mediatek: limit recent changes to MTK8173
Previous change introduced a regression to CTS tests on other mediatek board then MTK8173. This CL fixes this by switching to relying on MTK_MT8173 compile define. BUG=b:305347887 TEST=android.mediav2.cts.CodecEncoderSurfaceTest Cq-Depend: chromium:4887244 Change-Id: I30f814222423e1b77d25c3256e9fcb0319c6339f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4946471 Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Tested-by: Bartłomiej Grzesik <bgrzesik@google.com> Commit-Queue: Kazuhiro Inaba <kinaba@chromium.org>
This commit is contained in:
parent
48a3e34e16
commit
6a402a9d24
1 changed files with 23 additions and 7 deletions
30
mediatek.c
30
mediatek.c
|
|
@ -127,7 +127,7 @@ static int mediatek_init(struct driver *drv)
|
|||
metadata.modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
drv_modify_combination(drv, DRM_FORMAT_YVU420, &metadata,
|
||||
BO_USE_HW_VIDEO_DECODER | BO_USE_PROTECTED);
|
||||
#ifndef USE_NV12_FOR_HW_VIDEO_DECODING
|
||||
#ifdef MTK_MT8173
|
||||
/*
|
||||
* b/292507490: The MT8173 decoder can output YUV420 only. Some CTS tests feed the
|
||||
* decoded buffer to the hardware encoder and the tests allocate the buffer with
|
||||
|
|
@ -189,7 +189,11 @@ static int mediatek_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
|
|||
const bool is_camera_preview =
|
||||
(bo->meta.use_flags & BO_USE_SCANOUT) && (bo->meta.use_flags & BO_USE_CAMERA_WRITE);
|
||||
const bool is_hw_video_encoder = bo->meta.use_flags & BO_USE_HW_VIDEO_ENCODER;
|
||||
const bool is_hw_video_decoder = bo->meta.use_flags & BO_USE_HW_VIDEO_DECODER;
|
||||
#ifdef MTK_MT8173
|
||||
const bool is_mt8173_video_decoder = bo->meta.use_flags & BO_USE_HW_VIDEO_DECODER;
|
||||
#else
|
||||
const bool is_mt8173_video_decoder = false;
|
||||
#endif
|
||||
/*
|
||||
* Android sends blobs for encoding in the shape of a single-row pixel buffer. Use R8 +
|
||||
* single row as a proxy for Android HAL_PIXEL_FORMAT_BLOB until a drm equivalent is
|
||||
|
|
@ -218,11 +222,23 @@ static int mediatek_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
|
|||
#endif
|
||||
|
||||
/*
|
||||
* The alignment of the hardware video decoder is larger than the hardware video
|
||||
* encoder. If a hardware video decoder mask is specified, then the alignment of
|
||||
* the decoder is to be applied.
|
||||
* The mediatek video decoder requires to align width and height by 64. But this is
|
||||
* the requirement for mediatek tiled format (e.g. MT21 and MM21). The buffers are
|
||||
* not allocated by minigbm. So we don't have to care about it. The tiled buffer is
|
||||
* converted to NV12 or YV12, which is allocated by minigbm. V4L2 MDP doesn't
|
||||
* require any special alignment for them.
|
||||
* On the other hand, the mediatek video encoder reuqires a padding on each plane.
|
||||
* When both video decoder and encoder use flag is masked (in some CTS test), we
|
||||
* align with the encoder alignment.
|
||||
* However, V4L2VideoDecodeAccelerator used on MT8173 fails handling the buffer with
|
||||
* padding, although V4L2VideoDecoder used on MT8183 and later can do. We workaround
|
||||
* this problem to allocate a buffer without padding on MT8173. This works because
|
||||
* MT8173 decoder's output NV12 is converted to YV12 buffer that is allocated with
|
||||
* video encoder usage mask only and thus have padding in Android.
|
||||
* See go/mediatek-video-buffer-alignment-note for detail.
|
||||
*/
|
||||
if ((is_hw_video_encoder && !is_hw_video_decoder && !is_format_blob) || is_camera_preview) {
|
||||
if ((is_hw_video_encoder && !is_mt8173_video_decoder && !is_format_blob) ||
|
||||
is_camera_preview) {
|
||||
uint32_t aligned_height = ALIGN(height, 32);
|
||||
uint32_t padding[DRV_MAX_PLANES] = { 0 };
|
||||
|
||||
|
|
@ -459,7 +475,7 @@ static void mediatek_resolve_format_and_use_flags(struct driver *drv, uint32_t f
|
|||
*/
|
||||
if (use_flags &
|
||||
(BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_HW_VIDEO_ENCODER)) {
|
||||
#ifdef USE_NV12_FOR_HW_VIDEO_DECODING
|
||||
#ifndef MTK_MT8173
|
||||
*out_format = DRM_FORMAT_NV12;
|
||||
break;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue