Commit graph

13 commits

Author SHA1 Message Date
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
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
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
Yi Xie
464fee5671 minigbm: Align BO tile size for llvmpipe on dumb driver
Mesa's llvmpipe software renderer generates instructions that require
memory to be aligned properly, otherwise it will crash with general
protection exception. To support crosvm on headless VM with vkms we'd
like to always align memory properly on dumb driver.

BUG=b:239110721
TEST=Run betty-arc-r on headless VM with vkms enabled

Change-Id: I4b119f450cbb9b36d0d35d37be9ca97102924963
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4134929
Tested-by: Yi Xie <yixie@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yi Xie <yixie@chromium.org>
2023-01-13 14:24:45 +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
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
3a171db9be gralloc: move the logic to strip BO_USE_HW_VIDEO_ENCODER to the backends
BUG=b:199524294
TEST=CQ

Change-Id: I2b36a0ef17cd6ecb77723d4a9d95196ad27ff4ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3200148
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Chia-I Wu <olv@google.com>
2021-10-05 11:05:13 +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.c (Browse further)