Add a helper function to turn an array of DRM fourccs into an array of
corresponding struct pixel_format_info pointers.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
This will be useful for client code that wants to create a wl_shm buffer
with a DRM format code.
The test suite will be using this.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Sometimes you will have a pixman_image_t and you need the corresponding
drm_fourcc format.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Add a new hide_from_clients flag which, if set, specifies that the
format is only for internal information and processing, and should not
be advertised for clients.
This will be used for formats like R8 and GR88, which are not useful for
client buffers, but are used internally to implement YUV -> RGB
conversion.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We already had these with effective width and height, but they're useful
externally as well. Pull them out to a helper.
Signed-off-by: Daniel Stone <daniels@collabora.com>
'depth' isn't actually used to determine the bit depth of meaningful
components generally, but specifically to determine whether we can use
the legacy drmModeAddFB (pre-AddFB2) with those formats.
Rename the member to make it more clear what it's used for.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Adds a Pixman format field to the pixel format table, and
adjusts the shm format handling code in the Pixman renderer
to use this table.
Pixman formats have been registered only for specific 565, 8888,
and 2101010 layouts, as these have corresponding DRM format codes
and are commonly used.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Conditionally build support when libdrm is at least 2.4.107 to make use
of it. Plug it in when printing out the buffer information.
With this in, we add a hard dependecy for libweston to link against
libdrm.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
These fields are necessary when looking for an EGLConfig matching a pixel
format, but the configs do not expose a native visual id. Such happens on the
EGL surfaceless platform where one does not actually care about the exact pixel
format, one just cares it has the right number of bits for each channel and the
right component type.
FP16 formats are coming, so this paves way for them too, allowing them to be
described.
The FIXED/FLOAT terminology comes from EGL_EXT_pixel_format_float.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Replace one more open-coded pixel format translation map with a call to our
central pixel format database, reducing duplication of format information.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In current form SHM buffers pixel format can only be printed as 0 and 1.
With the help of this helper we align with DRM_FORMAT_ pixel format.
Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
Add a function to find a format description by the DRM format name. This
will be useful when parsing configuration strings.
While at it, fix the two function formattings in pixel-formats.h to
match everything else in the file.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
There is often a need to print the name of a pixel format. Printing the
raw numeric value is hard to decipher, printing the four ASCII
characters is slightly more human-friendly but still needs a decoder
table. Add a name that can be printed easily.
The bulk of this patch was done with:
sed -i -e 's/\.format = DRM_FORMAT_\(.\+\),/DRM_FORMAT(\1),/' libweston/pixel-formats.c
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Rather than duplicating knowledge of pixel formats across several
components, create a custom central repository.
Signed-off-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix include paths and two copy-pastas]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>