summaryrefslogtreecommitdiffstats
path: root/src/glx
Commit message (Collapse)AuthorAgeFilesLines
...
* Use calloc instead of malloc/memset-0Matt Turner2012-09-055-24/+12
| | | | | | | | | | | | | | | | 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 <brianp@vmware.com>
* Remove useless checks for NULL before freeingMatt Turner2012-09-056-32/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <brianp@vmware.com>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-0511-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Don't cast the return value of malloc/realloc. // // Casting the return value of malloc/realloc only stands to hide // errors. @@ type T; expression E1, E2; @@ - (T) ( _mesa_align_calloc(E1, E2) | _mesa_align_malloc(E1, E2) | calloc(E1, E2) | malloc(E1) | realloc(E1, E2) )
* Remove Xcalloc/Xmalloc/Xfree callsMatt Turner2012-09-0521-153/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use the correct macro _WIN32 for Windows.Vinson Lee2012-09-051-1/+1
| | | | | | | | | | | | | | The correct predefined macro for Windows is _WIN32, not WIN32 or __WIN32__. _WIN32 is defined for 32-bit and 64-bit version of Windows by both MSVC and MinGW compilers. http://sourceforge.net/p/predef/wiki/OperatingSystems http://msdn.microsoft.com/en-us/library/b0084kay.aspx This patch also fixes a MinGW automake build error. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
* build: Clean glx Makefile.amMatt Turner2012-08-221-4/+1
| | | | | | mapi/glapi is already built when make is run in src/glx. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glx/dri2: add dri2 prime support.Dave Airlie2012-08-161-0/+13
| | | | | | | | | | This adds support for having libGL pick a different driver for prime support. DRI_PRIME env var is set to the value retrieved from the server randr provider calls, by the calling process. (generally DRI_PRIME=1 will be the right answer). Signed-off-by: Dave Airlie <airlied@redhat.com>
* build/glx: fix include paths for out-of-tree buildsChristopher James Halse Rogers2012-08-131-0/+2
| | | | | Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
* build: fix location of generated files in src/mesa (v4)Christopher James Halse Rogers2012-08-131-0/+4
| | | | | | | | | | | | | | | Also fix include paths for the generated headers. v2: Switch to using self-explanatory BUILDDIR/SRCDIR defined from top_builddir/top_srcdir rather than the ambiguous TOP. v3: Add both top_builddir and top_srcdir to include flags for mesa asm. These rely on both in-tree and build-time-generated includes. v4: Rebased on top of 948c8f502a. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
* glx/dri: Initialize reset to __DRI_CTX_RESET_NO_NOTIFICATION.Kenneth Graunke2012-08-082-2/+2
| | | | | | | | | | | | | | | | | | | | If the application has requested reset notification, then dri2_convert_glx_attribs will initialize this to the correct value. Otherwise, it's supposed to initialize this to NO_NOTIFICATION, but doesn't when num_attribs == 0. (The consensus seems to be that we should make it do so, but that's more invasive, so I'm pushing this for now.) Fixes a regression since a8724d85f8cb2f0fb73b9c6c1f268f9084c6d473 where trying to run OilRush_x86 or apitrace heaven_x64 would result in: dri_util.c:221: dri2CreateContextAttribs: Assertion `!"Should not get here."' failed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53076 Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glx: Don't use glapitable.h at allIan Romanick2012-08-083-6/+10
| | | | | | | | | | | | When --enable-shared-glapi is used, all non-ABI entries in the table are lies. Avoiding the use of glapitable.h avoids the lies. The only entries used in this code are entries that are ABI. For these, the ABI offset can be used directly. Since this code is in src/glx, it can't use src/mesa/main/dispatch.h to get the pretty names for these offsets. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
* glx: Don't rely on struct _glapi_tableIan Romanick2012-08-082-666/+654
| | | | | | | | | | | | | | | | | | | When --enable-shared-glapi is used, all non-ABI entries in the table are lies. There are two completely separate code generation paths used to assign dispatch offset. Neither has any clue about the other. Unsurprisingly, the can't agree on what offsets to assign. This adds a bunch of overhead to __glXNewIndirectAPI, but this function is called at most once. The test ExtensionNopDispatch was removed. There was just no way to make this test work with the information provided in shared-glapi. Since indirect_glx.c uses _glapi_get_proc_offset now, it was also impossible to make the tests work without shared-glapi. So much pain. This fixes indirect rendering with shared-glapi. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
* automake: Honor GL_LIB for mangled/custom lib namesBrad King2012-07-231-20/+7
| | | | | | | | | | | | | | | | Commit 2d4b77c7 (automake: Convert src/mesa/drivers/x11/Makefile to automake, 2012-06-12) dropped the old Makefile, which used GL_LIB, and replaced it with a Makefile.am hard-coding the name "GL". This broke handling of --enable-mangling and --with-gl-lib-name options which depend on GL_LIB to specify the GL library name. Use "@GL_LIB@" in src/mesa/drivers/x11/Makefile.am to configure the library name. Also use this approach to simplify src/glx/Makefile.am and drop the HAVE_MANGLED_GL conditional. While at it, fix the compatibility link we create in "lib" for the software-only driver to use version GL_MAJOR instead of hard-coding "1". Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
* glx: build tests after libglx.laMatt Turner2012-07-171-1/+1
| | | | | | | Previously, if you ran make followed by make check it would work, but if you just ran make check the test program would fail to compile. Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* automake: convert libglapiJon TURNEY2012-07-131-1/+1
| | | | | | | | | | | | | | | | | | | * "configure substitutions are not allowed in _SOURCES variables" in automake, so remove the AC_SUBST'ed GLAPI_ASM_SOURCES and instead use some AM_CONDITIONALS to choose which asm sources are used * Change GLAPI_LIB to point to the .la file in other Makefile.am files, and make a link to the .a file for the convenience of other Makefiles which have not yet been converted to automake v2: - Use AM_CPPFLAGS for cleaner build output - EXTRA_SOURCES is not needed - Remove libglapi.a compatibility link on clean Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Eric Anholt <eric@anholt.net> Tested-by: Matt Turner <mattst88@gmail.com>
* scons: Also require recent XCB.José Fonseca2012-07-121-0/+3
| | | | And don't trip when it's not found -- simply skip building src/glx.
* mesa: Require current libxcb.Eric Anholt2012-07-124-33/+1
| | | | | | | | | | Without that, people with buggy apps that looked at just the server string for GLX_ARB_create_context would call this function that just threw an error when you tried to make a context. Google shows plenty of complaints about this. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glx/dri2: Add support for GLX_ARB_create_context_robustnessIan Romanick2012-07-116-6/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* glx/tests: Fix off-by-one error in allocating extension string bufferIan Romanick2012-07-031-1/+1
| | | | | | | | | | | NOTE: This is a candidate for the 8.0 release branch. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50621 Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=418161 Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: Markus Oehme <oehme.markus@gmx.de>
* glx/tests: Fix signed/unsigned comparison warnings.Paul Berry2012-06-202-27/+27
|
* glx/tests and mesa/tests: Update .gitignore files.Paul Berry2012-06-141-1/+1
| | | | | | | | | This patch updates .gitignore files to account for the new build artifacts introduced by the following commits: ae376f0 glx/tests: Rename test as glx-test 8fecdcc mesa/tests: Add tests for _mesa_lookup_enum_by_{name,nr} functions a29ad2b mesa/tests: Add tests for the generated dispatch table
* glx/tests: Add unit tests for generated code in indirect_init.cIan Romanick2012-06-132-1/+1536
| | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* glx/tests: Add unit tests for generated code in indirect_size.cIan Romanick2012-06-132-0/+557
| | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* glx/tests: Rename test as glx-testIan Romanick2012-06-131-4/+4
| | | | | | | This matches the existing test in src/glsl/tests. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* glx: Move tests from tests/glx to src/glx/testsIan Romanick2012-06-138-0/+1499
| | | | | | | This matches the organization of other unit tests in Mesa. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* glx: Handle a null reply in QueryVersion.Stéphane Marchesin2012-06-121-0/+3
| | | | | | | | Works around crashes when X connections break. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> NOTE: This is a candidate for the 8.0 branch.
* automake: Globally add stub automake targets to the old Makefiles.Eric Anholt2012-06-111-1/+1
| | | | | | | | | I tried to update all the old Makefiles that included the default config to be sure they had a default target if they didn't previously have one, since this new all target will always point at it. Almost everything had one. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* scons: add code to generate the various GL API filesBrian Paul2012-05-311-0/+51
| | | | | | | This fixes recent build breakage when we began building the generated API files from xml as part of the normal build process. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=50475
* mesa: Remove the generated glapi from source control, and just build it.Eric Anholt2012-05-296-12714/+6
| | | | | | | | | | | Mesa already always depends on python to build. The checked in changes are not reviewed (because any trivial change rewrites the world). We also have been pushing commits between xml change and regen where at-build-time xml-generated code disagrees with committed xml-generated code. And worst of all, sometimes we ("I") check in *stale* xml-generated code. Acked-by: Ian Romanick <ian.d.romanick@intel.com>
* darwin: Address a build failure on Leopard and earlier OS versionsJeremy Huddleston2012-05-181-0/+10
| | | | | | | <https://trac.macports.org/ticket/34499> Regression-from: 51691f0767f6a75a1f549cd979a878a0ad12a228 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* darwin: Eliminate a possible race condition while destroying a surfaceJeremy Huddleston2012-05-161-4/+4
| | | | | Introduced by: c60ffd2840036af1ea6f2b6c6e1e9014bb8e2c34 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* darwin: Unlock our mutex before destroying itJeremy Huddleston2012-05-161-0/+3
| | | | | | http://xquartz.macosforge.org/trac/ticket/575 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* darwin: Use ASL for loggingJeremy Huddleston2012-05-035-21/+183
| | | | Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* darwin: Make reported errors more user-friendlyJeremy Huddleston2012-05-031-9/+10
| | | | Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* darwin: Fix an error messageJeremy Huddleston2012-05-031-1/+1
| | | | Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* darwin: Eliminate a pthread mutex leakJeremy Huddleston2012-04-241-0/+7
| | | | | Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Charles Davis <cdavis@mines.edu>
* apple: Fix a use after freeJonas Maebe2012-04-231-2/+4
| | | | Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
* glx: Hook up the unit tests again using the internal gtest.Eric Anholt2012-04-122-3/+9
| | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glx: fix compile warningsYuanhan Liu2012-04-091-0/+2
| | | | | | | | Fix 'set but not used' warnings; gl_version, gl_versions_profiles and glx_extensions variables are used just only HAVE_XCB_GLX_CREATE_CONTEXT is defined. Thus those warnings are shown when that macro isn't defined. Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
* Use -no-undefined libtool flag in src/glx/Makefile.amJon TURNEY2012-03-281-1/+1
| | | | | | | | "Use -no-undefined to assure libtool that the library has no unresolved symbols at link time, so that libtool will build a shared library on platforms that require that all symbols are resolved when the library is linked." Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
* glx:dri_common.c: check psc->driScreen->createDrawable return valueWang YanQing2012-03-281-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>
* glx/drisw: avoid segfaults when we fail to get visualDave Airlie2012-03-241-2/+9
| | | | | | | | piglit glx-tfp segfaults on llvmpipe when run vs a 16-bit radeon screen, it now fails instead of segfaulting, much prettier. Signed-off-by: Dave Airlie <airlied@redhat.com>
* glx: Fix glXGetProcAddress() of global glX symbols post-automake conversion.Eric Anholt2012-03-211-0/+1
| | | | | | | | | | | | | | | | | When a GL LD_PRELOAD library like apitrace was used, glXGetProcAddress() would return the preload's symbols instead of libGL's symbol, leading to infinite recursion when the returned function was called. This didn't hit apitrace on most apps because who calls glXGetProcAddress() on the global functions. The -Bsymbolic, which was present in mklib before automake conversion, causes the glxcmds.c:GLX_functions table to be resolved at link time, so that LD_PRELOADs don't affect it any more. Fixes crashes when running wine under apitrace. Tested-by: Matt Turner <mattst88@gmail.com> Tested-by: Marek Olšák <maraeo@gmail.com>
* Add Makefile.in to toplevel .gitignoreKenneth Graunke2012-03-201-1/+0
| | | | | | | To avoid redundancies, this patch also removes Makefile.in from the other .gitignore files. Acked-by: Eric Anholt <eric@anholt.net>
* Add .deps/, .libs/, and *.la to toplevel .gitignorePaul Berry2012-03-201-3/+0
| | | | | | | To avoid redundancies, this patch also removes .deps, .libs, and *.la from .gitignore files in subdirectories. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* shared-glapi: Convert to automakeKristian Høgsberg2012-03-191-1/+1
| | | | | | | | | | This fixes a build problem where EGL links to libgbm.la, which encodes a relative path to it's libglapi.so dependency. The relative path breaks when the linker tries to resolve it from src/egl/main instead of src/gbm. Typically we silently fall back to the system libglapi.so, which is wrong and breaks when there isn't one. Morale of the story: don't mix mklib and libtool.
* darwin: Build create_context.cJeremy Huddleston2012-03-162-1/+7
| | | | | | Fixes a build regression from: 588042a8ec4ea91a952c07a0768516fd590758f4 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* 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 <David@Fries.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glx: Also put a symlink from libGL.so in lib/ for now.Johannes Obermayr2012-03-071-0/+1
| | | | | | | | | This fixes the libGLU.so.* build when a system libGL.so is not present since it is relying on the lib/ to build against until it gets converted to automake. Tested-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* glx: Convert to automake.Eric Anholt2012-02-293-119/+127
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>