Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 03-24-10, 04:01 AM   #1
seaweed
Registered User
 
Join Date: Sep 2009
Posts: 57
Default Background settings for VDPSurface not working

I want to be able to letterbox a video window (native X rendering with decode/render using VDPAU) to paint black borders around the video when screen size is bigger. When I move the source co-ordinates by an offset to output to destination surface, the screen positions are correct, the area covered by the offset ( picture's x,y from scereen (x,y)) are black color however the area to the right and bottom of it are all green.
When I create the mixer, I enable VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR and set a background as attribute value (black) , but its not working. I have tried other ways, such as fill the surfaces with put_bits function, use the function VdpPresentationQueueSetBackgroundColor etc but all to no avail. What are the fundamental requirements for this simple thing to work?

thanks
seaweed is offline   Reply With Quote
Old 03-24-10, 11:50 AM   #2
Stephen Warren
Moderator
 
Stephen Warren's Avatar
 
Join Date: Aug 2005
Posts: 1,327
Default Re: Background settings for VDPSurface not working

It sounds like one of the following is happening:

1) Your VdpOutputSurfaces aren't large enough to fill your window.

2) Your VdpPresentationQueueDisplay parameters are clipping the VdpOutputSurface to a size that's smaller than the window.

Either of those will cause the window to show the presentation queue's background color in the regions not covered by the VdpOutputSurface's clipped size.

I'm surprised that VdpPresentationQueueSetBackgroundColor doesn't affect the color of this right/bottom region. Does behaviour differ based on blit vs. overlay presentation queue? What about if you call VdpPresentationQueueSetBackgroundColor before displaying any surfaces?

Alternatively, if this clipping isn't an issue, then I guess the rectangles you're passing to VdpVideoMixerRender aren't covering the surfaces in the way you want.

If that doesn't help, can you create a small test application that demonstrates the issue?
Stephen Warren is offline   Reply With Quote
Old 03-25-10, 04:08 PM   #3
seaweed
Registered User
 
Join Date: Sep 2009
Posts: 57
Default Re: Background settings for VDPSurface not working

Quote:
Originally Posted by Stephen Warren View Post
It sounds like one of the following is happening:

1) Your VdpOutputSurfaces aren't large enough to fill your window.
This isn't the case, the window size is the same as the output surface size (1080 P)

Quote:
Originally Posted by Stephen Warren View Post
2) Your VdpPresentationQueueDisplay parameters are clipping the VdpOutputSurface to a size that's smaller than the window.
This sounds like a potential culprit, I am using original video size here (640x480). I will check with full size.

Quote:
Originally Posted by Stephen Warren View Post
Either of those will cause the window to show the presentation queue's background color in the regions not covered by the VdpOutputSurface's clipped size.

I'm surprised that VdpPresentationQueueSetBackgroundColor doesn't affect the color of this right/bottom region. Does behaviour differ based on blit vs. overlay presentation queue? What about if you call VdpPresentationQueueSetBackgroundColor before displaying any surfaces?
If I dont render anything, the black background does show up properly. Its only when I start playing, the regions described earlier becomes green.

Quote:
Originally Posted by Stephen Warren View Post
Alternatively, if this clipping isn't an issue, then I guess the rectangles you're passing to VdpVideoMixerRender aren't covering the surfaces in the way you want.
The only thing I can tell you here is that the dimensions of the video surfaces ( past/current/future etc) are of original video resolution sizes (i am using 640x480). But this is the source rect, the dest is the output surface that matches the dimension of the window. One question here, do I have to dedicate an output surface just for the background and pass to this function ? I didnt think this is was necessary since there is a function VdpPresentationQueueSetBackgroundColor thats supposed to do that..

Quote:
Originally Posted by Stephen Warren View Post
If that doesn't help, can you create a small test application that demonstrates the issue?
I did some modifications, let me do some more experiements and if it fails, I will do that.

Another question, if I want to render multiple video windows sharing the same output window (lets say four 640x480 covering a 1920x1080 area), and I have individual VDP Device, VDP Decoder, mixer etc, do you think when all of these windows are relocated with the VdpVideoMixerRender function to different screen positions, the window will flicker? Do I have to create 1920x1080 output surfaces for all of them?
seaweed is offline   Reply With Quote
Old 03-25-10, 05:55 PM   #4
seaweed
Registered User
 
Join Date: Sep 2009
Posts: 57
Default Re: Background settings for VDPSurface not working

VdpPresentationQueueDisplay was the culprit! I gave the full window regions and Its now showing up properly. However that raises the same question I asked before,

"Another question, if I want to render multiple video windows sharing the same output window (lets say four 640x480 covering a 1920x1080 area), and I have individual VDP Device, VDP Decoder, mixer etc, do you think when all of these windows are relocated with the VdpVideoMixerRender function to different screen positions, the window will flicker? Do I have to create 1920x1080 output surfaces for all of them?"

It seems that the multiple VDP decoders will have to share the same presentation queue (because once I create a 1080 P window and a presentation queue backing it up, subsequent VdpPresentationQueueTargetCreateX11 fails because the window cant be reused, this leads me to come to the conclusion above. So could you please elaborate what common resources should be created and shared and what resources should be created for individual video streams and not shared? The resources being the X11 window, presentation queue, presentation queue target, VDP device, VDP decoder, VDP mixer, video surfaces, output surfaces
seaweed is offline   Reply With Quote
Old 03-26-10, 12:12 PM   #5
Stephen Warren
Moderator
 
Stephen Warren's Avatar
 
Join Date: Aug 2005
Posts: 1,327
Default Re: Background settings for VDPSurface not working

If you want to render 4 separate streams into the same window, you have two choices:

Choice 1:

Create 1 VdpDevice
Create 1 VdpPresentationQueue
Create 4 VdpVideoDecoders
Create 4 VdpVideoMixers (1 per stream; the mixer maintains stream-specific history)
Create 1 set of window-sized VdpOutputSurfaces

For each display frame, for each of the 4 streams, use the stream's VdpVideoMixer to render to a subset of the selected VdpOutputSurface, and then pass this combined surface to the VdpPresentationQueue.

Advantages:
* Single presentation queue means it's easy to keep the videos synchronized.
* Single device and presentation queue means there's less overhead.

Choice 2:

Use child X windows to sub-divide your top-level window into 4 windows. For each window, use a separate VdpPresentationQueue, VdpVideoMixer, and VdpDecoder. These can be in the same or separate VdpDevice.

Advantages:
* The N streams can be completely separately managed by your application.
Stephen Warren is offline   Reply With Quote
Old 03-29-10, 01:49 AM   #6
seaweed
Registered User
 
Join Date: Sep 2009
Posts: 57
Default Re: Background settings for VDPSurface not working

Quote:
Originally Posted by Stephen Warren View Post
If you want to render 4 separate streams into the same window, you have two choices:

Choice 1:

Create 1 VdpDevice
Create 1 VdpPresentationQueue
Create 4 VdpVideoDecoders
Create 4 VdpVideoMixers (1 per stream; the mixer maintains stream-specific history)
Create 1 set of window-sized VdpOutputSurfaces

For each display frame, for each of the 4 streams, use the stream's VdpVideoMixer to render to a subset of the selected VdpOutputSurface, and then pass this combined surface to the VdpPresentationQueue.

Advantages:
* Single presentation queue means it's easy to keep the videos synchronized.
* Single device and presentation queue means there's less overhead.

Choice 2:

Use child X windows to sub-divide your top-level window into 4 windows. For each window, use a separate VdpPresentationQueue, VdpVideoMixer, and VdpDecoder. These can be in the same or separate VdpDevice.

Advantages:
* The N streams can be completely separately managed by your application.
Thanks a bunch for clarifying some of the stuff.
The way I have it right now, choice 2 will be easier to implement, but I think since each stream will have their own presentation time for rendering, the overall view of the whole window wont look very pleasing to the eye. I will find out shortly.
seaweed is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:19 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.