mediatek: align with hardware workaround on Sigurd based GPU
BUG=b:239243515 TEST=android.media.cts.DecodeAccuracyTest#testGLViewLargerWidthDecodeAccuracy[40] Change-Id: I7b4dcf0325e0776a2554d10898cffcc515cb8473 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3824599 Tested-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Lepton Wu <lepton@chromium.org> Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
parent
ccfca97d92
commit
5c93742e6c
1 changed files with 19 additions and 0 deletions
19
mediatek.c
19
mediatek.c
|
|
@ -36,6 +36,14 @@
|
|||
#define DONT_USE_64_ALIGNMENT_FOR_VIDEO_BUFFERS
|
||||
#endif
|
||||
|
||||
// For Mali Sigurd based GPUs, the texture unit reads outside the specified texture dimensions.
|
||||
// Therefore, certain formats require extra memory padding to its allocated surface to prevent the
|
||||
// hardware from reading outside an allocation. For YVU420, we need additional padding for the last
|
||||
// chroma plane.
|
||||
#if defined(MTK_MT8186)
|
||||
#define USE_EXTRA_PADDING_FOR_YVU420
|
||||
#endif
|
||||
|
||||
struct mediatek_private_map_data {
|
||||
void *cached_addr;
|
||||
void *gem_addr;
|
||||
|
|
@ -190,6 +198,17 @@ static int mediatek_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
|
|||
height = ALIGN(height, 16);
|
||||
#endif
|
||||
drv_bo_from_format(bo, stride, height, format);
|
||||
|
||||
#ifdef USE_EXTRA_PADDING_FOR_YVU420
|
||||
/* Do the fix after drv_bo_from_format to avoid extra calculations. */
|
||||
if ((format == DRM_FORMAT_YVU420 || format == DRM_FORMAT_YVU420_ANDROID) &&
|
||||
(bo->meta.use_flags & BO_USE_TEXTURE)) {
|
||||
const size_t last_plane = bo->meta.num_planes - 1;
|
||||
uint32_t padded_last_plane_size = drv_size_from_format(
|
||||
format, bo->meta.strides[last_plane], ALIGN(height, 4), last_plane);
|
||||
bo->meta.total_size += padded_last_plane_size - bo->meta.sizes[last_plane];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
gem_create.size = bo->meta.total_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue