[Mesa-dev] [PATCH] virgl: remove unused stride-arguments

Gurchetan Singh gurchetansingh at chromium.org
Fri Jul 20 03:39:32 UTC 2018


Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
On Wed, Jul 18, 2018 at 4:06 AM Erik Faye-Lund
<erik.faye-lund at collabora.com> wrote:
>
> The IOCTLs doesn't pass this along, so computing them in the first
> place is kinda pointless.
>
> Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
> ---
>
> This is just a cleanup I noticed based on some discussion with Gert.
>
> A question is, what code here expects this stride to be respected? The
> call-sites in virgl_*_transfer_map and virgl_*_transfer_unmap kinda
> looks like they do... They'll get a bit of a surprise here, no?
>
> Anyway, this is already broken, so I think this should be OK. But
> perhaps this patch shows some code-paths that need some love?
>
>  src/gallium/drivers/virgl/virgl_buffer.c      |  4 ++--
>  src/gallium/drivers/virgl/virgl_context.c     |  2 +-
>  src/gallium/drivers/virgl/virgl_texture.c     | 24 ++-----------------
>  src/gallium/drivers/virgl/virgl_winsys.h      |  2 --
>  .../winsys/virgl/drm/virgl_drm_winsys.c       |  6 -----
>  5 files changed, 5 insertions(+), 33 deletions(-)
>
> diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c
> index 2e63aebc72..97b2854b9c 100644
> --- a/src/gallium/drivers/virgl/virgl_buffer.c
> +++ b/src/gallium/drivers/virgl/virgl_buffer.c
> @@ -77,7 +77,7 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx,
>
>     readback = virgl_res_needs_readback(vctx, &vbuf->base, usage);
>     if (readback)
> -      vs->vws->transfer_get(vs->vws, vbuf->base.hw_res, box, trans->base.stride, trans->base.layer_stride, offset, level);
> +      vs->vws->transfer_get(vs->vws, vbuf->base.hw_res, box, offset, level);
>
>     if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED))
>        doflushwait = true;
> @@ -109,7 +109,7 @@ static void virgl_buffer_transfer_unmap(struct pipe_context *ctx,
>           vbuf->base.clean = FALSE;
>           vctx->num_transfers++;
>           vs->vws->transfer_put(vs->vws, vbuf->base.hw_res,
> -                               &transfer->box, trans->base.stride, trans->base.layer_stride, trans->offset, transfer->level);
> +                               &transfer->box, trans->offset, transfer->level);
>
>        }
>     }
> diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
> index ee28680b8f..19bc23dd1e 100644
> --- a/src/gallium/drivers/virgl/virgl_context.c
> +++ b/src/gallium/drivers/virgl/virgl_context.c
> @@ -71,7 +71,7 @@ static void virgl_buffer_flush(struct virgl_context *vctx,
>
>     vctx->num_transfers++;
>     rs->vws->transfer_put(rs->vws, vbuf->base.hw_res,
> -                         &box, 0, 0, box.x, 0);
> +                         &box, box.x, 0);
>
>     util_range_set_empty(&vbuf->valid_buffer_range);
>  }
> diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
> index 150a5ebd8c..485b7cf1a7 100644
> --- a/src/gallium/drivers/virgl/virgl_texture.c
> +++ b/src/gallium/drivers/virgl/virgl_texture.c
> @@ -138,7 +138,6 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx,
>     const unsigned h = u_minify(vtex->base.u.b.height0, level);
>     const unsigned nblocksy = util_format_get_nblocksy(format, h);
>     bool is_depth = util_format_has_depth(util_format_description(resource->format));
> -   uint32_t l_stride;
>     bool doflushwait;
>
>     doflushwait = virgl_res_needs_flush_wait(vctx, &vtex->base, usage);
> @@ -156,15 +155,6 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx,
>     trans->base.stride = vtex->stride[level];
>     trans->base.layer_stride = trans->base.stride * nblocksy;
>
> -   if (resource->target != PIPE_TEXTURE_3D &&
> -       resource->target != PIPE_TEXTURE_CUBE &&
> -       resource->target != PIPE_TEXTURE_1D_ARRAY &&
> -       resource->target != PIPE_TEXTURE_2D_ARRAY &&
> -       resource->target != PIPE_TEXTURE_CUBE_ARRAY)
> -      l_stride = 0;
> -   else
> -      l_stride = trans->base.layer_stride;
> -
>     if (is_depth && resource->nr_samples > 1) {
>        struct pipe_resource tmp_resource;
>        virgl_init_temp_resource_from_box(&tmp_resource, resource, box,
> @@ -188,7 +178,7 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx,
>
>     readback = virgl_res_needs_readback(vctx, &vtex->base, usage);
>     if (readback)
> -      vs->vws->transfer_get(vs->vws, hw_res, box, trans->base.stride, l_stride, offset, level);
> +      vs->vws->transfer_get(vs->vws, hw_res, box, offset, level);
>
>     if (doflushwait || readback)
>        vs->vws->resource_wait(vs->vws, vtex->base.hw_res);
> @@ -210,16 +200,6 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
>     struct virgl_context *vctx = virgl_context(ctx);
>     struct virgl_transfer *trans = virgl_transfer(transfer);
>     struct virgl_texture *vtex = virgl_texture(transfer->resource);
> -   uint32_t l_stride;
> -
> -   if (transfer->resource->target != PIPE_TEXTURE_3D &&
> -       transfer->resource->target != PIPE_TEXTURE_CUBE &&
> -       transfer->resource->target != PIPE_TEXTURE_1D_ARRAY &&
> -       transfer->resource->target != PIPE_TEXTURE_2D_ARRAY &&
> -       transfer->resource->target != PIPE_TEXTURE_CUBE_ARRAY)
> -      l_stride = 0;
> -   else
> -      l_stride = trans->base.layer_stride;
>
>     if (trans->base.usage & PIPE_TRANSFER_WRITE) {
>        if (!(transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT)) {
> @@ -227,7 +207,7 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
>           vtex->base.clean = FALSE;
>           vctx->num_transfers++;
>           vs->vws->transfer_put(vs->vws, vtex->base.hw_res,
> -                               &transfer->box, trans->base.stride, l_stride, trans->offset, transfer->level);
> +                               &transfer->box, trans->offset, transfer->level);
>
>        }
>     }
> diff --git a/src/gallium/drivers/virgl/virgl_winsys.h b/src/gallium/drivers/virgl/virgl_winsys.h
> index 6346c21faf..232437e861 100644
> --- a/src/gallium/drivers/virgl/virgl_winsys.h
> +++ b/src/gallium/drivers/virgl/virgl_winsys.h
> @@ -50,13 +50,11 @@ struct virgl_winsys {
>     int (*transfer_put)(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);
>
>     int (*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);
>
>     struct virgl_hw_res *(*resource_create)(struct virgl_winsys *vws,
> diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> index aad6430c41..36655c6388 100644
> --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
> @@ -250,7 +250,6 @@ static int
>  virgl_bo_transfer_put(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)
>  {
>     struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
> @@ -266,8 +265,6 @@ virgl_bo_transfer_put(struct virgl_winsys *vws,
>     tohostcmd.box.d = box->depth;
>     tohostcmd.offset = buf_offset;
>     tohostcmd.level = level;
> -  // tohostcmd.stride = stride;
> -  // tohostcmd.layer_stride = stride;
>     return drmIoctl(vdws->fd, DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST, &tohostcmd);
>  }
>
> @@ -275,7 +272,6 @@ static int
>  virgl_bo_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)
>  {
>     struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
> @@ -285,8 +281,6 @@ virgl_bo_transfer_get(struct virgl_winsys *vws,
>     fromhostcmd.bo_handle = res->bo_handle;
>     fromhostcmd.level = level;
>     fromhostcmd.offset = buf_offset;
> -  // fromhostcmd.stride = stride;
> -  // fromhostcmd.layer_stride = layer_stride;
>     fromhostcmd.box.x = box->x;
>     fromhostcmd.box.y = box->y;
>     fromhostcmd.box.z = box->z;
> --
> 2.18.0.rc2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list