egl: inline fallback for query_buffer_age
authorEric Engestrom <eric@engestrom.ch>
Fri, 10 Jul 2020 22:40:57 +0000 (00:40 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 16 Jul 2020 22:11:25 +0000 (22:11 +0000)
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>

src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/egl_dri2_fallbacks.h
src/egl/drivers/dri2/platform_device.c
src/egl/drivers/dri2/platform_surfaceless.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c

index e118509..08c9198 100644 (file)
@@ -2067,6 +2067,8 @@ static EGLint
 dri2_query_buffer_age(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   if (!dri2_dpy->vtbl->query_buffer_age)
+      return 0;
    return dri2_dpy->vtbl->query_buffer_age(drv, disp, surf);
 }
 
index 485097f..de21579 100644 (file)
@@ -140,6 +140,7 @@ struct dri2_egl_display_vtbl {
    EGLBoolean (*copy_buffers)(_EGLDriver *drv, _EGLDisplay *disp,
                               _EGLSurface *surf, void *native_pixmap_target);
 
+   /* optional */
    EGLint (*query_buffer_age)(_EGLDriver *drv, _EGLDisplay *disp,
                               _EGLSurface *surf);
 
index 0456a4b..6609aa2 100644 (file)
 
 struct wl_buffer;
 
-static inline EGLint
-dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *disp,
-                               _EGLSurface *surf)
-{
-   return 0;
-}
-
 static inline struct wl_buffer*
 dri2_fallback_create_wayland_buffer_from_image(_EGLDriver *drv,
                                                _EGLDisplay *disp,
index 01aac6a..c1ed30c 100644 (file)
@@ -186,7 +186,6 @@ static const struct dri2_egl_display_vtbl dri2_device_display_vtbl = {
    .create_pbuffer_surface = dri2_device_create_pbuffer_surface,
    .destroy_surface = device_destroy_surface,
    .create_image = dri2_create_image_khr,
-   .query_buffer_age = dri2_fallback_query_buffer_age,
    .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
    .get_sync_values = dri2_fallback_get_sync_values,
    .get_dri_drawable = dri2_surface_get_dri_drawable,
index cbcb3f5..c8ef1dc 100644 (file)
@@ -180,7 +180,6 @@ static const struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = {
    .create_pbuffer_surface = dri2_surfaceless_create_pbuffer_surface,
    .destroy_surface = surfaceless_destroy_surface,
    .create_image = dri2_create_image_khr,
-   .query_buffer_age = dri2_fallback_query_buffer_age,
    .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
    .get_sync_values = dri2_fallback_get_sync_values,
    .get_dri_drawable = dri2_surface_get_dri_drawable,
index 41d1b45..285c0b7 100644 (file)
@@ -2002,7 +2002,6 @@ static const struct dri2_egl_display_vtbl dri2_wl_swrast_display_vtbl = {
    .destroy_surface = dri2_wl_destroy_surface,
    .create_image = dri2_create_image_khr,
    .swap_buffers = dri2_wl_swrast_swap_buffers,
-   .query_buffer_age = dri2_fallback_query_buffer_age,
    .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
    .get_sync_values = dri2_fallback_get_sync_values,
    .get_dri_drawable = dri2_surface_get_dri_drawable,
index 65cb4c5..b9b28ec 100644 (file)
@@ -1182,7 +1182,6 @@ static const struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
    .create_image = dri2_create_image_khr,
    .swap_buffers = dri2_x11_swap_buffers,
    /* XXX: should really implement this since X11 has pixmaps */
-   .query_buffer_age = dri2_fallback_query_buffer_age,
    .query_surface = dri2_query_surface,
    .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
    .get_sync_values = dri2_fallback_get_sync_values,
@@ -1201,7 +1200,6 @@ static const struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .swap_buffers_region = dri2_x11_swap_buffers_region,
    .post_sub_buffer = dri2_x11_post_sub_buffer,
    .copy_buffers = dri2_x11_copy_buffers,
-   .query_buffer_age = dri2_fallback_query_buffer_age,
    .query_surface = dri2_query_surface,
    .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image,
    .get_sync_values = dri2_x11_get_sync_values,