diff options
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/drisw_glx.c | 32 | ||||
-rw-r--r-- | src/glx/glx_pbuffer.c | 19 | ||||
-rw-r--r-- | src/glx/glxclient.h | 8 | ||||
-rw-r--r-- | src/glx/glxcmds.c | 17 | ||||
-rw-r--r-- | src/glx/indirect_glx.c | 3 | ||||
-rw-r--r-- | src/glx/renderpix.c | 98 |
6 files changed, 64 insertions, 113 deletions
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 5c7f40cdffa..2eaa3c59348 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -128,13 +128,11 @@ swrastGetDrawableInfo(__DRIdrawable * draw, Drawable drawable; Window root; - Status stat; unsigned uw, uh, bw, depth; drawable = pdraw->xDrawable; - stat = XGetGeometry(dpy, drawable, &root, - x, y, &uw, &uh, &bw, &depth); + XGetGeometry(dpy, drawable, &root, x, y, &uw, &uh, &bw, &depth); *w = uw; *h = uh; } @@ -340,7 +338,7 @@ drisw_create_context(struct glx_screen *base, } static void -driDestroyDrawable(__GLXDRIdrawable * pdraw) +driswDestroyDrawable(__GLXDRIdrawable * pdraw) { struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw; struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc; @@ -352,8 +350,8 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw) } static __GLXDRIdrawable * -driCreateDrawable(struct glx_screen *base, XID xDrawable, - GLXDrawable drawable, struct glx_config *modes) +driswCreateDrawable(struct glx_screen *base, XID xDrawable, + GLXDrawable drawable, struct glx_config *modes) { struct drisw_drawable *pdp; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; @@ -386,14 +384,14 @@ driCreateDrawable(struct glx_screen *base, XID xDrawable, return NULL; } - pdp->base.destroyDrawable = driDestroyDrawable; + pdp->base.destroyDrawable = driswDestroyDrawable; return &pdp->base; } static int64_t -driSwapBuffers(__GLXDRIdrawable * pdraw, - int64_t target_msc, int64_t divisor, int64_t remainder) +driswSwapBuffers(__GLXDRIdrawable * pdraw, + int64_t target_msc, int64_t divisor, int64_t remainder) { struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw; struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc; @@ -408,7 +406,7 @@ driSwapBuffers(__GLXDRIdrawable * pdraw, } static void -driDestroyScreen(struct glx_screen *base) +driswDestroyScreen(struct glx_screen *base) { struct drisw_screen *psc = (struct drisw_screen *) base; @@ -439,7 +437,7 @@ static const struct glx_screen_vtable drisw_screen_vtable = { }; static struct glx_screen * -driCreateScreen(int screen, struct glx_display *priv) +driswCreateScreen(int screen, struct glx_display *priv) { __GLXDRIscreen *psp; const __DRIconfig **driver_configs; @@ -497,9 +495,9 @@ driCreateScreen(int screen, struct glx_display *priv) psc->base.vtable = &drisw_screen_vtable; psp = &psc->vtable; psc->base.driScreen = psp; - psp->destroyScreen = driDestroyScreen; - psp->createDrawable = driCreateDrawable; - psp->swapBuffers = driSwapBuffers; + psp->destroyScreen = driswDestroyScreen; + psp->createDrawable = driswCreateDrawable; + psp->swapBuffers = driswSwapBuffers; return &psc->base; @@ -517,7 +515,7 @@ driCreateScreen(int screen, struct glx_display *priv) /* Called from __glXFreeDisplayPrivate. */ static void -driDestroyDisplay(__GLXDRIdisplay * dpy) +driswDestroyDisplay(__GLXDRIdisplay * dpy) { Xfree(dpy); } @@ -536,8 +534,8 @@ driswCreateDisplay(Display * dpy) if (pdpyp == NULL) return NULL; - pdpyp->base.destroyDisplay = driDestroyDisplay; - pdpyp->base.createScreen = driCreateScreen; + pdpyp->base.destroyDisplay = driswDestroyDisplay; + pdpyp->base.createScreen = driswCreateScreen; return &pdpyp->base; } diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index ec54f1e09d6..5c76c74a2c1 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -77,9 +77,6 @@ warn_GLX_1_3(Display * dpy, const char *function_name) * \note * This function dynamically determines whether to use the SGIX_pbuffer * version of the protocol or the GLX 1.3 version of the protocol. - * - * \todo - * This function needs to be modified to work with direct-rendering drivers. */ static void ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable, @@ -265,9 +262,6 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable) * The number of attributes returned is likely to be small, probably less than * 10. Given that, this routine should try to use an array on the stack to * capture the reply rather than always calling Xmalloc. - * - * \todo - * This function needs to be modified to work with direct-rendering drivers. */ static int GetDrawableAttribute(Display * dpy, GLXDrawable drawable, @@ -372,9 +366,6 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, /** * Create a non-pbuffer GLX drawable. - * - * \todo - * This function needs to be modified to work with direct-rendering drivers. */ static GLXDrawable CreateDrawable(Display *dpy, struct glx_config *config, @@ -384,6 +375,7 @@ CreateDrawable(Display *dpy, struct glx_config *config, CARD32 *data; unsigned int i; CARD8 opcode; + GLXDrawable xid; i = 0; if (attrib_list) { @@ -404,7 +396,7 @@ CreateDrawable(Display *dpy, struct glx_config *config, req->screen = config->screen; req->fbconfig = config->fbconfigID; req->window = drawable; - req->glxwindow = XAllocID(dpy); + req->glxwindow = xid = XAllocID(dpy); req->numAttribs = i; if (attrib_list) @@ -413,9 +405,9 @@ CreateDrawable(Display *dpy, struct glx_config *config, UnlockDisplay(dpy); SyncHandle(); - CreateDRIDrawable(dpy, config, drawable, req->glxwindow, attrib_list, i); + CreateDRIDrawable(dpy, config, drawable, xid, attrib_list, i); - return req->glxwindow; + return xid; } @@ -462,9 +454,6 @@ DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode) * \note * This function dynamically determines whether to use the SGIX_pbuffer * version of the protocol or the GLX 1.3 version of the protocol. - * - * \todo - * This function needs to be modified to work with direct-rendering drivers. */ static GLXDrawable CreatePbuffer(Display * dpy, struct glx_config *config, diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 2b6966f2e08..a443f780672 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -310,14 +310,6 @@ struct glx_context /*@} */ /** - * This is \c GL_TRUE if the pixel unpack modes are such that an image - * can be unpacked from the clients memory by just copying. It may - * still be true that the server will have to do some work. This - * just promises that a straight copy will fetch the correct bytes. - */ - GLboolean fastImageUnpack; - - /** * Fill newImage with the unpacked form of \c oldImage getting it * ready for transport to the server. */ diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 22bebab26bc..8b4151d0b4b 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -200,19 +200,14 @@ glx_context_init(struct glx_context *gc, /** - * Create a new context. Exactly one of \c vis and \c fbconfig should be - * non-NULL. + * Create a new context. * - * \param use_glx_1_3 For FBConfigs, should GLX 1.3 protocol or - * SGIX_fbconfig protocol be used? * \param renderType For FBConfigs, what is the rendering type? */ static GLXContext -CreateContext(Display * dpy, int generic_id, - struct glx_config *config, - GLXContext shareList_user, - Bool allowDirect, +CreateContext(Display *dpy, int generic_id, struct glx_config *config, + GLXContext shareList_user, Bool allowDirect, unsigned code, int renderType, int screen) { struct glx_context *gc; @@ -649,13 +644,13 @@ glXCreateGLXPixmap(Display * dpy, XVisualInfo * vis, Pixmap pixmap) if (psc->driScreen == NULL) break; config = glx_config_find_visual(psc->visuals, vis->visualid); - pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, config); + pdraw = psc->driScreen->createDrawable(psc, pixmap, xid, config); if (pdraw == NULL) { fprintf(stderr, "failed to create pixmap\n"); break; } - if (__glxHashInsert(priv->drawHash, req->glxpixmap, pdraw)) { + if (__glxHashInsert(priv->drawHash, xid, pdraw)) { (*pdraw->destroyDrawable) (pdraw); return None; /* FIXME: Check what we're supposed to do here... */ } @@ -1895,7 +1890,7 @@ glXGetFBConfigFromVisualSGIX(Display * dpy, XVisualInfo * vis) struct glx_display *priv; struct glx_screen *psc = NULL; - if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) != Success) + if ((GetGLXPrivScreenConfig(dpy, vis->screen, &priv, &psc) == Success) && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit) && (psc->configs->fbconfigID != (int) GLX_DONT_CARE)) { return (GLXFBConfigSGIX) glx_config_find_visual(psc->configs, diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index 1870edee371..b4f16c72536 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -404,10 +404,7 @@ indirect_create_context(struct glx_screen *psc, /* ** PERFORMANCE NOTE: A mode dependent fill image can speed things up. - ** Other code uses the fastImageUnpack bit, but it is never set - ** to GL_TRUE. */ - gc->fastImageUnpack = GL_FALSE; gc->fillImage = __glFillImage; gc->pc = gc->buf; gc->bufEnd = gc->buf + bufSize; diff --git a/src/glx/renderpix.c b/src/glx/renderpix.c index 8234bbe21f6..b54f1155959 100644 --- a/src/glx/renderpix.c +++ b/src/glx/renderpix.c @@ -76,10 +76,6 @@ * Modify this function so that \c NULL images are sent using * \c __glXSendLargeChunk instead of __glXSendLargeCommand. Doing this * will eliminate the need to allocate a buffer for that case. - * - * \bugs - * The \c fastImageUnpack path, which is thankfully never used, is completely - * broken. */ void __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, @@ -87,48 +83,38 @@ __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, GLenum format, GLenum type, const GLvoid * src, GLubyte * pc, GLubyte * modes) { - if (!gc->fastImageUnpack || (src == NULL)) { - /* Allocate a temporary holding buffer */ - GLubyte *buf = (GLubyte *) Xmalloc(compsize); - if (!buf) { - __glXSetError(gc, GL_OUT_OF_MEMORY); - return; - } + /* Allocate a temporary holding buffer */ + GLubyte *buf = (GLubyte *) Xmalloc(compsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } - /* Apply pixel store unpack modes to copy data into buf */ - if (src != NULL) { - (*gc->fillImage) (gc, dim, width, height, depth, format, type, - src, buf, modes); - } - else { - if (dim < 3) { - (void) memcpy(modes, __glXDefaultPixelStore + 4, 20); - } - else { - (void) memcpy(modes, __glXDefaultPixelStore + 0, 36); - } - } + /* Apply pixel store unpack modes to copy data into buf */ + if (src != NULL) { + (*gc->fillImage) (gc, dim, width, height, depth, format, type, + src, buf, modes); + } + else { + if (dim < 3) { + (void) memcpy(modes, __glXDefaultPixelStore + 4, 20); + } + else { + (void) memcpy(modes, __glXDefaultPixelStore + 0, 36); + } + } - /* Send large command */ - __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize); - /* Free buffer */ - Xfree((char *) buf); - } - else { - /* Just send the data straight as is */ - __glXSendLargeCommand(gc, gc->pc, pc - gc->pc, pc, compsize); - } + /* Free buffer */ + Xfree((char *) buf); } /************************************************************************/ /** * Implement GLX protocol for \c glSeparableFilter2D. - * - * \bugs - * The \c fastImageUnpack path, which is thankfully never used, is completely - * broken. */ void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, @@ -177,6 +163,7 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, __GLX_END(0); } else { + GLubyte *buf; const GLint bufsize = image1len + image2len; /* Use GLXRenderLarge protocol to send command */ @@ -190,29 +177,22 @@ __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat, __GLX_PUT_LONG(20, type); pc += hdrlen; - if (!gc->fastImageUnpack) { - /* Allocate a temporary holding buffer */ - GLubyte *buf = (GLubyte *) Xmalloc(bufsize); - if (!buf) { - __glXSetError(gc, GL_OUT_OF_MEMORY); - return; - } - (*gc->fillImage) (gc, 1, width, 1, 1, format, type, row, buf, - pixelHeaderPC); + /* Allocate a temporary holding buffer */ + buf = (GLubyte *) Xmalloc(bufsize); + if (!buf) { + __glXSetError(gc, GL_OUT_OF_MEMORY); + return; + } + (*gc->fillImage) (gc, 1, width, 1, 1, format, type, row, buf, + pixelHeaderPC); - (*gc->fillImage) (gc, 1, height, 1, 1, format, type, column, - buf + image1len, pixelHeaderPC); + (*gc->fillImage) (gc, 1, height, 1, 1, format, type, column, + buf + image1len, pixelHeaderPC); - /* Send large command */ - __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf, - bufsize); - /* Free buffer */ - Xfree((char *) buf); - } - else { - /* Just send the data straight as is */ - __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), pc, - bufsize); - } + /* Send large command */ + __glXSendLargeCommand(gc, gc->pc, (GLint) (pc - gc->pc), buf, + bufsize); + /* Free buffer */ + Xfree((char *) buf); } } |