0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

VO: remove VO direct rendering

This was disabled by default, and could be enabled with -dr. It was
disabled by default because it was buggy: there were issues with OSD
corruption.

It wasn't entirely sane for OpenGL based VOs either. OpenGL can chose
to drop mapped pixel buffer objects, requiring the application to map
and fill the buffer again. But there was no mechanism in mplayer to
fill the lost buffer again. (It seems this rarely happened in practice,
though.)

On the other side, users liked the --dr flag, because it promised them
more speed. I'm not sure if it actually helped with speed, but it's
unlikely it had any real advantages on modern systems.

In order to evade the --dr cargo culting in mplayer config files, it's
best to get rid of it.
This commit is contained in:
wm4 2012-08-02 21:28:59 +02:00
parent 6c05d49730
commit e48b21dd87
12 changed files with 3 additions and 163 deletions

View File

@ -514,11 +514,6 @@
double-click (default: 300). Set to 0 to let your windowing system decide
what a double-click is (``--vo=directx`` only).
--dr
Turns on direct rendering (not supported by all codecs and video outputs)
*WARNING*: May cause OSD/SUB corruption!
--dumpfile=<filename>
Specify which file MPlayer should dump to. Should be used together with
``--dumpaudio`` / ``--dumpvideo`` / ``--dumpstream`` / ``--capture``.

View File

@ -172,7 +172,7 @@ gl
than the maximum texture size of your OpenGL implementation. Intended to
work even with the most basic OpenGL implementations, but also makes use
of newer extensions, which allow support for more colorspaces and direct
rendering. For optimal speed try adding the options ``--dr=-noslices``
rendering.
The code performs very few checks, so if a feature does not work, this
might be because it is not supported by your card/OpenGL implementation
@ -181,7 +181,7 @@ gl
(no-)ati-hack
ATI drivers may give a corrupted image when PBOs are used (when using
``--dr`` or `force-pbo`). This option fixes this, at the expense of
`force-pbo`). This option fixes this, at the expense of
using a bit more memory.
(no-)force-pbo
Always uses PBOs to transfer textures even if this involves an extra

View File

@ -733,9 +733,6 @@ const m_option_t mplayer_opts[]={
OPT_INTRANGE("gamma", vo_gamma_gamma, 0, -100, 100),
{"keepaspect", &vo_keepaspect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
// direct rendering (decoding to video out buffer)
{"dr", &vo_directrendering, CONF_TYPE_FLAG, 0, 0, 1, NULL},
//---------------------- mplayer-only options ------------------------
{"use-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},

View File

@ -199,7 +199,7 @@ static void get_image(struct vf_instance *vf,
if (!video_out->config_ok)
return;
// GET_IMAGE is required for hardware-accelerated formats
if (vo_directrendering || IMGFMT_IS_HWACCEL(mpi->imgfmt))
if (IMGFMT_IS_HWACCEL(mpi->imgfmt))
vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
}

View File

@ -66,7 +66,6 @@ int vo_pts=0; // for hw decoding
float vo_fps=0;
char *vo_subdevice = NULL;
int vo_directrendering=0;
int vo_colorkey = 0x0000ff00; // default colorkey is green
// (0xff000000 means that colorkey has been disabled)

View File

@ -330,7 +330,6 @@ extern int xinerama_y;
extern int vo_grabpointer;
extern int vo_doublebuffering;
extern int vo_directrendering;
extern int vo_vsync;
extern int vo_fs;
extern int vo_fsmode;

View File

@ -1493,10 +1493,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(priv, *(uint32_t*) data);
case VOCTRL_GET_IMAGE:
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Direct Rendering request. Not implemented yet.\n");
return VO_NOTIMPL;
case VOCTRL_DRAW_IMAGE:
return d3d_upload_and_render_frame(priv, data);
case VOCTRL_FULLSCREEN:

View File

@ -1091,75 +1091,6 @@ if (layer) {
return VO_FALSE;
}
static uint32_t get_image(mp_image_t *mpi)
{
int err;
uint8_t *dst;
int pitch;
// if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: get_image() called\n");
if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
if(mpi->type==MP_IMGTYPE_STATIC) return VO_FALSE; // it is not static
// printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags);
if(mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)){
// we're lucky or codec accepts stride => ok, let's go!
if (frame) {
err = frame->Lock(frame,DSLF_WRITE|DSLF_READ,(void *)&dst,&pitch);
framelocked=1;
} else {
err = primary->Lock(primary,DSLF_WRITE,(void *)&dst,&pitch);
primarylocked=1;
}
if (err) {
mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: DR lock failed!");
return VO_FALSE;
};
if(mpi->flags&MP_IMGFLAG_PLANAR){
//YV12 format
mpi->planes[0]=dst;
if(mpi->flags&MP_IMGFLAG_SWAPPED){
mpi->planes[1]=dst + pitch*height;
mpi->planes[2]=mpi->planes[1] + pitch*height/4;
} else {
mpi->planes[2]=dst + pitch*height;
mpi->planes[1]=mpi->planes[2] + pitch*height/4;
}
mpi->width=width;
mpi->stride[0]=pitch;
mpi->stride[1]=mpi->stride[2]=pitch/2;
} else {
//YUY2 and RGB formats
mpi->planes[0]=dst;
mpi->width=width;
mpi->stride[0]=pitch;
}
// center image
if (!frame) {
if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[0]= dst + yoffset * pitch + xoffset;
mpi->planes[1]+= ((yoffset * pitch) >> 2) + (xoffset >> 1);
mpi->planes[2]+= ((yoffset * pitch) >> 2) + (xoffset >> 1);
} else {
mpi->planes[0]=dst + yoffset * pitch + xoffset * (mpi->bpp >> 3);
}
}
mpi->flags|=MP_IMGFLAG_DIRECT;
// if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
return VO_TRUE;
}
return VO_FALSE;
}
static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
{
int i;
@ -1375,8 +1306,6 @@ static int control(uint32_t request, void *data)
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
case VOCTRL_GET_IMAGE:
return get_image(data);
case VOCTRL_DRAW_IMAGE:
return put_image(data);
case VOCTRL_SET_EQUALIZER:

View File

@ -862,10 +862,6 @@ static void flip_page(void)
g_lpddsPrimary->lpVtbl->Blt(g_lpddsPrimary, &rd, g_lpddsBack, NULL, DDBLT_WAIT, &ddbltfx);
}
if (g_lpddsBack->lpVtbl->Lock(g_lpddsBack, NULL, &ddsdsf, DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL) == DD_OK) {
if (vo_directrendering && (dstride != ddsdsf.lPitch)) {
mp_msg(MSGT_VO, MSGL_WARN, "<vo_directx><WARN>stride changed !!!! disabling direct rendering\n");
vo_directrendering = 0;
}
free(tmp_image);
tmp_image = NULL;
dstride = ddsdsf.lPitch;
@ -882,43 +878,6 @@ static int draw_frame(uint8_t *src[])
return 0;
}
static uint32_t get_image(mp_image_t *mpi)
{
if (mpi->flags & MP_IMGFLAG_READABLE) {
mp_msg(MSGT_VO, MSGL_V, "<vo_directx><ERROR>slow video ram\n");
return VO_FALSE;
}
if (mpi->type == MP_IMGTYPE_STATIC) {
mp_msg(MSGT_VO, MSGL_V, "<vo_directx><ERROR>not static\n");
return VO_FALSE;
}
if (mpi->width == dstride || (mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))) {
if (mpi->flags & MP_IMGFLAG_PLANAR) {
if (image_format == IMGFMT_YV12) {
mpi->planes[2] = image + dstride * image_height;
mpi->planes[1] = image + dstride * image_height + dstride * image_height / 4;
mpi->stride[1] = mpi->stride[2] = dstride / 2;
} else if (image_format == IMGFMT_IYUV || image_format == IMGFMT_I420) {
mpi->planes[1] = image + dstride * image_height;
mpi->planes[2] = image + dstride * image_height + dstride * image_height / 4;
mpi->stride[1] = mpi->stride[2] = dstride / 2;
} else if (image_format == IMGFMT_YVU9) {
mpi->planes[2] = image + dstride * image_height;
mpi->planes[1] = image + dstride * image_height + dstride * image_height / 16;
mpi->stride[1] = mpi->stride[2] = dstride / 4;
}
}
mpi->planes[0] = image;
mpi->stride[0] = dstride;
mpi->width = image_width;
mpi->height = image_height;
mpi->flags |= MP_IMGFLAG_DIRECT;
mp_msg(MSGT_VO, MSGL_DBG3, "<vo_directx><INFO>Direct Rendering ENABLED\n");
return VO_TRUE;
}
return VO_FALSE;
}
static uint32_t put_image(mp_image_t *mpi)
{
uint8_t *d;
@ -1130,8 +1089,6 @@ static uint32_t color_ctrl_get(const char *what, int *value)
static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_GET_IMAGE:
return get_image(data);
case VOCTRL_QUERY_FORMAT:
return query_format(*(uint32_t *)data);
case VOCTRL_DRAW_IMAGE:

View File

@ -1383,8 +1383,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(vo, *(uint32_t *)data);
case VOCTRL_GET_IMAGE:
return get_image(vo, data);
case VOCTRL_DRAW_IMAGE:
return draw_image(vo, data);
case VOCTRL_DRAW_EOSD:

View File

@ -1834,8 +1834,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*(uint32_t *)data);
case VOCTRL_GET_IMAGE:
return get_image(vo, data);
case VOCTRL_DRAW_IMAGE:
return draw_image(p, data);
case VOCTRL_DRAW_EOSD:

View File

@ -549,32 +549,6 @@ static int draw_frame(uint8_t * src[])
return VO_ERROR;
}
static uint32_t get_image(mp_image_t * mpi)
{
if (zoomFlag ||
!IMGFMT_IS_BGR(mpi->imgfmt) ||
(IMGFMT_BGR_DEPTH(mpi->imgfmt) != vo_depthonscreen) ||
((mpi->type != MP_IMGTYPE_STATIC)
&& (mpi->type != MP_IMGTYPE_TEMP))
|| (mpi->flags & MP_IMGFLAG_PLANAR)
|| (mpi->flags & MP_IMGFLAG_YUV) || (mpi->width != image_width)
|| (mpi->height != image_height))
return VO_FALSE;
if (Flip_Flag)
{
mpi->stride[0] = -image_width * ((bpp + 7) / 8);
mpi->planes[0] = ImageData - mpi->stride[0] * (image_height - 1);
} else
{
mpi->stride[0] = image_width * ((bpp + 7) / 8);
mpi->planes[0] = ImageData;
}
mpi->flags |= MP_IMGFLAG_DIRECT;
return VO_TRUE;
}
static int query_format(uint32_t format)
{
mp_msg(MSGT_VO, MSGL_DBG2,
@ -650,8 +624,6 @@ static int control(uint32_t request, void *data)
return int_pause = 0;
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t *) data));
case VOCTRL_GET_IMAGE:
return get_image(data);
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
vo_x11_clearwindow(mDisplay, vo_window);