drm: do not pull writeback task if KMS atomic API is not supported

Since 2d70bdfdcd "drm-backend: add support
to output capture writeback source", the DRM-backend was broken for KMS
devices that do not support the atomic API. This fixes that.

We don't support writeback screenshots without atomic modeset support.
So for such devices, we never update the output capture info
(weston_output_update_capture_info()) for the writeback source.

The function that we use to pull writeback tasks
(weston_output_pull_capture_task()) asserts that the capture providers
(renderers, DRM-backend) did not forget to update the capture info
(size/format) if something changed. But as we've never updated the
capture info for such devices, it is zeroed, leading to an assert hit.

With this patch we only pull the capture task for KMS devices that
support the atomic API.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2023-06-02 14:44:44 -03:00 committed by Pekka Paalanen
parent 6d8e3c569c
commit 3226417573

View file

@ -553,14 +553,14 @@ drm_output_pick_writeback_capture_task(struct drm_output *output)
int32_t height = output->base.current_mode->height;
uint32_t format = output->format->format;
assert(output->device->atomic_modeset);
ct = weston_output_pull_capture_task(&output->base,
WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
width, height, pixel_format_get_info(format));
if (!ct)
return;
assert(output->device->atomic_modeset);
if (output->base.disable_planes > 0) {
msg = "drm: KMS planes usage is disabled for now, so " \
"writeback capture tasks are rejected";
@ -642,7 +642,8 @@ drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
if (drm_output_ensure_hdr_output_metadata_blob(output) < 0)
goto err;
drm_output_pick_writeback_capture_task(output);
if (device->atomic_modeset)
drm_output_pick_writeback_capture_task(output);
drm_output_render(state, damage);
scanout_state = drm_output_state_get_plane(state,