[Cogl] [PATCH] display: add _set_onscreen_template() api
Neil Roberts
neil at linux.intel.com
Mon Jun 10 07:24:47 PDT 2013
It looks like the function is trying to cope with setting the onscreen
template to NULL. However, cogl_display_new will explicitly create a
dummy onscreen template if you pass NULL. Does the rest of the code
assume that there is always an onscreen template? Maybe this function
should be changed to either _COGL_RETURN_IF_FAIL when the template is
NULL or it should create a dummy template like cogl_display_new does.
I think it would also be good to add a _COGL_RETURN_IF_FAIL to assert
that display->setup==FALSE.
Regards,
- Neil
Robert Bragg <robert at sixbynine.org> writes:
> From: Robert Bragg <robert at linux.intel.com>
>
> Currently it's only possible to set an onscreen template on a
> CoglDisplay by passing a template to cogl_display_new(). For
> applications that want to deal with fallbacks then they may want to
> replace the onscreen template so this adds a
> cogl_display_set_onscreen_template() function.
> ---
> cogl/cogl-display.c | 12 ++++++++++++
> cogl/cogl-display.h | 23 ++++++++++++++++++++++-
> 2 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
> index d943c2c..73d2cfb 100644
> --- a/cogl/cogl-display.c
> +++ b/cogl/cogl-display.c
> @@ -116,6 +116,18 @@ cogl_display_get_renderer (CoglDisplay *display)
> return display->renderer;
> }
>
> +void
> +cogl_display_set_onscreen_template (CoglDisplay *display,
> + CoglOnscreenTemplate *onscreen_template)
> +{
> + if (onscreen_template)
> + cogl_object_ref (onscreen_template);
> +
> + cogl_object_unref (display->onscreen_template);
> +
> + display->onscreen_template = onscreen_template;
> +}
> +
> CoglBool
> cogl_display_setup (CoglDisplay *display,
> CoglError **error)
> diff --git a/cogl/cogl-display.h b/cogl/cogl-display.h
> index 1177aee..424e7e6 100644
> --- a/cogl/cogl-display.h
> +++ b/cogl/cogl-display.h
> @@ -85,7 +85,8 @@ typedef struct _CoglDisplay CoglDisplay;
> *
> * A common use for explicitly allocating a display object is to
> * define a template for allocating onscreen framebuffers which is
> - * what the @onscreen_template argument is for.
> + * what the @onscreen_template argument is for, or alternatively
> + * you can use cogl_display_set_onscreen_template().
> *
> * When a display is first allocated via cogl_display_new() it is in a
> * mutable configuration mode. It's designed this way so we can
> @@ -122,6 +123,26 @@ CoglRenderer *
> cogl_display_get_renderer (CoglDisplay *display);
>
> /**
> + * cogl_display_set_onscreen_template:
> + * @display: a #CoglDisplay
> + * @onscreen_template: A template for creating #CoglOnscreen framebuffers
> + *
> + * Specifies a template for creating #CoglOnscreen framebuffers.
> + *
> + * Depending on the system, the constraints for creating #CoglOnscreen
> + * framebuffers need to be known before setting up a #CoglDisplay because the
> + * final setup of the display may constrain how onscreen framebuffers may be
> + * allocated. If Cogl knows how an application wants to allocate onscreen
> + * framebuffers then it can try to make sure to setup the display accordingly.
> + *
> + * Since: 1.16
> + * Stability: unstable
> + */
> +void
> +cogl_display_set_onscreen_template (CoglDisplay *display,
> + CoglOnscreenTemplate *onscreen_template);
> +
> +/**
> * cogl_display_setup:
> * @display: a #CoglDisplay
> * @error: return location for a #CoglError
> --
> 1.8.2.1
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the Cogl
mailing list