svga: minor code refactor for svga_buffer_upload_command()

Put the HBS code into a separate function.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
Brian Paul 2016-06-22 17:18:17 -06:00
parent db721da5a3
commit e82fa96d19

View file

@ -223,6 +223,7 @@ svga_buffer_upload_gb_command(struct svga_context *svga,
struct pipe_resource *dummy;
unsigned i;
assert(svga_have_gb_objects(svga));
assert(numBoxes);
assert(sbuf->dma.updates == NULL);
@ -318,11 +319,13 @@ svga_buffer_upload_gb_command(struct svga_context *svga,
/**
* Variant of SVGA3D_BufferDMA which leaves the copy box temporarily in blank.
* Issue DMA commands to transfer guest memory to the host.
* Note that the memory segments (offset, size) will be patched in
* later in the svga_buffer_upload_flush() function.
*/
static enum pipe_error
svga_buffer_upload_command(struct svga_context *svga,
struct svga_buffer *sbuf)
svga_buffer_upload_hb_command(struct svga_context *svga,
struct svga_buffer *sbuf)
{
struct svga_winsys_context *swc = svga->swc;
struct svga_winsys_buffer *guest = sbuf->hwbuf;
@ -336,8 +339,7 @@ svga_buffer_upload_command(struct svga_context *svga,
unsigned surface_flags;
struct pipe_resource *dummy;
if (svga_have_gb_objects(svga))
return svga_buffer_upload_gb_command(svga, sbuf);
assert(!svga_have_gb_objects(svga));
if (transfer == SVGA3D_WRITE_HOST_VRAM) {
region_flags = SVGA_RELOC_READ;
@ -393,6 +395,20 @@ svga_buffer_upload_command(struct svga_context *svga,
}
/**
* Issue commands to transfer guest memory to the host.
*/
static enum pipe_error
svga_buffer_upload_command(struct svga_context *svga, struct svga_buffer *sbuf)
{
if (svga_have_gb_objects(svga)) {
return svga_buffer_upload_gb_command(svga, sbuf);
} else {
return svga_buffer_upload_hb_command(svga, sbuf);
}
}
/**
* Patch up the upload DMA command reserved by svga_buffer_upload_command
* with the final ranges.