diff options
author | Austin Shafer <ashafer@nvidia.com> | 2022-12-20 12:23:02 +0100 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2023-01-20 17:56:54 +0000 |
commit | d67383a695f40ca5470ae2392233e1f5fc012b0c (patch) | |
tree | c8764f5c4bd9dc975c0b38afc126e8b88f9f29aa | |
parent | 9865a2321f96966f1314aab8349392439f2e3e09 (diff) |
xwayland: Send PresentCompleteModeSuboptimalCopy if dmabuf feedback was resent
If the dmabuf protocol's feedback object gave us a new list of
modifiers, send PresentCompleteModeSuboptimalCopy to the client
to inform them that they need to call GetSupportedModifiers.
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
-rw-r--r-- | hw/xwayland/xwayland-glamor.c | 1 | ||||
-rw-r--r-- | hw/xwayland/xwayland-present.c | 29 | ||||
-rw-r--r-- | hw/xwayland/xwayland-window.h | 7 |
3 files changed, 36 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index fdec127d8..6c7784efb 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -608,6 +608,7 @@ xwl_dmabuf_feedback_done(void *data, struct zwp_linux_dmabuf_feedback_v1 *dmabuf struct xwl_dmabuf_feedback *xwl_feedback = data; xwl_feedback->feedback_done = true; + xwl_feedback->unprocessed_feedback_pending = true; } static void diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 99e476b2f..2c0e1a05c 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -296,6 +296,7 @@ xwl_present_flip_notify_vblank(present_vblank_ptr vblank, uint64_t ust, uint64_t { WindowPtr window = vblank->window; struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window); + uint8_t mode = PresentCompleteModeFlip; DebugPresent(("\tn %" PRIu64 " %p %" PRIu64 " %" PRIu64 ": %08" PRIx32 " -> %08" PRIx32 "\n", vblank->event_id, vblank, vblank->exec_msc, vblank->target_msc, @@ -321,7 +322,10 @@ xwl_present_flip_notify_vblank(present_vblank_ptr vblank, uint64_t ust, uint64_t xwl_present_window->flip_active = vblank; - present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc); + if (vblank->reason == PRESENT_FLIP_REASON_BUFFER_FORMAT) + mode = PresentCompleteModeSuboptimalCopy; + + present_vblank_notify(vblank, PresentCompleteKindPixmap, mode, ust, crtc_msc); if (vblank->abort_flip) xwl_present_flips_stop(window); @@ -559,6 +563,27 @@ xwl_present_flush(WindowPtr window) glamor_block_handler(window->drawable.pScreen); } +static void +xwl_present_maybe_set_reason(struct xwl_window *xwl_window, PresentFlipReason *reason) +{ + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + + if (!reason || xwl_screen->dmabuf_protocol_version < 4) + return; + + if (xwl_window->feedback.unprocessed_feedback_pending) { + xwl_window->feedback.unprocessed_feedback_pending = 0; + + *reason = PRESENT_FLIP_REASON_BUFFER_FORMAT; + } + + if (xwl_screen->default_feedback.unprocessed_feedback_pending) { + xwl_screen->default_feedback.unprocessed_feedback_pending = 0; + + *reason = PRESENT_FLIP_REASON_BUFFER_FORMAT; + } +} + static Bool xwl_present_check_flip(RRCrtcPtr crtc, WindowPtr present_window, @@ -579,6 +604,8 @@ xwl_present_check_flip(RRCrtcPtr crtc, if (!xwl_window) return FALSE; + xwl_present_maybe_set_reason(xwl_window, reason); + if (!crtc) return FALSE; diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h index 88ea6011c..2e8313f56 100644 --- a/hw/xwayland/xwayland-window.h +++ b/hw/xwayland/xwayland-window.h @@ -80,6 +80,13 @@ struct xwl_dmabuf_feedback { int feedback_done; int dev_formats_len; struct xwl_device_formats *dev_formats; + /* + * This flag is used to identify if the feedback + * has been resent. If this is true, then the xwayland + * clients need to be sent PresentCompleteModeSuboptimalCopy + * to tell them to re-request modifiers. + */ + int unprocessed_feedback_pending; }; struct xwl_window { |