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"
46 #include "font_load.h"
48 #include "libavcodec/vdpau.h"
50 #include "libavutil/common.h"
51 #include "libavutil/mathematics.h"
53 #include "libass/ass.h"
54 #include "libass/ass_mp.h"
56 static vo_info_t info
= {
59 "Rajib Mahapatra <rmahapatra@nvidia.com> and others",
65 #define CHECK_ST_ERROR(message) \
66 if (vdp_st != VDP_STATUS_OK) { \
67 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
68 message, vdp_get_error_string(vdp_st)); \
72 #define CHECK_ST_WARNING(message) \
73 if (vdp_st != VDP_STATUS_OK) \
74 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
75 message, vdp_get_error_string(vdp_st));
77 /* number of video and output surfaces */
78 #define NUM_OUTPUT_SURFACES 2
79 #define MAX_VIDEO_SURFACES 50
81 /* number of palette entries */
82 #define PALETTE_SIZE 256
84 /* Initial maximum number of EOSD surfaces */
85 #define EOSD_SURFACES_INITIAL 512
88 * Global variable declaration - VDPAU specific
91 /* Declaration for all variables of win_x11_init_vdpau_procs() and
92 * win_x11_init_vdpau_flip_queue() functions
94 static VdpDevice vdp_device
;
95 static VdpDeviceCreateX11
*vdp_device_create
;
96 static VdpGetProcAddress
*vdp_get_proc_address
;
98 static VdpPresentationQueueTarget vdp_flip_target
;
99 static VdpPresentationQueue vdp_flip_queue
;
101 static VdpDeviceDestroy
*vdp_device_destroy
;
102 static VdpVideoSurfaceCreate
*vdp_video_surface_create
;
103 static VdpVideoSurfaceDestroy
*vdp_video_surface_destroy
;
105 static VdpGetErrorString
*vdp_get_error_string
;
107 /* May be used in software filtering/postprocessing options
108 * in MPlayer (./mplayer -vf ..) if we copy video_surface data to
111 static VdpVideoSurfacePutBitsYCbCr
*vdp_video_surface_put_bits_y_cb_cr
;
112 static VdpOutputSurfacePutBitsNative
*vdp_output_surface_put_bits_native
;
114 static VdpOutputSurfaceCreate
*vdp_output_surface_create
;
115 static VdpOutputSurfaceDestroy
*vdp_output_surface_destroy
;
117 /* VideoMixer puts video_surface data on displayable output_surface. */
118 static VdpVideoMixerCreate
*vdp_video_mixer_create
;
119 static VdpVideoMixerDestroy
*vdp_video_mixer_destroy
;
120 static VdpVideoMixerRender
*vdp_video_mixer_render
;
121 static VdpVideoMixerSetFeatureEnables
*vdp_video_mixer_set_feature_enables
;
122 static VdpVideoMixerSetAttributeValues
*vdp_video_mixer_set_attribute_values
;
124 static VdpPresentationQueueTargetDestroy
*vdp_presentation_queue_target_destroy
;
125 static VdpPresentationQueueCreate
*vdp_presentation_queue_create
;
126 static VdpPresentationQueueDestroy
*vdp_presentation_queue_destroy
;
127 static VdpPresentationQueueDisplay
*vdp_presentation_queue_display
;
128 static VdpPresentationQueueBlockUntilSurfaceIdle
*vdp_presentation_queue_block_until_surface_idle
;
129 static VdpPresentationQueueTargetCreateX11
*vdp_presentation_queue_target_create_x11
;
131 static VdpOutputSurfaceRenderOutputSurface
*vdp_output_surface_render_output_surface
;
132 static VdpOutputSurfacePutBitsIndexed
*vdp_output_surface_put_bits_indexed
;
133 static VdpOutputSurfaceRenderBitmapSurface
*vdp_output_surface_render_bitmap_surface
;
135 static VdpBitmapSurfaceCreate
*vdp_bitmap_surface_create
;
136 static VdpBitmapSurfaceDestroy
*vdp_bitmap_surface_destroy
;
137 static VdpBitmapSurfacePutBitsNative
*vdp_bitmap_surface_putbits_native
;
139 static VdpDecoderCreate
*vdp_decoder_create
;
140 static VdpDecoderDestroy
*vdp_decoder_destroy
;
141 static VdpDecoderRender
*vdp_decoder_render
;
143 static VdpGenerateCSCMatrix
*vdp_generate_csc_matrix
;
145 static void *vdpau_lib_handle
;
146 /* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */
147 #define osd_surface output_surfaces[NUM_OUTPUT_SURFACES]
148 static VdpOutputSurface output_surfaces
[NUM_OUTPUT_SURFACES
+ 1];
149 static VdpVideoSurface deint_surfaces
[3];
150 static mp_image_t
*deint_mpi
[2];
151 static int output_surface_width
, output_surface_height
;
153 static VdpVideoMixer video_mixer
;
155 static int deint_type
;
156 static int deint_counter
;
157 static int deint_buffer_past_frames
;
159 static float denoise
;
160 static float sharpen
;
161 static int chroma_deint
;
162 static int top_field_first
;
164 static VdpDecoder decoder
;
165 static int decoder_max_refs
;
167 static VdpRect src_rect_vid
;
168 static VdpRect out_rect_vid
;
169 static int border_x
, border_y
;
171 static struct vdpau_render_state surface_render
[MAX_VIDEO_SURFACES
];
172 static int surface_num
;
173 static int vid_surface_num
;
174 static uint32_t vid_width
, vid_height
;
175 static uint32_t image_format
;
176 static VdpChromaType vdp_chroma_type
;
177 static VdpYCbCrFormat vdp_pixel_format
;
180 static unsigned char *index_data
;
181 static int index_data_size
;
182 static uint32_t palette
[PALETTE_SIZE
];
187 VdpBitmapSurface surface
;
193 // List of surfaces to be rendered
195 VdpBitmapSurface surface
;
201 static int eosd_render_count
;
202 static int eosd_surface_count
;
205 static VdpProcamp procamp
;
210 static int visible_buf
;
211 static int int_pause
;
213 static void draw_eosd(void);
215 static void push_deint_surface(VdpVideoSurface surface
)
217 deint_surfaces
[2] = deint_surfaces
[1];
218 deint_surfaces
[1] = deint_surfaces
[0];
219 deint_surfaces
[0] = surface
;
222 static void video_to_output_surface(void)
227 if (vid_surface_num
< 0)
230 if (deint
< 2 || deint_surfaces
[0] == VDP_INVALID_HANDLE
)
231 push_deint_surface(surface_render
[vid_surface_num
].surface
);
233 for (i
= 0; i
<= !!(deint
> 1); i
++) {
234 int field
= VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME
;
235 VdpOutputSurface output_surface
;
242 field
= (top_field_first
== i
) ^ (deint
> 1) ?
243 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD
:
244 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
;
245 output_surface
= output_surfaces
[surface_num
];
246 vdp_st
= vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue
,
249 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
251 vdp_st
= vdp_video_mixer_render(video_mixer
, VDP_INVALID_HANDLE
, 0,
252 field
, 2, deint_surfaces
+ 1,
254 1, &surface_render
[vid_surface_num
].surface
,
257 NULL
, &out_rect_vid
, 0, NULL
);
258 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
259 push_deint_surface(surface_render
[vid_surface_num
].surface
);
263 static void resize(void)
267 struct vo_rect src_rect
;
268 struct vo_rect dst_rect
;
269 struct vo_rect borders
;
270 calc_src_dst_rects(vid_width
, vid_height
, &src_rect
, &dst_rect
, &borders
, NULL
);
271 out_rect_vid
.x0
= dst_rect
.left
;
272 out_rect_vid
.x1
= dst_rect
.right
;
273 out_rect_vid
.y0
= dst_rect
.top
;
274 out_rect_vid
.y1
= dst_rect
.bottom
;
275 src_rect_vid
.x0
= src_rect
.left
;
276 src_rect_vid
.x1
= src_rect
.right
;
277 src_rect_vid
.y0
= src_rect
.top
;
278 src_rect_vid
.y1
= src_rect
.bottom
;
279 border_x
= borders
.left
;
280 border_y
= borders
.top
;
281 #ifdef CONFIG_FREETYPE
282 // adjust font size to display size
285 vo_osd_changed(OSDTYPE_OSD
);
287 if (output_surface_width
< vo_dwidth
|| output_surface_height
< vo_dheight
) {
288 if (output_surface_width
< vo_dwidth
) {
289 output_surface_width
+= output_surface_width
>> 1;
290 output_surface_width
= FFMAX(output_surface_width
, vo_dwidth
);
292 if (output_surface_height
< vo_dheight
) {
293 output_surface_height
+= output_surface_height
>> 1;
294 output_surface_height
= FFMAX(output_surface_height
, vo_dheight
);
296 // Creation of output_surfaces
297 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++) {
298 if (output_surfaces
[i
] != VDP_INVALID_HANDLE
)
299 vdp_output_surface_destroy(output_surfaces
[i
]);
300 vdp_st
= vdp_output_surface_create(vdp_device
, VDP_RGBA_FORMAT_B8G8R8A8
,
301 output_surface_width
, output_surface_height
,
302 &output_surfaces
[i
]);
303 CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
304 mp_msg(MSGT_VO
, MSGL_DBG2
, "OUT CREATE: %u\n", output_surfaces
[i
]);
307 video_to_output_surface();
312 /* Initialize vdp_get_proc_address, called from preinit() */
313 static int win_x11_init_vdpau_procs(void)
317 struct vdp_function
{
322 const struct vdp_function
*dsc
;
324 static const struct vdp_function vdp_func
[] = {
325 {VDP_FUNC_ID_GET_ERROR_STRING
, &vdp_get_error_string
},
326 {VDP_FUNC_ID_DEVICE_DESTROY
, &vdp_device_destroy
},
327 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE
, &vdp_video_surface_create
},
328 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY
, &vdp_video_surface_destroy
},
329 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR
,
330 &vdp_video_surface_put_bits_y_cb_cr
},
331 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE
,
332 &vdp_output_surface_put_bits_native
},
333 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE
, &vdp_output_surface_create
},
334 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY
, &vdp_output_surface_destroy
},
335 {VDP_FUNC_ID_VIDEO_MIXER_CREATE
, &vdp_video_mixer_create
},
336 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY
, &vdp_video_mixer_destroy
},
337 {VDP_FUNC_ID_VIDEO_MIXER_RENDER
, &vdp_video_mixer_render
},
338 {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES
,
339 &vdp_video_mixer_set_feature_enables
},
340 {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES
,
341 &vdp_video_mixer_set_attribute_values
},
342 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY
,
343 &vdp_presentation_queue_target_destroy
},
344 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE
, &vdp_presentation_queue_create
},
345 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY
,
346 &vdp_presentation_queue_destroy
},
347 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY
,
348 &vdp_presentation_queue_display
},
349 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE
,
350 &vdp_presentation_queue_block_until_surface_idle
},
351 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11
,
352 &vdp_presentation_queue_target_create_x11
},
353 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE
,
354 &vdp_output_surface_render_output_surface
},
355 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED
,
356 &vdp_output_surface_put_bits_indexed
},
357 {VDP_FUNC_ID_DECODER_CREATE
, &vdp_decoder_create
},
358 {VDP_FUNC_ID_DECODER_RENDER
, &vdp_decoder_render
},
359 {VDP_FUNC_ID_DECODER_DESTROY
, &vdp_decoder_destroy
},
360 {VDP_FUNC_ID_BITMAP_SURFACE_CREATE
, &vdp_bitmap_surface_create
},
361 {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY
, &vdp_bitmap_surface_destroy
},
362 {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE
,
363 &vdp_bitmap_surface_putbits_native
},
364 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE
,
365 &vdp_output_surface_render_bitmap_surface
},
366 {VDP_FUNC_ID_GENERATE_CSC_MATRIX
, &vdp_generate_csc_matrix
},
370 vdp_st
= vdp_device_create(mDisplay
, mScreen
,
371 &vdp_device
, &vdp_get_proc_address
);
372 if (vdp_st
!= VDP_STATUS_OK
) {
373 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st
);
377 vdp_get_error_string
= NULL
;
378 for (dsc
= vdp_func
; dsc
->pointer
; dsc
++) {
379 vdp_st
= vdp_get_proc_address(vdp_device
, dsc
->id
, dsc
->pointer
);
380 if (vdp_st
!= VDP_STATUS_OK
) {
381 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
) : "?");
388 /* Initialize vdpau_flip_queue, called from config() */
389 static int win_x11_init_vdpau_flip_queue(void)
393 vdp_st
= vdp_presentation_queue_target_create_x11(vdp_device
, vo_window
,
395 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
397 vdp_st
= vdp_presentation_queue_create(vdp_device
, vdp_flip_target
,
399 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
404 static int create_vdp_mixer(VdpChromaType vdp_chroma_type
) {
405 #define VDP_NUM_MIXER_PARAMETER 3
406 #define MAX_NUM_FEATURES 5
409 int feature_count
= 0;
410 VdpVideoMixerFeature features
[MAX_NUM_FEATURES
];
411 VdpBool feature_enables
[MAX_NUM_FEATURES
];
412 static const VdpVideoMixerAttribute denoise_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL
};
413 const void * const denoise_value
[] = {&denoise
};
414 static const VdpVideoMixerAttribute sharpen_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL
};
415 const void * const sharpen_value
[] = {&sharpen
};
416 static const VdpVideoMixerAttribute skip_chroma_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE
};
417 const uint8_t skip_chroma_value
= 1;
418 const void * const skip_chroma_value_ptr
[] = {&skip_chroma_value
};
419 static const VdpVideoMixerParameter parameters
[VDP_NUM_MIXER_PARAMETER
] = {
420 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH
,
421 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT
,
422 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE
424 const void *const parameter_values
[VDP_NUM_MIXER_PARAMETER
] = {
429 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL
;
431 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL
;
433 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE
;
435 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION
;
437 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS
;
439 vdp_st
= vdp_video_mixer_create(vdp_device
, feature_count
, features
,
440 VDP_NUM_MIXER_PARAMETER
,
441 parameters
, parameter_values
,
443 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create")
445 for (i
= 0; i
< feature_count
; i
++) feature_enables
[i
] = VDP_TRUE
;
447 feature_enables
[0] = VDP_FALSE
;
449 vdp_video_mixer_set_feature_enables(video_mixer
, feature_count
, features
, feature_enables
);
451 vdp_video_mixer_set_attribute_values(video_mixer
, 1, denoise_attrib
, denoise_value
);
453 vdp_video_mixer_set_attribute_values(video_mixer
, 1, sharpen_attrib
, sharpen_value
);
455 vdp_video_mixer_set_attribute_values(video_mixer
, 1, skip_chroma_attrib
, skip_chroma_value_ptr
);
460 // Free everything specific to a certain video file
461 static void free_video_specific(void) {
465 if (decoder
!= VDP_INVALID_HANDLE
)
466 vdp_decoder_destroy(decoder
);
467 decoder
= VDP_INVALID_HANDLE
;
468 decoder_max_refs
= -1;
470 for (i
= 0; i
< 3; i
++)
471 deint_surfaces
[i
] = VDP_INVALID_HANDLE
;
473 for (i
= 0; i
< 2; i
++)
475 deint_mpi
[i
]->usage_count
--;
479 for (i
= 0; i
< MAX_VIDEO_SURFACES
; i
++) {
480 if (surface_render
[i
].surface
!= VDP_INVALID_HANDLE
) {
481 vdp_st
= vdp_video_surface_destroy(surface_render
[i
].surface
);
482 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
484 surface_render
[i
].surface
= VDP_INVALID_HANDLE
;
487 if (video_mixer
!= VDP_INVALID_HANDLE
) {
488 vdp_st
= vdp_video_mixer_destroy(video_mixer
);
489 CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
491 video_mixer
= VDP_INVALID_HANDLE
;
494 static int create_vdp_decoder(int max_refs
)
497 VdpDecoderProfile vdp_decoder_profile
;
498 if (decoder
!= VDP_INVALID_HANDLE
)
499 vdp_decoder_destroy(decoder
);
500 switch (image_format
) {
501 case IMGFMT_VDPAU_MPEG1
:
502 vdp_decoder_profile
= VDP_DECODER_PROFILE_MPEG1
;
504 case IMGFMT_VDPAU_MPEG2
:
505 vdp_decoder_profile
= VDP_DECODER_PROFILE_MPEG2_MAIN
;
507 case IMGFMT_VDPAU_H264
:
508 vdp_decoder_profile
= VDP_DECODER_PROFILE_H264_HIGH
;
509 mp_msg(MSGT_VO
, MSGL_V
, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs
);
511 case IMGFMT_VDPAU_WMV3
:
512 vdp_decoder_profile
= VDP_DECODER_PROFILE_VC1_MAIN
;
514 case IMGFMT_VDPAU_VC1
:
515 vdp_decoder_profile
= VDP_DECODER_PROFILE_VC1_ADVANCED
;
518 vdp_st
= vdp_decoder_create(vdp_device
, vdp_decoder_profile
,
519 vid_width
, vid_height
, max_refs
, &decoder
);
520 CHECK_ST_WARNING("Failed creating VDPAU decoder");
521 if (vdp_st
!= VDP_STATUS_OK
) {
522 decoder
= VDP_INVALID_HANDLE
;
523 decoder_max_refs
= 0;
526 decoder_max_refs
= max_refs
;
531 * connect to X server, create and map window, initialize all
532 * VDPAU objects, create different surfaces etc.
534 static int config(uint32_t width
, uint32_t height
, uint32_t d_width
,
535 uint32_t d_height
, uint32_t flags
, char *title
,
539 XSetWindowAttributes xswa
;
540 XWindowAttributes attribs
;
541 unsigned long xswamask
;
545 int vm
= flags
& VOFLAG_MODESWITCHING
;
548 image_format
= format
;
551 free_video_specific();
552 if (IMGFMT_IS_VDPAU(image_format
) && !create_vdp_decoder(2))
563 XGetWindowAttributes(mDisplay
, DefaultRootWindow(mDisplay
), &attribs
);
564 depth
= attribs
.depth
;
565 if (depth
!= 15 && depth
!= 16 && depth
!= 24 && depth
!= 32)
567 XMatchVisualInfo(mDisplay
, mScreen
, depth
, TrueColor
, &vinfo
);
569 xswa
.background_pixel
= 0;
570 xswa
.border_pixel
= 0;
571 /* Do not use CWBackPixel: It leads to VDPAU errors after
572 aspect ratio changes. */
573 xswamask
= CWBorderPixel
;
575 vo_x11_create_vo_window(&vinfo
, vo_dx
, vo_dy
, d_width
, d_height
,
576 flags
, CopyFromParent
, "vdpau", title
);
577 XChangeWindowAttributes(mDisplay
, vo_window
, xswamask
, &xswa
);
581 /* Grab the mouse pointer in our window */
583 XGrabPointer(mDisplay
, vo_window
, True
, 0,
584 GrabModeAsync
, GrabModeAsync
,
585 vo_window
, None
, CurrentTime
);
586 XSetInputFocus(mDisplay
, vo_window
, RevertToNone
, CurrentTime
);
591 if ((flags
& VOFLAG_FULLSCREEN
) && WinID
<= 0)
594 /* -----VDPAU related code here -------- */
595 if (vdp_flip_queue
== VDP_INVALID_HANDLE
&& win_x11_init_vdpau_flip_queue())
598 vdp_chroma_type
= VDP_CHROMA_TYPE_420
;
599 switch (image_format
) {
603 vdp_pixel_format
= VDP_YCBCR_FORMAT_YV12
;
606 vdp_pixel_format
= VDP_YCBCR_FORMAT_NV12
;
609 vdp_pixel_format
= VDP_YCBCR_FORMAT_YUYV
;
610 vdp_chroma_type
= VDP_CHROMA_TYPE_422
;
613 vdp_pixel_format
= VDP_YCBCR_FORMAT_UYVY
;
614 vdp_chroma_type
= VDP_CHROMA_TYPE_422
;
616 if (create_vdp_mixer(vdp_chroma_type
))
620 vid_surface_num
= -1;
626 static void check_events(void)
628 int e
= vo_x11_check_events(mDisplay
);
630 if (e
& VO_EVENT_RESIZE
)
633 if ((e
& VO_EVENT_EXPOSE
|| e
& VO_EVENT_RESIZE
) && int_pause
) {
634 /* did we already draw a buffer */
636 /* redraw the last visible buffer */
638 vdp_st
= vdp_presentation_queue_display(vdp_flip_queue
,
639 output_surfaces
[surface_num
],
640 vo_dwidth
, vo_dheight
,
642 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
647 static void draw_osd_I8A8(int x0
,int y0
, int w
,int h
, unsigned char *src
,
648 unsigned char *srca
, int stride
)
650 VdpOutputSurface output_surface
= output_surfaces
[surface_num
];
654 int index_data_size_required
;
655 VdpRect output_indexed_rect_vid
;
656 VdpOutputSurfaceRenderBlendState blend_state
;
661 index_data_size_required
= 2*w
*h
;
662 if (index_data_size
< index_data_size_required
) {
663 index_data
= realloc(index_data
, index_data_size_required
);
664 index_data_size
= index_data_size_required
;
667 // index_data creation, component order - I, A, I, A, .....
668 for (i
= 0; i
< h
; i
++)
669 for (j
= 0; j
< w
; j
++) {
670 index_data
[i
*2*w
+ j
*2] = src
[i
*stride
+j
];
671 index_data
[i
*2*w
+ j
*2 + 1] = -srca
[i
*stride
+j
];
674 output_indexed_rect_vid
.x0
= x0
;
675 output_indexed_rect_vid
.y0
= y0
;
676 output_indexed_rect_vid
.x1
= x0
+ w
;
677 output_indexed_rect_vid
.y1
= y0
+ h
;
681 // write source_data to osd_surface.
682 vdp_st
= vdp_output_surface_put_bits_indexed(osd_surface
,
683 VDP_INDEXED_FORMAT_I8A8
,
684 (const void *const*)&index_data
,
686 &output_indexed_rect_vid
,
687 VDP_COLOR_TABLE_FORMAT_B8G8R8X8
,
689 CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
691 blend_state
.struct_version
= VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION
;
692 blend_state
.blend_factor_source_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
693 blend_state
.blend_factor_source_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
694 blend_state
.blend_factor_destination_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
695 blend_state
.blend_factor_destination_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
696 blend_state
.blend_equation_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
697 blend_state
.blend_equation_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
699 vdp_st
= vdp_output_surface_render_output_surface(output_surface
,
700 &output_indexed_rect_vid
,
702 &output_indexed_rect_vid
,
705 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
);
706 CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
709 static void draw_eosd(void) {
711 VdpOutputSurface output_surface
= output_surfaces
[surface_num
];
712 VdpOutputSurfaceRenderBlendState blend_state
;
715 blend_state
.struct_version
= VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION
;
716 blend_state
.blend_factor_source_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA
;
717 blend_state
.blend_factor_source_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
718 blend_state
.blend_factor_destination_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
719 blend_state
.blend_factor_destination_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA
;
720 blend_state
.blend_equation_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
721 blend_state
.blend_equation_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
723 for (i
=0; i
<eosd_render_count
; i
++) {
724 vdp_st
= vdp_output_surface_render_bitmap_surface(
725 output_surface
, &eosd_targets
[i
].dest
,
726 eosd_targets
[i
].surface
, &eosd_targets
[i
].source
,
727 &eosd_targets
[i
].color
, &blend_state
,
728 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
);
729 CHECK_ST_WARNING("EOSD: Error when rendering")
733 static void generate_eosd(mp_eosd_images_t
*imgs
) {
737 ass_image_t
*img
= imgs
->imgs
;
740 // Nothing changed, no need to redraw
741 if (imgs
->changed
== 0)
743 eosd_render_count
= 0;
744 // There's nothing to render!
748 if (imgs
->changed
== 1)
749 goto eosd_skip_upload
;
751 for (j
=0; j
<eosd_surface_count
; j
++)
752 eosd_surfaces
[j
].in_use
= 0;
754 for (i
= img
; i
; i
= i
->next
) {
755 // Try to reuse a suitable surface
757 for (j
=0; j
<eosd_surface_count
; j
++) {
758 if (eosd_surfaces
[j
].surface
!= VDP_INVALID_HANDLE
&& !eosd_surfaces
[j
].in_use
&&
759 eosd_surfaces
[j
].w
>= i
->w
&& eosd_surfaces
[j
].h
>= i
->h
) {
764 // None found, allocate a new surface
766 for (j
=0; j
<eosd_surface_count
; j
++) {
767 if (!eosd_surfaces
[j
].in_use
) {
768 if (eosd_surfaces
[j
].surface
!= VDP_INVALID_HANDLE
)
769 vdp_bitmap_surface_destroy(eosd_surfaces
[j
].surface
);
774 // Allocate new space for surface/target arrays
776 j
= found
= eosd_surface_count
;
777 eosd_surface_count
= eosd_surface_count
? eosd_surface_count
*2 : EOSD_SURFACES_INITIAL
;
778 eosd_surfaces
= realloc(eosd_surfaces
, eosd_surface_count
* sizeof(*eosd_surfaces
));
779 eosd_targets
= realloc(eosd_targets
, eosd_surface_count
* sizeof(*eosd_targets
));
780 for(j
=found
; j
<eosd_surface_count
; j
++) {
781 eosd_surfaces
[j
].surface
= VDP_INVALID_HANDLE
;
782 eosd_surfaces
[j
].in_use
= 0;
785 vdp_st
= vdp_bitmap_surface_create(vdp_device
, VDP_RGBA_FORMAT_A8
,
786 i
->w
, i
->h
, VDP_TRUE
, &eosd_surfaces
[found
].surface
);
787 CHECK_ST_WARNING("EOSD: error when creating surface")
788 eosd_surfaces
[found
].w
= i
->w
;
789 eosd_surfaces
[found
].h
= i
->h
;
791 eosd_surfaces
[found
].in_use
= 1;
792 eosd_targets
[eosd_render_count
].surface
= eosd_surfaces
[found
].surface
;
797 vdp_st
= vdp_bitmap_surface_putbits_native(eosd_targets
[eosd_render_count
].surface
,
798 (const void *) &i
->bitmap
, &i
->stride
, &destRect
);
799 CHECK_ST_WARNING("EOSD: putbits failed")
804 eosd_render_count
= 0;
805 for (i
= img
; i
; i
= i
->next
) {
806 // Render dest, color, etc.
807 eosd_targets
[eosd_render_count
].color
.alpha
= 1.0 - ((i
->color
>> 0) & 0xff) / 255.0;
808 eosd_targets
[eosd_render_count
].color
.blue
= ((i
->color
>> 8) & 0xff) / 255.0;
809 eosd_targets
[eosd_render_count
].color
.green
= ((i
->color
>> 16) & 0xff) / 255.0;
810 eosd_targets
[eosd_render_count
].color
.red
= ((i
->color
>> 24) & 0xff) / 255.0;
811 eosd_targets
[eosd_render_count
].dest
.x0
= i
->dst_x
;
812 eosd_targets
[eosd_render_count
].dest
.y0
= i
->dst_y
;
813 eosd_targets
[eosd_render_count
].dest
.x1
= i
->w
+ i
->dst_x
;
814 eosd_targets
[eosd_render_count
].dest
.y1
= i
->h
+ i
->dst_y
;
815 eosd_targets
[eosd_render_count
].source
.x0
= 0;
816 eosd_targets
[eosd_render_count
].source
.y0
= 0;
817 eosd_targets
[eosd_render_count
].source
.x1
= i
->w
;
818 eosd_targets
[eosd_render_count
].source
.y1
= i
->h
;
823 static void draw_osd(void)
825 mp_msg(MSGT_VO
, MSGL_DBG2
, "DRAW_OSD\n");
827 vo_draw_text_ext(vo_dwidth
, vo_dheight
, border_x
, border_y
, border_x
, border_y
,
828 vid_width
, vid_height
, draw_osd_I8A8
);
831 static void flip_page(void)
834 mp_msg(MSGT_VO
, MSGL_DBG2
, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
835 surface_render
[vid_surface_num
].surface
, output_surfaces
[surface_num
]);
837 vdp_st
= vdp_presentation_queue_display(vdp_flip_queue
, output_surfaces
[surface_num
],
838 vo_dwidth
, vo_dheight
,
840 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
842 surface_num
= (surface_num
+ 1) % NUM_OUTPUT_SURFACES
;
846 static int draw_slice(uint8_t *image
[], int stride
[], int w
, int h
,
850 struct vdpau_render_state
*rndr
= (struct vdpau_render_state
*)image
[0];
851 int max_refs
= image_format
== IMGFMT_VDPAU_H264
? rndr
->info
.h264
.num_ref_frames
: 2;
852 if (!IMGFMT_IS_VDPAU(image_format
))
854 if ((decoder
== VDP_INVALID_HANDLE
|| decoder_max_refs
< max_refs
)
855 && !create_vdp_decoder(max_refs
))
858 vdp_st
= vdp_decoder_render(decoder
, rndr
->surface
, (void *)&rndr
->info
, rndr
->bitstream_buffers_used
, rndr
->bitstream_buffers
);
859 CHECK_ST_WARNING("Failed VDPAU decoder rendering");
864 static int draw_frame(uint8_t *src
[])
869 static struct vdpau_render_state
*get_surface(int number
)
871 if (number
> MAX_VIDEO_SURFACES
)
873 if (surface_render
[number
].surface
== VDP_INVALID_HANDLE
) {
875 vdp_st
= vdp_video_surface_create(vdp_device
, vdp_chroma_type
,
876 vid_width
, vid_height
,
877 &surface_render
[number
].surface
);
878 CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
879 if (vdp_st
!= VDP_STATUS_OK
)
882 mp_msg(MSGT_VO
, MSGL_DBG2
, "VID CREATE: %u\n", surface_render
[number
].surface
);
883 return &surface_render
[number
];
886 static uint32_t draw_image(mp_image_t
*mpi
)
888 if (IMGFMT_IS_VDPAU(image_format
)) {
889 struct vdpau_render_state
*rndr
= mpi
->priv
;
890 vid_surface_num
= rndr
- surface_render
;
891 if (deint_buffer_past_frames
) {
894 deint_mpi
[1]->usage_count
--;
895 deint_mpi
[1] = deint_mpi
[0];
898 } else if (!(mpi
->flags
& MP_IMGFLAG_DRAW_CALLBACK
)) {
900 void *destdata
[3] = {mpi
->planes
[0], mpi
->planes
[2], mpi
->planes
[1]};
901 struct vdpau_render_state
*rndr
= get_surface(deint_counter
);
902 deint_counter
= (deint_counter
+ 1) % 3;
903 vid_surface_num
= rndr
- surface_render
;
904 if (image_format
== IMGFMT_NV12
)
905 destdata
[1] = destdata
[2];
906 vdp_st
= vdp_video_surface_put_bits_y_cb_cr(rndr
->surface
,
908 (const void *const*)destdata
,
909 mpi
->stride
); // pitch
910 CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
912 if (mpi
->fields
& MP_IMGFIELD_ORDERED
)
913 top_field_first
= !!(mpi
->fields
& MP_IMGFIELD_TOP_FIRST
);
917 video_to_output_surface();
921 static uint32_t get_image(mp_image_t
*mpi
)
923 struct vdpau_render_state
*rndr
;
925 // no dr for non-decoding for now
926 if (!IMGFMT_IS_VDPAU(image_format
)) return VO_FALSE
;
927 if (mpi
->type
!= MP_IMGTYPE_NUMBERED
) return VO_FALSE
;
929 rndr
= get_surface(mpi
->number
);
931 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] no surfaces available in get_image\n");
932 // TODO: this probably breaks things forever, provide a dummy buffer?
935 mpi
->flags
|= MP_IMGFLAG_DIRECT
;
936 mpi
->stride
[0] = mpi
->stride
[1] = mpi
->stride
[2] = 0;
937 mpi
->planes
[0] = mpi
->planes
[1] = mpi
->planes
[2] = NULL
;
938 // hack to get around a check and to avoid a special-case in vd_ffmpeg.c
939 mpi
->planes
[0] = (void *)rndr
;
945 static int query_format(uint32_t format
)
947 int default_flags
= VFCAP_CSP_SUPPORTED
| VFCAP_CSP_SUPPORTED_BY_HW
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
| VFCAP_OSD
| VFCAP_EOSD
| VFCAP_EOSD_UNSCALED
;
955 return default_flags
| VOCAP_NOSLICES
;
956 case IMGFMT_VDPAU_MPEG1
:
957 case IMGFMT_VDPAU_MPEG2
:
958 case IMGFMT_VDPAU_H264
:
959 case IMGFMT_VDPAU_WMV3
:
960 case IMGFMT_VDPAU_VC1
:
961 return default_flags
;
966 static void DestroyVdpauObjects(void)
971 free_video_specific();
973 vdp_st
= vdp_presentation_queue_destroy(vdp_flip_queue
);
974 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
976 vdp_st
= vdp_presentation_queue_target_destroy(vdp_flip_target
);
977 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
979 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++) {
980 vdp_st
= vdp_output_surface_destroy(output_surfaces
[i
]);
981 output_surfaces
[i
] = VDP_INVALID_HANDLE
;
982 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
985 for (i
= 0; i
<eosd_surface_count
; i
++) {
986 if (eosd_surfaces
[i
].surface
!= VDP_INVALID_HANDLE
) {
987 vdp_st
= vdp_bitmap_surface_destroy(eosd_surfaces
[i
].surface
);
988 CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy")
990 eosd_surfaces
[i
].surface
= VDP_INVALID_HANDLE
;
993 vdp_st
= vdp_device_destroy(vdp_device
);
994 CHECK_ST_WARNING("Error when calling vdp_device_destroy")
997 static void uninit(void)
999 if (!vo_config_count
)
1003 /* Destroy all vdpau objects */
1004 DestroyVdpauObjects();
1009 free(eosd_surfaces
);
1010 eosd_surfaces
= NULL
;
1012 eosd_targets
= NULL
;
1014 #ifdef CONFIG_XF86VM
1019 dlclose(vdpau_lib_handle
);
1022 static const opt_t subopts
[] = {
1023 {"deint", OPT_ARG_INT
, &deint
, (opt_test_f
)int_non_neg
},
1024 {"chroma-deint", OPT_ARG_BOOL
, &chroma_deint
, NULL
},
1025 {"pullup", OPT_ARG_BOOL
, &pullup
, NULL
},
1026 {"denoise", OPT_ARG_FLOAT
, &denoise
, NULL
},
1027 {"sharpen", OPT_ARG_FLOAT
, &sharpen
, NULL
},
1031 static const char help_msg
[] =
1032 "\n-vo vdpau command line help:\n"
1033 "Example: mplayer -vo vdpau:deint=2\n"
1035 " deint (all modes > 0 respect -field-dominance)\n"
1036 " 0: no deinterlacing\n"
1037 " 1: only show first field\n"
1038 " 2: bob deinterlacing\n"
1039 " 3: temporal deinterlacing (resource-hungry)\n"
1040 " 4: temporal-spatial deinterlacing (very resource-hungry)\n"
1042 " Operate on luma and chroma when using temporal deinterlacing (default)\n"
1043 " Use nochroma-deint to speed up temporal deinterlacing\n"
1045 " Try to apply inverse-telecine (needs temporal deinterlacing)\n"
1047 " Apply denoising, argument is strength from 0.0 to 1.0\n"
1049 " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n"
1052 static int preinit(const char *arg
)
1055 static const char *vdpaulibrary
= "libvdpau.so.1";
1056 static const char *vdpau_device_create
= "vdp_device_create_x11";
1061 deint_buffer_past_frames
= 0;
1062 deint_mpi
[0] = deint_mpi
[1] = NULL
;
1067 if (subopt_parse(arg
, subopts
) != 0) {
1068 mp_msg(MSGT_VO
, MSGL_FATAL
, help_msg
);
1074 deint_buffer_past_frames
= 1;
1076 vdpau_lib_handle
= dlopen(vdpaulibrary
, RTLD_LAZY
);
1077 if (!vdpau_lib_handle
) {
1078 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Could not open dynamic library %s\n",
1082 vdp_device_create
= dlsym(vdpau_lib_handle
, vdpau_device_create
);
1083 if (!vdp_device_create
) {
1084 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Could not find function %s in %s\n",
1085 vdpau_device_create
, vdpaulibrary
);
1088 if (!vo_init() || win_x11_init_vdpau_procs())
1091 decoder
= VDP_INVALID_HANDLE
;
1092 for (i
= 0; i
< MAX_VIDEO_SURFACES
; i
++)
1093 surface_render
[i
].surface
= VDP_INVALID_HANDLE
;
1094 video_mixer
= VDP_INVALID_HANDLE
;
1095 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++)
1096 output_surfaces
[i
] = VDP_INVALID_HANDLE
;
1097 vdp_flip_queue
= VDP_INVALID_HANDLE
;
1098 output_surface_width
= output_surface_height
= -1;
1100 // full grayscale palette.
1101 for (i
= 0; i
< PALETTE_SIZE
; ++i
)
1102 palette
[i
] = (i
<< 16) | (i
<< 8) | i
;
1104 index_data_size
= 0;
1106 eosd_surface_count
= eosd_render_count
= 0;
1107 eosd_surfaces
= NULL
;
1108 eosd_targets
= NULL
;
1110 procamp
.struct_version
= VDP_PROCAMP_VERSION
;
1111 procamp
.brightness
= 0.0;
1112 procamp
.contrast
= 1.0;
1113 procamp
.saturation
= 1.0;
1119 static int get_equalizer(char *name
, int *value
) {
1120 if (!strcasecmp(name
, "brightness"))
1121 *value
= procamp
.brightness
* 100;
1122 else if (!strcasecmp(name
, "contrast"))
1123 *value
= (procamp
.contrast
-1.0) * 100;
1124 else if (!strcasecmp(name
, "saturation"))
1125 *value
= (procamp
.saturation
-1.0) * 100;
1126 else if (!strcasecmp(name
, "hue"))
1127 *value
= procamp
.hue
* 100 / M_PI
;
1133 static int set_equalizer(char *name
, int value
) {
1135 VdpCSCMatrix matrix
;
1136 static const VdpVideoMixerAttribute attributes
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX
};
1137 const void *attribute_values
[] = {&matrix
};
1139 if (!strcasecmp(name
, "brightness"))
1140 procamp
.brightness
= value
/ 100.0;
1141 else if (!strcasecmp(name
, "contrast"))
1142 procamp
.contrast
= value
/ 100.0 + 1.0;
1143 else if (!strcasecmp(name
, "saturation"))
1144 procamp
.saturation
= value
/ 100.0 + 1.0;
1145 else if (!strcasecmp(name
, "hue"))
1146 procamp
.hue
= value
/ 100.0 * M_PI
;
1150 vdp_st
= vdp_generate_csc_matrix(&procamp
, VDP_COLOR_STANDARD_ITUR_BT_601
,
1152 CHECK_ST_WARNING("Error when generating CSC matrix")
1153 vdp_st
= vdp_video_mixer_set_attribute_values(video_mixer
, 1, attributes
,
1155 CHECK_ST_WARNING("Error when setting CSC matrix")
1159 static int control(uint32_t request
, void *data
)
1162 case VOCTRL_GET_DEINTERLACE
:
1163 *(int*)data
= deint
;
1165 case VOCTRL_SET_DEINTERLACE
:
1166 deint
= *(int*)data
;
1169 if (deint_type
> 2) {
1171 VdpVideoMixerFeature features
[1] =
1173 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL
:
1174 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL
};
1175 VdpBool feature_enables
[1] = {deint
? VDP_TRUE
: VDP_FALSE
};
1176 vdp_st
= vdp_video_mixer_set_feature_enables(video_mixer
, 1,
1179 CHECK_ST_WARNING("Error changing deinterlacing settings")
1180 deint_buffer_past_frames
= 1;
1184 return (int_pause
= 1);
1186 return (int_pause
= 0);
1187 case VOCTRL_QUERY_FORMAT
:
1188 return query_format(*(uint32_t *)data
);
1189 case VOCTRL_GET_IMAGE
:
1190 return get_image(data
);
1191 case VOCTRL_DRAW_IMAGE
:
1192 return draw_image(data
);
1197 case VOCTRL_FULLSCREEN
:
1198 vo_x11_fullscreen();
1201 case VOCTRL_GET_PANSCAN
:
1203 case VOCTRL_SET_PANSCAN
:
1206 case VOCTRL_SET_EQUALIZER
: {
1207 struct voctrl_set_equalizer_args
*args
= data
;
1208 return set_equalizer(args
->name
, args
->value
);
1210 case VOCTRL_GET_EQUALIZER
:
1212 struct voctrl_get_equalizer_args
*args
= data
;
1213 return get_equalizer(args
->name
, args
->valueptr
);
1218 case VOCTRL_UPDATE_SCREENINFO
:
1219 update_xinerama_info();
1221 case VOCTRL_DRAW_EOSD
:
1224 generate_eosd(data
);
1227 case VOCTRL_GET_EOSD_RES
: {
1228 mp_eosd_res_t
*r
= data
;
1229 r
->mt
= r
->mb
= r
->ml
= r
->mr
= 0;
1231 r
->w
= vo_screenwidth
;
1232 r
->h
= vo_screenheight
;
1233 r
->ml
= r
->mr
= border_x
;
1234 r
->mt
= r
->mb
= border_y
;