backends/native: Introduce MetaRendererViewNative
MetaRendererViewNative is a MetaRendererView which contains logic specific to views of the native backend. It will be used by following commits. In the future, per-view logic from MetaRendererNative can be moved to MetaRendererViewNative where it makes more sense to have it. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
This commit is contained in:
parent
2dfbbf0068
commit
1abd930c56
@ -49,28 +49,32 @@ enum
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST];
|
||||
|
||||
struct _MetaRendererView
|
||||
typedef struct _MetaRendererViewPrivate
|
||||
{
|
||||
MetaStageView parent;
|
||||
|
||||
MetaMonitorTransform transform;
|
||||
|
||||
MetaCrtc *crtc;
|
||||
};
|
||||
} MetaRendererViewPrivate;
|
||||
|
||||
G_DEFINE_TYPE (MetaRendererView, meta_renderer_view,
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaRendererView, meta_renderer_view,
|
||||
META_TYPE_STAGE_VIEW)
|
||||
|
||||
MetaMonitorTransform
|
||||
meta_renderer_view_get_transform (MetaRendererView *view)
|
||||
{
|
||||
return view->transform;
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (view);
|
||||
|
||||
return priv->transform;
|
||||
}
|
||||
|
||||
MetaCrtc *
|
||||
meta_renderer_view_get_crtc (MetaRendererView *view)
|
||||
{
|
||||
return view->crtc;
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (view);
|
||||
|
||||
return priv->crtc;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -78,10 +82,13 @@ meta_renderer_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||
graphene_matrix_t *matrix)
|
||||
{
|
||||
MetaRendererView *renderer_view = META_RENDERER_VIEW (view);
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (renderer_view);
|
||||
|
||||
graphene_matrix_init_identity (matrix);
|
||||
|
||||
meta_monitor_transform_transform_matrix (
|
||||
meta_monitor_transform_invert (renderer_view->transform), matrix);
|
||||
meta_monitor_transform_invert (priv->transform), matrix);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -102,9 +109,11 @@ meta_renderer_view_transform_rect_to_onscreen (ClutterStageView *view
|
||||
cairo_rectangle_int_t *dst_rect)
|
||||
{
|
||||
MetaRendererView *renderer_view = META_RENDERER_VIEW (view);
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (renderer_view);
|
||||
|
||||
return meta_rectangle_transform (src_rect,
|
||||
renderer_view->transform,
|
||||
priv->transform,
|
||||
dst_width,
|
||||
dst_height,
|
||||
dst_rect);
|
||||
@ -114,10 +123,13 @@ static void
|
||||
meta_renderer_view_set_transform (MetaRendererView *view,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
if (view->transform == transform)
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (view);
|
||||
|
||||
if (priv->transform == transform)
|
||||
return;
|
||||
|
||||
view->transform = transform;
|
||||
priv->transform = transform;
|
||||
clutter_stage_view_invalidate_offscreen_blit_pipeline (CLUTTER_STAGE_VIEW (view));
|
||||
}
|
||||
|
||||
@ -128,14 +140,16 @@ meta_renderer_view_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaRendererView *view = META_RENDERER_VIEW (object);
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (view);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TRANSFORM:
|
||||
g_value_set_uint (value, view->transform);
|
||||
g_value_set_uint (value, priv->transform);
|
||||
break;
|
||||
case PROP_CRTC:
|
||||
g_value_set_object (value, view->crtc);
|
||||
g_value_set_object (value, priv->crtc);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -150,6 +164,8 @@ meta_renderer_view_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaRendererView *view = META_RENDERER_VIEW (object);
|
||||
MetaRendererViewPrivate *priv =
|
||||
meta_renderer_view_get_instance_private (view);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -157,7 +173,7 @@ meta_renderer_view_set_property (GObject *object,
|
||||
meta_renderer_view_set_transform (view, g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_CRTC:
|
||||
view->crtc = g_value_get_object (value);
|
||||
priv->crtc = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -24,10 +24,15 @@
|
||||
|
||||
#define META_TYPE_RENDERER_VIEW (meta_renderer_view_get_type ())
|
||||
META_EXPORT_TEST
|
||||
G_DECLARE_FINAL_TYPE (MetaRendererView, meta_renderer_view,
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaRendererView, meta_renderer_view,
|
||||
META, RENDERER_VIEW,
|
||||
MetaStageView)
|
||||
|
||||
struct _MetaRendererViewClass
|
||||
{
|
||||
MetaStageViewClass parent_class;
|
||||
};
|
||||
|
||||
MetaMonitorTransform meta_renderer_view_get_transform (MetaRendererView *view);
|
||||
|
||||
META_EXPORT_TEST
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "backends/native/meta-render-device-gbm.h"
|
||||
#include "backends/native/meta-render-device-surfaceless.h"
|
||||
#include "backends/native/meta-renderer-native-private.h"
|
||||
#include "backends/native/meta-renderer-view-native.h"
|
||||
#include "cogl/cogl.h"
|
||||
#include "core/boxes-private.h"
|
||||
|
||||
@ -1258,7 +1259,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
int onscreen_width;
|
||||
int onscreen_height;
|
||||
MetaRectangle view_layout;
|
||||
MetaRendererView *view;
|
||||
MetaRendererViewNative *view_native;
|
||||
EGLSurface egl_surface;
|
||||
GError *error = NULL;
|
||||
|
||||
@ -1371,7 +1372,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
meta_rectangle_from_graphene_rect (&crtc_config->layout,
|
||||
META_ROUNDING_STRATEGY_ROUND,
|
||||
&view_layout);
|
||||
view = g_object_new (META_TYPE_RENDERER_VIEW,
|
||||
view_native = g_object_new (META_TYPE_RENDERER_VIEW_NATIVE,
|
||||
"name", meta_output_get_name (output),
|
||||
"stage", meta_backend_get_stage (backend),
|
||||
"layout", &view_layout,
|
||||
@ -1390,7 +1391,8 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
CoglDisplayEGL *cogl_display_egl;
|
||||
CoglOnscreenEgl *onscreen_egl;
|
||||
|
||||
meta_onscreen_native_set_view (COGL_ONSCREEN (framebuffer), view);
|
||||
meta_onscreen_native_set_view (COGL_ONSCREEN (framebuffer),
|
||||
META_RENDERER_VIEW (view_native));
|
||||
|
||||
/* Ensure we don't point to stale surfaces when creating the offscreen */
|
||||
cogl_display_egl = cogl_display->winsys;
|
||||
@ -1402,7 +1404,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
cogl_display_egl->egl_context);
|
||||
}
|
||||
|
||||
return view;
|
||||
return META_RENDERER_VIEW (view_native);
|
||||
}
|
||||
|
||||
static void
|
||||
|
43
src/backends/native/meta-renderer-view-native.c
Normal file
43
src/backends/native/meta-renderer-view-native.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Dor Askayo
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Written by:
|
||||
* Dor Askayo <dor.askayo@gmail.com>
|
||||
*/
|
||||
|
||||
#include "backends/native/meta-renderer-view-native.h"
|
||||
|
||||
struct _MetaRendererViewNative
|
||||
{
|
||||
MetaRendererView parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaRendererViewNative, meta_renderer_view_native,
|
||||
META_TYPE_RENDERER_VIEW)
|
||||
|
||||
static void
|
||||
meta_renderer_view_native_class_init (MetaRendererViewNativeClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_renderer_view_native_init (MetaRendererViewNative *view_native)
|
||||
{
|
||||
}
|
34
src/backends/native/meta-renderer-view-native.h
Normal file
34
src/backends/native/meta-renderer-view-native.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Dor Askayo
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Written by:
|
||||
* Dor Askayo <dor.askayo@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef META_RENDERER_VIEW_NATIVE_H
|
||||
#define META_RENDERER_VIEW_NATIVE_H
|
||||
|
||||
#include "backends/meta-renderer-view.h"
|
||||
|
||||
#define META_TYPE_RENDERER_VIEW_NATIVE (meta_renderer_view_native_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaRendererViewNative, meta_renderer_view_native,
|
||||
META, RENDERER_VIEW_NATIVE, MetaRendererView)
|
||||
|
||||
#endif /* META_RENDERER_VIEW_NATIVE_H */
|
@ -813,6 +813,8 @@ if have_native_backend
|
||||
'backends/native/meta-renderer-native-private.h',
|
||||
'backends/native/meta-renderer-native.c',
|
||||
'backends/native/meta-renderer-native.h',
|
||||
'backends/native/meta-renderer-view-native.c',
|
||||
'backends/native/meta-renderer-view-native.h',
|
||||
'backends/native/meta-seat-impl.c',
|
||||
'backends/native/meta-seat-impl.h',
|
||||
'backends/native/meta-seat-native.c',
|
||||
|
Loading…
Reference in New Issue
Block a user