This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.
This reverts commit 8634c7e349.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This flag ensures support for both the GL_ANDROID_native_fence_sync
and the GL_EXT_disjoint_timer_query extensions at run-time. The GL
features log now reports that flag so the warning log has been
removed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Now that the GL extensions are stored in the gl_extensions bitfield,
there's no need to use booleans anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit ensures GL_OES_EGL_image is available before setting up
dma-buf renderer functions because it's not implied by the presence of
the EGL_EXT_image_dma_buf_import extension.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
GL_OES_texture_3D isn't used because of the complexity implied for
correct OpenGL ES 2 support (see commit 734c2278), so there's no need
to check for it. The check also now avoids checking for
GL_EXT_color_buffer_half_float on OpenGL ES 3.2 which includes support
for 16-bit FP renderbuffers by default.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The GL renderer supports OpenGL ES from version 2.0 to 3.2. It's meant
to correctly link on systems with only OpenGL ES 2, so OpenGL ES 3
symbols can't be used directly. eglGetProcAddress() is currently
defined to not support the querying of non-extension OpenGL ES
functions. Support for that is exposed by the
KHR_get_all_proc_addresses extension. This commit ensures OpenGL ES 3
function addresses can be retrieved by eglGetProcAddress() by checking
for that extension at run-time.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
A new gl_extensions bitfield is added to the renderer to store the
flags supported by the GL implementation. This allows the GL renderer
to easily check for extension support whenever needed.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Don't flag EGL_PBUFFER_BIT to get the EGL config if the
EGL_KHR_surfaceless_context extension isn't available. The branch is
never taken because the extension is required and if it isn't
available, the function would have already returned.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Get the EGL_WL_bind_wayland_display extension function addresses after
checking for extension availability.
Let the EGL display setup end before trying to bind the Wayland
display in gl-renderer.c. The EGL features log will now report the
extension as supported even if the bind subsequently fails, in which
case a warning is logged.
This commit also avoids calling query_buffer() if the display isn't
bound in fill_buffer_info(), it would otherwise fail or even segfault
if the EGL_WL_bind_wayland_display extension isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This feature flag is for explicit sync support.
We replace the explicit sync warning by logging supported fence syncs
along with the report EGL features report.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This second feature flag ensures that either the
EGL_EXT_swap_buffers_with_damage or EGL_EXT_swap_buffers_with_damage
extension is available.
Some function pointer addresses are currently retrieved depending on
the availabilty of their associated extension and some others are
retrieved unconditionally. For consistency reasons, we'll try from now
on in this commit set to first load function pointers depending on the
associated extension availability and then flag features once all the
addresses are retrieved.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit introduces feature flags. While an extension flag only
ensures the availability of an extension at run-time, a feature flag
ensures the availability of a minimal OpenGL ES version and/or
extensions in order to easily check for the availability of a specific
feature at run-time.
This first feature ensures the availability of either the
EGL_KHR_no_config_context or EGL_MESA_configless_context extensions.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Now that the EGL extensions are stored in the egl_*_extensions
bitfields, there's no need to use booleans anymore.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This new utility parses extension strings and fills a bitfield of
matched flags. This will be used to store EGL and GL extension flags.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The dmabuf allocator pulls in libgbm which lives inside Mesa and is built
as a non-standalone part Mesa. This makes gl-renderer hard-wired to Mesa.
The allocator is only used by an optional pipewire backend so make
the allocator optional too.
Signed-off-by: Tomek Bury <tomek.bury@gmail.com>
The buffer_init function added with commit 83b37c0ac4, "renderers: pull
dmabuf initial setup out of attach", doesn't take into consideration the
the buffer's direct-display property.
Previously, gl_renderer_attach_dmabuf, wasn't being called when dmabuf's
direct-display was turned on, but with commit 83b37c0ac4 this has been changed.
So with commit 83b37c0ac4, linux_dmabuf_buffer_get_user_data will never
return a valid gb (gl buffer state), causing a crash using
direct-display extension. This adds an explicit check to return early
when this happens.
Fixes: 83b37c0ac4, "renderers: pull dmabuf initial setup out of attach"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.
With this change windowed-output-api.h also includes the helpers header.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The debug clear region must be generated out of the current render
buffer's damage region, not out of the current damage region, unless
shadow 16F is enabled.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
eglSetDamageRegion() requires a postable surface and shouldn't be
called with EGL_NO_SURFACE.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Revert active unit to default value right after use so that other
functions can assume the default state. A best practices section is
added to the internal header for reference.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The wireframe unit can only be used by the wireframe texture so
there's no need to bind it anymore before use.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Merge duplicated gl_renderer_attach_dmabuf() and
gl_renderer_attach_egl() functions into a single
gl_renderer_attach_buffer() one.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Revert pixel store's GL_UNPACK_* changes to default values right after
use so that other part of the code can assume the default state.
Fixes: #928
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to default
value right after use so that other part of the code can assume the
default state.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to
default value right after use so that other part of the code can
assume the default state.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Prepare gl_renderer_do_read_pixels() so that the default pixel storage
states can be more easily reverted to default before return.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
These were only necessary to allow surface_copy_content to return contents
that included recently attached (but not yet rendered) buffers.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of attaching and flushing damage when performing
weston_surface_copy_content, just return the contents as the renderer
currently knows them.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If the renderer uses the EGL_PLATFORM_GBM_KHR, the egl_native_display is already
a gbm_device and the renderer doesn't have to create another device.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The GL renderer is able to use a gbm_device to allocate gbm_bos, which can be
used as DMABUFs.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Support importing dmabuf buffers as renderbuffers and binding them to
FBOs. These can then be rendered to directly, or they can be blitted
into from the shadow render buffer.
How to best create those dmabuf buffers in the backend is an open
question and may vary depending on what external API the backend is
interfacing with.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The renderbuffer list is the reason for keeping a reference for the
renderbuffers in the gl-renderer. Add helper functions to make this explicit.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The GL renderer uses the bottom left corner as origin. Therefore, the buffers
must be flipped when using ReadPixels to have a image in the correct orientation
for screenshots. If the rendered buffers are directly passed to a different
application without going through ReadPixels, the rendered buffer appears upside
down.
Flip the rendered image in the FBO to fix the orientation when directly using
the rendered buffer. Update read_pixels to not flip the image in these cases.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
read_pixels may use the top left or bottom left corner as origin.
As the renderer may render the image upside down based on the y_flip variable.
read_pixels must read the image with the same origin as used by the renderer to
produce a correct image.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The GL renderer uses the bottom left corner as origin and several
transformations in the renderer assume this corner as origin.
Make this assumption explicit by introducing a y_flip variable that is used to
calculate transformation that are caused by this origin.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Avoid the calculation of the y-flipped coordinates when transforming the pixman
region to the vertex coordinates by initializing the projection matrix to
already include the y-flip.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
This moves debug mode setup to a dedicated function because the
addition of new modes made it bigger.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The shaders debug mode doesn't have much interest now that other more
specific debug modes show shaders too.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The batches debug mode tints each batch of a repaint pass in a
different color in order to highlight batches.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>