mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-09 05:38:34 +00:00
Use qemu_get_buffer_in_place for xbzrle data
Avoid a data copy (if we're lucky) in the xbzrle code. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Message-Id: <1450266458-3178-6-git-send-email-dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
This commit is contained in:
parent
4addcd4fdc
commit
063e760a5f
@ -2088,10 +2088,12 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
|
||||
{
|
||||
unsigned int xh_len;
|
||||
int xh_flags;
|
||||
uint8_t *loaded_data;
|
||||
|
||||
if (!xbzrle_decoded_buf) {
|
||||
xbzrle_decoded_buf = g_malloc(TARGET_PAGE_SIZE);
|
||||
}
|
||||
loaded_data = xbzrle_decoded_buf;
|
||||
|
||||
/* extract RLE header */
|
||||
xh_flags = qemu_get_byte(f);
|
||||
@ -2107,10 +2109,10 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
|
||||
return -1;
|
||||
}
|
||||
/* load data and decode */
|
||||
qemu_get_buffer(f, xbzrle_decoded_buf, xh_len);
|
||||
qemu_get_buffer_in_place(f, &loaded_data, xh_len);
|
||||
|
||||
/* decode RLE */
|
||||
if (xbzrle_decode_buffer(xbzrle_decoded_buf, xh_len, host,
|
||||
if (xbzrle_decode_buffer(loaded_data, xh_len, host,
|
||||
TARGET_PAGE_SIZE) == -1) {
|
||||
error_report("Failed to load XBZRLE page - decode error!");
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user