Bug 23144 - Add RGB formats to textured video.
Summary: Add RGB formats to textured video.
Status: RESOLVED INVALID
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-04 22:10 UTC by Kusanagi Kouichi
Modified: 2018-06-12 19:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Add 16 and 32 bit RGB formats to textured video. R6xx/R7xx only. (15.54 KB, patch)
2009-08-04 22:10 UTC, Kusanagi Kouichi
no flags Details | Splinter Review
Add 16 and 32 bit RGB formats to textured video. R6xx/R7xx only. (13.38 KB, patch)
2009-09-08 22:53 UTC, Kusanagi Kouichi
no flags Details | Splinter Review
Implement RGB formats for textured-Xv with pass-through shader (i.e. no hue/contrast/brightness/saturation adjustment) (113.07 KB, patch)
2011-01-03 07:26 UTC, Da Fox
no flags Details | Splinter Review
Implement hue/contrast/brightness/saturation adjustments for RGB textured-Xv (96.75 KB, patch)
2011-01-03 07:26 UTC, Da Fox
no flags Details | Splinter Review
Test program for testing RGB output via textured-Xv (20.48 KB, patch)
2011-01-03 07:27 UTC, Da Fox
no flags Details | Splinter Review
This image displays wrong in RGB32 mode (something seems amiss with the image stride) (37.65 KB, image/png)
2011-01-03 07:50 UTC, Da Fox
no flags Details
Xv: Add RGB formats to r600+ (62.61 KB, patch)
2011-04-01 06:33 UTC, Kusanagi Kouichi
no flags Details | Splinter Review

Description Kusanagi Kouichi 2009-08-04 22:10:03 UTC
Created attachment 28356 [details] [review]
Add 16 and 32 bit RGB formats to textured video. R6xx/R7xx only.

RGB formats would be useful for some applications.
I wrote a preliminary patch.
Comment 1 Roland Scheidegger 2009-08-05 09:21:46 UTC
(In reply to comment #0)
> Created an attachment (id=28356) [details]
> Add 16 and 32 bit RGB formats to textured video. R6xx/R7xx only.
> 
> RGB formats would be useful for some applications.
I agree that they are useful sometimes. Should be possible for all chips easily though.
Also, any reason you restrict the interpolation parameter to rgb formats? If you really want ugly filtering (not sure this attribute really is a good idea), there doesn't seem to be a good reason why you'd not allow that for other formats. Looks completely orthogonal to rgb formats to me.
Comment 2 Kusanagi Kouichi 2009-09-08 22:53:21 UTC
Created attachment 29345 [details] [review]
Add 16 and 32 bit RGB formats to textured video. R6xx/R7xx only.

(In reply to comment #1)
> (In reply to comment #0)
> > Created an attachment (id=28356) [details] [details]
> > Add 16 and 32 bit RGB formats to textured video. R6xx/R7xx only.
> > 
> > RGB formats would be useful for some applications.
> I agree that they are useful sometimes. Should be possible for all chips easily
> though.

Other chips should be supported as well as r6xx/r7xx. But I cannot test r100-r500 because I don't have them. So I didn't touch its part.


> Also, any reason you restrict the interpolation parameter to rgb formats? If
> you really want ugly filtering (not sure this attribute really is a good idea),
> there doesn't seem to be a good reason why you'd not allow that for other
> formats. Looks completely orthogonal to rgb formats to me.

The interpolation parameter could also be applied to YUV formats. But I dropped interpolation part because I thought that image format and interpolation method were two separate things.
Comment 3 Da Fox 2011-01-03 07:26:18 UTC
Created attachment 41588 [details] [review]
Implement RGB formats for textured-Xv with pass-through shader (i.e. no hue/contrast/brightness/saturation adjustment)
Comment 4 Da Fox 2011-01-03 07:26:56 UTC
Created attachment 41589 [details] [review]
Implement hue/contrast/brightness/saturation adjustments for RGB textured-Xv
Comment 5 Da Fox 2011-01-03 07:27:54 UTC
Created attachment 41590 [details] [review]
Test program for testing RGB output via textured-Xv
Comment 6 Da Fox 2011-01-03 07:49:12 UTC
My two patches add support for RGB video output with the textured-video Xv output driver. Patch 1 (should) add the basic support similar to (and based upon) the patches of Kusanagi, but for r3xx. Patch 2 extends the support with hue/contrast/brightness/saturation/gamma correction support. Attachment 3 [details] is not a patch but a small tool I wrote to test various output formats. It's not the greatest software ever but it works.  Patches developed & tested on Mobility Radeon 9600 M10 (RV350).

The following formats are supported:
FOURCC_RGBA32, e.g. A8R8G8B8
FOURCC_RGB16, e.g. R5G6B5
FOURCC_RGBT16, e.g. A1R5G5B5
FOURCC_RGB15, e.g. R5G5B5
FOURCC_BGR15, e.g. B5G5R5

FOURCC_BGR15 is especially useful since it appears to be the native pixel format for Playstation 1, and possibly other (old?) game consoles. This means that emulators can output directly without having to perform a costly conversion step in software. I have some proof-of-concept code for Pcsx working on my laptop.

FOURCC_RGB24 is notably missing because I could not find a way to output it in hardware directly (I think there were some comments on IRC stating that it is in fact not possible). Therefor I think it is best to leave the conversion to the application instead.

Finally I noticed that there appears to be a bug with rgb32 output when using certain image widths (I'll try to find an example later). I have not yet been able to find what causes this. Any help would be appreciated.
Comment 7 Da Fox 2011-01-03 07:50:16 UTC
Created attachment 41593 [details]
This image displays wrong in RGB32 mode (something seems amiss with the image stride)
Comment 8 Michel Dänzer 2011-01-03 08:08:48 UTC
(In reply to comment #6)
> Finally I noticed that there appears to be a bug with rgb32 output when using
> certain image widths (I'll try to find an example later). I have not yet been
> able to find what causes this. Any help would be appreciated.

The below part of your patch incorrectly open-codes the RADEON_ALIGN macro for dstPitch. Using the macro instead might work better. :)

+    case FOURCC_RGBA32:
+	srcPitch = width << 2;
+	dstPitch = ((dst_width << 2) + hw_align) & ~hw_align;
+	break;
Comment 9 Da Fox 2011-01-04 05:01:40 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > Finally I noticed that there appears to be a bug with rgb32 output when using
> > certain image widths (I'll try to find an example later). I have not yet been
> > able to find what causes this. Any help would be appreciated.
> 
> The below part of your patch incorrectly open-codes the RADEON_ALIGN macro for
> dstPitch. Using the macro instead might work better. :)
> 
> +    case FOURCC_RGBA32:
> +    srcPitch = width << 2;
> +    dstPitch = ((dst_width << 2) + hw_align) & ~hw_align;
> +    break;

Yes, using the RADEON_ALIGN macro indeed fixed the issue. I think that piece of code was originally from kusanagi's patch, and looked good to me. I didn't look into the RADEON_ALIGN macro or why it was not used here, I kind of assumed that there was a reason for the difference. Thanks for pointing that out so fast! I see now why that wouldn't work. I'll refrain from posting a new patch since the change is so small, and this is not the final patch.
Comment 10 Kusanagi Kouichi 2011-04-01 06:33:40 UTC
Created attachment 45133 [details] [review]
Xv: Add RGB formats to r600+

Can anyone test this patch? It's working on my Redwood.
Comment 11 Adam Jackson 2018-06-12 19:10:15 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current 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.