summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2020-12-06 19:06:30 +0100
committerJan Ekström <jeebjp@gmail.com>2020-12-06 21:46:29 +0200
commitb8156a9a86ae4ff087b1b255c68a3ca38ec2d086 (patch)
tree445a44e83d743757a99418f710a6c5347887cefa /video
parent96bcf51c3907ca04a2f553e71d3ac7dea5ebeb06 (diff)
downloadmpv-b8156a9a86ae4ff087b1b255c68a3ca38ec2d086.tar.bz2
mpv-b8156a9a86ae4ff087b1b255c68a3ca38ec2d086.tar.xz
vo_gpu: revert 8a09299 and conditionally clear framebuffer again
in the original commit, that removed the conditional clearing, an incorrect assumption was made that clearing "should be practically free" and can be done always. though, at least on macOS + intel this can have a performance impact of up to 50% increased usage. it might have an impact on other platforms and setups as well, but this is unconfirmed. the reason for removing the conditional clearing was to partially work around a driver bug on very specific setups, X11 with amdgpu and OpenGL, to clear garbled frames on start. though it still has issues with garbled frames in other situation like fullscreening. there is also an open bug report on the mesa bug tracker about this. setting the radeonsi_zerovram flag works around all of those issues. since the flag works around all these issues and the original fix doesn't work completely we revert it and keep our optimisation. Fixes #8273
Diffstat (limited to 'video')
-rw-r--r--video/out/gpu/video.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 851289e281..a99e70270e 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -3246,9 +3246,11 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame,
bool has_frame = !!frame->current;
- struct m_color c = p->clear_color;
- float clear_color[4] = {c.r / 255.0, c.g / 255.0, c.b / 255.0, c.a / 255.0};
- p->ra->fns->clear(p->ra, fbo.tex, clear_color, &target_rc);
+ if (!has_frame || !mp_rect_equals(&p->dst_rect, &target_rc)) {
+ struct m_color c = p->clear_color;
+ float clear_color[4] = {c.r / 255.0, c.g / 255.0, c.b / 255.0, c.a / 255.0};
+ p->ra->fns->clear(p->ra, fbo.tex, clear_color, &target_rc);
+ }
if (p->hwdec_overlay) {
if (has_frame) {