This is a temporary solution to easily test wl_shm support for
different RGB formats. I think it would be better to have a dedicated
client to test all the supported RGB and YUV formats for the wl_shm,
dma-buf import and legacy EGL protocols.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Support more YUV formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add new formats supported by OpenGL to the pixel formats table: R16,
RG88, GR1616, RG1616, XRGB16161616 and ARGB16161616.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Support more RGB formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Simplify fragment shader logic by getting rid of the RGBX variant
which can be implemented using texture swizzles instead.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
All the formats are declared as RGBA swizzled variations. Make the
BGRA8888 format do the same for consistency reasons as there shouldn't
be any performance impact for it.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The channel ordering system currently proposes to swizzle components
in the fragment shader for a few combinations. This commit replaces
this system with texture swizzling parameters in order to support all
the possible combinations in a more efficient way.
This will allow to easily add a lot more formats and as a nice side
effect to force components to 0 or 1, which is useful for opaque
formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OpenGL ES 3 adds support for texture swizzling parameters in order to
let graphics drivers efficiently swizzle R, G, B and A components at
texture look-up, with the nice feature of allowing 0 and 1 as
supported values.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Cache and update texture parameters only when changed by storing
minification/magnification filters, wrap modes and their target into a
dedicated gl_texture_parameters structure and by calling new utility
functions to create and flush parameters.
This structure is itself stored into the buffer state for each texture
of a surface and into the output state for border and shadow textures.
The shader config filled before emitting a draw call now just takes a
pointer to the array of texture ids, a pointer to the array of
parameters and the number of textures.
This allows to simplify the logic in gl-renderer.c, to minimise GL
state changes and to let the utility wrapper validate the parameters.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_EGL_image_storage provides a mechanism for creating texture
objects that are both EGL image targets and immutable. When available,
this makes the texture object target immutable, preventing
respecifications.
While adding support for that extension, it appeared that the
compositor calls attach_buffer() at every buffer updates and that the
texture object is each time respecified to the same EGL image. This
commit additionally prevents any respecification when
EXT_EGL_image_storage isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The parent surface may not be on a layer. In that case, remove all child
surfaces from their current layer as well.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This is purely cosmetic but we do this in other parts as well, when
releasing the GEM handles. Use the macro for no of planes as well when
going over them.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Turns out it seems we have a missed some spots when using the
weston-direct-display protocol.
Specifically we still seem to be attempting a dma buffer import which
ultimately can reach the GPU. This patch rectifies that in such a way
that we can actually provide a full scanout path for client's (dma)
buffers as to avoid hitting the GPU entirely.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This can end up being the first function to touch a surface in a flow,
which leads to confusing traces.
Just trace the function without a flow instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
headless_output_repaint() is not actually called immediately after
weston_output_finish_frame(): Weston waits for "frame-duration - repaint-window"
but at least one millisecond.
And renderning can also take an arbitrary amount of time.
So use weston_output_arm_frame_timer() like all other timer based backends. It
takes all of this into account and calculates the delay relative to the next
expected vblank time.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This tests out if libweston can be built with a C++ compiler and catch
potential issues which we don't normally see.
We re-use one of the builds, the full-x86-64 one, and build this new
front-end alongside it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
A new gl_format_info structure is added to the pixel_format_info
structure in order to store new GL format information (compatible with
Table 1 in gl-utils.c) for each supported format. There will be a
temporary duplication of GL format info in order to keep other parts
of the code not yet ported working. That will be removed later.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_format_BGRA8888 allows OpenGL ES implementations to
support GL_BGRA8_EXT FBO and texture format.
OpenGL implementations handle the spec differently regarding the use
of GL_BGRA8_EXT or GL_BGRA_EXT with TexStorage*D(), TexImage*D() and
RenderbufferStorage(). A recent revision of the spec (and Mesa)
clarifies all that, but in order to support most drivers we simply
check which method is supported by order of preference.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Before the creation of the EXT_texture_storage extension,
OES_required_internalformat used to guarantee minimal FBO and texture
precisions to OpenGL ES 1 and 2 implementations using sized internal
formats.
Note that new external format and type combinations (like for instance
GL_RGB and GL_UNSIGNED_BYTE for the GL_RGB565 sized internal format)
should be available when OES_required_internalformat is supported.
This isn't supported by this wrapper for now because of the implicit
conversion in gl_texture_2d_init() that forces a specific type when
EXT_texture_storage isn't available.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_type_2_10_10_10_REV allows OpenGL ES 2 implementations to
support GL_RGB10_A2 texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
QCOM_render_sRGB_R8_RG8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT and GL_SRG8_EXT FBO formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_sRGB_RG8 allows OpenGL ES 3 implementations to support
GL_SRG8_EXT texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_texture_sRGB_R8 allows OpenGL ES 3 implementations to support
GL_SR8_EXT texture format.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
APPLE_texture_packed_float allows OpenGL ES 2 implementations to
support GL_R11F_G11F_B10F and GL_RGB9_A5 texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
NV_packed_float allows OpenGL ES 2 implementations to support
GL_R11F_G11F_B10F FBO and texture format.
Note that GL_HALF_FLOAT should be available (the spec is a bit
confusing) as type combination with the GL_RGB external format when
both NV_packed_float and OES_texture_half_float are supported on
OpenGL ES 2. This isn't supported by this wrapper for now because of
the implicit conversion in gl_texture_2d_init() that forces a specific
type when EXT_texture_storage isn't available.
NV_packed_float_linear would require a new utility function to
retrieve whether a texture can be linearly interpolated by the texture
samplers or not. This hasn't been added for the other formats because
there's no users for now but this might be added later.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_color_buffer_float allows OpenGL ES implementations to support
GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F and
GL_R11F_G11F_B10F FBO formats. All of these are supported by default
from OpenGL ES 3.2.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
EXT_color_buffer_half_float allows OpenGL ES implementations to
support GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F FBO formats.
GL_R16F, GL_RG16F and GL_RGBA16F are supported by default from OpenGL
ES 3.2.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OES_texture_float allows OpenGL ES 2 implementations to support
GL_R32F, GL_RG32F, GL_RGB32F and GL_RGBA32F texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OES_texture_half_float allows OpenGL ES 2 implementations to support
GL_R16F, GL_RG16F, GL_RGB16F and GL_RGBA16F texture formats.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
OpenGL ES 2 implementations support texture immutability and sized
internal formats using the GL_EXT_texture_storage extension.
Co-authored-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>