summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGurchetan Singh <[email protected]>2018-12-12 15:43:43 -0800
committerGurchetan Singh <[email protected]>2019-04-18 15:38:44 -0700
commit0dd661777a489d1134707ebc770af9e21e44e0dc (patch)
treeae3154cbee5ceb6a1e7c50c1c9dba7bbc99588f3
parent599d55371c83e2a535814c78b62f4293be79408d (diff)
virgl/vtest: execute a transfer_get when flushing the front buffer
This just moves everything to a helper function -- "flush_front_buffer" will be used later. virgl_vtest_resource_map / virgl_vtest_resource_unmap already take care to map the display target. Signed-off-by: Gurchetan Singh <[email protected]> Reviewed-By: Gert Wollny <[email protected]> Reviewed-By: Piotr Rak <[email protected]>
-rw-r--r--src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
index e3a38e00ec5..681c0c25e6b 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -89,11 +89,12 @@ virgl_vtest_transfer_put(struct virgl_winsys *vws,
}
static int
-virgl_vtest_transfer_get(struct virgl_winsys *vws,
- struct virgl_hw_res *res,
- const struct pipe_box *box,
- uint32_t stride, uint32_t layer_stride,
- uint32_t buf_offset, uint32_t level)
+virgl_vtest_transfer_get_internal(struct virgl_winsys *vws,
+ struct virgl_hw_res *res,
+ const struct pipe_box *box,
+ uint32_t stride, uint32_t layer_stride,
+ uint32_t buf_offset, uint32_t level,
+ bool flush_front_buffer)
{
struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws);
uint32_t size;
@@ -115,6 +116,18 @@ virgl_vtest_transfer_get(struct virgl_winsys *vws,
return 0;
}
+static int
+virgl_vtest_transfer_get(struct virgl_winsys *vws,
+ struct virgl_hw_res *res,
+ const struct pipe_box *box,
+ uint32_t stride, uint32_t layer_stride,
+ uint32_t buf_offset, uint32_t level)
+{
+ return virgl_vtest_transfer_get_internal(vws, res, box, stride,
+ layer_stride, buf_offset,
+ level, false);
+}
+
static void virgl_hw_res_destroy(struct virgl_vtest_winsys *vtws,
struct virgl_hw_res *res)
{
@@ -601,9 +614,7 @@ static void virgl_vtest_flush_frontbuffer(struct virgl_winsys *vws,
{
struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws);
struct pipe_box box;
- void *map;
- uint32_t size;
- uint32_t offset = 0, valid_stride;
+ uint32_t offset = 0;
if (!res->dt)
return;
@@ -620,22 +631,10 @@ static void virgl_vtest_flush_frontbuffer(struct virgl_winsys *vws,
box.depth = 1;
}
- size = vtest_get_transfer_size(res, &box, res->stride, 0, level, &valid_stride);
-
virgl_vtest_busy_wait(vtws, res->res_handle, VCMD_BUSY_WAIT_FLAG_WAIT);
- map = vtws->sws->displaytarget_map(vtws->sws, res->dt, 0);
-
- /* execute a transfer */
- virgl_vtest_send_transfer_get(vtws, res->res_handle,
- level, res->stride, 0, &box, size, offset);
-
- /* This functions gets the resource from the hardware backend that may have
- * a hardware imposed stride that is different from the IOV stride used to
- * get the data. */
- virgl_vtest_recv_transfer_get_data(vtws, map + offset, size, valid_stride,
- &box, res->format);
- vtws->sws->displaytarget_unmap(vtws->sws, res->dt);
+ virgl_vtest_transfer_get_internal(vws, res, &box, res->stride, 0, offset,
+ level, true);
vtws->sws->displaytarget_display(vtws->sws, res->dt, winsys_drawable_handle,
sub_box);