diff options
author | Simon Ser <contact@emersion.fr> | 2023-04-20 10:39:46 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-04-20 10:39:46 +0200 |
commit | 44069dfd5e9e3efa150ce468f48c64916f2de0ae (patch) | |
tree | 03261acc761e48a341cbb93988ef0f238f6581be /backend/drm | |
parent | d79582434685827275d79dca05f61efed5e3d6e7 (diff) |
output-layer: add cropping support
Add a src_box state field. Use the SRC_* KMS props in the DRM
backend, reject the layers in the Wayland backend (for now, we can
support it later via viewporter).
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/libliftoff.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/backend/drm/libliftoff.c b/backend/drm/libliftoff.c index cd62dccb..550d4533 100644 --- a/backend/drm/libliftoff.c +++ b/backend/drm/libliftoff.c @@ -201,10 +201,18 @@ static bool set_layer_props(struct wlr_drm_backend *drm, uint64_t crtc_w = (uint64_t)state->dst_box.width; uint64_t crtc_h = (uint64_t)state->dst_box.height; - uint64_t src_x = to_fp16(0); - uint64_t src_y = to_fp16(0); - uint64_t src_w = to_fp16(width); - uint64_t src_h = to_fp16(height); + struct wlr_fbox src_box = state->src_box; + if (wlr_fbox_empty(&src_box)) { + src_box = (struct wlr_fbox){ + .width = width, + .height = height, + }; + } + + uint64_t src_x = to_fp16(src_box.x); + uint64_t src_y = to_fp16(src_box.y); + uint64_t src_w = to_fp16(src_box.width); + uint64_t src_h = to_fp16(src_box.height); return liftoff_layer_set_property(layer->liftoff, "zpos", zpos) == 0 && |