vo: avoid putting large voctrl_performance_data on stack

This is around 512 kB, which is just way too much. Heap-allocate it
instead. Also cut down the max pass count to 64, since 128 was
unrealistically high even for vo_opengl.
This commit is contained in:
Niklas Haas 2017-09-11 18:20:18 +02:00
parent 71c25df5e6
commit 3faf1fb0a4
No known key found for this signature in database
GPG Key ID: 9A09076581B27402
3 changed files with 19 additions and 12 deletions

View File

@ -2913,19 +2913,21 @@ static int mp_property_vo_passes(void *ctx, struct m_property *prop,
return M_PROPERTY_OK;
}
struct voctrl_performance_data data = {0};
if (vo_control(mpctx->video_out, VOCTRL_PERFORMANCE_DATA, &data) <= 0)
return M_PROPERTY_UNAVAILABLE;
int ret = M_PROPERTY_UNAVAILABLE;
struct voctrl_performance_data *data = talloc_ptrtype(NULL, data);
if (vo_control(mpctx->video_out, VOCTRL_PERFORMANCE_DATA, data) <= 0)
goto out;
switch (action) {
case M_PROPERTY_PRINT: {
char *res = NULL;
res = talloc_asprintf_append(res, "fresh:\n");
res = asprint_perf(res, &data.fresh);
res = asprint_perf(res, &data->fresh);
res = talloc_asprintf_append(res, "\nredraw:\n");
res = asprint_perf(res, &data.redraw);
res = asprint_perf(res, &data->redraw);
*(char **)arg = res;
return M_PROPERTY_OK;
ret = M_PROPERTY_OK;
goto out;
}
case M_PROPERTY_GET: {
@ -2933,14 +2935,19 @@ static int mp_property_vo_passes(void *ctx, struct m_property *prop,
node_init(&node, MPV_FORMAT_NODE_MAP, NULL);
struct mpv_node *fresh = node_map_add(&node, "fresh", MPV_FORMAT_NODE_ARRAY);
struct mpv_node *redraw = node_map_add(&node, "redraw", MPV_FORMAT_NODE_ARRAY);
get_frame_perf(fresh, &data.fresh);
get_frame_perf(redraw, &data.redraw);
get_frame_perf(fresh, &data->fresh);
get_frame_perf(redraw, &data->redraw);
*(struct mpv_node *)arg = node;
return M_PROPERTY_OK;
ret = M_PROPERTY_OK;
goto out;
}
}
return M_PROPERTY_NOT_IMPLEMENTED;
ret = M_PROPERTY_NOT_IMPLEMENTED;
out:
talloc_free(data);
return ret;
}
static int mp_property_vo(void *ctx, struct m_property *p, int action, void *arg)

View File

@ -27,6 +27,7 @@
#include "shader_cache.h"
#include "video/csputils.h"
#include "video/out/filter_kernels.h"
#include "video/out/vo.h"
// Assume we have this many texture units for sourcing additional passes.
// The actual texture unit assignment is dynamic.
@ -164,7 +165,6 @@ void gl_video_resize(struct gl_video *p,
struct mp_rect *src, struct mp_rect *dst,
struct mp_osd_res *osd);
void gl_video_set_fb_depth(struct gl_video *p, int fb_depth);
struct voctrl_performance_data;
void gl_video_perfdata(struct gl_video *p, struct voctrl_performance_data *out);
void gl_video_set_clear_color(struct gl_video *p, struct m_color color);
void gl_video_set_osd_pts(struct gl_video *p, double pts);

View File

@ -152,7 +152,7 @@ struct mp_pass_perf {
uint64_t count;
};
#define VO_PASS_PERF_MAX 128
#define VO_PASS_PERF_MAX 64
struct mp_frame_perf {
int count;