Commit graph

65 commits

Author SHA1 Message Date
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
Fritz Koenig
afa4dedecd msm: Update P010 stride alignment
V4L2 aligns the stride of P010 to 256 while
NV12 is aligned to 128.  Previously the width
was doubled, but not the alignment.

BUG=b:259594959
TEST=v4l2_stateful_decoder -f test-25fps.vp9_2 -c P010 -w -m 1

Change-Id: I35f566178f02e2506861930cb348c05f9b5e27b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4214566
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Nathan Hebert <nhebert@chromium.org>
2023-02-02 20:43:29 +00:00
Rob Clark
206462b38d msm: Disallow mapping buffers with modifiers
GBM users don't know how to do CPU access to any buffer with a modfier.
So they have no business mapping them.

This fixes "jailbar" corruption resulting from something somewhere
trying to do sw rendering to a UBWC buffer

BUG=b:237708681
TEST=Alt-TopRowFullScreenButton on herobrine

Change-Id: Ideb80df17d4f174600b7f605f563f275655a88da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4195657
Tested-by: Rob Clark <robdclark@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
2023-01-27 00:20:31 +00:00
Rob Clark
99387a7176 Revert "minigbm/msm: disable UBWC for virtualization"
This reverts commit 7a1a7dbda3.

BUG=b:243681772
TEST=confirm UBWC usage in arcvm

Cq-Depend: chromium:3900312
Change-Id: I126353bd91b75b7656257da00bc6fdf7d4c17060
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3900553
Reviewed-by: Chia-I Wu <olv@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Tested-by: Rob Clark <robdclark@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
2022-09-16 14:43:02 +00:00
Jason Macnak
80f664c422 minigbm: passthrough SENSOR_DIRECT_DATA via gbm frontend
BUG=b:238609372
TEST=vts -m VtsHalSensorsV2_1TargetTest

Change-Id: I37834f80d71e453e6e29b88198efc1584c109456
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3773926
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
Tested-by: Jason Macnak <natsu@google.com>
2022-07-26 23:41:35 +00:00
Yiwei Zhang
bbe1fd3a8c minigbm: passthrough GPU_DATA_BUFFER via gbm frontend
This is required for modern Android atop a gralloc with the cross_domain
backend or other native backend.

BUG=b:238609372
TEST=build and AHB cts

Change-Id: Id963eeec62c4400cc009384e127c93588c99346e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3777566
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2022-07-21 05:37:37 +00:00
Rob Clark
29daef0984 msm: Handle YVU420_ANDROID and YVU420 identically
With arcvm, virtgpu_cross_domain.c in the host remaps YVU420_ANDROID to
YVU420, to avoid exposing custom DRM_FORMAT_x values in the API between
the host and guest.  Which means it expects identical behavior for both.
Fortunately, we can do this, provided that it is a single level+layer
(minigbm does not allocate anything more complex than non-mipmap 2D),
and not tiled/UBWC.  The latter constraint we can get away with because
NV12 is used for anything produced by hw.

BUG=b:238158981
TEST=cts-tradefed run cts -m CtsVideoTestCases

Change-Id: If1330340f84835643be7cf8cae95026cbcebf273
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3774456
Auto-Submit: Rob Clark <robdclark@chromium.org>
Tested-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2022-07-20 04:12:10 +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
7648f0649b minigbm: fix some formating
TEST=./presubmit.sh

Change-Id: Ia53da4264de6ab637a21ad55029024c52a253c0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3761444
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
2022-07-15 06:50:50 +00:00
Yiwei Zhang
7a1a7dbda3 minigbm/msm: disable UBWC for virtualization
This actually reverts commit 407eb0ebf3.
However, the rationales have been updated.

BUG=b:229147702
TEST=emerge and deploy and verified graphics working in crostini

Change-Id: I8f491daf14f97a5dbda797207886695a985e44e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3586372
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Commit-Queue: Chia-I Wu <olv@google.com>
2022-04-14 22:18:32 +00:00
Fritz Koenig
407eb0ebf3 Revert "minigbm/msm: Disable UBWC for video gtest"
This reverts commit 1d3637fbf6.

The browser has support for disabling bandwidth compression
by passing the |disable-buffer-bw-compression| flag.  This
makes the reliance on dlsym obsolete.

BUG=b:171260705
BUG=b:220910969
TEST=video_decode_accelerator_tests

Change-Id: Ic4d88b28c3a2cc095e5f782fc2255032ae20d281
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3150967
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
2022-02-24 19:24:15 +00:00
Rob Clark
06cf1f1faf msm: Support fp16 and rgba1010102 formats
These are needed by vrend.

BUG=b:216322701
TEST=n/a

Change-Id: I19351e7f72b9b5d205176ef6466889c3260407fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3413989
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Dominik Behr <dbehr@chromium.org>
2022-01-26 21:39:22 +00:00
John Stultz
0a4229eae4 minigbm: msm: Allow for build-time method to disable DRM_FORMAT_MOD_QCOM_COMPRESSED on NV12
Currently when we allocate a NV12 buffer, it ends up being
created with the DRM_FORMAT_MOD_QCOM_COMPRESSED modifier.

Unfortunately the upstream venus driver doesn't actually
understand drm buffer modifiers. So video decoder output
buffers are written to in uncompressed NV12.

Then when the buffer is set to the GPU or display, we end up
treating the uncompressed NV12 data like compressed data.
Which produces garbage output.

This patch adds a build option which disables UBWC compression
on just NV12 buffers.

A follow up patch to the Android.bp (only in the AOSP tree) will
be made to enable this.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Ib064ff9f3978bd8847355c5fd1cc9346b551efd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3265874
Reviewed-by: Rob Clark <robdclark@chromium.org>
2021-12-02 01:33:01 +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
26e16cbd64 msm: remove scanout and ecoder use_flags for YV12
BUG=b:194817426
TEST=db845c external webcam works

Change-Id: Ib4abb5caa86bc40fbb56c22667f8c11205b920eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3195656
Tested-by: John Stultz <john.stultz@linaro.org>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
2021-10-01 19:57:01 +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
Fritz Koenig
2471aa23ea msm: Add P010 support
7180 can produce P010 frames, but they can't be
scanned out.  7280 can produce and scan out.

BUG=b:183020822
TEST=v4l2_stateful_decoder -f vp9_2_test_file.ivf -o P010

Cq-Depend: chromium:3100276
Change-Id: I79cc60f26268cccd683a45609384b62a752ae44c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3100277
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Auto-Submit: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
2021-08-24 22:11:28 +00:00
John Stultz
d9381b6628 minigbm: msm: Allow DRM_FORMAT_YVU420_ANDROID for camera, encoding and display use
In order to support external/usb camera provider on db845c with
AOSP, add flag combination for the YV12 format so is_supported()
will succeed.

Similar logic may be needed elsewhere as well

Bug: b:194817426
Test: Manually run camera app in AOSP on db845c with usb webcam
Change-Id: Idcb98e93164eb51c58943f0ae992d8123b6ede68
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3058396
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-08-03 20:56:57 +00:00
Gurchetan Singh
45ca4495d0 minigbm: run presubmit.sh
Am I the only one who does this????

BUG=none
TEST=none

Change-Id: Ie121703c631debd5e7eed1760334bb8ce5ebe115
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2857885
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-04-30 20:41:41 +00:00
Hanlin Chen
b7839748d1 minigbm: msm: disable uwbc for camera usage buffer
On msm camera stack, the usage of uwbc for camera buffer is disabled.
The path removes the usage to avoid format mismatch for camera buffer.

BUG=b:184725673
TEST=Android Camera APP preview works

Change-Id: I8eae5a944978934a66fab0e733e018b601ce00a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2847963
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hanlin Chen <hanlinchen@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Hanlin Chen <hanlinchen@chromium.org>
2021-04-26 08:23:24 +00:00
Gurchetan Singh
146ee021c0 minigbm: add gbm_bo_get_fd_for_plane
One more piece in aligning with Mesa GBM ..

BUG=b:145747113
TEST=compile

Change-Id: Ic9d5dad5705feccd7005f40370f59d0339fe8bfc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2803580
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-04-06 21:20:55 +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
695125c0b3 minigbm: add drv_resolve_format_helper
Removes duplicated code.

BUG=none
TEST=CQ

Change-Id: Iea59cc6ca20e13756b6121db7f5294855cc6cfcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2672509
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2021-02-04 19:14:50 +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
Pilar Molina Lopez
28cf2f1d70 minigbm: add buffer bandwidth compression flag to gbm device
Read MINIGBM_DEBUG env var when creating a gbm driver
Store value as a flag inside driver
Avoid allocating compressed buffers in the backends
when the flag disables compression

BUG=b:172215587

Change-Id: Idbd6f0aebc1782c1bf5921a6438310a87212d1f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2535658
Tested-by: Pilar Molina Lopez <pmolinalopez@google.com>
Commit-Queue: Pilar Molina Lopez <pmolinalopez@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2020-12-04 20:12:34 +00:00
Rob Clark
7278758909 minigbm/msm: Double pitch alignment for YUV
Something somewhere is assuming the UV pitch can be half of the Y pitch,
leading to failures with CtsMediaTestCases#android.media.cts.DecodeAccuracyTest

To componsate, double the pitch alignment requirement for YUV formats.

BUG=b:159504968, b:165333514
TEST=run CtsMediaTestCases#android.media.cts.DecodeAccuracyTest

Change-Id: I0118d813576654c72ed55500d741cf07a1977b20
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2568395
Commit-Queue: Rob Clark <robdclark@chromium.org>
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2020-12-02 16:20:56 +00:00
Fritz Koenig
1d3637fbf6 minigbm/msm: Disable UBWC for video gtest
video_decode_accelerator_tests need non UBWC
frames in order to check for exactness.  This
is expected to be a short term fix until a
proper verification method is devised.

BUG=b:171260705
TEST=YouTube has UBWC, video_decode_accelerator_tests does not

Change-Id: Ia3ab02493f8b740ba9589b4fc21d3fa6b23ea7cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2523246
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-11-09 23:36:43 +00:00
Gurchetan Singh
bbba9dde65 minigbm: stop faking the protected buffers
With real HW protection on the horizon, let's repurpose the
protection flag to mean that.

Currently, our protected buffer scheme on the Android side
allocates a dummy fd, which is sent to Chrome.  Chrome
associates that dummy fd with an unmappable shared memory
buffer.  In the entire process, minigbm doesn't really do
anything.

We prevent buffers allocated with the protected
flag from being mapped, but since it's a dummy fd it's not
really useful.

Chrome doesn't use the protected flag yet, but hopefully will
so in the future, but with real HW protection.

BUG=
TEST=

Change-Id: I57be26926539471f062ffeff33b523a3899c35f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2466958
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-10-14 04:32:55 +00:00
Gurchetan Singh
9964438dbb minigbm: reduce use of memset
Also run presubmit.sh.

BUG=none
TEST=compile

Change-Id: I6f5d2afca41c4228a4f8eb40f3670b39bce7b641
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2459529
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-10-12 21:56:58 +00:00
Fritz Koenig
b8226cb96d minigbm/msm: Enable UBWC for NV12 buffers
BUG=b:149525848
TEST=video_decode_accelerator_tests use UBWC

Change-Id: I66f44f31f69b2a1d32c66a802c21e0a76d95ec89
Cq-Depend: chromium:2460816, chromium:2455450
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2343729
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
2020-10-09 12:30:19 +00:00
Fritz Koenig
b03e9c85d0 minigbm/msm: Correct NV12 UBWC buffer allocation
V4L2 is the consumer of these buffers and sets up
the allocation in get_framesize_raw_nv12_ubwc().
There was a mismatch where V4L2 was aligning the
uv buffer differently than minigbm.

BUG=b:166157708
TEST=video_decode_accelerator_tests with 856x480 video

Change-Id: Idb9fb689a56639dbc73753d453e7e6e5daeb6700
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2402146
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-09-13 20:56:11 +00:00
Kristian H. Kristensen
2de95ecb06 msm: Clear all sw use flags for UBWC combinations
Whether rarely or often, we can't support any kind of sw access if the
buffer is UBWC compressed.  We could potentially add support for
blitting in and out of the buffer, but for now just allocate linear.

BUG=b:167934919
TEST=Buffers allocated with any SW access use flag don't get UBWC

Change-Id: Ic9c1d86a124e24b7bc4aa259c62d8c4882c487b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2397084
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
2020-09-09 21:12:09 +00:00
Kristian H. Kristensen
8f782d8532 Revert "msm: Disable UBWC briefly while we land the ARC++ modifier support"
This reverts commit 8e2ae67794.  With the
uprev from CL:2375596, we have support for modifiers all the way from
ARC++, through EGL and exo to KMS and can re-enable UBWC.

BUG=b:145579089, b:79682290, b:163562363
TEST=Once UBWC is enabled again in minigbm, ARC++ buffers should be UBWC
  compressed.

Cq-Depend: chromium:2375596
Change-Id: Iec9bb6f2057eb897fe119750f6a961bbefb871af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2375673
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
2020-08-27 20:53:18 +00:00
Kristian H. Kristensen
8e2ae67794 msm: Disable UBWC briefly while we land the ARC++ modifier support
BUG=b:145579089, b:79682290. b:163562363
TEST=Verify that UBWC is off (eg /sys/kernel/debug/dri/1/state)

Change-Id: Icc62960ea12c30bfa709e358ec1cfb097333e6fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2353749
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
2020-08-18 09:13:55 +00:00
Rob Clark
e48e4d7e58 minigbm/msm: Add workaround for waffle
Waffle does not support modifiers, detect it and fall back to linear
buffers.  Fixes glmark2-waffle, glbench/windowmanagertest, etc.

BUG=b:158238296, b:153675943
TEST=run glmark2-waffle and verify it displays correct
TEST=run graphics.Sanity and verify that it passes
TEST=start ui and verify that it still picks UBWC modifier

Change-Id: I591136c8d07bd32beb6f4efa63971821193ce39e
Exempt-From-Owner-Approval: already CR+2 from owner
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2343173
Tested-by: Rob Clark <robdclark@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
2020-08-10 15:50:39 +00:00
Douglas Anderson
0c03c9b54b minigbm/msm: Don't use uninitialized metadata to setup DRM_FORMAT_R8
CL:2245540 seems to have accidentally modified msm.c to use an
uninitialized metadata when setting up DRM_FORMAT_R8.  Let's go back
to using LINEAR_METADATA.

BUG=b:161426616
TEST=Camera no longer crashes

Change-Id: Ia587821216c82d4488b096686904f82147224aa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2310289
Tested-by: Douglas Anderson <dianders@chromium.org>
Auto-Submit: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
2020-07-22 14:49:54 +00:00
Hirokazu Honda
3bd681c62c Modify NV12 allowed buffer usages for camera capture use case
We use SCANOUT_VEA_READ_CAMERA_AND_CPU_READ_WRITE for camera
capture use scenario in Chrome. Therefore, NV12 format must be
allowed for all those usage masks. This CL modifies the usages on
all platforms.

BUG=chromium:982201
TEST=video.EncodeAccel.vp8_720p_i420 on eve

Change-Id: I7880e64049f3bbf9dd1c177619e41362baf641f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2240995
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2020-06-25 14:17:05 +00:00
Hirokazu Honda
fd8b8abd7f Remove HW_VIDEO_ENCODER usage of YVU420
minigbm has allowed HW_VIDEO_ENCODER usage to YVU420 so that
chrome can allocate YVU420 with HW_VIDEO_ENCODER. But this
format is no longer allocated by chrome with the usage. Let's
delete the code.

BUG=chromium:982201
TEST=None

Change-Id: Ia6bbc24e7782e3e73c2eb00c00127af212ddf486
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2245967
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
2020-06-18 06:10:36 +00:00
David Stevens
495181462f minigbm: add encoder/decoder blob combination
ARCVM sets encoder/decoder usage on the blob output/input buffers, so
that virtio_gpu knows to perform transfers from/to the host where
appropriate. Recently, virtio_gpu started passing all bind flags to the
host, instead of reducing them in the guest. These factors combined
means that the host backends now need to support encoder/decoder usage
with R8 format.

Test: manually verify ARCVM YouTube
Bug: b:158957350
Change-Id: I58bf657496647f8002c693d17a1186f4cf527b01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2245540
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-06-16 07:27:24 +00:00
Douglas Anderson
64b80ce3be minigbm/msm: Add DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED for msm
It seems to be tradition to copy a bit of code into the
resolve_format() function for everyone.  The msm driver isn't one to
break from tradition, so we'll adopt this code fragment too.

BUG=b:154782445
TEST=Hangout

Change-Id: I9e8eaf0c5a8485afea82437fd7249e24e5509b5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2209178
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
2020-06-05 22:52:48 +00:00
Gurchetan Singh
8d88474891 minigbm: run presubmit.sh, modify OWNERs
BUG=none
TEST=none

Change-Id: I07ae6fa603117f16dee39b1b7e9ca3162daa0c97
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2118462
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-03-24 21:02:36 +00:00
Jeffrey Kardatzke
afb2c56b57 minigbm/msm: Update msm for removal of kms_query
Recently kms_query was removed which then caused the NV12 texture format
here to use UBWC, which is incorrect currently. This updates the msm
code similar to other changes.

I'm somewhat guessing at this, so please review this thoroughly.

BUG=b:149190288
TEST=VDA tests pass on trogdor again

Change-Id: Ie3370623d324f8378d03bcc3562cd17561f5ba01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2083720
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
2020-03-03 18:33:28 +00:00
Jeffrey Kardatzke
e3cd0d38dc minigbm/msm: Add NV12 format for Android flex allocation
BUG=b:149344523
TEST=HW decoder playback on ARC works w/ test codec manifest

Change-Id: Ic4c8ed8466a783dd9779b529e96be85298fc680e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2072600
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
2020-02-26 23:52:07 +00:00
Jeffrey Kardatzke
a6a9efc138 msm: Don't height align R8, height 1 buffers used for camera output
We height align to multiples of 64 and the camera will create a height
one buffer of length 13MB for JPEG output with R8 format. If we see R8
format with height 1, then don't do the height alignment.

BUG=b:148152367
TEST=Camera app works on trogdor

Change-Id: I6e4260f37cc45fe3b7e9bd132844cbde4a58fc26
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2066796
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
2020-02-25 08:01:05 +00:00
Ricky Liang
f11f1dfcb5 msm: add camera use flags for NV12 and R8
NV12 is used by the camera stack for YUV buffers. R8 is used by the
camera stack as a blob format for JPEG images.

BUG=b:148152367
TEST=Manually with built-in camera app on Cheza

Change-Id: I484f1a5ede2dfece549706310d832086af087544
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2053665
Tested-by: Ricky Liang <jcliang@chromium.org>
Commit-Queue: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-02-24 07:03:15 +00:00
Jeffrey Kardatzke
6f266902d1 minigbm: Disable UBWC for texture formats
The venus driver doesn't understand UBWC formats yet so we shouldn't be
using them for texture formats that the video decoder writes to.

BUG=b:149190288
TEST=video_decode_accelerator_tests pass on trogdor

Change-Id: I572c7ff9e1bddcd58136772b3ced07f79a219cba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2055873
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
2020-02-16 03:10:00 +00:00
Fritz Koenig
e5c3fdf746 msm: Add scanout support for UBWC RGB8888
msm hardware does not support UBWC RGB, only BGR.
The creator and consumers know that UBWC buffers
are hw native format.  This is an opaque buffer
that will not be accessed outside of the gpu.

BUG=b:145579089
TEST=webgl aquarium goes to ubwc underlay

Change-Id: I4872958d00e1de623b2a9692249e88e4aa302334
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1960784
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Auto-Submit: Fritz Koenig <frkoenig@chromium.org>
2020-01-14 04:47:13 +00:00
Gurchetan Singh
298b757913 minigbm: factor out metadata from struct bo
Generated using coccinelle:

@@
struct bo *B;
@@

- B->width
+ B->width

BUG=chromium:924405
TEST=compile

Change-Id: I4da1731a650d198ce7f2bda3031a47b2f9c3041c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1815566
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:42 +00:00