The gbm_mesa cherry-pick series added a mediatek gralloc@4.0 service
definition but the corresponding init .rc file was missing from the
aosp/android-16.0_r3 branch. Create it from the msm template.
Copyright (C) 2026 Brendan Szymanski <hello@bscubed.dev>
This is needed for ARC-R container targets using arc-cros-gralloc.
Meanwhile, bump -std=c++14 to -std=c++17 for std::optional and others.
Bug: b/433317686
Test: chromium CI + android CI
Change-Id: Id9ed5f27f6788ca63d0bdb9566c54b3cd4030e16
Rather than use `clang-format` from $PATH (which changes between devs),
use `cros format` which has a pinned version for all people.
Add *.cpp to the include list as not all C++ files use *.cc.
Then run format on the files to fix latent issues.
BUG=None
TEST=./presubmit.sh
Change-Id: I28e167d454a7b089bb79e932b7265fa87e4c331f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/6475964
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Ryan Neph <ryanneph@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Bug: None
Test: lunch brya-trunk_staging-userdebug && m libminigbm_gralloc
Change-Id: I23022dbb536ade53951fe61014c5056e114f4bbc
Everything now builds under the same minigbm name for all platforms.
Bug: 388092228
Test: Boot corsola to desktop
Flag: EXEMPT: desktop-only change
Change-Id: I00708383151f832bcccec1aad8091f422dfcf2c3
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
Define vintf_fragments as modules if the file is shared among multiple
modules to avoid any conflicts.
Bug: 322089980
Test: aosp_cf_x86_64_phone build succeeded
Change-Id: I653ed96587445a3e0126b3eee415edce7b657939
... to pull in https://crrev.com/c/4897926.
Bug: b/300616292
Bug: b/300194143
Bug: b/294661992
Test: launch Cuttlefish, run SurfaceFlinger_test, inspect
tracing around lifetime of cros_gralloc_driver
Change-Id: I72c9164c2194af87bab0800fd821b4bc0934f245
... to ensure the lifetime of the underlying cros_gralloc_driver
matches those of the various Mapper* interfaces. Without this, the
the destruction of the static cros_gralloc_driver `s_instance`
could race with a potential CrosGralloc4Mapper user on another
thread which is still alive at the time of exit() (for example,
a buffer being cleaned up on a libhwbinder worker thread).
Bug: b/300616292
Bug: b/300194143
Bug: b/294661992
Test: launch Cuttlefish, run SurfaceFlinger_test, inspect
tracing around lifetime of cros_gralloc_driver
Change-Id: Id8e2dbff471c03f7b663952524905a06cc03fbc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4897926
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
... to not return address to a local stack variable.
Noticed by dustingreen@
Bug: b/287536665
Test: cvd start && vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: Iba486270a7ae3f8fbe50b41e3ea4c32aa0c4acad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4615434
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
Blob formats (aka buffers) get represented as R8 textures with height
of one and width==size. These have no particular stride requirement,
even though the host might ask for a pitch that would make sense for
a 2D R8 texture with height greater than one.
Relax the validateBufferSize check for format_blob rather than set the
stride. As blob defined: buffers of this format must have a height of
1, so height doesn't need to be checked specifically.
BUG=b:269565421
TEST=CQ
Change-Id: I7a8d4dbf292330df0c24b502abd9dbf3dceac728
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4263402
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
The getter already worked, it just wasn't listed as such.
Also drop claiming SMPTE2094_40 support on IMapper5, since
it's always a no-op and only conceptually makes sense
if the setter exists (wording on the spec will be changed
to reflect this)
Test: atest VtsHalGraphicsMapperStableC_TargetTest
Change-Id: I4ee93927edc11fda6bd3983caaabf8b281c080ab
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>
... to pull in https://crrev.com/c/3563512 to avoid trying to use
dmabuf heap allocator when dmabuf system heap is not available.
Bug: b/227375257
Test: cvd start
Test: vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: I2de7d0b8e6a898fa34333ade9204929342268659
... otherwise a buffer would be leaked if `mDriver->allocate()`
succeeds but `initializeMetadata()` fails as the error handling
in the multi-buffer `CrosGralloc4Allocate::allocate()` would
fail to `mDriver->release();`.
BUG=b:219757060
TEST=cvd start
TEST=vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: I375da2c959dd9df2667503a040ed1dcbd2aa12b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3501132
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
... to pull in support for `gralloc->set(<metadata>)` for Cuttlefish
from https://crrev.com/c/3421048 and the related changes in the chain.
Bug: b/219757060
Test: cvd start
Test: cts dEQP-VK.api.external.memory.android_hardware_buffer.*
Test: vts -m VtsHalGraphicsMapperV4_0Target
Test: cvd start --gpu_mode=gfxstream
Test: cts dEQP-VK.api.external.memory.android_hardware_buffer.*
Test: vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: I541d479da3b208c25666fcc50f89c790c361f1f6
... by reserving the first section in the shared memory
reserved region for a new CrosGralloc4Metadata struct.
BUG=b:207388558
TEST=cvd start
TEST=vts -m VtsHalGraphicsMapperV4_0Target
TEST=cvd start --gpu_mode=gfxstream
TEST=vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: I7c59196ca747dc0fe854cdb4cbbcd21dd82e1401
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3421048
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
... to support upcoming change where CrosGralloc4Mapper's
get(<metadata>) will want to access metadata that may be
in either the buffer's handle or the buffer's reserved
region. The for-each-[handle|buffer] methods support
dumpBuffers() where we need to iterate over all of the
buffers while holding a lock on the cros_gralloc_driver's
mutex.
BUG=b:207388558
TEST=cvd start
TEST=vts -m VtsHalGraphicsMapperV4_0Target
TEST=cvd start --gpu_mode=gfxstream
TEST=vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: I674cab487d7446af722f94d796f504cf4f97de27
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3433121
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
... to make it easier handle ownership (no more conditional
ownership if the buffer was allocated versus imported).
This also helps avoid a deadlock in CrosGralloc4Mapper's
dumpBuffers() in an upcoming change where CrosGralloc4Mapper
wants to interact with both metadata in the handle and
metadata in the cros_gralloc_buffer's reserved region. By
having the cros_gralloc_buffer always have a handle, the
CrosGralloc4Mapper can have access to all metadata when it
has a cros_gralloc_buffer parameter.
BUG=b:207388558
TEST=cvd start
TEST=vts -m VtsHalGraphicsMapperV4_0Target
TEST=cvd start --gpu_mode=gfxstream
TEST=vts -m VtsHalGraphicsMapperV4_0Target
Change-Id: I56fffbbfacf8436db165a961bec8ce546b4acc6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3433118
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: 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>
Update minigbm in AOSP
* aosp/upstream-main:
minigbm: msm: Allow for build-time method to disable DRM_FORMAT_MOD_QCOM_COMPRESSED on NV12
dumb_driver: should be rgb565
minigbm: Support bo_create_with_modifiers in the dumb driver
gralloc: Fix plane layout for RGB565
gralloc: Add comment about HAL_PIXEL_FORMAT_RGB_565 component order
gralloc: Fix a HAL_PIXEL_FORMAT to DRM_FORMAT mapping
i915: prevent pre-gen9 from using tile modifiers with AR24
minigbm: Remove stride alignment to power of two on ADL-P
minigbm_helper: close the opened dir
amdgpu: Use bo_release to free DRI images.
drv: Add new bo_release driver callback.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I4404c8d2e6d7e4de37c89e08a6e0e43c9cf9cc03
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>
It's possible to switch its backend from virtgpu_virgl to another
one later. b/195673105#comment33
Bug: 195673105
Test: mma
Change-Id: I32396118fe20e220604ad36893e9a6c690e9fd4f
... to update Minigbm for Cuttlefish to pull in https://crrev.com/c/3208931
to restrict 2D allocs to max supported SwiftShader size.
Bug: b/194426249
Test: `cts -m CtsNativeHardwareTestCases` with aosp/1845813
Change-Id: I9f538e48a72ec699617b9e653812f2b785c5e39a
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>
... to update Minigbm for Cuttlefish to pull in clean ups for
supported combinations and to pull in restricting 2D allocs to
max supported SwiftShader/llvmpipe size.
Bug: b/201325625
Bug: b/194426249
Test: launch_cvd --gpu_mode=guest_swiftshader
Test: launch_cvd --gpu_mode=gfxstream
Change-Id: I11c71b95987cedbb27515e85559e00c5df8c0dd9
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>