|
|
79df40 |
From bc80ae3c807287597da8c673447311807ae4ce15 Mon Sep 17 00:00:00 2001
|
|
|
79df40 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
79df40 |
Date: Wed, 10 Jul 2019 15:38:56 +0200
|
|
|
79df40 |
Subject: [PATCH 04/28] cogl/onscreen-template: Unref the swap chain
|
|
|
79df40 |
|
|
|
79df40 |
Each onscreen template owns a swap chain, but this is not released once on free
|
|
|
79df40 |
|
|
|
79df40 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
|
|
|
79df40 |
---
|
|
|
79df40 |
cogl/cogl/cogl-onscreen-template.c | 3 +++
|
|
|
79df40 |
1 file changed, 3 insertions(+)
|
|
|
79df40 |
|
|
|
79df40 |
diff --git a/cogl/cogl/cogl-onscreen-template.c b/cogl/cogl/cogl-onscreen-template.c
|
|
|
79df40 |
index 1adbf4128..6ca176755 100644
|
|
|
79df40 |
--- a/cogl/cogl/cogl-onscreen-template.c
|
|
|
79df40 |
+++ b/cogl/cogl/cogl-onscreen-template.c
|
|
|
79df40 |
@@ -22,60 +22,63 @@
|
|
|
79df40 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
79df40 |
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
79df40 |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
79df40 |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
79df40 |
* SOFTWARE.
|
|
|
79df40 |
*
|
|
|
79df40 |
* Authors:
|
|
|
79df40 |
* Robert Bragg <robert@linux.intel.com>
|
|
|
79df40 |
*/
|
|
|
79df40 |
|
|
|
79df40 |
#ifdef HAVE_CONFIG_H
|
|
|
79df40 |
#include "cogl-config.h"
|
|
|
79df40 |
#endif
|
|
|
79df40 |
|
|
|
79df40 |
#include "cogl-object.h"
|
|
|
79df40 |
|
|
|
79df40 |
#include "cogl-framebuffer-private.h"
|
|
|
79df40 |
#include "cogl-onscreen-template-private.h"
|
|
|
79df40 |
#include "cogl-gtype-private.h"
|
|
|
79df40 |
|
|
|
79df40 |
#include <stdlib.h>
|
|
|
79df40 |
|
|
|
79df40 |
static void _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template);
|
|
|
79df40 |
|
|
|
79df40 |
COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template);
|
|
|
79df40 |
COGL_GTYPE_DEFINE_CLASS (OnscreenTemplate, onscreen_template);
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
_cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template)
|
|
|
79df40 |
{
|
|
|
79df40 |
+ if (onscreen_template->config.swap_chain)
|
|
|
79df40 |
+ cogl_object_unref (onscreen_template->config.swap_chain);
|
|
|
79df40 |
+
|
|
|
79df40 |
g_slice_free (CoglOnscreenTemplate, onscreen_template);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
CoglOnscreenTemplate *
|
|
|
79df40 |
cogl_onscreen_template_new (CoglSwapChain *swap_chain)
|
|
|
79df40 |
{
|
|
|
79df40 |
CoglOnscreenTemplate *onscreen_template = g_slice_new0 (CoglOnscreenTemplate);
|
|
|
79df40 |
char *user_config;
|
|
|
79df40 |
|
|
|
79df40 |
onscreen_template->config.swap_chain = swap_chain;
|
|
|
79df40 |
if (swap_chain)
|
|
|
79df40 |
cogl_object_ref (swap_chain);
|
|
|
79df40 |
else
|
|
|
79df40 |
onscreen_template->config.swap_chain = cogl_swap_chain_new ();
|
|
|
79df40 |
|
|
|
79df40 |
onscreen_template->config.swap_throttled = TRUE;
|
|
|
79df40 |
onscreen_template->config.need_stencil = TRUE;
|
|
|
79df40 |
onscreen_template->config.samples_per_pixel = 0;
|
|
|
79df40 |
|
|
|
79df40 |
user_config = getenv ("COGL_POINT_SAMPLES_PER_PIXEL");
|
|
|
79df40 |
if (user_config)
|
|
|
79df40 |
{
|
|
|
79df40 |
unsigned long samples_per_pixel = strtoul (user_config, NULL, 10);
|
|
|
79df40 |
if (samples_per_pixel != ULONG_MAX)
|
|
|
79df40 |
onscreen_template->config.samples_per_pixel =
|
|
|
79df40 |
samples_per_pixel;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
return _cogl_onscreen_template_object_new (onscreen_template);
|
|
|
79df40 |
}
|
|
|
79df40 |
--
|
|
|
79df40 |
2.26.2
|
|
|
79df40 |
|