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>
This commit is contained in:
Austin Shafer 2022-12-20 12:23:02 +01:00 committed by Michel Dänzer
parent 9865a2321f
commit d67383a695
3 changed files with 36 additions and 1 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 {