[Cogl] [PATCH 2/2] Prune redundant pipeline ancestry after adding a layer difference

Robert Bragg robert at sixbynine.org
Tue Mar 19 10:47:41 PDT 2013


This looks good to land to me:

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

thanks,
- Robert

On Sat, Mar 9, 2013 at 9:05 PM, Neil Roberts <neil at linux.intel.com> wrote:
> 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.
> ---
>  cogl/cogl-pipeline.c              | 7 ++++++-
>  tests/conform/test-conform-main.c | 2 +-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
> index feb911d..314cf44 100644
> --- a/cogl/cogl-pipeline.c
> +++ b/cogl/cogl-pipeline.c
> @@ -3,7 +3,7 @@
>   *
>   * 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
>   * modify it under the terms of the GNU Lesser General Public
> @@ -1292,6 +1292,11 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
>
>    if (inc_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
> diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
> index 8a38d27..82d631e 100644
> --- a/tests/conform/test-conform-main.c
> +++ b/tests/conform/test-conform-main.c
> @@ -120,7 +120,7 @@ main (int argc, char **argv)
>
>    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);
>
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list