X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2Fglx_pbuffer.c;h=24c073cb9baa72ea35f9e696f1d2c794408e9ac7;hb=a73116ecc60414ade89802150b707b3336d8d50f;hp=411d6e572f1c5ad66b72e43776bbeff3554ebcd8;hpb=e503609e6feb9373ec3bba4ff028a66f1517be30;p=mesa.git diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c index 411d6e572f1..24c073cb9ba 100644 --- a/src/glx/glx_pbuffer.c +++ b/src/glx/glx_pbuffer.c @@ -39,7 +39,7 @@ #ifdef GLX_USE_APPLEGL #include -#include "apple_glx_drawable.h" +#include "apple/apple_glx_drawable.h" #endif #include "glx_error.h" @@ -285,6 +285,10 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, unsigned int num_attributes; GLboolean use_glx_1_3; +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) + __GLXDRIdrawable *pdraw; +#endif + if (dpy == NULL) return 0; @@ -311,6 +315,36 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, if (!opcode) return 0; +#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) + pdraw = GetGLXDRIDrawable(dpy, drawable); + + if (attribute == GLX_BACK_BUFFER_AGE_EXT) { + struct glx_context *gc = __glXGetCurrentContext(); + struct glx_screen *psc; + + /* The GLX_EXT_buffer_age spec says: + * + * "If querying GLX_BACK_BUFFER_AGE_EXT and is not bound to + * the calling thread's current context a GLXBadDrawable error is + * generated." + */ + if (pdraw == NULL || gc == &dummyContext || gc->currentDpy != dpy || + (gc->currentDrawable != drawable && + gc->currentReadable != drawable)) { + __glXSendError(dpy, GLXBadDrawable, drawable, + X_GLXGetDrawableAttributes, false); + return 0; + } + + psc = pdraw->psc; + + if (psc->driScreen->getBufferAge != NULL) + *value = psc->driScreen->getBufferAge(pdraw); + + return 0; + } +#endif + LockDisplay(dpy); if (use_glx_1_3) { @@ -363,13 +397,11 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable, } #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) - { - __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable); - - if (pdraw != NULL && !pdraw->textureTarget) + if (pdraw != NULL) { + if (!pdraw->textureTarget) pdraw->textureTarget = determineTextureTarget((const int *) data, num_attributes); - if (pdraw != NULL && !pdraw->textureFormat) + if (!pdraw->textureFormat) pdraw->textureFormat = determineTextureFormat((const int *) data, num_attributes); } @@ -647,7 +679,7 @@ DestroyPbuffer(Display * dpy, GLXDrawable drawable) /** * Create a new pbuffer. */ -_X_EXPORT GLXPbufferSGIX +_GLX_PUBLIC GLXPbufferSGIX glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) @@ -662,7 +694,7 @@ glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config, /** * Create a new pbuffer. */ -_X_EXPORT GLXPbuffer +_GLX_PUBLIC GLXPbuffer glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list) { int i, width, height; @@ -737,7 +769,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list) /** * Destroy an existing pbuffer. */ -_X_EXPORT void +_GLX_PUBLIC void glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf) { #ifdef GLX_USE_APPLEGL @@ -753,7 +785,7 @@ glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf) /** * Query an attribute of a drawable. */ -_X_EXPORT void +_GLX_PUBLIC void glXQueryDrawable(Display * dpy, GLXDrawable drawable, int attribute, unsigned int *value) { @@ -802,7 +834,7 @@ glXQueryDrawable(Display * dpy, GLXDrawable drawable, /** * Query an attribute of a pbuffer. */ -_X_EXPORT int +_GLX_PUBLIC int glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable, int attribute, unsigned int *value) { @@ -813,7 +845,7 @@ glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable, /** * Select the event mask for a drawable. */ -_X_EXPORT void +_GLX_PUBLIC void glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask) { #ifdef GLX_USE_APPLEGL @@ -846,7 +878,7 @@ glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask) /** * Get the selected event mask for a drawable. */ -_X_EXPORT void +_GLX_PUBLIC void glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask) { #ifdef GLX_USE_APPLEGL @@ -883,7 +915,7 @@ glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask) } -_X_EXPORT GLXPixmap +_GLX_PUBLIC GLXPixmap glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list) { @@ -903,7 +935,7 @@ glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, } -_X_EXPORT GLXWindow +_GLX_PUBLIC GLXWindow glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, const int *attrib_list) { @@ -938,7 +970,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, } -_X_EXPORT void +_GLX_PUBLIC void glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) { WARN_ONCE_GLX_1_3(dpy, __func__); @@ -951,7 +983,7 @@ glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) } -_X_EXPORT void +_GLX_PUBLIC void glXDestroyWindow(Display * dpy, GLXWindow win) { WARN_ONCE_GLX_1_3(dpy, __func__); @@ -961,17 +993,17 @@ glXDestroyWindow(Display * dpy, GLXWindow win) } #ifndef GLX_USE_APPLEGL -_X_EXPORT +_GLX_PUBLIC GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX, (Display * dpy, GLXPbufferSGIX pbuf), (dpy, pbuf), glXDestroyPbuffer) -_X_EXPORT +_GLX_PUBLIC GLX_ALIAS_VOID(glXSelectEventSGIX, (Display * dpy, GLXDrawable drawable, unsigned long mask), (dpy, drawable, mask), glXSelectEvent) -_X_EXPORT +_GLX_PUBLIC GLX_ALIAS_VOID(glXGetSelectedEventSGIX, (Display * dpy, GLXDrawable drawable, unsigned long *mask), (dpy, drawable, mask),