minigbm: i915: Update plane count in bo_import
and implement num_planes_from_modifier interface. This only includes the i915 parts of commit1a733377e9, partially reverting commit853b8542fb. Bug🅱️224580219 Change-Id: I94b5181f3ec231929873bc56c1044ca427f9de5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3568488 Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Robert Mader <robert.mader@collabora.corp-partner.google.com> Tested-by: Robert Mader <robert.mader@collabora.corp-partner.google.com> Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
parent
bc51ff31d2
commit
96058f97e8
1 changed files with 19 additions and 2 deletions
21
i915.c
21
i915.c
|
|
@ -441,6 +441,19 @@ static int i915_bo_from_format(struct bo *bo, uint32_t width, uint32_t height, u
|
|||
return 0;
|
||||
}
|
||||
|
||||
static size_t i915_num_planes_from_modifier(struct driver *drv, uint32_t format,
|
||||
uint64_t modifier)
|
||||
{
|
||||
size_t num_planes = drv_num_planes_from_format(format);
|
||||
if (modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
|
||||
modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS) {
|
||||
assert(num_planes == 1);
|
||||
return 2;
|
||||
}
|
||||
|
||||
return num_planes;
|
||||
}
|
||||
|
||||
static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
uint64_t use_flags, const uint64_t *modifiers, uint32_t count)
|
||||
{
|
||||
|
|
@ -565,7 +578,7 @@ static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t heig
|
|||
bo->meta.offsets[1] = offset;
|
||||
offset += ccs_size;
|
||||
|
||||
bo->meta.num_planes = 2;
|
||||
bo->meta.num_planes = i915_num_planes_from_modifier(bo->drv, format, modifier);
|
||||
bo->meta.total_size = offset;
|
||||
} else if (modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS) {
|
||||
|
||||
|
|
@ -600,7 +613,7 @@ static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t heig
|
|||
bo->meta.sizes[1] = ALIGN(bo->meta.sizes[0] / 256, getpagesize());
|
||||
bo->meta.offsets[1] = bo->meta.sizes[0];
|
||||
/* Total number of planes & sizes */
|
||||
bo->meta.num_planes = 2;
|
||||
bo->meta.num_planes = i915_num_planes_from_modifier(bo->drv, format, modifier);
|
||||
bo->meta.total_size = bo->meta.sizes[0] + bo->meta.sizes[1];
|
||||
} else {
|
||||
i915_bo_from_format(bo, width, height, format);
|
||||
|
|
@ -678,6 +691,9 @@ static int i915_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
|||
int ret;
|
||||
struct drm_i915_gem_get_tiling gem_get_tiling = { 0 };
|
||||
|
||||
bo->meta.num_planes = i915_num_planes_from_modifier(bo->drv, data->format,
|
||||
data->format_modifier);
|
||||
|
||||
ret = drv_prime_bo_import(bo, data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -808,6 +824,7 @@ const struct backend backend_i915 = {
|
|||
.bo_invalidate = i915_bo_invalidate,
|
||||
.bo_flush = i915_bo_flush,
|
||||
.resolve_format_and_use_flags = drv_resolve_format_and_use_flags_helper,
|
||||
.num_planes_from_modifier = i915_num_planes_from_modifier,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue