summaryrefslogtreecommitdiffstats
path: root/src/egl
Commit message (Collapse)AuthorAgeFilesLines
* egl/dri2: Properly dereference array.Matt Turner2015-10-071-3/+3
| | | | | | | | | | Fixes a regression that broke EGL since commit 858f2f2ae6d72f338fdd6d544b0c733814e22724 Author: Emil Velikov <[email protected]> Date: Sun Sep 13 12:25:27 2015 +0100 egl/dri2: ease srgb __DRIconfig conditionals
* egl/dri2: enable EGL_KHR_gl_colorspace for swrastEmil Velikov2015-10-073-16/+19
| | | | | | | | | | No driver changes needed for softpipe/llvmpipe - things just work. v2: Whitespace fixes. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Boyan Ding <[email protected]> Acked-by: Alex Deucher <[email protected]>
* egl/dri2: ease srgb __DRIconfig conditionalsEmil Velikov2015-10-072-29/+14
| | | | | | | | One can simplify the if-else chain, by declaring the driconfigs as a two sized array, whist using srgb as a index to the correct entry. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Alex Deucher <[email protected]>
* egl: move memcpy to bring conf->base operations togetherVarad Gautam2015-10-071-1/+1
| | | | | | Signed-off-by: Varad Gautam <[email protected]> Suggested-by: Emil Velikov <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: restore surface type before linking config to its displayVarad Gautam2015-10-071-0/+2
| | | | | | | | | | | | | | commit c2c2e9a (egl: implement EGL_KHR_gl_colorspace (v2)) leaves _EGLConfig->SurfaceType set incorrectly before calling _eglLinkConfig(), and the bad value is passed around to platform_android. set it to zero as earlier. v2: Set SurfaceType to 0, rather than surface_type (Suggested by Emil) Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91596 Signed-off-by: Varad Gautam <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/dri2: don't require a context for ClientWaitSync (v2)Marek Olšák2015-10-031-2/+7
| | | | | | | | | | | The spec doesn't require it. This fixes a crash on Android. v2: don't set any flags if ctx == NULL v3: add the spec note Cc: 10.6 11.0 <[email protected]> Reviewed-by: Albert Freeman <[email protected]> Reviewed-by: Frank Binns <[email protected]>
* egl: rework handling EGL_CONTEXT_FLAGSMatthew Waters2015-10-031-5/+44
| | | | | | | | | | | | | | | | | | As of version 15 of the EGL_KHR_create_context spec, debug contexts are allowed for ES contexts. We should allow creation instead of erroring. While we're here provide a more comprehensive checking for the other two flags - ROBUST_ACCESS_BIT_KHR and FORWARD_COMPATIBLE_BIT_KHR v2 [Emil Velikov] Rebase. Minor tweak in commit message. Cc: Boyan Ding <[email protected]> Cc: Chad Versace <[email protected]> Cc: "10.6 11.0" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91044 Signed-off-by: Matthew Waters <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* egl: Fix missing Haiku include pathAlexander von Gluck IV2015-09-281-0/+1
|
* wayland: Add copyright notice for wayland-egl.cKristian Høgsberg Kristensen2015-09-241-0/+29
| | | | Signed-off-by: Kristian Høgsberg Kristensen <[email protected]>
* egl/dri2: don't leak the fd on dri2_terminateEmil Velikov2015-09-153-1/+3
| | | | | | | | | | Currently the check was incorrect as it did not consider the (unlikely) case of fd == 0. In order to fix this we should first correctly initialize it to -1, as the swrast implementations leave it set to zero (props to calloc()). Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Boyan Ding <[email protected]>
* egl/dri2/drm: compact existing device mgmtEmil Velikov2015-09-151-6/+4
| | | | | | | | | Move the fcntl(dupfd_cloexec) to the else branch where it belongs. Otherwise it's not immediately obvious that the code is hit, only when an existing device is used. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Boyan Ding <[email protected]>
* egl/dri2: Close file descriptor on error.Matt Turner2015-09-151-13/+14
| | | | | | | | | | v2: [Emil Velikov] Rework the error path to a common goto, close only if we own the fd. v3; [Emil Velikov] Always close the fd (we either opened the device or dup'd) (Boyan, Ian) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Boyan Ding <[email protected]>
* egl_dri2: Add support for EGL_KHR_create_contest when using swrastBoyan Ding2015-09-091-1/+2
| | | | | | | | | This requires swrast version >= 3. Also EGL_EXT_create_context_robostness is supported if __DRI2_ROBUSTNESS extension is found. Reference: https://bugs.freedesktop.org/show_bug.cgi?id=80821 Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Boyan Ding <[email protected]>
* egl_dri2: Use createContextAttribs if swrast version >= 3Boyan Ding2015-09-091-6/+27
| | | | | | | v2: Change return type of the new function from int to bool Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Boyan Ding <[email protected]>
* egl_dri2: Move filling context_attrib array in a separate functionBoyan Ding2015-09-091-36/+54
| | | | | | | | v2: Change return type of the new function from int to bool Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Boyan Ding <[email protected]>
* mesa: Fix warning about static being in the wrong placeIan Romanick2015-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | Because the compiler already has enough things to complain about. grep -rl 'const static' src/ | while read f do sed --in-place -e 's/const static/static const/g' $f done brw_eu_emit.c: In function 'brw_reg_type_to_hw_type': brw_eu_emit.c:98:7: warning: 'static' is not at beginning of declaration [-Wold-style-declaration] const static int imm_hw_types[] = { ^ brw_eu_emit.c:120:7: warning: 'static' is not at beginning of declaration [-Wold-style-declaration] const static int hw_types[] = { ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* egl: scons: fix the haiku build, do not build the dri2 backendAlexander von Gluck IV2015-08-221-1/+0
| | | | Reviewed-by: Emil Velikov <[email protected]>
* egl/wayland: define set_cloexec_or_close only when mkostemp is not present11.0-branchpointBoyan Ding2015-08-221-0/+4
| | | | | | | | | | | Fixes a compiler warning of defined but not used function when HAVE_MKOSTEMP is defined. Fixes: eb3e2562a4b(configure.ac: check for mkostemp()) Signed-off-by: Boyan Ding <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* mesa/egl: Resolve GCC sign-compare warning.Rhys Kidd2015-08-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | mesa/src/egl/drivers/dri2/platform_drm.c: In function 'release_buffer': mesa/src/egl/drivers/dri2/platform_drm.c:73:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ^ mesa/src/egl/drivers/dri2/platform_drm.c: In function 'has_free_buffers': mesa/src/egl/drivers/dri2/platform_drm.c:87:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) ^ mesa/src/egl/drivers/dri2/platform_drm.c: In function 'dri2_drm_destroy_surface': mesa/src/egl/drivers/dri2/platform_drm.c:199:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ^ mesa/src/egl/drivers/dri2/platform_drm.c: In function 'get_back_bo': mesa/src/egl/drivers/dri2/platform_drm.c:224:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { ^ mesa/src/egl/drivers/dri2/platform_drm.c: In function 'dri2_drm_swap_buffers': mesa/src/egl/drivers/dri2/platform_drm.c:425:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) ^ Signed-off-by: Rhys Kidd <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* egl: improve attribute checking for eglCreateContextFrank Binns2015-08-131-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | The EGL 1.4 spec states for eglCreateContext: "attribute EGL_CONTEXT_CLIENT_VERSION is only valid when the current rendering API is EGL_OPENGL_ES_API" Additionally, if the EGL_KHR_create_context EGL extension is supported (this is mandatory in EGL 1.5) then the EGL_CONTEXT_MAJOR_VERSION_KHR, which is an alias for EGL_CONTEXT_CLIENT_VERSION, and EGL_CONTEXT_MINOR_VERSION_KHR attributes are also accepted by eglCreateContext with the extension spec stating: "The values for attributes EGL_CONTEXT_MAJOR_VERSION_KHR and EGL_CONTEXT_MINOR_VERSION_KHR specify the requested client API version. They are only meaningful for OpenGL and OpenGL ES contexts, and specifying them for other types of contexts will generate an error." Add the necessary checks against the extension and rendering APIs when validating these attributes as part of eglCreateContext. Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Matt Turner <[email protected]> [Emil Velikov: Add newline before the spec quote (Matt)] Reviewed-by: Emil Velikov <[email protected]>
* egl: don't allow eglGetConfigs to set num_configs param to a negative valueFrank Binns2015-08-131-0/+3
| | | | | | | | | | | | | | | | | | When a buffer is provided to eglGetConfigs it's supposed to set the value of the num_config parameter to the total number of configs that have been copied into this buffer. For some reason the EGL spec doesn't consider it to be an error to pass this function a buffer while specifying its size to be less than 0. Given this, one would expect this combination to result in the num_config parameter being set to 0 but this wasn't the case. This was due to the buffer size being copied straight into num_configs without being clamped to 0. This was causing the following dEQP EGL test to fail: dEQP-EGL.functional.query_config.get_configs.get_configs_bounds Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/x11: don't abort when creating a DRI2 drawable failsFrank Binns2015-08-131-1/+19
| | | | | | | | | | | | | When calling either eglCreateWindowSurface or eglCreatePixmapSurface it was possible for an application to be aborted as a result of it failing to create a DRI2 drawable on the server. This could happen due to an application passing in an invalid native drawable handle, for example. v2: Handle the case where an error has been set on the connection Cc: <[email protected]> Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/x11: set EGL_BAD_NATIVE_(PIXMAP|WINDOW) for invalid pixmaps/windowsFrank Binns2015-08-131-4/+12
| | | | | | | | | | | | | | | | | | | | Both eglCreatePixmapSurface and eglCreateWindowSurface were incorrectly setting the EGL error to be EGL_BAD_ALLOC when an invalid native drawable handle was being passed in. The EGL spec states the following for eglCreatePixmapSurface: "If pixmap is not a valid native pixmap handle, then an EGL_BAD_- NATIVE_PIXMAP error should be generated." (eglCreateWindowSurface has similar text) Correctly set the EGL error value based on xcb_get_geometry_reply returning an error structure containing something other than BadAlloc. v2: Check for BadAlloc error and update commit message to reflect this Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/x11: fix use of EGL_BAD_NATIVE_WINDOWFrank Binns2015-08-131-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4ed23fd590 introduced some calls to _eglError inappropriately passing it EGL_BAD_NATIVE_WINDOW. This was actually harmless in two of the cases as _eglError gets called later on with a more appropriate error code but (just to be safe) switch these to _eglLog calls instead. The final case is a little trickier as it actually needs to set an error of which the following are available (according to the EGL spec): EGL_BAD_MATCH, EGL_BAD_CONFIG, EGL_BAD_NATIVE_(PIXMAP|WINDOW) and EGL_BAD_ALLOC. Of these, EGL_BAD_ALLOC seems to be the most appropriate given that failure can occur either as a result of xcb_get_setup failing due to an earlier error on the connection (where the most commonly occurring error code is XCB_CONN_CLOSED_MEM_INSUFFICIENT) or as a result of the xcb_screen_iterator_t 'rem' field being 0. In addition to this, commit af2aea40d2 unconditionally set the error to EGL_BAD_NATIVE_WINDOW when creating a window or pixmap surface with a NULL native handle. Change this to correctly set the error based on surface type. v2: Updated patch description (Emil Velikov) Return EGL_BAD_NATIVE_PIXMAP when eglCreatePixmapSurface is called with a NULL native pixmap handle Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl/x11: Fix driver_name acquisitionBoyan Ding2015-08-081-6/+5
| | | | | | | | | | | | | We don't need to free driverName string from dri2 reply, on the other hand, the driver name acquired from loader doesn't need duplication. Fixes: 45e110bad9d (egl/x11: trust our loader over the xserver for the drivername) Reported-by: Timothy Arceri <[email protected]> Signed-off-by: Boyan Ding <[email protected]> [Emil Velikov: use brackets for both branches of conditional] Reviewed-by: Emil Velikov <[email protected]>
* egl/dri2: Fix include path of u_atomic.h introduced e7e29189Alexander von Gluck IV2015-08-073-1/+3
| | | | | | | | This was causing a failure to build on SCons due to a missing -Isrc/egl. Instead of adding in that path, lets just -Isrc/ and include "utils/u_atomic.h". Reviewed-by: Matt Turner <[email protected]>
* egl/x11: don't crash if dri2_dpy->conn is NULLEmil Velikov2015-08-071-5/+3
| | | | | | | Identical to commit 60e9c35b3a0(egl/x11: bail out if we cannot fetch the xcb connection) but for the swrast codepath. Signed-off-by: Emil Velikov <[email protected]>
* egl/x11: auth with xserver before attempting to open the dri moduleEmil Velikov2015-08-071-3/+3
| | | | | | | | | No real change, apart from keeping the calls to the underlying winsys (x11) next to each other. Just like platform_wayland. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/x11: trust our loader over the xserver for the drivernameEmil Velikov2015-08-071-1/+11
| | | | | | | | | | | | | This is a port of commit 7bd95ec437a(dri2: Trust our own driver name lookup over the server's.) from glx/dri2. v2: Add newline between code and multiline comment. (Matt) Cc: Julien Isorce <[email protected]> Reported-by: Julien Isorce <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/x11: open the device from within dri2_x11_connect()Emil Velikov2015-08-071-13/+16
| | | | | | | | | Allows us, with the next commit, to use alternative driver_name rather than the one from xserver. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/x11: fetch the device_name prior to driver_nameEmil Velikov2015-08-071-5/+5
| | | | | | | | | | With the follow up commits we're about to further reshuffle things. Thus we'll honour our our driver_name lookup (src/loader), and use the one provided by xserver as a fall-back. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/x11: remove dri2_dpy->conn checksEmil Velikov2015-08-071-12/+6
| | | | | | | | If the connection is NULL we won't be able to get here. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Alex Deucher <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/x11: bail out if we cannot fetch the xcb connectionEmil Velikov2015-08-071-1/+1
| | | | | | | | | | | | | | | | The documentation of xcb_connection_has_error() does not mention what will happen, if NULL is fed to the function. Upon closer look (props to Matt), it seems that we'll crash as the implementation dereferences conn. This will also allow us to remove the dri2_dpy->conn checking with the next commit. v2: Reword commit message as per Matt's findings. Acked-by: Alex Deucher <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* egl: Add eglQuerySurface surface type check for EGL_LARGEST_PBUFFER attribFrank Binns2015-08-041-1/+2
| | | | | | | | | | | | | | | | | | | Calling eglQuerySurface on a window or pixmap with the EGL_LARGEST_PBUFFER attribute resulted in the contents of the 'value' parameter being modified. This is the wrong behaviour according to the EGL spec, which states: "Querying EGL_LARGEST_PBUFFER for a pbuffer surface returns the same attribute value specified when the surface was created with eglCreatePbufferSurface. For a window or pixmap surface, the contents of value are not modified." Avoid this from happening by checking that the surface type is EGL_PBUFFER_BIT before modifying the contents of the parameter. Cc: <[email protected]> Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/dri: Add error info needed for EGL_EXT_image_dma_buf_import extensionFrank Binns2015-08-041-0/+4
| | | | | | | | | | | | | Update the DRI image interface error codes to reflect the needs of the EGL_EXT_image_dma_buf_import extension. This means updating the existing error code documentation and adding a new __DRI_IMAGE_ERROR_BAD_ACCESS error code so that drivers can correctly reject unsupported pitches and offsets. Hook the new error code up in EGL to return EGL_BAD_ACCESS. Cc: <[email protected]> Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* egl/wayland: use drmGetNodeTypeFromFd helper instead of opencoding itEmil Velikov2015-08-011-18/+2
| | | | | | Cc: Axel Davy <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Acked-by: Boyan Ding <[email protected]>
* egl/wayland: use designated initializersEmil Velikov2015-08-011-13/+13
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* egl: remove ifdef $(egl_extension) compile guardsEmil Velikov2015-08-013-65/+1
| | | | | | All of these are already defined in the headers provided. Signed-off-by: Emil Velikov <[email protected]>
* egl/wayland: libdrm is a hard requirement, treat it as suchEmil Velikov2015-08-011-2/+0
| | | | | | | | Prompt at configure time if it's missing otherwise we'll fail later on in the build. Remove ambiguous HAVE_LIBDRM guard. Cc: 10.6 <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* egl: consolidate ifdef HAVE_LIBDRM blocksEmil Velikov2015-08-011-108/+102
| | | | | | | | Move the code around rather than having it scattered. No functional change. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* egl: Add support for DRM_FORMAT_R8, RG88, and GR88Chad Versace2015-07-281-0/+19
| | | | | | | | | | | | | | | The Kodi/XBMC developers want to transcode NV12 to RGB with OpenGL shaders, importing the two source planes through EGL_EXT_image_dma_buf_import. That requires importing the Y plane as an R8 EGLImage and the UV plane as either an RG88 or GR88 EGLImage. This patch teaches the driver-independent part of EGL about the new formats. Real driver support is left for follow-up patches. The new formats landed in airlied's kernel branch 'drm-next' on July 24. Tested-by: Peter Frühberger <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl,dri_interface: use DRI2rendererQueryExtension to enable 3D textures & sRGBMarek Olšák2015-07-222-0/+24
| | | | Reviewed-by: Emil Velikov <[email protected]>
* egl: implement EGL_KHR_gl_colorspace (v2)Marek Olšák2015-07-229-24/+90
| | | | | | v2: add missing "break" Reviewed-by: Emil Velikov <[email protected]>
* egl: android: remove DRM_GRALLOC_TOP hackEmil Velikov2015-07-221-1/+0
| | | | | | | | | | Now that the drm_gralloc module exports the correct includes we can get rid of this hack. Cc: Chih-Wei Huang <[email protected]> Cc: Eric Anholt <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Tested-by: Varad Gautam <[email protected]>
* egl: remove old makefile.sourcesEmil Velikov2015-07-222-31/+1
| | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]>
* android: rework the EGL buildEmil Velikov2015-07-222-74/+25
| | | | | | | | | | | | See previous two commits for details. v2: Don't forget git mv, bring back DRM_GRALLOC_TOP. Spotted by Varad. Cc: Chih-Wei Huang <[email protected]> Cc: Eric Anholt <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Tested-by: Varad Gautam <[email protected]>
* scons: rework the EGL buildEmil Velikov2015-07-223-36/+11
| | | | | | | | | The scons equivalent of the previous commit - just fold the almost identical driver + main Sconscripts. Cc: Alexander von Gluck IV <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]>
* automake: rework the EGL buildEmil Velikov2015-07-223-76/+68
| | | | | | | | | | | Simplify things by merging the two makefiles. This way we can combine the duplicated HAVE_PLATFORM_ checks, and build the library without having a separate static library. v2: use $() when referencing variables, use correct define (Matt) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* egl: automake: remove unused HAVE_XCB_DRI2 defineEmil Velikov2015-07-221-1/+0
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* egl: remove unused _EGL_DRIVER_SEARCH_DIR defineEmil Velikov2015-07-223-8/+2
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>