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

63 lines
2.5 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
*/
#ifndef META_ONSCREEN_NATIVE_H
#define META_ONSCREEN_NATIVE_H
#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_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 10:18:21 +00:00
MetaCrtc * meta_onscreen_native_get_crtc (MetaOnscreenNative *onscreen_native);
#endif /* META_ONSCREEN_NATIVE_H */