summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-13 18:07:20 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-13 17:45:29 -0800
commitf17246fec15963e7cc098cf7ba7263ad02877b99 (patch)
tree45689c1cd1200df665969d4ea75d3dab17de1c46
parentceca1602e9360564a780036597dfe904566611ff (diff)
downloadmpv-f17246fec15963e7cc098cf7ba7263ad02877b99.tar.bz2
mpv-f17246fec15963e7cc098cf7ba7263ad02877b99.tar.xz
vo_gpu: remove old window screenshot glue code and GL implementation
There is now a better way. Reading the font framebuffer was always a hack. The new code via VOCTRL_SCREENSHOT renders it into a FBO, which does not come with the disadvantages of reading the front buffer (like not being supported by GLES, possibly black regions due to overlapping windows on some systems). For now keep VOCTRL_SCREENSHOT_WIN on the VO level, because there are still some lesser VOs and backends that use it.
-rw-r--r--video/out/gpu/context.h3
-rw-r--r--video/out/opengl/context.c26
-rw-r--r--video/out/vo_gpu.c12
-rw-r--r--video/out/vulkan/context.c1
4 files changed, 0 insertions, 42 deletions
diff --git a/video/out/gpu/context.h b/video/out/gpu/context.h
index 78c0441cdf..a2fcb3711a 100644
--- a/video/out/gpu/context.h
+++ b/video/out/gpu/context.h
@@ -69,9 +69,6 @@ struct ra_swapchain_fns {
// Gets the current framebuffer depth in bits (0 if unknown). Optional.
int (*color_depth)(struct ra_swapchain *sw);
- // Retrieves a screenshot of the framebuffer. Optional.
- struct mp_image *(*screenshot)(struct ra_swapchain *sw);
-
// Called when rendering starts. Returns NULL on failure. This must be
// followed by submit_frame, to submit the rendered frame. This function
// can also fail sporadically, and such errors should be ignored unless
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index 8f44119210..0bf8d7436e 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -173,8 +173,6 @@ bool ra_gl_ctx_init(struct ra_ctx *ctx, GL *gl, struct ra_gl_ctx_params params)
if (ext) {
if (ext->color_depth)
p->fns.color_depth = ext->color_depth;
- if (ext->screenshot)
- p->fns.screenshot = ext->screenshot;
if (ext->start_frame)
p->fns.start_frame = ext->start_frame;
if (ext->submit_frame)
@@ -247,29 +245,6 @@ int ra_gl_ctx_color_depth(struct ra_swapchain *sw)
return depth_g;
}
-struct mp_image *ra_gl_ctx_screenshot(struct ra_swapchain *sw)
-{
- struct priv *p = sw->priv;
-
- struct mp_image *screen = mp_image_alloc(IMGFMT_RGB24, p->wrapped_fb->params.w,
- p->wrapped_fb->params.h);
- if (!screen)
- return NULL;
-
- int dir = p->params.flipped ? 1 : -1;
-
- assert(p->wrapped_fb);
- if (!gl_read_fbo_contents(p->gl, p->main_fb, dir, GL_RGB, GL_UNSIGNED_BYTE,
- p->wrapped_fb->params.w, p->wrapped_fb->params.h,
- screen->planes[0], screen->stride[0]))
- {
- talloc_free(screen);
- return NULL;
- }
-
- return screen;
-}
-
bool ra_gl_ctx_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
{
struct priv *p = sw->priv;
@@ -353,7 +328,6 @@ void ra_gl_ctx_swap_buffers(struct ra_swapchain *sw)
static const struct ra_swapchain_fns ra_gl_swapchain_fns = {
.color_depth = ra_gl_ctx_color_depth,
- .screenshot = ra_gl_ctx_screenshot,
.start_frame = ra_gl_ctx_start_frame,
.submit_frame = ra_gl_ctx_submit_frame,
.swap_buffers = ra_gl_ctx_swap_buffers,
diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c
index 70c874fc54..61696af0e4 100644
--- a/video/out/vo_gpu.c
+++ b/video/out/vo_gpu.c
@@ -168,7 +168,6 @@ static void get_and_update_ambient_lighting(struct gpu_priv *p)
static int control(struct vo *vo, uint32_t request, void *data)
{
struct gpu_priv *p = vo->priv;
- struct ra_swapchain *sw = p->ctx->swapchain;
switch (request) {
case VOCTRL_SET_PANSCAN:
@@ -177,17 +176,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_EQUALIZER:
vo->want_redraw = true;
return VO_TRUE;
- case VOCTRL_SCREENSHOT_WIN: {
- struct mp_image *screen = NULL;
- if (sw->fns->screenshot)
- screen = sw->fns->screenshot(sw);
- if (!screen)
- break; // redirect to backend
- // set image parameters according to the display, if possible
- screen->params.color = gl_video_get_output_colorspace(p->renderer);
- *(struct mp_image **)data = screen;
- return true;
- }
case VOCTRL_SCREENSHOT: {
struct vo_frame *frame = vo_get_current_vo_frame(vo);
if (frame) {
diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c
index 21ad5c30c7..cbe0911385 100644
--- a/video/out/vulkan/context.c
+++ b/video/out/vulkan/context.c
@@ -565,7 +565,6 @@ static void swap_buffers(struct ra_swapchain *sw)
}
static const struct ra_swapchain_fns vulkan_swapchain = {
- // .screenshot is not currently supported
.color_depth = color_depth,
.start_frame = start_frame,
.submit_frame = submit_frame,