Commit graph

103 commits

Author SHA1 Message Date
Yiwei Zhang
0495473b90 minigbm: deprecate drv_log to favor log level
TEST=build

Change-Id: I3f0021bfd05eb1ab7c3b35ae2f31d806bc0a58dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3761446
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
2022-07-19 04:16:15 +00:00
Hsin-Yi Wang
2581c470d6 minigbm: mediatek: check BO_USE_CAMERA_WRITE flag on camera preview case
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>
2022-04-08 09:24:14 +00:00
Hsin-Yi Wang
d4df3d57eb minigbm: mediatek: remove USE_SCANOUT in yuv format
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>
2022-04-02 09:27:02 +00:00
Hsin-Yi Wang
c37de98240 minigbm: mediatek: use the HW_VIDEO_ENCODE padding for camera preview
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>
2022-03-31 11:34:43 +00:00
Miguel Casas
35fd7d23bb mediatek.c: Don't use 64-stride alignment for video on 8173 (hana)
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>
2022-02-23 17:13:37 +00:00
Hsin-Yi Wang
8fe9f19018 minigbm/mediatek: allocate NV12 video buffers for MT8186
BUG=b:214886582
TEST=emerge-corsola minigbm

Change-Id: Ic1f4e153c4c32050de86abe8827ad5f246f7fd3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3398070
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>
2022-01-25 04:36:56 +00:00
Yiwei Zhang
f4c1725d38 mediatek: support fp16 and 10bit rgba formats
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>
2021-11-02 06:05:03 +00:00
Yiwei Zhang
3a171db9be gralloc: move the logic to strip BO_USE_HW_VIDEO_ENCODER to the backends
BUG=b:199524294
TEST=CQ

Change-Id: I2b36a0ef17cd6ecb77723d4a9d95196ad27ff4ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3200148
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Chia-I Wu <olv@google.com>
2021-10-05 11:05:13 +00:00
Yiwei Zhang
b3caf22272 mediatek: strip scanout on resolved YVU420 format
If the FLEX_YCbCr_420_888 format gets resolved into YVU420, the backend
must strip scanout to satisfy the format support.

BUG=b:201686603
TEST=gralloctest alloc_combinations

Change-Id: I9206cb4d695b9a7eb052d2bbf2ea1032d706abb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3198681
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-10-05 03:43:19 +00:00
Yiwei Zhang
b8ad7b88ca minigbm: refactor to add unified resolve_format_and_use_flags helper
It makes more sense to resovle the format and use_flags together to
avoid duplicates.

Add the helper to vc4 and dumb_driver backends since that's missed
from prior frontend refactoring.

Split the resolve helper in virtgpu_virgl for the 3d and 2d paths to
make code logic cleaner.

BUG=b:199524294
TEST=CQ

Change-Id: I89b633ea484f0fc5bb9b4e0548cad017b9970cc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3200143
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Chia-I Wu <olv@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-10-05 03:43:18 +00:00
Yiwei Zhang
b7a64441ef minigbm: refactor driver helpers
1. frontends access the driver via drv.h only
2. the renamed drv_helpers and drv_array_helpers are for driver only
3. remove extern "C" from drv_helpers.h given not exposed to gralloc
4. remove all redundant includes for those helpers

BUG=b:199524294
TEST=CQ and gralloc builds on aosp

Change-Id: I3f4d33076a6a8161804f1b7c26950ff5496507e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3195651
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-10-01 18:35:11 +00:00
Yiwei Zhang
afdf87dcd4 minigbm: add more error handling especially for oom
This change also fixes a potential prime_fd leak in mediatek backend.

BUG=b:201110412
TEST=CQ

Change-Id: Ia3e10c94b536f83ecfb6580666103fe654bbc616
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3188852
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
2021-09-29 07:08:22 +00:00
Yiwei Zhang
c1413ea43a minigbm: conditionally fallback to strip scanout use_flag
Only 2d virtgpu backend needs to fallback here because virtio primary
plane only allows DRM_FORMAT_XRGB8888.

Most our platforms cannot display YV12 (except msm), thus the fallback
is required for the converted DRM_FORMAT_YVU420_ANDROID. For virgl
backend, additionally append a BO_USE_LINEAR as a replacement for the
hack inside compute_virgl_bind_flags.

BUG=b:199524294
TEST=CQ
TEST=gralloctest alloc_combinations
TEST=android.media.cts.VideoDecoderRotationTest

Change-Id: Ic87838ea2aae2b0abf87ed898ad75a3d7e556471
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3166775
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-09-22 19:47:06 +00:00
Yiwei Zhang
9f390d92a4 minigbm: remove redundant drv param in resolve_format
BUG=b:199524294
TEST=build

Change-Id: I53eaa20847afc6e80ae957b746248468420c30b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3174312
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-09-22 19:47:05 +00:00
Fei Shao
1f70a6be8c Revert "minigbm: mediatek: Conditionally resolve DRM_FORMAT_BGR888 to DRM_FORMAT_XBGR8888"
This reverts commit bfd4b0a3ab.

Reason for revert: This breaks CTS: b:196768393

Original change's description:
> minigbm: mediatek: Conditionally resolve DRM_FORMAT_BGR888 to DRM_FORMAT_XBGR8888
>
> Since the original DRM_FORMAT_BGR888 format did not support
> BO_USE_RENDERING or BO_USE_TEXTURE flag and Chromium doesn't
> support 24-bit RGB format, resolve the DRM_FORMAT_BGR888
> to DRM_FORMAT_XBGR8888 to solve the problem.
>
> BUG=b:191096118
> TEST=deploy vendor image and open "My Talking Tom 2" app
>
> Signed-off-by: Nick Fan <Nick.Fan@mediatek.com>
> Change-Id: Ibfc76b3790045731c95f1cd387e67ecc5d775e0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2976161
> Reviewed-by: Nick Fan <nick.fan@mediatek.corp-partner.google.com>
> Reviewed-by: Fei Shao <fshao@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Tested-by: Nick Fan <nick.fan@mediatek.corp-partner.google.com>
> Commit-Queue: Fei Shao <fshao@chromium.org>

Bug=b:191096118,b:196768393

Change-Id: I049e41c0885863fd514c43e56705382779b3daa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3097252
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Tested-by: Fei Shao <fshao@chromium.org>
Auto-Submit: Fei Shao <fshao@chromium.org>
Reviewed-by: Shawn Ku <shawnku@chromium.org>
Commit-Queue: Kazuhiro Inaba <kinaba@chromium.org>
2021-08-18 01:48:32 +00:00
Nick Fan
bfd4b0a3ab minigbm: mediatek: Conditionally resolve DRM_FORMAT_BGR888 to DRM_FORMAT_XBGR8888
Since the original DRM_FORMAT_BGR888 format did not support
BO_USE_RENDERING or BO_USE_TEXTURE flag and Chromium doesn't
support 24-bit RGB format, resolve the DRM_FORMAT_BGR888
to DRM_FORMAT_XBGR8888 to solve the problem.

BUG=b:191096118
TEST=deploy vendor image and open "My Talking Tom 2" app

Signed-off-by: Nick Fan <Nick.Fan@mediatek.com>
Change-Id: Ibfc76b3790045731c95f1cd387e67ecc5d775e0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2976161
Reviewed-by: Nick Fan <nick.fan@mediatek.corp-partner.google.com>
Reviewed-by: Fei Shao <fshao@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Nick Fan <nick.fan@mediatek.corp-partner.google.com>
Commit-Queue: Fei Shao <fshao@chromium.org>
2021-08-13 06:30:40 +00:00
Tzung-Bi Shih
d661228b91 minigbm/mediatek: allocate NV12 video buffers for MT8195
BUG=b:189277882
TEST=emerge-cherry minigbm

Cq-Depend: chromium:2918035
Change-Id: I135e1f9ad0c7a5ea21f09b1179e739ba8b8af07b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2916706
Tested-by: Tzung-Bi Shih <tzungbi@chromium.org>
Auto-Submit: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Commit-Queue: Tzung-Bi Shih <tzungbi@chromium.org>
2021-05-27 15:05:05 +00:00
Alexandre Courbot
f9c7aa4036 minigbm/mediatek: allocate NV12 video buffers for MT8192
90a0c88636 "minigbm/mediatek: Allocate NV12 video buffers for MT8192"
added NV12 to the list of supported formats, but forgot to return it
when needed. Fix this.

BUG=b:167469726
BUG=b:184014873
TEST=ARC++ on Asurada allocates NV12 video buffers.

Change-Id: I5182949f39a44d7a1dd7b1f118b300ac0f56559a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2823624
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
2021-04-15 17:58:46 +00:00
Fritz Koenig
90a0c88636 minigbm/mediatek: Allocate NV12 video buffers for MT8192
MT8192 v4l2 decodes into nv12

BUG=b:167469726
TEST=video_decode_accelerator_tests get the buffers needed

Change-Id: I03fd52c26a3f09d5e4e75e92fd3eb4e55dc2d987
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2524254
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-11-09 23:36:45 +00:00
Gurchetan Singh
bbba9dde65 minigbm: stop faking the protected buffers
With real HW protection on the horizon, let's repurpose the
protection flag to mean that.

Currently, our protected buffer scheme on the Android side
allocates a dummy fd, which is sent to Chrome.  Chrome
associates that dummy fd with an unmappable shared memory
buffer.  In the entire process, minigbm doesn't really do
anything.

We prevent buffers allocated with the protected
flag from being mapped, but since it's a dummy fd it's not
really useful.

Chrome doesn't use the protected flag yet, but hopefully will
so in the future, but with real HW protection.

BUG=
TEST=

Change-Id: I57be26926539471f062ffeff33b523a3899c35f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2466958
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-10-14 04:32:55 +00:00
Gurchetan Singh
9964438dbb minigbm: reduce use of memset
Also run presubmit.sh.

BUG=none
TEST=compile

Change-Id: I6f5d2afca41c4228a4f8eb40f3670b39bce7b641
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2459529
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-10-12 21:56:58 +00:00
Wei Lee
2f02cfbe44 minigbm: Use NV12 for video decoder on MT8183 only
To unblock the HALv3 camera migration for MT8173 platform, we changed to
use NV12 for camera read/write, video hw encoder/decoder for
DRM_FORMAT_FLEX_YCbCr_420_888 format on MT8173 in crrev.com/c/2317328.

However, it broke V4L2 VDA since it does not support NV12, as per
b:162698479.

Since camera will not use video decoder actually, change MT8173
back to use YVU420 for video decoder.

BUG=b:162698479
TEST=tast run [DUT] arc.VideoDecodeAccel.h264

Change-Id: Iee83ab0184541b24ecc9e4fb07138c09228e5440
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2336352
Tested-by: Wei Lee <wtlee@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Wei Lee <wtlee@chromium.org>
Auto-Submit: Wei Lee <wtlee@chromium.org>
2020-08-13 03:13:55 +00:00
Wei Lee
e03625b24b minigbm: Enable NV12 for camera usage on MT8173
BUG=b:141517606
TEST=tast run [DUT] camera.CCAUI* camera.HAL3*
TEST=Run CtsCameraTestCases

Change-Id: I908f4a9896e716f460325abb741ace4ee8547ad7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2317328
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Wei Lee <wtlee@chromium.org>
Tested-by: Wei Lee <wtlee@chromium.org>
2020-07-29 03:06:39 +00:00
Hirokazu Honda
3bd681c62c Modify NV12 allowed buffer usages for camera capture use case
We use SCANOUT_VEA_READ_CAMERA_AND_CPU_READ_WRITE for camera
capture use scenario in Chrome. Therefore, NV12 format must be
allowed for all those usage masks. This CL modifies the usages on
all platforms.

BUG=chromium:982201
TEST=video.EncodeAccel.vp8_720p_i420 on eve

Change-Id: I7880e64049f3bbf9dd1c177619e41362baf641f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2240995
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2020-06-25 14:17:05 +00:00
Hirokazu Honda
fd8b8abd7f Remove HW_VIDEO_ENCODER usage of YVU420
minigbm has allowed HW_VIDEO_ENCODER usage to YVU420 so that
chrome can allocate YVU420 with HW_VIDEO_ENCODER. But this
format is no longer allocated by chrome with the usage. Let's
delete the code.

BUG=chromium:982201
TEST=None

Change-Id: Ia6bbc24e7782e3e73c2eb00c00127af212ddf486
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2245967
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
2020-06-18 06:10:36 +00:00
David Stevens
495181462f minigbm: add encoder/decoder blob combination
ARCVM sets encoder/decoder usage on the blob output/input buffers, so
that virtio_gpu knows to perform transfers from/to the host where
appropriate. Recently, virtio_gpu started passing all bind flags to the
host, instead of reducing them in the guest. These factors combined
means that the host backends now need to support encoder/decoder usage
with R8 format.

Test: manually verify ARCVM YouTube
Bug: b:158957350
Change-Id: I58bf657496647f8002c693d17a1186f4cf527b01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2245540
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-06-16 07:27:24 +00:00
Gurchetan Singh
1914f98941 minigbm: mediatek: fix SCANOUT flag
All renderer target works are eligible for scanout, after looking
at mtk_plane_init.

BUG=b:151064316
TEST=Mirror mode works again on Kukui

Change-Id: Ife8948c167c1d75622404af573f8cc92b3516416
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2118463
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-03-26 21:48:43 +00:00
David Stevens
ddb56b5eac mediatek: get prime fd with drv_bo_get_plane_fd
Instead of calling drmPrimeHandleToFD directly, call drv_bo_get_plane_fd
so that the FD is exported with DRM_RDWR if possible.

When a handle is exported, the drm framework caches the underlying
dma_buf struct, even if all fd references are closed. This means that
the flags from the first export operation end up being the primary flags
for all subsequent export attempts. This change ensures that the O_RDWR
flag is set on the first call, to prevent permission checks in
PlatformSharedMemoryRegion from failing.

BUG=b:151394062
TEST=youtube on arcvm on kukui

Change-Id: I9de7bb67b45b3669704f3487889b10ed62493418
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2101054
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-03-16 05:55:18 +00:00
Moja Hsu
059ac08b0b mediatek: Align height to 16 bytes for NV12
We want to use the same buffer from camera to JPEG hardware encoder so
align the height of camera usage buffer 16 that is required by the JPEG
hardware encoder.

BUG=b:141516308
TEST=Check if data offset is correct. Take picture with CCA.

Change-Id: I0db10762494423f7c4a340725015839803b40af4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1984211
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Hsu Wei-Cheng <mojahsu@chromium.org>
Commit-Queue: Hsu Wei-Cheng <mojahsu@chromium.org>
2020-01-08 04:44:25 +00:00
Hirokazu Honda
2a2bfc25bb mediatek: Allocate a buffer expected by encoder if BO_USE_HW_VIDEO_ENCODER
MediaTek driver expects 16 aligned width and 32 aligned height for an input
buffer on encoding [1]. Besides, there is an extra data between planes.
This changes the minigbm allocation to match the expectation though width
is aligned by 64 for the AMD cache-width optimization.

[1] https://chromium.googlesource.com/chromiumos/third_party/kernel/+/3c551224d8600b956ed53097520501d58f31cf59/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c#278
BUG=b:144135251
TEST=ARC++ encoder on kukui
Change-Id: Id330a8a6b0a40040098920427e6e29f05fcb64d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1855520
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Commit-Queue: Hsu Wei-Cheng <mojahsu@chromium.org>
2019-12-25 08:26:11 +00:00
Jasmine Chen
c7aa974dd3 Add MediaTek private format for reprocessing
In this CL, we add DRM_FORMAT_MTISP_SXYZW10, a 10-bit private bayer
format for private reprocessing on MediaTek ISP P1. We change the logic
around resolving the DRM format for IMPLEMENTATION_DEFINED buffers. When
CAMERA_READ usage flag is present, we consider it to be a buffer for
reprocessing and resolve the format to our private format.

BUG=b:130851309
TEST=Emerge and deploy minigbm cros-camera-libcbm cros-camera
cros-camera-hal-mtk, then verify that ZSL is working.

Change-Id: I8d9fd4e6a20c284751915e136bef0b4ceb143d78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1753902
Tested-by: Jasmine Chen <lnishan@google.com>
Auto-Submit: Jasmine Chen <lnishan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Jasmine Chen <lnishan@google.com>
2019-12-05 07:56:40 +00:00
Hirokazu Honda
b6c4cf7b91 Revert "Enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage"
This reverts commit aa6b072d4c.

Reason for revert: This change is unnecessary because HW_VIDEO_ENCODER
usage is unmasked in crrev.com/c/1940034.

Original change's description:
> Enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage
>
> crrev.com/c/1904910 masks the HW_VIDEO_ENCODER usage when
> BO_USE_HW_VIDEO_ENCODER is specified in gralloc. A camera stack allocates
> XBGR8888 buffer with BO_USE_HW_VIDEO_ENCODER usage in ARC++ video
> recording if the camera HAL version is V1. Thanks to crrev.com/c/1904910,
> it is necessary to enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage.
>
> BUG=b:144135251
> TEST=Recording with GCA
>
> Change-Id: I61beee87a1531c0dea371861ffb31ce2189ef854
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1934068
> Tested-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
> Commit-Queue: Hirokazu Honda <hiroh@chromium.org>

Bug: b:144135251
Cq-Depend: chromium:1940034
Change-Id: I8d64c97399a601487fc84a6ecae337c235bd4464
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1947685
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2019-12-04 11:50:39 +00:00
Hirokazu Honda
aa6b072d4c Enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage
crrev.com/c/1904910 masks the HW_VIDEO_ENCODER usage when
BO_USE_HW_VIDEO_ENCODER is specified in gralloc. A camera stack allocates
XBGR8888 buffer with BO_USE_HW_VIDEO_ENCODER usage in ARC++ video
recording if the camera HAL version is V1. Thanks to crrev.com/c/1904910,
it is necessary to enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage.

BUG=b:144135251
TEST=Recording with GCA

Change-Id: I61beee87a1531c0dea371861ffb31ce2189ef854
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1934068
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2019-11-27 10:37:55 +00:00
Gurchetan Singh
8312ec228d minigbm: rockchip/mediatek: add PROTECTED flag back in
crrev.com/c/1643677 removed it, so we should add it back in.

BUG=b:141347335
TEST=GtsExoPlayerTestCases/GtsMediaTestCases

Change-Id: Ic49bd4158349da6170e8435c5c516954fe1646fa
Reviewed-on: https://chromium-review.googlesource.com/1821693
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Ready: Kazuhiro Inaba <kinaba@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-10-10 16:38:19 -07:00
Alexandre Courbot
6ad6382539 mediatek: provide NV12 buffers for video decoding for MT8183
crrev.com/c/1767450 changed the default android flexible buffer format
back to YV12, but the video decoding scenario on MT8183 requires NV12
buffers. Add an exception for this case.

BUG=b:141732718
TEST=Play H.264 video with acceleration using both Chrome and Android's
Youtube.

Change-Id: Ie4b80389b22650450ea45f5cdea36a00360899a9
Reviewed-on: https://chromium-review.googlesource.com/1833362
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-10-02 05:23:07 -07:00
Ricky Liang
86e72a439a mediatek: Fix the metadata for R8
The R8 format should be configured with LINEAR_METADATA.

BUG=b:141328294
TEST=manually on Kukui

Change-Id: I612e78d28b63960428a6dce04104c3266b124a23
Reviewed-on: https://chromium-review.googlesource.com/1816204
Tested-by: Ricky Liang <jcliang@chromium.org>
Commit-Ready: Ricky Liang <jcliang@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2019-09-25 10:43:09 -07:00
Gurchetan Singh
298b757913 minigbm: factor out metadata from struct bo
Generated using coccinelle:

@@
struct bo *B;
@@

- B->width
+ B->width

BUG=chromium:924405
TEST=compile

Change-Id: I4da1731a650d198ce7f2bda3031a47b2f9c3041c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1815566
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
2019-09-24 17:23:42 +00:00
Gurchetan Singh
dc9b120451 minigbm: rockchip/mediatek: remove R8 as texture source on Mali/Bifrost
EGL can't import this format on Mali/Bifrost.

BUG=chromium:969044
TEST=Ozone unit test

Change-Id: I356ec2bd35030af600b268bf39565e30e16465f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1643677
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
2019-09-19 16:59:17 +00:00
Nicolas Boichat
d7c83386cc mediatek/rockchip: Use PRIu64 to print uint64_t variables
Required to build for arm64 on mediatek, and let's fix the
rockchip one, while we're at it.

BUG=b:140228960
TEST=emerge-kevin-arc64 -av arc-cros-gralloc
TEST=emerge-kukui -av arc-cros-gralloc (with ARC++ 64-bit)

Change-Id: I8e04355a4d247b44ac86963331be72495655d321
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1775949
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Auto-Submit: Nicolas Boichat <drinkcat@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
2019-09-02 00:19:31 +00:00
Hirokazu Honda
3d856025f8 mediatek: Change android flexible format to allocate YVU420 buffer
crrev.com/c/1716864 made gralloc allocae NV12 buffer with the android flexible
format, DRM_FORMAT_FLEX_YCbCr_420_888. However, the change broke many CTS tests.
This partially reverts the commit. The allocated buffer fromat becomes YVU420.

BUG=chromium:987185
BUG=b:139714614
Cq-Depend: chromium:1767680
Change-Id: I9fcde88cff79fac2655fb627418b371b314077c1
Reviewed-on: https://chromium-review.googlesource.com/1767450
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Ready: Hirokazu Honda <hiroh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2019-08-25 01:10:35 -07:00
Hirokazu Honda
3b8d4d0c83 Add GBM_BO_USE_HW_VIDEO_ENCODER use flag
Chrome needs to allocate a linear buffer that a hardware video encoder can read
and cpu can read and write. There is no use flag in gbm that specifies the
former. This CL introduces a new use flag for that.

BUG=b:138703716
TEST=None

Change-Id: Ied0321914a366294a47e4fc5c2a8f08ee0351bd8
Reviewed-on: https://chromium-review.googlesource.com/1728729
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-08-16 12:40:30 -07:00
Hirokazu Honda
0f0ce6ffc9 mediatek: Add NV12 format for output frame in HW decoder
YV12 have been a pixel format of output frame in HW decoder on MediaTek device.
Since all other platforms uses NV12 for the format, it is good to change the
format to NV12 on MediaTek as well. So we can only think about NV12 for a pixel
format in HW decoder.

BUG=chromium:987185
TEST=video_decode_accelerator_tests
TEST=Play video with Chrome
Cq-Depend:chromium:1716844
Change-Id: Ic7e4f66d503247bdeba9cb66c8a598b233ed6df9
Reviewed-on: https://chromium-review.googlesource.com/1716864
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-08-14 16:24:41 -07:00
Gurchetan Singh
0d44d48d52 minigbm: modify resolve format hooks a bit
Plumb the driver backend to the resolve format hook.

BUG=b:132939420
TEST=compile

Change-Id: I3ac10f5c986bc5dae5b34cd70654676d4ad289ea
Reviewed-on: https://chromium-review.googlesource.com/1645879
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
2019-07-03 02:02:15 -07:00
Gurchetan Singh
39490e9e3f minigbm: run presubmit.sh and add OWNERS file
This now apparently is required.

Change-Id: I28b19684d207aad50493974dc71d8249bc82ca21
Reviewed-on: https://chromium-review.googlesource.com/1633452
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2019-05-30 22:02:07 -07:00
Nick Fan
01c40149a2 minigbm: Add formats support for MT8183 camera
Add NV21, YUYV and YVU420 formats support for MT8183 camera
Use config to seperate modification only for MT8183

BUG=b:109911488
TEST=emerge-kukui minigbm

Change-Id: I7201b89de3fa062f96cd69e4b91a2a4b434c738e
Signed-off-by: Nick Fan <Nick.Fan@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/1267857
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Nick Fan <nick.fan@mediatek.corp-partner.google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-05-09 16:05:56 -07:00
Fritz Koenig
1b9b5b93fd minigbm: mediatek: Implement bo_create_with_modifiers
Mediatek MT8183 only supports DRM_FORMAT_MOD_LINEAR.

BUG=b:123042223, b:129645475
TEST=null_platform_test -m DRM_FORMAT_MOD_LINEAR

Change-Id: I1938e52a9b221f25b62ddd27916a2222be8c0a46
Reviewed-on: https://chromium-review.googlesource.com/1529226
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-04-02 11:09:54 -07:00
Stéphane Marchesin
6ac299f3d3 minigbm: Fix consistency in return values
minigbm functions don't use errno; however drmIoctl does. So we need
to return -errno instead of returning exactly what drmIoctl returns.

BUG=none
TEST=builds

Change-Id: I20e00141782ac1407133ee72259fe43381954d26
Reviewed-on: https://chromium-review.googlesource.com/1534878
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-03-26 04:43:19 -07:00
Gurchetan Singh
71bc665179 minigbm: don't advertise BGR24 as a render/texture target
Mesa drivers can't use it, in general.

I'm leaving in Rockchip since I haven't gotten any reports
about this test failing on kevin-arcnext.

Fixes: abe44f ("minigbm: add support for BG24")

BUG=b:77876551, b:115564746
TEST=The following tests should pass on Eve/Grunt arc-next:

  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuColorOutputAndSampledImage_R8G8B8_UNORM
  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuColorOutputCpuRead_R8G8B8_UNORM
  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuColorOutputIsRenderable_R8G8B8_UNORM
  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuSampledImageCanBeSampled_R8G8B8_UNORM

Change-Id: Ic7aec07c89fdc21e0c8392238e833f7980062049
Reviewed-on: https://chromium-review.googlesource.com/1229439
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2018-09-21 03:38:13 -07:00
Luigi Santivetti
a72f442309 minigbm: mediatek: always provide munmap() with a valid address
Before this change, a NULL pointer could have been passed to munmap(),
making impossible for it to unmap previoulsy mapped memory. After this
change, munmap() always receives a valid pointer.

BUG=b:71835379 b:114699642
TEST=adb shell "am instrument -w --abi armeabi-v7a -e class\
 android.uirendering.cts.testclasses.InfrastructureTests#testScreenshot\
 android.uirendering.cts/android.support.test.runner.AndroidJUnitRunner"

Change-Id: Ic1b15807623209ab28d0d4ed63fe0d6ef2dcc6f8
Signed-off-by: Luigi Santivetti <luigi.santivetti@imagination.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1221667
Commit-Ready: Kazuhiro Inaba <kinaba@chromium.org>
Tested-by: Pin-chih Lin <johnylin@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-09-14 12:08:48 -07:00
Luigi Santivetti
500928fd3a minigbm: mediatek: wait for outstanding operations when invalidating
Without doing this it's possible for the CPU to access the memory when it's
in use by another device.

TEST=adb shell "am instrument -w --abi armeabi-v7a -e class\
 android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromPersistentSurfaceToSurfaceQCIF\
 android.media.cts/android.support.test.runner.AndroidJUnitRunner"
BUG=b:71835379

Change-Id: I3b1508a0eab3b020b7c42978cb1e1099ebc029fd
Signed-off-by: Luigi Santivetti <luigi.santivetti@imagination.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1193302
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-08-31 23:42:53 -07:00