[Spice-devel] [PATCH spice-server] Release cursor as soon as possible

Christophe Fergeau cfergeau at redhat.com
Wed Sep 6 15:33:15 UTC 2017


On Wed, Sep 06, 2017 at 01:41:21PM +0100, Frediano Ziglio wrote:
> diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
> index 33f36923a..fda4ff26d 100644
> --- a/server/red-parse-qxl.c
> +++ b/server/red-parse-qxl.c
> @@ -26,6 +26,7 @@
>  #include "red-common.h"
>  #include "memslot.h"
>  #include "red-parse-qxl.h"
> +#include "red-qxl.h"
>  
>  /* Max size in bytes for any data field used in a QXL command.
>   * This will for example be useful to prevent the guest from saturating the
> @@ -1461,8 +1462,10 @@ static void red_put_cursor(SpiceCursor *red)
>  }
>  
>  bool red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
> -                        RedCursorCmd *red, QXLPHYSICAL addr)
> +                        RedCursorCmd *red, QXLPHYSICAL addr,
> +                        QXLInstance *qxl_instance)
>  {
> +    QXLReleaseInfoExt release_info_ext;
>      QXLCursorCmd *qxl;
>      int error;
>  
> @@ -1470,8 +1473,8 @@ bool red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
>      if (error) {
>          return false;
>      }
> -    red->release_info_ext.info      = &qxl->release_info;
> -    red->release_info_ext.group_id  = group_id;
> +    release_info_ext.info      = &qxl->release_info;
> +    release_info_ext.group_id  = group_id;
>  
>      red->type = qxl->type;
>      switch (red->type) {
> @@ -1487,6 +1490,7 @@ bool red_get_cursor_cmd(RedMemSlotInfo *slots, int group_id,
>          red->u.trail.frequency = qxl->u.trail.frequency;
>          break;
>      }
> +    red_qxl_release_resource(qxl_instance, release_info_ext);
>      return true;
>  }

I would still move this up to the caller:

diff --git a/server/red-worker.c b/server/red-worker.c
index 3d27afc47..a06029e3b 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -108,6 +108,7 @@ static gboolean red_process_cursor_cmd(RedWorker *worker, const QXLCommandExt *e
         free(cursor_cmd);
         return FALSE;
     }
+    red_qxl_release_resource(worker->qxl, cursor_cmd->release_info_ext);
     cursor_channel_process_cmd(worker->cursor_channel, cursor_cmd);
     return TRUE;
 }

And I'd still move the "remove CursorChannel::qxl" bits to a separate commit.

Christophe


More information about the Spice-devel mailing list