mirror of https://github.com/mpv-player/mpv
vdpau: don't upload video images in advance
With software decoding, images were uploaded to vdpau surfaces as they were queued to the VO. This makes it slightly more complicated (especially later on), and has no advantages - so stop doing it. The only reason why this was done explicitly was due to attempts to keep the code equivalent (instead of risking performance regressions). The original code did this naturally for certain reasons, but now that we can measure that it has no advantages and just requires extra code, we can just drop it.
This commit is contained in:
parent
d563dc8cb9
commit
fa34b4920a
|
@ -288,12 +288,6 @@ void vo_queue_image(struct vo *vo, struct mp_image *mpi)
|
|||
if (!vo->config_ok)
|
||||
return;
|
||||
assert(mp_image_params_equal(vo->params, &mpi->params));
|
||||
if (vo->driver->filter_image && mpi)
|
||||
mpi = vo->driver->filter_image(vo, mpi);
|
||||
if (!mpi) {
|
||||
MP_ERR(vo, "Could not upload image.\n");
|
||||
return;
|
||||
}
|
||||
assert(vo->max_video_queue <= VO_MAX_QUEUE);
|
||||
assert(vo->num_video_queue < vo->max_video_queue);
|
||||
vo->video_queue[vo->num_video_queue++] = mpi;
|
||||
|
|
|
@ -163,20 +163,6 @@ struct vo_driver {
|
|||
*/
|
||||
int (*query_format)(struct vo *vo, uint32_t format);
|
||||
|
||||
/*
|
||||
* Optional. Can be used to convert the input image into something VO
|
||||
* internal, such as GPU surfaces. Ownership of mpi is passed to the
|
||||
* function, and the returned image is owned by the caller.
|
||||
* The following guarantees are given:
|
||||
* - mpi has the format with which the VO was configured
|
||||
* - the returned image can be arbitrary, and the VO merely manages its
|
||||
* lifetime
|
||||
* - images passed to draw_image are always passed through this function
|
||||
* - the maximum number of images kept alive is not over vo->max_video_queue
|
||||
* - if vo->max_video_queue is large enough, some images may be buffered ahead
|
||||
*/
|
||||
struct mp_image *(*filter_image)(struct vo *vo, struct mp_image *mpi);
|
||||
|
||||
/*
|
||||
* Initialize or reconfigure the display driver.
|
||||
* params: video parameters, like pixel format and frame size
|
||||
|
|
|
@ -847,30 +847,23 @@ static void draw_image(struct vo *vo, struct mp_image *mpi)
|
|||
{
|
||||
struct vdpctx *vc = vo->priv;
|
||||
|
||||
check_preemption(vo);
|
||||
|
||||
struct mp_image *vdp_mpi = mp_vdpau_upload_video_surface(vc->mpvdp, mpi);
|
||||
if (vdp_mpi) {
|
||||
mp_image_copy_attributes(vdp_mpi, mpi);
|
||||
} else {
|
||||
MP_ERR(vo, "Could not upload image.\n");
|
||||
}
|
||||
talloc_free(mpi);
|
||||
|
||||
talloc_free(vc->current_image);
|
||||
vc->current_image = mpi;
|
||||
vc->current_image = vdp_mpi;
|
||||
|
||||
if (status_ok(vo))
|
||||
video_to_output_surface(vo);
|
||||
}
|
||||
|
||||
static struct mp_image *filter_image(struct vo *vo, struct mp_image *mpi)
|
||||
{
|
||||
struct vdpctx *vc = vo->priv;
|
||||
|
||||
check_preemption(vo);
|
||||
|
||||
struct mp_image *reserved_mpi = mp_vdpau_upload_video_surface(vc->mpvdp, mpi);
|
||||
if (!reserved_mpi)
|
||||
goto end;
|
||||
|
||||
mp_image_copy_attributes(reserved_mpi, mpi);
|
||||
|
||||
end:
|
||||
talloc_free(mpi);
|
||||
return reserved_mpi;
|
||||
}
|
||||
|
||||
// warning: the size and pixel format of surface must match that of the
|
||||
// surfaces in vc->output_surfaces
|
||||
static struct mp_image *read_output_surface(struct vo *vo,
|
||||
|
@ -1148,7 +1141,6 @@ const struct vo_driver video_out_vdpau = {
|
|||
.reconfig = reconfig,
|
||||
.control = control,
|
||||
.draw_image = draw_image,
|
||||
.filter_image = filter_image,
|
||||
.flip_page_timed = flip_page_timed,
|
||||
.uninit = uninit,
|
||||
.priv_size = sizeof(struct vdpctx),
|
||||
|
|
Loading…
Reference in New Issue