renderer/native: Queue mode reset from new rebuild_views vfunc

Simplify the call site a bit and make the native renderer know it should
queue mode reset itself when views have been rebuilt. This is done
partly due to more things needing to be dealt with after views have been
rebuilt.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
This commit is contained in:
Jonas Ådahl 2019-06-19 20:57:14 +02:00
parent 8c339dac3e
commit 0756fd4636
5 changed files with 25 additions and 4 deletions

View File

@ -90,6 +90,12 @@ meta_renderer_create_view (MetaRenderer *renderer,
*/ */
void void
meta_renderer_rebuild_views (MetaRenderer *renderer) meta_renderer_rebuild_views (MetaRenderer *renderer)
{
return META_RENDERER_GET_CLASS (renderer)->rebuild_views (renderer);
}
static void
meta_renderer_real_rebuild_views (MetaRenderer *renderer)
{ {
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer); MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
MetaBackend *backend = meta_get_backend (); MetaBackend *backend = meta_get_backend ();
@ -181,4 +187,6 @@ meta_renderer_class_init (MetaRendererClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_renderer_finalize; object_class->finalize = meta_renderer_finalize;
klass->rebuild_views = meta_renderer_real_rebuild_views;
} }

View File

@ -43,6 +43,7 @@ struct _MetaRendererClass
CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer); CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer);
MetaRendererView * (* create_view) (MetaRenderer *renderer, MetaRendererView * (* create_view) (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor); MetaLogicalMonitor *logical_monitor);
void (* rebuild_views) (MetaRenderer *renderer);
}; };
CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer); CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer);

View File

@ -256,6 +256,9 @@ cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format, CoglPixelFormat *out_format,
CoglTextureComponents *out_components); CoglTextureComponents *out_components);
static void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
static void static void
meta_renderer_native_gpu_data_free (MetaRendererNativeGpuData *renderer_gpu_data) meta_renderer_native_gpu_data_free (MetaRendererNativeGpuData *renderer_gpu_data)
{ {
@ -2743,7 +2746,7 @@ meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native)
return TRUE; return TRUE;
} }
void static void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native) meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
{ {
MetaRenderer *renderer = META_RENDERER (renderer_native); MetaRenderer *renderer = META_RENDERER (renderer_native);
@ -3110,6 +3113,17 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
return view; return view;
} }
static void
meta_renderer_native_rebuild_views (MetaRenderer *renderer)
{
MetaRendererClass *parent_renderer_class =
META_RENDERER_CLASS (meta_renderer_native_parent_class);
parent_renderer_class->rebuild_views (renderer);
meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
}
void void
meta_renderer_native_finish_frame (MetaRendererNative *renderer_native) meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
{ {
@ -3934,6 +3948,7 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass)
renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer; renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer;
renderer_class->create_view = meta_renderer_native_create_view; renderer_class->create_view = meta_renderer_native_create_view;
renderer_class->rebuild_views = meta_renderer_native_rebuild_views;
obj_props[PROP_BACKEND] = obj_props[PROP_BACKEND] =
g_param_spec_object ("backend", g_param_spec_object ("backend",

View File

@ -53,8 +53,6 @@ struct gbm_device * meta_gbm_device_from_gpu (MetaGpuKms *gpu_kms);
gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native); gboolean meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native);
void meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native); void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native);
int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native); int64_t meta_renderer_native_get_frame_counter (MetaRendererNative *renderer_native);

View File

@ -140,7 +140,6 @@ meta_stage_native_rebuild_views (MetaStageNative *stage_native)
ClutterActor *stage = meta_backend_get_stage (backend); ClutterActor *stage = meta_backend_get_stage (backend);
meta_renderer_rebuild_views (renderer); meta_renderer_rebuild_views (renderer);
meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
clutter_stage_update_resource_scales (CLUTTER_STAGE (stage)); clutter_stage_update_resource_scales (CLUTTER_STAGE (stage));
ensure_frame_callbacks (stage_native); ensure_frame_callbacks (stage_native);
} }