summaryrefslogtreecommitdiff
path: root/xserver/glx/glxdriswrast.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2017-12-08 15:02:03 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2017-12-08 15:02:03 +0000
commite2e6e25be1cbd7ecc45bbd9130c4527f7715e547 (patch)
tree85e40fcfbc819cb0394346c69db478a22e9ed122 /xserver/glx/glxdriswrast.c
parent63d0911c1d9f1be4f8755144bced468fcbc398a6 (diff)
Update to xserver 1.19.5.
Tested by bru@, jsg@ and others
Diffstat (limited to 'xserver/glx/glxdriswrast.c')
-rw-r--r--xserver/glx/glxdriswrast.c98
1 files changed, 41 insertions, 57 deletions
diff --git a/xserver/glx/glxdriswrast.c b/xserver/glx/glxdriswrast.c
index 924067c79..ed0469fd6 100644
--- a/xserver/glx/glxdriswrast.c
+++ b/xserver/glx/glxdriswrast.c
@@ -89,6 +89,9 @@ struct __GLXDRIdrawable {
GCPtr swapgc; /* GC for swapping the color buffers */
};
+/* white lie */
+extern glx_func_ptr glXGetProcAddressARB(const char *);
+
static void
__glXDRIdrawableDestroy(__GLXdrawable * drawable)
{
@@ -210,28 +213,6 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = {
__glXDRIreleaseTexImage
};
-static void
-__glXDRIscreenDestroy(__GLXscreen * baseScreen)
-{
- int i;
-
- __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
-
- (*screen->core->destroyScreen) (screen->driScreen);
-
- dlclose(screen->driver);
-
- __glXScreenDestroy(baseScreen);
-
- if (screen->driConfigs) {
- for (i = 0; screen->driConfigs[i] != NULL; i++)
- free((__DRIconfig **) screen->driConfigs[i]);
- free(screen->driConfigs);
- }
-
- free(screen);
-}
-
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
@@ -391,15 +372,16 @@ static const __DRIextension *loader_extensions[] = {
};
static void
-initializeExtensions(__GLXDRIscreen * screen)
+initializeExtensions(__GLXscreen * screen)
{
const __DRIextension **extensions;
+ __GLXDRIscreen *dri = (__GLXDRIscreen *)screen;
int i;
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
- LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
+ LogMessage(X_INFO, "IGLX: enabled GLX_MESA_copy_sub_buffer\n");
- if (screen->swrast->base.version >= 3) {
+ if (dri->swrast->base.version >= 3) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context");
__glXEnableExtension(screen->glx_enable_bits,
@@ -414,19 +396,18 @@ initializeExtensions(__GLXDRIscreen * screen)
__glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_framebuffer_sRGB");
__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float");
__glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_fbconfig_packed_float");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read");
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_texture_from_pixmap");
- extensions = screen->core->getExtensions(screen->driScreen);
+ extensions = dri->core->getExtensions(dri->driScreen);
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
- screen->copySubBuffer =
+ dri->copySubBuffer =
(const __DRIcopySubBufferExtension *) extensions[i];
}
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
- screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
- /* GLX_EXT_texture_from_pixmap is always enabled. */
+ dri->texBuffer = (const __DRItexBufferExtension *) extensions[i];
}
#ifdef __DRI2_FLUSH_CONTROL
@@ -439,15 +420,33 @@ initializeExtensions(__GLXDRIscreen * screen)
}
}
-/* white lie */
-extern glx_func_ptr glXGetProcAddressARB(const char *);
+static void
+__glXDRIscreenDestroy(__GLXscreen * baseScreen)
+{
+ int i;
+
+ __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
+
+ (*screen->core->destroyScreen) (screen->driScreen);
+
+ dlclose(screen->driver);
+
+ __glXScreenDestroy(baseScreen);
+
+ if (screen->driConfigs) {
+ for (i = 0; screen->driConfigs[i] != NULL; i++)
+ free((__DRIconfig **) screen->driConfigs[i]);
+ free(screen->driConfigs);
+ }
+
+ free(screen);
+}
static __GLXscreen *
__glXDRIscreenProbe(ScreenPtr pScreen)
{
const char *driverName = "swrast";
__GLXDRIscreen *screen;
- size_t buffer_size;
screen = calloc(1, sizeof *screen);
if (screen == NULL)
@@ -459,7 +458,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->base.swapInterval = NULL;
screen->base.pScreen = pScreen;
- __glXInitExtensionEnableBits(screen->glx_enable_bits);
+ __glXInitExtensionEnableBits(screen->base.glx_enable_bits);
screen->driver = glxProbeDriver(driverName,
(void **) &screen->core,
@@ -476,38 +475,23 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
&screen->driConfigs, screen);
if (screen->driScreen == NULL) {
- LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed\n");
+ LogMessage(X_ERROR, "IGLX error: Calling driver entry point failed\n");
goto handle_error;
}
- initializeExtensions(screen);
+ initializeExtensions(&screen->base);
- screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
- GLX_WINDOW_BIT |
- GLX_PIXMAP_BIT |
- GLX_PBUFFER_BIT);
+ screen->base.fbconfigs = glxConvertConfigs(screen->core,
+ screen->driConfigs);
+#if !defined(XQUARTZ) && !defined(WIN32)
+ screen->base.glvnd = strdup("mesa");
+#endif
__glXScreenInit(&screen->base, pScreen);
- /* The first call simply determines the length of the extension string.
- * This allows us to allocate some memory to hold the extension string,
- * but it requires that we call __glXGetExtensionString a second time.
- */
- buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
- if (buffer_size > 0) {
- free(screen->base.GLXextensions);
-
- screen->base.GLXextensions = xnfalloc(buffer_size);
- (void) __glXGetExtensionString(screen->glx_enable_bits,
- screen->base.GLXextensions);
- }
-
- screen->base.GLXmajor = 1;
- screen->base.GLXminor = 4;
-
__glXsetGetProcAddress(glXGetProcAddressARB);
- LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
+ LogMessage(X_INFO, "IGLX: Loaded and initialized %s\n", driverName);
return &screen->base;