gbm: wire up fence extension
authorRob Clark <robdclark@gmail.com>
Tue, 16 Aug 2016 16:56:45 +0000 (12:56 -0400)
committerRob Clark <robdclark@gmail.com>
Wed, 7 Sep 2016 15:54:00 +0000 (11:54 -0400)
v2: make fence extension optional to not break non-i965 classic
    drivers, and move __DRI2_FENCE into core extensions, based
    on comments from Emil

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/egl/drivers/dri2/platform_drm.c
src/gallium/state_trackers/dri/dri2.c
src/gbm/backends/dri/gbm_dri.c
src/gbm/backends/dri/gbm_driint.h

index e678db8991ed885d40cd141962e9fbfea07a957a..47add1250609cbaf395fa697c9d791da4afc06c8 100644 (file)
@@ -644,6 +644,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;
index f391c77b657c46406353f12fb1d8ffb7fe712a0d..43a5df11d0ac96e8bbb66d7791094a1d936512f0 100644 (file)
@@ -1991,6 +1991,7 @@ const __DRIextension *galliumdrm_driver_extensions[] = {
     &driImageDriverExtension.base,
     &driDRI2Extension.base,
     &gallium_config_options.base,
+    &dri2FenceExtension.base,
     NULL
 };
 
index 9c3a51b2b9de8e0eda133f151eccb7b07d5e0418..c1f9d62d36686c744f447d44b5584ba682773d18 100644 (file)
@@ -239,11 +239,13 @@ struct dri_extension_match {
    const char *name;
    int version;
    int offset;
+   int optional;
 };
 
 static struct dri_extension_match dri_core_extensions[] = {
    { __DRI2_FLUSH, 1, offsetof(struct gbm_dri_device, flush) },
    { __DRI_IMAGE, 1, offsetof(struct gbm_dri_device, image) },
+   { __DRI2_FENCE, 2, offsetof(struct gbm_dri_device, fence), 1 },
    { NULL, 0, 0 }
 };
 
@@ -279,7 +281,7 @@ dri_bind_extensions(struct gbm_dri_device *dri,
 
    for (j = 0; matches[j].name; j++) {
       field = ((char *) dri + matches[j].offset);
-      if (*(const __DRIextension **) field == NULL) {
+      if ((*(const __DRIextension **) field == NULL) && !matches[j].optional) {
          ret = -1;
       }
    }
index 46bb5c15619a120085ab28eee8b0aeabe6c32832..9c550074847c98563bc1e5c786b52816922a974a 100644 (file)
@@ -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;