diff options
Diffstat (limited to 'src/glx/x11')
-rw-r--r-- | src/glx/x11/dri2_glx.c | 20 | ||||
-rw-r--r-- | src/glx/x11/dri_glx.c | 56 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 3 |
3 files changed, 50 insertions, 29 deletions
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index 9c8f1101b9e..b6eeb913b66 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -74,7 +74,6 @@ struct __GLXDRIdrawablePrivateRec { int bufferCount; int width, height; int have_back; - int have_front; int have_fake_front; }; @@ -195,7 +194,7 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw, XserverRegion region; /* Check we have the right attachments */ - if (!(priv->have_front && priv->have_back)) + if (!priv->have_back) return; xrect.x = x; @@ -229,7 +228,7 @@ static void dri2WaitX(__GLXDRIdrawable *pdraw) XserverRegion region; /* Check we have the right attachments */ - if (!(priv->have_fake_front && priv->have_front)) + if (!priv->have_fake_front) return; xrect.x = 0; @@ -254,7 +253,7 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw) XRectangle xrect; XserverRegion region; - if (!(priv->have_fake_front && priv->have_front)) + if (!priv->have_fake_front) return; xrect.x = 0; @@ -273,6 +272,15 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw) XFixesDestroyRegion(pdraw->psc->dpy, region); } + +static void dri2FlushFrontBuffer(__DRIdrawable *driDrawable, + void *loaderPrivate) +{ + (void) driDrawable; + dri2WaitGL((__GLXDRIdrawable *) loaderPrivate); +} + + static void dri2DestroyScreen(__GLXscreenConfigs *psc) { /* Free the direct rendering per screen data */ @@ -299,7 +307,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable, pdraw->width = *width; pdraw->height = *height; pdraw->bufferCount = *out_count; - pdraw->have_front = 0; pdraw->have_fake_front = 0; pdraw->have_back = 0; @@ -311,8 +318,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable, pdraw->buffers[i].pitch = buffers[i].pitch; pdraw->buffers[i].cpp = buffers[i].cpp; pdraw->buffers[i].flags = buffers[i].flags; - if (pdraw->buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT) - pdraw->have_front = 1; if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) pdraw->have_fake_front = 1; if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT) @@ -327,6 +332,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable, static const __DRIdri2LoaderExtension dri2LoaderExtension = { { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION }, dri2GetBuffers, + dri2FlushFrontBuffer }; static const __DRIextension *loader_extensions[] = { diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 3089aa17285..87d62ad8468 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -40,6 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glxclient.h" #include "glcontextmodes.h" #include "xf86dri.h" +#include "dri2.h" #include "sarea.h" #include <dlfcn.h> #include <sys/types.h> @@ -75,32 +76,45 @@ struct __GLXDRIcontextPrivateRec { */ static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName) { - int directCapable; - Bool b; - int driverMajor, driverMinor, driverPatch; + int directCapable; + Bool b; + int event, error; + int driverMajor, driverMinor, driverPatch; - *driverName = NULL; + *driverName = NULL; - if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { - ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n"); - return False; - } - if (!directCapable) { - ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n"); - return False; - } + if (XF86DRIQueryExtension(dpy, &event, &error)) { /* DRI1 */ + if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { + ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n"); + return False; + } + if (!directCapable) { + ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n"); + return False; + } - b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, - &driverPatch, driverName); - if (!b) { - ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum); - return False; - } + b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, + &driverPatch, driverName); + if (!b) { + ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum); + return False; + } + + InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", + driverMajor, driverMinor, driverPatch, *driverName, scrNum); + + return True; + } else if (DRI2QueryExtension(dpy, &event, &error)) { /* DRI2 */ + char *dev; + Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev); - InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", - driverMajor, driverMinor, driverPatch, *driverName, scrNum); + if (ret) + Xfree(dev); + + return ret; + } - return True; + return False; } /* diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index e5c0db4c968..b9e0706d312 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1702,7 +1702,8 @@ PUBLIC GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) int i; *nelements = 0; - if ( (priv->screenConfigs != NULL) + if ( priv + && (priv->screenConfigs != NULL) && (screen >= 0) && (screen <= ScreenCount(dpy)) && (priv->screenConfigs[screen].configs != NULL) && (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE) ) { |