panfrost: Use row stride for explicit layouts
Line strides don't make sense for linear images, so use row strides instead in the API. Then update the layout code accordingly. Note: we need to preserve the old UABI (bug for bug compatibility), so we still use legacy strides externally. But now we use row strides internally, which is better than using both everywhere. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16201>
This commit is contained in:
parent
c40ebd859c
commit
81a686a714
|
@ -86,7 +86,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
|
|||
PAN_IMAGE_CRC_OOB : PAN_IMAGE_CRC_NONE;
|
||||
struct pan_image_explicit_layout explicit_layout = {
|
||||
.offset = whandle->offset,
|
||||
.line_stride = whandle->stride,
|
||||
.row_stride = panfrost_from_legacy_stride(whandle->stride, templat->format, mod)
|
||||
};
|
||||
|
||||
rsc->image.layout = (struct pan_image_layout) {
|
||||
|
@ -177,7 +177,7 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
|
|||
return false;
|
||||
}
|
||||
|
||||
handle->stride = rsrc->image.layout.slices[0].line_stride;
|
||||
handle->stride = panfrost_get_legacy_stride(&rsrc->image.layout, 0);
|
||||
handle->offset = rsrc->image.layout.slices[0].offset;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -246,21 +246,21 @@ pan_image_layout_init(struct pan_image_layout *layout,
|
|||
slice->offset = offset;
|
||||
|
||||
/* Compute the would-be stride */
|
||||
unsigned stride = bytes_per_pixel * effective_width;
|
||||
unsigned row_stride = bytes_per_pixel * effective_width * block_size.height;
|
||||
|
||||
if (explicit_layout) {
|
||||
/* Make sure the explicit stride is valid */
|
||||
if (explicit_layout->line_stride < stride)
|
||||
if (explicit_layout->row_stride < row_stride)
|
||||
return false;
|
||||
|
||||
stride = explicit_layout->line_stride;
|
||||
row_stride = explicit_layout->row_stride;
|
||||
} else if (linear) {
|
||||
/* Keep lines alignment on 64 byte for performance */
|
||||
stride = ALIGN_POT(stride, 64);
|
||||
row_stride = ALIGN_POT(row_stride, 64);
|
||||
}
|
||||
|
||||
slice->line_stride = stride;
|
||||
slice->row_stride = stride * block_size.height;
|
||||
slice->line_stride = row_stride / block_size.height;
|
||||
slice->row_stride = row_stride;
|
||||
|
||||
unsigned slice_one_size = slice->line_stride * effective_height;
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ struct pan_scoreboard;
|
|||
|
||||
struct pan_image_explicit_layout {
|
||||
unsigned offset;
|
||||
unsigned line_stride;
|
||||
unsigned row_stride;
|
||||
};
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in New Issue