[Spice-devel] [PATCH spice 02/11] server/red_worker: dump_bitmap: add surface_id to the bitmap file name
Christophe Fergeau
cfergeau at redhat.com
Tue Apr 10 02:28:56 PDT 2012
On Sun, Apr 08, 2012 at 06:43:11PM +0300, Yonit Halperin wrote:
>
> Signed-off-by: Yonit Halperin <yhalperi at redhat.com>
> ---
> server/red_worker.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 5350195..b2fa348 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -1014,7 +1014,7 @@ static void cursor_channel_client_release_item_after_push(CursorChannelClient *c
> static void red_wait_pipe_item_sent(RedChannelClient *rcc, PipeItem *item);
>
> #ifdef DUMP_BITMAP
> -static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id);
> +static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id, int surface_id);
> #endif
>
> /*
> @@ -6368,7 +6368,9 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
> case SPICE_IMAGE_TYPE_BITMAP: {
> SpiceBitmap *bitmap = &image.u.bitmap;
> #ifdef DUMP_BITMAP
> - dump_bitmap(display_channel->common.worker, &simage->u.bitmap, drawable->group_id);
> + dump_bitmap(display_channel->common.worker, &simage->u.bitmap,
> + drawable->group_id,
> + drawable->surface_id);
> #endif
> /* Images must be added to the cache only after they are compressed
> in order to prevent starvation in the client between pixmap_cache and
> @@ -11236,7 +11238,7 @@ static void dump_line(FILE *f, uint8_t* line, uint16_t n_pixel_bits, int width,
>
> #define RAM_PATH "/tmp/tmpfs"
>
> -static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id)
> +static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id, int surface_id)
> {
> static uint32_t file_id = 0;
>
> @@ -11303,7 +11305,7 @@ static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_i
> file_size = bitmap_data_offset + (bitmap->y * row_size);
>
> id = ++file_id;
> - sprintf(file_str, "%s/%u.bmp", RAM_PATH, id);
> + sprintf(file_str, "%s/%u-%d.bmp", RAM_PATH, id, surface_id);
Can you replace this with snprintf or asprintf (+free) while you are at it ? Looks good otherwise.
Christophe
>
> f = fopen(file_str, "wb");
> if (!f) {
> --
> 1.7.7.6
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120410/ff141c2b/attachment.pgp>
More information about the Spice-devel
mailing list