renderer-view/native: Allocate backend specific ClutterFrame

This will carry an on-demand created MetaKmsUpdate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
This commit is contained in:
Jonas Ådahl 2022-07-07 09:26:06 +02:00 committed by Robert Mader
parent 678dc3243f
commit 7b634df379
8 changed files with 86 additions and 5 deletions

View File

@ -735,7 +735,7 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
if (iface->new_frame)
frame = iface->new_frame (frame_clock, frame_clock->listener.user_data);
if (!frame)
frame = clutter_frame_new ();
frame = clutter_frame_new (ClutterFrame);
frame->frame_count = frame_count;
frame->has_target_presentation_time = frame_clock->is_next_presentation_time_valid;

View File

@ -34,7 +34,10 @@ struct _ClutterFrame
};
CLUTTER_EXPORT
ClutterFrame * clutter_frame_new (void);
gpointer clutter_frame_new (size_t size);
#define clutter_frame_new(FrameType) \
((FrameType *) (clutter_frame_new (sizeof (FrameType))))
ClutterFrameResult clutter_frame_get_result (ClutterFrame *frame);

View File

@ -35,12 +35,14 @@ clutter_frame_unref (ClutterFrame *frame)
g_free (frame);
}
ClutterFrame *
clutter_frame_new (void)
gpointer
(clutter_frame_new) (size_t size)
{
ClutterFrame *frame;
frame = g_new0 (ClutterFrame, 1);
g_assert (size >= sizeof (ClutterFrame));
frame = g_malloc0 (size);
g_ref_count_init (&frame->ref_count);
return frame;

View File

@ -29,6 +29,7 @@
#include "clutter-backend-private.h"
#include "clutter-damage-history.h"
#include "clutter-event-private.h"
#include "clutter-frame-private.h"
#include "clutter-input-device-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"

View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2022 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.
*/
#include "config.h"
#include "backends/native/meta-frame-native.h"
#include "clutter/clutter-mutter.h"
struct _MetaFrameNative
{
ClutterFrame base;
};
MetaFrameNative *
meta_frame_native_new (void)
{
return clutter_frame_new (MetaFrameNative);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2022 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_FRAME_NATIVE_H
#define META_FRAME_NATIVE_H
typedef struct _MetaFrameNative MetaFrameNative;
MetaFrameNative * meta_frame_native_new (void);
#endif /* META_FRAME_NATIVE_H */

View File

@ -24,6 +24,8 @@
#include "backends/native/meta-renderer-view-native.h"
#include "backends/native/meta-frame-native.h"
struct _MetaRendererViewNative
{
MetaRendererView parent;
@ -32,9 +34,18 @@ struct _MetaRendererViewNative
G_DEFINE_TYPE (MetaRendererViewNative, meta_renderer_view_native,
META_TYPE_RENDERER_VIEW)
static ClutterFrame *
meta_renderer_view_native_new_frame (ClutterStageView *stage_view)
{
return (ClutterFrame *) meta_frame_native_new ();
}
static void
meta_renderer_view_native_class_init (MetaRendererViewNativeClass *klass)
{
ClutterStageViewClass *stage_view_class = CLUTTER_STAGE_VIEW_CLASS (klass);
stage_view_class->new_frame = meta_renderer_view_native_new_frame;
}
static void

View File

@ -743,6 +743,8 @@ if have_native_backend
'backends/native/meta-drm-buffer.h',
'backends/native/meta-gpu-kms.c',
'backends/native/meta-gpu-kms.h',
'backends/native/meta-frame-native.c',
'backends/native/meta-frame-native.h',
'backends/native/meta-input-device-native.c',
'backends/native/meta-input-device-native.h',
'backends/native/meta-input-device-tool-native.c',