mutter/src/backends/native/meta-onscreen-native.h

68 lines
2.7 KiB
C
Raw Normal View History

/*
* Copyright (C) 2016-2020 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <glib.h>
#include "backends/meta-backend-types.h"
#include "backends/native/meta-backend-native-types.h"
#include "clutter/clutter.h"
#include "cogl/cogl.h"
#include "core/util-private.h"
#define META_TYPE_ONSCREEN_NATIVE (meta_onscreen_native_get_type ())
META_EXPORT_TEST
G_DECLARE_FINAL_TYPE (MetaOnscreenNative, meta_onscreen_native,
META, ONSCREEN_NATIVE,
CoglOnscreenEgl)
void meta_renderer_native_release_onscreen (CoglOnscreen *onscreen);
void meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
ClutterFrame *frame);
kms/impl-device: Add deadline based KMS commit scheduling This makes it possible to post KMS updates that will always defer until just before the scanout deadline. This is useful to allow queuing cursor updates where we don't want to post them to KMS immediately, but rather wait until as late as possible to get lower latency. We cannot delay primary plane compositions however, and this is due to how the kernel may prioritize GPU work - not until a pipeline gets attached to a atomic commit will it in some drivers get bumped to high priority. This means we still need to post any update that depends on OpenGL pipelines as soon as possible. To avoid working on compositing, then getting stomped on the feet by the deadline scheduler, the deadline timer is disarmed whenever there is a frame currently being painted. This will still allow new cursor updates to arrive during composition, but will delay the actual KMS commit until the primary plane update has been posted. Still, even for cursor-only we still need higher than default timing capabilities, thus the deadline scheduler depends on the KMS thread getting real-time scheduling priority. When the thread isn't realtime scheduled, the KMS thread instead asks the main thread to "flush" the commit as part of the regular frame update. A flushing update means one that isn't set to always defer and has a latching CRTC. The verbose KMS debug logging makes the processing take too long, making us more likely to miss the deadline. Avoid this by increasing the evasion length when debug logging is enabled. Not the best, but better than changing the behavior completely. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2022-10-26 19:08:30 +02:00
void meta_onscreen_native_before_redraw (CoglOnscreen *onscreen,
ClutterFrame *frame);
void meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
ClutterFrame *frame);
void meta_onscreen_native_dummy_power_save_page_flip (CoglOnscreen *onscreen);
gboolean meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
MetaDrmBuffer *fb);
void meta_onscreen_native_set_view (CoglOnscreen *onscreen,
MetaRendererView *view);
MetaOnscreenNative * meta_onscreen_native_new (MetaRendererNative *renderer_native,
MetaGpuKms *render_gpu,
MetaOutput *output,
MetaCrtc *crtc,
CoglContext *cogl_context,
int width,
int height);
META_EXPORT_TEST
renderer/native: Don't clear GPU data with pending page flips An incorrect assumption that after mode set there would be no pending page flips was made. This meant that if there was a mode set, followed by a page flip, if that page flip was for a CRTC on a now unused GPU, we'd crash due to the renderer GPU data having already been freed. This commit avoids that by keeping it alive as long as the page flips are still in the air. It fixes crashes with backtraces such as 0) meta_render_device_get_egl_display (render_device=0x0) at ../src/backends/native/meta-render-device.c:320 1) secondary_gpu_state_free (secondary_gpu_state=0x1c8cc30) at ../src/backends/native/meta-onscreen-native.c:560 2) meta_onscreen_native_dispose (object=0x1cb65e0) at ../src/backends/native/meta-onscreen-native.c:2168 3) g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3540 4) g_object_unref (_object=0x1cb65e0) at ../gobject/gobject.c:3470 5) clutter_stage_view_finalize (object=0x1cbb450) at ../clutter/clutter/clutter-stage-view.c:1412 6) g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3578 7) g_object_unref (_object=0x1cbb450) at ../gobject/gobject.c:3470 8) meta_kms_page_flip_closure_free (closure=0x1d47e60) at ../src/backends/native/meta-kms-page-flip.c:76 9) g_list_foreach (list=<optimized out>, func=0x7fb3ada67111 <meta_kms_page_flip_closure_free>, user_data=0x0) at ../glib/glist.c:1090 10) g_list_free_full (list=0x1cb4d20 = {...}, free_func=<optimized out>) at ../glib/glist.c:244 11) meta_kms_page_flip_data_unref (page_flip_data=0x1c65510) at ../src/backends/native/meta-kms-page-flip.c:109 12) meta_kms_callback_data_free (callback_data=0x227ebf0) at ../src/backends/native/meta-kms.c:372 13) flush_callbacks (kms=0x18e2630) at ../src/backends/native/meta-kms.c:391 14) callback_idle (user_data=0x18e2630) at ../src/backends/native/meta-kms.c Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
2021-12-09 11:18:21 +01:00
MetaCrtc * meta_onscreen_native_get_crtc (MetaOnscreenNative *onscreen_native);
void meta_onscreen_native_invalidate (MetaOnscreenNative *onscreen_native);
void meta_onscreen_native_detach (MetaOnscreenNative *onscreen_native);