From 9399b9a0e27915dd5a388ff42ad99a9024c79b33 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 28 Aug 2009 12:52:16 +0100 Subject: util: Reset size to zero when failed to allocate buffer. --- src/gallium/auxiliary/util/u_upload_mgr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index c90425f3e5..eb635c9f14 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -123,21 +123,25 @@ static enum pipe_error u_upload_alloc_buffer( struct u_upload_mgr *upload, unsigned min_size ) { + unsigned size; + /* Release old buffer, if present: */ u_upload_flush( upload ); /* Allocate a new one: */ - upload->size = align(MAX2(upload->default_size, min_size), 4096); + size = align(MAX2(upload->default_size, min_size), 4096); upload->buffer = pipe_buffer_create( upload->screen, upload->alignment, upload->usage | PIPE_BUFFER_USAGE_CPU_WRITE, - upload->size ); + size ); if (upload->buffer == NULL) goto fail; + upload->size = size; + upload->offset = 0; return 0; -- cgit v1.2.3 From edb117879846155632aaeb66483a3085c7a78815 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sun, 30 Aug 2009 12:43:37 +0200 Subject: glx/x11: Fix glXCreateGLXPixmap for direct rendering. Fixes progs/xdemos/glxpixmap modified to use direct rendering. --- src/glx/x11/glxcmds.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 820d8b9868..3242ac7712 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -845,6 +845,34 @@ PUBLIC GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, req->glxpixmap = xid = XAllocID(dpy); UnlockDisplay(dpy); SyncHandle(); + +#ifdef GLX_DIRECT_RENDERING + do { + /* FIXME: Maybe delay __DRIdrawable creation until the drawable + * is actually bound to a context... */ + + __GLXdisplayPrivate *const priv = __glXInitialize(dpy); + __GLXDRIdrawable *pdraw; + __GLXscreenConfigs *psc; + __GLcontextModes *modes; + + psc = &priv->screenConfigs[vis->screen]; + if (psc->driScreen == NULL) + break; + modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid); + pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, modes); + if (pdraw == NULL) { + fprintf(stderr, "failed to create pixmap\n"); + break; + } + + if (__glxHashInsert(psc->drawHash, req->glxpixmap, pdraw)) { + (*pdraw->destroyDrawable) (pdraw); + return None; /* FIXME: Check what we're supposed to do here... */ + } + } while (0); +#endif + return xid; } -- cgit v1.2.3