[PATCH xserver 1/4] xwayland: Don't create a "fake" crtc for Present
Roman Gilg
subdiff at gmail.com
Tue May 8 12:01:08 UTC 2018
Thanks for looking into this. You are right that the fake CRTCs are
not needed. The reason I introduced them in the past was that with a
change (reset) of the msc counter the client might want to see a
different CRTC as well. But with the persistent window structs the
CRTC stays the same all the time and the msc counter is monotonically
counting for a window so there should be no need to have different
CRTCs for different msc counters.
Tested the patch in a Plasma session with VLC and Skype.
Tested-by: Roman Gilg <subdiff at gmail.com>
Reviewed-by: Roman Gilg <subdiff at gmail.com>
On Mon, May 7, 2018 at 11:21 PM, Adam Jackson <ajax at redhat.com> wrote:
> We probably don't want a fake crtc to be visible to clients, and we
> definitely don't want to generate events every time we create such a
> fake (which would happen as a side effect from RRCrtcCreate hitting
> RRTellChanged). As it happens we're not actually using that crtc for
> anything because xwayland doesn't store any state on the crtc object,
> so it suffices to use the real crtc for the screen.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
> hw/xwayland/xwayland-present.c | 21 ++++-----------------
> hw/xwayland/xwayland.h | 1 -
> 2 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
> index ae9f47ebae..b5ae80dcf0 100644
> --- a/hw/xwayland/xwayland-present.c
> +++ b/hw/xwayland/xwayland-present.c
> @@ -51,14 +51,10 @@ xwl_present_window_get_priv(WindowPtr window)
> struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
>
> if (xwl_present_window == NULL) {
> - ScreenPtr screen = window->drawable.pScreen;
> -
> xwl_present_window = calloc (1, sizeof (struct xwl_present_window));
> if (!xwl_present_window)
> return NULL;
>
> - xwl_present_window->crtc_fake = RRCrtcCreate(screen,
> - xwl_present_window);
> xwl_present_window->window = window;
> xwl_present_window->msc = 1;
> xwl_present_window->ust = GetTimeInMicros();
> @@ -131,8 +127,6 @@ xwl_present_cleanup(WindowPtr window)
> if (xwl_window && xwl_window->present_window == window)
> xwl_window->present_window = NULL;
>
> - RRCrtcDestroy(xwl_present_window->crtc_fake);
> -
> if (xwl_present_window->frame_callback) {
> wl_callback_destroy(xwl_present_window->frame_callback);
> xwl_present_window->frame_callback = NULL;
> @@ -306,10 +300,13 @@ static RRCrtcPtr
> xwl_present_get_crtc(WindowPtr present_window)
> {
> struct xwl_present_window *xwl_present_window = xwl_present_window_get_priv(present_window);
> + rrScrPrivPtr rr_private;
> +
> if (xwl_present_window == NULL)
> return NULL;
>
> - return xwl_present_window->crtc_fake;
> + rr_private = rrGetScrPriv(present_window->drawable.pScreen);
> + return rr_private->crtcs[0];
> }
>
> static int
> @@ -342,9 +339,6 @@ xwl_present_queue_vblank(WindowPtr present_window,
> if (!xwl_window)
> return BadMatch;
>
> - if (xwl_present_window->crtc_fake != crtc)
> - return BadRequest;
> -
> if (xwl_window->present_window &&
> xwl_window->present_window != present_window)
> return BadMatch;
> @@ -454,13 +448,6 @@ xwl_present_flip(WindowPtr present_window,
> if (!xwl_window)
> return FALSE;
>
> - /*
> - * Make sure the client doesn't try to flip to another crtc
> - * than the one created for 'xwl_window'.
> - */
> - if (xwl_present_window->crtc_fake != crtc)
> - return FALSE;
> -
> present_box = RegionExtents(&present_window->winSize);
> damage_box = RegionExtents(damage);
>
> diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
> index ce290d4909..25112e2cb8 100644
> --- a/hw/xwayland/xwayland.h
> +++ b/hw/xwayland/xwayland.h
> @@ -182,7 +182,6 @@ struct xwl_present_window {
> WindowPtr window;
> struct xorg_list link;
>
> - RRCrtcPtr crtc_fake;
> uint64_t msc;
> uint64_t ust;
>
> --
> 2.17.0
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list