Fix fullscreen for VDPAU

This commit is contained in:
Iwan Timmer
2017-06-10 20:36:42 +02:00
parent 966dce5f69
commit 0ea71fc635
3 changed files with 16 additions and 5 deletions

View File

@@ -167,7 +167,7 @@ AVFrame* vdpau_get_frame(AVFrame* dec_frame) {
return cpu_frame;
}
int vdpau_init_presentation(Drawable win, int width, int height) {
int vdpau_init_presentation(Drawable win, int width, int height, int display_width, int display_height) {
VdpVideoMixerParameter params[] = {
VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT
@@ -177,7 +177,7 @@ int vdpau_init_presentation(Drawable win, int width, int height) {
if (vdp_video_mixer_create(vdp_device, 0, NULL, 2, params, paramValues, &vdp_mixer) != VDP_STATUS_OK)
return -1;
if (vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, width, height, &vdp_output) != VDP_STATUS_OK)
if (vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, display_width, display_height, &vdp_output) != VDP_STATUS_OK)
return -1;
if(vdp_presentation_queue_target_create_x11(vdp_device, win, &vdp_queue_target) != VDP_STATUS_OK)

View File

@@ -24,5 +24,5 @@ int vdpau_init_lib(Display* display);
int vdpau_init(AVCodecContext* decoder_ctx, int width, int height);
void vdpau_destroy();
AVFrame* vdpau_get_frame(AVFrame* dec_frame);
int vdpau_init_presentation(Drawable win, int width, int height);
int vdpau_init_presentation(Drawable win, int width, int height, int display_width, int display_height);
void vdpau_queue(AVFrame* dec_frame);

View File

@@ -78,9 +78,20 @@ int x11_setup(int videoFormat, int width, int height, int redrawRate, void* cont
return -1;
}
int display_width;
int display_height;
if (drFlags & DISPLAY_FULLSCREEN) {
Screen* screen = DefaultScreenOfDisplay(display);
display_width = WidthOfScreen(screen);
display_height = HeightOfScreen(screen);
} else {
display_width = width;
display_height = height;
}
Window root = DefaultRootWindow(display);
XSetWindowAttributes winattr = { .event_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask };
Window window = XCreateWindow(display, root, 0, 0, width, height, 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &winattr);
Window window = XCreateWindow(display, root, 0, 0, display_width, display_height, 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &winattr);
XMapWindow(display, window);
XStoreName(display, window, "Moonlight");
@@ -116,7 +127,7 @@ int x11_setup(int videoFormat, int width, int height, int redrawRate, void* cont
egl_init(display, window, width, height);
#ifdef HAVE_VDPAU
else if (ffmpeg_decoder == VDPAU)
vdpau_init_presentation(window, width, height);
vdpau_init_presentation(window, width, height, display_width, display_height);
#endif
x11_input_init(display, window);