onscreen/native: Split swap_buffers_with_damage into two functions
1. The EGL part: meta_onscreen_native_swap_buffers_with_damage 2. The KMS part: post_latest_swap (cherry picked from commit 37b6ddd6172d3aeafeb5561899adc669982b190e) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441> Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This commit is contained in:
parent
367bd34bf4
commit
e895919517
1 changed files with 44 additions and 19 deletions
|
@ -140,6 +140,9 @@ G_DEFINE_TYPE (MetaOnscreenNative, meta_onscreen_native,
|
|||
|
||||
static GQuark blit_source_quark = 0;
|
||||
|
||||
static void
|
||||
post_latest_swap (CoglOnscreen *onscreen);
|
||||
|
||||
static gboolean
|
||||
init_secondary_gpu_state (MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
|
@ -1346,28 +1349,18 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
|
||||
MetaRendererNativeGpuData *renderer_gpu_data = cogl_renderer_egl->platform;
|
||||
MetaRendererNative *renderer_native = renderer_gpu_data->renderer_native;
|
||||
MetaRenderer *renderer = META_RENDERER (renderer_native);
|
||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
|
||||
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
||||
MetaDeviceFile *render_device_file;
|
||||
ClutterFrame *frame = user_data;
|
||||
MetaFrameNative *frame_native = meta_frame_native_from_frame (frame);
|
||||
MetaKmsUpdate *kms_update;
|
||||
CoglOnscreenClass *parent_class;
|
||||
MetaPowerSave power_save_mode;
|
||||
g_autoptr (GError) error = NULL;
|
||||
MetaDrmBufferFlags buffer_flags;
|
||||
MetaDrmBufferGbm *buffer_gbm;
|
||||
g_autoptr (MetaDrmBuffer) primary_gpu_fb = NULL;
|
||||
g_autoptr (MetaDrmBuffer) secondary_gpu_fb = NULL;
|
||||
g_autoptr (MetaDrmBuffer) buffer = NULL;
|
||||
MetaKmsCrtc *kms_crtc;
|
||||
MetaKmsDevice *kms_device;
|
||||
|
||||
COGL_TRACE_SCOPED_ANCHOR (MetaRendererNativePostKmsUpdate);
|
||||
|
||||
COGL_TRACE_BEGIN_SCOPED (MetaRendererNativeSwapBuffers,
|
||||
"Meta::OnscreenNative::swap_buffers_with_damage()");
|
||||
|
@ -1459,12 +1452,50 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||
clutter_frame_set_result (frame,
|
||||
CLUTTER_FRAME_RESULT_PENDING_PRESENTED);
|
||||
|
||||
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (onscreen_native->crtc));
|
||||
kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||
meta_frame_native_set_damage (frame_native, rectangles, n_rectangles);
|
||||
post_latest_swap (onscreen);
|
||||
return;
|
||||
|
||||
swap_failed:
|
||||
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
|
||||
meta_onscreen_native_notify_frame_complete (onscreen);
|
||||
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
|
||||
}
|
||||
|
||||
static void
|
||||
post_latest_swap (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||
CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
|
||||
CoglRenderer *cogl_renderer = cogl_context->display->renderer;
|
||||
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
|
||||
MetaRendererNativeGpuData *renderer_gpu_data = cogl_renderer_egl->platform;
|
||||
MetaRendererNative *renderer_native = renderer_gpu_data->renderer_native;
|
||||
MetaRenderer *renderer = META_RENDERER (renderer_native);
|
||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
|
||||
MetaPowerSave power_save_mode;
|
||||
MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
|
||||
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||
MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||
MetaKmsUpdate *kms_update;
|
||||
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
|
||||
ClutterFrame *frame = onscreen_native->next_frame;
|
||||
MetaFrameNative *frame_native;
|
||||
|
||||
COGL_TRACE_SCOPED_ANCHOR (MetaRendererNativePostKmsUpdate);
|
||||
|
||||
power_save_mode = meta_monitor_manager_get_power_save_mode (monitor_manager);
|
||||
if (power_save_mode == META_POWER_SAVE_ON)
|
||||
{
|
||||
int n_rectangles;
|
||||
int *rectangles;
|
||||
|
||||
frame_native = meta_frame_native_from_frame (frame);
|
||||
n_rectangles = meta_frame_native_get_damage (frame_native, &rectangles);
|
||||
|
||||
kms_update = meta_frame_native_ensure_kms_update (frame_native,
|
||||
kms_device);
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
|
@ -1490,7 +1521,7 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||
}
|
||||
|
||||
COGL_TRACE_BEGIN_ANCHORED (MetaRendererNativePostKmsUpdate,
|
||||
"Meta::OnscreenNative::swap_buffers_with_damage#post_pending_update()");
|
||||
"Meta::OnscreenNative::post_latest_swap#post_pending_update()");
|
||||
|
||||
switch (renderer_gpu_data->mode)
|
||||
{
|
||||
|
@ -1556,12 +1587,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||
|
||||
meta_kms_device_post_update (kms_device, kms_update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
return;
|
||||
|
||||
swap_failed:
|
||||
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
|
||||
meta_onscreen_native_notify_frame_complete (onscreen);
|
||||
clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
Loading…
Reference in a new issue