Commit Graph

28 Commits

Author SHA1 Message Date
Chao Guo 0000c491f4 backend-drm: make the renderer produce client format matched image
When users need to place view on underlay HW plane, they need to set
the output format to alpha format.

This will cause gl-renderer to output a transparent image, allowing
through holes to work.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-07-11 08:59:03 +00:00
Ray Smith 885c616589 backend-drm: fix confused fallback format handling
This seems to think formats needs to be NULL terminated, but it doesn't
and gl_renderer_get_egl_config asserts that all formats_count elements
are not NULL.

This happens when EGL_KHR_no_config_context is not supported.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-01-22 09:29:01 +00:00
Tomohito Esaki 1e781d9f88 drm-backend: Drop support libgbm older than 21.1.1
Since drm-backend requires libgbm 21.1.1 or later, there is no need to
support the old libgbm which does not support modifiers or fd import.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2023-08-09 21:45:42 +03:00
Daniel Stone 9aa68248a9 backend-drm: Use weston_compositor.shutting_down
We previously had our own local variable for this, but now we can just
use the one in weston_compositor.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Michael Tretter 3f9f4277c3 backend-drm: import cursors on non gbm outputs
Additional devices don't have a gbm device. Therefore, we cannot create gbm bos
for the cursor.

If the output device differs from the gbm device, fall back to the allocation of
a dumb buffer for the cursor on the output device. Update the cursor sprite with
a memcpy to the already mapped dumb buffer that belongs to the current cursor.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Tretter 575804c7e1 backend-drm: use linear buffers if gbm and kms device differ
If we are using multiple GPUs and are not able to use modifiers to ensure that
the formats are compatible, we have to use linear buffers for the transfer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Philipp Zabel 4c3febfb52 backend-drm: use pixel_format_info instead of gbm_format
Use const struct pixel_format_info *format instead of uint32_t
gbm_format for backend and output pixel format.

Since create_gbm_surface() is never called without output->format being
set, drop the unnecessary error message.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 15:32:24 +00:00
Philipp Zabel ad38c41a50 gl-renderer: use pixel_format_info instead of drm fourccs
Use struct pixel_format_info pointers instead of uint32_t drm fourcc
values at the API surface for output and image creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-29 14:47:03 +01:00
Philipp Zabel 6757bae0f3 pixman-renderer: set renderbuffer via new repaint_output parameter
Add a struct weston_renderbuffer parameter to repaint_output and make
backends set the pixman image renderbuffer through this parameter
instead of using pixman_renderer_output_set_buffer()

Turn pixman_renderer_output_set_buffer() static.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-23 20:05:21 +00:00
Philipp Zabel fc8d260ce3 libweston, backends: move GL renderer interface into weston_renderer
Move the struct gl_renderer_interface pointer from the backends into
the weston_renderer structure. The interface struct only contains
function pointers that never change, so make it const.

Load and initialize the GL renderer in libweston instead of in the
backends, using the new weston_compositor_init_renderer() function.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-16 20:40:34 +01:00
Philipp Zabel 97e9ee5b10 backend-drm: store backend on struct drm_output
To avoid retrieving the backend from the compositor all the time, store
a pointer to the drm backend on its drm_output structures.

This will be useful once the compositor contains more than one backend.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-16 11:51:48 +01:00
Pekka Paalanen 7886cbe4b9 gl-renderer: pass initial output area explicitly
This changes the GL-renderer interface to pass the initial framebuffer
size and compositing area explicitly. All backends are changed to
provide the correct parameters.

GL-renderer mostly does not yet use these values, but later patches
will. The pbuffer path uses it already, because they replaced the
existing fields.

All this is to make GL-renderer aware of the different sizes, so it can
implement the future revision of the screenshooting API.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Marius Vlad eaf2de3441 compositor: Use weston_load_module
Except the module dir path, they're one and the same. This change
warrants a libweston version bump, if it hasn't been done already.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:47:40 +00:00
Marius Vlad 78ccc99d0a libweston: Remove runtime render switching
It is only enabled by a debug key binding, currently not tested at all,
and is seems it doesn't really work, so let's remove it. This also
removes it from the man page.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-07-26 13:40:43 +00:00
Michael Tretter deebfd99e3 backend-drm: get the drm device from the output
If we have multiple drm devices, we cannot use the drm device from the backend,
because we would only get the primary device and not the device of the output.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:17:49 +02:00
Michael Tretter 101c0f6b8b backend-drm: get the fb using the device instead of the backend
The fbs are specific to the device on which they will be displayed. Therefore,
we have to tell which device shall be used when we are creating the fb.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:13:40 +02:00
Michael Tretter 0d967bd7f4 backend-drm: extract device from backend
Extract the kms device from the backend to allow a better separation of the
backend and the kms device. This will allow to handle multiple kms devices with
a single drm backend.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:12:57 +02:00
Michael Tretter 00b74293e8 backend-drm: use pixel format to print gbm format
The gbm_format is the same as the drm format used by the pixel format.

Print the format name using the pixel format in the error message to make the
error message easier to understand for humans.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:04:29 +02:00
Marius Vlad bb55d86300 backend-drm/drm-gbm: gbm_device_destroy on an invalid gbm device
When EGL initialization fails (failure to create a GLES3 or GLES2
context) we will end up calling gbm_device_destroy() twice, once
in init_egl() and once in the drm_backend_create() error path.

Given that we should also take care of properly destroying the gbm
device when we don't have any inputs for instance, mark the gbm device
as NULL to avoid calling gbm_device_destroy() once more when destroying
the DRM-backend.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-01-12 13:52:26 +00:00
Leandro Ribeiro 567cc92797 backend-drm: add DRM_FORMAT_MOD_INVALID to modifier sets when no modifiers are supported
From now on, when we can't know the modifiers supported for a certain
format, we add DRM_FORMAT_MOD_INVALID to its modifier set.

There is some parts where nothing is being added an others where
DRM_FORMAT_MOD_LINEAR is being added, so fix them.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-27 19:56:38 +00:00
Leandro Ribeiro f767302729 backend-drm: fix slightly wrong comment about allocating with no modifiers
In create_gbm_surface() we may allocate with no modifiers in the
following situations:

1. old GBM version, so HAVE_GBM_MODIFIERS is false;
2. the KMS driver does not support modifiers;
3. if allocating with modifiers failed, what can happen when the KMS
   display device supports modifiers but the GBM driver does not, e.g.
   the old i915 Mesa driver.

The comment was only stating the third situation, so add the other two.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-27 19:56:38 +00:00
Leandro Ribeiro 3459bad63d backend-drm: move code that creates gbm surface to a separate function
The function drm_output_init_egl() is too big, so move the code to
create the gbm surface to a separate function: create_gbm_surface().

Also made some minor style changes to the code that has been moved, in
order to improve readability.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-27 19:56:38 +00:00
Scott Anderson 7466309c12 backend-drm: start to use weston_drm_format in drm_plane
In commit "libweston: add struct weston_drm_format" struct
weston_drm_format and its helper functions were added to libweston.
Also, unit tests for this API have been added in commit "tests: add unit
tests for struct weston_drm_format".

Start to use this API in the DRM-backend, as it enhances the code by
avoiding repetition and ensuring correctness.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-27 19:56:38 +00:00
Alexandros Frantzis 9975134593 drm: Introduce drm_plane_reset_state() helper function
Introduce a helper function to reset the current state of a drm_plane.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2020-08-17 09:44:45 +00:00
Daniel Stone db6e6e1ec5 gl-renderer: Replace window-create args with struct
gl_rendererer's output_window_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-03-20 15:25:24 +00:00
Daniel Stone c890c384c8 gl-renderer: Replace display-create args with struct
gl_rendererer's output_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2020-03-20 15:25:24 +00:00
Emmanuel Gil Peyrot 1b3ad0993b backend-drm: Make boolean fields actually bool
Continues what dd8219b3fb started, also in
the DRM backend.
2019-12-11 19:33:20 +00:00
Stefan Agner ccf24076dd backend-drm: make GBM optional
Make GBM optional in case GL renderer is disabled. This allows to
build Weston with DRM backend without Mesa dependencies.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-10-25 15:32:07 +02:00