[Spice-devel] [PATCH 2/5] qxl parser: add cursor parsing
Gerd Hoffmann
kraxel at redhat.com
Thu Aug 26 23:51:04 PDT 2010
On 08/27/10 08:38, Alexander Larsson wrote:
> On Fri, 2010-08-27 at 00:09 +0200, Gerd Hoffmann wrote:
>>
>> + red->data_size = qxl->data_size;
>> + size = red_get_data_chunks_ptr(slots, group_id,
>> + get_memslot_id(slots, addr),
>> +&chunks,&qxl->chunk);
>> + data = red_linearize_chunk(&chunks, size,&free_data);
>> + red_put_data_chunks(&chunks);
>> + red->data = spice_malloc(size);
>> + memcpy(red->data, data, size);
>> +
>> + if (free_data) {
>> + free(data);
>> + }
>
> Ack, but this part could be more efficient. In the n_chunks> 1 case the
> red_linearize_chunk part will already malloc and copy the data so we
> don't need to do it then.
Right. Incremental patch attached.
> We should have a linearlize_chunks variant
> that always copies and use that.
Not worth the trouble for that single use case I think.
cheers,
Gerd
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-red_get_cursor-avoid-extra-copy.patch
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20100827/0ad1231b/attachment.ksh>
More information about the Spice-devel
mailing list