summaryrefslogtreecommitdiff
path: root/src/glx/dri_common.c
AgeCommit message (Collapse)AuthorFilesLines
2013-10-24glx: Add an optional function call for getting the DRI driver interface.Eric Anholt1-1/+16
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 <mattst88@gmail.com> (v1) Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-10-24glx: Move the driver extension-loading to a helper function.Eric Anholt1-0/+14
I'm planning on doing driver extension parsing from 3 places, and making the extension loading step a bit longer. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-09-04glx: Initialize OpenGL version to 1.0Rico Schüller1-7/+7
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 <kgbricola@web.de> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla http://bugs.winehq.org/show_bug.cgi?id=34238 Cc: "9.1 9.2" <mesa-stable@lists.freedesktop.org>
2013-07-18dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPETomasz Lis1-1/+7
Mark __DRI_ATTRIB_FLOAT_MODE as deprecated, and introduce new flags to __DRI_ATTRIB_RENDER_TYPE for float modes. Both signed float (fbconfig_float) and unsigned (packed_float) are introduced. The old attribute should be set for both float modes. v2 (idr): Require that the render mode from the DRI attributes matches the render mode of the config exactly. This is the behavior of the old code. Signed-off-by: Tomasz Lis <tomasz.lis@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-07-18glx: Retrieve the value of RENDER_TYPE from GLX attribs arrayTomasz Lis1-6/+6
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 <tomasz.lis@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-09-05Remove Xcalloc/Xmalloc/Xfree callsMatt Turner1-1/+1
These calls allowed Xlib to use a custom memory allocator, but Xlib has used the standard C library functions since at least its initial import into git in 2003. It seems unlikely that it will grow a custom memory allocator. The functions now just add extra overhead. Replacing them will make future Coccinelle patches simpler. This patch has been generated by the following Coccinelle semantic patch: // Remove Xcalloc/Xmalloc/Xfree calls @@ expression E1, E2; @@ - Xcalloc (E1, E2) + calloc (E1, E2) @@ expression E; @@ - Xmalloc (E) + malloc (E) @@ expression E; @@ - Xfree (E) + free (E) @@ expression E; @@ - XFree (E) + free (E) Reviewed-by: Brian Paul <brianp@vmware.com>
2012-07-11glx/dri2: Add support for GLX_ARB_create_context_robustnessIan Romanick1-2/+18
Add the infrastructure required for this extension. There is no xserver support and no driver support yet. Drivers can enable this be advertising DRI2 version 4 and accepting the __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in create context. Some additional Mesa infrastructure is needed before drivers can do this. The GL_ARB_robustness spec, which all Mesa drivers already advertise, requires: "If the behavior is LOSE_CONTEXT_ON_RESET_ARB, a graphics reset will result in the loss of all context state, requiring the recreation of all associated objects." It is necessary to land this infrastructure now so that the related infrastructure can land in the xserver. The xserver has very long release schedules, and the remaining Mesa parts should land long, long before the next xserver merge window opens. v2: Expose robustness as a DRI2 extension rather than bumping __DRI_DRI2_VERSION. v3: Add a comment explaining why dri2->base.version >= 3 is also required for GLX_ARB_create_context_robustness. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
2012-03-28glx:dri_common.c: check psc->driScreen->createDrawable return valueWang YanQing1-0/+6
createDrawable may return NULL value, we should check it, or it will make a segment failed. [minor-indent-issue-fixed-by: Yuanhan Liu] Signed-off-by: Wang YanQing <udknight@gmail.com> Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2012-02-08dri: Add a CriticalErrorMessageF macro.Carl Worth1-0/+24
Sometimes an error is so sever that we want to print it even when the user hasn't specifically requested debugging by setting LIBGL_DEBUG. Add a CriticalErrorMessageF macro to be used for this case. (The error message can still be slienced with the existing LIBGL_DEBUG=quiet). For critical error messages we also direct the user to set the LIBGL_DEBUG environment variable for more details. Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2012-02-08dri: Clarify comments on InfoMessageF and ErrorMessageF macros.Carl Worth1-1/+6
The description of ErrorMessageF was misleading in the case of LIBGL_DEBUG being unset, (the previous comment could be understood to mean the error should be printed, but the code does not print in this case). InfoMessageF previously had no comment at all. Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2012-01-11glx/dri: Initialize api even if num_attribs == 0.Kenneth Graunke1-1/+3
Both dri2_create_context_attribs and drisw_create_context_attribs call dri2_convert_glx_attribs, expecting it to fill in *api on success. However, when num_attribs == 0, it was returning true without setting *api, causing the caller to use an uninitialized value. Tested-by: Vadim Girlin <vadimgirlin@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2012-01-02glx: Enable GLX_EXT_create_context_es2_profileIan Romanick1-0/+16
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 <ian.d.romanick@intel.com>
2012-01-02glx/dri: Add utility function dri2_convert_glx_attribsIan Romanick1-0/+102
This converts all of the GLX data from glXCreateContextAttribsARB to the values expected by the DRI driver interfaces. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-07glx: Fix indirect fallback when a non-Mesa GLX extension is present.Aaron Plattner1-2/+0
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 <aplattner@nvidia.com> Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Brian Paul <brianp@vmware.com>
2011-08-26dri: Remove all DRI1 driversIan Romanick1-1/+1
Acked-by: Kristian Høgsberg <krh@bitplanet.net> Acked-by: Marek Olšák <maraeo@gmail.com> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Jakob Bornecrantz <jakob@vmware.com> Acked-by: Dave Airlie <airlied@redhat.com> Build-Tested-by: Jakob Bornecrantz <jakob@vmware.com> Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-07-19glx: Avoid calling __glXInitialize() in driReleaseDrawables().Henri Verbeet1-1/+1
This fixes a regression introduced by commit a26121f37530619610a78a5fbe5ef87e44047fda (fd.o bug #39219). Since the __glXInitialize() call should be unnecessary anyway, this is probably a nicer fix for the original problem too. NOTE: This is a candidate for the 7.10 and 7.11 branches. Signed-off-by: Henri Verbeet <hverbeet@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Tested-by: padfoot@exemail.com.au
2011-06-17glx: implement drawable refcounting.Stéphane Marchesin1-7/+19
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 <piman@chromium.org> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-03-06glx/dri: add initial dri interface for GLX_EXT_framebuffer_sRGB.Dave Airlie1-1/+3
This realigns the name of the glx bit to align with the core mesa names.
2010-09-29glx: Only remove drawables from the hash when we actually delete themKristian Høgsberg1-4/+6
https://bugs.freedesktop.org/show_bug.cgi?id=30457
2010-09-08glx: Drop broken drawable garbage collectionKristian Høgsberg1-0/+25
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.
2010-07-28glx: Move bind and unbind to context vtableKristian Høgsberg1-0/+27
2010-07-28glx: Rename glcontextmodes.[ch] to glxconfig.[ch]Kristian Høgsberg1-1/+0
2010-07-28glx: Rename __GLcontextModes to struct glx_configKristian Høgsberg1-26/+24
With this rename, we use 'config' consitently to refer to GLX configurations instead of the modes/configs/visual mess before.
2010-07-21glx: Move last few dri_interface.h types out of glxclient.h and drop includeKristian Høgsberg1-1/+11
2010-07-19glx: Move DRI CopySubBuffer extension to DRI1 codeKristian Høgsberg1-25/+0
We do this in the X server for DRI2.
2010-07-19glx: Move driver_configs to DRI screen privatesKristian Høgsberg1-0/+10
2010-07-19glx: Remove support for MESA_swap_frame_usageKristian Høgsberg1-7/+0
The extension never worked, the implementation returns GLX_BAD_CONTEXT when enabling the frame tracking.
2010-07-19glx: Move DRI1 specific extensions and code to DRI1 screen privateKristian Høgsberg1-34/+0
2010-07-19glx: Move DRI2 extensions to DRI2 screen privateKristian Høgsberg1-36/+0
2010-07-19glx: Drop support for GLX_MESA_allocate_memoryKristian Høgsberg1-7/+0
Only r200 implemented it.
2010-07-19glx: Add screen privates for dri drivers and moved some fields thereKristian Høgsberg1-12/+5
GLXscreenConfigs is badly named and a dumping ground for a lot of stuff. This patch creates private screen structs for the dri drivers and moves some of their fields over there.
2010-04-28Merge branch '7.8'Brian Paul1-1/+1
Conflicts: src/glx/dri2_glx.c src/glx/glx_pbuffer.c
2010-04-27apple: Change ifdefs for DRI to be DRI && !APPLEJeremy Huddleston1-1/+1
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-04-22DRI2: add config query extensionJesse Barnes1-0/+5
Add a new DRI2 configuration query extension. Allows for DRI2 client code to query for common DRI2 configuration options.
2010-04-01Revert accidental commits from the xquartz treeJeremy Huddleston1-1/+1
This reverts commit 9aadc793f3db64cefa0b08f18abad424a659dacc. This reverts commit 69ea4e7718efb60b6b0d795a355cebd6712ceac1. This reverts commit dbe8b013936d977ec63d6607bfd2fc6772d29787. This reverts commit 23215ef4d60a86d9f3b3fdc08e3fdadc59e98890. This reverts commit 9495e3703062d1ddaf3161f4efc23f0b51284d9b. This reverts commit 0594cf70883b64692ba617d85f4f9b4e636e5c2b. This reverts commit 86a7978d37393ee34f876569ac06ffdb8d7289ae. This reverts commit 437902ce978cde9a0e1aa260f12dc232a8501c42.
2010-04-01apple: Change ifdefs for DRI to be DRI && !APPLEJeremy Huddleston1-1/+1
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-02-09Retire miniglx and move the actual glx code up to src/glxKristian Høgsberg1-0/+450