[Spice-devel] [PATCH spice-gtk 2/5] DisplayChannel: Fix introspection method bindings
Marc-André Lureau
marcandre.lureau at redhat.com
Tue Sep 19 10:32:16 UTC 2017
----- Original Message -----
> Signed-off-by: Matthew Francis <mjay.francis at gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
> doc/reference/spice-gtk-sections.txt | 5 ++
> src/channel-display.c | 92
> +++++++++++++++++++++++++++++++++++-
> src/channel-display.h | 22 +++++++--
> src/map-file | 5 ++
> src/spice-glib-sym-file | 5 ++
> src/spice-widget-egl.c | 2 +-
> src/spice-widget.c | 14 +++---
> tools/spicy.c | 8 ++--
> 8 files changed, 135 insertions(+), 18 deletions(-)
>
> diff --git a/doc/reference/spice-gtk-sections.txt
> b/doc/reference/spice-gtk-sections.txt
> index c4f416f..ffaf00e 100644
> --- a/doc/reference/spice-gtk-sections.txt
> +++ b/doc/reference/spice-gtk-sections.txt
> @@ -165,10 +165,15 @@ SpiceDisplayPrimary
> SpiceGlScanout
> <SUBSECTION>
> spice_display_get_gl_scanout
> +spice_display_channel_get_gl_scanout
> spice_display_gl_draw_done
> +spice_display_channel_gl_draw_done
> spice_display_get_primary
> +spice_display_channel_get_primary
> spice_display_change_preferred_compression
> +spice_display_channel_change_preferred_compression
> spice_display_change_preferred_video_codec_type
> +spice_display_channel_change_preferred_video_codec_type
> spice_gl_scanout_free
> <SUBSECTION Standard>
> SPICE_DISPLAY_CHANNEL
> diff --git a/src/channel-display.c b/src/channel-display.c
> index 4c570ea..75d2e32 100644
> --- a/src/channel-display.c
> +++ b/src/channel-display.c
> @@ -227,7 +227,7 @@ static void spice_display_get_property(GObject
> *object,
> break;
> }
> case PROP_GL_SCANOUT: {
> - g_value_set_static_boxed(value,
> spice_display_get_gl_scanout(channel));
> + g_value_set_static_boxed(value,
> spice_display_channel_get_gl_scanout(channel));
> break;
> }
> default:
> @@ -472,10 +472,31 @@ static void
> spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
> *
> * Returns: %TRUE if the primary surface was found and its details
> * collected in @primary.
> + *
> + * Deprecated: 0.35: use spice_display_channel_get_primary() instead.
> */
> gboolean spice_display_get_primary(SpiceChannel *channel, guint32
> surface_id,
> SpiceDisplayPrimary *primary)
> {
> + return spice_display_channel_get_primary(channel, surface_id, primary);
> +}
> +
> +/**
> + * spice_display_channel_get_primary:
> + * @channel: a #SpiceDisplayChannel
> + * @surface_id: a surface id
> + * @primary: a #SpiceDisplayPrimary
> + *
> + * Retrieve primary display surface @surface_id.
> + *
> + * Returns: %TRUE if the primary surface was found and its details
> + * collected in @primary.
> + *
> + * Since: 0.35
> + */
> +gboolean spice_display_channel_get_primary(SpiceChannel *channel, guint32
> surface_id,
> + SpiceDisplayPrimary *primary)
> +{
> g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), FALSE);
> g_return_val_if_fail(primary != NULL, FALSE);
>
> @@ -508,9 +529,25 @@ gboolean spice_display_get_primary(SpiceChannel
> *channel, guint32 surface_id,
> * for the @channel.
> *
> * Since: 0.31
> + * Deprecated: 0.35: use
> spice_display_channel_change_preferred_compression() instead.
> */
> void spice_display_change_preferred_compression(SpiceChannel *channel, gint
> compression)
> {
> + spice_display_channel_change_preferred_compression(channel,
> compression);
> +}
> +
> +/**
> + * spice_display_channel_change_preferred_compression:
> + * @channel: a #SpiceDisplayChannel
> + * @compression: a #SpiceImageCompression
> + *
> + * Tells the spice server to change the preferred image compression
> + * for the @channel.
> + *
> + * Since: 0.35
> + */
> +void spice_display_channel_change_preferred_compression(SpiceChannel
> *channel, gint compression)
> +{
> SpiceMsgOut *out;
> SpiceMsgcDisplayPreferredCompression pref_comp_msg;
>
> @@ -561,9 +598,26 @@ static void
> spice_display_send_client_preferred_video_codecs(SpiceChannel *chann
> * display channel.
> *
> * Since: 0.34
> + * Deprecated: 0.35: use
> spice_display_channel_change_preferred_video_codec_type() instead.
> */
> void spice_display_change_preferred_video_codec_type(SpiceChannel *channel,
> gint codec_type)
> {
> + spice_display_channel_change_preferred_video_codec_type(channel,
> codec_type);
> +}
> +
> +/**
> + * spice_display_channel_change_preferred_video_codec_type:
> + * @channel: a #SpiceDisplayChannel
> + * @codec_type: a #SpiceVideoCodecType
> + *
> + * Tells the spice server to change the preferred video codec type for
> + * streaming in @channel. Application can set only one preferred video codec
> per
> + * display channel.
> + *
> + * Since: 0.35
> + */
> +void spice_display_channel_change_preferred_video_codec_type(SpiceChannel
> *channel, gint codec_type)
> +{
> GArray *codecs;
>
> g_return_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel));
> @@ -595,10 +649,27 @@ void
> spice_display_change_preferred_video_codec_type(SpiceChannel *channel, gint
> * Returns: the current GL scanout, or %NULL if none or not valid
> *
> * Since: 0.31
> + * Deprecated: 0.35: use spice_display_channel_get_gl_scanout() instead.
> **/
> const SpiceGlScanout *
> spice_display_get_gl_scanout(SpiceDisplayChannel *channel)
> {
> + return spice_display_channel_get_gl_scanout(channel);
> +}
> +
> +/**
> + * spice_display_channel_get_gl_scanout:
> + * @channel: a #SpiceDisplayChannel
> + *
> + * Retrieves the GL scanout if available
> + *
> + * Returns: the current GL scanout, or %NULL if none or not valid
> + *
> + * Since: 0.35
> + **/
> +const SpiceGlScanout *
> +spice_display_channel_get_gl_scanout(SpiceDisplayChannel *channel)
> +{
> g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), NULL);
>
> return channel->priv->scanout.fd != -1 ? &channel->priv->scanout : NULL;
> @@ -978,7 +1049,7 @@ static void spice_display_channel_up(SpiceChannel
> *channel)
> g_coroutine_object_notify(G_OBJECT(channel), "monitors");
>
> if (preferred_compression != SPICE_IMAGE_COMPRESSION_INVALID) {
> - spice_display_change_preferred_compression(channel,
> preferred_compression);
> + spice_display_channel_change_preferred_compression(channel,
> preferred_compression);
> }
> }
>
> @@ -1896,9 +1967,26 @@ static void display_handle_gl_draw(SpiceChannel
> *channel, SpiceMsgIn *in)
> * (failing to do so for each gl-draw may result in a frozen display).
> *
> * Since: 0.31
> + * Deprecated: 0.35: use spice_display_channel_gl_draw_done() instead.
> **/
> void spice_display_gl_draw_done(SpiceDisplayChannel *display)
> {
> + spice_display_channel_gl_draw_done(display);
> +}
> +
> +/**
> + * spice_display_channel_gl_draw_done:
> + * @channel: a #SpiceDisplayChannel
> + *
> + * After a SpiceDisplayChannel::gl-draw is emitted, the client should
> + * draw the current display with the current GL scanout, and must
> + * release the GL resource with a call to spice_display_gl_draw_done()
> + * (failing to do so for each gl-draw may result in a frozen display).
> + *
> + * Since: 0.35
> + **/
> +void spice_display_channel_gl_draw_done(SpiceDisplayChannel *display)
> +{
> SpiceChannel *channel;
> SpiceMsgOut *out;
>
> diff --git a/src/channel-display.h b/src/channel-display.h
> index fccf228..5b48d2f 100644
> --- a/src/channel-display.h
> +++ b/src/channel-display.h
> @@ -145,17 +145,31 @@ struct _SpiceDisplayChannelClass {
> };
>
> GType spice_display_channel_get_type(void);
> -gboolean spice_display_get_primary(SpiceChannel *channel, guint32
> surface_id,
> - SpiceDisplayPrimary *primary);
> +gboolean spice_display_channel_get_primary(SpiceChannel *channel,
> guint32 surface_id,
> + SpiceDisplayPrimary
> *primary);
>
> -void spice_display_change_preferred_compression(SpiceChannel *channel, gint
> compression);
> -void spice_display_change_preferred_video_codec_type(SpiceChannel *channel,
> gint codec_type);
> +void spice_display_channel_change_preferred_compression(SpiceChannel
> *channel, gint compression);
> +void spice_display_channel_change_preferred_video_codec_type(SpiceChannel
> *channel, gint codec_type);
>
> GType spice_gl_scanout_get_type (void) G_GNUC_CONST;
> void spice_gl_scanout_free (SpiceGlScanout *scanout);
>
> +const SpiceGlScanout*
> spice_display_channel_get_gl_scanout(SpiceDisplayChannel *channel);
> +void spice_display_channel_gl_draw_done(SpiceDisplayChannel *channel);
> +
> +#ifndef SPICE_DISABLE_DEPRECATED
> +G_DEPRECATED_FOR(spice_display_channel_change_preferred_compression)
> +void spice_display_change_preferred_compression(SpiceChannel *channel, gint
> compression);
> +G_DEPRECATED_FOR(spice_display_channel_change_preferred_video_codec_type)
> +void spice_display_change_preferred_video_codec_type(SpiceChannel *channel,
> gint codec_type);
> +G_DEPRECATED_FOR(spice_display_channel_get_gl_scanout)
> const SpiceGlScanout* spice_display_get_gl_scanout(SpiceDisplayChannel
> *channel);
> +G_DEPRECATED_FOR(spice_display_channel_get_primary)
> +gboolean spice_display_get_primary(SpiceChannel *channel, guint32
> surface_id,
> + SpiceDisplayPrimary *primary);
> +G_DEPRECATED_FOR(spice_display_channel_gl_draw_done)
> void spice_display_gl_draw_done(SpiceDisplayChannel *channel);
> +#endif
>
> G_END_DECLS
>
> diff --git a/src/map-file b/src/map-file
> index de4f421..8635e92 100644
> --- a/src/map-file
> +++ b/src/map-file
> @@ -23,7 +23,12 @@ spice_cursor_channel_get_type;
> spice_cursor_shape_get_type;
> spice_display_change_preferred_compression;
> spice_display_change_preferred_video_codec_type;
> +spice_display_channel_change_preferred_compression;
> +spice_display_channel_change_preferred_video_codec_type;
> +spice_display_channel_get_gl_scanout;
> +spice_display_channel_get_primary;
> spice_display_channel_get_type;
> +spice_display_channel_gl_draw_done;
> spice_display_get_gl_scanout;
> spice_display_get_grab_keys;
> spice_display_get_pixbuf;
> diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
> index 79c75f1..d996dbf 100644
> --- a/src/spice-glib-sym-file
> +++ b/src/spice-glib-sym-file
> @@ -21,7 +21,12 @@ spice_cursor_channel_get_type
> spice_cursor_shape_get_type
> spice_display_change_preferred_compression
> spice_display_change_preferred_video_codec_type
> +spice_display_channel_change_preferred_compression
> +spice_display_channel_change_preferred_video_codec_type
> +spice_display_channel_get_gl_scanout
> +spice_display_channel_get_primary
> spice_display_channel_get_type
> +spice_display_channel_gl_draw_done
> spice_display_get_gl_scanout
> spice_display_get_primary
> spice_display_gl_draw_done
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index b50641c..1e71753 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -278,7 +278,7 @@ end:
>
> d->egl.context_ready = TRUE;
>
> - if (spice_display_get_gl_scanout(d->display) != NULL) {
> + if (spice_display_channel_get_gl_scanout(d->display) != NULL) {
> DISPLAY_DEBUG(display, "scanout present during egl init, updating
> widget");
> spice_display_widget_gl_scanout(display);
> spice_display_widget_update_monitor_area(display);
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index fb94e94..714ca88 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -587,7 +587,7 @@ gl_area_render(GtkGLArea *area, GdkGLContext *context,
> gpointer user_data)
> spice_egl_update_display(display);
> glFlush();
> if (d->egl.call_draw_done) {
> - spice_display_gl_draw_done(d->display);
> + spice_display_channel_gl_draw_done(d->display);
> d->egl.call_draw_done = FALSE;
> }
>
> @@ -620,7 +620,7 @@ drawing_area_realize(GtkWidget *area, gpointer user_data)
> SpiceDisplay *display = SPICE_DISPLAY(user_data);
>
> if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
> - spice_display_get_gl_scanout(display->priv->display) != NULL) {
> + spice_display_channel_get_gl_scanout(display->priv->display) !=
> NULL) {
> spice_display_widget_gl_scanout(display);
> }
> #endif
> @@ -2523,7 +2523,7 @@ static void update_area(SpiceDisplay *display,
> #if HAVE_EGL
> if (egl_enabled(d)) {
> const SpiceGlScanout *so =
> - spice_display_get_gl_scanout(d->display);
> + spice_display_channel_get_gl_scanout(d->display);
> g_return_if_fail(so != NULL);
> primary = (GdkRectangle) {
> .width = so->width,
> @@ -2891,7 +2891,7 @@ void spice_display_widget_gl_scanout(SpiceDisplay
> *display)
> if (d->egl.context_ready) {
> const SpiceGlScanout *scanout;
>
> - scanout = spice_display_get_gl_scanout(d->display);
> + scanout = spice_display_channel_get_gl_scanout(d->display);
> /* should only be called when the display has a scanout */
> g_return_if_fail(scanout != NULL);
>
> @@ -2913,7 +2913,7 @@ static void gl_draw(SpiceDisplay *display,
>
> if (!d->egl.context_ready) {
> DISPLAY_DEBUG(display, "Draw without GL context, skipping");
> - spice_display_gl_draw_done(d->display);
> + spice_display_channel_gl_draw_done(d->display);
> return;
> }
>
> @@ -2930,7 +2930,7 @@ static void gl_draw(SpiceDisplay *display,
> #endif
> {
> spice_egl_update_display(display);
> - spice_display_gl_draw_done(d->display);
> + spice_display_channel_gl_draw_done(d->display);
> }
> }
> #endif
> @@ -2966,7 +2966,7 @@ static void channel_new(SpiceSession *s, SpiceChannel
> *channel, gpointer data)
> spice_g_signal_connect_object(channel, "notify::monitors",
> G_CALLBACK(spice_display_widget_update_monitor_area),
> display, G_CONNECT_AFTER |
> G_CONNECT_SWAPPED);
> - if (spice_display_get_primary(channel, 0, &primary)) {
> + if (spice_display_channel_get_primary(channel, 0, &primary)) {
> primary_create(channel, primary.format, primary.width,
> primary.height,
> primary.stride, primary.shmid, primary.data,
> display);
> mark(display, primary.marked);
> diff --git a/tools/spicy.c b/tools/spicy.c
> index d71d996..6ff6c9e 100644
> --- a/tools/spicy.c
> +++ b/tools/spicy.c
> @@ -1009,16 +1009,16 @@ static void compression_cb(GtkRadioAction *action
> G_GNUC_UNUSED,
> GtkRadioAction *current,
> gpointer user_data)
> {
> - spice_display_change_preferred_compression(SPICE_CHANNEL(user_data),
> -
> gtk_radio_action_get_current_value(current));
> +
> spice_display_channel_change_preferred_compression(SPICE_CHANNEL(user_data),
> +
> gtk_radio_action_get_current_value(current));
> }
>
> static void video_codec_type_cb(GtkRadioAction *action G_GNUC_UNUSED,
> GtkRadioAction *current,
> gpointer user_data)
> {
> -
> spice_display_change_preferred_video_codec_type(SPICE_CHANNEL(user_data),
> -
> gtk_radio_action_get_current_value(current));
> +
> spice_display_channel_change_preferred_video_codec_type(SPICE_CHANNEL(user_data),
> +
> gtk_radio_action_get_current_value(current));
> }
>
> static void
> --
> 2.7.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list