[Mesa-dev] [RFC] gbm: wire up fence extension

Rob Clark robdclark at gmail.com
Tue Aug 16 17:01:10 UTC 2016


I noticed that fence extension wasn't exposed for drm/gbm, which sort
of defeats the purpose of using fence fd's for synchronizing rendering
and atomic pageflip.

I suppose that somewhere or other, there needs to be a similar change
to .../state_trackers/dri/dri2.c to avoid breaking things on i965.
---
 src/egl/drivers/dri2/platform_drm.c   | 1 +
 src/gallium/state_trackers/dri/dri2.c | 1 +
 src/gbm/backends/dri/gbm_dri.c        | 1 +
 src/gbm/backends/dri/gbm_driint.h     | 1 +
 4 files changed, 4 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 1ce282f..7bea8e1 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -645,6 +645,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
    dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;
    dri2_dpy->core = dri2_dpy->gbm_dri->core;
    dri2_dpy->dri2 = dri2_dpy->gbm_dri->dri2;
+   dri2_dpy->fence = dri2_dpy->gbm_dri->fence;
    dri2_dpy->image = dri2_dpy->gbm_dri->image;
    dri2_dpy->flush = dri2_dpy->gbm_dri->flush;
    dri2_dpy->swrast = dri2_dpy->gbm_dri->swrast;
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 75d740b..8ad8701 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -2042,6 +2042,7 @@ const __DRIextension *galliumdrm_driver_extensions[] = {
     &driImageDriverExtension.base,
     &driDRI2Extension.base,
     &gallium_config_options.base,
+    &dri2FenceExtension.base,
     NULL
 };
 
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index c3626e3..d4602d1 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -250,6 +250,7 @@ static struct dri_extension_match dri_core_extensions[] = {
 static struct dri_extension_match gbm_dri_device_extensions[] = {
    { __DRI_CORE, 1, offsetof(struct gbm_dri_device, core) },
    { __DRI_DRI2, 1, offsetof(struct gbm_dri_device, dri2) },
+   { __DRI2_FENCE, 2, offsetof(struct gbm_dri_device, fence) },
    { NULL, 0, 0 }
 };
 
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 46bb5c1..9c55007 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -51,6 +51,7 @@ struct gbm_dri_device {
 
    const __DRIcoreExtension   *core;
    const __DRIdri2Extension   *dri2;
+   const __DRI2fenceExtension *fence;
    const __DRIimageExtension  *image;
    const __DRIswrastExtension *swrast;
    const __DRI2flushExtension *flush;
-- 
2.7.4



More information about the mesa-dev mailing list