summaryrefslogtreecommitdiff
path: root/src/egl/drivers/dri2/platform_wayland.c
Commit message (Collapse)AuthorAgeFilesLines
...
* egl: drop unused _EGLDriver from Create{Window,Pixmap,Pbuffer}Surface() & ↵Eric Engestrom2020-08-161-9/+5
| | | | | | | | DestroySurface() Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6241>
* egl: drop unused _EGLDriver from Initialize()Eric Engestrom2020-08-161-9/+9
| | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6241>
* egl: const _eglDriverEric Engestrom2020-08-011-12/+12
| | | | | | | | | | | Converted using `s/_EGLDriver/const _EGLDriver/g` and dropped a couple of irrelevant changes in comments, in the `_EGL_DRIVER_TYPECAST()` macro and the typedef itself. Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6129>
* egl: inline _EGLAPI into _EGLDriverEric Engestrom2020-07-211-3/+3
| | | | | | | | | | _EGLDriver was an empty wrapper around _EGLAPI, so let's only keep one of them. "driver" represents better what's being accessed, so that's the one we're keeping. Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5987>
* egl: drop now empty egl_dri2_fallbacks.hEric Engestrom2020-07-161-1/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for get_sync_valuesEric Engestrom2020-07-161-2/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for create_wayland_buffer_from_imageEric Engestrom2020-07-161-1/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for query_buffer_ageEric Engestrom2020-07-161-1/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for copy_buffersEric Engestrom2020-07-161-2/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for post_sub_bufferEric Engestrom2020-07-161-2/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for swap_buffers_regionEric Engestrom2020-07-161-2/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for swap_buffers_with_damageEric Engestrom2020-07-161-1/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl: inline fallback for create_pbuffer_surfaceEric Engestrom2020-07-161-2/+0
| | | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5861>
* egl/wayland: add missing newline between functionsEric Engestrom2020-07-131-0/+1
| | | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5862>
* egl/wayland: Fix zwp_linux_dmabuf usageChristopher James Halse Rogers2020-04-291-12/+20
| | | | | | | | | | | | | | | | | | | | | | There's no guarantee that the formats advertised by wl_drm and the formats advertised by zwp_linux_dmabuf_v1 are the same. get_back_bo() handles this by falling back from createImageWithModifiers() to createImage() when there's a wl_drm format but no corresponding linux_dmabuf format, but create_wl_buffer() unconditionally tries to create a linux_dmabuf buffer unless DRIimage has DRM_FORMAT_MOD_INVALID. Fix this by always checking if the DRIimage modifier has been advertised by zwp_linux_dmabuf_v1, and falling back to wl_drm if not. If DRM_FORMAT_MOD_INVALID has been advertised then we trust the client has allocated something appropriate and treat any modifier as matching. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2220 Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4294>
* egl/wayland: Don't invalidate buffers on no-op resizeDaniel Stone2020-03-041-0/+4
| | | | | | | | | | | | | | | | The Wayland platform's resize_callback is invoked from libwayland-egl when wl_egl_window_resize() is called. The resize call is the only place for the application to insert dx/dy arguments to wl_surface_attach(). When modifying the cursor hotspot (as in wayland/wayland#148), we want to set dx/dy, but leave the surface size the same. If we get wl_egl_window_resize() with the same width and height argument as we already have, we do not need to invalidate our existing drawable. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4030> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4030>
* egl: allow INVALID format for linux_dmabufIvan Molodetskikh2020-03-021-5/+24
| | | | | | | | | | | | | | | | | | | | | As per https://gitlab.freedesktop.org/wayland/wayland-protocols/commit/fb9b2a87317c77e26283da5f6c9559d709f6fdcd, the compositor may advertise DRM_FORMAT_MOD_INVALID as a supported modifier. This patch makes mesa recognize this fact and allow linux_dmabuf usage with the INVALID modifier in this case. In case the driver doesn't support modifiers, we can still use linux-dmabuf protocol instead of the legacy wl_drm interface to create wl_buffers. This will help compositors to handle these buffers better. In this commit, the INVALID modifier is allowed to be added to the list of supported modifiers, and create_wl_buffer will be able to use linux_dmabuf with an INVALID modifier if the compositor advertised it as supported. Signed-off-by: Ivan Molodetskikh <yalterz@gmail.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2147> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2147>
* Revert "egl: Configs w/o double buffering support have no `EGL_WINDOW_BIT`."Hal Gentz2019-10-181-2/+0
| | | | This reverts commit 075a96aa926e6e89795f95a6a59693f44d9ac970.
* egl: Configs w/o double buffering support have no `EGL_WINDOW_BIT`.Hal Gentz2019-10-111-0/+2
| | | | | | | | | | | | | | | | When users pass a config to `eglCreateWindowSurface` it requests double buffering, but if the config doesn't have the appropriate `__DRIconfig`, `eglCreateWindowSurface` fails with a `EGL_BAD_MATCH`. Given that such behaviour is completely unacceptable, we drop the `EGL_WINDOW_BIT` if we don't have at least one `__DRIconfig` supporting double buffering, otherwise dropping the `EGL_PIXMAP_BIT`. Fixes: 049f343e8ac "egl: Allow 24-bit visuals for 32-bit RGBA8888 configs" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676 Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
* egl/wayland: Implement getCapability for the dri2 and image loadersAdam Jackson2019-09-201-2/+15
| | | | Reviewed-by: Kevin Strasser <kevin.strasser@intel.com>
* egl/wayland: Add FP16 format supportAdam Jackson2019-09-201-0/+21
| | | | Reviewed-by: Kevin Strasser <kevin.strasser@intel.com>
* egl/wayland: Reindent the format tableAdam Jackson2019-09-201-35/+35
| | | | | | No idea how these ended up with 3-then-2-space indents. Reviewed-by: Kevin Strasser <kevin.strasser@intel.com>
* egl: Convert configs to use shifts and sizes instead of masksKevin Strasser2019-08-211-19/+30
| | | | | | | | | | | | Change dri2_add_config to take arrays of shifts and sizes, and compare with those set in the dri config. Convert all platform driver masks to shifts and sizes. In order to handle older drivers, where shift attributes aren't available, we fall back to the mask attributes and compute the shifts with ffs. Signed-off-by: Kevin Strasser <kevin.strasser@intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* egl/android: Delete set_damage_region from egl dri vtblHarish Krupo2019-08-131-1/+0
| | | | | | | | | | | | | | | | | | The intension of the KHR_partial_update was not to send the damage back to the platform but to send the damage to the driver to ensure that the following rendering could be restricted to those regions. This patch removes the set_damage_region from the egl_dri vtbl and all the platfrom_*.c files. Then upcomming patches add a new dri2 interface for the drivers to implement Signed-off-by: Harish Krupo <harishkrupo@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Qiang Yu <yuq825@gmail.com> Tested-by: Qiang Yu <yuq825@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* util: add anon_file.h for all memfd/temp file usageGreg V2019-08-071-117/+2
| | | | | | | | | Move the Weston os_create_anonymous_file code from egl/wayland into util, add support for Linux memfd and FreeBSD SHM_ANON, use that code in anv/aubinator instead of explicit memfd calls for portability. Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
* egl/wayland: use bitset.h for `formats` bit setEric Engestrom2019-07-011-10/+15
| | | | | | | | | | | Currently only 7 formats are supported, but we don't want the 16 limit (it's an `unsigned`) to hit us by surprise :] Let's use bitset.h's BITSET magic to allow us to have any number of formats, with a static assert to make sure we don't forget to update it. Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
* egl: Let the caller of dri2_create_drawable decide about loaderPrivate.Mathias Fröhlich2019-06-101-1/+1
| | | | | | | | | | | In the call arguments to dri2_create_drawable decouple loaderPrivate from dri2_surf. For all callers of dri2_create_drawable the two pointers are the same with the exception of the gbm backed platform. Let the calling code of dri2_create_drawable decide what loaderPrivate shall be. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
* egl/dri: flesh out and use dri2_create_drawable()Emil Velikov2019-06-051-13/+1
| | | | | | | | | | | | | | | | | | | Wrap the loader->createNewDrawable() dance into a helper and use it throughout the codebase. This addresses a cases like surfaceless (SL) on swrast (SL on kms_swrast is fine) where we'd attempt using the wrong driver and crash out. v2: fixup quirky GBM (Mathias) v3: fixup GBM for real (Marek) Cc: mesa-stable@lists.freedesktop.org Cc: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de> (v1) Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> (v2) Signed-off-by: Marek Olšák <marek.olsak@amd.com> (v2) Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* wayland/egl: Ensure correct buffer size when allocatingJonas Ådahl2019-05-141-2/+11
| | | | | | | | | | Whenever a buffer is allocated, e.g. by the first draw call or EGL call after a buffer swap, make sure the size is up to date. Prior to this commit, we failed to do so when querying the buffer age, or swapping buffers without any prior EGL call or draw call. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
* egl: store the native surface pointer in struct _egl_surfacePaulo Zanoni2019-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Each platform stores this in a different place: - platform_drm uses dri2_surf->gbm_surf->base - platform_android uses dri2_surf->window - platform_wayland uses dri2_surf->wl_win - platform_x11 uses dri2_surf->drawable - platform_x11_dri3 uses dri3_surf->loader_drawable.drawable - haiku doesn't even store it! We need access to the native surface since the specification asks us to refuse creating a new surface if there's already an EGLSurface associated with native_surface. An alternative to this patch would be to create a new API.GetNativeWindow callback that each platform would have to implement. While that's something we can definitely do, I prefer this approach. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
* wayland/egl: Ensure EGL surface is resized on DRI update_buffers()Carlos Garnacho2019-02-201-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fullscreening and unfullscreening a totem window while playing a video sometimes results in the video subsurface not changing size along. This is also reproducible with epiphany. If a surface gets resized while we have an active back buffer for it, the resized dimensions won't get neither immediately applied on the resize callback, nor correctly synchronized on update_buffers(), as the (now stale) surface size and currently attached buffer size still do match. There's actually 2 things to synchronize here, first the surface query size might not be updated yet to the wl_egl_window's (i.e. resize_callback happened while there is a back buffer), and second the wayland buffers would need dropping if new surface size differs with the currently attached buffer. These are done in separate steps now. https://bugzilla.redhat.com/show_bug.cgi?id=1650929 https://bugs.freedesktop.org/show_bug.cgi?id=109594 Fixes: a9fb331ea7d ("wayland/egl: update surface size on window resize") Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Tested-by: Bastien Nocera <hadess@hadess.net> Tested-by: Denys Kostin <denys.kostin@globallogic.com>
* drm-uapi: use local files, not system libdrmEric Engestrom2019-02-141-1/+1
| | | | | | | | | There was an issue recently caused by the system header being included by mistake, so let's just get rid of this include path and always explicitly #include "drm-uapi/FOO.h" Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
* egl/wayland-drm: Only announce formats via wl_drm which the driver supports.Mario Kleiner2019-01-291-0/+18
| | | | | | | | | | | | | | | | | | | | | Check if a pixel format is supported by the Wayland servers gpu driver before exposing it to the client via wl_drm, so we avoid reporting formats to the client which the server gpu can't handle. Restrict this reporting to the new color depth 30 formats for now, as the ARGB/XRGB8888 and RGB565 formats are probably supported by every gpu under the sun. Atm. this is mostly useful to allow proper PRIME renderoffload for depth 30 formats on the typical Intel iGPU + NVidia dGPU "NVidia Optimus" laptop combo. Tested on Intel, AMD, NVidia with single-gpu setup and on a Intel + NVidia Optimus setup. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* egl/wayland: Allow client->server format conversion for PRIME offload. (v2)Mario Kleiner2019-01-291-9/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support PRIME render offload between a Wayland server gpu and a Wayland client gpu with different channel ordering for their color formats, e.g., between Intel drivers which currently only support ARGB2101010 and XRGB2101010 import/display and nouveau which only supports ABGR2101010 rendering and display on nv-50 and later. In the wl_visuals table, we also store for each format an alternate sibling format which stores colors at the same precision, but with different channel ordering, e.g., ARGB2101010 <-> ABGR2101010. If a given client-gpu renderable format is not supported by the server for import, but the alternate format is supported by the server, expose the client-gpu renderable format as a valid EGLConfig to the client. At eglSwapBuffers time, during the blitImage() detiling blit from the client backbuffer to the linear buffer, the client format is converted to the server supported format. As we have to do a copy for PRIME anyway, this channel swizzling conversion comes essentially for free. Note that even if a server gpu in principle does support sampling from the clients native format, this conversion will be a performance advantage if it allows to convert to the servers preferred format for direct scanout, as the Wayland compositor may then be able to directly page-flip a fullscreen client wl_buffer onto the primary plane, or onto a hardware overlay plane, avoiding an extra data copy for desktop composition. Tested so far under Weston with: nouveau single-gpu, Intel single-gpu, AMD single-gpu, "Optimus" Intel server iGPU for display + NVidia client dGPU for rendering. v2: Implement minor review comments by Eric Engestrom: Add some comment and assert, and some style fixes for clarity. No functional change. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* egl/wayland: rather obvious build fixNicolai Hähnle2018-11-281-2/+2
| | | | | Fixes: ce74a7bb8de7 ("egl/wayland: plug memory leak in drm_handle_device()") Fixes: c59d3aa4b9bc ("egl/wayland: bail out when drmGetMagic fails")
* egl/wayland: plug memory leak in drm_handle_device()Emil Velikov2018-11-281-0/+2
| | | | | | | | | | As we fail to open the node, we leak the node/device name. v2: Log and then free() (Eric) Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
* egl/wayland: bail out when drmGetMagic failsEmil Velikov2018-11-281-1/+8
| | | | | | | | | | | | | Currently as the function fails, we pass uninitialized data to the authentication function. Stop doing that and print an warning when the function fails. v2: Plug memory leak in error path (Eric) Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> (v1) Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
* egl: Move loader_set_logger() up to egl_dri2.c.Eric Anholt2018-11-161-4/+0
| | | | | | | Everyone needs to call it, and platform_x11 forgot to. Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* wayland/egl: Resize EGL surface on update buffer for swrastOlivier Fourdan2018-11-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After commit a9fb331ea ("wayland/egl: update surface size on window resize"), the surface size is updated as soon as the resize is done, and `update_buffers()` would resize only if the surface size differs from the attached size. However, in the case of swrast, there is no resize callback and the attached size is updated in `dri2_wl_swrast_commit_backbuffer()` prior to the `swrast_update_buffers()` so the attached size is always up to date when it reaches `swrast_update_buffers()` and the surface is never resized. This can be observed with "totem" using the GDK backend on Wayland (the default) when running on software rendering: $ LIBGL_ALWAYS_SOFTWARE=true CLUTTER_BACKEND=gdk totem Resizing the window would leave the EGL surface size unchanged. To avoid the issue, partially revert the part of commit a9fb331ea for `swrast_update_buffers()` and resize on the win size and not the attached size. Fixes: a9fb331ea - wayland/egl: update surface size on window resize Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> CC: Daniel Stone <daniel@fooishbar.org> CC: Juan A. Suarez Romero <jasuarez@igalia.com> CC: mesa-stable@lists.freedesktop.org Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
* egl: set the EGLDevice when creating a displayEmil Velikov2018-11-011-0/+18
| | | | | | | | | | | This is the final requirement from the base EGLDevice spec. v2: - split from another patch - move wayland hunk after we have the fd Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
* egl/wayland: do not leak wl_buffer when it is lockedJuan A. Suarez Romero2018-08-311-7/+15
| | | | | | | | | | | | | | If color buffer is locked, do not set its wayland buffer to NULL; otherwise it can not be freed later. Rather, flag it in order to destroy it later on the release event. v2: instruct release event to unlock only or free wl_buffer too (Daniel) This also fixes dEQP-EGL.functional.swap_buffers_with_damage.* tests. CC: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Daniel Stone <daniels@collabora.com>
* egl: add helper to combine two u32 into one u64Eric Engestrom2018-08-211-4/+2
| | | | | | | | | Use a helper to avoid the common issues of upcasting after the right shift (losing the upper bits) and shifting signed values (sign gets shifted too). Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl/wayland: remove sign from bitfield `formats`Eric Engestrom2018-08-161-5/+5
| | | | | Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* egl: some spelling fixesEric Engestrom2018-08-161-5/+5
| | | | Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
* wayland/egl: update surface size on window resizeJuan A. Suarez Romero2018-08-081-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to EGL 1.5 spec, section 3.10.1.1 ("Native Window Resizing"): "If the native window corresponding to _surface_ has been resized prior to the swap, _surface_ must be resized to match. _surface_ will normally be resized by the EGL implementation at the time the native window is resized. If the implementation cannot do this transparently to the client, then *eglSwapBuffers* must detect the change and resize surface prior to copying its pixels to the native window." So far, resizing a native window in Wayland/EGL was interpreted in Mesa as a request to resize, which is not executed until the first draw call. And hence, surface size is not updated until executing it. Thus, querying the surface size with eglQuerySurface() after a window resize still returns the old values. This commit updates the surface size values as soon as the resize is done, even when the real resize is done in the draw call. This makes the semantics that any native window resize request take effect inmediately, and if user calls eglQuerySurface() it will return the new resized values. v2: update surface size if there isn't a back surface (Daniel) CC: Daniel Stone <daniel@fooishbar.org> CC: mesa-stable@lists.freedesktop.org Reviewed-by: Daniel Stone <daniels@collabora.com>
* wayland/egl: initialize window surface size to window sizeJuan A. Suarez Romero2018-08-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a windows surface with eglCreateWindowSurface(), the width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is invalid until buffers are updated (like calling glClear()). But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"): "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and height, in pixels, of the surface. For a window or pixmap surface, these values are initially equal to the width and height of the native window or pixmap with respect to which the surface was created" This fixes dEQP-EGL.functional.color_clears.* CTS tests v2: - Do not modify attached_{width,height} (Daniel) - Do not update size on resizing window (Brendan) CC: Daniel Stone <daniel@fooishbar.org> CC: Brendan King <brendan.king@imgtec.com> CC: mesa-stable@lists.freedesktop.org Tested-by: Eric Engestrom <eric@engestrom.ch> Tested-by: Chad Versace <chadversary@chromium.org> Reviewed-by: Chad Versace <chadversary@chromium.org> Reviewed-by: Daniel Stone <daniels@collabora.com>
* egl/wayland: Add 10bpc BGR configsDaniel Stone2018-08-011-0/+12
| | | | | | | | | | Add support for XBGR2101010 and ABGR2101010. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com> Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
* egl: Use the canonical drm-uapi fourcc header to avoid local defines.Eric Anholt2018-07-181-8/+0
| | | | | | | We should only use a #define locally once it's been upstreamed, and at that point you should just update our drm_fourcc.h. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* egl: rewire the build systems to use libwayland-eglEric Engestrom2018-06-061-4/+3
| | | | | | | Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
* egl: check if colorspace/surface type is supportedJuan A. Suarez Romero2018-05-031-0/+6
| | | | | | | | | | | | | | | | | | According to EGL 1.4 spec, section 3.5.1 ("Creating On-Screen Rendering Surfaces"), if config does not support the colorspace or alpha format attributes specified in attrib_list (as defined for eglCreateWindowSurface), an EGL_BAD_MATCH error is generated. This fixes dEQP-EGL.functional.wide_color.*_888_colorspace_srgb (still not merged, https://android-review.googlesource.com/c/platform/external/deqp/+/667322), which is crashing when trying to create a windows surface with RGB888 configuration and sRGB colorspace. v2: Handle the fix in other backends (Tapani) Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>