diff options
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_resource.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 3cc6654b740..1874271c86b 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -898,15 +898,18 @@ fd_resource_from_handle(struct pipe_screen *pscreen, util_range_init(&rsc->valid_buffer_range); - rsc->bo = fd_screen_bo_from_handle(pscreen, handle, &slice->pitch); + rsc->bo = fd_screen_bo_from_handle(pscreen, handle); if (!rsc->bo) goto fail; rsc->base.vtbl = &fd_resource_vtbl; rsc->cpp = util_format_get_blocksize(tmpl->format); - slice->pitch /= rsc->cpp; + slice->pitch = handle->stride / rsc->cpp; slice->offset = handle->offset; + if ((slice->pitch < align(prsc->width0, 32)) || (slice->pitch % 32)) + goto fail; + assert(rsc->cpp); return prsc; |