r300,r600,radeonsi: set winsys_handle::stride,offset in drivers, not winsyses
authorMarek Olšák <marek.olsak@amd.com>
Tue, 27 Aug 2019 23:35:25 +0000 (19:35 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 10 Sep 2019 03:43:03 +0000 (23:43 -0400)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/radeon/radeon_winsys.h
src/gallium/drivers/radeonsi/si_texture.c
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index 737a4f90418db345e82b8909cd1f04e29efd048c..f977dd14dc70fb9bd7d493fd1c0cefd2facd96d2 100644 (file)
@@ -1049,8 +1049,10 @@ bool r300_resource_get_handle(struct pipe_screen* screen,
         return false;
     }
 
-    return rws->buffer_get_handle(rws, tex->buf, tex->tex.stride_in_bytes[0],
-                                  0, 0, whandle);
+    whandle->stride = tex->tex.stride_in_bytes[0];
+    whandle->offset = 0;
+
+    return rws->buffer_get_handle(rws, tex->buf, whandle);
 }
 
 static const struct u_resource_vtbl r300_texture_vtbl =
index 03f217b988abfb072ffb03882bebf7a0e5799696..4b9b15bc0cd6c62ed60cc989dd83494b0156fdcc 100644 (file)
@@ -570,8 +570,10 @@ static bool r600_texture_get_handle(struct pipe_screen* screen,
                res->external_usage = usage;
        }
 
-       return rscreen->ws->buffer_get_handle(rscreen->ws, res->buf, stride,
-                                             offset, slice_size, whandle);
+       whandle->stride = stride;
+       whandle->offset = offset + slice_size * whandle->layer;
+
+       return rscreen->ws->buffer_get_handle(rscreen->ws, res->buf, whandle);
 }
 
 static void r600_texture_destroy(struct pipe_screen *screen,
index 505b6c9a2cb530b730bfc58b0bbed44580eea5fb..31eed8f5300f084297c1c8efd2bb1b067cafc14c 100644 (file)
@@ -412,13 +412,10 @@ struct radeon_winsys {
      * \param ws        The winsys instance for which the handle is to be valid
      * \param buf       A winsys buffer object to get the handle from.
      * \param whandle   A winsys handle pointer.
-     * \param stride    A stride of the buffer in bytes, for texturing.
      * \return          true on success.
      */
     bool (*buffer_get_handle)(struct radeon_winsys *ws,
                               struct pb_buffer *buf,
-                              unsigned stride, unsigned offset,
-                              unsigned slice_size,
                               struct winsys_handle *whandle);
 
     /**
index a4a08a6e3214cefd1ff1c7ad95b532e61bad1cf6..64fcd50f3a12c3a2088c9cee251ce304c222c57a 100644 (file)
@@ -1029,8 +1029,10 @@ static bool si_texture_get_handle(struct pipe_screen* screen,
                res->external_usage = usage;
        }
 
-       return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, stride,
-                                             offset, slice_size, whandle);
+       whandle->stride = stride;
+       whandle->offset = offset + slice_size * whandle->layer;
+
+       return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, whandle);
 }
 
 static void si_texture_destroy(struct pipe_screen *screen,
index 53f2bd67ea936544382a40c57d9f99b210864f61..6a39596711794c8c9fb1cd3accac9d78d09beed1 100644 (file)
@@ -1519,8 +1519,6 @@ error:
 
 static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
                                  struct pb_buffer *buffer,
-                                 unsigned stride, unsigned offset,
-                                 unsigned slice_size,
                                  struct winsys_handle *whandle)
 {
    struct amdgpu_screen_winsys *sws = amdgpu_screen_winsys(rws);
@@ -1565,9 +1563,6 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
    util_hash_table_set(ws->bo_export_table, bo->bo, bo);
    simple_mtx_unlock(&ws->bo_export_table_lock);
 
-   whandle->stride = stride;
-   whandle->offset = offset;
-   whandle->offset += slice_size * whandle->layer;
    bo->is_shared = true;
    return true;
 }
index f8a7b89966a3ed7c4fbd6d3befad69fae3c74a44..c0a763d45baee588f47c874e5a6567a5a20ba2ac 100644 (file)
@@ -1274,8 +1274,6 @@ fail:
 
 static bool radeon_winsys_bo_get_handle(struct radeon_winsys *rws,
                                         struct pb_buffer *buffer,
-                                        unsigned stride, unsigned offset,
-                                        unsigned slice_size,
                                         struct winsys_handle *whandle)
 {
     struct drm_gem_flink flink;
@@ -1312,10 +1310,6 @@ static bool radeon_winsys_bo_get_handle(struct radeon_winsys *rws,
             return false;
     }
 
-    whandle->stride = stride;
-    whandle->offset = offset;
-    whandle->offset += slice_size * whandle->layer;
-
     return true;
 }