renderer/native: Extract secondary_gpu_release_dumb

There will be another place where I need to release the dumb buffers but not
destroy the whole secondary_gpu_state, so extract this bit of code into a
helper.

The checks of fb_id are dropped as redundant with the check already in in
release_dumb_fb ().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/810
This commit is contained in:
Pekka Paalanen 2019-09-17 13:23:22 +03:00 committed by Jonas Ådahl
parent fe76e6a228
commit f409dddb54

View File

@ -714,13 +714,22 @@ init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_nat
return TRUE;
}
static void
secondary_gpu_release_dumb (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
{
MetaGpuKms *gpu_kms = secondary_gpu_state->gpu_kms;
unsigned i;
for (i = 0; i < G_N_ELEMENTS (secondary_gpu_state->cpu.dumb_fbs); i++)
release_dumb_fb (&secondary_gpu_state->cpu.dumb_fbs[i], gpu_kms);
}
static void
secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
{
MetaBackend *backend = meta_get_backend ();
MetaEgl *egl = meta_backend_get_egl (backend);
MetaGpuKms *gpu_kms = secondary_gpu_state->gpu_kms;
unsigned int i;
if (secondary_gpu_state->egl_surface != EGL_NO_SURFACE)
{
@ -737,13 +746,7 @@ secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_sta
g_clear_object (&secondary_gpu_state->gbm.next_fb);
g_clear_pointer (&secondary_gpu_state->gbm.surface, gbm_surface_destroy);
for (i = 0; i < G_N_ELEMENTS (secondary_gpu_state->cpu.dumb_fbs); i++)
{
MetaDumbBuffer *dumb_fb = &secondary_gpu_state->cpu.dumb_fbs[i];
if (dumb_fb->fb_id)
release_dumb_fb (dumb_fb, gpu_kms);
}
secondary_gpu_release_dumb (secondary_gpu_state);
g_free (secondary_gpu_state);
}