summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Staplin <gstaplin@apple.com>2009-02-06 12:55:09 -0700
committerGeorge Staplin <gstaplin@apple.com>2009-02-06 12:55:09 -0700
commit58c4116c47543b5e30c2232e7bee8efc0b9be176 (patch)
treeb58f3e3c07f0767e13a61d7421ab5ba93cc2424d
parent0d5dd1501af35d8edcea5672b4cc539ce1251975 (diff)
XQuartz: xpr: The dri.c code for pixmaps was wrong in several ways. They weren't
being exported correctly by Xplugin. This should fix a bug with the surface for a window, when an export fails. Before the export could fail and leave behind an invalid (freed) pointer in the dix privates. I have an idea of how to fix the GLXPixmaps now without using CGLSetOffScreen. This work is a step towards that. The Xplugin will need a small patch to fix an issue that this change brought forth.
-rw-r--r--hw/xquartz/xpr/dri.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 50b478b9c..bcd0c65bc 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -410,3 +410,3 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
-/* Return FALSE if an error occurs. */
+/* Return NULL if an error occurs. */
static DRIDrawablePrivPtr
@@ -419,3 +419,2 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
xp_error err;
- xp_window_changes wc;
@@ -441,14 +440,6 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
- wc.x = 0;
- wc.y = 0;
- wc.width = pPix->drawable.width;
- wc.height = pPix->drawable.height;
-
- err = xp_configure_surface(pDRIDrawablePriv->sid, XP_BOUNDS, &wc);
-
- if(err != Success) {
- xp_destroy_surface(pDRIDrawablePriv->sid);
- xfree(pDRIDrawablePriv);
- return NULL;
- }
+ /*
+ * The DRIUpdateSurface will be called to resize the surface
+ * after this function, if the export is successful.
+ */
@@ -493,5 +484,4 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
}
-
-
+
/* Finish initialization of new surfaces */
@@ -502,3 +492,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
/* try to give the client access to the surface */
- if (client_id != 0 && wid != 0) {
+ if (client_id != 0) {
+ /*
+ * Xplugin accepts a 0 wid if the surface id is offscreen, such
+ * as for a pixmap.
+ */
err = xp_export_surface(wid, pDRIDrawablePriv->sid,
@@ -508,2 +502,17 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
xfree(pDRIDrawablePriv);
+
+ /*
+ * Now set the dix privates to NULL that were previously set.
+ * This prevents reusing an invalid pointer.
+ */
+ if(pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDrawable;
+
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
+ } else if(pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPix = (PixmapPtr)pDrawable;
+
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
+ }
+
return FALSE;