[PATCH xserver 1/4] xwayland: Don't create a "fake" crtc for Present

Adam Jackson ajax at redhat.com
Mon May 7 21:21:17 UTC 2018


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



More information about the xorg-devel mailing list