vo_gpu: unconditionally clear framebuffer on start of frame

For some reason, the first frame displayed on X11 with amdgpu and OpenGL
will be garbled. This is especially visible if the player starts,
displays a frame, but then still takes a while to properly start
playback.

With --interpolation, the behavior somehow changes (usually gets worse).
I'm not sure what exactly is going on, and the code in video.c is way
too abstruse. Maybe there is some slight possibility that a frame with
uncleared contents gets displayed, which somehow also corrupts another
frame that is displayed immediately after that.

If clear is unconditionally run, this somehow doesn't happen, and you
see a video frame. By any logic this shouldn't happen: a video frame
should always overwrite the background. So I can't exclude that this
isn't some sort of driver bug, or at least very obscure interaction.

Clearing should be practically free anyway, so always do it.

Fixes: #7105
This commit is contained in:
wm4 2019-11-06 22:42:44 +01:00
parent e8aae688c3
commit 8a0929973d
1 changed files with 3 additions and 5 deletions

View File

@ -3223,11 +3223,9 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame,
bool has_frame = !!frame->current;
if (!has_frame || !mp_rect_equals(&p->dst_rect, &target_rc)) {
struct m_color c = p->clear_color;
float 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, color, &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) {