gsk: Prepare subsurface offload

Use a GskOffloadInfo to update subsurfaces (and collect info about
them). Pass that info to both the diff and the render vfuncs.
This commit is contained in:
Matthias Clasen 2023-10-31 19:19:32 -04:00
parent 48740de71a
commit b7c2528ad1
6 changed files with 23 additions and 15 deletions

View File

@ -919,7 +919,8 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
static void
gsk_broadway_renderer_render (GskRenderer *renderer,
GskRenderNode *root,
const cairo_region_t *update_area)
const cairo_region_t *update_area,
GskOffload *offload)
{
GskBroadwayRenderer *self = GSK_BROADWAY_RENDERER (renderer);

View File

@ -272,7 +272,8 @@ update_area_requires_clear (GdkSurface *surface,
static void
gsk_gl_renderer_render (GskRenderer *renderer,
GskRenderNode *root,
const cairo_region_t *update_area)
const cairo_region_t *update_area,
GskOffload *offload)
{
GskGLRenderer *self = (GskGLRenderer *)renderer;
cairo_region_t *render_region;

View File

@ -152,7 +152,8 @@ gsk_cairo_renderer_render_texture (GskRenderer *renderer,
static void
gsk_cairo_renderer_render (GskRenderer *renderer,
GskRenderNode *root,
const cairo_region_t *region)
const cairo_region_t *region,
GskOffload *offload)
{
GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer);
cairo_t *cr;

View File

@ -41,6 +41,7 @@
#include "gl/gskglrenderer.h"
#include "gskprofilerprivate.h"
#include "gskrendernodeprivate.h"
#include "gskoffloadprivate.h"
#include "gskenumtypes.h"
@ -128,7 +129,8 @@ gsk_renderer_real_render_texture (GskRenderer *self,
static void
gsk_renderer_real_render (GskRenderer *self,
GskRenderNode *root,
const cairo_region_t *region)
const cairo_region_t *region,
GskOffload *offload)
{
GSK_RENDERER_WARN_NOT_IMPLEMENTED_METHOD (self, render);
}
@ -424,6 +426,7 @@ gsk_renderer_render (GskRenderer *renderer,
{
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
cairo_region_t *clip;
GskOffload *offload = NULL;
g_return_if_fail (GSK_IS_RENDERER (renderer));
g_return_if_fail (priv->is_realized);
@ -433,6 +436,11 @@ gsk_renderer_render (GskRenderer *renderer,
if (priv->surface == NULL)
return;
priv->root_node = gsk_render_node_ref (root);
if (!GSK_RENDERER_DEBUG_CHECK (renderer, OFFLOAD_DISABLE))
offload = gsk_offload_new (priv->surface, root);
if (region == NULL || priv->prev_node == NULL || GSK_RENDERER_DEBUG_CHECK (renderer, FULL_REDRAW))
{
clip = cairo_region_create_rectangle (&(GdkRectangle) {
@ -444,18 +452,11 @@ gsk_renderer_render (GskRenderer *renderer,
else
{
clip = cairo_region_copy (region);
gsk_render_node_diff (priv->prev_node, root, clip, NULL);
if (cairo_region_is_empty (clip))
{
cairo_region_destroy (clip);
return;
}
gsk_render_node_diff (priv->prev_node, root, clip, offload);
}
priv->root_node = gsk_render_node_ref (root);
GSK_RENDERER_GET_CLASS (renderer)->render (renderer, root, clip);
GSK_RENDERER_GET_CLASS (renderer)->render (renderer, root, clip, offload);
if (GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
{
@ -474,6 +475,7 @@ gsk_renderer_render (GskRenderer *renderer,
g_clear_pointer (&priv->prev_node, gsk_render_node_unref);
cairo_region_destroy (clip);
gsk_offload_free (offload);
priv->prev_node = priv->root_node;
priv->root_node = NULL;
}

View File

@ -21,6 +21,7 @@
#include "gskrenderer.h"
#include "gskprofilerprivate.h"
#include "gskdebugprivate.h"
#include "gskoffloadprivate.h"
G_BEGIN_DECLS
@ -47,7 +48,8 @@ struct _GskRendererClass
const graphene_rect_t *viewport);
void (* render) (GskRenderer *renderer,
GskRenderNode *root,
const cairo_region_t *invalid);
const cairo_region_t *invalid,
GskOffload *offload);
};
GskProfiler * gsk_renderer_get_profiler (GskRenderer *renderer);

View File

@ -349,7 +349,8 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer,
static void
gsk_vulkan_renderer_render (GskRenderer *renderer,
GskRenderNode *root,
const cairo_region_t *region)
const cairo_region_t *region,
GskOffload *offload)
{
GskVulkanRenderer *self = GSK_VULKAN_RENDERER (renderer);
GskVulkanRender *render;