From 0ea71fc6357d6fb2a13305647710c6c680d1f4c1 Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Sat, 10 Jun 2017 20:36:42 +0200 Subject: [PATCH] Fix fullscreen for VDPAU --- src/video/ffmpeg_vdpau.c | 4 ++-- src/video/ffmpeg_vdpau.h | 2 +- src/video/x11.c | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/video/ffmpeg_vdpau.c b/src/video/ffmpeg_vdpau.c index 8307700..3660e6b 100644 --- a/src/video/ffmpeg_vdpau.c +++ b/src/video/ffmpeg_vdpau.c @@ -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) diff --git a/src/video/ffmpeg_vdpau.h b/src/video/ffmpeg_vdpau.h index 4507e9a..f28a61b 100644 --- a/src/video/ffmpeg_vdpau.h +++ b/src/video/ffmpeg_vdpau.h @@ -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); diff --git a/src/video/x11.c b/src/video/x11.c index a6ab3e0..c46e097 100644 --- a/src/video/x11.c +++ b/src/video/x11.c @@ -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);