User Tools

Site Tools


os:linux:ubuntu:nvidiastutter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
os:linux:ubuntu:nvidiastutter [2022/11/10 18:25] – [Applying the Changes] jayos:linux:ubuntu:nvidiastutter [2023/10/26 17:51] (current) jay
Line 1: Line 1:
 ====== Ubuntu 22.04 + Nvidia Window Movement Stutter ====== ====== Ubuntu 22.04 + Nvidia Window Movement Stutter ======
 +//Updated on 2023-10-26 to change to mutter 42.9//
 +
 There's a known issue within [[https://gitlab.gnome.org/GNOME/mutter|Mutter]] (Gnome library) where, if you fire up some sort GL app (could be ''glxgears'') and try and move windows, you will hit some pretty severe lag/stuttering.  There is a patch for this [[https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2652/diffs|here]], but it's a patch for the ''main'' branch, which means you won't be able to compile on Ubuntu 22.04 without running into later version dependency issues. There's a known issue within [[https://gitlab.gnome.org/GNOME/mutter|Mutter]] (Gnome library) where, if you fire up some sort GL app (could be ''glxgears'') and try and move windows, you will hit some pretty severe lag/stuttering.  There is a patch for this [[https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2652/diffs|here]], but it's a patch for the ''main'' branch, which means you won't be able to compile on Ubuntu 22.04 without running into later version dependency issues.
  
Line 20: Line 22:
 I already had a bunch of core build tools installed, so //hopefully// that's all that needs to be installed for your system. I already had a bunch of core build tools installed, so //hopefully// that's all that needs to be installed for your system.
  
-===== Mutter-42.=====+===== Mutter-42.=====
 This is the version of ''libmutter'' already installed on your 22.04 machine, so we're going to use that so we don't run into dependencies on later versions of items (I tried and failed to build off the tip of the ''main'' branch). This is the version of ''libmutter'' already installed on your 22.04 machine, so we're going to use that so we don't run into dependencies on later versions of items (I tried and failed to build off the tip of the ''main'' branch).
  
-You can download that here: [[https://gitlab.gnome.org/GNOME/mutter/-/archive/42.2/mutter-42.2.tar.gz]].+You can download that here: [[https://gitlab.gnome.org/GNOME/mutter/-/archive/42.9/mutter-42.9.tar.gz]].
  
 Once you get that downloaded, you need to move to a dir to unpack it. Once you get that downloaded, you need to move to a dir to unpack it.
  
 <code bash> <code bash>
-tar -xvzf mutter-42.2.tar.gz+tar -xvzf mutter-42.9.tar.gz
 </code> </code>
  
 ===== Patching ===== ===== Patching =====
-Next up, we need to apply the patch for 42.2, which is basically what I [[https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2652/diffs|linked to above]], but with some slight changes for the older version of mutter.+Next up, we need to apply the patch for 42.9, which is basically what I [[https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2652/diffs|linked to above]], but with some slight changes for the older version of mutter.
  
 The patch is this: The patch is this:
 <code> <code>
-diff -ru mutter-42.2-orig/src/core/display.c mutter-42.2/src/core/display.c +diff -ru mutter-42.9.orig/src/core/display.c mutter-42.9/src/core/display.c 
---- mutter-42.2-orig/src/core/display.c 2022-05-28 12:02:49.000000000 -0700 +--- mutter-42.9.orig/src/core/display.c 2023-03-19 15:24:00.000000000 -0700 
-+++ mutter-42.2/src/core/display.c 2022-10-27 15:07:55.447856552 -0700 ++++ mutter-42.9/src/core/display.c 2023-10-26 10:23:26.687211442 -0700 
-@@ -878,7 +878,6 @@+@@ -880,7 +880,6 @@
    
    display->current_time = META_CURRENT_TIME;    display->current_time = META_CURRENT_TIME;
Line 47: Line 49:
    
    display->grab_op = META_GRAB_OP_NONE;    display->grab_op = META_GRAB_OP_NONE;
-@@ -1850,6 +1849,21 @@ +@@ -1962,13 +1961,12 @@
-     } +
- } +
-  +
-+void +
-+meta_display_clear_grab_move_resize_later (MetaDisplay *display) +
-+{ +
-+  if (display->grab_move_resize_later_id) +
-+    { +
-+      MetaCompositor *compositor; +
-+      MetaLaters *laters; +
-+
-+      compositor = meta_display_get_compositor (display); +
-+      laters = meta_compositor_get_laters (compositor); +
-+      meta_laters_remove (laters, display->grab_move_resize_later_id); +
-+      display->grab_move_resize_later_id = 0; +
-+    } +
-+} +
-+
- gboolean +
- meta_display_begin_grab_op (MetaDisplay *display, +
-                             MetaWindow  *window, +
-@@ -1956,13 +1970,12 @@+
    display->grab_anchor_root_y = root_y;    display->grab_anchor_root_y = root_y;
    display->grab_latest_motion_x = root_x;    display->grab_latest_motion_x = root_x;
Line 84: Line 64:
    meta_topic (META_DEBUG_WINDOW_OPS,    meta_topic (META_DEBUG_WINDOW_OPS,
                "Grab op %u on window %s successful",                "Grab op %u on window %s successful",
-@@ -2048,13 +2061,12 @@+@@ -2054,13 +2052,12 @@
    display->grab_anchor_root_y = 0;    display->grab_anchor_root_y = 0;
    display->grab_latest_motion_x = 0;    display->grab_latest_motion_x = 0;
Line 99: Line 79:
    if (meta_is_wayland_compositor ())    if (meta_is_wayland_compositor ())
      meta_display_sync_wayland_input_focus (display);      meta_display_sync_wayland_input_focus (display);
-diff -ru mutter-42.2-orig/src/core/display-private.h mutter-42.2/src/core/display-private.h +@@ -2758,6 +2755,21 @@ 
---- mutter-42.2-orig/src/core/display-private.h 2022-05-28 12:02:49.000000000 -0700 +   return copy; 
-+++ mutter-42.2/src/core/display-private.h 2022-10-27 14:59:10.345569206 -0700 + } 
-@@ -187,12 +187,10 @@ +  
-   MetaRectangle grab_initial_window_pos; ++void 
-   int         grab_initial_x, grab_initial_y;  /* These are only relevant for */ ++meta_display_clear_grab_move_resize_later (MetaDisplay *display) 
-   gboolean    grab_threshold_movement_reached; /* raise_on_click == FALSE.    */ ++{ 
--  int64_t     grab_last_moveresize_time;++  if (display->grab_move_resize_later_id) 
 ++    { 
 ++      MetaCompositor *compositor; 
 ++      MetaLaters *laters; 
 +
 ++      compositor = meta_display_get_compositor (display); 
 ++      laters = meta_compositor_get_laters (compositor); 
 ++      meta_laters_remove (laters, display->grab_move_resize_later_id); 
 ++      display->grab_move_resize_later_id = 0; 
 ++    } 
 ++} 
 +
 + static void 
 + prefs_changed_callback (MetaPreference pref, 
 +                         void          *data) 
 +diff -ru mutter-42.9.orig/src/core/display-private.h mutter-42.9/src/core/display-private.h 
 +--- mutter-42.9.orig/src/core/display-private.h 2023-03-19 15:24:00.000000000 -0700 
 ++++ mutter-42.9/src/core/display-private.h 2023-10-26 10:24:54.101094492 -0700 
 +@@ -191,+191,@@
    MetaEdgeResistanceData *grab_edge_resistance_data;    MetaEdgeResistanceData *grab_edge_resistance_data;
    unsigned int grab_last_edge_resistance_flags;    unsigned int grab_last_edge_resistance_flags;
Line 116: Line 114:
    
    /* Opening the display */    /* Opening the display */
-@@ -346,6 +344,7 @@+@@ -346,6 +345,7 @@
  gboolean meta_grab_op_is_mouse    (MetaGrabOp op);  gboolean meta_grab_op_is_mouse    (MetaGrabOp op);
  gboolean meta_grab_op_is_keyboard (MetaGrabOp op);  gboolean meta_grab_op_is_keyboard (MetaGrabOp op);
Line 124: Line 122:
                                               MetaWindow  *window);                                               MetaWindow  *window);
  void meta_display_remove_autoraise_callback (MetaDisplay *display);  void meta_display_remove_autoraise_callback (MetaDisplay *display);
-diff -ru mutter-42.2-orig/src/core/window.c mutter-42.2/src/core/window.c +diff -ru mutter-42.9.orig/src/core/window.c mutter-42.9/src/core/window.c 
---- mutter-42.2-orig/src/core/window.c 2022-05-28 12:02:49.000000000 -0700 +--- mutter-42.9.orig/src/core/window.c 2023-03-19 15:24:00.000000000 -0700 
-+++ mutter-42.2/src/core/window.c 2022-10-27 15:03:23.537529806 -0700++++ mutter-42.9/src/core/window.c 2023-10-26 10:38:40.578927863 -0700
 @@ -132,15 +132,6 @@ @@ -132,15 +132,6 @@
  static void meta_window_unqueue (MetaWindow    *window,  static void meta_window_unqueue (MetaWindow    *window,
Line 143: Line 141:
    
  static void meta_window_flush_calc_showing   (MetaWindow *window);  static void meta_window_flush_calc_showing   (MetaWindow *window);
-@@ -5714,44 +5705,6 @@+@@ -5761,44 +5752,6 @@
    return is_onscreen;    return is_onscreen;
  }  }
Line 188: Line 186:
  update_move_maybe_tile (MetaWindow *window,  update_move_maybe_tile (MetaWindow *window,
                          int         shake_threshold,                          int         shake_threshold,
-@@ -5822,+5775,8 @@ +@@ -6039,34 +5992,59 @@
-   display->grab_latest_motion_x = x; +
-   display->grab_latest_motion_y = y; +
-  +
-+  meta_display_clear_grab_move_resize_later (display); +
-+
-   dx = x - display->grab_anchor_root_x; +
-   dy = y - display->grab_anchor_root_y; +
-  +
-@@ -5992,34 +5947,60 @@+
  }  }
    
  static gboolean  static gboolean
 -update_resize_timeout (gpointer data) -update_resize_timeout (gpointer data)
-+update_move_cb (gpointer user_data)++update_move_cb (gpointer data)
  {  {
 -  MetaWindow *window = data; -  MetaWindow *window = data;
 +  MetaWindow *window = user_data; +  MetaWindow *window = user_data;
 ++  window->display->grab_move_resize_later_id = 0;
    
 -  update_resize (window, -  update_resize (window,
Line 213: Line 203:
 -                 TRUE); -                 TRUE);
 -  return FALSE; -  return FALSE;
-+  window->display->grab_move_resize_later_id = 0; 
-+ 
 +  update_move (window, +  update_move (window,
 +               window->display->grab_last_edge_resistance_flags, +               window->display->grab_last_edge_resistance_flags,
Line 269: Line 257:
    dy = y - window->display->grab_anchor_root_y;    dy = y - window->display->grab_anchor_root_y;
    
-@@ -6081,27 +6062,6 @@+@@ -6128,27 +6106,6 @@
    if (window->sync_request_timeout_id != 0)    if (window->sync_request_timeout_id != 0)
      return;      return;
Line 297: Line 285:
    
    /* One sided resizing ought to actually be one-sided, despite the fact that    /* One sided resizing ought to actually be one-sided, despite the fact that
-@@ -6129,11 +6089,44 @@+@@ -6176,11 +6133,45 @@
    meta_window_resize_frame_with_gravity (window, TRUE,    meta_window_resize_frame_with_gravity (window, TRUE,
                                           new_rect.width, new_rect.height,                                           new_rect.width, new_rect.height,
                                           gravity);                                           gravity);
 +} +}
 ++
 +static gboolean +static gboolean
 +update_resize_cb (gpointer user_data) +update_resize_cb (gpointer user_data)
Line 346: Line 335:
    
  static void  static void
-@@ -6157,10 +6150,9 @@+@@ -6204,10 +6195,9 @@
  void  void
  meta_window_update_resize (MetaWindow *window,  meta_window_update_resize (MetaWindow *window,
Line 359: Line 348:
    
  static void  static void
-@@ -6204,7 +6196,7 @@+@@ -6251,7 +6241,7 @@
            if (window->tile_match != NULL)            if (window->tile_match != NULL)
              flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS);              flags |= (META_EDGE_RESISTANCE_SNAP | META_EDGE_RESISTANCE_WINDOWS);
Line 368: Line 357:
          }          }
      }      }
-@@ -6281,14 +6273,14 @@+@@ -6328,14 +6318,14 @@
        meta_display_check_threshold_reached (window->display, x, y);        meta_display_check_threshold_reached (window->display, x, y);
        if (meta_grab_op_is_moving (window->display->grab_op))        if (meta_grab_op_is_moving (window->display->grab_op))
Line 385: Line 374:
        return TRUE;        return TRUE;
    
-diff -ru mutter-42.2-orig/src/core/window-private.h mutter-42.2/src/core/window-private.h +diff -ru mutter-42.9.orig/src/core/window-private.h mutter-42.9/src/core/window-private.h 
---- mutter-42.2-orig/src/core/window-private.h 2022-05-28 12:02:49.000000000 -0700 +--- mutter-42.9.orig/src/core/window-private.h 2023-03-19 15:24:00.000000000 -0700 
-+++ mutter-42.2/src/core/window-private.h 2022-10-27 14:45:55.225559488 -0700 ++++ mutter-42.9/src/core/window-private.h 2023-10-26 10:39:43.863644170 -0700 
-@@ -864,8 +864,@@+@@ -869,8 +869,@@
    
  void meta_window_update_resize (MetaWindow *window,  void meta_window_update_resize (MetaWindow *window,
Line 394: Line 383:
 -                                int x, int y, -                                int x, int y,
 -                                gboolean force); -                                gboolean force);
-+                                int x, ++                                int x, int y);
-+                                int y);+
    
  void meta_window_move_resize_internal (MetaWindow          *window,  void meta_window_move_resize_internal (MetaWindow          *window,
                                         MetaMoveResizeFlags  flags,                                         MetaMoveResizeFlags  flags,
-diff -ru mutter-42.2-orig/src/x11/window-x11.c mutter-42.2/src/x11/window-x11.c +diff -ru mutter-42.9.orig/src/x11/window-x11.c mutter-42.9/src/x11/window-x11.c 
---- mutter-42.2-orig/src/x11/window-x11.c 2022-05-28 12:02:49.000000000 -0700 +--- mutter-42.9.orig/src/x11/window-x11.c 2023-03-19 15:24:00.000000000 -0700 
-+++ mutter-42.2/src/x11/window-x11.c 2022-10-27 14:54:06.765147582 -0700++++ mutter-42.9/src/x11/window-x11.c 2023-10-26 10:40:36.721192953 -0700
 @@ -1231,8 +1231,7 @@ @@ -1231,8 +1231,7 @@
        meta_window_update_resize (window,        meta_window_update_resize (window,
Line 412: Line 400:
    
    return FALSE;    return FALSE;
-@@ -4152,8 +4151,7 @@+@@ -4153,8 +4152,7 @@
            meta_window_update_resize (window,            meta_window_update_resize (window,
                                       window->display->grab_last_edge_resistance_flags,                                       window->display->grab_last_edge_resistance_flags,
Line 421: Line 409:
          }          }
      }      }
 + 
 </code> </code>
  
Line 428: Line 417:
  
 <code bash> <code bash>
-cd /path/to/mutter-42. # wherever you unzipped the source code you got from gitlab+cd /path/to/mutter-42. # wherever you unzipped the source code you got from gitlab
 patch -p1 < /path/to/mutter.patch patch -p1 < /path/to/mutter.patch
 </code> </code>
Line 447: Line 436:
  
 <code bash> <code bash>
-cd /path/to/mutter-42. # Again, wherever you unzipped the source+cd /path/to/mutter-42. # Again, wherever you unzipped the source
 meson build/ meson build/
 </code> </code>
Line 453: Line 442:
 If everything goes well there, we're ready to actually do our compilation and installation. By default, the install prefix is ''/usr/local'', which is likely what you'll want to keep, but if not you can append ''--prefix='' to your ''meson build/'' command above. e.g. ''meson build --prefix=/usr'' It's worth noting that ''gnome-shell'' (which uses mutter as a library) will try to use ''/usr/local/lib'' **first**, so the default is preferred so you don't nuke your core system libs. If everything goes well there, we're ready to actually do our compilation and installation. By default, the install prefix is ''/usr/local'', which is likely what you'll want to keep, but if not you can append ''--prefix='' to your ''meson build/'' command above. e.g. ''meson build --prefix=/usr'' It's worth noting that ''gnome-shell'' (which uses mutter as a library) will try to use ''/usr/local/lib'' **first**, so the default is preferred so you don't nuke your core system libs.
  
-All right, let's compile and install!+All right, let's compile and install!  Note that you will get a prompt for your password here to install to ''/usr/local''.
  
 <code bash> <code bash>
-cd /path/to/mutter-42.2+cd /path/to/mutter-42.9
 ninja -C build/ install ninja -C build/ install
 </code> </code>
os/linux/ubuntu/nvidiastutter.txt · Last modified: 2023/10/26 17:51 by jay