diff options
author | Eric Anholt <[email protected]> | 2018-11-01 12:15:25 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-11-01 13:54:36 -0700 |
commit | 47586ab56989bc4225caf173f5bb570f60c7759f (patch) | |
tree | 85b432590f8086f1ba8ae3bfe8ab0cd00a859ead /src/gallium/drivers/v3d/v3d_resource.c | |
parent | 5313fb8abd2af8f0b5cfb8d3bc1b64697d8176d7 (diff) |
v3d: Respect user-passed strides for BO imports.
If the caller has passed in a stride for (linear) BO import, we should use
that stride when rendering to the BO (or, if we some day support texturing
from linear-imported BOs, when doing the linear-to-UIF shadow copy). This
lets us remove the extra stride-changing relayout in the simulator.
Diffstat (limited to 'src/gallium/drivers/v3d/v3d_resource.c')
-rw-r--r-- | src/gallium/drivers/v3d/v3d_resource.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index dd0db8cfd89..b9c578b9cf5 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -396,7 +396,7 @@ v3d_get_ub_pad(struct v3d_resource *rsc, uint32_t height) } static void -v3d_setup_slices(struct v3d_resource *rsc) +v3d_setup_slices(struct v3d_resource *rsc, uint32_t winsys_stride) { struct pipe_resource *prsc = &rsc->base; uint32_t width = prsc->width0; @@ -498,7 +498,10 @@ v3d_setup_slices(struct v3d_resource *rsc) } slice->offset = offset; - slice->stride = level_width * rsc->cpp; + if (winsys_stride) + slice->stride = winsys_stride; + else + slice->stride = level_width * rsc->cpp; slice->padded_height = level_height; slice->size = level_height * slice->stride; @@ -674,7 +677,7 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen, rsc->internal_format = prsc->format; - v3d_setup_slices(rsc); + v3d_setup_slices(rsc, 0); if (!v3d_resource_bo_alloc(rsc)) goto fail; @@ -730,12 +733,10 @@ v3d_resource_from_handle(struct pipe_screen *pscreen, switch (whandle->type) { case WINSYS_HANDLE_TYPE_SHARED: - rsc->bo = v3d_bo_open_name(screen, - whandle->handle, whandle->stride); + rsc->bo = v3d_bo_open_name(screen, whandle->handle); break; case WINSYS_HANDLE_TYPE_FD: - rsc->bo = v3d_bo_open_dmabuf(screen, - whandle->handle, whandle->stride); + rsc->bo = v3d_bo_open_dmabuf(screen, whandle->handle); break; default: fprintf(stderr, @@ -749,7 +750,7 @@ v3d_resource_from_handle(struct pipe_screen *pscreen, rsc->internal_format = prsc->format; - v3d_setup_slices(rsc); + v3d_setup_slices(rsc, whandle->stride); v3d_debug_resource_layout(rsc, "import"); if (whandle->stride != slice->stride) { |