[Lima] [PATCH rfc 1/3] egl, glx: query dri integer to expose EGL/GLX_EXT_buffer_age
Qiang Yu
yuq825 at gmail.com
Thu Jul 5 02:31:37 UTC 2018
Add __DRI2_RENDERER_EXPOSE_BUFFER_AGE dri integer query for
driver to determine if want to expose EGL/GLX_EXT_buffer_age.
Without knowing damage region first, some tile buffer based
GPU like ARM Mali Utgard has to load whole render target to
tile buffer before partitial update, then write them back.
Expose this extension will mis-lead application to use it
which will make performance worse for this kind of GPU.
EGL_KHR_partial_update is better choice for this kind of GPU.
Signed-off-by: Qiang Yu <yuq825 at gmail.com>
---
include/GL/internal/dri_interface.h | 2 ++
src/egl/drivers/dri2/egl_dri2.c | 3 +++
src/egl/drivers/dri2/platform_android.c | 1 -
src/egl/drivers/dri2/platform_drm.c | 4 ++--
src/egl/drivers/dri2/platform_wayland.c | 2 --
src/egl/drivers/dri2/platform_x11.c | 1 -
src/gallium/state_trackers/dri/dri_query_renderer.c | 3 +++
src/glx/dri3_glx.c | 12 +++++++++---
src/mesa/drivers/dri/i915/intel_screen.c | 3 +++
src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
src/mesa/drivers/dri/nouveau/nouveau_screen.c | 3 +++
src/mesa/drivers/dri/radeon/radeon_screen.c | 3 +++
src/mesa/drivers/dri/swrast/swrast.c | 3 +++
13 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 4f4795c7ae..9dd8a90381 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1856,6 +1856,8 @@ typedef struct __DRIDriverVtableExtensionRec {
#define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_MEDIUM (1 << 1)
#define __DRI2_RENDERER_HAS_CONTEXT_PRIORITY_HIGH (1 << 2)
+#define __DRI2_RENDERER_EXPOSE_BUFFER_AGE 0x000e
+
typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
struct __DRI2rendererQueryExtensionRec {
__DRIextension base;
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 45d0c7275c..8f91c91638 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -777,6 +777,9 @@ dri2_setup_screen(_EGLDisplay *disp)
if (dri2_dpy->flush_control)
disp->Extensions.KHR_context_flush_control = EGL_TRUE;
+
+ disp->Extensions.EXT_buffer_age =
+ dri2_renderer_query_integer(dri2_dpy, __DRI2_RENDERER_EXPOSE_BUFFER_AGE);
}
void
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 7f1a496ea2..d1ef070e6b 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1270,7 +1270,6 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
disp->Extensions.ANDROID_framebuffer_target = EGL_TRUE;
disp->Extensions.ANDROID_image_native_buffer = EGL_TRUE;
disp->Extensions.ANDROID_recordable = EGL_TRUE;
- disp->Extensions.EXT_buffer_age = EGL_TRUE;
#if ANDROID_API_LEVEL >= 23
disp->Extensions.KHR_partial_update = EGL_TRUE;
#endif
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index dc4efea910..e9f4a6a055 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -769,8 +769,8 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
}
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
- if (dri2_dpy->dri2)
- disp->Extensions.EXT_buffer_age = EGL_TRUE;
+ if (!dri2_dpy->dri2)
+ disp->Extensions.EXT_buffer_age = EGL_FALSE;
#ifdef HAVE_WAYLAND_PLATFORM
dri2_dpy->device_name = loader_get_device_name_for_fd(dri2_dpy->fd);
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 80853ac00b..78d9329f7e 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1433,8 +1433,6 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp)
if (!dri2_dpy->is_different_gpu)
disp->Extensions.WL_create_wayland_buffer_from_image = EGL_TRUE;
- disp->Extensions.EXT_buffer_age = EGL_TRUE;
-
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
/* Fill vtbl last to prevent accidentally calling virtual function during
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 60330b33df..3485ed1466 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1340,7 +1340,6 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
disp->Extensions.CHROMIUM_sync_control = EGL_TRUE;
- disp->Extensions.EXT_buffer_age = EGL_TRUE;
dri2_set_WL_bind_wayland_display(drv, disp);
diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c b/src/gallium/state_trackers/dri/dri_query_renderer.c
index 80847e3d31..a88658b573 100644
--- a/src/gallium/state_trackers/dri/dri_query_renderer.c
+++ b/src/gallium/state_trackers/dri/dri_query_renderer.c
@@ -62,6 +62,9 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param,
if (!value[0])
return -1;
return 0;
+ case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(_screen, param, value);
}
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index ce60b95c71..04d1594626 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -827,6 +827,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
char *driverName, *tmp;
int i;
unsigned char disable;
+ unsigned int enable = 1;
psc = calloc(1, sizeof *psc);
if (psc == NULL)
@@ -978,9 +979,14 @@ dri3_create_screen(int screen, struct glx_display * priv)
__glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer");
psp->getBufferAge = dri3_get_buffer_age;
- if (psc->config->configQueryb(psc->driScreen,
- "glx_disable_ext_buffer_age",
- &disable) || !disable)
+ if (psc->rendererQuery)
+ psc->rendererQuery->queryInteger(psc->driScreen,
+ __DRI2_RENDERER_EXPOSE_BUFFER_AGE,
+ &enable);
+ if (enable &&
+ (psc->config->configQueryb(psc->driScreen,
+ "glx_disable_ext_buffer_age",
+ &disable) || !disable))
__glXEnableDirectExtension(&psc->base, "GLX_EXT_buffer_age");
free(driverName);
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 5024a69bd4..4baaa14087 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -759,6 +759,9 @@ i915_query_renderer_integer(__DRIscreen *psp, int param, unsigned int *value)
case __DRI2_RENDERER_HAS_TEXTURE_3D:
value[0] = 1;
return 0;
+ case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(psp, param, value);
}
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 7f3c82fab8..17bb62f6e3 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1484,6 +1484,9 @@ brw_query_renderer_integer(__DRIscreen *dri_screen,
case __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB:
value[0] = 1;
return 0;
+ case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(dri_screen, param, value);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 95b3469daa..f92d0fc86b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -188,6 +188,9 @@ nouveau_query_renderer_integer(__DRIscreen *psp, int param,
case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
value[0] = 0;
return 0;
+ case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(psp, param, value);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 51af452e24..e32e5fd02d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -500,6 +500,9 @@ radeonQueryRendererInteger(__DRIscreen *psp, int param,
case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
value[0] = 0;
return 0;
+ case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(psp, param, value);
}
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index ae5874f592..80798d154f 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -178,6 +178,9 @@ swrast_query_renderer_integer(__DRIscreen *psp, int param,
*/
value[0] = 0;
return 0;
+ case __DRI2_RENDERER_EXPOSE_BUFFER_AGE:
+ value[0] = 1;
+ return 0;
default:
return driQueryRendererIntegerCommon(psp, param, value);
}
--
2.17.1
More information about the lima
mailing list