The write permission for restricted_mtk_cma is unnecessary.
Bug: 433330646
Test: allocate a buffer with GRALLOC_USAGE_PROTECTED usage
Flag: EXEMPT: desktop-only change
Change-Id: Id99a0e03f2e1c7cbb9f15596316dd21aaebdf4a3
This change modifies buffer allocation to include necessary padding
for buffers with the BO_USE_CURSOR flag. This behavior mirrors
identical logic in the i915 and xe implementations.
Bug: b/420919101
Change-Id: I113162cf400116e2627b2a6bb20b560207117cf3
for all render/scanout formats and R8 and non YUV image source formats.
Bug: 414820115
Test: run dEQP-VK.image.swapchain_mutable.android.2d_array
Change-Id: I074f84b75f9096a77c9db90e66fcbd98672372ea
if the heap is available
Bug: b/406253026
Test: run android.graphics.cts.BitmapTest#testWrapHardwareBufferWithProtectedUsageFails
Flag: EXEMPT: desktop-only change
Change-Id: Ifbd1d75e63609e5e7c24e0ec6dce7aaba9f14b98
On Android, cros-codecs needs NV12 buffers that can be written to by the
CPU so that it can do MM21->NV12 de-tiling using libyuv. On Android, we
can't specify that we want NV12 buffers specifically using the gralloc
API. Instead, we ask for DRM_FORMAT_FLEX_YCbCr_420_888 and hope for the
best.
Before this CL, minigbm was returning YV12 buffers in this case on
corsola. This CL makes it so that on the mediatek backend,
DRM_FORMAT_FLEX_YCbCr_420_888 is always resolved to NV12 outside of
MT8173.
Bug: 408498122
Bug: 408503818
Test: adb -s $DUT shell codec -vpR /tmp/1080.mp4 on corsola
Test: vts-tradefed run vts --serial $DUT -m VtsHalMediaC2V1_0TargetVideoDecTest on corsola
Change-Id: Idbdba3434fdfdb0bf12aa7c92d1f9523e5870aba
Add build changes for mt8186.
Add ARM metadata types: compression, plane fds and data type.
Add mediatek_drm.h which is not available.
Bug: 388092228
Test: boot corsola with minigbm gralloc/mapper
Change-Id: I1f1e8a57f37e26694320c3ddee01fbad453f854b
There was another change done after this was tested before which then
was setting the size before the calculation was done to handle the
10-bit case. We now fix that size after doing the 10-bit modification.
BUG=b:367770932
TEST=None
Change-Id: Id5410f802c9140d378217fbf7b33f1d467ebf5ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5967833
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
After this change is_supported() succeeds, USB camera starts
working and:
E [minigbm:CrosGralloc4Allocator.cc(88)]: Unsupported combination -- pixel format: YV12, drm format:DRM_FOURCC_9997, usage: CPU_READ_NEVER | CPU_WRITE_NEVER | CPU_WRITE_RARELY | CPU_WRITE_OFTEN | GPU_TEXTURE | CAMERA_OUTPUT (0x20130)
issue is fixed.
Similar settings were already introduced for other backends e.g. msm:
https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3058396
BUG=b:320202326, b:309244873
Test: Verify that external USB camera is working in Android environment
Change-Id: I7e1e328998ddf62ed127c001f054ed10c6fb6a02
Reviewed-by: Michal Dubiel <dubielm@google.com>
Reviewed-by: Konrad Adamczyk <konrada@google.com>
Tested-by: Konrad Adamczyk <konrada@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5913519
Auto-Submit: Grzegorz Jaszczyk <jaszczyk@google.com>
Tested-by: Grzegorz Jaszczyk <jaszczyk@google.com>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
1. Allocate secure buffer from DMA_HEAP_IOCTL_ALLOC ,then using FD to
create a GEM handle and close this FD.
2. Since the secure buffer doesn't allocate via DRM_IOCTL_MTK_GEM_CREATE,
the DRM_MTK_GEM_CREATE_FLAG_RESTRICTED flag can be removed.
It should be added in the code that calls drmModeAddFB2().
3. Add mediatek_private_drv_data to store the dma_heap_fd in drv->priv,
and also add mediatek_close() to close dma_heap_fd and free drv->priv
when backend driver is closing.
BUG=b:248609774
TEST=emerge-geralt minigbm
Change-Id: I96df25580efe04f2c9a739b2d68de8837df091df
Signed-off-by: Jason-jh Lin <jason-jh.lin@mediatek.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5581571
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
To improve the efficiency of allocating high-resolution video decoder,
pass a flag to notify the kernel DMA framework to allocate linear
scanout buffers with single pages, so the allocation is more likely to
success when the available large chunk memory is constrained.
BUG=b:352229429
TEST=emerge-geralt libdrm minigbm
Cq-Depend: chromium:5689126
Change-Id: I21f2745cb5bdb7eaf7f50482c4c091791d13bbcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5706152
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Tested-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
On MTK, when we allocate MT2T surfaces for protected content, these are
sent in as P010 instead. However, P010 uses 16bpp where MT2T requires
only 10bpp. This adjusts the allocation sizes to only be what is needed
so we reduce memory usage by 5/8.
BUG=b:339091167
TEST=Netflix 4K 10-bit HEVC plays on Ciri
Change-Id: Ia34b7d3aa962f3138da130077d723748592023bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5582540
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Miguel Casas <mcasas@google.com>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Miguel Casas <mcasas@google.com>
Add support for AR30 overlays to select MTK devices.
BUG=b:325625530
TEST=Tested by running MT2T->AR30 image processing tests on MT8188G.
Change-Id: I570ee740e49b5d9c61a1e1d0da777fdcc937321d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5345669
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Commit-Queue: Justin Green <greenjustin@google.com>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Justin Green <greenjustin@google.com>
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 patch fixes the allocation of BO_USE_HW_VIDEO_DECODER | BO_USE_HW_VIDEO_ENCODER
on MTK8173 in order to pass CTS tests. The tests were failing due to
lack of resolved combo for DRM_FORMAT_FLEX_YCbCr_420_888 with
BO_USE_HW_VIDEO_DECODER | BO_USE_HW_VIDEO_ENCODER. Furthermore a change in
buffer alignment was required to avoid V4L2VDA failures.
BUG=b:292507490
TEST=CtsMediaV2TestCases android.mediav2.cts.CodecEncoderSurfaceTest
Change-Id: I41170169098e9110154328288710832a436bc9d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4916803
Auto-Submit: Bartłomiej Grzesik <bgrzesik@google.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Bartłomiej Grzesik <bgrzesik@google.com>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Run clang-format to correct the format in mediatek.c
BUG=N/A
TEST=CQ
Change-Id: I2c6630792ade67fd09a4fd8e7d13140ec4da7c90
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4517884
Commit-Queue: Dawn Han <dawnhan@google.com>
Tested-by: Dawn Han <dawnhan@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
BO_USE_PROTECTED use_flag is for allocating a secure buffer from GEM,
so we also need to add it for the formats of gpu and video decoder.
BUG=b:248609774
TEST="emerge-cherry libdrm minigbm" pass
Change-Id: I36f433ac173724a4c3794ad9642dea1f8d9db051
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4603653
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
MT8173's IMG driver doesn't seem to support these texture formats, and
that causes CTS failures when we upgrade Android version to container-R.
Use an allow-list approach to exclude the formats from MT8173.
While at it, also do a minor renaming for alignment.
BUG=b:278492435
TEST=CtsGraphicsTestCases
Change-Id: Ic7ce5510f986c4cf3176b72a5f196b648387de34
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4453148
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
The multi-planar formats are being allocated into a single plane,
and the minigbm exynos backend is dropped. So we can use `handle` instead of handles as of now.
Remove some of the helper functions that calculate the number of planes.
There is no need to check if there is more than one kernel buffer per buffer object.
Added a new function `drv_gem_close` in `drv_helpers` that can be used by `drv_gem_bo_destroy` and `drv_prime_bo_import`. It can be used to clean the unused gem_handle.
Bug=b:266776512
TEST=camera and screenshot work fine after deploying the change #strongbad
TEST=camera and screenshot work fine after deploying the change #kukui-arc-r
TEST=camera and screenshot work fine after deploying the change, tested a couple of apps in the Google Play Store, and checked file `dma_buf/bufinfo` to see there's no object leaking. #guybrush
Change-Id: Ib63559504e4cb8f1a32ae90170925146613d694f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4297873
Commit-Queue: Dawn Han <dawnhan@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Dawn Han <dawnhan@google.com>
HAL_PIXEL_FORMAT_BLOB gets resolved into DRM_FORMAT_R8 with height of 1.
Avoid doing any vertical alignment for this case. This format should be
exempt from the 32 vertical alignment requirement from mtk video encoder
in the kernel driver.
BUG=b:270850022
BUG=b:242495495
TEST=test and app work
Change-Id: Ic635c708597b5f5548ad95f34a81943d4cc2c801
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4364500
Reviewed-by: Hsin-Yi Wang <hsinyi@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
drv_bo_from_format will apply stride_align to all planes. Since we
always pass 1 for stride_align, there is no change except when the
format is DRM_FORMAT_YVU420_ANDROID.
When the format is DRM_FORMAT_YVU420_ANDROID, and when stride_align is 0
or 1, drv_bo_from_format assumes there is no hw requirement and forces
stride_align to 16. But because we used to require stride to be aligned
to 32, there is no actual change either.
BUG=b:265746435
TEST=subset of CTS and CTS Verifier on grunt, guybrush and skyrim
Change-Id: Ia6ef89bb744c39d2baead07bc47f11b0eea96b97
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4336265
Tested-by: Chia-I Wu <olv@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Dawn Han <dawnhan@google.com>
Remove the parameter to align with upstream gbm.
For some places that use the number of planes. The number is 1. The
multi-planar formats are being allocated into a single plane, and
minigbm exynos backend is dropped. So we can just set the plane
index to 0 if needed.
Fixed the format in i915.c.
Bug=b:266776512
TEST=camera works after deploying the change #strongbad
TEST=camera works after deploying the change #corsola
Change-Id: I0880917754c01b9d0f27d21f3c42d87f00a09f50
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4249501
Commit-Queue: Dawn Han <dawnhan@google.com>
Tested-by: Dawn Han <dawnhan@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
To reserve the blame history, make it easier to extend and ensure the
lines don't get too lengthy in the future.
BUG=None
TEST=emerge-geralt minigbm
Change-Id: Id176ac4b113f61472c171874884d14037591c5e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3998335
Tested-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
Reviewed-by: Hsin-Yi Wang <hsinyi@chromium.org>
Add BO_USE_TEXTURE to YUYV planes for Mediatek devices. This allows them
to be used as hardware overlays.
BUG=b:238137982
TEST=Tested on Asurada and Cherry
Change-Id: Ib0b6d91f64fe4e0af737594de976d5d5154e223d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3864630
Tested-by: Justin Green <greenjustin@google.com>
Commit-Queue: Justin Green <greenjustin@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Add YUY2 (DRM_FORMAT_YUYV) support for Mediatek platforms. Mediatek
devices support YUY2 hardware overlays, which we would like to exploit
to reduce video frame latency.
BUG=b:238137982
TEST=Tested with atomictest on Asurada
Change-Id: I42937956cb1017fea5f8997dd38d591a1b0b80b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3846866
Reviewed-by: Rob Clark <robdclark@chromium.org>
Tested-by: Justin Green <greenjustin@google.com>
Commit-Queue: Justin Green <greenjustin@google.com>
This is required for modern Android atop a gralloc with the cross_domain
backend or other native backend.
BUG=b:238609372
TEST=build and AHB cts
Change-Id: Id963eeec62c4400cc009384e127c93588c99346e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3777566
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
We only want camera preview use case to use the same padding as
BO_USE_HW_VIDEO_ENCODER. Previously we check this by BO_USE_SCANOUT
flag. This would cause some format issues in CTS drm tests. This patch
updates CL:3551188 to check for BO_USE_CAMERA_WRITE flag as well.
BUG=b:227983122
TEST=check camera is normal on kukui
TEST=android.media.cts.MediaDrmClearkeyTest#* pass on kukui
Change-Id: I1606b677678dfafc6331713f67d327a2b6030394
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3574581
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Reviewed-by: Miguel Casas <mcasas@google.com>
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Tested-by: Kazuhiro Inaba <kinaba@chromium.org>
Commit-Queue: Hsin-Yi Wang <hsinyi@chromium.org>
minigbm clients use the SCANOUT flag whenever they want the
minigbm-allocated buffers to be promoted to overlays. Mediatek doesn't
support YUV overlays, so remove the SCANOUT flag.
BUG=b:224698291
TEST=emerge on elm, emerge and deploy on kukui/jacuzzi
Change-Id: If3ee2fb925c7e729269c31caab991bb0bc56b0de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3555233
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Feels: Hsin-Yi Wang <hsinyi@chromium.org>
Auto-Submit: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Miguel Casas <mcasas@google.com>
Commit-Queue: Hsin-Yi Wang <hsinyi@chromium.org>
Since CL:3515652, preview under photo mode no longer uses hw video
encoder. This results in the wrong padding set in minigbm. Make camera
preview mode to use the original padding by detecting the
GRALLOC_USAGE_HW_COMPOSER (BO_USE_SCANOUT) flag.
BUG=b:224698291
TEST=check camera preview on krane
Change-Id: I299886a8f2106678f19ffff308331afec9627614
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3551188
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Auto-Submit: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Reviewed-by: Miguel Casas <mcasas@google.com>
Commit-Queue: Hsin-Yi Wang <hsinyi@chromium.org>
Video buffers are forced to use 64 alignment because of some nebulous
argument around better cache performance (b/35560932, it was mostly
about kevin and somehow hana got bundled in).
On Mediatek, however, video decoder and image processor use 16-
alignment (like macroblocks), forcing the use of the image processor
to reconcile these two, negating any performance/cache improvements.
This CL changes that to only use 64-alignment to non-YUV (hence,
video) quads, and this only for Hana.
BUG=b:220175010
TEST=video.DecodeAccel.* on hana
Change-Id: I48ee1beac29f915734830eda64705a2b4827a901
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3475099
Tested-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Tested-by: Miguel Casas <mcasas@google.com>
Reviewed-by: Fei Shao <fshao@chromium.org>
Reviewed-by: Miguel Casas <mcasas@google.com>
Commit-Queue: Miguel Casas <mcasas@google.com>
These are VIRGL_BIND_SAMPLER_VIEW compatible formats checked by vrend.
So virtgpu advertises texture support for them correspondingly. When it
comes to host gbm allocation, minigbm failed because of no support,
which breaks the api contract. Advertising them for mt8183 fixes it.
BUG=b:204633833
TEST=dEQP-VK.api.external.memory.android_hardware_buffer.*
Change-Id: I2429f2f5ac04b8193ac3505774deba224f464d92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3253838
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>