summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2_glx.c
Commit message (Collapse)AuthorAgeFilesLines
* glx: Use loader_open_device() helperDerek Foreman2015-06-231-9/+1
| | | | | | | | | We've moved the open with CLOEXEC idiom into a helper function, so call it instead of duplicating the code here. Signed-off-by: Derek Foreman <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glx: report which DRI version is used when in verbose debug modeMartin Peres2015-05-071-0/+2
| | | | | | | | This should make it more obvious in bug reports while also removing any sort of guesswork for developers. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* glx: Add an error message when a direct renderer's createScreen() routine failsJon TURNEY2014-06-181-1/+3
| | | | | | | | | | | | | | | because no matching fbConfigs or visuals could be found. Nearly all the error cases in *createScreen() issue an error message to diagnose the failure to initialize before branching to handle_error. The few remaining error cases which don't should probably do the same. (At the moment, it seems this can be triggered in drisw with an X server which reports definite values for MAX_PBUFFFER_(WIDTH|HEIGHT|SIZE), because those attributes are checked for an exact match against 0.) Signed-off-by: Jon TURNEY <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glx/dri2: explicitly assign struct components for glx_*_vtableEmil Velikov2014-04-281-13/+13
| | | | | | | | ... to improve readability of code. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glx/dri2: rework __DRIextension handlingEmil Velikov2014-04-281-1/+1
| | | | | | | | | | | | Make sure that the DRI*Extensions report the version of the interface implemented over the listed in the headers. While both are currently the same, this may change in the future. v2: Keep loader extensions handling as is. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]> (v1) Reviewed-by: Kristian Høgsberg <[email protected]>
* dri_interface: Update __DRItexBufferExtensionRec to version 3Emil Velikov2014-04-281-5/+1
| | | | | | | | | | | | | | | | | | | | With commit e59fa4c46c8("dri2: release texture image.") we updated the extension without bumping the version number. The patch itself added an interface required to enable texture_from_pixmap on certain platforms. The new code was effectively never build, as it depended on __DRI_TEX_BUFFER_VERSION >= 3, which never came to be in upstream mesa. This commit bumps the version number, drops the __DRI_TEX_BUFFER_VERSION checks and resolves all the build conflicts. Additionally it add a version check as egl and dri3, as require version 2 of the extension which does not have the releaseTexBuffer hook. Cc: Juan Zhao <[email protected]> Cc: Kristian Høgsberg <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* loader: add special logic to distinguish nouveau from nouveau_vieuxIlia Mirkin2014-03-191-10/+10
| | | | | | | | | | | There are a lot of different pci ids supported by nouveau, and more are added all the time. The relevant distinguisher between drivers is the chipset id. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Cc: "10.1" <[email protected]>
* glx: Fix incorrect pdp assignment in dri2_bind_context().Charmaine Lee2014-03-181-1/+2
| | | | | | | pdp should be set to dpyPriv->dri2Display. Fixes blank frame failure running glretrace ClearView. Reviewed-by: Brian Paul <[email protected]>
* dri3: Add GLX_EXT_buffer_age supportAdel Gadllah2014-03-131-0/+1
| | | | | | | | | | | v2: Indent according to Mesa style, reuse sbc instead of making a new swap_count field, and actually get a usable back before returning the age of the back (fixing updated piglit tests). Changes by anholt. Signed-off-by: Adel Gadllah <[email protected]> Reviewed-by: Robert Bragg <[email protected]> (v1) Reviewed-by: Adel Gadllah <[email protected]> (v2) Reviewed-by: Eric Anholt <[email protected]>
* glx: cleanup unneeded headersEmil Velikov2014-03-111-3/+0
| | | | | | | | | | | - xf86dri.h is the old dri1 header, not required by dri2 nor dri3 - fold xf86drm.h inclusiong inside dri2.h - dri3_glx does not have any drm specific dependencies - glapi.h is not required by the dri2 and dri3 codepaths Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jon TURNEY <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx/dri2: set the implemented version of __DRIdri2LoaderExtensionEmil Velikov2014-02-231-8/+10
| | | | | | | | ... over the version number provided by the headers. Explicitly set extension members to improve clarity. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Pass NULL DRI drawables into the DRI driver for None GLX drawablesKristian Høgsberg2014-02-061-5/+12
| | | | | | | | | | | | | | GLX_ARB_create_context allows making a GLX context current with None drawable and readables, but this was never implemented correctly in GLX. We would create a __DRIdrawable for the None GLX drawable and pass that to the DRI driver and that would somehow work. Now it's somehow broken. The way this should have worked is that we pass a NULL DRI drawable to the DRI driver when the GLX user calls glXMakeContextCurrent() with None for drawable and readables. https://bugs.freedesktop.org/show_bug.cgi?id=74143 Signed-off-by: Kristian Høgsberg <[email protected]>
* dri2: Trust our own driver name lookup over the server's.Eric Anholt2014-01-271-1/+11
| | | | | | | | | | This allows Mesa to choose to rename driver .sos (or split drivers), without needing a flag day with the corresponding 2D driver. v2: Undo the loader-only-for-dri3 change. Reviewed-by: Keith Packard <[email protected]> [v1] Reviewed-by: Kristian Høgsberg <[email protected]> [v1]
* dri2: Open the fd before loading the driver.Eric Anholt2014-01-271-14/+14
| | | | | | | | I want to stop trusting the server for the driver name, and instead decide on our own based on the fd, so I needed this code motion. Reviewed-by: Keith Packard <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glx: add missing null check in dri2_bind_tex_imageJuha-Pekka Heikkila2013-12-181-2/+6
| | | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glx: Add missing null check in dri2CreateDrawableJuha-Pekka Heikkila2013-12-181-2/+4
| | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glx: Add missing null check in gxl/dri2_glx.cJuha-Pekka Heikkila2013-12-031-0/+4
| | | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glx/dri2: Add DRI2 support for GLX_MESA_query_rendererIan Romanick2013-11-071-1/+12
| | | | | | | | | | The new functions for this extension were added to a separate file (dri2_query_renderer.c) to facilitate unit testing. I tried putting them in dri2_glx.c, and it resulting in an unending chain of dependencies. It was the proverbial threading hanging from a sweater. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glx/dri2: Pull some internal structures out to a separate header fileIan Romanick2013-11-071-20/+1
| | | | | | | | | This structures will be accessed by internal functions that will be added in a file separate from dri2_glx.c. The new code will be added to a new file to facilitate unit testing. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* dri: Pass in the dlsym()ed driver extension to screen creation.Eric Anholt2013-10-241-9/+14
| | | | | | | | | | | This will allow a megadrivers build to reference the actual driver being loaded from the shared dri_util screen creation code. v2: Fix indentation, fallback case in EGL (review by Emil). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Chad Versace <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]>
* glx: Add an optional function call for getting the DRI driver interface.Eric Anholt2013-10-241-1/+1
| | | | | | | | | | | | | | The previous interface relied on a static struct, which meant that the driver didn't get a chance to edit the struct before the struct got used. For megadrivers, I want struct specific to the driver being loaded. v2: Fix the prototype in the docs (caught by Marek). Since the driver name was in the function, we didn't need to also pass it in. v3: Fix asprintf error checking (caught by Matt's gcc). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glx: Move the driver extension-loading to a helper function.Eric Anholt2013-10-241-4/+2
| | | | | | | | | I'm planning on doing driver extension parsing from 3 places, and making the extension loading step a bit longer. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glx: Initialize OpenGL version to 1.0Rico Schüller2013-09-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code in dri2_glx suffered from a typographical error that caused the default version to be 2.1 instead of 1.2 (minimum required by the Linux OpenGL ABI). drisw_glx had a similar error resulting in a default version of 0.1. Some driver/card combinations (r200/RV280, i915/915G) don't support OpenGL 2.1. These create in some corner cases an indirect context instead of a direct context when calling glXCreateContextAttribsARB(). This happens because of a bad default value. To avoid this, just used the default value specified by the GLX_ARB_create_context specification: "The default values for GLX_CONTEXT_MAJOR_VERSION_ARB and GLX_CONTEXT_MINOR_VERSION_ARB are 1 and 0 respectively. In this case, implementations will typically return the most recent version of OpenGL they support which is backwards compatible with OpenGL 1.0 (e.g. 3.0, 3.1 + GL_ARB_compatibility, or 3.2 compatibility profile)" Refactor all the default value setting to dri2_convert_glx_attribs, and make sure the correct defaults are set in that one place. Signed-off-by: Rico Schüller <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Bugzilla http://bugs.winehq.org/show_bug.cgi?id=34238 Cc: "9.1 9.2" <[email protected]>
* glx: make the interval of LIBGL_SHOW_FPS adjustableChia-I Wu2013-09-021-4/+8
| | | | | | | | | LIBGL_SHOW_FPS=1 makes GLX print FPS every second while other values do nothing. Extend it so that LIBGL_SHOW_FPS=N will print the FPS every N seconds. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glx: Validate the GLX_RENDER_TYPE valueTomasz Lis2013-07-181-0/+8
| | | | | | | | | | | | | Correctly handle the value of renderType in GLX context. In case of the value being incorrect, context creation fails. v2 (idr): indirect_create_context is just a memory allocator, so don't validate the GLX_RENDER_TYPE there. Fixes regressions in several GLX_ARB_create_context piglit tests. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Retrieve the value of RENDER_TYPE from GLX attribs arrayTomasz Lis2013-07-181-2/+2
| | | | | | | | | | | | | Make sure that context creation routines are provided with the value of RENDER_TYPE retrieved from GLX attribs. v2 (idr): Minor formatting changes. Change type of dri2_convert_glx_attribs render_type parameter to uint32_t to silence some GCC warnings. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Store the value of renderType while creating contextTomasz Lis2013-07-181-0/+8
| | | | | | | | | | | | | Make sure that renderType property value is stored in GLX context while it's being created. Further patches will be provided to make the value correspond to fbconfig's renderType. v2 (idr): Move a hunk from the next patch to this patch to prevent a build break. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* DRI2: HACK: no GLX_INTEL_swap_event if no ScheduleSwapRob Clark2013-03-181-6/+15
| | | | | | | | | | | | | | | If ddx does not support swap, don't advertise it. This is a hack to work around current xservers which advertise this extension even when it is clearly not supported. When: http://lists.x.org/archives/xorg-devel/2013-February/035449.html is merged in upstream xserver and makes it's way into most distros then this hack can be removed. In the mean time, it is required to allow gnome-shell/clutter/etc to work properly with a DDX driver which does not support ScheduleSwap. Signed-off-by: Rob Clark <[email protected]>
* DRI2: Don't disable GLX_INTEL_swap_event unconditionallyZack Rusin2013-02-191-3/+12
| | | | | | | | | | | | | | | | | | | | GLX_INTEL_swap_event is broken on the server side, where it's currently unconditionally enabled. This completely breaks systems running on drivers which don't support that extension. There's no way to test for its presence on this side, so instead of disabling it uncondtionally, just disable it for drivers which are known to not support it. It makes sense because most drivers do support it right now. We'll be able to remove this once Xserver properly advertises GLX_INTEL_swap_event. Note: This is a candidate for stable branch branches. Signed-off-by: Zack Rusin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60052 Reviewed-by: Jesse Barnes <[email protected]> Reviewed-by: Brian Paul <[email protected]> Tested-by: Ian Romanick <[email protected]>
* glx: Centralize the code for context flushing.Eric Anholt2013-02-071-45/+37
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glx: Add a little comment about what dri2FlushFrontBuffer() does.Eric Anholt2013-02-071-0/+4
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glx: Check that swap_buffers_reply is non-NULL before using itStéphane Marchesin2013-01-291-3/+5
| | | | | | | | | Check that the return value from xcb_dri2_swap_buffers_reply is non-NULL before accessing the struct members. Note: This is a candidate for the 9.0 branch. Reviewed-by: Brian Paul <[email protected]>
* glx: only advertise GLX_INTEL_swap_event if it's supportedZack Rusin2013-01-241-2/+3
| | | | | | | | | | | Only drivers supporting DRI2 version >=4 support GLX_INTEL_swap_event. So lets mark it as such otherwise applications which use this extension (i.e. everything based on Clutter, e.g. gnome-shell) break horribly on drivers supporting DRI2 versions only up to 3. Note: This is a candidate for the 9.0 branch. Reviewed-by: Brian Paul <[email protected]>
* glx/dri2: set the __DRI2_FLUSH_DRAWABLE flag where it should be setMarek Olšák2012-12-071-2/+4
| | | | | | | | Sorry, I accidentally omitted this. It only broke MLAA. Reviewed-by: Brian Paul <[email protected]>
* glx/dri2: add and use new driver hook flush_with_flagsMarek Olšák2012-12-021-49/+92
|
* glx: move the glFlush call one layer downMarek Olšák2012-12-021-5/+13
|
* glx: Fix listing of INTEL_swap_event in glXQueryExtensionsString()Owen W. Taylor2012-10-171-1/+1
| | | | | | | | | | | Due to a string mismatch, INTEL_swap_event wasn't listed among GLX extensions for the connection, even when present on both client and server. That is, glXQueryServerString and glXGetClientString reported the extension, but glXQueryExtensionsString did not. Note: This is a candidate for the stable branches. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56057 Reviewed-by: Chad Versace <[email protected]>
* glx: Fix a regression in the new XCB codeFredrik Höglund2012-10-161-3/+15
| | | | | | | | | | | dri2DrawableGetMSC(), dri2WaitForMSC() and dri2WaitForSBC() were inadvertently changed to return 0 on success. This resulted in the callers returning an error to the client. Restore the previous behavior and also check that the reply pointers are valid before accessing them. Reviewed-by: Eric Anholt <[email protected]>
* glx: Replace DRI2SwapBuffers() custom protocol with XCB.Eric Anholt2012-10-091-4/+31
| | | | Reviewed-by: Chad Versace <[email protected]>
* glx: Fix some indentation.Eric Anholt2012-10-091-5/+5
| | | | Reviewed-by: Chad Versace <[email protected]>
* glx: Replace DRI2SwapInterval custom protocol with XCB.Eric Anholt2012-10-091-7/+2
| | | | Reviewed-by: Chad Versace <[email protected]>
* glx: Reuse setSwapInterval for setting initial swap interval.Eric Anholt2012-10-091-5/+2
|
* glx: Allow glXSwapInterval(0) when vblank_mode=0.Eric Anholt2012-10-091-1/+3
| | | | There's no reason to say no in this case.
* glx: Replace DRI2GetMSC custom protocol with XCB.Eric Anholt2012-10-091-16/+10
| | | | Reviewed-by: Chad Versace <[email protected]>
* glx: Replace DRI2WaitForMSC custom protocol with XCB.Eric Anholt2012-10-091-16/+21
| | | | Reviewed-by: Chad Versace <[email protected]>
* glx: Replace DRI2WaitForSBC custom protocol with XCB.Eric Anholt2012-10-091-9/+34
| | | | Reviewed-by: Chad Versace <[email protected]>
* glx: Unifdef some dri_interface.h defines.Eric Anholt2012-10-091-14/+1
| | | | | | | | | | | dri_interface.h comes from our tree, so why litter our tree with ifdefs for older versions of it? I left in the DRI_TEX_BUFFER_VERSION ifdefs, which is broken and uncompiled (the version wasn't bumped from 2 to 3 when the patch was landed), but I don't know what should be done with it. Reviewed-by: Chad Versace <[email protected]>
* glx/dri2: use uint64_t instead of double to represent time for FPS calculationMarek Olšák2012-10-031-5/+6
| | | | | | | | | | | | Wine or a windows app changes fpucw to 0x7f, causing doubles to be equivalent to floats, which broke the calculation of FPS. We should be very careful about using doubles in Mesa. Henri Verbeet adds: For reference, this is done by for example d3d9 when a D3D device is created without D3DCREATE_FPU_PRESERVE set. In the general case applications can do all kinds of terrible things to the FPU control word of course.
* Use calloc instead of malloc/memset-0Matt Turner2012-09-051-8/+4
| | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: @@ expression E; identifier I; @@ - I = malloc(E); + I = calloc(1, E); ... - memset(I, 0, sizeof *I); Reviewed-by: Brian Paul <[email protected]>
* Remove useless checks for NULL before freeingMatt Turner2012-09-051-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + free (E); + E = NULL; - if (unlikely (E != NULL)) { - free(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; type T; @@ + free ((T) E); + E = NULL; - if (unlikely (E != NULL)) { - free((T) E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + free (E); - if (unlikely (E != NULL)) { - free (E); - } @@ expression E; type T; @@ + free ((T) E); - if (unlikely (E != NULL)) { - free ((T) E); - } Reviewed-by: Brian Paul <[email protected]>