[RFC xserver v5 04/14] present: Send PresentCompleteModeSuboptimalCopy appropriately
Michel Dänzer
michel at daenzer.net
Tue Nov 7 11:01:52 UTC 2017
On 06/11/17 10:30 PM, Louis-Francis Ratté-Boulianne wrote:
> Add 'check_flip2' hook for driver to let know the core
> about why flipping is not possible ('reason').
> If it is because of unsupported buffer format/modifier,
> a PresentCompleteNotify event is sent to the client with
> the PresentCompleteModeSuboptimalCopy mode.
>
> v2: Check for PresentOptionSuboptimal and check driver version
> before using 'check_flip2'.
>
> Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
[...]
> @@ -177,7 +178,12 @@ present_check_flip(RRCrtcPtr crtc,
> }
>
> /* Ask the driver for permission */
> - if (screen_priv->info->check_flip) {
> + if (screen_priv->info->version >= 1 && screen_priv->info->check_flip2 && reason) {
> + if (!(*screen_priv->info->check_flip2) (crtc, window, pixmap, sync_flip, reason)) {
> + DebugPresent(("\td %08lx -> %08lx\n", window->drawable.id, pixmap ? pixmap->drawable.id : 0));
> + return FALSE;
> + }
> + } else if (screen_priv->info->check_flip) {
This could be improved slightly in one of two ways:
The check_flip2 hook could be used even if reason is NULL. That way, the
driver could only provide the check_flip2 hook, it wouldn't need to
provide the check_flip hook as well.
Otherwise, the test could be rearranged as
if (reason && screen_priv->info->version >= 1 && screen_priv->info->check_flip2) {
so that the screen_priv->info members don't need to be tested if reason
is NULL anyway.
> @@ -564,6 +570,7 @@ present_check_flip_window (WindowPtr window)
> present_window_priv_ptr window_priv = present_window_priv(window);
> present_vblank_ptr flip_pending = screen_priv->flip_pending;
> present_vblank_ptr vblank;
> + int reason;
Either this local variable needs to be initialized, or
present_check_flip needs to set a reason value even if the driver
doesn't provide the check_flip2 hook.
> diff --git a/present/present.h b/present/present.h
> index aab2e168a..094946a7c 100644
> --- a/present/present.h
> +++ b/present/present.h
> @@ -27,6 +27,9 @@
> #include "randrstr.h"
> #include "presentext.h"
>
> +#define PresentFlipReasonUnknown 0
> +#define PresentFlipReasonBufferFormat 1
Might be nice to make this an enum.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the xorg-devel
mailing list