cogl: Add new path cache

This redesigns the path cache so that it does not mess with the
context functions, thereby hopefully making it much more resilient
to changes in the rest of cairo that change the way the default
context works. It is also much simpler, and it is anticipated that
it will be more maintainable. Performance in contrast to the old
cache design speeds up most traces in cairo-perf-trace, and slows
down only a lesser few by <20%.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This commit is contained in:
George Matsumura 2020-08-05 23:10:42 -06:00
parent 939da43c44
commit ecbd7ed174
8 changed files with 500 additions and 1794 deletions

View file

@ -119,12 +119,12 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name,
height = 1;
if (content & CAIRO_CONTENT_ALPHA) {
/* A hackish way to ensure that we get a framebuffer with
* an alpha component */
CoglSwapChain *swap_chain;
CoglOnscreenTemplate *onscreen_template;
CoglRenderer *renderer;
CoglDisplay *display;
/* A hackish way to ensure that we get a framebuffer with
* an alpha component */
CoglSwapChain *swap_chain;
CoglOnscreenTemplate *onscreen_template;
CoglRenderer *renderer;
CoglDisplay *display;
swap_chain = cogl_swap_chain_new ();
cogl_swap_chain_set_has_alpha (swap_chain, TRUE);

View file

@ -468,9 +468,7 @@ cairo_vg_sources = cairo-vg-surface.c
cairo_cogl_headers = cairo-cogl.h
cairo_cogl_private = cairo-cogl-private.h \
cairo-cogl-gradient-private.h \
cairo-cogl-context-private.h \
cairo-cogl-utils-private.h
cairo_cogl_sources = cairo-cogl-surface.c \
cairo-cogl-gradient.c \
cairo-cogl-context.c \
cairo-cogl-utils.c

View file

@ -1,58 +0,0 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.og/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* Contributor(s):
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef CAIRO_COGL_CONTEXT_PRIVATE_H
#define CAIRO_COGL_CONTEXT_PRIVATE_H
#include "cairo-default-context-private.h"
#include "cairo-cogl-private.h"
typedef struct _cairo_cogl_context {
cairo_default_context_t base;
int path_ctm_age;
cairo_path_fixed_t user_path;
cairo_bool_t path_is_rectangle;
double x, y, width, height;
cairo_backend_t backend;
/* We save a copy of all the original backend methods that we override so
* we can chain up...
*/
cairo_backend_t backend_parent;
} cairo_cogl_context_t;
cairo_t *
_cairo_cogl_context_create (void *target);
#endif /* CAIRO_COGL_CONTEXT_PRIVATE_H */

File diff suppressed because it is too large Load diff

View file

@ -37,6 +37,7 @@
#include "cairo-backend-private.h"
#include "cairo-default-context-private.h"
#include "cairo-surface-private.h"
#include "cairo-freelist-private.h"
#include <cogl/cogl2-experimental.h>
@ -93,10 +94,11 @@ typedef struct _cairo_cogl_device {
/* Caches 1d linear gradient textures */
cairo_cache_t linear_cache;
cairo_cache_t path_fill_staging_cache;
cairo_cache_t path_fill_prim_cache;
cairo_cache_t path_stroke_staging_cache;
cairo_cache_t path_stroke_prim_cache;
cairo_freelist_t path_fill_meta_freelist;
cairo_freelist_t path_stroke_meta_freelist;
} cairo_cogl_device_t;
typedef struct _cairo_cogl_clip_primitives {
@ -159,15 +161,4 @@ _cairo_cogl_path_fixed_rectangle (cairo_path_fixed_t *path,
cairo_fixed_t width,
cairo_fixed_t height);
cairo_int_status_t
_cairo_cogl_surface_fill_rectangle (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
double x,
double y,
double width,
double height,
cairo_matrix_t *ctm,
const cairo_clip_t *clip);
#endif /* CAIRO_COGL_PRIVATE_H */

File diff suppressed because it is too large Load diff

View file

@ -94,10 +94,6 @@ cairo_debug_reset_static_data (void)
_cairo_default_context_reset_static_data ();
#if CAIRO_HAS_COGL_SURFACE
_cairo_cogl_context_reset_static_data ();
#endif
CAIRO_MUTEX_FINALIZE ();
}

View file

@ -217,7 +217,6 @@ cairo_feature_sources = {
'cairo-cogl': [
'cairo-cogl-surface.c',
'cairo-cogl-gradient.c',
'cairo-cogl-context.c',
'cairo-cogl-utils.c',
],
'cairo-directfb': [