Commit Graph

15 Commits

Author SHA1 Message Date
Manuel Stoeckl 8a7f1e2bc0 pixman-renderer: track Pixman formats in pixel format table
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>
2021-09-15 15:00:29 +03:00
Marius Vlad 6f6fd2686d pixel-formats: Add human readable format modifier
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>
2021-07-22 22:19:17 +00:00
Pekka Paalanen a4ecf96316 libweston: fix #ifdef ENABLE_EGL
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>
2021-03-12 16:14:28 +02:00
Pekka Paalanen 4b301fe7f2 Add weston-drm-fourcc.h
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>
2021-02-25 14:35:03 +02:00
Pekka Paalanen c232f8d934 Unify the include style of shared/ headers
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>
2019-10-04 16:04:48 +03:00
Pekka Paalanen abd3f3c3ea pixel-formats: add RGBA bits and type fields
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>
2019-10-04 12:17:18 +03:00
Pekka Paalanen 8ba775d96d backend-drm: use format db for fallback too
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>
2019-10-01 09:26:33 +00:00
Daniel Stone bc4ccc2085 pixel-formats: Remove duplicate doc string
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>
2019-06-26 12:27:14 +01:00
Marius Vlad eeabe17e7c pixel-formats: Fix doxygen warnings about missing format
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>
2019-06-25 14:05:54 +00:00
Emmanuel Gil Peyrot 426c24673f Fix typos all around (thanks codespell!) 2019-02-20 16:47:35 +01:00
Marius Vlad 2ce2339045 pixel-formats: Document pixel format human-friendly conversion methods
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-23 16:28:21 +02:00
Marius Vlad a9a630401f pixel-formats: Added pixel_format_get_info_shm() helper for printing SHM buffers
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>
2018-11-20 18:00:09 +02:00
Pekka Paalanen f5ed7431e5 pixel-formats: search by name
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>
2018-11-20 12:05:11 +02:00
Pekka Paalanen e7c91b61c7 pixel-formats: add name string
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>
2018-11-20 12:05:11 +02:00
Daniel Stone 903721a621 libweston: Add pixel-format helpers
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>
2017-04-07 12:28:36 +03:00