Bug 13044

Summary: Corruption and slowness when screen rotated 90 degrees left or right
Product: xorg Reporter: Jure Repinc <jlp.bugs>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: dr.syon, magnade
Version: 7.3 (2007.09)   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
xorg.conf
none
Xorg.0.log
none
xorg.conf
none
Xorg.0.log after rotation attempt
none
xorg.conf with disabled acceleration
none
Xorg.log for configuration without acceleration after rotating left and back to normal
none
xorg.conf with XAA acceleration
none
Xorg.log for configuration with XAA after rotating left and back to normal
none
xorg.conf with EXA acceleration
none
Xorg.log for configuration with EXA after rotating left and back to normal
none
xorg.conf with EXA acceleration, adjusted virtual size
none
Xorg.log for configuration with EXA, new GIT's master
none
temporary fix
none
better fix none

Description Jure Repinc 2007-11-01 09:47:14 UTC
I have a laptop HP Compaq nx6325 which has an integrated Radeon graphics:
01:05.0 VGA compatible controller: ATI Technologies Inc RS485 [Radeon Xpress 1100 IGP] (prog-if 00 [VGA])
I installed the beta drivers version 6.7.195.
What I noticed is that if I rotate the screen 90 degrees left or right there is a screen corruption in the lower 1/4 part of the rotated image. I also noticed that drawing gets very slow if rotated this way. It is very noticeable when moving windows around for example.
If screen is rotated 180 degrees I don't experience any of these problems.
Comment 1 Alex Deucher 2007-11-01 11:46:01 UTC
Please attach your corg.conf and log file.  rotation is not currently accelerated with the radeon driver so it will be slow.
Comment 2 Jure Repinc 2007-11-01 22:46:10 UTC
Created attachment 12311 [details]
xorg.conf

Attaching xorg.conf as requested.
Comment 3 Jure Repinc 2007-11-01 22:48:02 UTC
Created attachment 12312 [details]
Xorg.0.log

Attaching the log file as requested
Comment 4 Alex Deucher 2007-11-02 06:30:31 UTC
does it work properly if you disable the DRI?  Also can you attach the output of xrandr?
Comment 5 Robin Green 2008-03-01 10:58:54 UTC
I am also experiencing corruption if I use xrandr.

[greenrd@crossover ~]$ xrandr --verbose -o right
 SZ:    Pixels          Physical       Refresh
*0   1280 x 768    ( 305mm x 183mm )  *60
 1   1280 x 720    ( 305mm x 183mm )   60
 2   1024 x 768    ( 305mm x 183mm )   60
 3    800 x 600    ( 305mm x 183mm )   60
 4    640 x 480    ( 305mm x 183mm )   60
Current rotation - normal
Current reflection - none
Rotations possible - normal left inverted right
Reflections possible - X Axis Y Axis
Setting size to 0, rotation to right
Setting reflection on neither axis
[greenrd@crossover ~]$ xrandr --verbose -o normal
 SZ:    Pixels          Physical       Refresh
*0   1280 x 768    ( 305mm x 183mm )  *60
 1   1280 x 720    ( 305mm x 183mm )   60
 2   1024 x 768    ( 305mm x 183mm )   60
 3    800 x 600    ( 305mm x 183mm )   60
 4    640 x 480    ( 305mm x 183mm )   60
Current rotation - right
Current reflection - none
Rotations possible - normal left inverted right
Reflections possible - X Axis Y Axis
Setting size to 0, rotation to normal
Setting reflection on neither axis

I have a HP Compaq Presario V2000 laptop with a 
01:05.0 VGA compatible controller: ATI Technologies Inc Radeon XPRESS 200M 5955 (PCIE)
I am using the xorg-x11-drv-ati-6.8.0-1.fc8 driver on Fedora 8.

I will attach my xorg.log and xorg.conf.

Disabling DRI does not solve the problem for me.
Comment 6 Robin Green 2008-03-01 10:59:44 UTC
Created attachment 14737 [details]
xorg.conf
Comment 7 Robin Green 2008-03-01 11:01:42 UTC
Created attachment 14738 [details]
Xorg.0.log after rotation attempt
Comment 8 Alex Deucher 2008-03-01 11:49:49 UTC
(In reply to comment #5)
> I am also experiencing corruption if I use xrandr.
> 
> [greenrd@crossover ~]$ xrandr --verbose -o right

does it work ok if you use the randr 1.2 commands?  There are issues with the randr 1.0 compatibility support.

xrandr --output LVDS --rotate right
Comment 9 Stephan Diestelhorst 2008-05-14 07:45:55 UTC
Have the same problem, using

> xrandr -o left

to rotate. Screen corruption in lower half, some areas mirroring each other and utter slowness.

> xrandr --output LVDS --rotate right

shows no reaction. This is xf86-driver-ati from todays GIT. Regardless of EXA, XAA or even "NoAccel" "1".

Will provide xorg.conf and Xorg.log for all three cases.
Comment 10 Stephan Diestelhorst 2008-05-14 07:57:50 UTC
Created attachment 16529 [details] [review]
xorg.conf with disabled acceleration
Comment 11 Stephan Diestelhorst 2008-05-14 07:58:37 UTC
Created attachment 16530 [details]
Xorg.log for configuration without acceleration after rotating left and back to normal
Comment 12 Stephan Diestelhorst 2008-05-14 07:59:27 UTC
Created attachment 16531 [details]
xorg.conf with XAA acceleration
Comment 13 Stephan Diestelhorst 2008-05-14 08:00:07 UTC
Created attachment 16532 [details] [review]
 Xorg.log for configuration with XAA after rotating left and back to normal
Comment 14 Stephan Diestelhorst 2008-05-14 08:00:56 UTC
Created attachment 16533 [details]
 xorg.conf with EXA acceleration
Comment 15 Stephan Diestelhorst 2008-05-14 08:01:54 UTC
Created attachment 16534 [details]
Xorg.log for configuration with EXA after rotating left and back to normal
Comment 16 Alex Deucher 2008-05-14 08:08:07 UTC
(In reply to comment #9)
> Have the same problem, using
>
> > xrandr --output LVDS --rotate right
> 
> shows no reaction. This is xf86-driver-ati from todays GIT. Regardless of EXA,
> XAA or even "NoAccel" "1".

In your case you don't have an LVDS output.  try:
xrandr --output DVI-0 --rotate right

Add a virtual line to the display dubsection of the screen section of your config:

  SubSection "Display"
    Depth      24
    Virtual 1600 1600
    Modes      "1600x1200" "1280x1024" "1024x768" "800x600" 
  EndSubSection

Comment 17 Stephan Diestelhorst 2008-05-14 08:59:17 UTC
Thanks for the hints.
xrandr --output DVI-0 --rotate left
has a much more helpful error message (than displaying garbage).
Setting up the proper virtual size then fixes the message and the display.

Multiple questions arise:
-Where do I get information about the available outputs from? Have not had any luck using the query or verbose options to xrandr.
-Why does xrandr fail silently if it receives an invalid output as a parameter?
-When can I get acceleration with rotation? ;-)

Many thanks for the quick and substantial help! Kudos for getting this to work!

Stephan
Comment 18 Stephan Diestelhorst 2008-05-14 09:15:02 UTC
Seriously. Are there any ways to get this usable? I can _see_ the screen getting updated. Even if there is no page-flipping, why does blitting the back buffer to the screen take so long (It didn't in the old days when I used rep movsd, but that was 320x200x8)? Or are all apps drawing directly to the visible screen surface, rather than to a single back buffer in memory?

Could composition help here? Could compiz do the entire rotation magic in software? Given that I can get 3D acceleration?

Thanks!
Comment 19 Alex Deucher 2008-05-14 10:19:36 UTC
(In reply to comment #17)
> Thanks for the hints.
> xrandr --output DVI-0 --rotate left
> has a much more helpful error message (than displaying garbage).
> Setting up the proper virtual size then fixes the message and the display.
> 
> Multiple questions arise:
> -Where do I get information about the available outputs from? Have not had any
> luck using the query or verbose options to xrandr.

type xrandr and you can see what outputs your card has, which are connected, and what modes are available on each output.  for example:
$ xrandr
Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 2560 x 1024
VGA-0 disconnected (normal left inverted right x axis y axis)
S-video disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1280x1024+1280+0 (normal left inverted right x axis y axis) 376mm x 301mm
   1280x1024      60.0*+   75.0     60.0     60.0* 
   1600x1024      60.0  
   1280x960       60.0  
   1152x864       75.0     75.0  
   1024x768       75.1     75.0     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        75.0     72.8     75.0     60.0     59.9  
   720x400        70.1  
DVI-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
   1280x1024      60.0*+   75.0     60.0     60.0* 
   1600x1024      60.0  
   1280x960       60.0  
   1152x864       75.0     75.0  
   1024x768       75.1     75.0     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        75.0     72.8     75.0     60.0     59.9  
   720x400        70.1  

On this card DVI-0 and HDMI-0 are connected.  VGA-0 and S-video are not.

> -Why does xrandr fail silently if it receives an invalid output as a parameter?

patches welcome.

> -When can I get acceleration with rotation? ;-)

If you enable exa (Option "AccelMethod" "EXA") and use the ati driver from git master, you can get accelerated rotation.
Comment 20 Stephan Diestelhorst 2008-05-14 11:03:29 UTC
(In reply to comment #19)
> > -Where do I get information about the available outputs from? Have not had any
> > luck using the query or verbose options to xrandr.
> 
> type xrandr and you can see what outputs your card has, which are connected,
> and what modes are available on each output.  for example:
> $ xrandr
> Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 2560 x 1024
> VGA-0 disconnected (normal left inverted right x axis y axis)
> S-video disconnected (normal left inverted right x axis y axis)
> HDMI-0 connected 1280x1024+1280+0 (normal left inverted right x axis y axis)
> DVI-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm

I'm apparently on an ancient xrandr version. (OpenSUSE 10.3's standard) These helpful lines are missing from my output. Glad to learn about the improvement!
 
> > -When can I get acceleration with rotation? ;-)
> 
> If you enable exa (Option "AccelMethod" "EXA") and use the ati driver from git
> master, you can get accelerated rotation.

Will try and report! Thanks. 

Comment 21 Alex Deucher 2008-05-14 12:12:04 UTC
(In reply to comment #20)
> I'm apparently on an ancient xrandr version. (OpenSUSE 10.3's standard) These
> helpful lines are missing from my output. Glad to learn about the improvement!

You'll definitely want to upgrade. Using randr 1,2 features with an old version of the xrandr utility will make your life difficult.
Comment 22 Stephan Diestelhorst 2008-05-15 05:46:24 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > I'm apparently on an ancient xrandr version. (OpenSUSE 10.3's standard) These
> > helpful lines are missing from my output. Glad to learn about the improvement!
> 
> You'll definitely want to upgrade. Using randr 1,2 features with an old version
> of the xrandr utility will make your life difficult.
> 

Apologies. That was blindness on my part. Seems like the new driver correctly reports the outputs, even with the existing xrandr.

>> -When can I get acceleration with rotation? ;-)
>
>If you enable exa (Option "AccelMethod" "EXA") and use the ati driver
>from git master, you can get accelerated rotation

I don't :( . Fresh GIT:

git log -1
commit cc9f510770700228e5d597c872e926a4e99bd950
Author: Corbin Simpson <MostAwesomeDude@gmail.com>
Date:   Wed May 14 16:49:01 2008 -0400

    RADEON: missing stdint.h includes

Compiles fine, runs well. But is slow in rotation. Will attach logs and conf. Again, why is this so slow? No offence, but I'm just curious. I can think of a rotation function that blits the 1200x1600 software buffer for X to the 1600x1200 buffer on graphics HW much faster than what I can see now. I do not understand the interplay between X and the drivers enough to see where this could be integrated.

Anything I could try? Thumbs up for working on this!
Comment 23 Stephan Diestelhorst 2008-05-15 05:49:40 UTC
Created attachment 16551 [details]
xorg.conf with EXA acceleration, adjusted virtual size

I tried disabling all the old stuff to see if that helped. I also used the ati wrapper to the radeon driver, no difference. Rotation is still slow, even with the GIT's master.
Comment 24 Stephan Diestelhorst 2008-05-15 05:51:17 UTC
Created attachment 16552 [details]
Xorg.log for configuration with EXA, new GIT's master

Using the increased virtual size, rotation finally works. However, performance is quite slow, despite the use of today's GIT master driver.
Comment 25 Alex Deucher 2008-05-19 09:14:07 UTC
Created attachment 16625 [details] [review]
temporary fix

This patch will get rotation working fast.  the driver falls back with REPEAT_NONE transformed sources.  We should be ok in the pixel exact cases like xrandr rotation, but it's breaks render semantics in other cases.  I'm not sure what the best fix is yet.
Comment 26 Alex Deucher 2008-05-19 13:46:33 UTC
Created attachment 16631 [details] [review]
better fix

Here's a better fix.  Ideally we'd handle more acceleratable cases.  I talked with otayler on IRC and have some ideas.
Comment 27 Stephan Diestelhorst 2008-05-20 04:27:01 UTC
(In reply to comment #26)
> Created an attachment (id=16631) [details]
> better fix
> 
> Here's a better fix.  Ideally we'd handle more acceleratable cases.  I talked
> with otayler on IRC and have some ideas.
> 
That is much better! Just recompiled and everything works just as without rotation.

Many thanks! And: You're the man :-)

Regards,
  Stephan
Comment 28 Alex Deucher 2008-05-20 10:10:23 UTC
committed:
a4f3d0088ba763ed8eab1d331959b5ecde8262e8
130e55738047f2a073bcc47e3e1400f7b694a81b

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.