aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/main/egldisplay.c
Commit message (Collapse)AuthorAgeFilesLines
* egl: warn user if they set an invalid EGL_PLATFORMEric Engestrom2019-09-031-0/+3
| | | | | | | | | Technically, the user might have set EGL_DISPLAY instead of EGL_PLATFORM, but since the former is deprecated let's just mention the latter in the warning message. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* egl: fix platform selectionLionel Landwerlin2019-09-021-2/+7
| | | | | | | | | | | | Add missing "device" platform v2: Add the missing platform (Eric) Signed-off-by: Lionel Landwerlin <[email protected]> Reported-by: Jean Hertel <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111529 Fixes: d6edccee8d ("egl: add EGL_platform_device support") Reviewed-by: Eric Engestrom <[email protected]>
* egl: simplify loopEric Engestrom2019-07-011-3/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Sagar Ghuge<[email protected]>
* egl: Enable eglGetPlatformDisplay on Android Platformrenchenglei2019-06-291-0/+16
| | | | | | This helps to add eglGetPlatformDisplay support on Android Platform. Reviewed-by: Eric Engestrom <[email protected]>
* egl: add missing #includeEric Engestrom2019-06-191-0/+1
| | | | | | | | close() is in <unistd.h> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: compare the whole list of attributesEric Engestrom2019-06-111-1/+1
| | | | | | | | | `memcmp()` compares a given number of bytes, but `EGLAttrib` is larger than a byte. Fixes: 8e991ce5397598ceb422 "egl: handle the full attrib list in display::options" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* egl: add EGL_platform_device supportEmil Velikov2019-06-051-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new 'platform' is added by default with no guards. It is effectively a copy of the surfaceless one, with updated function names and brand new probe function. Due to the reuse, some of the ifdef HAVE_SURFACELESS_PLATFORM guards have been dropped. A worthy mention are the changes in _egFindDisplay, since the original and dup'd fd are required, we make use of the plat_opt argument. Note that no hacks for eglGetDisplay are added - the API works only with the eglGetPlatformDisplay* API. v2: - s/_eglCompareDeviceDisplay/_eglSameDeviceDisplay/ (Eric) - let ^^ return bool (Eric) - fixup meson build, move files() further up (Eric) - copy from plat. surfaceless w/o the visual cleanups - close and free when destroying the dpy - sprinkle a few _eglDeviceSupports - split fd handling into separate function - use directly the render node if no FD is given (Mathias) v3: - s/dpy/disp/g - drop swap_buffers* callbacks - drop loader_set_logger() - drop local define - re-introduce _eglGetDRMDeviceRenderNode() - EGL_WARN on ForceSoftware with HW device - continue using the HW device - bail out for "EGL_MESA_device_software" until it's fixed - wire-up the Android build v4: - use new style _eglFindDisplay() - split hw vs sw code paths - don't close the internal fd (already handled in FiniDisplay()) - make swrast work (bit hacky bit will do for now) - Android for real, drop autotools - Correct HW + LIBGL_ALWAYS_SOFTWARE check - use the dri2_create_drawable() helper v5: - enhance comment around fd checks (Mathias) - rebase for dri2_init_surface() changes Cc: Mathias Fröhlich <[email protected]> Acked-by: Marek Olšák <[email protected]> (v4) Signed-off-by: Emil Velikov <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* egl: fold X11 attrib handling like other platformsEmil Velikov2019-06-051-34/+11
| | | | | | | | | | Since we no longer need special handling for X11, refactor the code to follow the style used by all other platforms. Reviewed-by: Mathias Fröhlich <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* egl: remove Options::Platform handlingAdam Jackson2019-06-051-9/+4
| | | | | | | | | | | | The full set of attributes is already handled with previous patches. Thus all this is not dead code. v2 (Emil) - split from a larger patch. Reviewed-by: Mathias Fröhlich <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* egl: handle the full attrib list in display::optionsAdam Jackson2019-06-051-9/+52
| | | | | | | | | | | | | | | | | | | Earlier spec is vague, although EGL 1.5 makes it clear: Multiple calls made to eglGetPlatformDisplay with the same parameters will return the same EGLDisplay handle. With this commit we store and compare the full attrib list. v2 (Emil): - Split into separate patches - Use EGLBoolean over int masked as such - Don't return free'd pointed on calloc failure Reviewed-by: Mathias Fröhlich <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* egl: fixup autotools-specific wordingEric Engestrom2019-04-301-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* egl: use coherent variable namesEric Engestrom2019-02-061-27/+27
| | | | | | | | | | | | | | | | | `EGLDisplay` variables (the opaque Khronos type) have mostly been consistently called `dpy`, as this is the name used in the Khronos specs. However, `_EGLDisplay` variables (our internal struct) have been randomly called `dpy` when there was no local variable clash with `EGLDisplay`s, and `disp` otherwise. Let's be consistent and use `dpy` for the Khronos type, and `disp` for our struct. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Emil Velikov <[email protected]> Acked-by: Eric Anholt <[email protected]>
* egl/main: fix indentationEric Engestrom2018-08-021-1/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Frank Binns <[email protected]>
* egl: Convert int to attrib in eglGetPlatformDisplayAdam Jackson2017-11-171-7/+8
| | | | | | | | ... because converting attrib to int truncates, and that's bad. Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: Move _eglPointerIsDereferencable() to eglglobals.[ch]Miguel A. Vico2017-07-241-33/+0
| | | | | | | | | | Move _eglPointerIsDereferencable() to eglglobals.[ch] and make it a non-static function so it can be used out of egldisplay.c Signed-off-by: Miguel A. Vico <[email protected]> Reviewed-by: James Jones <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: fold _eglError() + return EGL_FALSEEmil Velikov2017-06-261-6/+4
| | | | | | | | | | | The function _eglError() already explicitly returns EGL_FALSE, explicitly to simplify the callers. Make use of it. While EGL_FALSE is numerically identical to false, NULL, EGL_NO_FOO, storage is not the same so we cannot use it for "everything". Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl/display: make platform detection thread-safeEric Engestrom2017-06-161-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Imagine there are 2 threads that both call _eglGetNativePlatform() simultaneously: - thread 1 completes the first "if (native_platform == _EGL_INVALID_PLATFORM)" check and is preempted to do something else - thread 2 executes the whole function, does "native_platform = _EGL_NATIVE_PLATFORM" and just before returning it's preempted - thread 1 wakes up and calls _eglGetNativePlatformFromEnv() which returns _EGL_INVALID_PLATFORM because no env vars are set, updates native_platform and then gets preempted again - thread 2 wakes up and returns wrong _EGL_INVALID_PLATFORM Solve this by doing the detection in a local var and only overwriting the global one at the end, if no other thread has updated it since. This means the platform detected in the thread might not be the platform returned by the function, but this is a different issue that will need to be discussed when this becomes possible. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101252 Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Grazvydas Ignotas <[email protected]> Acked-by: Emil Velikov <[email protected]>
* egl/display: only detect the platform onceEric Engestrom2017-06-161-14/+17
| | | | | | | | | | | | | | My refactor missed the fact that `native_platform` is static. Add the proper guard around the detection code, as it might not be necessary, and only print the debug message when a detection was actually performed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101252 Fixes: 7adb9b094894a512c019 ("egl/display: remove unnecessary code and make it easier to read") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Grazvydas Ignotas <[email protected]> Acked-by: Emil Velikov <[email protected]>
* configure: update remaining --with-egl-platforms referencesEmil Velikov2017-05-191-1/+1
| | | | | | | | Rename the remaining references to omit the egl part. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* egl: Fix -Wint-to-pointer-castChad Versace2017-05-081-1/+1
| | | | | | | | | | | | | main/egldisplay.c: In function '_eglParseX11DisplayAttribList': main/egldisplay.c:491:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] display->Options.Platform = (void *)value; The fix: cast to uinptr_t before void*. ^ Fixes: ddb99127 egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute Cc: Adam Jackson <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* egl: avoid dereferencing a null displayEric Engestrom2017-05-081-1/+3
| | | | | | Fixes: ddb99127a6f6c ("egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attributeAdam Jackson2017-05-041-7/+12
| | | | | | | | | | Introduce _egl_display::Options::Platforms for private storage. For X11 platforms we can use it for the screen number as set by EGL_PLATFORM_X11_SCREEN_EXT. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* egl: Implement EGL_MESA_platform_surfacelessChad Versace2016-10-141-0/+21
| | | | Reviewed-by: Emil Velikov <[email protected]>
* egl: Tear down images and syncs at eglTerminateAdam Jackson2016-09-141-0/+22
| | | | | Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* egl/display: remove unnecessary code and make it easier to readEric Engestrom2016-07-071-15/+14
| | | | | | | | | Remove the two first level `if` as they will always be true, and flatten the two remaining `if`. No functional change. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* Revert "egl: Check if API is supported when using eglBindAPI."Marek Olšák2016-06-031-5/+0
| | | | | | This reverts commit e8b38ca202fbe8c281aeb81a4b64256983f185e0. It broke Glamor for Gallium at least.
* egl: Check if API is supported when using eglBindAPI.Plamena Manolova2016-06-021-0/+5
| | | | | | | | | According to the EGL specifications before binding an API we must check whether it's supported first. If not eglBindAPI should return EGL_FALSE and generate a EGL_BAD_PARAMETER error. Signed-off-by: Plamena Manolova <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* egl: remove _EGL_PLATFORM_WINDOWS enumEmil Velikov2015-07-221-1/+0
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* egl: remove final references of platform_nullEmil Velikov2015-07-221-1/+0
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* egl/dri2: implement platform_surfacelessHaixia Shi2015-06-161-1/+2
| | | | | | | | | | | | | | | | | | The surfaceless platform is for off-screen rendering only. Render node support is required. Only consider the render nodes. Do not use normal nodes as they require auth hooks. v3: change platform_null to platform_surfaceless v4: make libdrm required for surfaceless v5: remove modified include guards with defined(HAVE_SURFACELESS_PLATFORM) v6: use O_CLOEXEC for drm fd Signed-off-by: Haixia Shi <[email protected]> Signed-off-by: Zach Reizner <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl/main: drop platform fbdev specific codeEmil Velikov2015-03-211-16/+0
| | | | | | | st/egl was the only one which had support for this platform. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]>
* egl/main: use c11/threads' mutex directlyEmil Velikov2015-03-111-6/+7
| | | | | | | Remove the inline wrappers/abstraction layer. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Revert "egl/main: use c11/threads' mutex directly"Emil Velikov2015-03-061-7/+6
| | | | | | This reverts commit 6cee785c69a5c8d2d32b6807f9c502117f5a74b0. Not meant to go in yet. Lacking review.
* egl/main: use c11/threads' mutex directlyEmil Velikov2015-03-061-6/+7
| | | | | | Remove the inline wrappers/abstraction layer. Signed-off-by: Emil Velikov <[email protected]>
* egl: Add Haiku code and supportAlexander von Gluck IV2014-12-231-1/+6
| | | | | | | * This is the cleaned up work of the Haiku GCI student Adrián Arroyo Calle [email protected] * Several patches were consolidated to prevent unnecessary touching of non-related code
* egl/main: Enable Linux platform extensionsChad Versace2014-03-171-0/+72
| | | | | | | | | | | | | | | | Enable EGL_EXT_platform_base and the Linux platform extensions layered atop it: EGL_EXT_platform_x11, EGL_EXT_platform_wayland, and EGL_MESA_platform_gbm. Tested with Piglit's EGL_EXT_platform_base tests under an X11 session. To enable running the Wayland and GBM tests, windowed Weston was running and the kernel had render nodes enabled. I regression tested my EGL_EXT_platform_base patch set with Piglit on Ivybridge under X11/EGL, standalone Weston, and GBM with rendernodes. No regressions found. Signed-off-by: Chad Versace <[email protected]>
* egl/main: Stop using EGLNative types internallyChad Versace2014-03-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* egl: clarify what _eglInitResource doesChia-I Wu2014-02-191-1/+5
| | | | It is a helper called from the initializers of its subclasses.
* s/Tungsten Graphics/VMware/José Fonseca2014-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <[email protected]>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Don't cast the return value of malloc/realloc. // // Casting the return value of malloc/realloc only stands to hide // errors. @@ type T; expression E1, E2; @@ - (T) ( _mesa_align_calloc(E1, E2) | _mesa_align_malloc(E1, E2) | calloc(E1, E2) | malloc(E1) | realloc(E1, E2) )
* egl: silence unused var warningBrian Paul2011-11-101-0/+2
|
* egl: add null platformChia-I Wu2011-09-201-0/+1
| | | | | | | The null platform has no window or pixmap surface (but pbuffer surface). And the only valid display is EGL_DEFAULT_DISPLAY. It is useful for offscreen rendering. It works everywhere becase no window system is required.
* egl: add _EGL_PLATFORM_ANDROIDChia-I Wu2011-08-211-1/+2
| | | | | | | This is Android Gingerbread platform. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: Log (debug) native platform typeBenjamin Franzke2011-08-151-12/+25
| | | | Reviewed-by: Kristian Høgsberg <[email protected]>
* egl: Native Display autodetectionBenjamin Franzke2011-08-151-3/+97
| | | | | | | | | | | | | | | | | | | | | | | | EGL doesnt define howto manage different native platforms. So mesa has a builtime configurable default platform, whith non-standard envvar (EGL_PLATFORM) overwrites. This caused unneeded bugreports, when EGL_PLATFORM was forgotten. Detection is grouped into basic types of NativeDisplays (which itself needs to be detected). The final decision is based on characteristcs of these basic types: File Desciptor based platforms (fbdev): - fstat(2) to check for being a fd that belongs to a character device - check kernel subsystem (todo) Pointer to structuctures (x11, wayland, drm/gbm): - mincore(2) to check whether its valid pointer to some memory. - magic elements (e.g. pointers to exported symbols): o wayland display stores interface type pointer (first elm.) o gbm stores pointer to its constructor (first elm.) o x11 as a fallback (FIXME?) Reviewed-by: Kristian Høgsberg <[email protected]>
* egl: add copyright noticesChia-I Wu2011-07-021-0/+30
| | | | | The list of copyright holders could be incomplete. Please update directly or notify me if your name is missing.
* egl: Add wayland platformBenjamin Franzke2011-02-071-0/+1
|
* egl: Add reference count for resources.Chia-I Wu2010-10-231-1/+41
| | | | | This is a really simple mechanism. There is no atomicity and the caller is expected to hold the display lock.
* egl: Drop dpy argument from the link functions.Chia-I Wu2010-10-231-6/+5
| | | | | All display resources are already initialized with a display. Linking simply links a resource to its display.
* st/egl: Rename kms backend to drm.Chia-I Wu2010-09-191-1/+1
| | | | | The main use of the backend is to support EGL_MESA_drm_display. drm should be a better name.