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>
Everywhere else uses #ifdef, this used just #if. When the next commit
adds -Wundef to the compiler options, this #if here will start failing
as ENABLE_EGL is undefined.
It would be much better to use Meson's set10() for ENABLE_EGL and change
all #ifdef into #if, but I opted for the smaller change for now.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This header is for sharing fallback definitions for drm_fourcc.h. A new
test in tests/yuv-buffer-test.c is going to be needing XYUV8888 format,
and more new formats will be expected with HDR supports.
Share these fallback definitions in one place instead of copying them
all over.
All users of drm_fourcc.h are converted to include weston-drm-fourcc.h
instead for consistency: have the same definitions available everywhere.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.
This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.
This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with
#include "libweston/dbus.h"
or even
#include <libweston/dbus.h>
IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.
The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'
Signed-off-by: Pekka Paalanen <pekka.paalanen@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>
pixel_format_get_info() is already documented in the headers; no need to
also document it next to the code.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We already have documentation in header which conflicts with the one
the source code. Remove it entirely as it confuses user as well.
Signed-off-by: Marius Vlad <marius.vlad@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>