Somewhere between snv_55b and snv_60 linking of Xorg driver modules must have 
changed
to use "-B direct" binding.

This breaks the Xv XVideo extension for the ati/radeon driver.  I found this 
problem on
my Tecra S1 notebook, which uses an "ATI Radeon Mobility 9000 (M9) Lf (AGP)" 
chipset,
after upgrading from snv_55b to snv_60.  After upgrading to snv_60, mplayer 
refuses to
display video content when using the "xv" Xvideo video output driver.

% mplayer /home/leo/avi/sonopress.vob 
MPlayer 1.0pre7-3.4.3 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium M Banias (Family: 6, Stepping: 5)
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx


93 audio & 211 video codecs
Playing /home/leo/avi/sonopress.vob.
MPEG-PS file format detected.
VIDEO:  MPEG2  720x576  (aspect 2)  25.000 fps  8000.0 kbps (1000.0 kbyte/s)
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
No accelerated IMDCT transform found
AC3: 5.1 (3f+2r+lfe)  48000 Hz  448.0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
vo: X11 running at 1024x768 with depth 24 and 32 bpp (":0.0" => local display)
X11 error: BadMatch (invalid parameter attributes)            
<<<<<<<<<<<<<<<<<<<<<<<<<<<<


MPlayer interrupted by signal 6 in module: preinit_libvo
- MPlayer crashed. This shouldn't happen.
  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
  gcc version. If you think it's MPlayer's fault, please read
  DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
  won't help unless you provide this information when reporting a possible bug.





The crash happens because mplayer gets an unexpected X11 error when
trying to read the XV_COLORKEY attribute.  mplayer stack backtrace when
we get the unexpected BadMatch X11 error:

> $c
libX11.so.4`_XError+9(8859eb8, 8045ca0)
libX11.so.4`_XReply+0x3c1(8859eb8, 8045ca0, 0, 0)
libXv.so.1`XvGetPortAttribute+0xe0(8859eb8, 41, 1c6, 8045ce4, 0, 204ccd)
vo_xv_init_colorkey+0x262()



After mplayer has crashed, the /usr/X11/bin/xvinfo utility shows similar 
behaviour:

% /usr/X11/bin/xvinfo
X-Video Extension version 2.2
screen #0
  Adaptor #0: "ATI Radeon Video Overlay"
    number of ports: 1
    port base: 65
    operations supported: PutImage 
    supported visuals:
      depth 24, visualID 0x23
      depth 24, visualID 0x24
      depth 24, visualID 0x25
      depth 24, visualID 0x26
      depth 24, visualID 0x27
      depth 24, visualID 0x28
      depth 24, visualID 0x29
      depth 24, visualID 0x2a
    number of attributes: 22
      "XV_DEVICE_ID" (range 0 to -1)
              client gettable attribute
      "XV_LOCATION_ID" (range 0 to -1)
              client gettable attribute
      "XV_INSTANCE_ID" (range 0 to -1)
              client gettable attribute
      "XV_DUMP_STATUS" (range 0 to 1)
              client settable attribute
      "XV_SET_DEFAULTS" (range 0 to 1)
              client settable attribute
      "XV_AUTOPAINT_COLORKEY" (range 0 to 1)
              client settable attribute
              client gettable attribute
      "XV_COLORKEY" (range 0 to -1)
              client settable attribute
              client gettable attribute
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (XVideo)
  Minor opcode of failed request:  14 ()
  Serial number of failed request:  20
  Current serial number in output stream:  20


xvinfo get's the same unexpected BadMatch error when trying to
get the XV_COLORKEY attribute.  Stack backtrace for xvinfo's error:

...
      "XV_COLORKEY" (range 0 to -1)
              client settable attribute
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (XVideo)
  Minor opcode of failed request:  14 ()
  Serial number of failed request:  35
  Current serial number in output stream:  35
mdb: stop at libc.so.1`exit
mdb: target stopped at:
libc.so.1`exit: pushl  %ebx
mdb: You've got symbols!
> $c
libc.so.1`exit(84005d8, 8046f30)
libX11.so.4`_XError+0xed(84005d8, 8047010)
libX11.so.4`_XReply+0x3c1(84005d8, 8047010, 0, 0)
libXv.so.1`XvGetPortAttribute+0xe0(84005d8, 41, 1c6, 80470b4)
main+0x420(1, 80470f4, 80470fc)
_start+0x7a(1, 8047284, 0, 804728b, 80472ad, 80472c2)



I started to debug the Xorg server, and noticed that the radeon
video driver module is using completely different atom id number
for the XV_* attributes than xvinfo is trying to query.  From the
application stack traces above, we see that the XV_COLORKEY
atom is is 0x1c6, but in the debugger I saw that the radeon driver
is expecting an XV_COLORKEY atom id of 9:

in the radeon driver, we have radeon_drv.so`xvColorKey == 9 but the application
uses atom XV_COLORKEY == 0x1c6 ???

> radeon_drv.so`xvColorKey/X
radeon_drv.so`xvColorKey:       9        

> $c
radeon_drv.so`RADEONGetPortAttribute+0x62(842c500, 1c6, 80476f8, 8466218, 
8b0e450, 87ef110)
xf86XVGetPortAttribute+0x2c(87ef110, 8469e48, 1c6, 80476f8, 0, d1032000)
libextmod.so`XvdiGetPortAttribute+0x27(87ef110, 8469e48, 1c6, 80476f8, 0, 0)
libextmod.so`ProcXvGetPortAttribute+0xd1(80477f8, 840b8e4, 8047758, 8097fb2, 
840b8e4, 80477f0)
libextmod.so`ProcXvDispatch+0x52b(87ef110, 87ef110, 846b048, 0, 1, 1b)
XaceCatchExtProc+0x9d(87ef110, 87ef110, 3, 16, 8b0e450, 80478f8)
Dispatch+0x4f9(2, 0, 842b080, 8047e80, d1df0298, d1f99400)
main+0x491(9, 8047ebc, 8047ee4)
_start+0x80(9, 8047f5c, 8047f6e, 8047f71, 8047f78, 8047f7b)



Apparently, the root cause of this problem is that the ata/radeon driver shared
libraries are linked with the "-B direct" option.  When the radeon driver 
creates
X11 atoms for the XV attributes in function radeon_drv.so`RADEONResetVideo(),
it calls the external function MakeAtom, but because of direct binding, it 
doesn't
use the MakeAtom function from the main Xorg binary, it uses a duplicated
copy of MakeAtom that is found in libXfont.so.1`MakeAtom()!

> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0x91:    movl   $0xc,%edx
> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0x96:    movl   $0x1,%eax
> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0x9b:    movl   %edx,0x4(%esp)
> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0x9f:    movl   %edi,(%esp)
> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0xa2:    movl   $0xe,%edi
> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0xa7:    movl   %eax,0x8(%esp)
> ::step
mdb: target stopped at:
radeon_drv.so`RADEONResetVideo+0xab:    call   -0x1b204 
<PLT=libXfont.so.1`MakeAtom>
> ::step
mdb: target stopped at:
PLT=libXfont.so.1`MakeAtom:     jmp    *0x39c(%ebx)
> ::step
mdb: target stopped at:
libXfont.so.1`MakeAtom: pushl  %ebp
^^^^^^^^^^^^^


> ::nm !grep MakeAtom
0x08081b80|0x000001f9|FUNC |GLOB |0x0  |11      |MakeAtom
0xd1e37620|0x0000005f|FUNC |GLOB |0x0  |11      |bdfForceMakeAtom
0xd1e51bd0|0x00000365|FUNC |GLOB |0x0  |11      |MakeAtom
0xd1000000|0x00000000|NOTY |GLOB |0x0  |UNDEF   |MakeAtom
0xd0800000|0x00000000|NOTY |GLOB |0x0  |UNDEF   |MakeAtom
0xd1b90000|0x00000000|FUNC |GLOB |0x0  |UNDEF   |MakeAtom
0xcc000000|0x00000000|NOTY |GLOB |0x0  |UNDEF   |MakeAtom

So, we have two MakeAtom functions, one in the Xorg binary, and one in 
libXfont.so.1,
and libXfont.so.1 wins??

> 0x08081b80/i
MakeAtom:
MakeAtom:       pushl  %ebp
> 0xd1e51bd0
libXfont.so.1`MakeAtom:
libXfont.so.1`MakeAtom:         pushl  %ebp



This problem can also be shown by running the Xorg server with
environment variable LD_DEBUG=bindings, for example like this:

# env LD_DEBUG=bindings LD_DEBUG_OUTPUT=/tmp/Xorg.ld /usr/X11/bin/i386/Xorg
...
% grep MakeAtom /tmp/Xorg.ld.00583
00583: 1: binding file=/usr/X11/lib/modules/drivers//radeon_drv.so to 
file=/usr/X11/lib/X11/xserver/libXfont.so.1: symbol `MakeAtom'
00583: 1: binding file=/usr/X11/lib/modules/extensions//libextmod.so to 
file=/usr/X11/bin/i386/Xorg: symbol `MakeAtom'
00583: 1: binding file=/usr/X11/lib/modules/extensions//libxtrap.so to 
file=/usr/X11/bin/i386/Xorg: symbol `MakeAtom'
00583: 1: binding file=/usr/X11/lib/X11/xserver/libXfont.so.1 to 
file=/usr/X11/bin/i386/Xorg: symbol `MakeAtom'


Workaround: run Xorg with environment variable "LD_NODIRECT=1"

--- /usr/dt/config/Xservers~    2007-04-01 19:44:07.371221000 +0200
+++ /usr/dt/config/Xservers     2007-04-01 19:40:02.000000000 +0200
@@ -109,5 +109,5 @@
 # You can use kdmconfig to change which X server is run by this program
 
 
-   :0  Local local_uid at console root /usr/X11/bin/Xserver :0 -nobanner
+   :0  Local local_uid at console root /bin/env LD_NODIRECT=1 
/usr/X11/bin/Xserver :0 -nobanner
 
 
This message posted from opensolaris.org

Reply via email to