[Spice-devel] [PATCH v2] Limit maximum "n-surfaces" via param spec
Frediano Ziglio
fziglio at redhat.com
Tue Nov 1 12:29:36 UTC 2016
>
> In commit beec1b41, we manually limited this property value in
> _set_property(). But there's a simpler way to do it: via the param spec
> for the property.
>
> This also means that we can remove the warning log in red_worker_new()
> since GObject will automatically warn if a property is assigned a value
> outside of its valid range.
>
> Change the minimum and default value for this property from 0 to 1 so
> that we always have a primary surface.
> ---
> Change in v2:
> - make the minimum and default value of the property 1 instead of 0
>
> server/display-channel.c | 5 ++---
> server/red-worker.c | 2 --
> 2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 9b7b129..3a46020 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -60,7 +60,6 @@ display_channel_set_property(GObject *object,
> {
> case PROP_N_SURFACES:
> self->priv->n_surfaces = g_value_get_uint(value);
> - self->priv->n_surfaces = MIN(self->priv->n_surfaces,
> NUM_SURFACES);
> break;
> case PROP_VIDEO_CODECS:
> if (self->priv->video_codecs) {
> @@ -2238,8 +2237,8 @@ display_channel_class_init(DisplayChannelClass *klass)
> g_param_spec_uint("n-surfaces",
> "number of surfaces",
> "Number of surfaces
> for this channel",
> - 0, G_MAXUINT,
> - 0,
> + 1, NUM_SURFACES,
> + 1,
> G_PARAM_CONSTRUCT_ONLY
> |
> G_PARAM_READWRITE |
> G_PARAM_STATIC_STRINGS));
> diff --git a/server/red-worker.c b/server/red-worker.c
> index ec8ebce..9ddd7b6 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -1358,8 +1358,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> init_info.memslot_id_bits,
> init_info.internal_groupslot_id);
>
> - spice_warn_if_fail(init_info.n_surfaces <= NUM_SURFACES);
> -
> worker->event_timeout = INF_EVENT_WAIT;
>
> worker->cursor_channel = cursor_channel_new(reds, qxl,
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
More information about the Spice-devel
mailing list