|
|
5525bd |
From ca3e9e3b3b84fe95affbe5485212c6ecfa1a4b51 Mon Sep 17 00:00:00 2001
|
|
|
5525bd |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
5525bd |
Date: Tue, 22 Oct 2019 17:05:46 +0200
|
|
|
5525bd |
Subject: [PATCH 12/12] renderer-native: Separate offscreen and shadowfb
|
|
|
5525bd |
|
|
|
5525bd |
Create the intermediate shadow framebuffer for use exclusively when a
|
|
|
5525bd |
shadowfb is required.
|
|
|
5525bd |
|
|
|
5525bd |
Keep the previous offscreen framebuffer is as an intermediate
|
|
|
5525bd |
framebuffer for transformations only.
|
|
|
5525bd |
|
|
|
5525bd |
This way, we can apply transformations between in-memory framebuffers
|
|
|
5525bd |
prior to blit the result to screen, and achieve acceptable performance
|
|
|
5525bd |
even with software rendering on discrete GPU.
|
|
|
5525bd |
|
|
|
5525bd |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/917
|
|
|
5525bd |
|
|
|
5525bd |
(cherry picked from commit 551641c74822ca2e3c685e49603836ebf5397df2)
|
|
|
5525bd |
---
|
|
|
5525bd |
src/backends/native/meta-renderer-native.c | 29 ++++++++++++++++++----
|
|
|
5525bd |
1 file changed, 24 insertions(+), 5 deletions(-)
|
|
|
5525bd |
|
|
|
5525bd |
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
|
|
|
5525bd |
index 3cd01bcb7..ffb64a6bd 100644
|
|
|
5525bd |
--- a/src/backends/native/meta-renderer-native.c
|
|
|
5525bd |
+++ b/src/backends/native/meta-renderer-native.c
|
|
|
5525bd |
@@ -3287,7 +3287,6 @@ meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native,
|
|
|
5525bd |
static CoglOffscreen *
|
|
|
5525bd |
meta_renderer_native_create_offscreen (MetaRendererNative *renderer,
|
|
|
5525bd |
CoglContext *context,
|
|
|
5525bd |
- MetaMonitorTransform transform,
|
|
|
5525bd |
gint view_width,
|
|
|
5525bd |
gint view_height,
|
|
|
5525bd |
GError **error)
|
|
|
5525bd |
@@ -3489,6 +3488,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|
|
5525bd |
MetaMonitorTransform view_transform;
|
|
|
5525bd |
CoglOnscreen *onscreen = NULL;
|
|
|
5525bd |
CoglOffscreen *offscreen = NULL;
|
|
|
5525bd |
+ CoglOffscreen *shadowfb = NULL;
|
|
|
5525bd |
float scale;
|
|
|
5525bd |
int width, height;
|
|
|
5525bd |
MetaRendererView *view;
|
|
|
5525bd |
@@ -3515,18 +3515,35 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|
|
5525bd |
if (!onscreen)
|
|
|
5525bd |
g_error ("Failed to allocate onscreen framebuffer: %s", error->message);
|
|
|
5525bd |
|
|
|
5525bd |
- if (view_transform != META_MONITOR_TRANSFORM_NORMAL ||
|
|
|
5525bd |
- should_force_shadow_fb (renderer_native,
|
|
|
5525bd |
- renderer_native->primary_gpu_kms))
|
|
|
5525bd |
+ if (view_transform != META_MONITOR_TRANSFORM_NORMAL)
|
|
|
5525bd |
{
|
|
|
5525bd |
offscreen = meta_renderer_native_create_offscreen (renderer_native,
|
|
|
5525bd |
cogl_context,
|
|
|
5525bd |
- view_transform,
|
|
|
5525bd |
width,
|
|
|
5525bd |
height,
|
|
|
5525bd |
&error);
|
|
|
5525bd |
if (!offscreen)
|
|
|
5525bd |
g_error ("Failed to allocate back buffer texture: %s", error->message);
|
|
|
5525bd |
+
|
|
|
5525bd |
+ }
|
|
|
5525bd |
+
|
|
|
5525bd |
+ if (should_force_shadow_fb (renderer_native,
|
|
|
5525bd |
+ renderer_native->primary_gpu_kms))
|
|
|
5525bd |
+ {
|
|
|
5525bd |
+ int shadow_width;
|
|
|
5525bd |
+ int shadow_height;
|
|
|
5525bd |
+
|
|
|
5525bd |
+ /* The shadowfb must be the same size as the on-screen framebuffer */
|
|
|
5525bd |
+ shadow_width = cogl_framebuffer_get_width (COGL_FRAMEBUFFER (onscreen));
|
|
|
5525bd |
+ shadow_height = cogl_framebuffer_get_height (COGL_FRAMEBUFFER (onscreen));
|
|
|
5525bd |
+
|
|
|
5525bd |
+ shadowfb = meta_renderer_native_create_offscreen (renderer_native,
|
|
|
5525bd |
+ cogl_context,
|
|
|
5525bd |
+ shadow_width,
|
|
|
5525bd |
+ shadow_height,
|
|
|
5525bd |
+ &error);
|
|
|
5525bd |
+ if (!shadowfb)
|
|
|
5525bd |
+ g_error ("Failed to allocate shadow buffer texture: %s", error->message);
|
|
|
5525bd |
}
|
|
|
5525bd |
|
|
|
5525bd |
view = g_object_new (META_TYPE_RENDERER_VIEW,
|
|
|
5525bd |
@@ -3534,10 +3551,12 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
|
|
5525bd |
"scale", scale,
|
|
|
5525bd |
"framebuffer", onscreen,
|
|
|
5525bd |
"offscreen", offscreen,
|
|
|
5525bd |
+ "shadowfb", shadowfb,
|
|
|
5525bd |
"logical-monitor", logical_monitor,
|
|
|
5525bd |
"transform", view_transform,
|
|
|
5525bd |
NULL);
|
|
|
5525bd |
g_clear_pointer (&offscreen, cogl_object_unref);
|
|
|
5525bd |
+ g_clear_pointer (&shadowfb, cogl_object_unref);
|
|
|
5525bd |
|
|
|
5525bd |
meta_onscreen_native_set_view (onscreen, view);
|
|
|
5525bd |
|
|
|
5525bd |
--
|
|
|
5525bd |
2.21.0
|
|
|
5525bd |
|