Commit graph

11 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
Jason Macnak
4cca6f67dd Error when attempting to lock 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
2024-08-02 08:18:36 -07:00
Lloyd Pique
b20510aefc virtgpu_virgl: use blobs for ABGR8888
This is slightly modified version of another patch originally created by
David Stevens (stevensd@chromium.org), but since reverted.

https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3256451

Use blob buffers for ABGR8888 format buffers. This is necessary on ARCVM
to mitigate a performance problem with the
`testSurfaceTransaction_setEnableBackPressure` test from the
`CtsViewTestCases`, as the test expects to be able to read back rendered
buffers at 60fps.

Almost all the code is the same, with the only differences (besides some
minor conflict resolutions resurrecting this patch) being in the
switch statement in `should_use_blob` in `virtgpu_virgl.c` where a check
for ABGR8888 is added.

The rest of the change is as authored by stevensd@, which requires
knowing the host buffer layout before creating the blob resource, and
using an LRU cache of layouts to avoid the overhead of querying the host
every time a buffer is created.

As noted in stevensd@'s CL, virgpu_cross_domain will be the preferred
replacement to virgpu_virgl, and which is expected to have better
performance without this kludge.

TEST=CtsViewTestCases on hatch
BUG=b:235308831

Change-Id: Ia58573a8477e0c17239d6a0768ee53782fac1dd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4505920
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Lloyd Pique <lpique@chromium.org>
Auto-Submit: Lloyd Pique <lpique@chromium.org>
Tested-by: Lloyd Pique <lpique@chromium.org>
2023-05-09 23:42:32 +00:00
Dawn Han
3940cbd883 minigbm: move camera work-around
Move mt8183_camera_quirk_ into struct cross_domain_private.
Add a helper `drv_get_os_option` in `drv_helper` to query os option.
Advertise DRM_FORMAT_MTISP_SXYZW10 as supported format in virtgpu_cross_domain.c.
Implement cross domain's own resolve_format_and_use_flags entry point.

BUG=b:269982880

TEST=tested on a kukui machine after applying the change. Camera and
screen recording works fine.

Change-Id: Ia0d6e2cc701477aa6b9542de84e24f8aeb5a29e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4304961
Commit-Queue: Dawn Han <dawnhan@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Dawn Han <dawnhan@google.com>
2023-05-02 21:06:13 +00:00
Dawn Han
ad7928ef46 minigbm: remove close_gem_handle
There are two gem close handles. Remove one of them and use `drv_gem_close` instead.

Bug=b:266776512
TEST=cts

Change-Id: I4dd1ab884626623e7d5f2024296c241cf75a9402
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4461311
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Dawn Han <dawnhan@google.com>
Commit-Queue: Dawn Han <dawnhan@google.com>
2023-04-24 18:27:13 +00:00
Chia-I Wu
5ff4a55d37 drv: pass stride_align to drv_bo_from_format
drv_bo_from_format will apply stride_align to all planes.  Since we
always pass 1 for stride_align, there is no change except when the
format is DRM_FORMAT_YVU420_ANDROID.

When the format is DRM_FORMAT_YVU420_ANDROID, and when stride_align is 0
or 1, drv_bo_from_format assumes there is no hw requirement and forces
stride_align to 16.  But because we used to require stride to be aligned
to 32, there is no actual change either.

BUG=b:265746435
TEST=subset of CTS and CTS Verifier on grunt, guybrush and skyrim

Change-Id: Ia6ef89bb744c39d2baead07bc47f11b0eea96b97
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4336265
Tested-by: Chia-I Wu <olv@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Dawn Han <dawnhan@google.com>
2023-03-15 05:13:37 +00:00
Dawn Han
ecbc89179e minigbm: Remove plane in bo_map
Remove the parameter to align with upstream gbm.
For some places that use the number of planes. The number is 1. The
multi-planar formats are being allocated into a single plane, and
minigbm exynos backend is dropped. So we can just set the plane
index to 0 if needed.

Fixed the format in i915.c.

Bug=b:266776512
TEST=camera works after deploying the change #strongbad
TEST=camera works after deploying the change #corsola

Change-Id: I0880917754c01b9d0f27d21f3c42d87f00a09f50
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4249501
Commit-Queue: Dawn Han <dawnhan@google.com>
Tested-by: Dawn Han <dawnhan@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
2023-02-27 19:34:38 +00:00
David Stevens
a1b820fa9f Revert "virtgpu_virgl: use blobs NV12 encoder input"
This reverts commit 7eb9e826a7.

Reason for revert: b/260322776

Original change's description:
> virtgpu_virgl: use blobs NV12 encoder input
>
> Use blob buffers for encoder NV12 input, even when software access is
> required. This is helpful for ARCVM, since the v4l2_codec2 stack
> sometimes needs to do a format conversion in the guest as the
> virtio-video encoder only supports NV12/I420 input.
>
> Supporting this requires knowing the host buffer layout before creating
> the blob resource. This is done by creating a temporary resource to
> query the layout. To avoid the overhead of querying the host every time
> a buffer is created, the allocator process keeps a cache of the most
> recently used buffer formats and their host layout.
>
> Creating temporary resources to discover host buffer parameters is a bit
> of a cludge. However, since virtgpu_virgl will eventually be deprecated
> in favor of virtgpu_cross_domain, a self-contained and simple approach
> like this gives some nice performance gains on low end devices.
>
> TEST=decode-edit-encode workflows
> TEST=Cts{NativeHardware,Camera,Graphics,Video}TestCases on volteer
> BUG=b:203380807, b:232531771
>
> Change-Id: Ibda500862b42680ba898ba689e1600ebe5d258bd
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3256451
> Auto-Submit: David Stevens <stevensd@chromium.org>
> Reviewed-by: Lepton Wu <lepton@chromium.org>
> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
> Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
> Tested-by: David Stevens <stevensd@chromium.org>

Bug: b:203380807, b:232531771
Change-Id: I36d3ce104c71461e931d0413ab4b00588f02ee22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4060933
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2022-12-01 01:31:03 +00:00
David Stevens
7eb9e826a7 virtgpu_virgl: use blobs NV12 encoder input
Use blob buffers for encoder NV12 input, even when software access is
required. This is helpful for ARCVM, since the v4l2_codec2 stack
sometimes needs to do a format conversion in the guest as the
virtio-video encoder only supports NV12/I420 input.

Supporting this requires knowing the host buffer layout before creating
the blob resource. This is done by creating a temporary resource to
query the layout. To avoid the overhead of querying the host every time
a buffer is created, the allocator process keeps a cache of the most
recently used buffer formats and their host layout.

Creating temporary resources to discover host buffer parameters is a bit
of a cludge. However, since virtgpu_virgl will eventually be deprecated
in favor of virtgpu_cross_domain, a self-contained and simple approach
like this gives some nice performance gains on low end devices.

TEST=decode-edit-encode workflows
TEST=Cts{NativeHardware,Camera,Graphics,Video}TestCases on volteer
BUG=b:203380807, b:232531771

Change-Id: Ibda500862b42680ba898ba689e1600ebe5d258bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3256451
Auto-Submit: David Stevens <stevensd@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
2022-11-16 01:37:22 +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
Renamed from helpers.h (Browse further)