[virglrenderer-devel] [PATCH 1/3] Revert "vrend: make temporary buffer used by iovec read/write large enough"

Gurchetan Singh gurchetansingh at chromium.org
Tue Mar 6 04:54:38 UTC 2018


This breaks s3tc Piglit tests.

This reverts commit e3c79887c8f46716351ea159b351f0502560ae69.
---
 src/vrend_renderer.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index e9fb14e..7c7515f 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4669,7 +4669,8 @@ static void read_transfer_data(struct pipe_resource *res,
 {
    int blsize = util_format_get_blocksize(res->format);
    uint32_t size = vrend_get_iovec_size(iov, num_iovs);
-   uint32_t send_size = util_format_get_2d_size(res->format, src_stride, box->height) * box->depth;
+   uint32_t send_size = util_format_get_nblocks(res->format, box->width,
+                                              box->height) * blsize * box->depth;
    uint32_t bwx = util_format_get_nblocksx(res->format, box->width) * blsize;
    uint32_t bh = util_format_get_nblocksy(res->format, box->height);
    int d, h;
@@ -4710,12 +4711,13 @@ static void write_transfer_data(struct pipe_resource *res,
 {
    int blsize = util_format_get_blocksize(res->format);
    uint32_t size = vrend_get_iovec_size(iov, num_iovs);
+   uint32_t send_size = util_format_get_nblocks(res->format, box->width,
+                                                box->height) * blsize * box->depth;
    uint32_t bwx = util_format_get_nblocksx(res->format, box->width) * blsize;
    uint32_t bh = util_format_get_nblocksy(res->format, box->height);
    int d, h;
    uint32_t myoffset = offset;
    uint32_t stride = dst_stride ? dst_stride : util_format_get_nblocksx(res->format, u_minify(res->width0, level)) * blsize;
-   uint32_t send_size = util_format_get_2d_size(res->format, stride, box->height) * box->depth;
 
    if ((send_size == size || bh == 1) && !invert) {
       vrend_write_to_iovec(iov, num_iovs, offset, data, send_size);
@@ -4897,7 +4899,8 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
       }
 
       if (need_temp) {
-         send_size = util_format_get_2d_size(res->base.format, stride, info->box->height) * info->box->depth;
+         send_size = util_format_get_nblocks(res->base.format, info->box->width,
+                                             info->box->height) * elsize * info->box->depth;
          data = malloc(send_size);
          if (!data)
             return ENOMEM;
@@ -5153,12 +5156,8 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
       need_temp = 1;
 
    if (need_temp) {
-      uint32_t alloc_size, stride;
-
-      stride = util_format_get_nblocksx(res->base.format, u_minify(res->base.width0, info->level)) * elsize;
       send_size = util_format_get_nblocks(res->base.format, info->box->width, info->box->height) * info->box->depth * util_format_get_blocksize(res->base.format);
-      alloc_size = util_format_get_2d_size(res->base.format, stride, info->box->height) * info->box->depth;
-      data = malloc(alloc_size);
+      data = malloc(send_size);
       if (!data) {
          fprintf(stderr,"malloc failed %d\n", send_size);
          return ENOMEM;
-- 
2.16.2.395.g2e18187dfd-goog



More information about the virglrenderer-devel mailing list