From 3b050af311cb2599b035491f9f90ef5483f19657 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 30 Jul 2024 09:49:00 -0400 Subject: [PATCH] egl: inline DRI2_FLUSH usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/egl/drivers/dri2/egl_dri2.c | 5 ++--- src/egl/drivers/dri2/platform_android.c | 8 ++------ src/egl/drivers/dri2/platform_drm.c | 2 +- src/egl/drivers/dri2/platform_wayland.c | 8 +++----- src/egl/drivers/dri2/platform_x11.c | 8 ++++---- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 1636e89c374..d5d43057250 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1723,8 +1723,7 @@ dri2_flush_drawable_for_swapbuffers_flags( * "The contents of ancillary buffers are always undefined * after calling eglSwapBuffers." */ - dri2_dpy->flush->flush_with_flags( - dri2_ctx->dri_context, dri_drawable, + dri_flush(dri2_ctx->dri_context, dri_drawable, __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_INVALIDATE_ANCILLARY, throttle_reason); } @@ -1874,7 +1873,7 @@ dri2_wait_client(_EGLDisplay *disp, _EGLContext *ctx) * we need to copy fake to real here.*/ if (!dri2_dpy->swrast_not_kms) - dri2_dpy->flush->flush(dri_drawable); + dri_flush_drawable(dri_drawable); return EGL_TRUE; } diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index e04dfeee204..8b1a3824fba 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -616,7 +616,6 @@ droid_query_buffer_age(_EGLDisplay *disp, _EGLSurface *surface) static EGLBoolean droid_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw) { - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); const bool has_mutable_rb = _eglSurfaceHasMutableRenderBuffer(draw); @@ -655,7 +654,7 @@ droid_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw) if (dri2_surf->buffer) droid_window_enqueue_buffer(disp, dri2_surf); - dri2_dpy->flush->invalidate(dri2_surf->dri_drawable); + dri_invalidate_drawable(dri2_surf->dri_drawable); /* Update the shared buffer mode */ if (has_mutable_rb && @@ -924,9 +923,6 @@ droid_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd, if (ANativeWindow_dequeueBuffer(dri2_surf->window, &dri2_surf->buffer, &fence_fd)) { /* Tear down the surface because it no longer has a back buffer. */ - struct dri2_egl_display *dri2_dpy = - dri2_egl_display(dri2_surf->base.Resource.Display); - _eglLog(_EGL_WARNING, "%s: ANativeWindow_dequeueBuffer failed", __func__); dri2_surf->base.Lost = true; @@ -938,7 +934,7 @@ droid_display_shared_buffer(__DRIdrawable *driDrawable, int fence_fd, dri2_surf->dri_image_back = NULL; } - dri2_dpy->flush->invalidate(dri2_surf->dri_drawable); + dri_invalidate_drawable(dri2_surf->dri_drawable); return; } diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index f07306f0487..9487434b90d 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -330,7 +330,7 @@ dri2_drm_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw) * call get_back_bo (eg: through dri2_drm_image_get_buffers). */ dri2_flush_drawable_for_swapbuffers(disp, draw); - dri2_dpy->flush->invalidate(dri2_surf->dri_drawable); + dri_invalidate_drawable(dri2_surf->dri_drawable); /* Make sure we have a back buffer in case we're swapping without * ever rendering. */ diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 0c240f1b765..7e57e77acd2 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -417,8 +417,6 @@ static void resize_callback(struct wl_egl_window *wl_win, void *data) { struct dri2_egl_surface *dri2_surf = data; - struct dri2_egl_display *dri2_dpy = - dri2_egl_display(dri2_surf->base.Resource.Display); if (dri2_surf->base.Width == wl_win->width && dri2_surf->base.Height == wl_win->height) @@ -437,7 +435,7 @@ resize_callback(struct wl_egl_window *wl_win, void *data) dri2_surf->base.Width = wl_win->width; dri2_surf->base.Height = wl_win->height; } - dri2_dpy->flush->invalidate(dri2_surf->dri_drawable); + dri_invalidate_drawable(dri2_surf->dri_drawable); } static void @@ -1638,7 +1636,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw, * and glthread causes troubles (see #7624 and #8136) */ dri2_flush_drawable_for_swapbuffers(disp, draw); - dri2_dpy->flush->invalidate(dri2_surf->dri_drawable); + dri_invalidate_drawable(dri2_surf->dri_drawable); while (dri2_surf->throttle_callback != NULL) if (loader_wayland_dispatch(dri2_dpy->wl_dpy, dri2_surf->wl_queue, NULL) == @@ -1714,7 +1712,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw, if (dri2_dpy->flush) { __DRIdrawable *dri_drawable = dri2_dpy->vtbl->get_dri_drawable(draw); - dri2_dpy->flush->flush(dri_drawable); + dri_flush_drawable(dri_drawable); } } diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index f5d877719d1..4607b1106f6 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -617,7 +617,7 @@ dri2_query_surface(_EGLDisplay *disp, _EGLSurface *surf, EGLint attribute, surf->Width = w; surf->Height = h; if (changed && dri2_dpy->flush) - dri2_dpy->flush->invalidate(drawable); + dri_invalidate_drawable(drawable); } break; default: @@ -1034,7 +1034,7 @@ dri2_copy_region(_EGLDisplay *disp, _EGLSurface *draw, return EGL_TRUE; assert(!dri2_dpy->kopper); - dri2_dpy->flush->flush(dri2_surf->dri_drawable); + dri_flush_drawable(dri2_surf->dri_drawable); if (dri2_surf->have_fake_front) render_attachment = XCB_DRI2_ATTACHMENT_BUFFER_FAKE_FRONT_LEFT; @@ -1093,7 +1093,7 @@ dri2_x11_swap_buffers_msc(_EGLDisplay *disp, _EGLSurface *draw, int64_t msc, * happened. The driver should still be using the viewport hack to catch * window resizes. */ - dri2_dpy->flush->invalidate(dri2_surf->dri_drawable); + dri_invalidate_drawable(dri2_surf->dri_drawable); return swap_count; } @@ -1241,7 +1241,7 @@ dri2_x11_copy_buffers(_EGLDisplay *disp, _EGLSurface *surf, target = (uintptr_t)native_pixmap_target; if (dri2_dpy->flush) - dri2_dpy->flush->flush(dri2_surf->dri_drawable); + dri_flush_drawable(dri2_surf->dri_drawable); else { /* This should not be a swapBuffers, because it could present an * incomplete frame, and it could invalidate the back buffer if it's not