summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-16 17:07:35 +0200
committerwm4 <wm4@nowhere>2017-10-16 17:07:35 +0200
commitddfccd67d5da2f6b19f0057c89e3c497d248e212 (patch)
treea4d2351047e1bad35f586a4f87b27a66764fb40c
parent9e140775bcbf3fa37dce67790325788c41451e08 (diff)
downloadmpv-ddfccd67d5da2f6b19f0057c89e3c497d248e212.tar.bz2
mpv-ddfccd67d5da2f6b19f0057c89e3c497d248e212.tar.xz
video: remove special path for hwdec screenshots
This was phased out, and was used only by vdpau by now. Drop the mechanism and the vdpau special code, which means screenshots won't include the vf_vdpaupp processing anymore. (I don't care enough about vdpau, it's on its way out.)
-rw-r--r--player/screenshot.c6
-rw-r--r--video/hwdec.h10
-rw-r--r--video/mp_image_pool.c3
-rw-r--r--video/vdpau.c84
4 files changed, 1 insertions, 102 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index 7f79b2cbcd..dae39fdbae 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -404,12 +404,6 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode)
if (image && (image->fmt.flags & MP_IMGFLAG_HWACCEL)) {
struct mp_image *nimage = mp_image_hw_download(image, NULL);
- if (!nimage && mpctx->vo_chain && mpctx->vo_chain->hwdec_devs) {
- struct mp_hwdec_ctx *ctx =
- hwdec_devices_get_first(mpctx->vo_chain->hwdec_devs);
- if (ctx && ctx->download_image)
- nimage = ctx->download_image(ctx, image, NULL);
- }
talloc_free(image);
image = nimage;
}
diff --git a/video/hwdec.h b/video/hwdec.h
index 4a6739ecde..a432ecce2c 100644
--- a/video/hwdec.h
+++ b/video/hwdec.h
@@ -56,16 +56,6 @@ struct mp_hwdec_ctx {
// Hint to generic code: it's using a wrapper API
bool emulated;
- // Optional. Legacy. (New code should use AVHWFramesContext and
- // mp_image_hw_download().)
- // Allocates a software image from the pool, downloads the hw image from
- // mpi, and returns it.
- // pool can be NULL (then just use straight allocation).
- // Return NULL on error or if mpi has the wrong format.
- struct mp_image *(*download_image)(struct mp_hwdec_ctx *ctx,
- struct mp_image *mpi,
- struct mp_image_pool *swpool);
-
// Optional. Crap for vdpau. Makes sure preemption recovery is run if needed.
void (*restore_device)(struct mp_hwdec_ctx *ctx);
diff --git a/video/mp_image_pool.c b/video/mp_image_pool.c
index e993b4e096..ff743b4da7 100644
--- a/video/mp_image_pool.c
+++ b/video/mp_image_pool.c
@@ -254,8 +254,7 @@ void mp_image_pool_set_lru(struct mp_image_pool *pool)
// Copies the contents of the HW surface img to system memory and retuns it.
// If swpool is not NULL, it's used to allocate the target image.
-// img must be a hw surface with a AVHWFramesContext attached. If not, you
-// must use the legacy mp_hwdec_ctx.download_image.
+// img must be a hw surface with a AVHWFramesContext attached.
// The returned image is cropped as needed.
// Returns NULL on failure.
struct mp_image *mp_image_hw_download(struct mp_image *src,
diff --git a/video/vdpau.c b/video/vdpau.c
index b07926276d..efed6d7f0c 100644
--- a/video/vdpau.c
+++ b/video/vdpau.c
@@ -31,89 +31,6 @@
#include "mp_image_pool.h"
#include "vdpau_mixer.h"
-static struct mp_image *download_image_yuv(struct mp_hwdec_ctx *hwctx,
- struct mp_image *mpi,
- struct mp_image_pool *swpool)
-{
- if (mpi->imgfmt != IMGFMT_VDPAU || mp_vdpau_mixed_frame_get(mpi))
- return NULL;
-
- return mp_image_hw_download(mpi, swpool);
-}
-
-static struct mp_image *download_image(struct mp_hwdec_ctx *hwctx,
- struct mp_image *mpi,
- struct mp_image_pool *swpool)
-{
- if (mpi->imgfmt != IMGFMT_VDPAU && mpi->imgfmt != IMGFMT_VDPAU_OUTPUT)
- return NULL;
-
- struct mp_vdpau_ctx *ctx = hwctx->ctx;
- struct vdp_functions *vdp = &ctx->vdp;
- VdpStatus vdp_st;
-
- struct mp_image *res = NULL;
- int w, h;
- mp_image_params_get_dsize(&mpi->params, &w, &h);
-
- res = download_image_yuv(hwctx, mpi, swpool);
- if (res)
- return res;
-
- // Abuse this lock for our own purposes. It could use its own lock instead.
- pthread_mutex_lock(&ctx->pool_lock);
-
- if (ctx->getimg_surface == VDP_INVALID_HANDLE ||
- ctx->getimg_w < w || ctx->getimg_h < h)
- {
- if (ctx->getimg_surface != VDP_INVALID_HANDLE) {
- vdp_st = vdp->output_surface_destroy(ctx->getimg_surface);
- CHECK_VDP_WARNING(ctx, "Error when calling vdp_output_surface_destroy");
- }
- ctx->getimg_surface = VDP_INVALID_HANDLE;
- vdp_st = vdp->output_surface_create(ctx->vdp_device,
- VDP_RGBA_FORMAT_B8G8R8A8, w, h,
- &ctx->getimg_surface);
- CHECK_VDP_WARNING(ctx, "Error when calling vdp_output_surface_create");
- if (vdp_st != VDP_STATUS_OK)
- goto error;
- ctx->getimg_w = w;
- ctx->getimg_h = h;
- }
-
- if (!ctx->getimg_mixer)
- ctx->getimg_mixer = mp_vdpau_mixer_create(ctx, ctx->log);
-
- VdpRect in = { .x1 = mpi->w, .y1 = mpi->h };
- VdpRect out = { .x1 = w, .y1 = h };
- if (mp_vdpau_mixer_render(ctx->getimg_mixer, NULL, ctx->getimg_surface, &out,
- mpi, &in) < 0)
- goto error;
-
- res = mp_image_pool_get(swpool, IMGFMT_BGR0, ctx->getimg_w, ctx->getimg_h);
- if (!res)
- goto error;
-
- void *dst_planes[] = { res->planes[0] };
- uint32_t dst_pitches[] = { res->stride[0] };
- vdp_st = vdp->output_surface_get_bits_native(ctx->getimg_surface, NULL,
- dst_planes, dst_pitches);
- CHECK_VDP_WARNING(ctx, "Error when calling vdp_output_surface_get_bits_native");
- if (vdp_st != VDP_STATUS_OK)
- goto error;
-
- mp_image_set_size(res, w, h);
- mp_image_copy_attributes(res, mpi);
-
- pthread_mutex_unlock(&ctx->pool_lock);
- return res;
-error:
- talloc_free(res);
- MP_WARN(ctx, "Error copying image from GPU.\n");
- pthread_mutex_unlock(&ctx->pool_lock);
- return NULL;
-}
-
static void mark_vdpau_objects_uninitialized(struct mp_vdpau_ctx *ctx)
{
for (int i = 0; i < MAX_VIDEO_SURFACES; i++) {
@@ -451,7 +368,6 @@ struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11
.hwctx = {
.type = HWDEC_VDPAU,
.ctx = ctx,
- .download_image = download_image,
.restore_device = recheck_preemption,
},
.getimg_surface = VDP_INVALID_HANDLE,