[PATCH xserver] xwayland: Add Xfree86-VidModeExtension to Xwayland

Olivier Fourdan ofourdan at redhat.com
Wed Oct 14 09:24:06 PDT 2015


Hi

----- Original Message -----
> More worryingly, I tried xvidtune with that patch applied and that
> led to a crash in Xwayland - I'll investigate further to see if this
> is something in my tree or with the patch as I suspect.

Quick follow up, the crash occurs in VidModeGetMonitor() from xf86VidMode.c because the output is NULL:

Program received signal SIGSEGV, Segmentation fault.
VidModeGetMonitor (scrnIndex=<optimized out>, monitor=monitor at entry=0x7fff4b38a828) at xf86VidMode.c:178
178         mon->heightmm = output->mmHeight;
(gdb) bt
#0  VidModeGetMonitor (scrnIndex=<optimized out>, monitor=monitor at entry=0x7fff4b38a828) at xf86VidMode.c:178
#1  0x0000000000427077 in ProcXF86VidModeGetMonitor (client=0x2cfce10) at xf86vmode.c:1080
#2  0x000000000043b717 in Dispatch () at dispatch.c:430
#3  0x000000000043f603 in dix_main (argc=10, argv=0x7fff4b38aa38, envp=<optimized out>) at main.c:300
#4  0x00007fe17c66f580 in __libc_start_main () from /lib64/libc.so.6
#5  0x0000000000422ad9 in _start ()
(gdb) p *mon
$1 = {id = 0x2cdef10 "Wayland", vendor = 0x2cf3e40 "X.org", model = 0x2d218e0 "Xwayland", nHsync = 1, hsync = {{hi = 0,  
      lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0,
      lo = 0}, {hi = 0, lo = 0}}, nVrefresh = 1, vrefresh = {{hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {
      hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}, {hi = 0, lo = 0}}, Modes = 0x0, Last = 0x0,
  gamma = {red = 0, green = 0, blue = 0}, widthmm = 0, heightmm = 0, options = 0x0, DDC = 0x0, reducedblanking = 0, 
  maxPixClock = 0}
(gdb) p output
$2 = (RROutputPtr) 0x0

The fix is pretty obvious, and xvidtune will work with this:

 Bool
 VidModeGetCurrentModeline(int scrnIndex, void **mode, int *dotClock)
 {
@@ -188,8 +175,11 @@ VidModeGetMonitor(int scrnIndex, void **monitor)
     mon->nVrefresh = 1;
     mon->Modes = NULL;
     mon->Last = NULL;
-    mon->heightmm = output->mmHeight;
-    mon->widthmm = output->mmWidth;
+    if (output)
+    {
+      mon->heightmm = output->mmHeight;
+      mon->widthmm = output->mmWidth;
+    }
     *monitor = mon;
 
     return TRUE;

(not saying this is the right solution, but that suffice to avoid the crash)

Yet, all reported values reported for HSynv/VSync/pixel clock/etc. are wrong:

Vendor: X.org, Model: Xwayland
Num hsync: 1, Num vsync: 1
hsync range 0:   0.00 -   0.00
vsync range 0:   0.00 -   0.00

So this implementation is really just to please apps that check for the existence of the extension, no more - Any app that would actually try to do something with it would be most likely disappointed :-)

I wonder, can't we reuse more of the xrandr data to get some of these values correct (even if it's just for querying ant not changing/setting values)?

xrandr --verbose gives sensible data on this exact same hardware:

Screen 0: minimum 320 x 200, current 3840 x 1200, maximum 8192 x 8192
XWAYLAND0 connected 1920x1200+1920+0 (0x24) normal (normal) 520mm x 320mm
        Identifier: 0x21
        Timestamp:  23275741
        Subpixel:   unknown
        Gamma:      1.0:1.0:1.0
        Brightness: 0.0
        Clones:    
        CRTC:       0
        CRTCs:      0
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
  1920x1200 at 0.1Hz (0x24)  0.000MHz -HSync +VSync *current +preferred
        h: width  1920 start 1976 end 2160 total 2400 skew    0 clock   0.00KHz
        v: height 1200 start 1203 end 1209 total 1212           clock   0.00Hz
XWAYLAND1 connected 1920x1080+0+0 (0x25) normal (normal) 310mm x 170mm
        Identifier: 0x23
        Timestamp:  23275741
        Subpixel:   unknown
        Gamma:      1.0:1.0:1.0
        Brightness: 0.0
        Clones:    
        CRTC:       1
        CRTCs:      1
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
  1920x1080 at 0.1Hz (0x25)  0.000MHz -HSync +VSync *current +preferred
        h: width  1920 start 1976 end 2160 total 2400 skew    0 clock   0.00KHz
        v: height 1080 start 1083 end 1088 total 1091           clock   0.00Hz

So there should be a way to report some of these via Xfree86-VidModeExtension.

Cheers,
Olivier


More information about the xorg-devel mailing list