2 * VDPAU video output driver
4 * Copyright (C) 2008 NVIDIA
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * \defgroup VDPAU_Presentation VDPAU Presentation
27 * Actual decoding and presentation are implemented here.
28 * All necessary frame information is collected through
29 * the "vdpau_render_state" structure after parsing all headers
30 * etc. in libavcodec for different codecs.
40 #include "video_out.h"
41 #include "video_out_internal.h"
42 #include "x11_common.h"
45 #include "subopt-helper.h"
47 #include "libavcodec/vdpau.h"
49 #include "gui/interface.h"
51 #include "libavutil/common.h"
52 #include "libavutil/mathematics.h"
54 #include "libass/ass.h"
55 #include "libass/ass_mp.h"
57 static vo_info_t info
= {
60 "Rajib Mahapatra <rmahapatra@nvidia.com> and others",
66 #define CHECK_ST_ERROR(message) \
67 if (vdp_st != VDP_STATUS_OK) { \
68 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
69 message, vdp_get_error_string(vdp_st)); \
73 #define CHECK_ST_WARNING(message) \
74 if (vdp_st != VDP_STATUS_OK) \
75 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
76 message, vdp_get_error_string(vdp_st));
78 /* number of video and output surfaces */
79 #define NUM_OUTPUT_SURFACES 2
80 #define MAX_VIDEO_SURFACES 50
82 /* number of palette entries */
83 #define PALETTE_SIZE 256
85 /* Initial maximum number of EOSD surfaces */
86 #define EOSD_SURFACES_INITIAL 512
89 * Global variable declaration - VDPAU specific
92 /* Declaration for all variables of win_x11_init_vdpau_procs() and
93 * win_x11_init_vdpau_flip_queue() functions
95 static VdpDevice vdp_device
;
96 static VdpDeviceCreateX11
*vdp_device_create
;
97 static VdpGetProcAddress
*vdp_get_proc_address
;
99 static VdpPresentationQueueTarget vdp_flip_target
;
100 static VdpPresentationQueue vdp_flip_queue
;
102 static VdpDeviceDestroy
*vdp_device_destroy
;
103 static VdpVideoSurfaceCreate
*vdp_video_surface_create
;
104 static VdpVideoSurfaceDestroy
*vdp_video_surface_destroy
;
106 static VdpGetErrorString
*vdp_get_error_string
;
108 /* May be used in software filtering/postprocessing options
109 * in MPlayer (./mplayer -vf ..) if we copy video_surface data to
112 static VdpVideoSurfacePutBitsYCbCr
*vdp_video_surface_put_bits_y_cb_cr
;
113 static VdpOutputSurfacePutBitsNative
*vdp_output_surface_put_bits_native
;
115 static VdpOutputSurfaceCreate
*vdp_output_surface_create
;
116 static VdpOutputSurfaceDestroy
*vdp_output_surface_destroy
;
118 /* VideoMixer puts video_surface data on displayable output_surface. */
119 static VdpVideoMixerCreate
*vdp_video_mixer_create
;
120 static VdpVideoMixerDestroy
*vdp_video_mixer_destroy
;
121 static VdpVideoMixerRender
*vdp_video_mixer_render
;
122 static VdpVideoMixerSetFeatureEnables
*vdp_video_mixer_set_feature_enables
;
123 static VdpVideoMixerSetAttributeValues
*vdp_video_mixer_set_attribute_values
;
125 static VdpPresentationQueueTargetDestroy
*vdp_presentation_queue_target_destroy
;
126 static VdpPresentationQueueCreate
*vdp_presentation_queue_create
;
127 static VdpPresentationQueueDestroy
*vdp_presentation_queue_destroy
;
128 static VdpPresentationQueueDisplay
*vdp_presentation_queue_display
;
129 static VdpPresentationQueueBlockUntilSurfaceIdle
*vdp_presentation_queue_block_until_surface_idle
;
130 static VdpPresentationQueueTargetCreateX11
*vdp_presentation_queue_target_create_x11
;
132 static VdpOutputSurfaceRenderOutputSurface
*vdp_output_surface_render_output_surface
;
133 static VdpOutputSurfacePutBitsIndexed
*vdp_output_surface_put_bits_indexed
;
134 static VdpOutputSurfaceRenderBitmapSurface
*vdp_output_surface_render_bitmap_surface
;
136 static VdpBitmapSurfaceCreate
*vdp_bitmap_surface_create
;
137 static VdpBitmapSurfaceDestroy
*vdp_bitmap_surface_destroy
;
138 static VdpBitmapSurfacePutBitsNative
*vdp_bitmap_surface_putbits_native
;
140 static VdpDecoderCreate
*vdp_decoder_create
;
141 static VdpDecoderDestroy
*vdp_decoder_destroy
;
142 static VdpDecoderRender
*vdp_decoder_render
;
144 static VdpGenerateCSCMatrix
*vdp_generate_csc_matrix
;
146 static void *vdpau_lib_handle
;
147 /* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */
148 #define osd_surface output_surfaces[NUM_OUTPUT_SURFACES]
149 static VdpOutputSurface output_surfaces
[NUM_OUTPUT_SURFACES
+ 1];
150 static VdpVideoSurface deint_surfaces
[3];
151 static mp_image_t
*deint_mpi
[2];
152 static int output_surface_width
, output_surface_height
;
154 static VdpVideoMixer video_mixer
;
156 static int deint_type
;
157 static int deint_counter
;
158 static int deint_buffer_past_frames
;
160 static float denoise
;
161 static float sharpen
;
162 static int chroma_deint
;
163 static int top_field_first
;
165 static VdpDecoder decoder
;
166 static int decoder_max_refs
;
168 static VdpRect src_rect_vid
;
169 static VdpRect out_rect_vid
;
170 static int border_x
, border_y
;
172 static struct vdpau_render_state surface_render
[MAX_VIDEO_SURFACES
];
173 static int surface_num
;
174 static int vid_surface_num
;
175 static uint32_t vid_width
, vid_height
;
176 static uint32_t image_format
;
177 static VdpChromaType vdp_chroma_type
;
178 static VdpYCbCrFormat vdp_pixel_format
;
181 static unsigned char *index_data
;
182 static int index_data_size
;
183 static uint32_t palette
[PALETTE_SIZE
];
188 VdpBitmapSurface surface
;
194 // List of surfaces to be rendered
196 VdpBitmapSurface surface
;
202 static int eosd_render_count
;
203 static int eosd_surface_count
;
206 static VdpProcamp procamp
;
211 static int visible_buf
;
212 static int int_pause
;
214 static void draw_eosd(void);
216 static void push_deint_surface(VdpVideoSurface surface
)
218 deint_surfaces
[2] = deint_surfaces
[1];
219 deint_surfaces
[1] = deint_surfaces
[0];
220 deint_surfaces
[0] = surface
;
223 static void video_to_output_surface(void)
228 if (vid_surface_num
< 0)
231 if (deint
< 2 || deint_surfaces
[0] == VDP_INVALID_HANDLE
)
232 push_deint_surface(surface_render
[vid_surface_num
].surface
);
234 for (i
= 0; i
<= !!(deint
> 1); i
++) {
235 int field
= VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME
;
236 VdpOutputSurface output_surface
;
243 field
= (top_field_first
== i
) ^ (deint
> 1) ?
244 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD
:
245 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
;
246 output_surface
= output_surfaces
[surface_num
];
247 vdp_st
= vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue
,
250 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
252 vdp_st
= vdp_video_mixer_render(video_mixer
, VDP_INVALID_HANDLE
, 0,
253 field
, 2, deint_surfaces
+ 1,
255 1, &surface_render
[vid_surface_num
].surface
,
258 NULL
, &out_rect_vid
, 0, NULL
);
259 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
260 push_deint_surface(surface_render
[vid_surface_num
].surface
);
264 static void resize(void)
268 struct vo_rect src_rect
;
269 struct vo_rect dst_rect
;
270 struct vo_rect borders
;
271 calc_src_dst_rects(vid_width
, vid_height
, &src_rect
, &dst_rect
, &borders
, NULL
);
272 out_rect_vid
.x0
= dst_rect
.left
;
273 out_rect_vid
.x1
= dst_rect
.right
;
274 out_rect_vid
.y0
= dst_rect
.top
;
275 out_rect_vid
.y1
= dst_rect
.bottom
;
276 src_rect_vid
.x0
= src_rect
.left
;
277 src_rect_vid
.x1
= src_rect
.right
;
278 src_rect_vid
.y0
= src_rect
.top
;
279 src_rect_vid
.y1
= src_rect
.bottom
;
280 border_x
= borders
.left
;
281 border_y
= borders
.top
;
282 #ifdef CONFIG_FREETYPE
283 // adjust font size to display size
286 vo_osd_changed(OSDTYPE_OSD
);
288 if (output_surface_width
< vo_dwidth
|| output_surface_height
< vo_dheight
) {
289 if (output_surface_width
< vo_dwidth
) {
290 output_surface_width
+= output_surface_width
>> 1;
291 output_surface_width
= FFMAX(output_surface_width
, vo_dwidth
);
293 if (output_surface_height
< vo_dheight
) {
294 output_surface_height
+= output_surface_height
>> 1;
295 output_surface_height
= FFMAX(output_surface_height
, vo_dheight
);
297 // Creation of output_surfaces
298 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++) {
299 if (output_surfaces
[i
] != VDP_INVALID_HANDLE
)
300 vdp_output_surface_destroy(output_surfaces
[i
]);
301 vdp_st
= vdp_output_surface_create(vdp_device
, VDP_RGBA_FORMAT_B8G8R8A8
,
302 output_surface_width
, output_surface_height
,
303 &output_surfaces
[i
]);
304 CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
305 mp_msg(MSGT_VO
, MSGL_DBG2
, "OUT CREATE: %u\n", output_surfaces
[i
]);
308 video_to_output_surface();
313 /* Initialize vdp_get_proc_address, called from preinit() */
314 static int win_x11_init_vdpau_procs(void)
318 struct vdp_function
{
323 const struct vdp_function
*dsc
;
325 static const struct vdp_function vdp_func
[] = {
326 {VDP_FUNC_ID_GET_ERROR_STRING
, &vdp_get_error_string
},
327 {VDP_FUNC_ID_DEVICE_DESTROY
, &vdp_device_destroy
},
328 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE
, &vdp_video_surface_create
},
329 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY
, &vdp_video_surface_destroy
},
330 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR
,
331 &vdp_video_surface_put_bits_y_cb_cr
},
332 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE
,
333 &vdp_output_surface_put_bits_native
},
334 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE
, &vdp_output_surface_create
},
335 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY
, &vdp_output_surface_destroy
},
336 {VDP_FUNC_ID_VIDEO_MIXER_CREATE
, &vdp_video_mixer_create
},
337 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY
, &vdp_video_mixer_destroy
},
338 {VDP_FUNC_ID_VIDEO_MIXER_RENDER
, &vdp_video_mixer_render
},
339 {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES
,
340 &vdp_video_mixer_set_feature_enables
},
341 {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES
,
342 &vdp_video_mixer_set_attribute_values
},
343 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY
,
344 &vdp_presentation_queue_target_destroy
},
345 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE
, &vdp_presentation_queue_create
},
346 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY
,
347 &vdp_presentation_queue_destroy
},
348 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY
,
349 &vdp_presentation_queue_display
},
350 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE
,
351 &vdp_presentation_queue_block_until_surface_idle
},
352 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11
,
353 &vdp_presentation_queue_target_create_x11
},
354 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE
,
355 &vdp_output_surface_render_output_surface
},
356 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED
,
357 &vdp_output_surface_put_bits_indexed
},
358 {VDP_FUNC_ID_DECODER_CREATE
, &vdp_decoder_create
},
359 {VDP_FUNC_ID_DECODER_RENDER
, &vdp_decoder_render
},
360 {VDP_FUNC_ID_DECODER_DESTROY
, &vdp_decoder_destroy
},
361 {VDP_FUNC_ID_BITMAP_SURFACE_CREATE
, &vdp_bitmap_surface_create
},
362 {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY
, &vdp_bitmap_surface_destroy
},
363 {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE
,
364 &vdp_bitmap_surface_putbits_native
},
365 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE
,
366 &vdp_output_surface_render_bitmap_surface
},
367 {VDP_FUNC_ID_GENERATE_CSC_MATRIX
, &vdp_generate_csc_matrix
},
371 vdp_st
= vdp_device_create(mDisplay
, mScreen
,
372 &vdp_device
, &vdp_get_proc_address
);
373 if (vdp_st
!= VDP_STATUS_OK
) {
374 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st
);
378 vdp_get_error_string
= NULL
;
379 for (dsc
= vdp_func
; dsc
->pointer
; dsc
++) {
380 vdp_st
= vdp_get_proc_address(vdp_device
, dsc
->id
, dsc
->pointer
);
381 if (vdp_st
!= VDP_STATUS_OK
) {
382 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", dsc
->id
, vdp_get_error_string
? vdp_get_error_string(vdp_st
) : "?");
389 /* Initialize vdpau_flip_queue, called from config() */
390 static int win_x11_init_vdpau_flip_queue(void)
394 vdp_st
= vdp_presentation_queue_target_create_x11(vdp_device
, vo_window
,
396 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
398 vdp_st
= vdp_presentation_queue_create(vdp_device
, vdp_flip_target
,
400 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
405 static int create_vdp_mixer(VdpChromaType vdp_chroma_type
) {
406 #define VDP_NUM_MIXER_PARAMETER 3
407 #define MAX_NUM_FEATURES 5
410 int feature_count
= 0;
411 VdpVideoMixerFeature features
[MAX_NUM_FEATURES
];
412 VdpBool feature_enables
[MAX_NUM_FEATURES
];
413 static const VdpVideoMixerAttribute denoise_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL
};
414 const void * const denoise_value
[] = {&denoise
};
415 static const VdpVideoMixerAttribute sharpen_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL
};
416 const void * const sharpen_value
[] = {&sharpen
};
417 static const VdpVideoMixerAttribute skip_chroma_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE
};
418 const uint8_t skip_chroma_value
= 1;
419 const void * const skip_chroma_value_ptr
[] = {&skip_chroma_value
};
420 static const VdpVideoMixerParameter parameters
[VDP_NUM_MIXER_PARAMETER
] = {
421 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH
,
422 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT
,
423 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE
425 const void *const parameter_values
[VDP_NUM_MIXER_PARAMETER
] = {
430 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL
;
432 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL
;
434 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE
;
436 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION
;
438 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS
;
440 vdp_st
= vdp_video_mixer_create(vdp_device
, feature_count
, features
,
441 VDP_NUM_MIXER_PARAMETER
,
442 parameters
, parameter_values
,
444 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create")
446 for (i
= 0; i
< feature_count
; i
++) feature_enables
[i
] = VDP_TRUE
;
448 feature_enables
[0] = VDP_FALSE
;
450 vdp_video_mixer_set_feature_enables(video_mixer
, feature_count
, features
, feature_enables
);
452 vdp_video_mixer_set_attribute_values(video_mixer
, 1, denoise_attrib
, denoise_value
);
454 vdp_video_mixer_set_attribute_values(video_mixer
, 1, sharpen_attrib
, sharpen_value
);
456 vdp_video_mixer_set_attribute_values(video_mixer
, 1, skip_chroma_attrib
, skip_chroma_value_ptr
);
461 // Free everything specific to a certain video file
462 static void free_video_specific(void) {
466 if (decoder
!= VDP_INVALID_HANDLE
)
467 vdp_decoder_destroy(decoder
);
468 decoder
= VDP_INVALID_HANDLE
;
469 decoder_max_refs
= -1;
471 for (i
= 0; i
< 3; i
++)
472 deint_surfaces
[i
] = VDP_INVALID_HANDLE
;
474 for (i
= 0; i
< 2; i
++)
476 deint_mpi
[i
]->usage_count
--;
480 for (i
= 0; i
< MAX_VIDEO_SURFACES
; i
++) {
481 if (surface_render
[i
].surface
!= VDP_INVALID_HANDLE
) {
482 vdp_st
= vdp_video_surface_destroy(surface_render
[i
].surface
);
483 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
485 surface_render
[i
].surface
= VDP_INVALID_HANDLE
;
488 if (video_mixer
!= VDP_INVALID_HANDLE
) {
489 vdp_st
= vdp_video_mixer_destroy(video_mixer
);
490 CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
492 video_mixer
= VDP_INVALID_HANDLE
;
495 static int create_vdp_decoder(int max_refs
)
498 VdpDecoderProfile vdp_decoder_profile
;
499 if (decoder
!= VDP_INVALID_HANDLE
)
500 vdp_decoder_destroy(decoder
);
501 switch (image_format
) {
502 case IMGFMT_VDPAU_MPEG1
:
503 vdp_decoder_profile
= VDP_DECODER_PROFILE_MPEG1
;
505 case IMGFMT_VDPAU_MPEG2
:
506 vdp_decoder_profile
= VDP_DECODER_PROFILE_MPEG2_MAIN
;
508 case IMGFMT_VDPAU_H264
:
509 vdp_decoder_profile
= VDP_DECODER_PROFILE_H264_HIGH
;
510 mp_msg(MSGT_VO
, MSGL_V
, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs
);
512 case IMGFMT_VDPAU_WMV3
:
513 vdp_decoder_profile
= VDP_DECODER_PROFILE_VC1_MAIN
;
515 case IMGFMT_VDPAU_VC1
:
516 vdp_decoder_profile
= VDP_DECODER_PROFILE_VC1_ADVANCED
;
519 vdp_st
= vdp_decoder_create(vdp_device
, vdp_decoder_profile
,
520 vid_width
, vid_height
, max_refs
, &decoder
);
521 CHECK_ST_WARNING("Failed creating VDPAU decoder");
522 if (vdp_st
!= VDP_STATUS_OK
) {
523 decoder
= VDP_INVALID_HANDLE
;
524 decoder_max_refs
= 0;
527 decoder_max_refs
= max_refs
;
532 * connect to X server, create and map window, initialize all
533 * VDPAU objects, create different surfaces etc.
535 static int config(uint32_t width
, uint32_t height
, uint32_t d_width
,
536 uint32_t d_height
, uint32_t flags
, char *title
,
540 XSetWindowAttributes xswa
;
541 XWindowAttributes attribs
;
542 unsigned long xswamask
;
546 int vm
= flags
& VOFLAG_MODESWITCHING
;
549 image_format
= format
;
552 free_video_specific();
553 if (IMGFMT_IS_VDPAU(image_format
) && !create_vdp_decoder(2))
561 guiGetEvent(guiSetShVideo
, 0); // the GUI will set up / resize our window
570 XGetWindowAttributes(mDisplay
, DefaultRootWindow(mDisplay
), &attribs
);
571 depth
= attribs
.depth
;
572 if (depth
!= 15 && depth
!= 16 && depth
!= 24 && depth
!= 32)
574 XMatchVisualInfo(mDisplay
, mScreen
, depth
, TrueColor
, &vinfo
);
576 xswa
.background_pixel
= 0;
577 xswa
.border_pixel
= 0;
578 xswamask
= CWBackPixel
| CWBorderPixel
;
580 vo_x11_create_vo_window(&vinfo
, vo_dx
, vo_dy
, d_width
, d_height
,
581 flags
, CopyFromParent
, "vdpau", title
);
582 XChangeWindowAttributes(mDisplay
, vo_window
, xswamask
, &xswa
);
586 /* Grab the mouse pointer in our window */
588 XGrabPointer(mDisplay
, vo_window
, True
, 0,
589 GrabModeAsync
, GrabModeAsync
,
590 vo_window
, None
, CurrentTime
);
591 XSetInputFocus(mDisplay
, vo_window
, RevertToNone
, CurrentTime
);
596 if ((flags
& VOFLAG_FULLSCREEN
) && WinID
<= 0)
599 /* -----VDPAU related code here -------- */
600 if (vdp_flip_queue
== VDP_INVALID_HANDLE
&& win_x11_init_vdpau_flip_queue())
603 vdp_chroma_type
= VDP_CHROMA_TYPE_420
;
604 switch (image_format
) {
608 vdp_pixel_format
= VDP_YCBCR_FORMAT_YV12
;
611 vdp_pixel_format
= VDP_YCBCR_FORMAT_NV12
;
614 vdp_pixel_format
= VDP_YCBCR_FORMAT_YUYV
;
615 vdp_chroma_type
= VDP_CHROMA_TYPE_422
;
618 vdp_pixel_format
= VDP_YCBCR_FORMAT_UYVY
;
619 vdp_chroma_type
= VDP_CHROMA_TYPE_422
;
621 if (create_vdp_mixer(vdp_chroma_type
))
625 vid_surface_num
= -1;
631 static void check_events(void)
633 int e
= vo_x11_check_events(mDisplay
);
635 if (e
& VO_EVENT_RESIZE
)
638 if ((e
& VO_EVENT_EXPOSE
|| e
& VO_EVENT_RESIZE
) && int_pause
) {
639 /* did we already draw a buffer */
641 /* redraw the last visible buffer */
643 vdp_st
= vdp_presentation_queue_display(vdp_flip_queue
,
644 output_surfaces
[surface_num
],
645 vo_dwidth
, vo_dheight
,
647 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
652 static void draw_osd_I8A8(int x0
,int y0
, int w
,int h
, unsigned char *src
,
653 unsigned char *srca
, int stride
)
655 VdpOutputSurface output_surface
= output_surfaces
[surface_num
];
659 int index_data_size_required
;
660 VdpRect output_indexed_rect_vid
;
661 VdpOutputSurfaceRenderBlendState blend_state
;
666 index_data_size_required
= 2*w
*h
;
667 if (index_data_size
< index_data_size_required
) {
668 index_data
= realloc(index_data
, index_data_size_required
);
669 index_data_size
= index_data_size_required
;
672 // index_data creation, component order - I, A, I, A, .....
673 for (i
= 0; i
< h
; i
++)
674 for (j
= 0; j
< w
; j
++) {
675 index_data
[i
*2*w
+ j
*2] = src
[i
*stride
+j
];
676 index_data
[i
*2*w
+ j
*2 + 1] = -srca
[i
*stride
+j
];
679 output_indexed_rect_vid
.x0
= x0
;
680 output_indexed_rect_vid
.y0
= y0
;
681 output_indexed_rect_vid
.x1
= x0
+ w
;
682 output_indexed_rect_vid
.y1
= y0
+ h
;
686 // write source_data to osd_surface.
687 vdp_st
= vdp_output_surface_put_bits_indexed(osd_surface
,
688 VDP_INDEXED_FORMAT_I8A8
,
689 (const void *const*)&index_data
,
691 &output_indexed_rect_vid
,
692 VDP_COLOR_TABLE_FORMAT_B8G8R8X8
,
694 CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
696 blend_state
.struct_version
= VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION
;
697 blend_state
.blend_factor_source_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
698 blend_state
.blend_factor_source_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
699 blend_state
.blend_factor_destination_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
700 blend_state
.blend_factor_destination_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
701 blend_state
.blend_equation_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
702 blend_state
.blend_equation_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
704 vdp_st
= vdp_output_surface_render_output_surface(output_surface
,
705 &output_indexed_rect_vid
,
707 &output_indexed_rect_vid
,
710 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
);
711 CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
714 static void draw_eosd(void) {
716 VdpOutputSurface output_surface
= output_surfaces
[surface_num
];
717 VdpOutputSurfaceRenderBlendState blend_state
;
720 blend_state
.struct_version
= VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION
;
721 blend_state
.blend_factor_source_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA
;
722 blend_state
.blend_factor_source_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
723 blend_state
.blend_factor_destination_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
724 blend_state
.blend_factor_destination_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA
;
725 blend_state
.blend_equation_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
726 blend_state
.blend_equation_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
728 for (i
=0; i
<eosd_render_count
; i
++) {
729 vdp_st
= vdp_output_surface_render_bitmap_surface(
730 output_surface
, &eosd_targets
[i
].dest
,
731 eosd_targets
[i
].surface
, &eosd_targets
[i
].source
,
732 &eosd_targets
[i
].color
, &blend_state
,
733 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
);
734 CHECK_ST_WARNING("EOSD: Error when rendering")
738 static void generate_eosd(mp_eosd_images_t
*imgs
) {
742 ass_image_t
*img
= imgs
->imgs
;
745 // Nothing changed, no need to redraw
746 if (imgs
->changed
== 0)
748 eosd_render_count
= 0;
749 // There's nothing to render!
753 if (imgs
->changed
== 1)
754 goto eosd_skip_upload
;
756 for (j
=0; j
<eosd_surface_count
; j
++)
757 eosd_surfaces
[j
].in_use
= 0;
759 for (i
= img
; i
; i
= i
->next
) {
760 // Try to reuse a suitable surface
762 for (j
=0; j
<eosd_surface_count
; j
++) {
763 if (eosd_surfaces
[j
].surface
!= VDP_INVALID_HANDLE
&& !eosd_surfaces
[j
].in_use
&&
764 eosd_surfaces
[j
].w
>= i
->w
&& eosd_surfaces
[j
].h
>= i
->h
) {
769 // None found, allocate a new surface
771 for (j
=0; j
<eosd_surface_count
; j
++) {
772 if (!eosd_surfaces
[j
].in_use
) {
773 if (eosd_surfaces
[j
].surface
!= VDP_INVALID_HANDLE
)
774 vdp_bitmap_surface_destroy(eosd_surfaces
[j
].surface
);
779 // Allocate new space for surface/target arrays
781 j
= found
= eosd_surface_count
;
782 eosd_surface_count
= eosd_surface_count
? eosd_surface_count
*2 : EOSD_SURFACES_INITIAL
;
783 eosd_surfaces
= realloc(eosd_surfaces
, eosd_surface_count
* sizeof(*eosd_surfaces
));
784 eosd_targets
= realloc(eosd_targets
, eosd_surface_count
* sizeof(*eosd_targets
));
785 for(j
=found
; j
<eosd_surface_count
; j
++) {
786 eosd_surfaces
[j
].surface
= VDP_INVALID_HANDLE
;
787 eosd_surfaces
[j
].in_use
= 0;
790 vdp_st
= vdp_bitmap_surface_create(vdp_device
, VDP_RGBA_FORMAT_A8
,
791 i
->w
, i
->h
, VDP_TRUE
, &eosd_surfaces
[found
].surface
);
792 CHECK_ST_WARNING("EOSD: error when creating surface")
793 eosd_surfaces
[found
].w
= i
->w
;
794 eosd_surfaces
[found
].h
= i
->h
;
796 eosd_surfaces
[found
].in_use
= 1;
797 eosd_targets
[eosd_render_count
].surface
= eosd_surfaces
[found
].surface
;
802 vdp_st
= vdp_bitmap_surface_putbits_native(eosd_targets
[eosd_render_count
].surface
,
803 (const void *) &i
->bitmap
, &i
->stride
, &destRect
);
804 CHECK_ST_WARNING("EOSD: putbits failed")
809 eosd_render_count
= 0;
810 for (i
= img
; i
; i
= i
->next
) {
811 // Render dest, color, etc.
812 eosd_targets
[eosd_render_count
].color
.alpha
= 1.0 - ((i
->color
>> 0) & 0xff) / 255.0;
813 eosd_targets
[eosd_render_count
].color
.blue
= ((i
->color
>> 8) & 0xff) / 255.0;
814 eosd_targets
[eosd_render_count
].color
.green
= ((i
->color
>> 16) & 0xff) / 255.0;
815 eosd_targets
[eosd_render_count
].color
.red
= ((i
->color
>> 24) & 0xff) / 255.0;
816 eosd_targets
[eosd_render_count
].dest
.x0
= i
->dst_x
;
817 eosd_targets
[eosd_render_count
].dest
.y0
= i
->dst_y
;
818 eosd_targets
[eosd_render_count
].dest
.x1
= i
->w
+ i
->dst_x
;
819 eosd_targets
[eosd_render_count
].dest
.y1
= i
->h
+ i
->dst_y
;
820 eosd_targets
[eosd_render_count
].source
.x0
= 0;
821 eosd_targets
[eosd_render_count
].source
.y0
= 0;
822 eosd_targets
[eosd_render_count
].source
.x1
= i
->w
;
823 eosd_targets
[eosd_render_count
].source
.y1
= i
->h
;
828 static void draw_osd(void)
830 mp_msg(MSGT_VO
, MSGL_DBG2
, "DRAW_OSD\n");
832 vo_draw_text_ext(vo_dwidth
, vo_dheight
, border_x
, border_y
, border_x
, border_y
,
833 vid_width
, vid_height
, draw_osd_I8A8
);
836 static void flip_page(void)
839 mp_msg(MSGT_VO
, MSGL_DBG2
, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
840 surface_render
[vid_surface_num
].surface
, output_surfaces
[surface_num
]);
842 vdp_st
= vdp_presentation_queue_display(vdp_flip_queue
, output_surfaces
[surface_num
],
843 vo_dwidth
, vo_dheight
,
845 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
847 surface_num
= (surface_num
+ 1) % NUM_OUTPUT_SURFACES
;
851 static int draw_slice(uint8_t *image
[], int stride
[], int w
, int h
,
855 struct vdpau_render_state
*rndr
= (struct vdpau_render_state
*)image
[0];
856 int max_refs
= image_format
== IMGFMT_VDPAU_H264
? rndr
->info
.h264
.num_ref_frames
: 2;
857 if (!IMGFMT_IS_VDPAU(image_format
))
859 if ((decoder
== VDP_INVALID_HANDLE
|| decoder_max_refs
< max_refs
)
860 && !create_vdp_decoder(max_refs
))
863 vdp_st
= vdp_decoder_render(decoder
, rndr
->surface
, (void *)&rndr
->info
, rndr
->bitstream_buffers_used
, rndr
->bitstream_buffers
);
864 CHECK_ST_WARNING("Failed VDPAU decoder rendering");
869 static int draw_frame(uint8_t *src
[])
874 static struct vdpau_render_state
*get_surface(int number
)
876 if (number
> MAX_VIDEO_SURFACES
)
878 if (surface_render
[number
].surface
== VDP_INVALID_HANDLE
) {
880 vdp_st
= vdp_video_surface_create(vdp_device
, vdp_chroma_type
,
881 vid_width
, vid_height
,
882 &surface_render
[number
].surface
);
883 CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
884 if (vdp_st
!= VDP_STATUS_OK
)
887 mp_msg(MSGT_VO
, MSGL_DBG2
, "VID CREATE: %u\n", surface_render
[number
].surface
);
888 return &surface_render
[number
];
891 static uint32_t draw_image(mp_image_t
*mpi
)
893 if (IMGFMT_IS_VDPAU(image_format
)) {
894 struct vdpau_render_state
*rndr
= mpi
->priv
;
895 vid_surface_num
= rndr
- surface_render
;
896 if (deint_buffer_past_frames
) {
899 deint_mpi
[1]->usage_count
--;
900 deint_mpi
[1] = deint_mpi
[0];
903 } else if (!(mpi
->flags
& MP_IMGFLAG_DRAW_CALLBACK
)) {
905 void *destdata
[3] = {mpi
->planes
[0], mpi
->planes
[2], mpi
->planes
[1]};
906 struct vdpau_render_state
*rndr
= get_surface(deint_counter
);
907 deint_counter
= (deint_counter
+ 1) % 3;
908 vid_surface_num
= rndr
- surface_render
;
909 if (image_format
== IMGFMT_NV12
)
910 destdata
[1] = destdata
[2];
911 vdp_st
= vdp_video_surface_put_bits_y_cb_cr(rndr
->surface
,
913 (const void *const*)destdata
,
914 mpi
->stride
); // pitch
915 CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
917 if (mpi
->fields
& MP_IMGFIELD_ORDERED
)
918 top_field_first
= !!(mpi
->fields
& MP_IMGFIELD_TOP_FIRST
);
922 video_to_output_surface();
926 static uint32_t get_image(mp_image_t
*mpi
)
928 struct vdpau_render_state
*rndr
;
930 // no dr for non-decoding for now
931 if (!IMGFMT_IS_VDPAU(image_format
)) return VO_FALSE
;
932 if (mpi
->type
!= MP_IMGTYPE_NUMBERED
) return VO_FALSE
;
934 rndr
= get_surface(mpi
->number
);
936 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] no surfaces available in get_image\n");
937 // TODO: this probably breaks things forever, provide a dummy buffer?
940 mpi
->flags
|= MP_IMGFLAG_DIRECT
;
941 mpi
->stride
[0] = mpi
->stride
[1] = mpi
->stride
[2] = 0;
942 mpi
->planes
[0] = mpi
->planes
[1] = mpi
->planes
[2] = NULL
;
943 // hack to get around a check and to avoid a special-case in vd_ffmpeg.c
944 mpi
->planes
[0] = (void *)rndr
;
950 static int query_format(uint32_t format
)
952 int default_flags
= VFCAP_CSP_SUPPORTED
| VFCAP_CSP_SUPPORTED_BY_HW
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
| VFCAP_OSD
| VFCAP_EOSD
| VFCAP_EOSD_UNSCALED
;
960 return default_flags
| VOCAP_NOSLICES
;
961 case IMGFMT_VDPAU_MPEG1
:
962 case IMGFMT_VDPAU_MPEG2
:
963 case IMGFMT_VDPAU_H264
:
964 case IMGFMT_VDPAU_WMV3
:
965 case IMGFMT_VDPAU_VC1
:
966 return default_flags
;
971 static void DestroyVdpauObjects(void)
976 free_video_specific();
978 vdp_st
= vdp_presentation_queue_destroy(vdp_flip_queue
);
979 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
981 vdp_st
= vdp_presentation_queue_target_destroy(vdp_flip_target
);
982 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
984 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++) {
985 vdp_st
= vdp_output_surface_destroy(output_surfaces
[i
]);
986 output_surfaces
[i
] = VDP_INVALID_HANDLE
;
987 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
990 for (i
= 0; i
<eosd_surface_count
; i
++) {
991 if (eosd_surfaces
[i
].surface
!= VDP_INVALID_HANDLE
) {
992 vdp_st
= vdp_bitmap_surface_destroy(eosd_surfaces
[i
].surface
);
993 CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy")
995 eosd_surfaces
[i
].surface
= VDP_INVALID_HANDLE
;
998 vdp_st
= vdp_device_destroy(vdp_device
);
999 CHECK_ST_WARNING("Error when calling vdp_device_destroy")
1002 static void uninit(void)
1004 if (!vo_config_count
)
1008 /* Destroy all vdpau objects */
1009 DestroyVdpauObjects();
1014 free(eosd_surfaces
);
1015 eosd_surfaces
= NULL
;
1017 eosd_targets
= NULL
;
1019 #ifdef CONFIG_XF86VM
1024 dlclose(vdpau_lib_handle
);
1027 static const opt_t subopts
[] = {
1028 {"deint", OPT_ARG_INT
, &deint
, (opt_test_f
)int_non_neg
},
1029 {"chroma-deint", OPT_ARG_BOOL
, &chroma_deint
, NULL
},
1030 {"pullup", OPT_ARG_BOOL
, &pullup
, NULL
},
1031 {"denoise", OPT_ARG_FLOAT
, &denoise
, NULL
},
1032 {"sharpen", OPT_ARG_FLOAT
, &sharpen
, NULL
},
1036 static const char help_msg
[] =
1037 "\n-vo vdpau command line help:\n"
1038 "Example: mplayer -vo vdpau:deint=2\n"
1040 " deint (all modes > 0 respect -field-dominance)\n"
1041 " 0: no deinterlacing\n"
1042 " 1: only show first field\n"
1043 " 2: bob deinterlacing\n"
1044 " 3: temporal deinterlacing (resource-hungry)\n"
1045 " 4: temporal-spatial deinterlacing (very resource-hungry)\n"
1047 " Operate on luma and chroma when using temporal deinterlacing (default)\n"
1048 " Use nochroma-deint to speed up temporal deinterlacing\n"
1050 " Try to apply inverse-telecine (needs temporal deinterlacing)\n"
1052 " Apply denoising, argument is strength from 0.0 to 1.0\n"
1054 " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n"
1057 static int preinit(const char *arg
)
1060 static const char *vdpaulibrary
= "libvdpau.so.1";
1061 static const char *vdpau_device_create
= "vdp_device_create_x11";
1066 deint_buffer_past_frames
= 0;
1067 deint_mpi
[0] = deint_mpi
[1] = NULL
;
1072 if (subopt_parse(arg
, subopts
) != 0) {
1073 mp_msg(MSGT_VO
, MSGL_FATAL
, help_msg
);
1079 deint_buffer_past_frames
= 1;
1081 vdpau_lib_handle
= dlopen(vdpaulibrary
, RTLD_LAZY
);
1082 if (!vdpau_lib_handle
) {
1083 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Could not open dynamic library %s\n",
1087 vdp_device_create
= dlsym(vdpau_lib_handle
, vdpau_device_create
);
1088 if (!vdp_device_create
) {
1089 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Could not find function %s in %s\n",
1090 vdpau_device_create
, vdpaulibrary
);
1093 if (!vo_init() || win_x11_init_vdpau_procs())
1096 decoder
= VDP_INVALID_HANDLE
;
1097 for (i
= 0; i
< MAX_VIDEO_SURFACES
; i
++)
1098 surface_render
[i
].surface
= VDP_INVALID_HANDLE
;
1099 video_mixer
= VDP_INVALID_HANDLE
;
1100 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++)
1101 output_surfaces
[i
] = VDP_INVALID_HANDLE
;
1102 vdp_flip_queue
= VDP_INVALID_HANDLE
;
1103 output_surface_width
= output_surface_height
= -1;
1105 // full grayscale palette.
1106 for (i
= 0; i
< PALETTE_SIZE
; ++i
)
1107 palette
[i
] = (i
<< 16) | (i
<< 8) | i
;
1109 index_data_size
= 0;
1111 eosd_surface_count
= eosd_render_count
= 0;
1112 eosd_surfaces
= NULL
;
1113 eosd_targets
= NULL
;
1115 procamp
.struct_version
= VDP_PROCAMP_VERSION
;
1116 procamp
.brightness
= 0.0;
1117 procamp
.contrast
= 1.0;
1118 procamp
.saturation
= 1.0;
1124 static int get_equalizer(char *name
, int *value
) {
1125 if (!strcasecmp(name
, "brightness"))
1126 *value
= procamp
.brightness
* 100;
1127 else if (!strcasecmp(name
, "contrast"))
1128 *value
= (procamp
.contrast
-1.0) * 100;
1129 else if (!strcasecmp(name
, "saturation"))
1130 *value
= (procamp
.saturation
-1.0) * 100;
1131 else if (!strcasecmp(name
, "hue"))
1132 *value
= procamp
.hue
* 100 / M_PI
;
1138 static int set_equalizer(char *name
, int value
) {
1140 VdpCSCMatrix matrix
;
1141 static const VdpVideoMixerAttribute attributes
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX
};
1142 const void *attribute_values
[] = {&matrix
};
1144 if (!strcasecmp(name
, "brightness"))
1145 procamp
.brightness
= value
/ 100.0;
1146 else if (!strcasecmp(name
, "contrast"))
1147 procamp
.contrast
= value
/ 100.0 + 1.0;
1148 else if (!strcasecmp(name
, "saturation"))
1149 procamp
.saturation
= value
/ 100.0 + 1.0;
1150 else if (!strcasecmp(name
, "hue"))
1151 procamp
.hue
= value
/ 100.0 * M_PI
;
1155 vdp_st
= vdp_generate_csc_matrix(&procamp
, VDP_COLOR_STANDARD_ITUR_BT_601
,
1157 CHECK_ST_WARNING("Error when generating CSC matrix")
1158 vdp_st
= vdp_video_mixer_set_attribute_values(video_mixer
, 1, attributes
,
1160 CHECK_ST_WARNING("Error when setting CSC matrix")
1164 static int control(uint32_t request
, void *data
, ...)
1167 case VOCTRL_GET_DEINTERLACE
:
1168 *(int*)data
= deint
;
1170 case VOCTRL_SET_DEINTERLACE
:
1171 deint
= *(int*)data
;
1174 if (deint_type
> 2) {
1176 VdpVideoMixerFeature features
[1] =
1178 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL
:
1179 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL
};
1180 VdpBool feature_enables
[1] = {deint
? VDP_TRUE
: VDP_FALSE
};
1181 vdp_st
= vdp_video_mixer_set_feature_enables(video_mixer
, 1,
1184 CHECK_ST_WARNING("Error changing deinterlacing settings")
1185 deint_buffer_past_frames
= 1;
1189 return (int_pause
= 1);
1191 return (int_pause
= 0);
1192 case VOCTRL_QUERY_FORMAT
:
1193 return query_format(*(uint32_t *)data
);
1194 case VOCTRL_GET_IMAGE
:
1195 return get_image(data
);
1196 case VOCTRL_DRAW_IMAGE
:
1197 return draw_image(data
);
1198 case VOCTRL_GUISUPPORT
:
1204 case VOCTRL_FULLSCREEN
:
1205 vo_x11_fullscreen();
1208 case VOCTRL_GET_PANSCAN
:
1210 case VOCTRL_SET_PANSCAN
:
1213 case VOCTRL_SET_EQUALIZER
: {
1218 value
= va_arg(ap
, int);
1221 return set_equalizer(data
, value
);
1223 case VOCTRL_GET_EQUALIZER
: {
1228 value
= va_arg(ap
, int *);
1231 return get_equalizer(data
, value
);
1236 case VOCTRL_UPDATE_SCREENINFO
:
1237 update_xinerama_info();
1239 case VOCTRL_DRAW_EOSD
:
1242 generate_eosd(data
);
1245 case VOCTRL_GET_EOSD_RES
: {
1246 mp_eosd_res_t
*r
= data
;
1247 r
->mt
= r
->mb
= r
->ml
= r
->mr
= 0;
1249 r
->w
= vo_screenwidth
;
1250 r
->h
= vo_screenheight
;
1251 r
->ml
= r
->mr
= border_x
;
1252 r
->mt
= r
->mb
= border_y
;