aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx/glxdri.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx/glxdri.c')
-rw-r--r--xorg-server/glx/glxdri.c74
1 files changed, 51 insertions, 23 deletions
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index 52a97d4c4..64606ab5a 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -103,7 +103,7 @@ struct __GLXDRIdrawable {
#ifdef __DRI_TEX_OFFSET
GLint texname;
__GLXDRIcontext *ctx;
- unsigned long offset;
+ unsigned long long offset;
DamagePtr pDamage;
#endif
};
@@ -238,16 +238,9 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
__glXleaveServer(GL_FALSE);
}
- xfree(private);
-}
+ __glXDrawableRelease(drawable);
-static GLboolean
-__glXDRIdrawableResize(__GLXdrawable *glxPriv)
-{
- /* Nothing to do here, the DRI driver asks the server for drawable
- * geometry when it sess the SAREA timestamps change.*/
-
- return GL_TRUE;
+ xfree(private);
}
static GLboolean
@@ -372,6 +365,21 @@ glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
}
}
+static Bool
+testTexOffset(__GLXDRIscreen * const screen, PixmapPtr pPixmap)
+{
+ Bool ret;
+
+ if (!screen->texOffsetStart || !screen->texOffset)
+ return FALSE;
+
+ __glXenterServer(GL_FALSE);
+ ret = screen->texOffsetStart(pPixmap) != ~0ULL;
+ __glXleaveServer(GL_FALSE);
+
+ return ret;
+}
+
/*
* (sticking this here for lack of a better place)
* Known issues with the GLX_EXT_texture_from_pixmap implementation:
@@ -407,7 +415,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
pixmap = (PixmapPtr) glxPixmap->pDraw;
- if (screen->texOffsetStart && screen->texOffset) {
+ if (testTexOffset(screen, pixmap)) {
__GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride;
int i, firstEmpty = 16;
@@ -624,11 +632,10 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
if (baseShareContext && baseShareContext->isDirect)
return NULL;
- context = xalloc(sizeof *context);
+ context = xcalloc(1, sizeof *context);
if (context == NULL)
return NULL;
- memset(context, 0, sizeof *context);
context->base.destroy = __glXDRIcontextDestroy;
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
@@ -642,7 +649,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
if (visual->vid == glxConfig->visualID)
break;
if (i == pScreen->numVisuals)
- return GL_FALSE;
+ return NULL;
context->hwContextID = FakeClientID(0);
@@ -651,6 +658,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
context->hwContextID, &hwContext);
__glXleaveServer(GL_FALSE);
+ if (!retval)
+ return NULL;
+
context->driContext =
screen->legacy->createNewContext(screen->driScreen,
config->driConfig,
@@ -683,12 +693,10 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
GLboolean retval;
drm_drawable_t hwDrawable;
- private = xalloc(sizeof *private);
+ private = xcalloc(1, sizeof *private);
if (private == NULL)
return NULL;
- memset(private, 0, sizeof *private);
-
if (!__glXDrawableInit(&private->base, screen,
pDraw, type, drawId, glxConfig)) {
xfree(private);
@@ -696,15 +704,21 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
}
private->base.destroy = __glXDRIdrawableDestroy;
- private->base.resize = __glXDRIdrawableResize;
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
+ private->base.waitX = NULL;
+ private->base.waitGL = NULL;
__glXenterServer(GL_FALSE);
retval = DRICreateDrawable(screen->pScreen, serverClient,
pDraw, &hwDrawable);
__glXleaveServer(GL_FALSE);
+ if (!retval) {
+ xfree(private);
+ return NULL;
+ }
+
/* The last argument is 'attrs', which is used with pbuffers which
* we currently don't support. */
@@ -752,7 +766,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
numBackClipRects, &pBackClipRects);
__glXleaveServer(GL_FALSE);
- if (*numClipRects > 0) {
+ if (retval && *numClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numClipRects;
*ppClipRects = xalloc (size);
@@ -783,16 +797,20 @@ getDrawableInfo(__DRIdrawable *driDrawable,
}
else {
*ppClipRects = NULL;
+ *numClipRects = 0;
}
- if (*numBackClipRects > 0) {
+ if (retval && *numBackClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numBackClipRects;
*ppBackClipRects = xalloc (size);
if (*ppBackClipRects != NULL)
memcpy (*ppBackClipRects, pBackClipRects, size);
+ else
+ *numBackClipRects = 0;
}
else {
*ppBackClipRects = NULL;
+ *numBackClipRects = 0;
}
return retval;
@@ -812,7 +830,9 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
REGION_INIT(pDraw->pScreen, &region, (BoxPtr) rects, num_rects);
REGION_TRANSLATE(pScreen, &region, pDraw->x, pDraw->y);
- DamageDamageRegion(pDraw, &region);
+ DamageRegionAppend(pDraw, &region);
+ /* This is wrong, this needs a seperate function. */
+ DamageRegionProcessPending(pDraw);
REGION_UNINIT(pDraw->pScreen, &region);
__glXleaveServer(GL_FALSE);
@@ -877,6 +897,15 @@ initializeExtensions(__GLXDRIscreen *screen)
extensions = screen->core->getExtensions(screen->driScreen);
for (i = 0; extensions[i]; i++) {
+#ifdef __DRI_READ_DRAWABLE
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_SGI_make_current_read");
+
+ LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n");
+ }
+#endif
+
#ifdef __DRI_COPY_SUB_BUFFER
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
@@ -947,10 +976,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
return NULL;
}
- screen = xalloc(sizeof *screen);
+ screen = xcalloc(1, sizeof *screen);
if (screen == NULL)
return NULL;
- memset(screen, 0, sizeof *screen);
screen->base.destroy = __glXDRIscreenDestroy;
screen->base.createContext = __glXDRIscreenCreateContext;