Bug 3871

Summary: Rotation support on Radeon. Pivot on LCDs
Product: xorg Reporter: Johannes Hessellund <osos>
Component: Driver/RadeonAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: enhancement    
Priority: high CC: alexdeucher, marcel
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Johannes Hessellund 2005-07-26 04:03:32 UTC
More and more LCD panels come with pivot function.

It would be very nice to have rotation support in the radeon driver.

Currently I must use the vesa driver to rotate the screen on my Radeon Mobility
7500.
Comment 1 Alex Deucher 2005-07-26 04:35:24 UTC
Non-accelerated support could be added similar to how rotation is supported in
the savage or i810 drivers.
Comment 2 Johannes Hessellund 2005-08-02 03:42:59 UTC
(In reply to comment #1)
> Non-accelerated support could be added similar to how rotation is supported in
> the savage or i810 drivers.

This sounds fine to me.

Accelerated support could be added later. Specs from ATI is required I guess.
Does anyone have any specs from ATI?

How long would it take to implement this non-accelerated rotation support ?
Comment 3 Alex Deucher 2005-08-02 04:34:36 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Non-accelerated support could be added similar to how rotation is supported in
> > the savage or i810 drivers.
> 
> This sounds fine to me.
> 
> Accelerated support could be added later. Specs from ATI is required I guess.
> Does anyone have any specs from ATI?
> 

several developers have the specs, so that's not a problem.  I'm not quite sure
how it should be done though.

> How long would it take to implement this non-accelerated rotation support ?

it should be pretty easy.  You could probably implement it in a day or so based
on the savage or i810 drivers.  I won't have time to implement it anytime soon
though.  Patches welcome ;)
Comment 4 Johannes Hessellund 2005-08-15 23:24:37 UTC
> it should be pretty easy.  You could probably implement it in a day or so based
> on the savage or i810 drivers.  I won't have time to implement it anytime soon
> though.  Patches welcome ;)
> 
I don't have any experience on programming the xorg server.

I would like to help on this. Could you give me some more pointers on where in
the code to look. Are there any documentation on this?

I an trying to figure out how these drivers interface. I pretty much asume I
could just copy some functions from the i810 driver to the radeon driver. In
which function should this rotation be "hidden" ?


Comment 5 Johannes Hessellund 2005-08-15 23:31:28 UTC
> several developers have the specs, so that's not a problem.  I'm not quite sure
> how it should be done though.

Is it posible for me to get the specs on Radeon, Radeon 7500 is of special
interrest for me, would like Tv-out to work also!!
Comment 6 Alex Deucher 2005-08-16 22:26:21 UTC
(In reply to comment #4)
> > it should be pretty easy.  You could probably implement it in a day or so based
> > on the savage or i810 drivers.  I won't have time to implement it anytime soon
> > though.  Patches welcome ;)
> > 
> I don't have any experience on programming the xorg server.
> 
> I would like to help on this. Could you give me some more pointers on where in
> the code to look. Are there any documentation on this?
> 
> I an trying to figure out how these drivers interface. I pretty much asume I
> could just copy some functions from the i810 driver to the radeon driver. In
> which function should this rotation be "hidden" ?
> 
> 
> 

take a look at xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,
specifically the code guarded by psav->rotate.  The code in the i810 driver is
almost identical.
Comment 7 Johannes Hessellund 2005-08-23 22:27:35 UTC
(In reply to comment #6)
> take a look at xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,
> specifically the code guarded by psav->rotate.  The code in the i810 driver is
> almost identical.
> 

I have been looking a bit into it, but have much time for this...

What I see is savage and nv driver uses shadowfb to accomplish rotation. Radeon
DRI uses the shadowfb for some 3d? I am not sure I could just replace that.
Which brought me back to not knowing exactly where to but this, it seems there
could to lots of functions which might need to know of the rotation?
And how does you tell Xrandr that we support rotation?

Hardware acceleration seems not to be that difficult once the setup is done,
looking in radeon_accelfuncs.c !

I would like to help on this, but I dont have an overview of the driver structure.
Comment 8 Alex Deucher 2005-08-24 07:13:45 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > take a look at xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,
> > specifically the code guarded by psav->rotate.  The code in the i810 driver is
> > almost identical.
> > 
> 
> I have been looking a bit into it, but have much time for this...
> 
> What I see is savage and nv driver uses shadowfb to accomplish rotation. Radeon
> DRI uses the shadowfb for some 3d? I am not sure I could just replace that.

shadowfb is just a copy of the framebuffer that resides in system ram.  With
rotation the contents of the framebuffer are rotated in the shadow copy then
sent back to vram for scanning out.  3D drivers use a similar thing for doing SW
fallbacks.

> Which brought me back to not knowing exactly where to but this, it seems there
> could to lots of functions which might need to know of the rotation?
> And how does you tell Xrandr that we support rotation?

xrandr knows nothing of the rotation since it's just a driver specific option in
this case.  Real xrandr rotation support requires more work.  None of the Xorg
drivers support xrandr rotation at the moment.  I think some of the experimental
kdrive Xservers do (http://cvs.freedesktop.org/xserver/xserver/hw/kdrive/).

> 
> Hardware acceleration seems not to be that difficult once the setup is done,
> looking in radeon_accelfuncs.c !
> 

It wouldn't be too bad if you used a hostdata blit to copy the shadowfb back to
vram using DMA.  Alternatively you could rotate your coordinates and fix pitches
and probably use the 2d engine.

> I would like to help on this, but I dont have an overview of the driver structure.
> 

Take a look at the kdrive drivers I mentioned above.  Also, the driver DESIGN
document may be helpful:
http://www.x.org/X11R6.8.2/doc/DESIGN.html

Comment 9 Michel Dänzer 2006-06-08 02:22:29 UTC
FWIW, the i810/intel driver supports RandR rotation now, and the shadow
framebuffer could be in video RAM instead of system RAM.
Comment 10 Daniel Stone 2007-02-27 01:27:26 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 11 Alex Deucher 2007-02-27 10:57:33 UTC
this should come for free once we convert radeon to randr 1.2
Comment 12 Johannes Hessellund 2007-02-27 11:22:55 UTC
(In reply to comment #11)
> this should come for free once we convert radeon to randr 1.2
> 

Very nice. Looking forward to this.
Any schedule when the radeon driver will ship with randr 1.2 support ?

Comment 13 Alex Deucher 2007-02-27 11:47:56 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > this should come for free once we convert radeon to randr 1.2
> > 
> 
> Very nice. Looking forward to this.
> Any schedule when the radeon driver will ship with randr 1.2 support ?
> 

when it's ready :)

Dave has several testing versions on branches in his git tree and the ati git tree.
Comment 14 Alex Deucher 2007-08-31 07:13:36 UTC
rotation (via randr) is supported in ati git master and in 6.7.192 and newer ati driver releases.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.