diff options
Diffstat (limited to 'src/gallium/winsys/virgl')
4 files changed, 23 insertions, 43 deletions
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c index 00a197a0069..410cfa2cc04 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c @@ -173,6 +173,11 @@ int virgl_vtest_connect(struct virgl_vtest_winsys *vws) vws->sock_fd = sock; virgl_vtest_send_init(vws); vws->protocol_version = virgl_vtest_negotiate_version(vws); + + /* Version 1 is deprecated. */ + if (vws->protocol_version == 1) + vws->protocol_version = 0; + return 0; } @@ -270,7 +275,7 @@ int virgl_vtest_send_resource_create(struct virgl_vtest_winsys *vws, { uint32_t res_create_buf[VCMD_RES_CREATE_SIZE], vtest_hdr[VTEST_HDR_SIZE]; - if (vws->protocol_version >= 1) + if (vws->protocol_version >= 2) return virgl_vtest_send_resource_create2(vws, handle, target, format, bind, width, height, depth, array_size, last_level, @@ -400,7 +405,7 @@ int virgl_vtest_send_transfer_get(struct virgl_vtest_winsys *vws, uint32_t data_size, uint32_t offset) { - if (vws->protocol_version < 1) + if (vws->protocol_version < 2) return virgl_vtest_send_transfer_cmd(vws, VCMD_TRANSFER_GET, handle, level, stride, layer_stride, box, data_size); @@ -417,7 +422,7 @@ int virgl_vtest_send_transfer_put(struct virgl_vtest_winsys *vws, uint32_t data_size, uint32_t offset) { - if (vws->protocol_version < 1) + if (vws->protocol_version < 2) return virgl_vtest_send_transfer_cmd(vws, VCMD_TRANSFER_PUT, handle, level, stride, layer_stride, box, data_size); @@ -438,27 +443,20 @@ int virgl_vtest_recv_transfer_get_data(struct virgl_vtest_winsys *vws, uint32_t data_size, uint32_t stride, const struct pipe_box *box, - uint32_t format, uint32_t res_stride) + uint32_t format) { - char *ptr = data; - uint32_t bytes_to_read = data_size; - char dump[1024]; - - /* Copy the date from the IOV to the target resource respecting - * the different strides */ - for (int y = 0 ; y < box->height && bytes_to_read > 0; ++y) { - uint32_t btr = MIN2(res_stride, bytes_to_read); - virgl_block_read(vws->sock_fd, ptr, btr); + void *line; + void *ptr = data; + int hblocks = util_format_get_nblocksy(format, box->height); + + line = malloc(stride); + while (hblocks) { + virgl_block_read(vws->sock_fd, line, stride); + memcpy(ptr, line, util_format_get_stride(format, box->width)); ptr += stride; - bytes_to_read -= btr; - } - - /* It seems that there may be extra bytes that need to be read */ - while (bytes_to_read > 0 && bytes_to_read < data_size) { - uint32_t btr = MIN2(sizeof(dump), bytes_to_read); - virgl_block_read(vws->sock_fd, dump, btr); - bytes_to_read -= btr; + hblocks--; } + free(line); return 0; } diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c index 479a98fe499..bc65ef3d22a 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c @@ -79,16 +79,6 @@ virgl_vtest_transfer_put(struct virgl_winsys *vws, size = vtest_get_transfer_size(res, box, stride, layer_stride, level, &valid_stride); - /* The size calculated above is the full box size, but if this box origin - * is not zero we may have to correct the transfer size to not read past the - * end of the resource. The correct adjustment depends on various factors - * that are not documented, so instead of going though all the hops to get - * the size right up-front, we just make sure we don't read past the end. - * FIXME: figure out what it takes to actually get this right. - */ - if (size + buf_offset > res->size) - size = res->size - buf_offset; - virgl_vtest_send_transfer_put(vtws, res->res_handle, level, stride, layer_stride, box, size, buf_offset); @@ -112,21 +102,14 @@ virgl_vtest_transfer_get(struct virgl_winsys *vws, size = vtest_get_transfer_size(res, box, stride, layer_stride, level, &valid_stride); - /* Don't ask for more pixels than available (see above) */ - if (size + buf_offset > res->size) - size = res->size - buf_offset; - virgl_vtest_send_transfer_get(vtws, res->res_handle, level, stride, layer_stride, box, size, buf_offset); ptr = virgl_vtest_resource_map(vws, res); - /* This functions seems to be using a specific transfer resource that - * has exactly the box size and hence its src stride is equal to the target - * stride */ virgl_vtest_recv_transfer_get_data(vtws, ptr + buf_offset, size, - valid_stride, box, res->format, valid_stride); + valid_stride, box, res->format); virgl_vtest_resource_unmap(vws, res); return 0; @@ -644,8 +627,7 @@ static void virgl_vtest_flush_frontbuffer(struct virgl_winsys *vws, * 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->protocol_version == 0 ? valid_stride : util_format_get_stride(res->format, res->width)); + &box, res->format); vtws->sws->displaytarget_unmap(vtws->sws, res->dt); diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h index e51582032a3..012aa1c98b1 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h @@ -153,7 +153,7 @@ int virgl_vtest_recv_transfer_get_data(struct virgl_vtest_winsys *vws, uint32_t data_size, uint32_t stride, const struct pipe_box *box, - uint32_t format, uint32_t res_width); + uint32_t format); int virgl_vtest_busy_wait(struct virgl_vtest_winsys *vws, int handle, int flags); diff --git a/src/gallium/winsys/virgl/vtest/vtest_protocol.h b/src/gallium/winsys/virgl/vtest/vtest_protocol.h index c299c31418d..9b39020c0ae 100644 --- a/src/gallium/winsys/virgl/vtest/vtest_protocol.h +++ b/src/gallium/winsys/virgl/vtest/vtest_protocol.h @@ -24,7 +24,7 @@ #define VTEST_PROTOCOL #define VTEST_DEFAULT_SOCKET_NAME "/tmp/.virgl_test" -#define VTEST_PROTOCOL_VERSION 1 +#define VTEST_PROTOCOL_VERSION 0 /* 32-bit length field */ /* 32-bit cmd field */ |