Prune redundant pipeline ancestry after adding a layer difference

Adding a layer difference may mean the pipeline overrides all of the
layers of its parent which might make the parent redundant so we
should try to prune the hierarchy.

This is particularly important for CoglGst because whenever a new
frame is ready it tries to make a copy of the pipeline it last used
and then replace all of the textures in the layers. Without this patch
the new pipeline would keep the parent pipeline alive which means also
keeping the old textures alive so all of the frames of the video would
effectively be leaked.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 576c7b55aa835448c977f1d79d128dffd40e7cd8)
This commit is contained in:
Neil Roberts 2013-03-09 20:00:53 +00:00
parent f9456574ef
commit 22363a4137
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@
* *
* An object oriented GL/GLES Abstraction/Utility Layer * An object oriented GL/GLES Abstraction/Utility Layer
* *
* Copyright (C) 2008,2009,2010 Intel Corporation. * Copyright (C) 2008,2009,2010,2013 Intel Corporation.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -1436,6 +1436,11 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
if (inc_n_layers) if (inc_n_layers)
pipeline->n_layers++; pipeline->n_layers++;
/* Adding a layer difference may mean this pipeline now overrides
* all of the layers of its parent which might make the parent
* redundant so we should try to prune the hierarchy */
_cogl_pipeline_prune_redundant_ancestry (pipeline);
} }
void void

View File

@ -118,7 +118,7 @@ main (int argc, char **argv)
ADD_TEST (test_primitive_and_journal, 0, 0); ADD_TEST (test_primitive_and_journal, 0, 0);
ADD_TEST (test_copy_replace_texture, 0, TEST_KNOWN_FAILURE); ADD_TEST (test_copy_replace_texture, 0, 0);
UNPORTED_TEST (test_viewport); UNPORTED_TEST (test_viewport);