Automatic refreshrate changing does not work when playing videos
#1
Automatic refreshrate changing does not work when playing videos.

I noticed these in xbmc console output
cannot find mode 0x10d

With ubuntu binary xrandr mode changing using ID works fine.
I tried to compile xrandr from ubuntu sources, then xrandr has the same problem. See the copy pastes below.

For a workaround, I changed xbmc to use ubuntu binary for mode changes, and xbmc-xrandr for fetching the modes.

Distribution: Ubuntu 8.10 x86_64 2.6.27-9-generic
XBMC: revision 17558

Code:
root@bogey:/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr# xrandr --output default --mode 0x10d


root@bogey:/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for a BSD-compatible install... /usr/bin/install -c
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for XRANDR... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands


root@bogey:/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr# make
make  all-am
make[1]: Entering directory `/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr'
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT xrandr.o -MD -MP -MF .deps/xrandr.Tpo -c -o xrandr.o xrandr.c
xrandr.c: In function ‘set_name’:
xrandr.c:434: warning: format ‘%x’ expects type ‘unsigned int *’, but argument 3 has type ‘XID *’
xrandr.c: In function ‘main’:
xrandr.c:2274: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘RRMode’
xrandr.c:2310: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xrandr.c:2310: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long unsigned int’
xrandr.c:2316: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘XID’
xrandr.c:2317: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘Time’
xrandr.c:2382: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’
xrandr.c:2382: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’
xrandr.c:2426: warning: format ‘%x’ expects type ‘unsigned int’, but argument 3 has type ‘RRMode’
xrandr.c:2487: warning: format ‘%x’ expects type ‘unsigned int’, but argument 3 has type ‘RRMode’
mv -f .deps/xrandr.Tpo .deps/xrandr.Po
gcc  -g -O2   -o xrandr xrandr.o -lXrandr -lXrender -lX11
sed -e 's|__vendorversion__|"xrandr 1.2.3" "X Version 11"|' -e 's|__xorgversion__|"xrandr 1.2.3" "X Version 11"|' -e 's|__xservername__|Xorg|g' -e 's|__xconfigfile__|xorg.conf|g' -e 's|__projectroot__|/usr/local|g' -e 's|__apploaddir__||' -e 's|__appmansuffix__|1|g' -e 's|__libmansuffix__|3|g' -e 's|__adminmansuffix__|8|g' -e 's|__miscmansuffix__|7|g' -e 's|__filemansuffix__|5|g' < xrandr.man > xrandr.1
make[1]: Leaving directory `/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr'


root@bogey:/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr# ./xrandr --output default --mode 0x10d
./xrandr: cannot find mode 0x10d


root@bogey:/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr# ldd xrandr
        linux-vdso.so.1 =>  (0x00007fffb09fe000)
        libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007ffea849f000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007ffea8295000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00007ffea7f8d000)
        libc.so.6 => /lib/libc.so.6 (0x00007ffea7c1b000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00007ffea7a09000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0x00007ffea7807000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007ffea75eb000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007ffea73e7000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffea86a7000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00007ffea71e5000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007ffea6fe0000)


root@bogey:/home/jukka/linuxport/XBMC/x11-xserver-utils-7.3+5/xrandr# ldd /usr/bin/xrandr
        linux-vdso.so.1 =>  (0x00007fff9b5ff000)
        libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007f1a93187000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f1a92f7d000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f1a92c75000)
        libc.so.6 => /lib/libc.so.6 (0x00007f1a92903000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f1a926f1000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0x00007f1a924ef000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f1a922d3000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f1a920cf000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1a9338f000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f1a91ecd000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f1a91cc8000)

root@bogey:/home/jukka/linuxport/XBMC# ./xbmc-xrandr
<screen id="0" minimum_w="640" minimum_h="480" current_w="1680" current_h="1050" maximum_w="1920" maximum_h="1080">
  <output name="default" connected="true" w="1680" h="1050" x="0" y="0" wmm="0" hmm="0">
    <mode id="0x10d" name="1680x1050" w="1680" h="1050" hz="50.00000" current="true" preferred="false"/>
    <mode id="0x10e" name="1680x1050" w="1680" h="1050" hz="48.00000" current="false" preferred="false"/>
    <mode id="0x10f" name="1680x1050" w="1680" h="1050" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x110" name="1280x1024" w="1280" h="1024" hz="75.00000" current="false" preferred="false"/>
    <mode id="0x111" name="1280x1024" w="1280" h="1024" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x112" name="1280x960" w="1280" h="960" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x113" name="1152x864" w="1152" h="864" hz="75.00000" current="false" preferred="false"/>
    <mode id="0x114" name="1024x768" w="1024" h="768" hz="75.00000" current="false" preferred="false"/>
    <mode id="0x115" name="1024x768" w="1024" h="768" hz="70.00000" current="false" preferred="false"/>
    <mode id="0x116" name="1024x768" w="1024" h="768" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x117" name="800x600" w="800" h="600" hz="75.00000" current="false" preferred="false"/>
    <mode id="0x118" name="800x600" w="800" h="600" hz="72.00000" current="false" preferred="false"/>
    <mode id="0x119" name="800x600" w="800" h="600" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x11a" name="800x600" w="800" h="600" hz="56.00000" current="false" preferred="false"/>
    <mode id="0x11b" name="640x480" w="640" h="480" hz="75.00000" current="false" preferred="false"/>
    <mode id="0x11c" name="640x480" w="640" h="480" hz="73.00000" current="false" preferred="false"/>
    <mode id="0x11d" name="640x480" w="640" h="480" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x11e" name="480i/60" w="640" h="480" hz="30.00000" current="false" preferred="false"/>
    <mode id="0x11f" name="480p/60" w="640" h="480" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x120" name="720p/60" w="1280" h="720" hz="60.00000" current="false" preferred="false"/>
    <mode id="0x121" name="1080i/60" w="1920" h="1080" hz="30.00000" current="false" preferred="false"/>
    <mode id="0x122" name="1080p/60" w="1920" h="1080" hz="60.00000" current="false" preferred="false"/>
  </output>
</screen>
Reply
#2
Track: http://trac.xbmc.org/ticket/5921

Here is patch for 64-bit, taken from ubuntu x11-xserver-utils-7.3+5 sources.
Don't know if works with 32-bit too, if does, maybe it should be merged in xbmc svn.


Patch 04_xrandr-Fix-for-64bit-feed-a-pointer-to-the-right-size-vari.patch

From: Egbert Eich <[email protected]>
Date: Sun, 3 Aug 2008 13:24:49 +0200
Subject: [PATCH] Fix for 64bit: feed a pointer to the right size variable to scanf().

XID is unsigned long, however %x in scanf takes a pointer to an unsigned int.
Thus with XID xid, a sscanf(..., "0x%x", &xid) will most likely produce the
wrong results.



Code:
--- xbmc-xrandr.c.orig  2009-02-16 00:48:28.000000000 +0200
+++ xbmc-xrandr.c       2009-02-16 00:46:10.000000000 +0200
@@ -437,7 +437,8 @@ set_name_all (name_t *name, name_t *old)
static void
set_name (name_t *name, char *string, name_kind_t valid)
{
-    XID        xid;
+    unsigned int xid; /* don't make it XID (which is unsigned long):
+                        scanf() takes unsigned int */
     int index;

     if ((valid & name_xid) && sscanf (string, "0x%x", &xid) == 1)
Reply
#3
Better to fix the scanf, not the type passed to it.
Fixed in http://trac.xbmc.org/changeset/17776
Code:
Index: xbmc-xrandr.c
===================================================================
--- xbmc-xrandr.c       (revision 17774)
+++ xbmc-xrandr.c       (working copy)
-440,7 +440,7 @@
     XID        xid;
     int index;

-    if ((valid & name_xid) && sscanf (string, "0x%x", &xid) == 1)
+    if ((valid & name_xid) && sscanf (string, "0x%lx", &xid) == 1)
        set_name_xid (name, xid);
     else if ((valid & name_index) && sscanf (string, "%d", &index) == 1)
        set_name_index (name, index);
Reply
#4
hi,
is there a way to create rules for automatic resolution and refresh rate ?

because what I would like is that if the video is in 720x576i then the display would switch to that to take advantage of the TV deinterlacing wich appears to be better than what the computer does.

also my screen can do 24p only on 1920x1080, so if the screen is not in this 1920x1080, we want to swich to 1920x1080 to acces to 24p.

Since every screen have different specificity or the users specific needs, this would be nice to have it customisable.
Reply

Logout Mark Read Team Forum Stats Members Help
Automatic refreshrate changing does not work when playing videos0