mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-01-23 14:13:42 +08:00
dri: Pass in the dlsym()ed driver extension to screen creation.
This will allow a megadrivers build to reference the actual driver being loaded from the shared dri_util screen creation code. v2: Fix indentation, fallback case in EGL (review by Emil). Reviewed-by: Matt Turner <mattst88@gmail.com> (v1) Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1) Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
67caf36489
commit
f93533d118
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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 dri2CreateNewScreen(scrn, -1, extensions, driver_configs, 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 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 = {
|
||||
|
Loading…
Reference in New Issue
Block a user