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>
minigbm gralloc + gfxstream on the host will always fail the get caps
ioctl, but gralloc itself still works fine.
TEST=build and run the emulator
BUG=b:322199104
Change-Id: I35ebbdddbfb050ead76d61626f13f028cf909229
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5241884
Auto-Submit: Kaiyi Li <kaiyili@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Tested-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Prior this change the format modifier was not set for blob's meta, which
lead to incorrect reporting of format modifier to clients.
This changes fixes this issue.
BUG=b:267299128
TEST=ExoPlayer demo app
Change-Id: I15c2f9095d3cb20e2a5a34d749af6657e98f7ba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4628256
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
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>
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>
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>
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>
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>
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>
This is a workaround until the consumer side surface expresses the
intended usage bits to resolve.
BUG=b:264408280
TEST=build
Change-Id: Icf631f026b5d4d9b465cf16e48ccb86694ac6f16
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4159974
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Alan Ding <alanding@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
DRM_FORMAT_FLEX_YCbCr_420_888 gets the fallthrough but
DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED is missed. This change updates to
resolve flexible format into explicit format first and then further
resolve explicit format in a 2nd pass.
BUG=b:260032660
TEST=cts
Change-Id: I69724f5845299a79a315ab32ddf5a207cdfa26b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4133686
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
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>
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>
Format is no longer used when computing virgl bind flags, so drop the
parameter.
BUG=None
TEST=compiles
Change-Id: I7c0526584c442f981aa1b109c6b785a01d1e7ddf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4014226
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Venus device memory mapping setup must succeed for AHB VkBuffer.
Meanwhile, the imported AHB can be allocated with only GPU_DATA_BUFFER
flag. So we must add mappable flag in virtgpu backends accordingly.
BUG=b:246814802
TEST=Blob_BlobTest_GpuDataBufferVertexBuffer_BLOB
Change-Id: I88f63c732d3b133daf755d73ed54578605d27112
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3896159
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
In recent kernel versions virtgpu reports support for the linear
modifier due to commit "drm: add support modifiers for drivers whose
planes only support linear layout" [1].
This causes the UI to when it calls gbm_bo_create_with_modifiers; it
hits an early return in drv_bo_create_with_modifiers due to the
virtgpu backend setting neither bo_create_with_modifiers nor
bo_compute_metadata.
Fix by adding a virgl_bo_create_with_modifiers modeled on
dumb_bo_create_with_modifiers. If the requested modifiers include
the linear modifier, pass the request on to virgl_bo_create.
Otherwise fail with EINVAL.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8be576837b6e62b2ad0de2f9ba31cef618fa2891
BUG=b:243569755
TEST=Deploy minigbm to a reven-kernelnext VM
TEST=Restart UI, observe UI is no longer black
TEST=Logs don't show "Failed to create scanout buffer" errors
Change-Id: If8d02225a7a50600b5ae4685cc963ad391bd9bf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3862241
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Dominik Behr <dbehr@chromium.org>
Tested-by: Nicholas Bishop <nicholasbishop@google.com>
Auto-Submit: Nicholas Bishop <nicholasbishop@google.com>
... as the host may write to the buffer in a compute shader.
BUG=b:234513607
TEST=cts -m CtsNativeHardwareTestCases -t
android.hardware.nativehardware.cts.AHardwareBufferNativeTests#Blob_BlobTest_GpuDataBufferCpuRead_BLOB
Change-Id: Ied49e7861e9ae0cbc9e25ecfb7feec30cc733864
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3688450
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Implementation defined camera outputs can enable
'BO_USE_TEXTURE' at the consumer side in cases where
the producer/camera overrides the pixel format to P010.
BUG=b:216308391
TEST=`atest RobustnessTest#testMandatory10BitStreamCombinations`
Change-Id: I21946cc7e4db14f207942ecce2c1cf8269790024
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3418596
Auto-Submit: Emilian Peev <epeev@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Emilian Peev <epeev@google.com>
Commit-Queue: Emilian Peev <epeev@google.com>
... to that of SwiftShader + ANGLE (SwANGLE). With SwANGLE,
GL_MAX_TEXTURE_SIZE comes from a combination of
VkPhysicalDeviceLimits::maxFramebufferWidth and
VkPhysicalDeviceLimits::maxImageDimension2Dcomes to meet GLES 3.1
requirements (see https://crrev.com/c/1917130).
BUG=b:194426249
TEST=`cts -m CtsNativeHardwareTestCases` with aosp/1845813
Change-Id: Ia14f241b59742c1bb864ef8f6e19de82bbe8fba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3208931
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
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>
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>
For guest running 3d virtgpu_virgl atop 2d virtgpu_virgl as host gbm
backend. Common and required scanout capable formats on the guest side
will fail virgl_supports_combination_natively check, resulting in
advertising no scanout support to the guest.
This change adds the same logic to resolve_use_flags before checking
support or asking for allocation to accommodate accordingly. Then
whether to strip scanout use_flag can align with native support on those
guest side scanout capable formats.
Advertising scanout for NV12 needs to go through virgl_add_combination
as well for the native support check. This is fixed by this CL.
The logic to strip scanout needs to be scanout use_flag specific to
avoid accidentally stripping scanout when the format fails texture check
but later passes the emulation check because scanout has been stripped.
This is also fixed by this CL.
BUG=b:200969382
TEST=CQ and camera interop works
Change-Id: I9126773a1ee49d4cdaf1f7186612d5f4f5c6200e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3180981
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
When format plane is single, it's still possible for the host image
memory to have multiple planes for auxiliary planes for non-linear
modifiers.
Relying on the non-zero stride to retrieve the actual strides and
offsets info.
BUG=b:197899093
TEST=run Vulkan apps on zork-arc-r
TEST=run guest video/camera apps
TEST=CtsNativeHardwareTestCases and related CtsGraphicsTestCases
Change-Id: Id80f143de114bbe9252c40b46dcfb835085c754d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3120411
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
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>
Deprecating the allocation fallback for formats not supporting scanout
in virtgpu_virgl causes issue for camera interop where NV12 is a format
required by camera interop. Host drv backends already have such support.
BUG=b:199524294
TEST=camera apps working in arcvm
Change-Id: Ifa94695491ae9d172b147c51b8eeec8180a440f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3140575
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Refactor DRM_FORMAT_ABGR2101010 and DRM_FORMAT_ABGR16161616F into
texture formats since BO_USE_TEXTURE_MASK covers BO_USE_SW_MASK.
Refactor to remove the redundant advertisement of DRM_FORMAT_NV12 and
DRM_FORMAT_NV21 in the 2d path as the formats are already inside
dumb_texture_source_formats, and BO_USE_TEXTURE_MASK is a superset of
BO_USE_SW_MASK and BO_USE_LINEAR.
BUG=b:199524294
TEST=build
Change-Id: I89e315d2870ecf974157dfaec69d0c50453727f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3169570
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>
Currently, there is no way to coordinate buffer metadata between the
host and guest for blobs, so blobs which the guest will access can only
be used if the format is fully defined. Android's YV12 format (which
resolves to YVU420_ANDROID) is sort of fully defined, but some backends
don't actually use metadata that matches what the virtgpu_virgl expects.
As such only use blobs for YVU420_ANDROID when no SW access is required
(which is probably never, but it's straightforward enough to treat the
format the same as NV12).
Android's specification for YV12 is complicated by the fact that it
actually has two slightly different requirements depending on the use
case. The format itself requires that its stride be aligned to 16 bytes.
However, if the format is used with the long deprecated camera v1 APIs,
the stride must be the smallest possible 16 byte aligned value. The
various minigbm backends fulfil the format's stride alignment
requirement, but none actually fulfil the old camera API requirement.
Since this doesn't seem to be causing any problems in practice, either
in CTS or in any known apps, let's just leave it as is.
BUG=b:193205558, b:192516923, b:187462083
TEST=android.media.cts.EncodeDecodeTest on zork-arc-r
TEST=android.media.cts.VideoDecoderRotationTest on zork-arc-r
Change-Id: I3567cb166ab1cc547defb328b1ae697b4c3f55fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3088673
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
ARCVM's wayland compositor typically handles scanout buffers, but it can
fall back to texture buffers when the format doesn't support scanout.
These buffers can still end up being sent over virtwl, so any blob
resources with Android HW_COMPOSITOR usage need to have the
VIRTGPU_BLOB_FLAG_USE_CROSS_DEVICE set. In particular, this affects
output of SW decoders, as such buffers have no other HW usage flags set.
The simplest solution is to set the cross device flag on all blobs. This
can be revisited later if we add wider support for blobs.
BUG=b:194691227
TEST=android.mediav2.cts.CodecDecoderSurfaceTest on 5.10-arcvm kernel
Change-Id: I9baf65096eb2cb1f7d1190a52765254d7b0a2356
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3068681
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
BO_USE_FRONT_RENDERING was added to the RENDER/TEXTURE/SW_MASK masks in
crrev/c/2800148. This patch just maps the BO_USE_FRONT_RENDERING usage
flag to silence the log spam of "Unhandled bo use flag: 10000".
TEST=no more log spam from this BO usage
Change-Id: I4d5d573d700a172ae4eb387a46e60a38394af859
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3012831
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
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>
Enable basic 10-bit YUV P010 buffer support for use
with camera and image readers.
This is upstreaming aosp/1576366
BUG=b:147711411
TEST=Camera CTS
Change-Id: Ieaeda7189b528ec603390ff1b2012f582c627eae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2946769
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
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>
This change provides a route to the host side "cross domain"
allocator, which is specialized for resource sharing across domain
boundaries. It uses the upcoming CONTEXT_INIT ioctl to initialize
the backend when available, and multiple timelines to perform
metadata queries.
While it would be awesome to use the revolutionary Address Space
Graphics (ASG) algorithm for metadata queries, it would be
non-trivial to pull off in minigbm.
Key aspects of the cross-domain allocator are:
* Intelligently falls back to OpenGL texture allocation host-side
when external memory is not available. The fallback path is
named "virgl", even though it encompasses gfxstream and 2D mode.
More refactorings will be added in the future for further
clarity.
* Uses host Vulkan or minigbm to perform metadata query, and uses
a cache to minimize vmexits.
* No shadow memory. Only zero-copy blobs will be supported if the
blob is mappable. Shareable blobs may be compressed or tiled if
not mappable.
* A commitment to sharing code across Google projects and
cross-platform GPU virtualization.
The main goal here is to enable faster interation/testing, so this
code is just a prototype. It should be fine to merge via minigbm,
since the project has a very chill philosophy and even proudly
accepts code that doesn't make any sense (crrev.com/c/2583188)
[so long as existing users are not broken].
BUG=b:173630595
TEST=launch virtual machine with 2D mode
TEST=launch virtual machine with 3D mode
Change-Id: Ie33a46f19e5cdd82a2ac03bcf2351f4a8f294970
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2691716
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>