From 0d152381a890b643a5d1f73fadd8bc9c737065d9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 8 Apr 2022 11:32:40 +0100 Subject: [PATCH] c/client: Move NOOP begin/end to EGL client --- src/xrt/compositor/client/comp_egl_client.c | 23 +++++++++++++++++++-- src/xrt/compositor/client/comp_gl_client.c | 19 +++++------------ 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/xrt/compositor/client/comp_egl_client.c b/src/xrt/compositor/client/comp_egl_client.c index b9f261806..4904cc06d 100644 --- a/src/xrt/compositor/client/comp_egl_client.c +++ b/src/xrt/compositor/client/comp_egl_client.c @@ -213,6 +213,19 @@ insert_fence_android_native(struct xrt_compositor *xc, xrt_graphics_sync_handle_ return XRT_SUCCESS; } +static xrt_result_t +client_egl_context_begin(struct xrt_compositor *xc) +{ + //! @todo Implement + return XRT_SUCCESS; +} + +static void +client_egl_context_end(struct xrt_compositor *xc) +{ + //! @todo Implement +} + static void client_egl_compositor_destroy(struct xrt_compositor *xc) { @@ -350,8 +363,14 @@ xrt_gfx_provider_create_gl_egl(struct xrt_compositor_native *xcn, insert_fence_func = insert_fence_android_native; } - //! @todo implement client_gl_context_begin_func and client_gl_context_end_func - if (!client_gl_compositor_init(&ceglc->base, xcn, NULL, NULL, sc_create, insert_fence_func)) { + bool bret = client_gl_compositor_init( // + &ceglc->base, // c + xcn, // xcn + client_egl_context_begin, // context_begin + client_egl_context_end, // context_end + sc_create, // create_swapchain + insert_fence_func); // insert_fence + if (!bret) { free(ceglc); EGL_ERROR("Failed to initialize compositor"); old_restore(&old, display); diff --git a/src/xrt/compositor/client/comp_gl_client.c b/src/xrt/compositor/client/comp_gl_client.c index f5c5b6875..fb50c9bff 100644 --- a/src/xrt/compositor/client/comp_gl_client.c +++ b/src/xrt/compositor/client/comp_gl_client.c @@ -490,18 +490,6 @@ client_gl_compositor_destroy(struct xrt_compositor *xc) assert(!"Destroy should be implemented by the winsys code that uses the GL code."); } -static xrt_result_t -client_gl_context_begin_nop(struct xrt_compositor *xc) -{ - return XRT_SUCCESS; -} - -static void -client_gl_context_end_nop(struct xrt_compositor *xc) -{ - // No return -} - /* * @@ -523,6 +511,9 @@ client_gl_compositor_init(struct client_gl_compositor *c, client_gl_swapchain_create_func create_swapchain, client_gl_insert_fence_func insert_fence) { + assert(context_begin != NULL); + assert(context_end != NULL); + c->base.base.create_swapchain = client_gl_swapchain_create; c->base.base.begin_session = client_gl_compositor_begin_session; c->base.base.end_session = client_gl_compositor_end_session; @@ -540,8 +531,8 @@ client_gl_compositor_init(struct client_gl_compositor *c, c->base.base.layer_commit = client_gl_compositor_layer_commit; c->base.base.destroy = client_gl_compositor_destroy; c->base.base.poll_events = client_gl_compositor_poll_events; - c->context_begin = context_begin ? context_begin : client_gl_context_begin_nop; - c->context_end = context_end ? context_end : client_gl_context_end_nop; + c->context_begin = context_begin; + c->context_end = context_end; c->create_swapchain = create_swapchain; c->insert_fence = insert_fence; c->xcn = xcn;