Commit graph

90 commits

Author SHA1 Message Date
Roman Stratiienko
4f7758ffa1 minigbm: Use dmabuf inode as unique buffer id instead of handle
Handle has some limits and can't be used as unique buffer ID on systems
where display controller can scanout from CMA but GPU can work with both
CMA and VRAM.

Such systems have DRM/KMS and DRM/GPU drivers separated.
GBM frontend is always expecting handle for DRM/KMS driver.
In such system any attempt of importing the buffer with more
than 1 contiguous chunk into DRM/KMS driver will fail.

Using dma-buf inode as unique buffer ID is a common practice for
a last several years starting from [this kernel patch][1].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ed63bb1d1f8469586006a9ca63c42344401aa2ab
Change-Id: Ic3a69010d5da2f866a2252fc7e9eb29d67f8e1ed
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2026-07-16 00:53:22 -04:00
Roman Stratiienko
446588514a minigbm: Add drv_bo_get_pixel_stride function
Some drivers may copy/convert the buffer during mapping and
in some cases stride of copied image can be different from
original. Android uses pixel_stride for CPU access and need
map_time stride instead of original stride in this cases.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2026-07-15 22:36:25 -04:00
Jason Macnak
8956e04c7f Revert^2 "Merge remote-tracking branch 'aosp/upstream-main'"
8a3215bf53

Change-Id: I299a95b80910f102a652cbd577838ddfc65fdbc6
2024-10-16 19:19:47 +00:00
Jason Macnak
8a3215bf53 Revert "Merge remote-tracking branch 'aosp/upstream-main'"
Revert submission 3308804

Reason for revert: b/373667975

Reverted changes: /q/submissionid:3308804

Change-Id: Ieb4e87d2bdcd975f5aa231c8e05f1053963c6c6e
2024-10-15 20:15:13 +00:00
Hang Nguyen
453a4c0dcf i915: Remove media compression support
This CL removes the support for media compression on ADL and MTL in
minigbm. The change includes removing the functionality to allocate the
modifier and compute the metadata for media compressed buffers from
minigbm.

BUG=b:365827638
TEST=Build chrome and deploy

Change-Id: I688b30ff08de4753e7491f6e29c688c2133fa27a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5873458
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Hang Nguyen <hnt@chromium.org>
Commit-Queue: Hang Nguyen <hnt@chromium.org>
Reviewed-by: Andres Calderon Jaramillo <andrescj@google.com>
Tested-by: Hang Nguyen <hnt@chromium.org>
2024-09-25 15:34:16 +00:00
Jean-Francois Thibert
6158bc1fdc Add depth buffer support for virtgpu virgl
Bug: b:347022601
Test: Ran app that export/import depth through AHB with cf

Change-Id: I07e60729b18a9f15e0d795c33c462ba4b4f255b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5636740
Tested-by: Jean-François Thibert <jfthibert@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Commit-Queue: Jean-François Thibert <jfthibert@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
2024-06-26 15:22:27 +00:00
Carlos Santa
2c062d8347 minigbm: Add support for CCS Media Compression on MTL
BUG=b:201620358
TEST=null_platform_test -m I915_FORMAT_MOD_4_TILED_MTL_MC_CCS success

cat /sys/kernel/debug/dri/1/i915_display_info during rendering

uapi: [FB:434] XR24 little-endian (0x34325258),0x10000000000000e,1920x1200, visible=visible, src=1920.000000x1200.000000+0.000000+0.000000, dst=1920x1200+0+0, rotation=0 (0x00000001)
                hw: [FB:434] XR24 little-endian (0x34325258),0x10000000000000e,1920x1200, visible=yes, src=1920.000000x1200.000000+0.000000+0.000000, dst=1920x1200+0+0, rotation=0 (0x00000001)
        [PLANE:47:plane 2A]: type=OVL

and make sure the modifier shows 0x10000000000000e

v3: Rebased the patch as per latest tip and fixes.

Credits-to: Bai, Guangyao <guangyao.bai@intel.com>
		Heikkila, Juha-pekka <juha-pekka.heikkila@intel.com>
		Ma, Zhaoliang <zhaoliang.ma@intel.com>

Change-Id: I9d9391a2f9b1f8d78f2a70b729f1fcc86b76679d
Signed-off-by: Lobo, Melanie <melanie.lobo@intel.com>
Signed-off-by: Santa, Carlos <carlos.santa@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5351727
Commit-Queue: Vidya Srinivas <vidya.srinivas@intel.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2024-03-18 06:25:17 +00:00
Jason Macnak
e950d82ae2 drv: Use __func__ instead of __FILE__
... to avoid needing a basename() which is dropped from string.h
in musl.

Bug: b/328316038
Test: android build
Change-Id: Ib619b9c45a30ce69be30270fe7da0f13421179be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352313
Commit-Queue: Dominik Behr <dbehr@chromium.org>
Auto-Submit: Jason Macnak <natsu@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
2024-03-12 00:27:45 +00:00
Vidya Srinivas
8441cb7b81 Revert "minigbm: Add support for CCS Media Compression on MTL"
Revert reason: Seeing regression with media compression patches.
Video playback is falling back to SW decode.
Reverting media compression for now.

This reverts commit 4492f45651.

Change-Id: I20b84a90f7e7b49559db6fe04e976db159ddfb17
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5343756
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2024-03-05 18:04:26 +00:00
Carlos Santa
4492f45651 minigbm: Add support for CCS Media Compression on MTL
BUG=b:201620358
TEST=null_platform_test -m I915_FORMAT_MOD_4_TILED_MTL_MC_CCS success

cat /sys/kernel/debug/dri/1/i915_display_info during rendering

uapi: [FB:434] XR24 little-endian (0x34325258),0x10000000000000e,1920x1200, visible=visible, src=1920.000000x1200.000000+0.000000+0.000000, dst=1920x1200+0+0, rotation=0 (0x00000001)
                hw: [FB:434] XR24 little-endian (0x34325258),0x10000000000000e,1920x1200, visible=yes, src=1920.000000x1200.000000+0.000000+0.000000, dst=1920x1200+0+0, rotation=0 (0x00000001)
        [PLANE:47:plane 2A]: type=OVL

and make sure the modifier shows 0x10000000000000e

v2: Rebased the patch as per latest tip.

Change-Id: I7a63b471f932afca082d23f26d9d2c10200e8c80
Signed-off-by: Carlos Santa <carlos.santa@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5312159
Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2024-02-29 01:00:04 +00:00
Rob Clark
958cd774ae minigbm: Add an API to return cache attributes
Crosvm currently makes the simplistic assumption that if driver==i915
then cached mappings to guest should be used for minigbm allocated
buffers.  But this may not always be the correct choice.  And other
drivers can do cached mappings to, in certain cases.  But on ARM devices
in particular, we should be consistent in cachability when it comes to
CPU mappings.  So add a new minigbm API which crosvm can use to
determine how to map to guest.

BUG=b:239718180, b:306548532
TEST=no artifact in Camera FOV Calibration of CtsVerifier on rex

Change-Id: I5c9b6346270f6a2eb83e6637a911f2153f6120ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3777567
Tested-by: Chia-I Wu <olv@google.com>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2024-02-01 17:40:19 +00:00
Chia-I Wu
48a3e34e16 drv: add support for bo logging
When MINIGBM_DEBUG=log_bos is set, log all bos created/imported.

BUG=none
TEST=add MINIGBM_DEBUG=log_bos to /etc/chrome_dev.conf and
     see logs in /var/log/ui/ui.LATEST

Change-Id: Ib2b2d5c3181862b557dbc5499fef84f2c9ac8122
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5014198
Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Tested-by: Chia-I Wu <olv@google.com>
2023-11-15 01:58:57 +00:00
Carlos Santa
e3ad0a9047 minigbm: Add CCS support for render compression on MTL
BUG=b:201620358
TEST=boot chromeos with UI with I915_FORMAT_MOD_4_TILED_MTL_RC_CCS modifier success
     cat /sys/kernel/debug/dri/0/i915_gem_framebuffer
     [PLANE:31:plane 1A]: type=PRI
		uapi: [FB:286] XR24 little-endian (0x34325258),0x10000000000000d,1920x1200, visible=visible, src=1920.000000x1200.000000+0.000000+0.000000, dst=1920x1200+0+0, rotation=0 (0x00000001)
		hw: [FB:286] XR24 little-endian (0x34325258),0x10000000000000d,1920x1200, visible=yes, src=1920.000000x1200.000000+0.000000+0.000000, dst=1920x1200+0+0, rotation=0 (0x00000001)

Change-Id: I78d961265576de7b9871d56c727654651659af32
Signed-off-by: Carlos Santa <carlos.santa@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4569893
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Sachin Kumar <sachin.kumar@intel.com>
Commit-Queue: Sachin Kumar <sachin.kumar@intel.com>
Tested-by: K Konda Reddy <k.konda.reddy@intel.com>
2023-10-06 07:26:46 +00:00
Roman Stratiienko
b23bfa5a70 Don't print verbose messages by default
Apply the same logic as ALOGV from cutils/log.h does.

Change-Id: Ia372ae760a23ad193c33a9bdb30296122b6d8a3f
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4432230
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
2023-06-23 10:05:20 +00:00
Dawn Han
84b3a09ef0 minigbm: clean up bo.handles
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>
2023-04-09 18:57:40 +00:00
Chia-I Wu
bf1f37f516 drv: add drv_preload
It can be used to preload a backend, currently only used to preload
amdgpu.

BUG=b:269664560
TEST="grep radeonsi /proc/$(pidof zygote)/maps" on grunt

Change-Id: I30d9f701f1da3bc243a9c81326a1ba0c5e0562de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4262034
Commit-Queue: Chia-I Wu <olv@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Chia-I Wu <olv@google.com>
2023-02-21 19:57:34 +00:00
Lepton Wu
deea0549d6 virtgpu_virgl: Set BO_USE_RENDERING for ARC Screen capture buffers.
This helps syncing back the host side content to the screen capture buffer in guest.

BUG=b:267892346
TEST=manual - Run AnyDesk on ARCVM

Change-Id: I230bd896ade2176f5e7e317f6cb227f45e89807e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4241419
Tested-by: Lepton Wu <lepton@chromium.org>
Auto-Submit: Lepton Wu <lepton@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2023-02-12 07:35:16 +00:00
Vipin Anand
97e07deac8 minigbm: Add tile4 support
Adding tile4 support for MTL.

BUG=b:243459433, b:243685631
TEST=emerge-rex minigbm

Change-Id: Ib66e121498b6eacc6038a6a4c392a76a104c5c2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3841638
Tested-by: Ashutosh Kumar <ashutosh1.kumar@intel.com>
Commit-Queue: Rajat Jain <rajatja@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2022-10-22 01:10:05 +00:00
Jason Macnak
e8b40546ce drv/gralloc: Handle SENSOR_DIRECT_DATA usage
BUG=b:238609372
TEST=build

Change-Id: If1aefed829b69070d5f01f20e7c6961afc15cd82
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3774933
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
2022-07-23 06:27:01 +00:00
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
Yiwei Zhang
7b3cbeabbb drv/virtgpu: add log level for logging
Harmless initialization logging should be info instead of error.

TEST=build and check logcat
BUG=b:234143058

Change-Id: I41ff39b428feb85d01663eec74b3f826007337c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3759415
Commit-Queue: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
2022-07-14 08:48:27 +00:00
Vipin Anand
a0af30944c i915: Add render compression support for Gen-12
From Gen-12 onwards Render compression(RC) aux buffer layout has been
changed. Updating the buffer allocation logic accordingly.

BUG=b:149544398
TEST=Boot target board to UI and run this command in cros shell, and
verify type (6) of RC modifer is in the output:
localhost# cat /run/debugfs_gpu/i915_gem_framebuffer
user size: 2256 x 1504, depth 24, 32 bpp, modifier 0x100000000000006,...
...

Change-Id: Ic82302b81526028b18166737786d7848a506f7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2248284
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Vipin Anand <vipin.anand@intel.corp-partner.google.com>
Commit-Queue: Binu R S <binu.r.s@intel.com>
2021-10-20 09:10:34 +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
Jason Macnak
336fd05c8a drv: add support to query backend for max texture size
BUG=b:194426249
TEST=launch Cuttlefish w/ 2D mode
TEST=launch Cuttlefish w/ 3D mode

Change-Id: Iee5f7b88a73b9e5b8cf89de1d8b67308a696083f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3194813
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-09-30 07:58:13 +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
1f9b9000b7 minigbm: completely hide bo->meta from cros_gralloc
This change also stores the final use_flags used for bo allocation into
hnd->use_flags.

BUG=b:199524294
TEST=build

Change-Id: I0f4e3fbeb90acdd3852ede98e0a42620a757cb74
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3163206
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-17 13:47:51 +00:00
Yiwei Zhang
bb9d4af452 minigbm: support GPU_DATA_BUFFER in gralloc virtgpu_virgl backend
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>
2021-06-25 21:02:35 +00:00
Yiwei Zhang
a1e93fd6f1 minibgm: update GRALLOC_DRM_GET_BUFFER_INFO query
Vulkan on Android relis on VkImageDrmFormatModifierExplicitCreateInfoEXT
to import the gralloc allocated buffer, which requires buffer info of
the host storage.

BUG=b:186679287
TEST=venus wsi on arcvm and egl/gles
TEST=CtsNativeHardwareTestCases and related CtsGraphicsTestCases

Change-Id: I7ab0e80ab67a2daae9ea547a8d5abe9417af17d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2862161
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2021-05-05 07:58:40 +00:00
Rob Clark
6f83a442e5 minigbm: Add FRONT_RENDERING flag
Add a flag to indicate that a buffer will be used for front-buffer (low-
latency) rendering.  We need to avoid using framebuffer compression in
this case, as the compression data and pixel data can be transiently out
of sync, resulting in corrupted display.

BUG=b:168868719
TEST=None

Change-Id: I08e6444aba99a5f694d010372277de775bc56fd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2450927
Tested-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
2021-03-18 23:39:54 +00:00
Gurchetan Singh
52155b4b57 minigbm: format_modifiers[0] -> format_modifier
The early version of the modifier assumed per plane modifiers.
The current version is only one modifier per buffer object.

BUG=none
TEST=compile

Change-Id: Ic3899118d44cb172ee2e4eae346e98cdf8328cf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2654590
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-01-29 22:47:35 +00:00
David Stevens
b42624c3e6 virtgpu: improve blob support on ARCVM
This change expands the types of buffers which use blob allocation, to
cover decoder/encoder bitstream buffers. It also adds tiling to the
exported buffer metadata, so that flush/invalidate are properly skipped
on imported blob buffers.

BUG=None
TEST=tast run ARCVM-DUT arc.VideoDecodeAccel.*

Change-Id: I460f4448db9e1bd2f7458f3180c4e92ff3b3d74f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2400839
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-09-17 01:13:16 +00:00
Jason Macnak
1de7f6655d cros_gralloc: Adds gralloc 3.0 support
Implements the allocator 3.0 and mapper 3.0 interfaces
which:

 - Implements HIDL interface directly (older versions
   are wrapped in a passthrough HIDL interface)

 - Adds isSupported() to allow checking for format and
   usage combination support before allocating.

Adds emulated multi-planar buffer support to virtio
backend for non gbm enabled hosts.

Updates cros_gralloc_handle to use uint64_t instead of
two uint32_t for some members.

Updates cros_gralloc_handle to have a single format
modifier.

Replaces Android makefiles with Android bp files.

BUG=b:146515640
TEST=run Cuttlefish w/ gralloc3 and run CTS tests

Change-Id: I43ed9788a2413201bddce17ffb69b76006ef39fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2273554
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
2020-07-08 01:08:59 +00:00
Gurchetan Singh
bc4f023bfc minigbm: add resource_info callback for virtio-gpu
In ARC++, the wayland sevice and the video stack rely on
GRALLOC_DRM_GET_STRIDE and (*lock_ycbcr) with zero flags to return
the metadata associated with the buffer.

In the past, we've simply returned the metadata that was calculated
during allocation.

Since the current virtio-gpu API relies on shadow buffers, there's
actually two different sets of metadata:

1) The metadata of the shadow buffer --> useful for mapping
2) The metadata of the host resource --> useful for passing to Chrome

For the wayland_service and video stack, we want to return (2).
For the Android framework, we want to return (1).

BUG=b:132939420
TEST=compile

Change-Id: I1134d651396ba68e064eaf2e3cad3cb3225d7c5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1681383
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-03-26 21:48:47 +00:00
ChromeOS Developer
44588bb282 minigbm: dri: Support 2+ planes query for modifiers.
If the driver does not implement the new function, or
if modifier is INVALID this should return exactly the
same as before.

For LINEAR, DRI should return exactly the same as
minigbm for all the YUV formats.

BUG=b:149819940
TEST=Use with followup patch and login on a Zork device + play a YT
video.

Change-Id: I6ea3b5827876844e510794b85212be51e5dfd68f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093211
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
2020-03-10 15:39:09 +00:00
David Stevens
26fe682306 Reland "minigbm: introduce test allocation"
This reverts commit 08d8dbf094.

The original change returned early from drv_bo_create_with_modifiers,
which broke reference counting. This must have hit some race condition
in the tests, as they no longer flake after fixing reference counting.

Original change's description:
> Revert "minigbm: introduce test allocation"
>
> This reverts commit f0e607c7d4.
>
> Reason for revert: caused flaky regressions across the board.
>
> BUG=b:150997559
> Exempt-From-Owner-Approval: revert.
>
> Original change's description:
> > minigbm: introduce test allocation
> >
> > This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
> > for the creation of fake buffers that can be used to determine buffer
> > metadata without actually allocating a full buffer. The new flag is
> > supported by the i915 backends. This flag also alleviates the need to
> > cache buffers when virtio_gpu queries metadata properties.
> >
> > BUG=b:145994510
> > TEST=play youtube with arcvm demo image plus this and virgl change
> >
> > Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
> > Tested-by: David Stevens <stevensd@chromium.org>
> > Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> > Commit-Queue: David Stevens <stevensd@chromium.org>
>
> Bug: b:145994510
> Change-Id: I50079b7f0aabf38e1f373cac0f28c0e057eed760
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093923
> Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
> Tested-by: Ilja H. Friedel <ihf@chromium.org>
> Reviewed-by: Ilja H. Friedel <ihf@chromium.org>

Bug: b:150997559, b:145994510
Change-Id: If0f02a4701bb6960b6413d6b0c00b481146914d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2094068
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
2020-03-10 04:17:30 +00:00
Ilja H. Friedel
08d8dbf094 Revert "minigbm: introduce test allocation"
This reverts commit f0e607c7d4.

Reason for revert: caused flaky regressions across the board.

BUG=b:150997559
Exempt-From-Owner-Approval: revert.

Original change's description:
> minigbm: introduce test allocation
>
> This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
> for the creation of fake buffers that can be used to determine buffer
> metadata without actually allocating a full buffer. The new flag is
> supported by the i915 backends. This flag also alleviates the need to
> cache buffers when virtio_gpu queries metadata properties.
>
> BUG=b:145994510
> TEST=play youtube with arcvm demo image plus this and virgl change
>
> Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
> Tested-by: David Stevens <stevensd@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Commit-Queue: David Stevens <stevensd@chromium.org>

Bug: b:145994510
Change-Id: I50079b7f0aabf38e1f373cac0f28c0e057eed760
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093923
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
2020-03-08 09:17:47 +00:00
David Stevens
f0e607c7d4 minigbm: introduce test allocation
This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
for the creation of fake buffers that can be used to determine buffer
metadata without actually allocating a full buffer. The new flag is
supported by the i915 backends. This flag also alleviates the need to
cache buffers when virtio_gpu queries metadata properties.

BUG=b:145994510
TEST=play youtube with arcvm demo image plus this and virgl change

Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-03-05 03:12:45 +00:00
Gurchetan Singh
e32ec0be67 minigbm: gbm.h: organize our downstream patches
This patch series is not bisectable.

BUG=b:145747113
TEST=compile

Change-Id: I447e554f27e55e43a4f5d3ca8f1725eda46852fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1963001
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-01-17 02:58:14 +00:00
David Stevens
9982421bb3 minigbm: align BO_USE flags with GBM flags
Swap the values of the BO_USE encoder and decoder flags, to match the
values of the respective GBM flags.

BUG=none
TEST=compile

Change-Id: I419ca7b8234d4ce4e8a771ee608efac836b7d007
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980687
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-01-16 15:25:55 +00:00
Dominik Behr
6e6dc49707 minigbm: virtio: restrict formats supported without 3D
Upstream virtio drm commit "drm/virtio: fix DRM_FORMAT_* handling" severely
restricts supported formats and strictly enforces 32bpp dumb buffers.
Therefore now we only support XRGB8888 for scanout, ARGB8888 for cursor,
ARGB8888 for rendering. Also, we pretend all buffers are 32bpp when allocating
as dumb buffers.

BUG=none
TEST=tast run 127.0.0.1:9222 webrtc.RTCPeerConnection.vp8

Change-Id: I6225a9cb3c49f0850c6d94b2d12efaf9a33b149e
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1849773
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-12-12 06:36:24 +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
Gurchetan Singh
48b4c086ab minigbm: fix flags to align with GBM
For virtio, we can just forward use flags to host gbm. For that
to work, these flags must be aligned.

BUG=chromium:924405
TEST=compile

Change-Id: I64c03b4a374296a59749dccf65ab9ebeb59fc762
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1804827
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:53 +00:00
Miguel Casas
055a6aa3e8 Add support for DRM_FORMAT_P010
Test: Tested with chrome's ozone_gl_unittests: crrev.com/c/1561136
Bug: 911754
Change-Id: I8a9a28ba1c3a1186fd88b43c85098a5550fa1c8b
Reviewed-on: https://chromium-review.googlesource.com/1590464
Commit-Ready: Miguel Casas <mcasas@chromium.org>
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2019-05-02 16:12:39 -07:00
Kristian H. Kristensen
3cb5bbacc5 Reland "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
This is a reland of 1bd7b04a3a

We've landed CL:1070995 which fixes the missing modifier that
caused tiling corruption on pre-KBL Intel devices and CL:1072638
which makes the failing vda unittests use SCANOUT_VDA_WRITE as
they were supposed to.

Original change's description:
> i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
>
> This flag is used to indicate that the platform video decoder will be
> writing into this buffer and that it should be allocated
> accordingly. On Intel, this means that we have to allocate y-tiled
> NV12 for libva to be able to decode to the buffer.
>
> We force gralloc NV12 allocations to be linear for now, since ARC++
> doesn't properly pass modifiers to ChromeOS.
>
> BUG=822346
> TEST=test_that graphics_Gbm
>
> Change-Id: I840c30d22355d26816df718b49717407e2e4620f
> Reviewed-on: https://chromium-review.googlesource.com/996648
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Bug: 822346
Change-Id: Icf0921dc91ac422da26371bffea34b26550b8234
Reviewed-on: https://chromium-review.googlesource.com/1073877
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-05-30 12:50:33 -07:00
Hirokazu Honda
2b682fde2d Revert "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
This reverts commit 1bd7b04a3a.

Reason for revert: Breaks video decoding on most intel platforms, e.g., caroline and samus

Original change's description:
> i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
> 
> This flag is used to indicate that the platform video decoder will be
> writing into this buffer and that it should be allocated
> accordingly. On Intel, this means that we have to allocate y-tiled
> NV12 for libva to be able to decode to the buffer.
> 
> We force gralloc NV12 allocations to be linear for now, since ARC++
> doesn't properly pass modifiers to ChromeOS.
> 
> BUG=822346
> TEST=test_that graphics_Gbm
> 
> Change-Id: I840c30d22355d26816df718b49717407e2e4620f
> Reviewed-on: https://chromium-review.googlesource.com/996648
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Bug: 822346, 845076
Change-Id: I7681ddb66e4789951e840821993fc5562a55d1af
Reviewed-on: https://chromium-review.googlesource.com/1066032
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kuo Jen Wei <inker@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2018-05-22 08:06:31 +00:00
Kristian H. Kristensen
1bd7b04a3a i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
This flag is used to indicate that the platform video decoder will be
writing into this buffer and that it should be allocated
accordingly. On Intel, this means that we have to allocate y-tiled
NV12 for libva to be able to decode to the buffer.

We force gralloc NV12 allocations to be linear for now, since ARC++
doesn't properly pass modifiers to ChromeOS.

BUG=822346
TEST=test_that graphics_Gbm

Change-Id: I840c30d22355d26816df718b49717407e2e4620f
Reviewed-on: https://chromium-review.googlesource.com/996648
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-05-18 20:08:25 -07:00
Satyajit Sahu
77b7055a16 minigbm: Use the stride value returned by mapImage
mapImage can return a different stride value. This value must be
used for the mapped address.

BUG=b:38152101 b:79346377
TEST=graphics_Sanity autotest passed

Change-Id: Ie0eb716291366ae6a047d704f66d24ec41738713
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1041369
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-05-10 15:09:50 -07:00
Gurchetan Singh
767c538889 Revert "minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16"
This reverts commit 292da5365a.

Reason for revert: The Android framework uses successful allocation of HAL_PIXEL_FORMAT_RGBA_FP16 to test for wide-gamut capabilities.  We don't want to advertise this, so let's revert.

android.graphics.cts.BitmapColorSpaceTest#test16bitHardware

can pass if the framework falls back to RGBA8888, as is the plan.

Original change's description:
> minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16
>
> This is needed to support the following CTS test:
>
> android.graphics.cts.BitmapColorSpaceTest#test16bitHardware
>
> There have been some rumblings about adding 64-bit formats to <drm_fourcc.h>:
>
> https://lists.freedesktop.org/archives/intel-gvt-dev/2017-July/001469.html
>
> However, nothing has landed, so let's just define our own format
> for the time being.
>
> BUG=b:77973662
> TEST=Compile for kevin and kevin-arcnext
>      Unfortunately, my P setup refuses to work, so let the lab
>      test.
>
> Change-Id: I1fea16400ba6632a8ef17105e27bc7799d2af515
> Reviewed-on: https://chromium-review.googlesource.com/1029355
> Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

Bug: b:77973662
Change-Id: I9e4b79b06dd565189a2e783e8453f08af173d84c
Reviewed-on: https://chromium-review.googlesource.com/1045805
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-05-08 21:15:47 -07:00
Kristian H. Kristensen
222919005b minigbm: Drop drv_bo_get_stride_in_pixels() helper
Computing "stride in pixels" assumes the pixel size divides the
stride, which isn't always the case.  This is only used for the
cros_gralloc implementation, so lets move the calculation there
instead of providing a generic helper for an unhealthy concept.

BUG=822346
TEST=test_that graphics_Gbm

Change-Id: Iab7a363c5471e4bacef7df7095ef77723adf5e93
Reviewed-on: https://chromium-review.googlesource.com/996645
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-05-04 03:02:36 -07:00