aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQiang Yu <[email protected]>2020-03-30 10:54:08 +0800
committerMarge Bot <[email protected]>2020-03-31 01:40:29 +0000
commit4de35bed423a9e4204498b83b5be7f16399363bc (patch)
treea1bb9e07d14ec80f4ea692ea2b2b60873bd7103d /src
parente46b2ef7243a7f916b7d77f3495bea26f4f24d62 (diff)
lima: also check tiled and depth case when import
We missed the tiled and depth case when check buffer alignment. Reviewed-by: Vasily Khoruzhick <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4362> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4362>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/lima/lima_resource.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
index fb416652e53..5dd2a472114 100644
--- a/src/gallium/drivers/lima/lima_resource.c
+++ b/src/gallium/drivers/lima/lima_resource.c
@@ -322,25 +322,6 @@ lima_resource_from_handle(struct pipe_screen *pscreen,
return NULL;
}
- /* check alignment for the buffer */
- if (pres->bind & PIPE_BIND_RENDER_TARGET) {
- unsigned width, height, stride, size;
-
- width = align(pres->width0, 16);
- height = align(pres->height0, 16);
- stride = util_format_get_stride(pres->format, width);
- size = util_format_get_2d_size(pres->format, stride, height);
-
- if (res->levels[0].stride != stride || res->bo->size < size) {
- debug_error("import buffer not properly aligned\n");
- goto err_out;
- }
-
- res->levels[0].width = width;
- }
- else
- res->levels[0].width = pres->width0;
-
switch (handle->modifier) {
case DRM_FORMAT_MOD_LINEAR:
res->tiled = false;
@@ -360,6 +341,26 @@ lima_resource_from_handle(struct pipe_screen *pscreen,
goto err_out;
}
+ /* check alignment for the buffer */
+ if (res->tiled ||
+ (pres->bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL))) {
+ unsigned width, height, stride, size;
+
+ width = align(pres->width0, 16);
+ height = align(pres->height0, 16);
+ stride = util_format_get_stride(pres->format, width);
+ size = util_format_get_2d_size(pres->format, stride, height);
+
+ if (res->levels[0].stride != stride || res->bo->size < size) {
+ debug_error("import buffer not properly aligned\n");
+ goto err_out;
+ }
+
+ res->levels[0].width = width;
+ }
+ else
+ res->levels[0].width = pres->width0;
+
return pres;
err_out: