summaryrefslogtreecommitdiffstats
path: root/src/egl
Commit message (Collapse)AuthorAgeFilesLines
* egl_dri2: call dri2_add_configs_for_visuals after extensions setTapani Pälli2014-01-131-5/+6
| | | | | | | | dri2_add_config makes decisions based on NOK_texture_from_pixmap so it needs to be enabled before calling dri2_add_configs_for_visuals. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: break instead of looping after driver is foundQuanxian Wang2013-12-191-0/+3
| | | | | | | | Stop searching for a driver after success. Signed-off-by: Quanxian Wang <[email protected]> Reviewed-By: Gong, Zhigang <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* egl/wayland: Return -1 from get_back_bo to indicate errorKristian Høgsberg2013-12-091-1/+1
| | | | | A return value of -1 indicate failure to allocate the back buffer and means we don't segfault on the way out.
* egl_dri2: Remove the unused swap_interval member of dri2_egl_surfaceNeil Roberts2013-12-091-1/+0
| | | | | | The _EGLSurface struct which is embedded into dri2_egl_surface also contains a swap interval member so the other member is redundant. Nothing was using it as far as I can tell.
* wayland: Add support for eglSwapIntervalNeil Roberts2013-12-073-40/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Wayland EGL platform now respects the eglSwapInterval value. The value is clamped to either 0 or 1 because it is difficult (and probably not useful) to sync to more than 1 redraw. The main change is that if the swap interval is 0 then Mesa won't install a frame callback so that eglSwapBuffers can be executed as often as necessary. Instead it will do a sync request after the swap buffers. It will block for sync complete event in get_back_bo instead of the frame callback. The compositor is likely to send a release event while processing the new buffer attach and this makes sure we will receive that before deciding whether to allocate a new buffer. If there are no buffers available then instead of returning with an error, get_back_bo will now poll the compositor by repeatedly sending sync requests every 10ms. This is a last resort and in theory this shouldn't happen because there should be no reason for the compositor to hold on to more than three buffers. That means whenever we attach the fourth buffer we should always get an immediate release event which should come in with the notification for the first sync request that we are throttled to. When the compositor is directly scanning out from the application's buffer it may end up holding on to three buffers. These are the one that is is currently scanning out from, one that has been given to DRM as the next buffer to flip to, and one that has been attached and will be given to DRM as soon as the previous flip completes. When we attach a fourth buffer to the compositor it should replace that third buffer so we should get a release event immediately after that. This patch therefore also changes the number of buffer slots to 4 so that we can accomodate that situation. If DRM eventually gets a way to cancel a pending page flip then the compositors can be changed to only need to hold on to two buffers and this value can be put back to 3. This also moves the vblank configuration defines from platform_x11.c to the common egl_dri2.h header so they can be shared by both platforms.
* wayland: Block for the frame callback in get_back_bo not dri2_swap_buffersNeil Roberts2013-12-071-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider a typical game-style main loop which might be like this: while (1) { draw_something(); eglSwapBuffers(); } In this case the game is relying on eglSwapBuffers to throttle to a sensible frame rate. Previously this game would end up using three buffers even though it should only need two. This is because Mesa decides whether to allocate a new buffer in get_back_bo which would be before it has tried to read any events from the compositor so it wouldn't have seen any buffer release events yet. This patch just moves the block for the frame callback to get_back_bo. Typically the compositor will send a release event immediately after one of the attaches so if we block for the frame callback here then we can be sure to have completed at least one roundtrip and received that release event after attaching the previous buffer before deciding whether to allocate a new one. dri2_swap_buffers always calls get_back_bo so even if the client doesn't render anything we will still be sure to block to the frame callback. The code to create the new frame callback has been moved to after this call so that we can be sure to have cleared the previous frame callback before requesting a new one.
* wayland: Add an extension to create wl_buffers from EGLImagesNeil Roberts2013-12-045-0/+113
| | | | | | | | | | | | | | | | | | This adds an extension called EGL_WL_create_wayland_buffer_from_image which adds the following single function: struct wl_buffer * eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImageKHR image); The function creates a wl_buffer which shares its contents with the given EGLImage. The expected use case for this is in a nested Wayland compositor which is using subsurfaces to present buffers from its clients. Using this extension it can attach the client buffers directly to the subsurface without having to blit the contents into an intermediate buffer. The compositing can then be done in the parent compositor. The extension is only implemented in the Wayland EGL platform because of course it wouldn't make sense anywhere else.
* egl/wayland: Damage INT32_MAX x INT32_MAX region for eglSwapBuffersKristian Høgsberg2013-12-041-2/+2
| | | | | | | | | | | | | | | | If we're not using EGL_EXT_swap_buffers_with_damage, we have to damage the full extent. EGL operates on buffer coordinates, but wl_surface.damage takes surface coordinates. EGL doesn't know the buffer transformation (rotated or scaled) and can't post accurate damage in surface coordinates. The damage event however is clipped to the surface extents so we can just damage the maximum rectangle. In case of EGL_EXT_swap_buffers_with_damage, the application knows the buffer transform and is expected to pass in rectangles in surface space. https://bugs.freedesktop.org/show_bug.cgi?id=70250 Cc: "10.0" [email protected]
* Enable throttling in SwapBuffersAxel Davy2013-12-041-1/+13
| | | | | | | | | flush_with_flags, when available, allows the driver to throttle. Using this suppress input lag issues that can be observed in heavy rendering situations on non-intel cards. Signed-off-by: Axel Davy <[email protected]> Cc: "10.0" [email protected]
* egl/wayland: Send commit after flushing the driver contextKristian Høgsberg2013-12-041-2/+1
| | | | | | | | | | This typically won't make a difference, since we only send the requests at wl_display_flush() time. There might be a small race with another thread calling wl_display_flush() after our commit request, but before we flush the DRI driver. Moving the commit below the DRI driver flush call looks more natural and eliminates the small race. Cc: "10.0" [email protected]
* egl/wayland: Flush the wl_display at the end of SwapBuffersAxel Davy2013-12-041-0/+2
| | | | | | | | | | We would like the compositor to receive the commited buffer as soon as possible, so it has the time to treat it, and release old ones. We shouldn't rely on the client to flush the queue for us. Signed-off-by: Axel Davy <[email protected]> Cc: "10.0" [email protected]
* egl: add HAVE_LIBDRM define, fix EGL X11 platformTapani Pälli2013-12-031-6/+3
| | | | | | | | | | | | | | | | | | | | Commit a594cec broke EGL X11 backend by adding dependency between X11 and DRM backends requiring HAVE_EGL_PLATFORM_DRM defined for X11. This patch fixes the issue by adding additional define for libdrm detection independent of which backend is being compiled. Tested by compiling Mesa with '--with-egl-platforms=x11' and running es2gears_x11 + glbenchmark2.7 successfully. v2: return true for dri2_auth if running without libdrm (Samuel) v3: check libdrm when building EGL drm platform + AM_CFLAGS fix (Emil) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72062 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: Samuel Thibault <[email protected]> Cc: [email protected]
* egl: Kill macro _EGL_DECLARE_MUTEXChad Versace2013-11-265-8/+5
| | | | | | | | | | | | | | | Replace all occurences of the macro with its expansion. It seems that the macro intended to provide cross-platform static mutex intialization. However, it had the same definition in all pre-processor paths: #define _EGL_DECLARE_MUTEX(m) _EGLMutex m = _EGL_MUTEX_INITIALIZER Therefore this abstraction obscured rather than helped. Signed-off-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* egl: Enable EGL_EXT_client_extensionsChad Versace2013-11-263-1/+22
| | | | | | | | | | | | | | Insert two fields into _egl_global to hold the client extensions and statically initialize them: ClientExtensions // a struct of bools ClientExtensionString Post-patch, Mesa supports exactly one client extension, EGL_EXT_client_extensions. Signed-off-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* wayland: Use __DRIimage based getBuffers implementation when availableKristian Høgsberg2013-11-122-47/+96
| | | | | | | | | | | This lets us allocate color buffers as __DRIimages and pass them into the driver instead of having to create a __DRIbuffer with the flink that requires. Signed-off-by: Kristian Høgsberg <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: "10.0" <[email protected]>
* gbm: Add support for __DRIimage based getBuffers when availableKristian Høgsberg2013-11-121-8/+38
| | | | | | | | | | | | | | | | | | This lets us allocate color buffers as __DRIimages and pass them into the driver instead of having to create a __DRIbuffer with the flink that requires. With this patch, we can now run gbm on render-nodes. A render-node is a drm device that doesn't support modesetting and all the legacy DRI ioctls. flink is also not supported, but now that gbm doesn't need flink, we can run piglit on head-less gbm or head-less GPGPU. Signed-off-by: Kristian Høgsberg <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Tested-by: Jordan Justen <[email protected]> Cc: "10.0" <[email protected]>
* EGL: fix build without libdrmSamuel Thibault2013-11-102-0/+22
| | | | | | This fixes building EGL without libdrm support. Signed-off-by: Samuel Thibault <[email protected]>
* wayland: silence unused var warningFabio Pedretti2013-10-301-2/+0
| | | | Reviewed-by: Chad Versace <[email protected]>
* dri: Pass in the dlsym()ed driver extension to screen creation.Eric Anholt2013-10-242-6/+25
| | | | | | | | | | | 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]>
* egl: Add an optional function call for getting the DRI driver interface.Eric Anholt2013-10-241-2/+18
| | | | | | | | v2: Fix asprintf error checking. Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* wayland: Don't leak wl_drm global when unbinding displayAnder Conselvan de Oliveira2013-10-221-2/+5
|
* egl_dri2: Set NativeVisualID to the matching GBM config for the gbm platformKristian Høgsberg2013-10-151-2/+21
| | | | | | The EGLConfig doesn't have the rgba masks, only the rgba sizes. To make sure a config is usable with a given GBM/KMS format, we need a way to make sure the formats really match.
* egl_dri2: Remove depth argument from dri2_add_config()Kristian Høgsberg2013-10-156-26/+14
| | | | | | | | | | | | | | All callers now use the more correct rgba mask mechanism for filtering out mathcing DRI configs. Even if depth and buffer size match, the color component layout can be different, or in case or ARGB8888 and ARGB2101010 the color components can even be different sizes. Since anything that the depth check would reject is also rejected by the rgba mask comparison, the depth parameter is redundant and not specific enough. We should probably have removed it when the rgba masks argument was introduced, but better late than never. Signed-off-by: Kristian Høgsberg <[email protected]>
* egl_dri2: Match X11 visuals using rgba masks instead of depthKristian Høgsberg2013-10-151-1/+20
| | | | | | | | | | | | | | Matching on visual depth to buffer size makes 8 bpc RGBA look similar to 10 bit RGB with 2 bit alphs - both have buffer size 32. Instead, build the rgba masks from the visual data and use that for finding matching DRI configs. We need to keep the special case that allows us to match 24 bit visuals to DRI configs with buffer size 32. We do that by creating an alpha mask of "all the non-rgb bits" for 24 bit visuals and matching a second time with that. Signed-off-by: Kristian Høgsberg <[email protected]>
* egl-wayland: Add support for RGB565 pixel format for Wayland clientsSingh, Satyeshwar2013-10-152-2/+14
| | | | | | | With this patch Wayland clients can now ask EGL for RGB 565 format buffers and attach them to a Wayland compositor. Signed-off-by: Kristian Høgsberg <[email protected]>
* wayland: Only pass wl_drm instance to gbm when using gbm platformKristian Høgsberg2013-10-111-1/+2
|
* wayland: Don't rely on static variable for identifying wl_drm buffersKristian Høgsberg2013-10-113-12/+20
| | | | | | | | | | | | Now that libEGL has been fixed to not leak all kinds of symbols, gbm links to its own copy of the libwayland-drm.a helper library. That means we can't rely on comparing the addresses of a static vtable symbol in that library to determine if a wl_buffer is a wl_drm_buffer. Instead, we move the vtable into the wl_drm struct and use that for comparing. https://bugs.freedesktop.org/show_bug.cgi?id=69437 Cc: 9.2 <[email protected]>
* egl/main: remove undefined X11_LIBS automake variableGaetan Nadon2013-10-091-1/+1
| | | | | | | | | | | | | | | | The EGL library has some references to x11 but it gets the link flags from the XCB_DRI2_LIBS if and only if HAVE_EGL_PLATFORM_X11 is true. The X11_LIBS variable was probably coming from a PKG_CHECK_MODULES (x11) earlier in history. If it is possible to have HAVE_EGL_DRIVER_GLX without HAVE_EGL_PLATFORM_X11 then the link flags for libX11 should be passed. However, it won't come from X11_LIBS which is undefined. Reported-by: Emil Velikov <[email protected]> Acked-by: Emil Velikov <[email protected]> Signed-off-by: Gaetan Nadon <[email protected]>
* Use -Bsymbolic when linking libEGL.soCarl Worth2013-09-301-1/+1
| | | | | | | | | | | | | | | | | | | For some reason that I don't yet fully understand, Glaze does not work with libEGL unless libEGL is linked with -Bsymbolic.[*] Beyond that specific reason, all of the reasons for which libGL.so is linked with -Bsymbolic, (see the commit history), should also apply here. [*] The specific behavior I am seeing is that when Glaze calls dlopen for libEGL.so, ifunc resolvers within Glaze for EGL functions are called before the dlopen returns. These resolvers cannot succeed, as they need the return value from dlopen in order to find the functions to resolve to. I don't know what's causing these resolvers to be called, but I have verified that linking libEGL with -Bsymbolic causes this problematic behavior to stop. CC: "9.1 and 9.2" <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glx: fix compile error in egl_glx.c.Gaetan Nadon2013-09-191-1/+1
| | | | | | | | | | | | | | | | | egl_glx.c:40:22: fatal error: X11/Xlib.h: No such file or directory The compiler cannot find the Xlib.h in the installed system headers. All supplied include directives point to inside the mesa module. The X11_CFLAGS variable is undefined (not defined in config.status). It appears the intent was to use X11_INCLUDES defined in configure.ac. The Xlib.h file is not installed on my workstation. It is supplied in the libx11-dev package. This allows an X developer control over which version of this file is used for X development. Signed-off-by: Gaetan Nadon <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* wayland-egl.pc requires wayland-client.pc.Torsten Duwe2013-09-111-0/+1
| | | | | | | | | Mesa provides the wayland-egl libs and the pkgconfig file, but the headers originate from the wayland package. Ensure everything matches, by requiring application builds to look at the wayland headers as well. Signed-off-by: Torsten Duwe <[email protected]> Signed-off-by: Johannes Obermayr <[email protected]>
* gbm: Link to libwayland-drm if Wayland EGL platform is enabledArmin K2013-08-121-4/+0
| | | | | | | | We were relying on libEGL to pull in libwayland-client symbols, but with commit 2c2e64edaba0f6aeb181ca5b51eb8dea8e9b39f9 cleaned up the symbol leak. https://bugs.freedesktop.org/show_bug.cgi?id=67962
* egl: Do not export private symbolsChad Versace2013-08-085-0/+5
| | | | | | | | | | | | | | | | | | | | | | libEGL was incorrectly exporting *all* symbols, public and private. This patch adds -fvisibility=hidden to libEGL's linker flags to ensure that only symbols annotated with __attribute__((visibility("default"))) get exported. Sanity-checked with libEGL's builtin DRI2 driver and the i965 DRI driver by running Piglit on X/EGL and by running weston-gears on Weston as an X client. Sanity-checked with libEGL's Gallium driver (which is not built-in) and the swrast Gallium driver by running es2gears_x11. Kristian reviewed the symbol diff in `nm libEGL.so`. CC: "9.2" <[email protected]> CC: Ian Romanick <[email protected]> Acked-by: Kristian Høgsberg <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl: Update to Wayland 1.2 server APIAnder Conselvan de Oliveira2013-08-076-47/+65
| | | | | | | | | | Since Wayland 1.2, struct wl_buffer and a few functions are deprecated. References to wl_buffer are replaced with wl_resource and some getter functions and calls to deprecated functions are replaced with the proper new API. The latter changes are related to resource versioning. Signed-off-by: Ander Conselvan de Oliveira <[email protected]>
* egl/dri2: support for creating images out of dma buffersTopi Pohjolainen2013-08-021-0/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: - upon success close the given file descriptors v3: - use specific entry for dma buffers instead of the basic for primes, and enable the extension based on the availability of the hook v4 (Chad): - use ARRAY_SIZE - improve the comment about the number of file descriptors - in case of invalid format report EGL_BAD_ATTRIBUTE instead of EGL_BAD_MATCH - take into account specific error set by the driver. v5: - fix error handling v6 (Chad): - fix invalid plane count checking v7 (Chad): - fix indentation and reset loop counter before checking for excess attributes Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: definitions for EXT_image_dma_buf_importTopi Pohjolainen2013-08-025-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As specified in: http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt Checking for the valid fourcc values is left for drivers avoiding dependency to drm header files here. v2: enforce EGL_NO_CONTEXT v3: declare the extension as EGL (not GLES) v4: do not update eglext.h manually but rely on update from Khronos instead v5: (Eric) report invalid context as EGL_BAD_PARAMETER instead of as EGL_BAD_CONTEXT v6: (Chad) fix the checking for valid hints. Before all values were rejected. v7: (Chad) comment style change from /** * Multi- * line into /* Multi- * line Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: Restore "bogus" DRI2 invalidate event code.Eric Anholt2013-07-311-0/+14
| | | | | | | | | | | | | | | | | | | | I had removed it in commit 1e7776ca2bc59a6978d9b933d23852d47078dfa8 because it was obviously wrong -- why do we care whether the server is a version that emits events, if we're not watching for the server's events, anyway? And why would you only invalidate on a server that emits invalidate events, when the comment said to emit invalidates if the server *doesn't*? Only, I missed that we otherwise don't flag that our buffers might have changed at swap time at all, so the driver was only checking for new buffers when triggered by the Viewport hack. Of course you don't expect Viewport to be called after a swap. So, this is effectively a revert of the previous commit, except that I dropped the check for only emitting invalidates on a new server -- we *always* need to invalidate if we're doing a SwapBuffers. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63435 Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.1 and 9.2" <[email protected]>
* egl/build: Remove unused GLAPI_LIB.Matt Turner2013-07-221-2/+0
|
* egl: Drop configs with unknown or invalide __DRI_ATTRIB_RENDER_TYPEIan Romanick2013-07-181-1/+1
| | | | | | | Some render types, such as floating-point, aren't valid with EGL. Return NULL in those cases to drop them. Signed-off-by: Ian Romanick <[email protected]>
* dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPETomasz Lis2013-07-181-1/+1
| | | | | | | | | | | | | | 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 <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* wayland: Handle global_remove event as wellKristian Høgsberg2013-06-181-1/+8
| | | | | | | | | | | | We need to set up a handler for the global_remove event that gets sent out when a global gets removed. Without the handler we end up calling a NULL pointer. https://bugs.freedesktop.org/show_bug.cgi?id=65910 NOTE: This is a candidate for the stable branches. Signed-off-by: Kristian Høgsberg <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* egl/android: Fix error condition for EGL_ANDROID_image_native_bufferChad Versace2013-05-081-2/+14
| | | | | | | | | | | | | Emit EGL_BAD_CONTEXT if the user passes a context to eglCreateImageKHR(type=EGL_ANDROID_image_native_buffer). From the EGL_ANDROID_image_native_buffer spec: * If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. Note: This is a candidate for the stable branches. Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/wayland: Implement EGL_EXT_swap_buffers_with_damageRobert Bragg2013-05-071-3/+26
| | | | | Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* egl: Add extension infrastructure for EGL_EXT_swap_buffers_with_damageRobert Bragg2013-05-074-0/+41
| | | | | Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* android: libsync is needed on Android 4.2+ for any driverChia-I Wu2013-05-061-5/+3
| | | | | | | | Add libsync not only for MESA_BUILD_CLASSIC, but also for MESA_BUILD_GALLIUM. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* android: add ilo to the build systemChia-I Wu2013-05-061-0/+6
| | | | | | | | | It can be selected with BOARD_GPU_DRIVERS := ilo Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* wayland: Make eglQueryBufferWL succeed for width and height requests tooRob Bradford2013-05-021-2/+2
| | | | | Following the addition of the EGL_WIDTH and EGL_HEIGHT this function should return EGL_TRUE for those requested attributes too.
* egl/dri2: Fix min/max swap interval of configsChad Versace2013-04-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit below exposed a bug in dri2_add_config. commit 3998f8c6b5da1a223926249755e54d8f701f81ab Author: Ralf Jung <[email protected]> Date: Tue Apr 9 14:09:50 2013 +0200 egl/x11: Fix initialisation of swap_interval This little code snippet near the bottom of dri2_add_config, if (double_buffer) { ... conf->base.MinSwapInterval = dri2_dpy->min_swap_interval; conf->base.MaxSwapInterval = dri2_dpy->max_swap_interval; } it never did what it claimed to do. The assignment never changed the value of conf->base.MaxSwapInterval, because dri2_dpy->max_swap_interval was, until the above exposing commit, unitialized here. That is, conf->base.MaxSwapInterval was 0 before and after assignment. Ditto for the min swap interval. Above the troublesome code snippet, the call to _eglFilterArray rejects the config as unmatching if its swap interval bounds differ from the base config's. Before the exposing commit, at the call to _eglFilterArray, the swap interval bounds were always [0,0], and hence no config was rejected due to swap interval. After the exposing commit, _eglFilterArray incorrectly rejected some configs, which prevented dri2_egl_config::dri_double_config from getting set for the rejected config, which resulted in a NULL pointer getting passed into dri2CreateNewDrawable, and then segfault. The solution: set the swap interval bounds before _eglFilterArray. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63447 Tested-by: Lu Hua <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: NULL check value returned by dri2_create_surfaceIan Romanick2013-04-121-8/+9
| | | | | | | | | | | | | | | dri2_create_surface can fail for a variety of reasons, including bad input data. Dereferencing the NULL pointer and crashing is not okay. Fixes issue identified by Klocwork analysis: Pointer 'surf' returned from call to function 'dri2_create_surface' at line 285 may be NULL and will be dereferenced at line 291. NOTE: This is a candidate for the stable branches. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>