xserver: Branch 'master' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 1 13:58:38 UTC 2020


 hw/xwayland/xwayland-output.c |   31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit 727df0a74e75982f4352f0a3e574fcf6db3372f7
Author: Roman Gilg <subdiff at gmail.com>
Date:   Mon Aug 10 19:14:28 2020 +0200

    xwayland: Replace need_rotate boolean with simple check on xdg-output
    
    The need_rotate variable is only used once anymore and had semantics which lead
    to errors in the past. In particular when negated we are dealing with a double
    negation.
    
    The variable gets replaced with a simple check on the xdg-output directly.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 05e6ddcfc..d4634467d 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -503,17 +503,16 @@ apply_output_change(struct xwl_output *xwl_output)
     int mode_width, mode_height, count;
     int width = 0, height = 0, has_this_output = 0;
     RRModePtr *randr_modes;
-    Bool need_rotate;
 
     /* Clear out the "done" received flags */
     xwl_output->wl_output_done = FALSE;
     xwl_output->xdg_output_done = FALSE;
 
-    /* xdg-output sends output size in compositor space. so already rotated */
-    need_rotate = (xwl_output->xdg_output == NULL);
-
-    /* We need to rotate back the logical size for the mode */
-    if (need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
+    /* When we have received an xdg-output for the mode size we might need to
+     * rotate back the stored logical size it provided.
+     */
+    if (xwl_output->xdg_output == NULL
+        || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
         mode_width = xwl_output->width;
         mode_height = xwl_output->height;
     } else {
commit da791ed9fdc715dcbe73c60a4c4ab2d385ab28e4
Author: Roman Gilg <subdiff at gmail.com>
Date:   Thu Aug 13 16:55:03 2020 +0200

    Revert "xserver: Fix a typo"
    
    This reverts commit 427f8bc00981703abe3153b6da575faa69fe2748.
    
    When receiving an output update for the mode size we need to rotate the stored
    width and height values if and only if we have an xdg-output for this output
    since in this case the stored values describe the output's size in logical
    space, i.e. rotated.
    
    The here reverted commit made a code change with which we would not rotate though
    when an xdg-output was available since in this case the need_rotate variable was
    set to False what caused in the check afterwards the first branch to execute.

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 6df835de6..05e6ddcfc 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -513,7 +513,7 @@ apply_output_change(struct xwl_output *xwl_output)
     need_rotate = (xwl_output->xdg_output == NULL);
 
     /* We need to rotate back the logical size for the mode */
-    if (!need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
+    if (need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
         mode_width = xwl_output->width;
         mode_height = xwl_output->height;
     } else {
commit 92f4a9ade3c97bda833b0e10f10856b2542f793c
Author: Roman Gilg <subdiff at gmail.com>
Date:   Mon Aug 10 19:01:52 2020 +0200

    xwayland: Switch width and height argument order
    
    That is just a small style-change to the output_get_new_size function. The
    function before did take first the height and then the width argument, what
    is unusual since resolutions are normally named the other way around, for
    example 1920x1080. Also compare the update_screen_size function.
    
    Therefore change the order of arguments for output_get_new_size.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index eb2b7235c..6df835de6 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -131,7 +131,7 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
  * function sets the provided values to these maxima on return.
  */
 static inline void
-output_get_new_size(struct xwl_output *xwl_output, int *height, int *width)
+output_get_new_size(struct xwl_output *xwl_output, int *width, int *height)
 {
     int output_width, output_height;
 
@@ -540,14 +540,14 @@ apply_output_change(struct xwl_output *xwl_output)
         if (it == xwl_output)
             has_this_output = 1;
 
-        output_get_new_size(it, &height, &width);
+        output_get_new_size(it, &width, &height);
     }
 
     if (!has_this_output) {
         xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
 
         /* we did not check this output for new screen size, do it now */
-        output_get_new_size(xwl_output, &height, &width);
+        output_get_new_size(xwl_output, &width, &height);
 
 	--xwl_screen->expecting_event;
     }
@@ -713,7 +713,7 @@ xwl_output_remove(struct xwl_output *xwl_output)
     xorg_list_del(&xwl_output->link);
 
     xorg_list_for_each_entry(it, &xwl_screen->output_list, link)
-        output_get_new_size(it, &height, &width);
+        output_get_new_size(it, &width, &height);
     update_screen_size(xwl_output, width, height);
 
     RRCrtcDestroy(xwl_output->randr_crtc);
commit 1805383d9eb17ef8ac159366c684ac85b3d53731
Author: Roman Gilg <subdiff at gmail.com>
Date:   Mon Aug 10 18:58:56 2020 +0200

    xwayland: simplify output_get_new_size function
    
    We can just read out the xdg_output field of the provided xwl_output to check
    if a rotation is necessary or not.
    
    This makes the function easier to understand. Additionally some documentation
    is added.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index f94aa0d35..eb2b7235c 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -125,14 +125,19 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
     xwl_output->refresh = refresh;
 }
 
+/**
+ * Decides on the maximum expanse of an output in logical space (i.e. in the
+ * Wayland compositor plane) respective to some fix width and height values. The
+ * function sets the provided values to these maxima on return.
+ */
 static inline void
-output_get_new_size(struct xwl_output *xwl_output,
-                    Bool need_rotate,
-                    int *height, int *width)
+output_get_new_size(struct xwl_output *xwl_output, int *height, int *width)
 {
     int output_width, output_height;
 
-    if (!need_rotate || (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
+    /* When we have xdg-output support the stored size is already rotated. */
+    if (xwl_output->xdg_output
+            || (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180))) {
         output_width = xwl_output->width;
         output_height = xwl_output->height;
     } else {
@@ -535,14 +540,14 @@ apply_output_change(struct xwl_output *xwl_output)
         if (it == xwl_output)
             has_this_output = 1;
 
-        output_get_new_size(it, need_rotate, &height, &width);
+        output_get_new_size(it, &height, &width);
     }
 
     if (!has_this_output) {
         xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
 
         /* we did not check this output for new screen size, do it now */
-        output_get_new_size(xwl_output, need_rotate, &height, &width);
+        output_get_new_size(xwl_output, &height, &width);
 
 	--xwl_screen->expecting_event;
     }
@@ -704,12 +709,11 @@ xwl_output_remove(struct xwl_output *xwl_output)
     struct xwl_output *it;
     struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
     int width = 0, height = 0;
-    Bool need_rotate = (xwl_output->xdg_output == NULL);
 
     xorg_list_del(&xwl_output->link);
 
     xorg_list_for_each_entry(it, &xwl_screen->output_list, link)
-        output_get_new_size(it, need_rotate, &height, &width);
+        output_get_new_size(it, &height, &width);
     update_screen_size(xwl_output, width, height);
 
     RRCrtcDestroy(xwl_output->randr_crtc);


More information about the xorg-commit mailing list