summaryrefslogtreecommitdiffstats
path: root/libvo/vo_vdpau.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-07-28 17:07:49 +0200
committerwm4 <wm4@mplayer2.org>2012-07-28 17:24:05 +0200
commit51e198c2a1e43b74ad35ef358628dcd8791158d9 (patch)
tree60f6c2255ed912a7a4866b71728104a2cb2442f1 /libvo/vo_vdpau.c
parent2793e7eb70a342b346788f83e1ed660c8e0d491e (diff)
parent7dfaaa95104a8e6dc024fddaf1b49c71768f1be7 (diff)
downloadmpv-51e198c2a1e43b74ad35ef358628dcd8791158d9.tar.bz2
mpv-51e198c2a1e43b74ad35ef358628dcd8791158d9.tar.xz
Merge remote-tracking branch 'origin/master'
Conflicts: .gitignore bstr.c cfg-mplayer.h defaultopts.c libvo/video_out.c The conflict in bstr.c is due to uau adding a bstr_getline function in commit 2ba8b91a97e7e8. This function already existed in this branch. While uau's function is obviously derived from mine, it's incompatible. His function preserves line breaks, while mine strips them. Add a bstr_strip_linebreaks function, fix all other uses of bstr_getline, and pick uau's implementation. In .gitignore, change vo_gl3_shaders.h to use an absolute path additional to resolving the merge conflict.
Diffstat (limited to 'libvo/vo_vdpau.c')
-rw-r--r--libvo/vo_vdpau.c101
1 files changed, 41 insertions, 60 deletions
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index a7a13bc36f..9343dea3e1 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -43,7 +43,7 @@
#include "aspect.h"
#include "csputils.h"
#include "sub/sub.h"
-#include "subopt-helper.h"
+#include "m_option.h"
#include "libmpcodecs/vfcap.h"
#include "libmpcodecs/mp_image.h"
#include "osdep/timer.h"
@@ -152,6 +152,7 @@ struct vdpctx {
int query_surface_num;
VdpTime recent_vsync_time;
float user_fps;
+ int composite_detect;
unsigned int vsync_interval;
uint64_t last_queue_time;
uint64_t queue_time[MAX_OUTPUT_SURFACES];
@@ -438,9 +439,11 @@ static int win_x11_init_vdpau_procs(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
struct vdpctx *vc = vo->priv;
- talloc_free(vc->vdp); // In case this is reinitialization after preemption
- struct vdp_functions *vdp = talloc_zero(vc, struct vdp_functions);
- vc->vdp = vdp;
+ if (vc->vdp) // reinitialization after preemption
+ memset(vc->vdp, 0, sizeof(*vc->vdp));
+ else
+ vc->vdp = talloc_zero(vc, struct vdp_functions);
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
struct vdp_function {
@@ -525,7 +528,10 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo)
vc->last_sync_update = GetTimer();
vc->vsync_interval = 1;
- if (vc->user_fps > 0) {
+ if (vc->composite_detect && vo_x11_screen_is_composited(vo)) {
+ mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Compositing window manager "
+ "detected. Assuming timing info is inaccurate.\n");
+ } else if (vc->user_fps > 0) {
vc->vsync_interval = 1e9 / vc->user_fps;
mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Assuming user-specified display "
"refresh rate of %.3f Hz.\n", vc->user_fps);
@@ -1164,7 +1170,7 @@ static void flip_page_timed(struct vo *vo, unsigned int pts_us, int duration)
else
duration *= 1000;
- if (vc->user_fps < 0)
+ if (vc->vsync_interval == 1)
duration = -1; // Make sure drop logic is disabled
uint64_t now = sync_vdptime(vo);
@@ -1484,12 +1490,7 @@ static void uninit(struct vo *vo)
static int preinit(struct vo *vo, const char *arg)
{
- int i;
- int user_colorspace = 0;
- int studio_levels = 0;
-
- struct vdpctx *vc = talloc_zero(vo, struct vdpctx);
- vo->priv = vc;
+ struct vdpctx *vc = vo->priv;
vc->eosd_packer = eosd_packer_create(vo);
@@ -1498,54 +1499,9 @@ static int preinit(struct vo *vo, const char *arg)
mark_vdpau_objects_uninitialized(vo);
vc->colorspace = (struct mp_csp_details) MP_CSP_DETAILS_DEFAULTS;
- vc->deint_type = 3;
- vc->chroma_deint = 1;
- vc->flip_offset_window = 50;
- vc->flip_offset_fs = 50;
- vc->num_output_surfaces = 3;
vc->video_eq.capabilities = MP_CSP_EQ_CAPS_COLORMATRIX;
- const opt_t subopts[] = {
- {"deint", OPT_ARG_INT, &vc->deint, NULL},
- {"chroma-deint", OPT_ARG_BOOL, &vc->chroma_deint, NULL},
- {"pullup", OPT_ARG_BOOL, &vc->pullup, NULL},
- {"denoise", OPT_ARG_FLOAT, &vc->denoise, NULL},
- {"sharpen", OPT_ARG_FLOAT, &vc->sharpen, NULL},
- {"colorspace", OPT_ARG_INT, &user_colorspace, NULL},
- {"studio", OPT_ARG_BOOL, &studio_levels, NULL},
- {"hqscaling", OPT_ARG_INT, &vc->hqscaling, NULL},
- {"fps", OPT_ARG_FLOAT, &vc->user_fps, NULL},
- {"queuetime_windowed", OPT_ARG_INT, &vc->flip_offset_window, NULL},
- {"queuetime_fs", OPT_ARG_INT, &vc->flip_offset_fs, NULL},
- {"output_surfaces", OPT_ARG_INT, &vc->num_output_surfaces, NULL},
- {NULL}
- };
- if (subopt_parse(arg, subopts) != 0) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[vdpau] Could not parse suboptions.\n");
- return -1;
- }
- if (vc->hqscaling < 0 || vc->hqscaling > 9) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[vdpau] Invalid value for suboption "
- "hqscaling\n");
- return -1;
- }
- if (vc->num_output_surfaces < 2) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[vdpau] Invalid suboption "
- "output_surfaces: can't use less than 2 surfaces\n");
- return -1;
- }
- if (user_colorspace != 0 || studio_levels != 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] \"colorspace\" and \"studio\""
- " suboptions have been removed. Use options --colormatrix and"
- " --colormatrix-output-range=limited instead.\n");
- return -1;
- }
- if (vc->num_output_surfaces > MAX_OUTPUT_SURFACES) {
- mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Number of output surfaces "
- "is limited to %d.\n", MAX_OUTPUT_SURFACES);
- vc->num_output_surfaces = MAX_OUTPUT_SURFACES;
- }
- if (vc->deint)
- vc->deint_type = FFABS(vc->deint);
+
+ vc->deint_type = vc->deint ? FFABS(vc->deint) : 3;
if (vc->deint < 0)
vc->deint = 0;
@@ -1562,7 +1518,7 @@ static int preinit(struct vo *vo, const char *arg)
}
// full grayscale palette.
- for (i = 0; i < PALETTE_SIZE; ++i)
+ for (int i = 0; i < PALETTE_SIZE; ++i)
vc->palette[i] = (i << 16) | (i << 8) | i;
return 0;
@@ -1722,6 +1678,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
return VO_NOTIMPL;
}
+#undef OPT_BASE_STRUCT
+#define OPT_BASE_STRUCT struct vdpctx
+
const struct vo_driver video_out_vdpau = {
.is_new = true,
.buffer_frames = true,
@@ -1741,4 +1700,26 @@ const struct vo_driver video_out_vdpau = {
.flip_page_timed = flip_page_timed,
.check_events = check_events,
.uninit = uninit,
+ .privsize = sizeof(struct vdpctx),
+ .options = (const struct m_option []){
+ OPT_INTRANGE("deint", deint, 0, -4, 4),
+ OPT_FLAG_ON("chroma-deint", chroma_deint, 0, OPTDEF_INT(1)),
+ OPT_FLAG_OFF("nochroma-deint", chroma_deint, 0),
+ OPT_MAKE_FLAGS("pullup", pullup, 0),
+ OPT_FLOATRANGE("denoise", denoise, 0, 0, 1),
+ OPT_FLOATRANGE("sharpen", sharpen, 0, -1, 1),
+ OPT_ERRORMESSAGE("colorspace", "vo_vdpau suboption \"colorspace\" has "
+ "been removed. Use --colormatrix instead.\n"),
+ OPT_ERRORMESSAGE("studio", "vo_vdpau suboption \"studio\" has been "
+ "removed. Use --colormatrix-output-range=limited "
+ "instead.\n"),
+ OPT_INTRANGE("hqscaling", hqscaling, 0, 0, 9),
+ OPT_FLOAT("fps", user_fps, 0),
+ OPT_FLAG_ON("composite-detect", composite_detect, 0, OPTDEF_INT(1)),
+ OPT_INT("queuetime_windowed", flip_offset_window, 0, OPTDEF_INT(50)),
+ OPT_INT("queuetime_fs", flip_offset_fs, 0, OPTDEF_INT(50)),
+ OPT_INTRANGE("output_surfaces", num_output_surfaces, 0,
+ 2, MAX_OUTPUT_SURFACES, OPTDEF_INT(3)),
+ {NULL},
+ }
};