summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2_glx.c
Commit message (Collapse)AuthorAgeFilesLines
* Set close on exec flag FD_CLOEXECDavid Fries2012-03-111-1/+9
| | | | | | | | | Set the close on exec flag when opening dri character devices, so they will be closed and free any resouces allocated in exec. Signed-off-by: David Fries <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* dri: Emit a critical error if a named driver fails to load.Carl Worth2012-02-081-0/+2
| | | | | | | | | Something has gone wrong if we were asked to load a driver of a specific name, but it failed to load for some reason. The user really should be made aware of this, (and instructed to set LIBGL_DEBUG for more details). Reviewed-by: Eugeni Dodonov <[email protected]>
* glx/dri2: print FPS when env var LIBGL_SHOW_FPS is 1 (v2)Marek Olšák2012-01-051-1/+34
| | | | | | | | | This is useful for apps which don't print FPS. Only enabled in SwapBuffers. v2: track state per drawable, use libGL prefix Reviewed-by: Michel Dänzer <[email protected]>
* glx: Enable GLX_EXT_create_context_es2_profileIan Romanick2012-01-021-0/+6
| | | | | | | | | | | | This extension is only enabled if the underlying driver advertises support for OpenGL ES 2.0. This happens either through the getAPIMask function in version 2 of the DRI2 extension or implicity through version 2 of the DRISW extension. Since there is no OpenGL ES 2.0 protocol, this extension is marked as only available with direct-rendering. Signed-off-by: Ian Romanick <[email protected]>
* glx/dri2: Implement glx_screen_vtable::create_context_attribs for DRI2 contextsIan Romanick2012-01-021-1/+91
| | | | | | | | This also enables GLX_ARB_create_context and GLX_ARB_create_context_profile if the driver supports DRI_DRI2 version 3 or greater. Signed-off-by: Ian Romanick <[email protected]>
* glx: Add glx_screen_vtable::create_context_attribsIan Romanick2012-01-021-1/+2
| | | | Signed-off-by: Ian Romanick <[email protected]>
* glx: Send DestroyContext protocol at the correct timesIan Romanick2011-12-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | Send the DestroyContext protocol immediately when glXDestroyContext is called, and never call it when glXFreeContextEXT is called. In both cases, either destroy the client-side structures or, if the context is current, set xid to None so that the client-side structures will be destroyed later. I believe this restores the behavior of the original SGI code. See src/glx/x11 around commit 5df82c8. The spec doesn't say anything about glXDestroyContext not really destroying imported contexts (it acts like glXFreeContextEXT instead), but that's what the original code did. Note that glXFreeContextEXT on a non-imported context does not destroy it either. Fixes the piglit test glx-free-context. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Don't create a shared context if the other context isn't the same kindIan Romanick2011-12-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each of the DRI, DRI2, and DRISW backends contain code like the following in their create-context routine: if (shareList) { pcp_shared = (struct dri2_context *) shareList; shared = pcp_shared->driContext; } This assumes that the glx_context *shareList is actually the correct derived type. However, if shareList was created as an indirect-rendering context, it will not be the expected type. As a result, shared will contain garbage. This garbage will be passed to the driver, and the driver will probably segfault. This can be observed with the following GLX code: ctx0 = glXCreateContext(dpy, visinfo, NULL, False); ctx1 = glXCreateContext(dpy, visinfo, ctx0, True); Create-context is the only case where this occurs. All other cases where a context is passed to the backend, it is the 'this' pointer (i.e., we got to the backend by call something from ctx->vtable). To work around this, check that the shareList->vtable->destroy method is the same as the destroy method of the expected type. We could also check that shareList->vtable matches the vtable or by adding a "tag" to glx_context to identify the derived type. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Fix indirect fallback when a non-Mesa GLX extension is present.Aaron Plattner2011-12-071-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When driCreateScreen calls driConvertConfigs to try to convert the configs for swrast, it fails and returns NULL. Instead of checking, it just clobbers psc->base.configs. Then, when the application asks for the FBconfigs, there aren't any. Instead, make the caller responsible for freeing the old modes lists if both calls to driConvertConfigs succeed. Without the second fix, glxinfo fails unless you run it with LIBGL_ALWAYS_INDIRECT: $ glxinfo name of display: :0.0 Error: couldn't find RGB GLX visual or fbconfig $ LIBGL_ALWAYS_INDIRECT=1 glxinfo name of display: :0.0 display: :0 screen: 0 direct rendering: No (LIBGL_ALWAYS_INDIRECT set) server glx vendor string: NVIDIA Corporation server glx version string: 1.4 [...] Signed-off-by: Aaron Plattner <[email protected]> Reviewed-and-tested-by: Ian Romanick <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* dri2: Implement a throttle dri extension.Thomas Hellstrom2011-10-141-3/+50
| | | | | | | | | | | | | | | | | | | | The X server has limited throttle support on the server side, but doing this in the client has some benefits: 1) X server throttling is per client. Client side throttling can be done per drawable. 2) It's easier to control the throttling based on what client is run, for example using "driconf". 3) X server throttling requires drm swap complete events. So implement a dri2 throttling extension intended to be used by direct rendering clients. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
* Remove unneeded xdamages header from dri2_glx.c.Matt Turner2011-09-191-1/+0
| | | | | | | It's needed for dri1 but not dri2. Signed-off-by: Matt Turner <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* glx/dri2: Don't call X server for SwapBuffers when there's no back buffer.Michel Dänzer2011-09-141-0/+4
| | | | | | | | | | | | | | | As already done in dri2CopySubBuffer(). Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=36371 https://bugs.freedesktop.org/show_bug.cgi?id=40533 Might fix: https://bugs.freedesktop.org/show_bug.cgi?id=32589 Signed-off-by: Michel Dänzer <[email protected]>
* GLX: Say something if we cannot connect via DRI2Andrew Deason2011-09-141-0/+1
| | | | See https://bugs.freedesktop.org/show_bug.cgi?id=40437
* glx: Don't flush twice if we fallback to dri2CopySubBufferKristian Høgsberg2011-08-181-11/+10
| | | | | | | The flush extensions flush call indicates end of frame and should only be called once per frame. However, in the dri2SwapBuffer fallback path, we call flush and then call dri2CopySubBuffer, which also calls flush. Refactor the code to only call flush once.
* glx: move declarations before codeBrian Paul2011-08-091-3/+7
|
* glx: Allow a context-specific fallback for glXGetProcAddressJeremy Huddleston2011-06-201-0/+1
| | | | | | | | In applegl, GLX advertises the same extensions provided by OpenGL.framework even if such extensions are not provided by glapi. This allows a client to get access to such API. Signed-off-by: Jeremy Huddleston <[email protected]>
* glx: implement drawable refcounting.Stéphane Marchesin2011-06-171-3/+2
| | | | | | | | | | | | The current dri context unbind logic will leak drawables until the process dies (they will then get released by the GEM code). There are two ways to fix this: either always call driReleaseDrawables every time we unbind a context (but that costs us round trips to the X server at getbuffers() time) or implement proper drawable refcounting. This patch implements the latter. Signed-off-by: Antoine Labour <[email protected]> Signed-off-by: Stéphane Marchesin <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* dri2: protect dri2FlushFrontBuffer against NULL buffers.Stéphane Marchesin2011-06-061-0/+6
|
* glx: Fix use-before-null-check in dri2InvalidateBuffers().Eric Anholt2011-06-031-1/+6
| | | | | | | | | | The compiler used our dereference here to skip the NULL check below. Fixes window resize in "jconsole -J-Dsun.java2d.opengl=True" under OpenJDK 6. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37766 Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Check flush DRI extension version at runtimenobled2011-05-061-2/+3
| | | | | | The DRI driver itself might not have version 3 of the DRI2 flush extension, in which case this would've pointed to out of bounds memory...
* glx: Destroy dri2Hash on DRI2 display destruction.Henri Verbeet2011-04-101-0/+3
| | | | Signed-off-by: Henri Verbeet <[email protected]>
* dri2: Don't call the dri2 flush hook for swapbuffers unless we have a context.Eric Anholt2011-02-261-2/+7
| | | | | | The driver only has one reasonable place to look for its context to flush anything, which is the current context. Don't bother it with having to check.
* glx: Properly check for a valid fd in dri2CreateScreen().Henri Verbeet2011-01-311-1/+3
| | | | Signed-off-by: Brian Paul <[email protected]>
* glx: Fix leaks in DRI2 screen creation error paths.Henri Verbeet2011-01-311-4/+10
| | | | Signed-off-by: Brian Paul <[email protected]>
* dri2: release texture image.Juan Zhao2011-01-091-0/+21
| | | | | | Add release function for texture_from_pixmap extension. Some platform need to release texture image for texture_from_pixmap extension, add this interface for those platforms.
* glx: Invalidate buffers after binding a drawableKristian Høgsberg2010-09-221-4/+15
| | | | | | | | | If the server doesn't send invalidate events, we may miss a resize before the rendering starts. Invalidate the buffers now so the driver will recheck before rendering starts. https://bugs.freedesktop.org/show_bug.cgi?id=29984 https://bugs.freedesktop.org/show_bug.cgi?id=30155
* glx: decouple dri2.c and GLX, fixing Gallium EGL and d3d1x buildLuca Barbieri2010-09-221-0/+10
| | | | | | | | | | | | | | | The Gallium EGL state tracker reuses dri2.c but not the GLX code. Currently there is a bit of code in dri2.c that is incorrectly tied to GLX: instead, make it call an helper that both GLX and Gallium EGL implement, like dri2InvalidateBuffers. This avoids a link error complaining that dri2GetGlxDrawableFromXDrawableId is undefined. Note that we might want to move the whole event translation elsewhere, and probably stop using non-XCB DRI2 altogether, but this seems to be the minimal fix.
* glx: Hold on to drawables if we're just switching to another contextKristian Høgsberg2010-09-211-1/+4
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=30234
* glx: Don't destroy DRI2 drawables for legacy glx drawablesKristian Høgsberg2010-09-131-1/+11
| | | | | | | | | | | For GLX 1.3 drawables, we can destroy the DRI2 drawable when the GLX drawable is destroyed. However, for legacy drawables, there os no good way of knowing when the application is done with it, so we just let the DRI2 drawable linger on the server. The server will destroy the DRI2 drawable when it destroys the X drawable or the client exits anyway. https://bugs.freedesktop.org/show_bug.cgi?id=30109
* glx: Drop broken drawable garbage collectionKristian Høgsberg2010-09-081-2/+2
| | | | | | Doesn't work for pixmaps, was looking up the GLX XID and was never thread safe. Instead, just destroy the client side structures when the drawable is no long current for a context.
* glx: Move deref after NULL checkKristian Høgsberg2010-08-041-1/+2
|
* glx: dri2InvalidateBuffers() needs the X drawable XID not the GLX oneKristian Høgsberg2010-08-041-2/+2
| | | | This never ceases to entertain.
* glx: Move bind and unbind to context vtableKristian Høgsberg2010-07-281-11/+17
|
* glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types.Kristian Høgsberg2010-07-281-17/+17
|
* glx: Rename __GLXscreenConfigs to struct glx_screenKristian Høgsberg2010-07-281-6/+6
| | | | Because double underscores in private type names is painful.
* glx: Rename __GLcontextModes to struct glx_configKristian Høgsberg2010-07-281-5/+5
| | | | | With this rename, we use 'config' consitently to refer to GLX configurations instead of the modes/configs/visual mess before.
* Avoid a compiler warning about a potentially unused variable.Carl Worth2010-07-281-1/+1
| | | | | | | | | There is no assignment to the "ret" variable if X_DRI2SwapBuffers is not defined. In this case, the earlier explicit "return 0" is likely to be used, but the compiler can't be sure of that, (nor can I for that matter). We cover this case by explicitly initializing "ret" to 0.
* glx: Fix another case of confusing driContext and dri2_context *Eric Anholt2010-07-231-1/+1
|
* glx: Correctly look up the dri2 context pointer for SetTexBuffer.Eric Anholt2010-07-231-1/+1
| | | | | | | gc->driContext points at the second member of the dri2 context. The dri2 context is just a subclass of the GLX context. Fixes piglit tfp testcase.
* glx: Don't destroy context with XID 0Kristian Høgsberg2010-07-231-1/+2
| | | | | We use XID 0 to indicate the context has already been destroyed, but it's currently bound.
* glx: zero out drawable structs after allocationKristian Høgsberg2010-07-231-0/+1
|
* glx: Refactor and simplify context creationKristian Høgsberg2010-07-231-4/+7
| | | | | This lets us better separate context creation between the different backends.
* glx: Move context destroy to context vtableKristian Høgsberg2010-07-231-2/+9
|
* glx: Don't try to swap a front buffer if we don't have one.Eric Anholt2010-07-231-1/+2
| | | | Fixes glean glsl1 since 7b7845a076c933e096ac511b4184141ba194449a
* glx: Drop screen argument to GetGLXDRIDrawableKristian Høgsberg2010-07-221-3/+3
| | | | We'll just get it from the returned drawable when we need it.
* glx: Move WaitGL, WaitX, UseXFont to context vtable functionsKristian Høgsberg2010-07-221-9/+12
|
* glx: Allocate the __GLXcontext in the DRI driversKristian Høgsberg2010-07-221-17/+23
|
* glx: Move __driContext field out of __GLXcontextRecKristian Høgsberg2010-07-211-3/+3
|
* glx/dri2: Fix dri2CopySubBuffer() again.Michel Dänzer2010-07-201-3/+4
| | | | | | | Only refresh the fake front buffer if there is one, and only destroy the region once. Fixes X11 protocol errors reported by 'mcgreg' on IRC.
* glx: Move DRI CopySubBuffer extension to DRI1 codeKristian Høgsberg2010-07-191-1/+1
| | | | We do this in the X server for DRI2.