drm-backend: add support to output capture writeback source

With this change, we expose the DRM-backend writeback source through the
output capture interface, making it available to clients.

For now we'll always fail writeback screenshots requests, because we
still don't have the writeback screenshooter implementation on the
DRM-backend. We add that in the following commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2023-02-14 22:33:11 -03:00
parent 247d492d64
commit 2d70bdfdcd

View File

@ -444,6 +444,26 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
pixman_region32_fini(&scanout_damage);
}
static void
drm_output_pick_writeback_capture_task(struct drm_output *output)
{
struct weston_capture_task *ct;
const char *msg = "drm: writeback screenshot not supported yet";
int32_t width = output->base.current_mode->width;
int32_t height = output->base.current_mode->height;
uint32_t format = output->format->format;
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);
weston_capture_task_retire_failed(ct, msg);
}
static int
drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
{
@ -482,6 +502,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);
drm_output_render(state, damage);
scanout_state = drm_output_state_get_plane(state,
output->scanout_plane);
@ -792,6 +814,13 @@ drm_output_apply_mode(struct drm_output *output)
}
}
if (device->atomic_modeset && !output->base.disable_planes)
weston_output_update_capture_info(&output->base,
WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
output->base.current_mode->width,
output->base.current_mode->height,
pixel_format_get_info(output->format->format));
return 0;
}
@ -1967,6 +1996,12 @@ drm_output_enable(struct weston_output *base)
output->base.switch_mode = drm_output_switch_mode;
output->base.set_gamma = drm_output_set_gamma;
if (device->atomic_modeset && !base->disable_planes)
weston_output_update_capture_info(base, WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
base->current_mode->width,
base->current_mode->height,
pixel_format_get_info(output->format->format));
weston_log("Output %s (crtc %d) video modes:\n",
output->base.name, output->crtc->crtc_id);
drm_output_print_modes(output);