xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 29 08:15:02 UTC 2021


 man/Xserver.man        |    3 +++
 os/utils.c             |   12 ++++++++++++
 present/present.h      |    2 ++
 present/present_fake.c |   28 ++++++++++++++++++----------
 4 files changed, 35 insertions(+), 10 deletions(-)

New commits:
commit 16571b8926a5a7ba5a1885b36a16857addbe8f41
Author: Boris-Barboris <ismailsiege at gmail.com>
Date:   Tue Jun 22 00:51:08 2021 +0300

    Don't hardcode fps for fake screen
    
    Currently, when main hardware screen is powered-off,
    X server initializes fake screen's timer with
    1 second update interval.
    
    Streaming software like Nomachine or Vnc, as well as
    desktop input automation suffers from it, since it
    will forever be stuck on 1 fps until the display is
    turned back on.
    
    This commit adds command line option -fakescreenfps <int>
    that allows the user to change the default fake screen
    timer.
    
    Signed-off-by: Baranin Alexander <ismailsiege at gmail.com>

diff --git a/man/Xserver.man b/man/Xserver.man
index 2b7442d7e..31c3bd334 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -164,6 +164,9 @@ a list of accepted extension names is printed.
 .B \-f \fIvolume\fP
 sets beep (bell) volume (allowable range: 0-100).
 .TP 8
+.B \-fakescreenfps \fFps\fP
+sets fake presenter screen default fps (allowable range: 1-600).
+.TP 8
 .B \-fp \fIfontPath\fP
 sets the search path for fonts.  This path is a comma separated list
 of directories which the X server searches for font databases.
diff --git a/os/utils.c b/os/utils.c
index 231554954..92a66e81a 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -112,6 +112,8 @@ __stdcall unsigned long GetTickCount(void);
 
 #include "miinitext.h"
 
+#include "present.h"
+
 Bool noTestExtensions;
 
 #ifdef COMPOSITE
@@ -534,6 +536,7 @@ UseMsg(void)
     ErrorF
         ("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n");
     ErrorF("-f #                   bell base (0-100)\n");
+    ErrorF("-fakescreenfps #       fake screen default fps (1-600)\n");
     ErrorF("-fp string             default font path\n");
     ErrorF("-help                  prints message with these options\n");
     ErrorF("+iglx                  Allow creating indirect GLX contexts\n");
@@ -781,6 +784,15 @@ ProcessCommandLine(int argc, char *argv[])
             else
                 UseMsg();
         }
+        else if (strcmp(argv[i], "-fakescreenfps") == 0) {
+            if (++i < argc) {
+                FakeScreenFps = (uint32_t) atoi(argv[i]);
+                if (FakeScreenFps < 1 || FakeScreenFps > 600)
+                    FatalError("fakescreenfps must be an integer in [1;600] range\n");
+            }
+            else
+                UseMsg();
+        }
         else if (strcmp(argv[i], "-fp") == 0) {
             if (++i < argc) {
                 defaultFontPath = argv[i];
diff --git a/present/present.h b/present/present.h
index 389069195..d41b36033 100644
--- a/present/present.h
+++ b/present/present.h
@@ -162,4 +162,6 @@ present_register_complete_notify(present_complete_notify_proc proc);
 extern _X_EXPORT Bool
 present_can_window_flip(WindowPtr window);
 
+extern _X_EXPORT uint32_t FakeScreenFps;
+
 #endif /* _PRESENT_H_ */
diff --git a/present/present_fake.c b/present/present_fake.c
index 75e2508ba..f4a3bd887 100644
--- a/present/present_fake.c
+++ b/present/present_fake.c
@@ -113,21 +113,29 @@ present_fake_queue_vblank(ScreenPtr     screen,
     return Success;
 }
 
+uint32_t FakeScreenFps = 0;
+
 void
 present_fake_screen_init(ScreenPtr screen)
 {
+    uint32_t                fake_fps;
     present_screen_priv_ptr screen_priv = present_screen_priv(screen);
 
-    /* For screens with hardware vblank support, the fake code
-     * will be used for off-screen windows and while screens are blanked,
-     * in which case we want a slow interval here
-     *
-     * Otherwise, pretend that the screen runs at 60Hz
-     */
-    if (screen_priv->info && screen_priv->info->get_crtc)
-        screen_priv->fake_interval = 1000000;
-    else
-        screen_priv->fake_interval = 16667;
+    if (FakeScreenFps)
+        fake_fps = FakeScreenFps;
+    else {
+        /* For screens with hardware vblank support, the fake code
+        * will be used for off-screen windows and while screens are blanked,
+        * in which case we want a large interval here: 1Hz
+        *
+        * Otherwise, pretend that the screen runs at 60Hz
+        */
+        if (screen_priv->info && screen_priv->info->get_crtc)
+            fake_fps = 1;
+        else
+            fake_fps = 60;
+    }
+    screen_priv->fake_interval = 1000000 / fake_fps;
 }
 
 void


More information about the xorg-commit mailing list