summaryrefslogtreecommitdiffstats
path: root/src/glx/drisw_glx.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-05-29 13:04:03 +1000
committerDave Airlie <[email protected]>2018-05-30 09:11:54 +1000
commitd3ff4787322c5855aad1e9ee0ee0aa141f7d6420 (patch)
tree8ee040b7fece3d0b8174fcc8d0f86904fbb0e252 /src/glx/drisw_glx.c
parent33ce3aa512fa9c8313003f61516588e1ae3e5f8f (diff)
glx/drisw: make the shm/non-shm loader extensions separately.
I disliked removing the const here, function tables are meant to be const just to avoid having to think about them, make a second table for the shm vs non-shm paths to use. Reviewed-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/glx/drisw_glx.c')
-rw-r--r--src/glx/drisw_glx.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 3ff6a9617fc..a2777100a32 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -339,7 +339,7 @@ swrastGetImageShm(__DRIdrawable * read,
XShmGetImage(dpy, readable, ximage, x, y, ~0L);
}
-static __DRIswrastLoaderExtension swrastLoaderExtension = {
+static const __DRIswrastLoaderExtension swrastLoaderExtension_shm = {
.base = {__DRI_SWRAST_LOADER, 4 },
.getDrawableInfo = swrastGetDrawableInfo,
@@ -351,7 +351,22 @@ static __DRIswrastLoaderExtension swrastLoaderExtension = {
.getImageShm = swrastGetImageShm,
};
-static const __DRIextension *loader_extensions[] = {
+static const __DRIextension *loader_extensions_shm[] = {
+ &swrastLoaderExtension_shm.base,
+ NULL
+};
+
+static const __DRIswrastLoaderExtension swrastLoaderExtension = {
+ .base = {__DRI_SWRAST_LOADER, 3 },
+
+ .getDrawableInfo = swrastGetDrawableInfo,
+ .putImage = swrastPutImage,
+ .getImage = swrastGetImage,
+ .putImage2 = swrastPutImage2,
+ .getImage2 = swrastGetImage2,
+};
+
+static const __DRIextension *loader_extensions_noshm[] = {
&swrastLoaderExtension.base,
NULL
};
@@ -811,6 +826,7 @@ driswCreateScreen(int screen, struct glx_display *priv)
struct drisw_screen *psc;
struct glx_config *configs = NULL, *visuals = NULL;
int i;
+ const __DRIextension **loader_extensions_local;
psc = calloc(1, sizeof *psc);
if (psc == NULL)
@@ -829,10 +845,10 @@ driswCreateScreen(int screen, struct glx_display *priv)
if (extensions == NULL)
goto handle_error;
- if (!check_xshm(psc->base.dpy)) {
- swrastLoaderExtension.putImageShm = NULL;
- swrastLoaderExtension.getImageShm = NULL;
- }
+ if (!check_xshm(psc->base.dpy))
+ loader_extensions_local = loader_extensions_noshm;
+ else
+ loader_extensions_local = loader_extensions_shm;
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
@@ -850,12 +866,12 @@ driswCreateScreen(int screen, struct glx_display *priv)
if (psc->swrast->base.version >= 4) {
psc->driScreen =
- psc->swrast->createNewScreen2(screen, loader_extensions,
+ psc->swrast->createNewScreen2(screen, loader_extensions_local,
extensions,
&driver_configs, psc);
} else {
psc->driScreen =
- psc->swrast->createNewScreen(screen, loader_extensions,
+ psc->swrast->createNewScreen(screen, loader_extensions_local,
&driver_configs, psc);
}
if (psc->driScreen == NULL) {