Add function to query the DRM device given an EGLDisplay. It is the
device being used by the compositor to perform composition.
This will be useful in the next commits of this series, where we add
support for dma-buf feedback.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This allows passing EGL_PLATFORM_SURFACELESS_MESA to
gl_renderer_display_create(). It is not useful on its own, because the
surfaceless platform has no window surfaces.
This feature will be used by the headless backend.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Use EGL fence sync objects to emit timepoints for the beginning and the
end of rendering on the GPU. The timepoints are emitted asynchronously
using the sync file fds associated with the fence sync objects. The sync
file fds are acquired using the facilities provided by the
EGL_ANDROID_native_fence_sync extension.
The asynchronous timepoint submissions are stored in a list in
gl_output_state until they are executed, and any pending submissions
that remain at output destruction time are cleaned up.
If timelining is inactive or the required EGL extensions are not
present, then GPU timepoint processing and emission are skipped.
Note that the GPU timestamps returned by sync files are in the
CLOCK_MONOTONIC clock domain, and are thus compatible with the
timeline timestamps (which also are in the CLOCK_MONOTONIC domain).
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Check for the EGL_KHR_fence_sync and EGL_ANDROID_native_fence_sync
extensions and get pointers to required extension functions.
These extensions allow us to acquire GPU timestamp information
asynchronously, and are required by the upcoming work to add
rendering begin/end timepoints to the weston timeline.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
EGL_EXT_image_dma_buf_import_modifiers supports importing upto four dmabuf
planes into an EGLImage.
v2: correct PLANE3_PITCH token (Daniel Stone)
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
pass over the modifier attributes to EGL.
v2: ensure same modifier is passed for all planes (Daniel Stone)
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
EGL_EXT_image_dma_buf_import_modifiers allows querying the formats
and modifiers supported by the platform. expose these to the compositor.
v2:
- change calloc args (Daniel Stone)
- check for modifier support before querying formats (Daniel Stone)
Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Given that it's used by clients, it's really the very definition of
shared.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This patch makes use of recently implemented
EGL_KHR_no_config_context extension in Mesa,
which superseeds EGL_MESA_configless_context.
See also (and the follow-up patch):
https://lists.freedesktop.org/archives/mesa-dev/2016-September/128510.html
v2:
- Extend existing infrastructure for EGL_MESA_configless_context
per suggestion from Emmanuel Gil Peyrot.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
weston-egl-ext.h has been include in compositor-xx.c file in order to
define EGL_PLATFORM_xxx_KHR extensions used by the compositors.
But in case EGL support is not enabled, all EGL related definition must
be skipped except EGL_PLATFORM_xxx_KHR that must be still defined to
allow compositor-xx.c to build.
Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Will allow us to consolidate the multiple definitions through the tree.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
... and use it from simple-egl and gl-renderer.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This clarifies what is supposed to be the libweston code.
v2: screen-share.c is already in compositor/ instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
Import dmabuf as an EGLImage, and hold on to the EGLImage until we are
signalled a content change. On content change, destroy the EGLImage and
re-import to trigger GPU cache flushes.
We hold on to the EGLImage as long as possible just in case the client
does other imports that might later make re-importing fail.
As dmabuf protocol uses drm_fourcc codes, we need libdrm for
drm_fourcc.h. However, we are not doing any libdrm function calls, so
there is no new need to link to libdrm.
RFCv1 changes:
- fix error if dmabuf exposed unsupported
- always use GL_TEXTURE_EXTERNAL_OES with dmabuf
v2 changes:
- improve support check and error handling
- hold on to the imported EGLImage to avoid the dmabuf becoming
unimportable in the future
- send internal errors with linux_dmabuf_buffer_send_server_error()
- import EGL_EXT_image_dma_buf_import extension headers
- use heuristics to decide between GL_TEXTURE_2D and
GL_TEXTURE_EXTERNAL_OES
- add comment about Mesa requirements
- change y-invert from per-plane boolean to per-buffer flag
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Older versions of Mesa provided header definitions for the
EGL_WL_bind_wayland_display extension, but an earlier version of the
extension which only provided the (un)bind entrypoints, and not
QueryWaylandBuffer. Detect this half-provision and make sure we export
the QueryWaylandBuffer definitions as well.
Fixes build failure with EGL on Ubuntu 12.04.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Earlier versions of gl2ext.h defined the GL_EXT_unpack_subimage tokens
without the _EXT suffix. That's been fixed and we're using the _EXT
tokens now, but just in case we're using an older, broken header, define
the _EXT tokens manually.
In cases where the GPU can natively handle certain YUV formats,
eglQueryWaylandBufferWL() can return the value EGL_TEXTURE_EXTERNAL_WL
and the compositor will treat the buffer as a single egl-image-external.
See:
http://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt
v1: original
v2: rename EGL_TEXTURE_EXTERNAL_OES -> EGL_TEXTURE_EXTERNAL_WL and query
for the extension
v3: fix build without updated mesa headers, if EGL_TEXTURE_EXTERNAL_WL
#define is missing from older mesa headers.
v4: resend without missing parts
Signed-off-by: Rob Clark <rob@ti.com>
This is a workaround for platforms, whose EGL headers miss the
definitions for EGL_WL_bind_wayland_display.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>