1
0
Fork 0

onscreen/native: Increase secondary GPU dumb_fbs from 2 to 3

So that they don't get overwritten prematurely during triple buffering
causing tearing.

https://launchpad.net/bugs/1999216

(cherry picked from commit 336e7b5506648c4777b6f1b1f3bcfebf32304f95)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This commit is contained in:
Daniel van Vugt 2022-12-09 14:22:31 +08:00 committed by Mingi Sung
parent e3ea9c6b55
commit b41108f3d3
Signed by: sungmg
GPG key ID: 41BAFD6FFD8036C5

View file

@ -77,7 +77,7 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
struct {
MetaDrmBufferDumb *current_dumb_fb;
MetaDrmBufferDumb *dumb_fbs[2];
MetaDrmBufferDumb *dumb_fbs[3];
} cpu;
gboolean noted_primary_gpu_copy_ok;
@ -1020,11 +1020,16 @@ static MetaDrmBufferDumb *
secondary_gpu_get_next_dumb_buffer (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
{
MetaDrmBufferDumb *current_dumb_fb;
const int n_dumb_fbs = G_N_ELEMENTS (secondary_gpu_state->cpu.dumb_fbs);
int i;
current_dumb_fb = secondary_gpu_state->cpu.current_dumb_fb;
if (current_dumb_fb == secondary_gpu_state->cpu.dumb_fbs[0])
return secondary_gpu_state->cpu.dumb_fbs[1];
else
for (i = 0; i < n_dumb_fbs; i++)
{
if (current_dumb_fb == secondary_gpu_state->cpu.dumb_fbs[i])
return secondary_gpu_state->cpu.dumb_fbs[(i + 1) % n_dumb_fbs];
}
return secondary_gpu_state->cpu.dumb_fbs[0];
}