Commit graph

11 commits

Author SHA1 Message Date
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
dfe5ac6b58 gralloc: resolve format and use_flags at cros_gralloc_driver level
This simplify the separate resolving efforts in different gralloc
frontends (including separate logic in gralloc4 mapper and allocator).

BUG=b:199524294
TEST=CtsNativeHardwareTestCases

Change-Id: I74cd19df9b06c26a124e89c3367dd76b5b57dbd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3166893
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-09-17 13:47:55 +00:00
Yiwei Zhang
a12547b9f8 gralloc4: align the use_flag fallback logic with gralloc0
BUG=b:199524294
TEST=gralloc4 builds in aosp

Change-Id: I7cd5247d4768a108c4f7c6e2853229b030949a7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3163213
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>
2021-09-17 13:47:53 +00:00
Yiwei Zhang
61f9752a1c minigbm: refactor cros_gralloc_driver to be a singleton
Only a single cros_gralloc_driver instance is allowed to exist in a
process. However, currently when Gralloc3.0 or Gralloc4.0 is used, it's
possible for 2 independent driver instances to be created. This change
refactors cros_gralloc_driver to be a singleton and ensures the driver
initialization only happens once per process.

BUG=b:191895066
TEST=No regression of gralloc0 in ARCVM

Change-Id: I3cb8b7c3d13717cfe531b557b9d69b72efdbf3da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3002266
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-07-02 18:26:18 +00:00
Jason Macnak
3dc366e2eb cros_gralloc: Handle multiple instances of CrosGralloc4Mapper
... to respect

"The imported handle must be considered valid everywhere
in the process, including in another instance of the mapper."

Bug: b/179446728
Test: vts -m VtsHalGraphicsMapperV4_0Target
Test: Camera CTS with WIP change that used multiple mapper instances
Change-Id: Id4efe09ae782f04ad58630ee8360ab3592f4eb6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2679144
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
2021-02-06 23:36:04 +00:00
Jason Macnak
166fe14ab5 cros_gralloc: Handle failure to get prime fd
... in cros_gralloc_driver::allocate().

BUG=b:178495907
TEST=Cuttlefish CFI

Change-Id: Ibb9a5e55f2d2a4bf6be71f03dfe3f0fcd55a1b55
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2658929
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-02-03 04:22:39 +00:00
Gurchetan Singh
cadc54fe5d minigbm: consistent style
- 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>
2021-02-03 04:22:38 +00:00
Roman Stratiienko
142dd9c494 Always export DRM_FORMAT_YVU420_ANDROID as DRM_FORMAT_YVU420
Fixes video playback when gralloc0 and software video decoder are used.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I676060021806186bb3c23928d0d54af4add5120a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2589993
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-12-17 04:43:50 +00:00
Jason Macnak
16be5a74aa cros_gralloc: Fix PlaneLayout width/height metadata
... by using the horizontal/vertical subsampling of
each plane.

BUG=b:171019648
TEST=vts -m VtsHalGraphicsMapperV4_0TargetTest

Change-Id: I3eccfa1c0ac30394314c83b54ca50d690c679724
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2503481
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Auto-Submit: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
2020-10-28 14:01:26 +00:00
Gurchetan Singh
2d482e05f7 minigbm: cros_gralloc: simplify getting the drm format string
Can we do this.

BUG=none
TEST=compile

Change-Id: If9488038f1eb77b92e37d6daa99c8bea495315c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2451522
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-10-09 03:54:24 +00:00
Jason Macnak
2a77d942ae minigbm: Adds Gralloc 4 support
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>
2020-09-17 01:07:54 +00:00