mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
panfrost: Pass an image view to panfrost_estimate_texture_payload_size()
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
This commit is contained in:
parent
c449a8a2c1
commit
added29e91
3 changed files with 24 additions and 40 deletions
|
|
@ -1235,26 +1235,6 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
|||
assert(!first_layer && !last_layer);
|
||||
}
|
||||
|
||||
unsigned size =
|
||||
(pan_is_bifrost(device) ? 0 : MALI_MIDGARD_TEXTURE_LENGTH) +
|
||||
panfrost_estimate_texture_payload_size(device,
|
||||
first_level, last_level,
|
||||
first_layer, last_layer,
|
||||
texture->nr_samples,
|
||||
type,
|
||||
prsrc->image.layout.modifier);
|
||||
|
||||
so->bo = panfrost_bo_create(device, size, 0);
|
||||
|
||||
struct panfrost_ptr payload = so->bo->ptr;
|
||||
void *tex = pan_is_bifrost(device) ?
|
||||
&so->bifrost_descriptor : so->bo->ptr.cpu;
|
||||
|
||||
if (!pan_is_bifrost(device)) {
|
||||
payload.cpu += MALI_MIDGARD_TEXTURE_LENGTH;
|
||||
payload.gpu += MALI_MIDGARD_TEXTURE_LENGTH;
|
||||
}
|
||||
|
||||
struct pan_image_view iview = {
|
||||
.format = format,
|
||||
.dim = type,
|
||||
|
|
@ -1274,6 +1254,21 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
|
|||
.buf.size = buf_size,
|
||||
};
|
||||
|
||||
unsigned size =
|
||||
(pan_is_bifrost(device) ? 0 : MALI_MIDGARD_TEXTURE_LENGTH) +
|
||||
panfrost_estimate_texture_payload_size(device, &iview);
|
||||
|
||||
so->bo = panfrost_bo_create(device, size, 0);
|
||||
|
||||
struct panfrost_ptr payload = so->bo->ptr;
|
||||
void *tex = pan_is_bifrost(device) ?
|
||||
&so->bifrost_descriptor : so->bo->ptr.cpu;
|
||||
|
||||
if (!pan_is_bifrost(device)) {
|
||||
payload.cpu += MALI_MIDGARD_TEXTURE_LENGTH;
|
||||
payload.gpu += MALI_MIDGARD_TEXTURE_LENGTH;
|
||||
}
|
||||
|
||||
panfrost_new_texture(device, &iview, tex, &payload);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,23 +200,18 @@ panfrost_texture_num_elements(
|
|||
|
||||
unsigned
|
||||
panfrost_estimate_texture_payload_size(const struct panfrost_device *dev,
|
||||
unsigned first_level,
|
||||
unsigned last_level,
|
||||
unsigned first_layer,
|
||||
unsigned last_layer,
|
||||
unsigned nr_samples,
|
||||
enum mali_texture_dimension dim,
|
||||
uint64_t modifier)
|
||||
const struct pan_image_view *iview)
|
||||
{
|
||||
/* Assume worst case */
|
||||
unsigned manual_stride = pan_is_bifrost(dev) ||
|
||||
(modifier == DRM_FORMAT_MOD_LINEAR);
|
||||
(iview->image->layout.modifier == DRM_FORMAT_MOD_LINEAR);
|
||||
|
||||
unsigned elements = panfrost_texture_num_elements(
|
||||
first_level, last_level,
|
||||
first_layer, last_layer,
|
||||
nr_samples,
|
||||
dim == MALI_TEXTURE_DIMENSION_CUBE, manual_stride);
|
||||
unsigned elements =
|
||||
panfrost_texture_num_elements(iview->first_level, iview->last_level,
|
||||
iview->first_layer, iview->last_layer,
|
||||
iview->image->layout.nr_samples,
|
||||
iview->dim == MALI_TEXTURE_DIMENSION_CUBE,
|
||||
manual_stride);
|
||||
|
||||
return sizeof(mali_ptr) * elements;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,13 +173,7 @@ panfrost_block_dim(uint64_t modifier, bool width, unsigned plane);
|
|||
|
||||
unsigned
|
||||
panfrost_estimate_texture_payload_size(const struct panfrost_device *dev,
|
||||
unsigned first_level,
|
||||
unsigned last_level,
|
||||
unsigned first_layer,
|
||||
unsigned last_layer,
|
||||
unsigned nr_samples,
|
||||
enum mali_texture_dimension dim,
|
||||
uint64_t modifier);
|
||||
const struct pan_image_view *iview);
|
||||
|
||||
void
|
||||
panfrost_new_texture(const struct panfrost_device *dev,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue