In fact, the resolved format is always DRM_FORMAT_YVU420_ANDROID at
gralloc frontend upon metadata query.
DRM_FORMAT_YVU420 is only returned upon filling fourcc in native handle.
Do the fix anyway for sanity and prepare for later code cleanup.
TEST=build
Change-Id: I4c9a96d317bb458cf715364f68f1a0daead1a077
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3789650
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
The format DRM_FORMAT_XBGR8888 playe layout should be aligned with linux DRM
driver definition.
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
Change-Id: I8f8b025a99a7503eb27eda96bcbdf3373b011a8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3414504
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
DRM and pixel formats have the order flipped.
HAL_PIXEL_FORMAT_RGB_888 -> DRM_FORMAT_BGR888
BUG=b:191096118
TEST=CtsNativeHardwareTestCases on Cuttlefish
Change-Id: I88315730075b6289463963a9c9071bd4f089447e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3291554
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
Reordered the cases to align with actual enum value for the hal formats,
and added 3 more formats support to align with gralloc4 support:
1. Y8
2. Y16
3. YCBCR_P010
BUG=b:199524294
TEST=CtsNativeHardwareTestCases
TEST=gralloc4 builds in aosp
Change-Id: I7a6743524c024d46ab2a7a6d973f431ea2721c49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3160131
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
The current gralloc0 specific usage conversion is already a superset.
This change also fixes a misalignment on video encoder mapping due to
the original fix missing to hit gralloc4.
BUG=b:199524294
TEST=CtsNativeHardwareTestCases
TEST=gralloc4 builds on aosp
Change-Id: Ib1e37ba09deb50b754863b261423e201ab6b4910
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3166892
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
VK_ANDROID_external_memory_android_hardware_buffer spec requires gralloc
to support AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER. This patch adds a new
BO_USE_GPU_DATA_BUFFER flag accordingly and maps the new flag to
VIRGL_BIND_LINEAR, which aligns with the workarounds carried by existing
implementations as well as still going through the blob resource path to
be correctly mappable at the guest side.
BUG=b:191591725
TEST=AHardwareBuffer_allocate with AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER
TEST=CtsNativeHardwareTestCases
TEST=dEQP-VK.api.external.memory.android_hardware_buffer.*
Change-Id: Ib0d9b1cb90e3b7ff614d556954b6abb9018c92a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2974800
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
- Sometimes were return -1 and sometimes -errno. Prefer -errno
wherever possible.
- No braces for single line if/else statements. This does not
apply gralloc3/gralloc4, since that directory follows AOSP
style.
BUG=b:178495907
TEST=Cuttlefish CFI
Change-Id: I4c35768e015109730772a972b4b18e8d2c3cbb9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2665001
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
This should be fine since the dummy fd was never used
with the encoder / decoders, so it doesn't need to be
tiled.
BUG=b/171018855
TEST=GtsExoPlayerTestCases / GtsMediaTestCases
Change-Id: I1309a641e19a9196e0aed05f4820e0d2672fafa0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2481223
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
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>
Implements the Allocator 4.0 and Mapper 4.0 interfaces.
Some notable features of the 4.0 interface:
- buffer metadata getter/setters
- buffer flushing
- buffer debugging (buffer listing and buffer id)
BUG=b:161909468
TEST=build and launch Cuttlefish with Gralloc4
Change-Id: I63bdc76604207e1fcfe0135c9b64fa62bfba5b27
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2404601
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>