diff --git a/packages/libxcb-errors/build.sh b/packages/libxcb-errors/build.sh new file mode 100644 index 00000000000000..c4f61ae64eae35 --- /dev/null +++ b/packages/libxcb-errors/build.sh @@ -0,0 +1,12 @@ +TERMUX_PKG_HOMEPAGE=https://gitlab.freedesktop.org/xorg/lib/libxcb-errors +TERMUX_PKG_DESCRIPTION="XCB utility library that gives human readable names to error, event, & request codes." +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION="1.0.1" +TERMUX_PKG_GIT_BRANCH="xcb-util-errors-${TERMUX_PKG_VERSION}" +TERMUX_PKG_SRCURL=git+https://gitlab.freedesktop.org/xorg/lib/libxcb-errors +TERMUX_PKG_BUILD_DEPENDS="libxcb, xcb-proto" + +termux_step_pre_configure() { + autoreconf -fi +} diff --git a/packages/mesa/0010-virgl-direct-connection-to-x-server.patch b/packages/mesa/0010-virgl-direct-connection-to-x-server.patch new file mode 100644 index 00000000000000..e5fc79668a8d60 --- /dev/null +++ b/packages/mesa/0010-virgl-direct-connection-to-x-server.patch @@ -0,0 +1,196 @@ ++++ ./src/virtio/virtio-gpu/virgl_hw.h +@@ -587,6 +587,7 @@ + #define VIRGL_CAP_V2_GROUP_VOTE (1 << 15) + #define VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE (1 << 16) + #define VIRGL_CAP_V2_MIRROR_CLAMP (1 << 17) ++#define VIRGL_CAP_V2_DIRECT_CONNECTION_TO_X_SERVER (1u << 31) + + /* virgl bind flags - these are compatible with mesa 10.5 gallium. + * but are fixed, no other should be passed to virgl either. ++++ ./src/virtio/vtest/vtest_protocol.h +@@ -84,6 +84,8 @@ + #define VCMD_SUBMIT_CMD2 24 + #endif /* VIRGL_RENDERER_UNSTABLE_APIS */ + ++#define VCMD_DRAW_TO_X_SERVER_DRAWABLE 48 ++ + #define VCMD_RES_CREATE_SIZE 10 + #define VCMD_RES_CREATE_RES_HANDLE 0 /* must be 0 since protocol version 3 */ + #define VCMD_RES_CREATE_TARGET 1 +@@ -243,4 +245,6 @@ + + #endif /* VIRGL_RENDERER_UNSTABLE_APIS */ + ++#define VCMD_DRAW_TO_X_SERVER_DRAWABLE_SIZE 2 ++ + #endif /* VTEST_PROTOCOL */ ++++ ./src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h +@@ -50,6 +50,7 @@ + mtx_t mutex; + + unsigned protocol_version; ++ unsigned direct_x_server_connection_supported; + }; + + struct virgl_hw_res { +@@ -154,4 +155,6 @@ + + int virgl_vtest_busy_wait(struct virgl_vtest_winsys *vws, int handle, + int flags); ++ ++int virgl_vtest_send_draw_to_x_server_drawable(struct virgl_vtest_winsys *vws, uint32_t res_id, uint32_t handle); + #endif ++++ ./src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c +@@ -544,3 +544,17 @@ + assert(ret); + return result[0]; + } ++ ++int virgl_vtest_send_draw_to_x_server_drawable(struct virgl_vtest_winsys *vws, uint32_t res_id, uint32_t handle) ++{ ++ uint32_t vtest_hdr[VTEST_HDR_SIZE]; ++ uint32_t cmd[2]; ++ vtest_hdr[VTEST_CMD_LEN] = 2; ++ vtest_hdr[VTEST_CMD_ID] = VCMD_DRAW_TO_X_SERVER_DRAWABLE; ++ ++ cmd[0] = res_id; ++ cmd[1] = handle; ++ virgl_block_write(vws->sock_fd, &vtest_hdr, sizeof(vtest_hdr)); ++ virgl_block_write(vws->sock_fd, &cmd, sizeof(cmd)); ++ return 0; ++} ++++ ./src/gallium/include/mesa_interface.h 2024-11-24 21:33:02.048266004 +0200 +@@ -644,6 +644,8 @@ + unsigned char (*getImageShm2)(__DRIdrawable *readable, + int x, int y, int width, int height, + int shmid, void *loaderPrivate); ++ ++ uint32_t (*getDrawable)(void *loaderPrivate); + }; + + /** ++++ ./src/glx/drisw_glx.c +@@ -349,6 +349,12 @@ + swrastGetImageShm2(read, x, y, w, h, shmid, loaderPrivate); + } + ++static uint32_t ++swrastGetDrawable(void *loaderPrivate) ++{ ++ return ((struct drisw_drawable*) loaderPrivate)->base.xDrawable; ++} ++ + static const __DRIswrastLoaderExtension swrastLoaderExtension_shm = { + .base = {__DRI_SWRAST_LOADER, 6 }, + +@@ -361,6 +367,7 @@ + .getImageShm = swrastGetImageShm, + .putImageShm2 = swrastPutImageShm2, + .getImageShm2 = swrastGetImageShm2, ++ .getDrawable = swrastGetDrawable, + }; + + static const __DRIswrastLoaderExtension swrastLoaderExtension = { +@@ -371,6 +378,7 @@ + .getImage = swrastGetImage, + .putImage2 = swrastPutImage2, + .getImage2 = swrastGetImage2, ++ .getDrawable = swrastGetDrawable, + }; + + static_assert(sizeof(struct kopper_vk_surface_create_storage) >= sizeof(VkXcbSurfaceCreateInfoKHR), ""); ++++ ./src/gallium/include/frontend/drisw_api.h +@@ -22,6 +22,7 @@ + void (*put_image_shm) (struct dri_drawable *dri_drawable, + int shmid, char *shmaddr, unsigned offset, unsigned offset_x, + int x, int y, unsigned width, unsigned height, unsigned stride); ++ uint32_t (*get_drawable) (struct dri_drawable *dri_drawable); + }; + + #endif ++++ ./src/gallium/frontends/dri/drisw.c +@@ -188,6 +188,13 @@ + put_image_shm(drawable, shmid, shmaddr, offset, offset_x, x, y, width, height, stride); + } + ++static inline uint32_t ++drisw_get_drawable(struct dri_drawable *drawable) ++{ ++ const __DRIswrastLoaderExtension *loader = drawable->screen->swrast_loader; ++ return loader->getDrawable(drawable->loaderPrivate); ++} ++ + static inline void + drisw_present_texture(struct pipe_context *pipe, struct dri_drawable *drawable, + struct pipe_resource *ptex, unsigned nrects, struct pipe_box *sub_box) +@@ -543,12 +550,14 @@ + }; + + static const struct drisw_loader_funcs drisw_lf = { ++ .get_drawable = drisw_get_drawable, + .get_image = drisw_get_image, + .put_image = drisw_put_image, + .put_image2 = drisw_put_image2 + }; + + static const struct drisw_loader_funcs drisw_shm_lf = { ++ .get_drawable = drisw_get_drawable, + .get_image = drisw_get_image, + .put_image = drisw_put_image, + .put_image2 = drisw_put_image2, ++++ ./src/gallium/include/frontend/sw_winsys.h +@@ -146,6 +146,8 @@ + unsigned width, unsigned height, + unsigned stride, + void *data ); ++ ++ uint32_t (*displaytarget_get_drawable)( struct sw_winsys *ws, void *context_private); + }; + + ++++ ./src/gallium/winsys/sw/dri/dri_sw_winsys.c 2024-11-24 21:56:05.806775337 +0200 +@@ -380,6 +380,13 @@ + FREE(winsys); + } + ++static uint32_t ++dri_sw_displaytarget_get_drawable(struct sw_winsys *ws, void *priv) ++{ ++ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws); ++ return dri_sw_ws->lf->get_drawable((struct dri_drawable*) priv); ++} ++ + struct sw_winsys * + dri_create_sw_winsys(const struct drisw_loader_funcs *lf) + { +@@ -406,6 +413,7 @@ + ws->base.displaytarget_unmap = dri_sw_displaytarget_unmap; + + ws->base.displaytarget_display = dri_sw_displaytarget_display; ++ ws->base.displaytarget_get_drawable = dri_sw_displaytarget_get_drawable; + + return &ws->base; + } ++++ ./src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c +@@ -593,6 +593,8 @@ + // vtest doesn't support that + if (caps->caps.v2.capability_bits_v2 & VIRGL_CAP_V2_COPY_TRANSFER_BOTH_DIRECTIONS) + caps->caps.v2.capability_bits_v2 &= ~VIRGL_CAP_V2_COPY_TRANSFER_BOTH_DIRECTIONS; ++ if (caps->caps.v2.capability_bits_v2 & VIRGL_CAP_V2_DIRECT_CONNECTION_TO_X_SERVER) ++ vtws->direct_x_server_connection_supported = true; + return ret; + } + +@@ -647,6 +649,12 @@ + if (!res->dt) + return; + ++ if (vtws->direct_x_server_connection_supported) { ++ virgl_vtest_send_draw_to_x_server_drawable(vtws, res->res_handle, vtws->sws->displaytarget_get_drawable(vtws->sws, winsys_drawable_handle)); ++ virgl_vtest_busy_wait(vtws, res->res_handle, VCMD_BUSY_WAIT_FLAG_WAIT); ++ return; ++ } ++ + memset(&box, 0, sizeof(box)); + + if (sub_box) { diff --git a/packages/mesa/build.sh b/packages/mesa/build.sh index 7151fff6beeeff..cec1fde5654818 100644 --- a/packages/mesa/build.sh +++ b/packages/mesa/build.sh @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_LICENSE_FILE="docs/license.rst" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="24.2.7" +TERMUX_PKG_REVISION=1 _LLVM_MAJOR_VERSION=$(. $TERMUX_SCRIPTDIR/packages/libllvm/build.sh; echo $LLVM_MAJOR_VERSION) _LLVM_MAJOR_VERSION_NEXT=$((_LLVM_MAJOR_VERSION + 1)) TERMUX_PKG_SRCURL=https://archive.mesa3d.org/mesa-${TERMUX_PKG_VERSION}.tar.xz diff --git a/packages/virglrenderer-android/0007-Ensure-EGL-GLES-ANGLE-help-and-socket-path.patch.beforehostbuild b/packages/virglrenderer-android/0007-Ensure-EGL-GLES-ANGLE-help-and-socket-path.patch.beforehostbuild index da41a49cc99359..d15337eba58d3b 100644 --- a/packages/virglrenderer-android/0007-Ensure-EGL-GLES-ANGLE-help-and-socket-path.patch.beforehostbuild +++ b/packages/virglrenderer-android/0007-Ensure-EGL-GLES-ANGLE-help-and-socket-path.patch.beforehostbuild @@ -89,7 +89,7 @@ default: printf("Usage: %s [--no-fork] [--no-loop-or-fork] [--multi-clients] " - "[--use-glx] [--use-egl-surfaceless] [--use-gles] [--no-virgl]" -+ "[--angle-gl] [--angle-gl] [--angle-null] " ++ "[--angle-gl] [--angle-vulkan] [--angle-null] " "[--rendernode ] [--socket-path ] " "%s" " [file]\n", argv[0], ven); diff --git a/packages/virglrenderer-android/0009-direct-connection-to-x-server.patch.beforehostbuild b/packages/virglrenderer-android/0009-direct-connection-to-x-server.patch.beforehostbuild new file mode 100644 index 00000000000000..6fcc21e6581a4f --- /dev/null +++ b/packages/virglrenderer-android/0009-direct-connection-to-x-server.patch.beforehostbuild @@ -0,0 +1,305 @@ ++++ ./src/virgl_hw.h +@@ -587,6 +587,7 @@ + #define VIRGL_CAP_V2_DRAW_PARAMETERS (1u << 14) + #define VIRGL_CAP_V2_GROUP_VOTE (1u << 15) + #define VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE (1u << 16) ++#define VIRGL_CAP_V2_DIRECT_CONNECTION_TO_X_SERVER (1u << 31) + + /* virgl bind flags - these are compatible with mesa 10.5 gallium. + * but are fixed, no other should be passed to virgl either. ++++ ./vtest/vtest_protocol.h +@@ -78,6 +78,8 @@ + #define VCMD_SYNC_WAIT 23 + #define VCMD_SUBMIT_CMD2 24 + ++#define VCMD_DRAW_TO_X_SERVER_DRAWABLE 48 ++ + #define VCMD_RES_CREATE_SIZE 10 + #define VCMD_RES_CREATE_RES_HANDLE 0 /* must be 0 since protocol version 3 */ + #define VCMD_RES_CREATE_TARGET 1 +@@ -233,4 +235,6 @@ + #define VCMD_SUBMIT_CMD2_BATCH_SYNC_COUNT(n) (1 + 8 * (n) + 4) + #define VCMD_SUBMIT_CMD2_BATCH_RING_IDX(n) (1 + 8 * (n) + 5) + ++#define VCMD_DRAW_TO_X_SERVER_DRAWABLE_SIZE 2 ++ + #endif /* VTEST_PROTOCOL */ ++++ ./vtest/vtest.h +@@ -97,6 +97,8 @@ + + int vtest_submit_cmd2(uint32_t length_dw); + ++int vtest_draw_to_x_server_drawable(uint32_t length_dw); ++ + void vtest_set_max_length(uint32_t length); + + #endif ++++ ./vtest/vtest_server.c +@@ -733,6 +733,8 @@ + [VCMD_SYNC_WRITE] = { vtest_sync_write, true }, + [VCMD_SYNC_WAIT] = { vtest_sync_wait, true }, + [VCMD_SUBMIT_CMD2] = { vtest_submit_cmd2, true }, ++ ++ [VCMD_DRAW_TO_X_SERVER_DRAWABLE] = { vtest_draw_to_x_server_drawable, true }, + }; + + static int vtest_client_dispatch_commands(struct vtest_client *client) ++++ ./vtest/vtest_renderer.c +@@ -1089,6 +1089,9 @@ + return report_failed_call("vtest_send_fd", ret); + } + ++ if (args->bind & VIRGL_BIND_DISPLAY_TARGET) ++ virgl_renderer_attach_shm_fd(res->res_id, fd); ++ + /* Closing the file descriptor does not unmap the region. */ + close(fd); + +@@ -2135,6 +2138,28 @@ + return 0; + } + ++int vtest_draw_to_x_server_drawable(UNUSED uint32_t length_dw) ++{ ++ struct vtest_context *ctx = vtest_get_current_context(); ++ uint32_t buf[VCMD_DRAW_TO_X_SERVER_DRAWABLE_SIZE]; ++ struct vtest_resource *res = NULL; ++ int ret = -1; ++ ++ ret = ctx->input->read(ctx->input, buf, sizeof(buf)); ++ if (ret != sizeof(buf)) { ++ return -1; ++ } ++ ++ uint32_t handle = buf[0]; ++ uint32_t drawable = buf[1]; ++ ++ res = util_hash_table_get(ctx->resource_table, intptr_to_pointer(handle)); ++ if (!res) ++ return report_failed_call("util_hash_table_get", -ESRCH); ++ ++ return virgl_renderer_draw_to_x_server_drawable(res->res_id, ctx->ctx_id, drawable); ++} ++ + void vtest_set_max_length(uint32_t length) + { + renderer.max_length = length; ++++ ./src/virglrenderer.h +@@ -306,6 +306,9 @@ + struct iovec *iovec, + unsigned int iovec_cnt); + ++VIRGL_EXPORT int virgl_renderer_attach_shm_fd(uint32_t handle, int fd); ++VIRGL_EXPORT int virgl_renderer_draw_to_x_server_drawable(uint32_t handle, uint32_t ctx_id, uint32_t drawable); ++ + VIRGL_EXPORT void virgl_renderer_get_cap_set(uint32_t set, uint32_t *max_ver, + uint32_t *max_size); + ++++ ./src/virglrenderer.c +@@ -299,6 +299,20 @@ + return ctx->submit_cmd(ctx, buffer, ndw * sizeof(uint32_t)); + } + ++VIRGL_EXPORT int virgl_renderer_attach_shm_fd(uint32_t handle, int fd) { ++ TRACE_FUNC(); ++ ++ struct virgl_resource *res = virgl_resource_lookup(handle); ++ return vrend_renderer_attach_shm_fd(res->pipe_resource, fd); ++} ++ ++VIRGL_EXPORT int virgl_renderer_draw_to_x_server_drawable(uint32_t handle, uint32_t ctx_id, uint32_t drawable) { ++ TRACE_FUNC(); ++ ++ struct virgl_resource *res = virgl_resource_lookup(handle); ++ return vrend_renderer_draw_to_x_server_drawable(res->pipe_resource, virgl_context_lookup(ctx_id), drawable); ++} ++ + int virgl_renderer_transfer_write_iov(uint32_t handle, + uint32_t ctx_id, + int level, ++++ ./src/vrend_decode.c +@@ -53,6 +53,10 @@ + struct vrend_context *grctx; + }; + ++struct vrend_context* vrend_context_get_from_virgl(struct virgl_context* ctx) { ++ return ctx == NULL ? NULL : ((struct vrend_decode_ctx*) ctx)->grctx; ++} ++ + static inline uint32_t get_buf_entry(const uint32_t *buf, uint32_t offset) + { + return buf[offset]; ++++ ./src/vrend_renderer.h +@@ -108,6 +108,7 @@ + uint32_t blob_id; + struct list_head head; + bool is_imported; ++ uint32_t shm_seg, pixmap; + }; + + #define VIRGL_TEXTURE_NEED_SWIZZLE (1 << 0) +@@ -634,5 +635,8 @@ + int + vrend_renderer_resource_d3d11_texture2d(struct pipe_resource *res, void **handle); + + ++struct vrend_context* vrend_context_get_from_virgl(struct virgl_context* ctx); ++int vrend_renderer_attach_shm_fd(struct pipe_resource *res, int fd); ++int vrend_renderer_draw_to_x_server_drawable(struct pipe_resource *res, struct virgl_context* ctx, uint32_t drawable); + #endif ++++ ./src/vrend_renderer.c 2024-11-25 19:44:35.525876727 +0200 +@@ -65,6 +65,11 @@ + + #include "tgsi/tgsi_text.h" + ++#include ++#include ++#include ++#include ++ + #ifdef HAVE_EPOXY_GLX_H + #include + #endif +@@ -368,6 +373,13 @@ + int gl_major_ver; + int gl_minor_ver; + ++ struct { ++ xcb_connection_t* conn; ++ xcb_errors_context_t *err_ctx; ++ xcb_window_t root; ++ xcb_gcontext_t gc; ++ } xcb; ++ + mtx_t fence_mutex; + thrd_t sync_thread; + virgl_gl_context sync_context; +@@ -7579,6 +7591,22 @@ + /* make sure you have the latest version of libepoxy */ + gles = epoxy_is_desktop_gl() == 0; + ++ vrend_state.xcb.conn = getenv("DISPLAY") ? xcb_connect(NULL, NULL) : NULL; ++ if (xcb_connection_has_error(vrend_state.xcb.conn)) { ++ virgl_error("Failed to connect X server: %d\n", xcb_connection_has_error(vrend_state.xcb.conn)); ++ xcb_disconnect(vrend_state.xcb.conn); ++ vrend_state.xcb.conn = NULL; ++ } ++ ++ if (vrend_state.xcb.conn) { ++ xcb_errors_context_new(vrend_state.xcb.conn, &vrend_state.xcb.err_ctx); ++ xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(vrend_state.xcb.conn)).data; ++ vrend_state.xcb.root = screen->root; ++ vrend_state.xcb.gc = xcb_generate_id(vrend_state.xcb.conn); ++ xcb_create_gc(vrend_state.xcb.conn, vrend_state.xcb.gc, screen->root, XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES, (const uint32_t[]) {screen->black_pixel, 0}); ++ xcb_flush(vrend_state.xcb.conn); ++ } ++ + vrend_state.gl_major_ver = gl_ver / 10; + vrend_state.gl_minor_ver = gl_ver % 10; + +@@ -8846,6 +8874,15 @@ + if (res->d3d_tex2d) + res->d3d_tex2d->lpVtbl->Release(res->d3d_tex2d); + #endif ++ ++ if (vrend_state.xcb.conn) { ++ if (res->pixmap) ++ xcb_free_pixmap(vrend_state.xcb.conn, res->pixmap); ++ if (res->shm_seg) ++ xcb_shm_detach(vrend_state.xcb.conn, res->shm_seg); ++ xcb_flush(vrend_state.xcb.conn); ++ } ++ + free(res); + } + +@@ -12696,6 +12733,9 @@ + if (has_feature(feat_texture_mirror_clamp_to_edge)) + caps->v2.capability_bits_v2 |= VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE; + ++ if (vrend_state.xcb.conn) ++ caps->v2.capability_bits_v2 |= VIRGL_CAP_V2_DIRECT_CONNECTION_TO_X_SERVER; ++ + #ifdef ENABLE_VIDEO + vrend_video_fill_caps(caps); + #else +@@ -13536,3 +13576,79 @@ + return ctx->video; + } + #endif ++ ++static void vrend_renderer_handle_xcb_error(xcb_generic_error_t *e) { ++ xcb_errors_context_t *ctx = vrend_state.xcb.err_ctx; ++ const char* ext = NULL; ++ const char* err_name = xcb_errors_get_name_for_error(ctx, e->error_code, &ext); ++ const char* err_code_name = xcb_errors_get_name_for_minor_code(ctx, e->major_code, e->minor_code); ++ dprintf(2, "" ++ "XCB Error of failed request: %s::%s\n" ++ " Major opcode of failed request: %hhu(%s)\n" ++ " Minor opcode of failed request: %hu(%s)\n" ++ " Serial number of failed request: %d\n" ++ " Current serial number in output stream: %d\n", ++ (ext ? ext : ""), err_name, e->major_code, xcb_errors_get_name_for_major_code(ctx, e->major_code), ++ e->minor_code, (err_code_name ? err_code_name : "Core"), ++ e->sequence, e->full_sequence); ++} ++ ++int vrend_renderer_attach_shm_fd(struct pipe_resource *pres, int fd) { ++ struct vrend_resource *res = (struct vrend_resource *)pres; ++ xcb_generic_error_t *error = NULL; ++ ++ if (!res) ++ return EINVAL; ++ ++ if (vrend_state.xcb.conn == NULL) ++ return 0; ++ ++ res->shm_seg = xcb_generate_id(vrend_state.xcb.conn); ++ error = xcb_request_check(vrend_state.xcb.conn, xcb_shm_attach_fd_checked(vrend_state.xcb.conn, res->shm_seg, fcntl(fd, F_DUPFD_CLOEXEC, 0), 0)); ++ if (error) { ++ vrend_renderer_handle_xcb_error(error); ++ free(error); ++ res->pixmap = 0; ++ return ENOMEM; ++ } ++ ++ res->pixmap = xcb_generate_id(vrend_state.xcb.conn); ++ error = xcb_request_check(vrend_state.xcb.conn, xcb_shm_create_pixmap(vrend_state.xcb.conn, res->pixmap, vrend_state.xcb.root, res->base.width0, res->base.height0, 24, res->shm_seg, 0)); ++ if (error) { ++ vrend_renderer_handle_xcb_error(error); ++ free(error); ++ xcb_shm_detach(vrend_state.xcb.conn, res->shm_seg); ++ xcb_flush(vrend_state.xcb.conn); ++ res->shm_seg = res->pixmap = 0; ++ return ENOMEM; ++ } ++ return 0; ++} ++ ++int vrend_renderer_draw_to_x_server_drawable(struct pipe_resource *pres, struct virgl_context* ctx, uint32_t drawable) { ++ struct vrend_resource *res = (struct vrend_resource *)pres; ++ struct vrend_transfer_info transfer_info = {0}; ++ xcb_generic_error_t *error = NULL; ++ struct pipe_box box = {0}; ++ int ret = 0; ++ ++ if (!vrend_state.xcb.conn) ++ return ESRCH; ++ ++ if (!res) ++ return EINVAL; ++ ++ transfer_info.stride = util_format_get_nblocksx(pres->format, pres->width0) * util_format_get_blocksize(pres->format); ++ transfer_info.box = &box; ++ box.width = pres->width0; ++ box.height = pres->height0; ++ box.depth = 1; ++ ++ if ((ret = vrend_renderer_transfer_internal(vrend_context_get_from_virgl(ctx), res, &transfer_info, VIRGL_TRANSFER_FROM_HOST))) ++ return ret; ++ ++ xcb_copy_area(vrend_state.xcb.conn, res->pixmap, drawable, vrend_state.xcb.gc, 0, 0, 0, 0, pres->width0, pres->height0); ++ xcb_flush(vrend_state.xcb.conn); ++ ++ return 0; ++} diff --git a/packages/virglrenderer-android/build.sh b/packages/virglrenderer-android/build.sh index 86f6380736ffac..c72c9624e22fef 100644 --- a/packages/virglrenderer-android/build.sh +++ b/packages/virglrenderer-android/build.sh @@ -4,7 +4,7 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@licy183" TERMUX_PKG_VERSION="1.0.1" _LIBEPOXY_VERSION="1.5.10" -TERMUX_PKG_REVISION=3 +TERMUX_PKG_REVISION=4 TERMUX_PKG_SRCURL=( https://gitlab.freedesktop.org/virgl/virglrenderer/-/archive/virglrenderer-${TERMUX_PKG_VERSION}/virglrenderer-virglrenderer-${TERMUX_PKG_VERSION}.tar.gz https://github.com/anholt/libepoxy/archive/refs/tags/${_LIBEPOXY_VERSION}.tar.gz @@ -13,7 +13,7 @@ TERMUX_PKG_SHA256=( 446ab3e265f574ec598e77bdfbf0616ee3c77361f0574bec733ba4bac4df730a a7ced37f4102b745ac86d6a70a9da399cc139ff168ba6b8002b4d8d43c900c15 ) -TERMUX_PKG_DEPENDS="angle-android" +TERMUX_PKG_DEPENDS="angle-android, libxcb-errors" TERMUX_PKG_HOSTBUILD=true termux_step_post_get_source() { @@ -46,9 +46,9 @@ termux_step_host_build() { CXX=$(command -v $CCTERMUX_HOST_PLATFORM-clang++) LD=$(command -v ld.lld) CFLAGS="" - CPPFLAGS="" + CPPFLAGS="-I$TERMUX_PREFIX/include" CXXFLAGS="" - LDFLAGS="-Wl,-rpath=$_INSTALL_PREFIX/lib" + LDFLAGS="-Wl,-rpath=$_INSTALL_PREFIX/lib -Wl,-rpath=$TERMUX_PREFIX/lib -L$TERMUX_PREFIX/lib -lxcb -lxcb-shm -lxcb-errors" STRIP=$(command -v llvm-strip) termux_setup_meson