summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.c
Commit message (Collapse)AuthorAgeFilesLines
* android: support swrastWuZhen2016-11-011-0/+1
| | | | | | | | | | System boots up with gles_mesa/softpipe/llvmpipe. NO_REF_TASK Tested: local run Change-Id: I629ed0ca9fad12e32270eb8e8bfa9f7681b68474 Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
* egl/dri2: set max values for pbuffer width and heightTapani Pälli2016-10-271-0/+9
| | | | | | | | | | | | | | | | | | | While these max values were previously fixed for pbuffer creation, this change makes also eglGetConfigAttrib() return correct values. Fixes following dEQP tests: dEQP-EGL.functional.create_surface.pbuffer.rgb888_no_depth_no_stencil dEQP-EGL.functional.create_surface.pbuffer.rgb888_depth_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_no_depth_no_stencil dEQP-EGL.functional.create_surface.pbuffer.rgba8888_depth_stencil Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326 Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit b91e1e38e87b372d409469dfe00ace76c8febd34)
* egl: bring back the default glapi.so nameEric Engestrom2016-10-191-3/+1
| | | | | | | | | | | | | Earlier commit replaced the default platform specific libglapi.so name with an #error. This may have been overzealous since the name is the correct for the BSD platforms, at least. Reinstate the hunk - bringing back OpenBSD, et al. to a successful build state. Fixes: 7a9c92d071d ("egl/dri2: non-shared glapi cleanups") [Emil Velikov: format the patch from Eric, add commit message and tag.] Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* Revert "egl/dri2: rework dri2_make_current code flow"Emil Velikov2016-10-141-36/+36
| | | | This reverts commit 675719817e7bf7c5b9da22c02252aca77a41338d.
* egl/dri2: micro optimise dri2_bind_extensions()Emil Velikov2016-10-141-0/+1
| | | | | | | Do not loop over all matches if we've already found one. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* egl/dri2: annotate dri2_extension_match instances as const dataEmil Velikov2016-10-141-7/+7
| | | | | | | v2: Rebase. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* egl/dri2: use dri2_bind_extensions to manage the optional extensionsEmil Velikov2016-10-141-18/+10
| | | | | | | v2: dri2_bind_extensions() now takes optional as an argument. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* egl/dri2: add support for optional extensions in dri2_bind_extensions()Emil Velikov2016-10-141-9/+15
| | | | | | | | | | | Will allow us to reuse the function for optional extensions and fold a bit of code. v2: Make dri2_bind_extensions::optional flag an argument to dri2_bind_extensions (Kristian). Cc: Rob Clark <robdclark@gmail.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: coding style cleanupEmil Velikov2016-10-141-143/+143
| | | | | | | | | Consistently indent with space rather than a mix of tab and spaces. v2: Keep the structs properly aligned (Eric). Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: rework dri2_egl_display::extensions storageEmil Velikov2016-10-141-5/+5
| | | | | | | | | | | Remove the error prone fixed size array. While we're here also rename to loader_extensions like in the GLX code. v2: Rebase. Keep image_loader_extension within the wayland_drm dri2_loader_extensions list. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* egl/dri2: rework dri2_make_current code flowEmil Velikov2016-10-141-36/+36
| | | | | | | | Fold duplicate conditional blocks and add a few extra comments ;-) v2: Bring back the explicit "unbind" logic (Eric), remove NULL derefs. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: drop NULL checks prior to dri2_destroy_surfaceEmil Velikov2016-10-141-4/+2
| | | | | | The function already have the respective check within. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: call static functions directly, not via _EGLDriver::APIEmil Velikov2016-10-141-14/+14
| | | | | | | | | | | The indirection is meant to be used by the core EGL implementation in main. Not in the drivers themselves. Move the dri2_destroy_surface definition to avoid forward declaration of the static function. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: use dri2_egl_display inline wrapper where possibleEmil Velikov2016-10-141-9/+6
| | | | | | | | This way the only places that reference DriverData are the ones that manipulate it. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: bail out on NULL dpy in dri2_display_release()Emil Velikov2016-10-141-1/+6
| | | | | | | | Currently all callers are careful enough not to do that, yet that will not be the case in the future. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: move surface refcounting out of the platform codeEmil Velikov2016-10-141-0/+4
| | | | | | | | All the platforms are duplicating what should be a driver/dri2 thing - refcounting. Just fold it accordingly. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: coding style fixEmil Velikov2016-10-141-1/+2
| | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: non-shared glapi cleanupsEmil Velikov2016-10-141-14/+17
| | | | | | | | | For a while now we require shared glapi for EGL, thus we can drop a few bits from the olden days. Namely - dlopen(NULL...) is not possible, error out at build stage if so and drop the guard around dlclose(). Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl/dri2: glFlush is not optional, treat it as suchEmil Velikov2016-10-141-3/+8
| | | | | | | | | | The documentation is clear - one must glFlush the old context on eglMakeCurrent. Thus keeping it optional is not something we should be doing. Furthermore if we cannot get the entry point we're likely having a broken setup/stack. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* egl: Unify the EGLint/EGLAttrib paths in eglCreateSync* (v3)Chad Versace2016-10-101-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Pre-patch, there were two code paths for parsing EGLSync attribute lists: one path for old-style EGLint lists, used by eglCreateSyncKHR, and another for new-style EGLAttrib lists, used by eglCreateSync (1.5) and eglCreateSync64 (EGL_KHR_cl_event2). There were two attrib_list parsing functions, _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) _eglParseSyncAttribList64(_EGLSync *sync, const EGLattrib *attrib_list) This patch unifies the two attrib_list parsing functions into one, _eglParseSyncAttribList(_EGLSync *sync, const EGLattrib *attrib_list) Many internal EGLSync function signatures had *two* attrib_list parameters to accomodate both code paths: one parameter was an EGLint list and other an EGLAttrib list. At most one of the parameters was allowed to be non-null. This patch removes the `EGLint *attrib_list` parameter, leaving only the `EGLAttrib *attrib_list` parameter, for all internal EGLSync functions. v2: - Consistently use condition (sizeof(int_list[0]) == sizeof(attrib_list[0])). [for emil] v3: - Don't double-unlock the display in eglCreateSyncKHR. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (v2)
* egl: stop claiming support for pbuffer + msaaTapani Pälli2016-10-031-0/+9
| | | | | | | | | | | | | | | | | | | This fixes a crash in egl-create-msaa-pbuffer-surface Piglit test and same crash in many dEQP EGL tests. I also found that some Qt example did a workaround because of this crash: https://bugreports.qt.io/browse/QTBUG-47509 v2: Ian pointed out that v1 removed support for all multisample configs, including window ones. This one removes pbuffer bit when adding configs, now only pbuffer+msaa gets rejected and window+msaa continues to work. Fixed also comment (Emil) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* egl: return corresponding offset of EGLImage instead of 0.Chuanbo Weng2016-09-211-2/+9
| | | | | | | | | | | | | | | | | | The offset should not always be 0. For example, if EGLImage is created from a 2D texture with EGL_GL_TEXTURE_LEVEL=1, then the offset should be the actual start of miplevel 1 in bo. v2: Add version check of __DRIimageExtension implementation (Suggested by Axel Davy). v3: Don't add version check of __DRIimageExtension implementation. Set the offset only when queryImage() succeeds. (Suggested by Emil Velikov) Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> [Emil Velikov: coding style fixes] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* egl: Rename MESA_configless_context bit to KHR_no_config_contextAdam Jackson2016-09-121-1/+1
| | | | | | | | | Keep the old name in the extension string, but refer to the KHR extension internally. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
* egl: only store device name when Wayland support is builtFrank Binns2016-09-011-1/+4
| | | | | | | | The device name is only needed for WL_bind_wayland_display so make this clear by only storing the device name when Wayland support is built. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: check if the EGL API is valid before adding it to ClientAPIsEmil Velikov2016-08-301-4/+4
| | | | | | | | | | | | | In the rather unlikely case that the API is considered invalid, don't add it to the (supported) ClientAPIs bitmask. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> --- Strictly speaking we only need this in the Android case for OpenGL. Adding it everywhere doesn't hurt us since the compiler will const propagate and optimise/remove these.
* egl/dri2: dri2_initialize: Do not reference-count TestOnly displayNicolas Boichat2016-08-231-20/+9
| | | | | | | | | | | | | | | In the case where dri2_initialize is called with a TestOnly display, the display is not actually initialized, so dri2_egl_display always fails, and we cannot do any reference counting. Fixes piglit spec@egl_khr_create_context@verify gl flavor (reproducible with LIBGL_ALWAYS_SOFTWARE=1). Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) Cc: "12.0" <mesa-stable@lists.freedesktop.org> Reported-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: remove error checks on return values from mtx_lock and cnd_waitDongwon Kim2016-08-231-35/+12
| | | | | | | | | | | | | This removes unnecessary error checks on return result of mtx_lock and cnd_wait calls as in all other places in MESA source since there is no chance that any of these functions return any of error codes in current implementation. This patch also removes a redundent _eglError call that follows EGL_FALSE check in the bottom of dri2_client_wait_sync. Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: dri2_make_current: Release previous context's displayNicolas Boichat2016-08-161-4/+5
| | | | | | | | | | | | | | | | | | | eglMakeCurrent can also be used to change the active display. In that case, we need to decrement ref_count of the previous display (possibly destroying it), and increment it on the next display. Also, old_dsurf/old_rsurf cannot be non-NULL if old_ctx is NULL, so we only need to test if old_ctx is non-NULL. v2: Save the old display before destroying the context. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97214 Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) Cc: "12.0" <mesa-stable@lists.freedesktop.org> Reported-by: Alexandr Zelinsky <mexahotabop@w1l.ru> Tested-by: Alexandr Zelinsky <mexahotabop@w1l.ru> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
* egl: android: query native window default width and height (v2)Haixia Shi2016-08-091-0/+11
| | | | | | | | | | | | | | | | On android platform, the width and height of a native window surface may be updated after initialization. It is therefore necessary to query android framework for the current width and height. v2: remove Android specific #ifdef's and just implement the fallback directly if the platform query_surface() callback is not provided. TEST=dEQP-EGL.functional.resize.surface_size#* on cyan-cheets Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org> (v1) Reviewed-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Chad Versace <chad@kiwitree.net> Change-Id: I673f7d2f1d90c3bf572b30f63da537f2cae1496e
* egl/dri2: Add reference count for dri2_egl_displayNicolas Boichat2016-07-281-20/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | android.opengl.cts.WrapperTest#testGetIntegerv1 CTS test calls eglTerminate, followed by eglReleaseThread. A similar case is observed in this bug: https://bugs.freedesktop.org/show_bug.cgi?id=69622, where the test calls eglTerminate, then eglMakeCurrent(dpy, NULL, NULL, NULL). With the current code, dri2_dpy structure is freed on eglTerminate call, so the display is not initialized when eglReleaseThread calls MakeCurrent with NULL parameters, to unbind the context, which causes a a segfault in drv->API.MakeCurrent (dri2_make_current), either in glFlush or in a latter call. eglTerminate specifies that "If contexts or surfaces associated with display is current to any thread, they are not released until they are no longer current as a result of eglMakeCurrent." However, to properly free the current context/surface (i.e., call glFlush, unbindContext, driDestroyContext), we still need the display vtbl (and possibly an active dri dpy connection). Therefore, we add some reference counter to dri2_egl_display, to make sure the structure is kept allocated as long as it is required. One drawback of this is that eglInitialize may not completely reinitialize the display (if eglTerminate was called with a current context), however, this seems to meet the EGL spec quite well, and does not permanently leak any context/display even for incorrectly written apps. Cc: "12.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl/dri2: dri2_make_current: Set EGL error if bindContext failsNicolas Boichat2016-07-201-2/+8
| | | | | | | | | | | | | Without this, if a configuration is, say, available only on GLES2/3, but not on GLES1, and is rejected by the dri module's bindContext call, eglMakeCurrent fails with error "EGL_SUCCESS". In this patch, we set error to EGL_BAD_MATCH, which is what CTS/dEQP dEQP-EGL.functional.surfaceless_context expect. Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* Use correct names for dlopen()ed files on CygwinYaakov Selkowitz2016-07-151-0/+2
| | | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com> Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
* mesa_glinterop: remove mesa_glinterop typedefsEmil Velikov2016-05-301-3/+3
| | | | | | | | | | | | | | | | As is there are two places that do the typedefs - dri_interface.h and this header. As we cannot include the former in here, just drop the typedefs and use the struct directly (as needed). This is required because typedef redefinition is C11 feature which is not supported on all the versions of GCC used to build mesa. v2: Kill the typedef alltogether, as per Marek. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96236 Cc: Vinson Lee <vlee@freedesktop.org> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa_glinterop: make GL interop version field bidirectionalEmil Velikov2016-05-241-1/+1
| | | | | | | | | | | | | | This allows clear and easy communication between the two. Caller: Requesting information (struct vN) Callee: I know how to deal with older version (vN-1) only. Here is your data and the version I support. Caller: Older version ? Sure I'll cap all access to the fields provided by the older version (vN-1) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* egl: android: directly use dri2_create_image_dma_buf()Emil Velikov2016-05-231-1/+1
| | | | | | | | Make the function non static so that we can use it directly from the android platform code. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Rob Herring <robh@kernel.org>
* egl/dri2: Don't check return result of mtx_unlock().Matt Turner2016-05-181-8/+2
| | | | | | | Coverity (CID 1358496) warns that the cleanup code doesn't unlock the mutex (which is arguably kind of stupid, since the only case that can happen is when mtx_unlock() failed!). But, mtx_unlock() isn't going to fail -- the mutex was locked by this thread just a few lines above it.
* egl: implement EGL part of interop interface (v2)Marek Olšák2016-04-201-0/+32
| | | | v2: - use const
* egl: add EGL_KHR_reusable_sync to egl_driDongwon Kim2016-04-051-6/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables an EGL extension, EGL_KHR_reusable_sync. This new extension basically provides a way for multiple APIs or threads to be excuted synchronously via a "reusable sync" primitive shared by those threads/API calls. This was implemented based on the specification at https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_reusable_sync.txt v2 - use thread functions defined in C11/threads.h instead of using direct pthread calls - make the timeout set with reference to CLOCK_MONOTONIC - cleaned up the way expiration time is calculated - (bug fix) in dri2_client_wait_sync, case EGL_SYNC_CL_EVENT_KHR has been added. - (bug fix) in dri2_destroy_sync, return from cond_broadcast call is now stored in 'err' intead of 'ret' to prevent 'ret' from being reset to 'EGL_FALSE' even in successful case - corrected minor syntax problems v3 - dri2_egl_unref_sync now became 'void' type. No more error check is needed for this function call as a result. - (bug fix) resolved issue with duplicated unlocking of display in eglClientWaitSync when type of sync is "EGL_KHR_REUSABLE_SYNC" Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
* egl/dri2: expose srgb configs when KHR_gl_colorspace is availableEmil Velikov2016-01-221-0/+2
| | | | | | | | | | | | | | | Otherwise the user has no way of using it, and we'll try to access the linear one. v2: - Bail out when KHR_gl_colorspace is missing and srgb is set (Marek) Cc: Chih-Wei Huang <cwhuang@android-x86.org> Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org> Fixes: c2c2e9ab604(egl: implement EGL_KHR_gl_colorspace (v2)) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91596 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Tested-by: Mauro Rossi <issor.oruam@gmail.com>
* egl: make it clear which platform x11 backend is being used (dri2 or 3)Martin Peres2015-11-171-3/+3
| | | | | | | Signed-off-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Boyan Ding <boyan.j.ding@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
* egl/x11: Implement dri3 support with loader's dri3 helperBoyan Ding2015-11-171-6/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: From Martin Peres - Tell we are compiling the dri3 backend in configure.ac - Update the Makefile.am - get rid of the LIBDRM_HAS_RENDERNODE_SUPPORT macro - fix some warnings related to EGLuint64KHR to int64_t conversions - use dri2_get_dri_config to get the __DRIconfig instead of open-coding it - replace the occasional tabs with spaces v3: From Martin Peres - fix and indent problem (Matt Turner) - drop the authenticate function, use NULL in the vtable instead (Emil) - drop some useless includes (Emil Velikov) - mandate libdrm (Emil Velikov) - link to xcb-dri3 (Kristian Høgsberg) - convert to the new loader interface for drwable (Kristian) - remove some dead code after the dropping of some vfuncs (Kristian) - add a comment on the topic of rendering to the frontbuffer v4: From Martin Peres - do not expose the preserved swap behavior (Acked by Eric Anholt) Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
* egl_dri2: Add a function to let platform code return dri drawable from ↵Boyan Ding2015-11-171-19/+27
| | | | | | | | | | | | | | | | | | _EGLSurface dri3 for EGL will use different struct other than dri2_egl_surface for an EGL surface, the common code only uses __DRIdrawable from that struct, so instead of converting _EGLSurface to dri2_egl_surface, let the platform code return the __DRIdrawable by its own (although the current platforms use the same function). v2: From Martin Peres - convert to the new drawable interface (Kristian) Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
* egl/dri2: Properly dereference array.Matt Turner2015-10-071-3/+3
| | | | | | | | | | Fixes a regression that broke EGL since commit 858f2f2ae6d72f338fdd6d544b0c733814e22724 Author: Emil Velikov <emil.l.velikov@gmail.com> Date: Sun Sep 13 12:25:27 2015 +0100 egl/dri2: ease srgb __DRIconfig conditionals
* egl/dri2: ease srgb __DRIconfig conditionalsEmil Velikov2015-10-071-25/+12
| | | | | | | | 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 <emil.l.velikov@gmail.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
* egl: move memcpy to bring conf->base operations togetherVarad Gautam2015-10-071-1/+1
| | | | | | Signed-off-by: Varad Gautam <varadgautam@gmail.com> Suggested-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* 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: mesa-stable@lists.freedesktop.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91596 Signed-off-by: Varad Gautam <varadgautam@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* 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 <mesa-stable@lists.freedesktop.org> Reviewed-by: Albert Freeman <albertwdfreeman@gmail.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com>
* egl/dri2: don't leak the fd on dri2_terminateEmil Velikov2015-09-151-1/+1
| | | | | | | | | | 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 <emil.l.velikov@gmail.com> Reviewed-by: Boyan Ding <boyan.j.ding@gmail.com>
* 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 <emil.l.velikov@gmail.com> Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
* 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 <emil.l.velikov@gmail.com> Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>