Commit Graph

178 Commits

Author SHA1 Message Date
Emil Velikov 8ed08e69bc egl_dri2: add a note about dri2_create_screen
The function is not called by platform_drm. As such one needs to
pay special attention at teardown.

v2: Fix the comment block. Spotted by Ken.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2014-11-07 18:31:23 +00:00
Emil Velikov 38cec0303b egl_dri2: fix double free on drm platforms
Earlier commit failed to attribure that for drm platforms one does not
call dri2_create_screen, thus it does not create the screen and
driver_configs but inherits them from the "display" - gbm.

As such wrap cleanup in Platform != _EGL_PLATFORM_DRM to prevent
the issue and still cleanup correctly for non-drm platforms.

v2:
 - Drop the ifdef HAVE_DRM_PLATFORM, reindent the code and fix the
comment block. Suggested by Ken.

Reported-by: Kenneth Graunke <kenneth@whitecape.org>
Reported-by: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2014-11-07 18:29:08 +00:00
Emil Velikov ba0bb4227e egl_dri2: do not leak dri2_dpy->driver_configs
Walk through the list and free each config, and finally free the list
itself. Freeing approx 20KiB of memory, according to valgrind.
Inspired by a similar patch by enpeng xu.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-06 13:23:51 +00:00
Ilia Mirkin 1f4bc0c95e egl: don't exit process on initialization failure
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-08-16 17:52:54 -04:00
Pekka Paalanen 08264e5dad egl_dri2: fix EXT_image_dma_buf_import fds
The EGL_EXT_image_dma_buf_import specification was revised (according to
its revision history) on Dec 5th, 2013, for EGL to not take ownership of
the file descriptors.

Do not close the file descriptors passed in to eglCreateImageKHR with
EGL_LINUX_DMA_BUF_EXT target.

It is assumed, that the drivers, which ultimately process the file
descriptors, do not close or modify them in any way either. This avoids
the need to dup(), as it seems we would only need to just close the
dup'd file descriptors right after.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76188
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2014-08-14 21:30:57 +03:00
Giovanni Campagna e57ad3d38c dri: Add a new capabilities for drivers that can't share buffers
The kms-dri swrast driver cannot share buffers using the GEM,
so it must tell the loader to disable extensions relying on
that, without disabling the image DRI extension altogether
(which would prevent the loader from working at all).
This requires a new gallium capability (which is queried on
the pipe_screen and for swrast drivers it's forwarded to the
winsys), and requires a new version of the DRI image extension.

[Emil Velikov]
 - Rebased on top of gallium-dri megadrivers.
 - Drop PIPE_CAP_BUFFER_SHARE and sw_winsys::get_param hook.
The can_share_buffer cap is set at InitScreen. We use a different
InitScreen (and thus value for the cap) function for kms_dri, due to
deeper differences originating from dri megadrivers.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-07-30 16:43:41 +01:00
Matt Turner 6ac5adce63 egl: Remove unused variable dri_driver_path.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-06-17 10:18:12 -07:00
Emil Velikov 5cb1cad0ae egl/dri2: do not leak dri2_dpy->driver_name
Originally all hardware drivers duplicate the driver_name string
from an external source, while for the software rasterizer we set
it to "swrast". Follow the example set by hw drivers this way
we can free the string at dri2_terminate().

v2: Use strdup over strndup. Suggested by Ilia Mirkin.
v3: Handle platform_drm in a similar manner. Cleanup swrast
driver_name in error path.

Cc: Chia-I Wu <olv@lunarg.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-06-09 22:56:00 +01:00
Emil Velikov 6638c55838 egl_dri2: fix wayland_platform when drm_platform is not set
The build fails with implicit delaration of drmGetCap (xf86drm.h)
Were we're including the header only when building the DRM_PLATFORM.

Wayland backend can operate without DRM_PLATFORM so replace the
guard, and fold in drmGetCap() usage to silence compiler warnings.

Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-05-29 20:01:03 +01:00
Sarah Sharp c524f3ef91 egl: Add EGL_CHROMIUM_sync_control extension.
Chromium defined a new GL extension (that isn't registered with Khronos).
We need to add an EGL extension for it, so we can migrate ChromeOS on
Intel systems to use EGL instead of GLX.

http://git.chromium.org/gitweb/?p=chromium/src/third_party/khronos.git;a=commitdiff;h=27cbfdab35c601f70aa150581ad1448d0401f447

The EGL_CHROMIUM_sync_control extension is similar to the GLX extension
OML_sync_control, but only defines one function,
eglGetSyncValuesCHROMIUM, which is equivalent to glXGetSyncValuesOML.

http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Jamey Sharp <jamey@minilop.net>
Cc: Ian Romanick <idr@freedesktop.org>
Cc: Stéphane Marchesin <stephane.marchesin@gmail.com>
2014-05-20 15:19:48 -07:00
Emil Velikov a3e78bab7f egl_dri2: cleanup memory leak in dri2_create_context()
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2014-05-10 02:09:02 +01:00
Emil Velikov 5f280d0c44 egl_dri: rework dri extension handling
Use designated initialisers, and store the extensions pointers as const.

The loader extensions __DRIdri2LoaderExtension and __DRIswrastLoaderExtension
are setup by the platform backends so they should not be constified.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-04-28 19:13:38 +01:00
Emil Velikov 9b42fd1772 dri_interface: Update __DRItexBufferExtensionRec to version 3
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 <juan.j.zhao@intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-04-28 19:11:27 +01:00
Ander Conselvan de Oliveira 17860309f1 egl: Protect use of gbm_dri with ifdef HAVE_DRM_PLATFORM
Otherwise it fails to compile if the drm egl platform is disabled.

Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-25 21:17:54 +01:00
Jonathan Gray 0295953c5d egl/dri2: don't require libudev to build drm/wayland platforms
After the loader changes libudev is no longer required to
build gbm or the egl drm/wayland platforms.

Remove a libudev ifdef which allows the the drm egl driver
to be loaded on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-05 13:33:48 +01:00
Chad Versace 6d1f83ec09 egl/main: Stop using EGLNative types internally
Internally, much of the EGL code uses EGLNativeDisplayType,
EGLNativeWindowType, and EGLPixmapType. However, the EGLNative type
often does not match the variable's actual type.

The concept of EGLNative types are a bad match for Linux, as explained
below. And the EGL platform extensions don't use EGLNative types at all.
Those extensions attempt to solve cross-platform issues by moving the
EGL API away from the EGLNative types.

The core of the problem is that eglplatform.h can define each EGLNative
type once only, but Linux supports multiple EGL platforms.

To work around the problem, Mesa's eglplatform.h contains multiple
definitions of each EGLNative type, selected by feature macros. Mesa
expects EGL clients to set the feature macro approrpiately. But the
feature macros don't work when a single codebase must be built with
support for multiple EGL platforms, *such as Mesa itself*.

When building libEGL, autotools chooses the EGLNative typedefs based on
the first element of '--with-egl-platforms'. For example,
'--with-egl-platforms=x11,drm,wayland' defines the following:

    typedef Display* EGLNativeDisplayType;
    typedef Window   EGLNativeWindowType;
    typedef Pixmap   EGLNativePixmapType;

Clearly, this doesn't work well for Wayland and GBM.  Mesa works around
the problem by casting the EGLNative types to different things in
different files.

For sanity's sake, and to prepare for the EGL platform extensions, this
patch removes from egl/main and egl/dri2 all internal use of the
EGLNative types. It replaces them with 'void*' and checks each explicit
cast with a static assertion. Also, the patch touches egl_gallium the
minimal amount to keep it compatible with eglapi.h.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:39:23 -07:00
Chad Versace eef68a9094 egl/dri2: Dispatch eglCreateImageKHR by display, not driver
Add dri2_egl_display_vtbl::create_image, set it for each platform, and
let egl_dri2 dispatch eglCreateImageKHR to that.

To remove ambiguity, rename egl_dri2.c:dri2_create_image() to
dri2_create_image_from_dri().

This prepares for the EGL platform extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:39:23 -07:00
Chad Versace eadd5e0c0a egl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driver
Add dri2_egl_display_vtbl::create_wayland_buffer_from_image, set it for
each platform, and let egl_dri2 dispatch
eglCreateWaylandBufferFromImageWL to that.

This prepares for the EGL platform extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:39:22 -07:00
Chad Versace f506ef6784 egl/dri2: Consolidate eglTerminate
egl_dri2.c:dri2_terminate() handled terminating X11 and DRM displays.
The Wayland platform implemented its own dri2_wl_terminate(), which was
nearly a copy of the common one.

To implement the EGL platform extensions, we either need to dispatch
eglTerminate per display or define a common implementation for all
platforms. This patch chooses consolidation.  It removes
dri2_wl_terminate() by folding it into the common dri2_terminate().

It was necessary to invert the `if (disp->PlatformDisplay == NULL)` and
the switch statement because, unlike DRM and X11, Wayland's terminator
performed action even when EGL didn't own the native display. In the
inversion, I replaced `disp->PlatformDisplay == NULL` with
`dri2_dpy->own_device` because the two expressions are synonymous, but
the latter's meaning is clearer.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:39:22 -07:00
Chad Versace 688a0e8e73 egl/dri2: Dispatch eglPostSubBufferNV by display, not driver
Add dri2_egl_display_vtbl::post_sub_buffer, set it for each
platform, and let egl_dri2 dispatch eglPostSubBufferNV to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace 75d398ed93 egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver
Add dri2_egl_display_vtbl::swap_buffers_region, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersRegionNOK to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace bc2cbc0951 egl/dri2: Dispatch eglCopyBuffers by display, not driver
Add dri2_egl_display_vtbl::copy_buffers, set it for each
platform, and let egl_dri2 dispatch eglCopyBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace 3fdfbd2572 egl/dri2: Dispatch API.QueryBufferAge by display, not driver
Add dri2_egl_display_vtbl::query_buffer_age, set it for each
platform, and let egl_dri2 dispatch API.QueryBufferAge to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace 958dd80c40 egl/dri2: Dispatch eglDestroySurface by display, not driver
Add dri2_egl_display_vtbl::destroy_surface, set it for each
platform, and let egl_dri2 dispatch eglDestroySurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace bf20076baf egl/dri2: Dispatch eglCreatePbufferSurface by display, not driver
Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePbufferSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace bc8b07a657 egl/dri2: Dispatch eglCreatePixmapSurface by display, not driver
Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePixmapSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:04 -07:00
Chad Versace 0a0c881a13 egl/dri2: Dispatch eglCreateWindowSurface by display, not driver
Add dri2_egl_display_vtbl::create_window_surface, set it for each
platform, and let egl_dri2 dispatch eglCreateWindowSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:03 -07:00
Chad Versace d03948a766 egl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driver
Add dri2_egl_display_vtbl::swap_buffers_with_damage, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersWithDamageEXT to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:03 -07:00
Chad Versace ad173bcfdb egl/dri2: Dispatch eglSwapBuffers by display, not driver
Add dri2_egl_display_vtbl::swap_buffers, set it for each platform, and
let egl_dri2 dispatch eglSwapBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:03 -07:00
Chad Versace 8b9298af0a egl/dri2: Dispatch eglSwapInterval by display, not driver
Add dri2_egl_display_vtbl::swap_interval, set it for each platform, and
let egl_dri2 dispatch eglSwapInterval to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:03 -07:00
Chad Versace 90502b18b2 egl/dri2: Move dri2_egl_display virtual funcs to vtbl
dri2_egl_display has only one virtual function, 'authenticate'.  Define
dri2_egl_display::vtbl and move 'authenticate' there.

This prepares for the EGL platform extensions, which will add many
more virtual functions to dri2_egl_display.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-03-17 15:36:03 -07:00
Neil Roberts 551d459af4 Add the EGL_MESA_configless_context extension
This extension provides a way for an application to render to multiple
surfaces with different buffer formats without having to use multiple
contexts. An EGLContext can be created without an EGLConfig by passing
EGL_NO_CONFIG_MESA. In that case there are no restrictions on the surfaces
that can be used with the context apart from that they must be using the same
EGLDisplay.

_mesa_initialze_context can now take a NULL gl_config which will mark the
context as ‘configless’. It will memset the visual to zero in that case.
Previously the i965 and i915 drivers were explicitly creating a zeroed visual
whenever 0 is passed for the EGLConfig. Mesa needs to be aware that the
context is configless because it affects the initial value to use for
glDrawBuffer. The first time the context is bound it will set the initial
value for configless contexts depending on whether the framebuffer used is
double-buffered.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-12 14:40:47 -07:00
Quanxian Wang 1413a09f34 egl: break instead of looping after driver is found
Stop searching for a driver after success.

Signed-off-by: Quanxian Wang <quanxian.wang@intel.com>
Reviewed-By: Gong, Zhigang <zhigang.gong@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-19 12:44:11 -07:00
Samuel Thibault a594cec7e3 EGL: fix build without libdrm
This fixes building EGL without libdrm support.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-11-10 22:11:42 +01:00
Eric Anholt f93533d118 dri: Pass in the dlsym()ed driver extension to screen creation.
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 <mattst88@gmail.com> (v1)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-10-24 14:04:20 -07:00
Eric Anholt a64bb7553a egl: Add an optional function call for getting the DRI driver interface.
v2: Fix asprintf error checking.

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-24 14:04:20 -07:00
Kristian Høgsberg 44e584a73a egl_dri2: Remove depth argument from dri2_add_config()
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 <krh@bitplanet.net>
2013-10-15 22:07:52 -07:00
Kristian Høgsberg 1d34927061 wayland: Only pass wl_drm instance to gbm when using gbm platform 2013-10-11 15:30:09 -07:00
Kristian Høgsberg 360a141f24 wayland: Don't rely on static variable for identifying wl_drm buffers
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 <mesa-stable@lists.freedesktop.org>
2013-10-11 15:14:35 -07:00
Ander Conselvan de Oliveira 8d29b5271a egl: Update to Wayland 1.2 server API
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 <ander.conselvan.de.oliveira@intel.com>
2013-08-07 10:37:58 -07:00
Topi Pohjolainen 20de7f9f22 egl/dri2: support for creating images out of dma buffers
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 <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-08-02 08:56:03 +03:00
Ian Romanick 74cbe6e497 egl: Drop configs with unknown or invalide __DRI_ATTRIB_RENDER_TYPE
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 <ian.d.romanick@intel.com>
2013-07-18 16:03:42 -07:00
Tomasz Lis c37c367d38 dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPE
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-18 16:03:42 -07:00
Rob Bradford 15e64de9e6 wayland: Make eglQueryBufferWL succeed for width and height requests too
Following the addition of the EGL_WIDTH and EGL_HEIGHT this function should
return EGL_TRUE for those requested attributes too.
2013-05-02 16:46:04 -04:00
Chad Versace d3dfce3276 egl/dri2: Fix min/max swap interval of configs
The commit below exposed a bug in dri2_add_config.

    commit 3998f8c6b5
    Author: Ralf Jung <post@ralfj.de>
    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 <huax.lu@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-04-24 08:05:13 +02:00
Kristian Høgsberg 1670737436 egl_dri2: Lower __DRI_IMAGE version requirement back to 1
We check the extension version manually instead and verify that we have
the createImageFromFds function before enabling prime fd passing.
2013-03-19 16:13:38 -04:00
Kristian Høgsberg de315f76a2 wayland: Add prime fd passing as a buffer sharing mechanism
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
2013-03-18 21:15:41 -04:00
Ian Romanick 68a147e9a9 egl: Allow 24-bit visuals for 32-bit RGBA8888 configs
Previously only the 32-bit X visual would match the 32-bit RGBA8888
configs.  This resulted in every config with alpha getting the "magic"
visual whose alpha is used by the compositor.  This also resulted in no
multisample visuals being advertised.  How many ways could we lose?

This patch inverts the problem... now you can't get the visual with
alpha used by the compositor even if you want it.  I think we need to
invent a new value for EGL_TRANSPARENT_TYPE that apps can use to get
this.  I'm surprised that there isn't already a choice for
EGL_TRANSPARENT_ALPHA.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tian Ye <yex.tian@intel.com>
Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59783
2013-02-26 09:42:31 -08:00
José Fonseca 5048e69392 egl/dri: Don't invoke dri2_dpy->flush if it's NULL.
I'd like to test Mesa OpenGL ES along side with NVIDIA libGL drivers. But
without this change, I get a NULL pointer dereference.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-02-06 09:22:26 +00:00
Vinson Lee 080e91aa07 egl/dri2: Fix memory leak.
Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-02-01 22:50:34 -08:00