summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/GL/internal/dri_interface.h27
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c30
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h1
-rw-r--r--src/gbm/backends/dri/gbm_dri.c15
-rw-r--r--src/gbm/backends/dri/gbm_driint.h1
-rw-r--r--src/glx/dri2_glx.c23
-rw-r--r--src/glx/drisw_glx.c13
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c44
8 files changed, 119 insertions, 35 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 2122ae9ed48..a7afa224664 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -713,7 +713,7 @@ struct __DRIlegacyExtensionRec {
* conjunction with the core extension.
*/
#define __DRI_SWRAST "DRI_SWRast"
-#define __DRI_SWRAST_VERSION 3
+#define __DRI_SWRAST_VERSION 4
struct __DRIswrastExtensionRec {
__DRIextension base;
@@ -749,6 +749,18 @@ struct __DRIswrastExtensionRec {
const uint32_t *attribs,
unsigned *error,
void *loaderPrivate);
+
+ /**
+ * createNewScreen() with the driver extensions passed in.
+ *
+ * \since version 4
+ */
+ __DRIscreen *(*createNewScreen2)(int screen,
+ const __DRIextension **loader_extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs,
+ void *loaderPrivate);
+
};
/**
@@ -831,7 +843,7 @@ struct __DRIdri2LoaderExtensionRec {
* constructors for DRI2.
*/
#define __DRI_DRI2 "DRI_DRI2"
-#define __DRI_DRI2_VERSION 3
+#define __DRI_DRI2_VERSION 4
#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
#define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
@@ -939,6 +951,17 @@ struct __DRIdri2ExtensionRec {
const uint32_t *attribs,
unsigned *error,
void *loaderPrivate);
+
+ /**
+ * createNewScreen with the driver's extension list passed in.
+ *
+ * \since version 4
+ */
+ __DRIscreen *(*createNewScreen2)(int screen, int fd,
+ const __DRIextension **loader_extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs,
+ void *loaderPrivate);
};
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c2576846380..a64f4e8e9c2 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -449,6 +449,7 @@ dri2_load_driver(_EGLDisplay *disp)
dlclose(dri2_dpy->driver);
return EGL_FALSE;
}
+ dri2_dpy->driver_extensions = extensions;
return EGL_TRUE;
}
@@ -469,6 +470,7 @@ dri2_load_driver_swrast(_EGLDisplay *disp)
dlclose(dri2_dpy->driver);
return EGL_FALSE;
}
+ dri2_dpy->driver_extensions = extensions;
return EGL_TRUE;
}
@@ -534,14 +536,30 @@ dri2_create_screen(_EGLDisplay *disp)
dri2_dpy = disp->DriverData;
if (dri2_dpy->dri2) {
- dri2_dpy->dri_screen =
- dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions,
- &dri2_dpy->driver_configs, disp);
+ if (dri2_dpy->dri2->base.version >= 4) {
+ dri2_dpy->dri_screen =
+ dri2_dpy->dri2->createNewScreen2(0, dri2_dpy->fd,
+ dri2_dpy->extensions,
+ dri2_dpy->driver_extensions,
+ &dri2_dpy->driver_configs, disp);
+ } else {
+ dri2_dpy->dri_screen =
+ dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd,
+ dri2_dpy->extensions,
+ &dri2_dpy->driver_configs, disp);
+ }
} else {
assert(dri2_dpy->swrast);
- dri2_dpy->dri_screen =
- dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions,
- &dri2_dpy->driver_configs, disp);
+ if (dri2_dpy->swrast->base.version >= 4) {
+ dri2_dpy->dri_screen =
+ dri2_dpy->swrast->createNewScreen2(0, dri2_dpy->extensions,
+ dri2_dpy->driver_extensions,
+ &dri2_dpy->driver_configs, disp);
+ } else {
+ dri2_dpy->dri_screen =
+ dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions,
+ &dri2_dpy->driver_configs, disp);
+ }
}
if (dri2_dpy->dri_screen == NULL) {
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 4a39efbde09..c7d64846c7e 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,6 +118,7 @@ struct dri2_egl_display
__DRIdri2LoaderExtension dri2_loader_extension;
__DRIswrastLoaderExtension swrast_loader_extension;
const __DRIextension *extensions[4];
+ const __DRIextension **driver_extensions;
#ifdef HAVE_X11_PLATFORM
xcb_connection_t *conn;
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index ee05ed87256..e95fcc7b23c 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -228,7 +228,7 @@ dri_load_driver(struct gbm_dri_device *dri)
dlclose(dri->driver);
return -1;
}
-
+ dri->driver_extensions = extensions;
if (dri_bind_extensions(dri, gbm_dri_device_extensions, extensions) < 0) {
dlclose(dri->driver);
@@ -263,9 +263,16 @@ dri_screen_create(struct gbm_dri_device *dri)
if (dri->dri2 == NULL)
return -1;
- dri->screen = dri->dri2->createNewScreen(0, dri->base.base.fd,
- dri->extensions,
- &dri->driver_configs, dri);
+ if (dri->dri2->base.version >= 4) {
+ dri->screen = dri->dri2->createNewScreen2(0, dri->base.base.fd,
+ dri->extensions,
+ dri->driver_extensions,
+ &dri->driver_configs, dri);
+ } else {
+ dri->screen = dri->dri2->createNewScreen(0, dri->base.base.fd,
+ dri->extensions,
+ &dri->driver_configs, dri);
+ }
if (dri->screen == NULL)
return -1;
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 90d764fb44f..cb4e477abf4 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -53,6 +53,7 @@ struct gbm_dri_device {
const __DRIconfig **driver_configs;
const __DRIextension *extensions[4];
+ const __DRIextension **driver_extensions;
__DRIimage *(*lookup_image)(__DRIscreen *screen, void *image, void *data);
void *lookup_user_data;
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 7e22906318d..cfa5856484f 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1223,15 +1223,20 @@ dri2CreateScreen(int screen, struct glx_display * priv)
goto handle_error;
}
-
- /* If the server does not support the protocol for
- * DRI2GetBuffersWithFormat, don't supply that interface to the driver.
- */
- psc->driScreen =
- psc->dri2->createNewScreen(screen, psc->fd,
- (const __DRIextension **)
- &pdp->loader_extensions[0],
- &driver_configs, psc);
+ if (psc->dri2->base.version >= 4) {
+ psc->driScreen =
+ psc->dri2->createNewScreen2(screen, psc->fd,
+ (const __DRIextension **)
+ &pdp->loader_extensions[0],
+ extensions,
+ &driver_configs, psc);
+ } else {
+ psc->driScreen =
+ psc->dri2->createNewScreen(screen, psc->fd,
+ (const __DRIextension **)
+ &pdp->loader_extensions[0],
+ &driver_configs, psc);
+ }
if (psc->driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index a7d08434877..cb1d650b5c1 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -680,9 +680,16 @@ driswCreateScreen(int screen, struct glx_display *priv)
goto handle_error;
}
- psc->driScreen =
- psc->swrast->createNewScreen(screen, loader_extensions,
- &driver_configs, psc);
+ if (psc->swrast->base.version >= 4) {
+ psc->driScreen =
+ psc->swrast->createNewScreen2(screen, loader_extensions,
+ extensions,
+ &driver_configs, psc);
+ } else {
+ psc->driScreen =
+ psc->swrast->createNewScreen(screen, loader_extensions,
+ &driver_configs, psc);
+ }
if (psc->driScreen == NULL) {
ErrorMessageF("failed to create dri screen\n");
goto handle_error;
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index db44eede651..8a413daf043 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -89,9 +89,10 @@ setupLoaderExtensions(__DRIscreen *psp,
* Display.
*/
static __DRIscreen *
-dri2CreateNewScreen(int scrn, int fd,
- const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+dri2CreateNewScreen2(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
@@ -154,12 +155,31 @@ dri2CreateNewScreen(int scrn, int fd,
return psp;
}
+static __DRIscreen *
+dri2CreateNewScreen(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return dri2CreateNewScreen2(scrn, fd, extensions, NULL,
+ driver_configs, data);
+}
+
/** swrast driver createNewScreen entrypoint. */
static __DRIscreen *
-driCreateNewScreen(int scrn, const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+driSWRastCreateNewScreen(int scrn, const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return dri2CreateNewScreen2(scrn, -1, extensions, NULL,
+ driver_configs, data);
+}
+
+static __DRIscreen *
+driSWRastCreateNewScreen2(int scrn, const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
- return dri2CreateNewScreen(scrn, -1, extensions, driver_configs, data);
+ return dri2CreateNewScreen2(scrn, -1, extensions, driver_extensions,
+ driver_configs, data);
}
/**
@@ -688,7 +708,7 @@ const __DRIcoreExtension driCoreExtension = {
/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
- .base = { __DRI_DRI2, 3 },
+ .base = { __DRI_DRI2, 4 },
.createNewScreen = dri2CreateNewScreen,
.createNewDrawable = dri2CreateNewDrawable,
@@ -697,15 +717,17 @@ const __DRIdri2Extension driDRI2Extension = {
.createNewContextForAPI = dri2CreateNewContextForAPI,
.allocateBuffer = dri2AllocateBuffer,
.releaseBuffer = dri2ReleaseBuffer,
- .createContextAttribs = dri2CreateContextAttribs
+ .createContextAttribs = dri2CreateContextAttribs,
+ .createNewScreen2 = dri2CreateNewScreen2,
};
const __DRIswrastExtension driSWRastExtension = {
- { __DRI_SWRAST, __DRI_SWRAST_VERSION },
- driCreateNewScreen,
+ { __DRI_SWRAST, 4 },
+ driSWRastCreateNewScreen,
dri2CreateNewDrawable,
dri2CreateNewContextForAPI,
- dri2CreateContextAttribs
+ dri2CreateContextAttribs,
+ driSWRastCreateNewScreen2,
};
const __DRI2configQueryExtension dri2ConfigQueryExtension = {