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