Help fixing csync output with video-ati
arvidb at kth.se
Fri Mar 19 13:28:00 PDT 2010
Fernando Carrijo wrote, On 2010-03-18 01:49:
> Hi Arvid!
> Arvid Brodin <arvidb at kth.se> wrote:
>> Hello list-dwellers!
>> I have a PAL TV hooked up via RGB to my graphics card. It needs
>> composite sync:
>> $ ./xrandr --newmode "960x576 at 50i" 18.479 960 991 1078 1183 576 592 601
>> 625 interlace -csync
>> [+|-]csync is supported by the xrandr application, but not shown in
>> 'xrandr --help' - also, all csync options just give +hsync +vsync
>> (checked with oscilloscope) - so my guess is part of the implementation
>> is missing.
>> I long for watching movies from my couch again, and so I would like to
>> fix this. :) I'm not asking for a bug fix/new feature, but rather I'm
>> looking at this as an opportunity to learn something of the inner
>> workings of X.
>> XRRCreateMode() is called to create the new mode, but I cannot step into
>> this function with gdb [...]
> I'm not sure how did you set up your development environment, but being
> not able to use GDB to step into a function call most of the time means
> that it was not compiled with what is called a 'debugging symbols flag'.
> GCC, for example, has the -g flag which is supposed to be used for this
> sole purpose. Here is something you may find entertaining:
> If you haven't compiled this library yourself, maybe you would like to
> know that most distros, for the joy of developers, offer debugging
> symbols enabled versions of the libraries they ship.
>> [...] and I haven't been able to find out where it is implemented.
> Dealing with large code bases like X one's is a challenging task even
> for experienced developers. For this reason, people usually use indexing
> tools to (guess what?) index and locate identifiers scattered throughout
> the source code. One of the most used indexing tools is cscope, which
> with the help or the right plugin, may be integrated into your editor.
> By using cscope you'll be able to discover almost instantaneously that
> the function you were looking for, XRRCreateMode(), is in fact defined
> in libXrandr/src/XrrMode.c.
> Besides, if for any reason you realize that cscope doesn't fit your
> needs, you may want to ask Google if it could locate the function in
> your behalf.
> You take your pick! :)
Thank you for your help! I particularly liked Google code search (and
then I haven't even tried cscope yet!).
I downloaded libXrandr, built it locally, and using LD_LIBRARY_PATH I
got xrandr to use my "homebuilt" library instead of the system one - and
so I could step into the XRRCreateMode() function.
Where I immediately ran into a wall in the form of GetReq(), Data(), and
Luckily, I found this nice document -
http://www.freedesktop.org/software/xcb/xlib_impl.ps - explaining the
role of these functions.
I downloaded the xorg-server-1.6.5 package, searched for RRCreateMode()
there, and found ProcXRRCreateMode() which I *guess* is the handler for
Nothing very exciting seems to happen in that code path, in regards to
the modeFlags. The mode is just stored away (as could be expected ;).
The code path for xrandr --output ... --mode ... was more interesting
though. I believe the call stack looks something like this:
(*pScrPriv->rrCrtcSet)() == xf86RandR12CrtcSet() ??
xf86RandRModeConvert(pScrn, randr_mode, &mode);
xf86SetModeCrtc(mode, scrn->adjustFlags); (DisplayModePtr mode, int
mode->Crtc<X> = mode-><X>; (not Flags)
RRCrtcNotify(randr_crtc, randr_mode, x, y, ...)
crtc->mode = mode;
"??" meaning more guesswork than usual was required. :)
The bad part is, I still cannot find where the "magic" happens.
RRCrtcNotify() sets crtc->mode, and RRCrtcChanged() sets
pScrPriv->changed and pScrPriv->layoutChanged to TRUE, and that's it, as
far as I can see. Either I've missed some call somewhere, or the actual
setting happens asynchronously. I've also not been able to find any
filtering of the CSYNC flag anywhere.
BTW, does composite sync work on other architectures, like Intel?
>> If some nice developer could step me through this I would appreciate it
>> a lot! (I.e. give hints on how to continue, tell me why the function is
>> not "steppable", that it's no use, or whatever comes to mind. :) Perhaps
>> my question belongs on xorg-driver-ati at lists.x.org or
>> xorg at lists.freedesktop.org?
>> I'm running:
>> X.Org X Server 1.6.5
>> $ xrandr --version
>> xrandr program version 1.3.2
>> Server reports RandR version 1.3
>> xf86-video-ati-6.12.4 on a Radeon HD 3870.
>> Arvid Brodin
More information about the xorg-devel