Commit graph

858 commits

Author SHA1 Message Date
Carlos Santa
3ab89b0247 xe: add initial Xe kmd support for gen12 xelp
Adds a new intel backend for interfacing with the Xe kernel driver.
Currently only tested on gen12 (Xe1; e.g. TGL, ADL, MTL).

Test 1: drm-tests (natively): stop ui and then run:
	- mapped_texture_test
	- null_platform_test -m [I915_FORMAT_MOD_X_TILED|I915_FORMAT_MOD_Y_TILED]
	- plane_test (by default it uses NV12)

Test 2: full OS: boot to UI, execute webGL and/or YouTube successfully and watch
the terminal: TERM=xterm watch -n1 -d cat /sys/kernel/debug/dri/0/i915_display_info
for color formats and display plane usage

v1: Carlos Santa <carlos.santa@intel.corp-partner.google.com>
v2: Ryan Neph <ryanneph@google.com>
  - formatting fixes
  - remove deprecated #ifdef I915_SCANOUT_Y_TILED conditional compilation
  - add missing backend_xe implementations
  - mimic i915_add_combinations
    - Match formatting, order of operations, and add the missing combo for
      YVU420_ANDROID + USE_CAMERA_WRITE.
    - In a future CL, we'll factor this into a common function called by both
      backends.
  - simplify xe_bo_map()
    - The conditional body is always taken, so remove the conditional entirely.
  - mark late-gen12 as mtl_or_newer until proper version handling is used.

BUG=b:358427077
TEST=drm-tests (see above)

Change-Id: I1eaa1dcce6cee706a421b3c4d6a532a6b83f8564
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/6245159
Tested-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Matt Turner <msturner@google.com>
Reviewed-by: Lina Versace <linyaa@google.com>
2025-02-10 11:07:50 -08:00
Eliot Courtney
afef668e27 [i915] Use write-combining for offset map case.
This CL consolidates the logic for enabling write-combining on map and
applies it also to the offset map codepath.

BUG=b:371546474
TEST=CQ

Change-Id: Iedb812339f12a5d11386266565168ba06c9f11da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/6022557
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Tested-by: Eliot Courtney <edcourtney@chromium.org>
2025-01-09 22:30:59 -08:00
Lina Versace
ad29efaa71 i915: Choose TILE_4 vs TILE_Y at runtime
For all current ChromeOS boards, MTL and older, this patch should change
no behavior. It's just a refactor.

Do not choose at buildtime based on macro definitions. Decisions about
scanout-capable modifiers should be decided at runtime based on chipset
info.

We can safely delete the #ifdef blocks for I915_SCANOUT_4_TILED and
I915_SCANOUT_Y_TILED without changing any behavior. They were controlled
by the ebuild snippet below, and the USE flag is set if and only if
chipset >= MTL.

        if use intel_drm_tile4 ; then
                append-cppflags -DI915_SCANOUT_4_TILED
        else
                append-cppflags -DI915_SCANOUT_Y_TILED
        fi

I tested the patch on rex (MTL) and brya (ADL), which pre-patch took
different #ifdef paths.  Before and after the patch, On MTL, I confirmed
that fullscreen video from https://crosvideo.appspot.com/?codec=h264 was
promoted to a scanout plane with the expected pixel format and modifier:
I915_FORMAT_MOD_4_TILED + DRM_FORMAT_NV12. On ADL, I confirmed the same
for I915_FORMAT_MOD_Y_TILED + DRM_FORMAT_NV12. I confirmed by inspecting
/sys/kernel/debug/dri/0/state during video playback.

BUG=b:349135555
TEST=brya, rex. Confirm fullscreen h264 video gets promoted to scanout
  plane with correct pixel format and modifier. See commit message.

Change-Id: I1c5155548287869279fec3aa0b02e057acc788fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/6082999
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Marcin Wojtas <mwojtas@google.com>
Tested-by: Lina Versace <linyaa@google.com>
Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com>
Auto-Submit: Lina Versace <linyaa@google.com>
2024-12-16 23:32:40 -08:00
Owners Cleanup
993130c58e Remove marcheu@chromium.org from OWNERS
This suggested change is automatically generated based on group
memberships and affiliations.
If this change is unnecessary or in error, vote the lowest CR value
(i.e. reject the CL) and the bot will abandon it. Vote the highest CR to
approve this change. You may also abandon this change.

See the owner's recent activity for context:
https://chromium-review.googlesource.com/q/marcheu@chromium.org

To report an issue, file a bug in the Infra>Codereview component.

Change-Id: I571430359cb813dd036b5394915b12b9c6374186
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5680841
Tested-by: Matt Turner <msturner@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Matt Turner <msturner@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Auto-Submit: Owners Cleanup <swarming-tasks@owners-cleanup-prod.google.com.iam.gserviceaccount.com>
2024-11-21 20:10:59 +00:00
Jeffrey Kardatzke
ff04d4aa48 minigbm: Fix 10bit protected allocations on MTK
There was another change done after this was tested before which then
was setting the size before the calculation was done to handle the
10-bit case. We now fix that size after doing the 10-bit modification.

BUG=b:367770932
TEST=None

Change-Id: Id5410f802c9140d378217fbf7b33f1d467ebf5ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5967833
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
2024-10-28 07:50:21 +00:00
Jason Macnak
93e16b9029 cros_gralloc: Avoid using masks in handle_usage()
After https://crrev.com/c/5907583, handle_usage() tries to match
the entire value. An allocation with usage 0x100000203 from

  BufferUsage::GPU_RENDER_TARGET |
  BufferUsage::CPU_READ_OFTEN |
  BufferUsage::FRONT_BUFFER

would fail to match the combined BUFFER_USAGE_FRONT_RENDERING_MASK
(`1U << 28 | 1ULL << 32`) because the allocation only sets a
single usage bit `BUFFER_USAGE_FRONT_RENDERING` (`1ULL << 32`)
and not the combined mask.

Bug: b/373474508
Test: vts -m VtsHalGraphicsAllocatorAidl_TargetTest
Change-Id: I926789a7aab937f2c2092475cb40ad9666b4f95f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5932803
Auto-Submit: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Ren-Pei Zeng <kamesan@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
2024-10-15 16:19:58 +00:00
Grzegorz Jaszczyk
ccda09042a i915: allow DRM_FORMAT_YVU420_ANDROID for camera use
After this change is_supported() succeeds, USB camera starts
working and:

 E [minigbm:CrosGralloc4Allocator.cc(88)]: Unsupported combination -- pixel format: YV12, drm format:DRM_FOURCC_9997, usage: CPU_READ_NEVER | CPU_WRITE_NEVER | CPU_WRITE_RARELY | CPU_WRITE_OFTEN | GPU_TEXTURE | CAMERA_OUTPUT (0x20130)

issue is fixed.

Similar settings were already introduced for other backends e.g. msm:
https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3058396

BUG=b:323730914, b:309244873
Test: Verify that USB camera is working in Android environment

Change-Id: I29e0ec914ec8ba7c5b068fe22623efa30f0fb4f3
Reviewed-by: Michal Dubiel <dubielm@google.com>
Reviewed-by: Konrad Adamczyk <konrada@google.com>
Tested-by: Michal Dubiel <dubielm@google.com>
Tested-by: Konrad Adamczyk <konrada@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5913520
Tested-by: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Auto-Submit: Grzegorz Jaszczyk <jaszczyk@google.com>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
2024-10-10 22:08:10 +00:00
Grzegorz Jaszczyk
ff0509d723 mediatek: allow DRM_FORMAT_YVU420_ANDROID for camera use
After this change is_supported() succeeds, USB camera starts
working and:

 E [minigbm:CrosGralloc4Allocator.cc(88)]: Unsupported combination -- pixel format: YV12, drm format:DRM_FOURCC_9997, usage: CPU_READ_NEVER | CPU_WRITE_NEVER | CPU_WRITE_RARELY | CPU_WRITE_OFTEN | GPU_TEXTURE | CAMERA_OUTPUT (0x20130)

issue is fixed.

Similar settings were already introduced for other backends e.g. msm:
https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3058396

BUG=b:320202326, b:309244873
Test: Verify that external USB camera is working in Android environment

Change-Id: I7e1e328998ddf62ed127c001f054ed10c6fb6a02
Reviewed-by: Michal Dubiel <dubielm@google.com>
Reviewed-by: Konrad Adamczyk <konrada@google.com>
Tested-by: Konrad Adamczyk <konrada@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5913519
Auto-Submit: Grzegorz Jaszczyk <jaszczyk@google.com>
Tested-by: Grzegorz Jaszczyk <jaszczyk@google.com>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2024-10-10 14:55:09 +00:00
Ryan Neph
6d687b7b62 Revert "gralloc: Error when locking buffer alloc'd without CPU_ usage"
This reverts commit eb0e5fa310.

Reason for revert: fix ARCVM test regressions while investigating root cause (b/371862010).

Original change's description:
> gralloc: Error when locking buffer alloc'd without CPU_ usage
>
> ... except when running with software rendering as apps do not
> know that they would need to request additional CPU_* usage
> for GPU_* usage.
>
> Bug: b/356845188
> Test: cts -m CtsNativeHardwareTestCases
> Change-Id: I3536d80469d2187550558e9d02795896de4f9827
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5893718
> Reviewed-by: Ryan Neph <ryanneph@google.com>
> Reviewed-by: Juston Li <justonli@google.com>
> Tested-by: Ryan Neph <ryanneph@google.com>
> Tested-by: Juston Li <justonli@google.com>
> Commit-Queue: Ryan Neph <ryanneph@google.com>
> Commit-Queue: Jason Macnak <natsu@google.com>

Bug: b/371862010
Change-Id: Id16c3ae1989fec9d7cd71c24b9c6d55c3d29ae45
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5915946
Auto-Submit: Ryan Neph <ryanneph@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com>
2024-10-08 20:42:45 +00:00
Ren-Pei Zeng
d56aa1353a cros_gralloc: Fix gralloc -> gbm usage flag mapping
GRALLOC_USAGE_SW_READ_RARELY was incorrectly mapped to
BO_USE_SW_READ_OFTEN since GRALLOC_USAGE_SW_READ_OFTEN (== 3) contains
GRALLOC_USAGE_SW_READ_RARELY (== 2) in bit mask. Fix it by making the
flag check compare the full bit mask.

Same for the WRITE case.

BUG=None
TEST=CQ

Change-Id: I0c1e0e6f07978b6090472b2d470f5880ad231d0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5907583
Reviewed-by: Jason Macnak <natsu@google.com>
Tested-by: Ren-Pei Zeng <kamesan@chromium.org>
Commit-Queue: Ren-Pei Zeng <kamesan@chromium.org>
2024-10-04 17:09:07 +00:00
Jason Macnak
eb0e5fa310 gralloc: Error when locking buffer alloc'd without CPU_ usage
... except when running with software rendering as apps do not
know that they would need to request additional CPU_* usage
for GPU_* usage.

Bug: b/356845188
Test: cts -m CtsNativeHardwareTestCases
Change-Id: I3536d80469d2187550558e9d02795896de4f9827
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5893718
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Juston Li <justonli@google.com>
Tested-by: Ryan Neph <ryanneph@google.com>
Tested-by: Juston Li <justonli@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
2024-09-26 21:08:07 +00:00
Ryan Neph
94e1bdc657 OWNERS: add ryanneph@google.com
Change-Id: If6006eb58e2068819eb7002af7c486fe0b84f168
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5894024
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Chia-I Wu <olv@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Auto-Submit: Ryan Neph <ryanneph@google.com>
Tested-by: Ryan Neph <ryanneph@google.com>
2024-09-26 18:58:25 +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
Ryan Neph
2381df8295 virtgpu_cross_domain: fix planar size calculation
The last plane's size may include any padding bytes introduced by
virtgpu's page-alignment, but its not incorrect, and all other planes
will be exact.

BUG=b:365820897
TEST=Spot check new size calculation for YVU420_ANDROID allocation

Change-Id: I6e88905d7191dca7e68e5dfd773d2fcaac79773d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5849473
Tested-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chia-I Wu <olv@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Auto-Submit: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
2024-09-11 02:25:27 +00:00
Ryan Neph
05865d75bb virtgpu_cross_domain: force LINEAR for YVU420_ANDROID
Metadata query sent to host minigbm detects the YVU420 + LINEAR
combination and internally handle as YVU420_ANDROID to obey Android's
specific layout requirements.

This matches a similar hack applied to the virtgpu_virgl backend long
ago: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2596704

BUG=b:360937659
TEST=Fixes instagram video decode artifacts

Change-Id: I591e427a926327b841be6e280ca57eefab598965
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5849472
Reviewed-by: Chia-I Wu <olv@google.com>
Tested-by: Ryan Neph <ryanneph@google.com>
Auto-Submit: Ryan Neph <ryanneph@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2024-09-10 22:59:26 +00:00
Chia-I Wu
e2fdd90122 dri: pass use_flags to dri_bo_create_with_modifiers
We need use_flags when we implement the dri interface on top of hbm.

Also, dri_bo_create_with_modifiers does not take use flags only because
gbm_bo_create_with_modifiers does not.  That has changed with
gbm_bo_create_with_modifiers2 although minigbm does not reflect that.

BUG=b:292148713
TEST=CQ

Change-Id: I120358c843140a937fee1dd6183d1836ea622eec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5801181
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Tested-by: Chia-I Wu <olv@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2024-09-04 02:19:39 +00:00
Chia-I Wu
ac54d29297 dri: make dri_driver an opaque object
There is no reason to leak the internals to backends.

BUG=b:292148713
TEST=CQ

Change-Id: I42215ad3add750f19d4a2f0a575a040d73bb19e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5801180
Commit-Queue: Chia-I Wu <olv@google.com>
Tested-by: Chia-I Wu <olv@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
2024-09-04 02:19:37 +00:00
Chia-I Wu
2743358812 dri: make dri_driver a proper object
Make dri_driver a proper object that the backend can create, rather than
something that the backend must inherit from.

This makes dri_init return a dri_driver and make the rest dri_*
functions take a dri_driver.  There is no functional change.

BUG=b:292148713
TEST=CQ

Change-Id: I3ef045d73b0015b5c6d926dec7bae69d35d94275
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5801179
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Tested-by: Chia-I Wu <olv@google.com>
2024-09-04 02:19:34 +00:00
Tatsuyuki Ishi
a160cb46b1 minigbm: Update common.mk to unbreak gcc and bfd builds
Some parts of Android uses gcc and bfd, this imports upstream common.mk
changes required to avoid pass unsupported flags to them.

BUG=b:352469414
TEST=CQ

Change-Id: Ie9f5ff8d0590e215688105db4b24f529fd948383
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5825982
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
Auto-Submit: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
2024-09-03 12:44:03 +00:00
Dorinda Bassey
a2a049d9f5 Initialize emulated_metadata fields to avoid uninitialized warnings
Set `emulated_metadata` fields to default values (0) to prevent
potential usage of uninitialized variables in `virtgpu_virgl.c`.
This fix ensures that the compilation doesn't fail due to warnings
being treated as errors when using strict compiler flags.

Change-Id: I2508168c095896c7fd492830ffb6ff3564dc2733
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5782849
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2024-08-27 00:06:40 +00:00
Jean-Francois Thibert
71ca6afaef Add format filtering for virgl gfxstream
Bug=b:352091996
Test=Ran CTS deqp test cases with cuttlefish

Change-Id: Ie6af00d39abfd19b8070b8df9349d05c80b324c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5722608
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Jean-François Thibert <jfthibert@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Tested-by: Jean-François Thibert <jfthibert@google.com>
2024-08-01 15:42:33 +00:00
Jason-jh Lin
661992dfdf mediatek: Allocate secure buffer by DMA_HEAP_IOCTL_ALLOC
1. Allocate secure buffer from DMA_HEAP_IOCTL_ALLOC ,then using FD to
create a GEM handle and close this FD.

2. Since the secure buffer doesn't allocate via DRM_IOCTL_MTK_GEM_CREATE,
the DRM_MTK_GEM_CREATE_FLAG_RESTRICTED flag can be removed.
It should be added in the code that calls drmModeAddFB2().

3. Add mediatek_private_drv_data to store the dma_heap_fd in drv->priv,
and also add mediatek_close() to close dma_heap_fd and free drv->priv
when backend driver is closing.

BUG=b:248609774
TEST=emerge-geralt minigbm

Change-Id: I96df25580efe04f2c9a739b2d68de8837df091df
Signed-off-by: Jason-jh Lin <jason-jh.lin@mediatek.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5581571
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
2024-07-17 19:41:57 +00:00
Fei Shao
cd5aef63a7 minigbm: mediatek: Pass ALLOC_SINGLE_PAGES for linear scanout buffer
To improve the efficiency of allocating high-resolution video decoder,
pass a flag to notify the kernel DMA framework to allocate linear
scanout buffers with single pages, so the allocation is more likely to
success when the available large chunk memory is constrained.

BUG=b:352229429
TEST=emerge-geralt libdrm minigbm

Cq-Depend: chromium:5689126
Change-Id: I21f2745cb5bdb7eaf7f50482c4c091791d13bbcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5706152
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Tested-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
2024-07-15 13:32:51 +00:00
Fei Shao
c06a7dbe71 minigbm: mediatek: Integrate primitive BO use flag definitions
Move the primitive is_* boolean definitions for BO_USE_* flags to the
top of mediatek_bo_create_with_modifiers().

No functional changes.

BUG=b:352229429
TEST=emerge-geralt minigbm

Change-Id: Id1e9007d16bbf43bfb11af6f0376a18e1fc02cf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5706151
Tested-by: Fei Shao <fshao@chromium.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
2024-07-15 10:38:19 +00:00
Fei Shao
41fb484c28 minigbm: mediatek: Update restricted flag name
Follow CL:5689125 and rename the flag.

BUG=b:352225473
TEST=emerge-geralt minigbm libdrm

Cq-Depend: chromium:5689125
Change-Id: I271d57e255a79af5b8e93ddb91186107dc8ec529
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5690587
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Tested-by: Fei Shao <fshao@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
2024-07-12 15:37:52 +00:00
Tatsuyuki Ishi
87c07170be minigbm: Update common.mk with symbolic and visibility flags
This syncs common.mk with the latest source in src/platform2/common-mk.
Main change that affects the compiled binary are the newly added
-fvisibility-inlines-hidden CXXFLAGS and the -Bsymbolic-non-weak
LDFLAGS (see comments in the file for what these do).

Deviating from upstream, disable -Wimplicit-fallthrough and
-Wunreachable-code to unbreak compilation.

BUG=b:352469414
TEST=CQ

Change-Id: I75f7dc4084ba7857ab840ee438309c31d9457211
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5691003
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Auto-Submit: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
2024-07-11 14:28:21 +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
Ryan Neph
698c5e9e8d minigbm: #define MINIGBM_HAS_GBM_BO_GET_MAP_INFO
Mark the availability of minigbm's newer gbm_bo_get_map_info() API.

Virglrenderer (and others) can test for its existence at build-time and
conditionally use it.

BUG=b:338254311
TEST=emerge minigbm
TEST=virglrenderer can conditionally build with gbm_bo_get_map_info()

Change-Id: I2685813fa99b73316477bef7edfd96e5dd9699a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5636516
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2024-06-18 03:02:33 +00:00
Jeffrey Kardatzke
de65652cfb minigbm: Reduce allocation size for MT2T allocations
On MTK, when we allocate MT2T surfaces for protected content, these are
sent in as P010 instead. However, P010 uses 16bpp where MT2T requires
only 10bpp. This adjusts the allocation sizes to only be what is needed
so we reduce memory usage by 5/8.

BUG=b:339091167
TEST=Netflix 4K 10-bit HEVC plays on Ciri

Change-Id: Ia34b7d3aa962f3138da130077d723748592023bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5582540
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Miguel Casas <mcasas@google.com>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Miguel Casas <mcasas@google.com>
2024-05-31 22:59:05 +00:00
Hsin-Yi Wang
44265d2f9f mediatek: Add MT8196
BUG=b:336924470
TEST=emerge-rauru minigbm

Cq-Depend: chromium:5579120
Change-Id: I63a5352ecc60a98dd9438129e3a33aebb71361cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5577798
Commit-Queue: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Justin Green <greenjustin@google.com>
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
2024-05-30 01:06:04 +00:00
Ryan Neph
c52bbc8435 minigbm: autogenerate gbm.pc and cleanup build variables
FINALLY, the gbm.pc is autogenerated to respect the variables steering
the build.

BUG=b:338254311
TEST=mkdir -p build && OUT=build make && test -f build/gbm.pc && echo "ALL GOOD"
TEST=emerge minigbm

Change-Id: Ie1458bb46375be1357cbf4f0a8f59d698cbd6cfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5513263
Commit-Queue: Ryan Neph <ryanneph@google.com>
Tested-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
2024-05-10 20:49:02 +00:00
Yiwei Zhang
a0cb38aa68 minigbm: update OWNERS
Make it more up to date.

BUG=n/a
TEST=n/a

Change-Id: I0416c2dd02c3ee24155bb94d7b96ca1130098e50
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5505016
Reviewed-by: Satoshi Niwa <niwa@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
2024-05-01 08:09:47 +00:00
Yiwei Zhang
8291bfe6f1 minigbm: format fix
BUG=n/a
TEST=./presubmit.sh

Change-Id: Ic581ebe770c648ee344cfbe20ba6655786a2088e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5505015
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Satoshi Niwa <niwa@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2024-05-01 08:09:45 +00:00
Yiwei Zhang
772c24c476 msm: pad extra for YV12 to align with freedreno fdl_layout
BUG=b:285941238
TEST=android.media.decoder.cts.DecodeAccuracyTest

Change-Id: Iab3c1c9a67af2033fd45b7ee254b2cbdc927684c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5460257
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2024-04-29 23:20:14 +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
Roman Stratiienko
dd62167b6f cros_gralloc: Remove Android.bp files
Android.bp files are maintained in the AOSP fork repository.

Change-Id: I492e0c2154b22cd4cda85e379df2578b352c23df
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4961034
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
2024-03-13 00:34:56 +00:00
Marcin Radomski
40b28f098a minigbm: add gbm_{bo,surface}_create_with_modifiers2
Rationale: this will help get Rust gbm bindings into Android
(go/drm-gbm-rust-crates-for-android) without needing minigbm-specific
patches to upstream Rust code.

Upstream Mesa gbm defines those functions as variants with an extra
"flags" argument[2][3] (these don't exist in the mesa version checked
into Chromium though). The definitions added in this CL provide variants
that fail for any non-zero flags.

[1] https://crates.io/crates/gbm
[2] b7d6d90dab/src/gbm/main/gbm.h (L303)
[3] b7d6d90dab/src/gbm/main/gbm.h (L443)

Bug: 328363177
Test: cros build-packages --board=amd64-generic minigbm drm-tests
Change-Id: I9284d597e2d4de5ff9b677db0a0ffe6d274e4f57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352371
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Marcin Radomski <dextero@google.com>
Tested-by: Marcin Radomski <dextero@google.com>
2024-03-12 11:19:37 +00:00
Marcin Radomski
3b508e145f minigbm: use int instead of size_t for plane index
Rationale: this will help get Rust gbm bindings into Android
(go/drm-gbm-rust-crates-for-android) without needing minigbm-specific
patches to upstream Rust code.

Mesa gbm defines the plane argument for some functions as int rather
than size_t. While this doesn't bother C/C++ compilers too much,
attempting to use bindgen-generated Rust bindings to minigbm with gbm
Rust crate[1] fails.

[1] https://crates.io/crates/gbm

Bug: 328363177
Test: cros build-packages --board=amd64-generic minigbm drm-tests
Change-Id: I5938633e0936bf1b9aafb856bfb966ceb1fb1a2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352370
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Marcin Radomski <dextero@google.com>
Tested-by: Marcin Radomski <dextero@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2024-03-12 11:19:34 +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
Justin Green
1b84258e66 mediatek: Add AR30 overlay support
Add support for AR30 overlays to select MTK devices.

BUG=b:325625530
TEST=Tested by running MT2T->AR30 image processing tests on MT8188G.

Change-Id: I570ee740e49b5d9c61a1e1d0da777fdcc937321d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5345669
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Commit-Queue: Justin Green <greenjustin@google.com>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Justin Green <greenjustin@google.com>
2024-03-11 19:08:31 +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
Vidya Srinivas
5769945228 Revert "minigbm: Fix Alignment issues for MTL Media Compression"
Revert reason: Seeing regression with media compression patches.
Video playback is falling back to SW decode.
Reverting media compression for now.

This reverts commit 33b8c3eb40.

Change-Id: I7f544acc0248887763afeefa056b42f15bdd2b88
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5343755
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2024-03-05 18:04:24 +00:00
Vidya Srinivas
33b8c3eb40 minigbm: Fix Alignment issues for MTL Media Compression
Credits-to: Bai, Guangyao <guangyao.bai@intel.com>
	    Heikkila, Juha-pekka <juha-pekka.heikkila@intel.com>

BUG=b:201620358
TEST=vaapi_unittest --gtest_filter=*VaapiMinigbmTest*
--single-process-tests

Change-Id: Ib8e261a1e53e9678dfd56d61646a024dd648d9e2
Signed-off-by: Melanie Lobo <melanie.lobo@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Signed-off-by: Zhaoliang Ma <zhaoliang.ma@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5312160
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com>
2024-02-29 01:00:07 +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
Jason Macnak
bca615781a gralloc: Sync with AOSP
Bug: b/321158178
Test: untested, AOSP already builds
Change-Id: I0f405f840baf3da755b39a3a3c1028ecbc0915c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5258793
Commit-Queue: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
2024-02-27 18:49:17 +00:00
Ap, Kamal
768057a63e i915.c: Add 2 additional ADL-N PCI ids
Ref:https://cgit.freedesktop.org/drm-intel/commit/?h=drm-intel-next&id=425b463859eda4f4c071e517267acdd1c0d731bd

BUG=b:325995751
TEST=Boot on Nissa

Change-Id: Ia8bc74b3b365db37271644bf3c56e070afb7403d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5312155
Reviewed-by: Lalith Rajendran <lalithkraj@google.com>
Commit-Queue: Kamal Ap <kamal.ap@intel.corp-partner.google.com>
Tested-by: Kamal Ap <kamal.ap@intel.corp-partner.google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2024-02-26 18:09:13 +00:00
Chia-I Wu
eae1fe7e8b i915: make is_mtl a special case for bo cache
i915 kmd has a special case for MTL in shmem_object_init:

  if (HAS_LLC(i915) || (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)))
    cache_level = I915_CACHE_LLC;

Meanwhile, its i915_gem_object_pin_to_display_plane has:

  ret = i915_gem_object_set_cache_level(obj,
    HAS_WT(i915) ?
    I915_CACHE_WT : I915_CACHE_NONE);

Let's report GBM_BO_MAP_CACHE_CACHED on MTL unless BO_USE_SCANOUT is
set.

BUG=b:325368420
TEST=no artifact in Camera FOV Calibration of CtsVerifier on rex
TEST=android.hardware.cts.CameraTest#testPreviewFpsRange

Change-Id: I0b3b3f13769bbd1db6f4f7194e58afc0f151eb47
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5313949
Reviewed-by: Dawn Han <dawnhan@google.com>
Tested-by: Chia-I Wu <olv@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2024-02-21 23:50:50 +00:00
Hang Nguyen
0c9b2096a9 i915.c: Allocate Intel compressed buffers with modifiers
Before the CL, the environment variable
|ENABLE_INTEL_MEDIA_COMPRESSION| control minigbm's behaviour
to allocate the appropriate Intel media compressed buffers.
This variable is set accordingly to a feature flag in chrome
to support video decoding.

This CL removes the environment variable and will let chrome
pass the DRM specific modifier via
gbm_bo_create_with_modifiers() instead. With the modifier
passed, the CL includes the change to have the driver
compute the metadata for the compressed buffers.

BUG=b:315390307
TEST=Video playyback on chrome with MC support.

Change-Id: I9671443cd233295dcb904d6edc995efd19c1013a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5118242
Tested-by: Hang Nguyen <hnt@chromium.org>
Commit-Queue: Hang Nguyen <hnt@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2024-02-07 01:57:48 +00:00
Chia-I Wu
d5420cce7f i915: report GBM_BO_MAP_CACHE_WC for scanout
If a bo has BO_USE_SCANOUT, and it is ever scanned out, the kernel
driver changes its cache level to WC.  But the change is not reflected
in the guest.  Let's be conservative and report GBM_BO_MAP_CACHE_WC when
BO_USE_SCANOUT is set.

BUG=b:323433235
TEST=Squid works properly with cross-domain on volteer

Change-Id: I9325ffc0cfef8778917e13d5021ae884ac7a6dfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5255422
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2024-02-05 20:52:25 +00:00
Chia-I Wu
e701ddbf02 i915: report GBM_BO_MAP_CACHE_CACHED iff has_llc
BUG=b:239718180, b:306548532
TEST=no artifact in Camera FOV Calibration of CtsVerifier on rex

Change-Id: Ia6a0d689fefe20e52db2c62328c97f4aa3558b63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5254324
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Chia-I Wu <olv@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
2024-02-01 17:40:22 +00:00