The drivers now require a loader with a working useInvalidate hook.
If not enabled then "createNewScreen2" call will fail in mesa-22.2.0 onwards.
BUG=b:245687387
TEST= screenshot --internal /tmp/test.png
tast run <IP> graphics.GLBench
Signed-off-by: Ikshwaku Chauhan <ikshwaku.chauhan@amd.corp-partner.google.com>
Change-Id: I0f7319fb7193be6ea938209413e8fbfe3b7f0c93
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3941506
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
This is required for importing multi-plane modifiers where the
format plane count is lower (usually `1`). It will be used
by Exo for v3/4 of the `zwp_linux_dmabuf_v1` Wayland potocol,
allowing Wayland clients (and thus all clients that build on
the Wayland support) to use explicit modifiers which again
can increase performance on many GPUs.
Also add another fallback path to `dri_num_planes_from_modifier()`
for cases when `queryDmaBufFormatModifierAttribs()` fails and do
some refactoring there. Without this, some test apparently fail.
This includes the amdgpu part of
commit 1a733377e9, partially reverting
commit 853b8542fb.
Bug🅱️224580219
Change-Id: I93b64123420b39f3b83ff1bbbb9c59ddf4bc6105
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3568489
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Robert Mader <robert.mader@collabora.com>
Commit-Queue: Robert Mader <robert.mader@collabora.com>
Previously these would get leaked if we had multiple bo structs
pointing to the same image/GEM BO as each has their own DRI image,
but bo_destroy only gets called on the last struct.
To mitigate this we have a new callback for every struct where we
can free the DRI image.
BUG=b:185869479
TEST=Repeatedly open/close camera app on Grunt.
Change-Id: I6188346b5bf9e5cbbbbf32a3db621a3fe0276d4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3270684
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@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 virtualization purposes we always want to have a modifier. With
radeonsi that means allocating with modifiers. This has the
complication that the structure of modifiers isn't trivial.
Three implementation options:
1) Add dri-flag to create bo with valid modifier
2) Figure out scanout capable modifiers in minigbm
3) Take scanout capable modifiers from kernel.
3 is an issue because the card node is often behind a video group
on desktop linux and we don't want to create something that won't
work on desktop linux.
For 2 I figured out that the structure is actually fairly simple if
we assume that the DRI driver doesn't provide useless modifiers.
For 1 we'd end up having to do the same work as 2 + define the
DRI interface + maybe have to deal with older somewhat buggy kernels.
So I ended up selecting 2.
Note that this also removes CURSOR usage in the old path with DRI
On AMD we only allow linear for the cursor so this gets handled
in the linear path.
BUG=b:192390822
TEST=Run vkcube on zork-arc-r.
Change-Id: Ibde0e2ec761e293486c8ee71cfd88d9846ba09da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3086527
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
We were using the wrong attribute resulting in an error ...
BUG=b:192390822
TEST=Run vkcube on zork-arc-r
Change-Id: Id1bcfc08497ae215c821b4c8b9060390fdf08b7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3118294
Reviewed-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
The string gets allocated in libdrm with strdup so it is the callers
responsibility to free. While at it, also add a proper NULL check, as
NULL can be returned (e.g. when the file doesn't exist in a container).
Found by inspection.
BUG=none
TEST=compile and confirm the UI still starts on Zork.
Change-Id: Ib8701f7a15f030458885eade0effe5c8fe09dc83
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3017875
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Virgl are expecting host gpm can handle this format, so just
enable this for amdgpu.
BUG=b:177032502
TEST=manual - run CtsNativeHardwareTestCases on zork-arc-r
Change-Id: I574d3bfda5a86a6a42790cd02edc137f0e367471
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2850989
Tested-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Lepton Wu <lepton@chromium.org>
- Sometimes were return -1 and sometimes -errno. Prefer -errno
wherever possible.
- No braces for single line if/else statements. This does not
apply gralloc3/gralloc4, since that directory follows AOSP
style.
BUG=b:178495907
TEST=Cuttlefish CFI
Change-Id: I4c35768e015109730772a972b4b18e8d2c3cbb9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2665001
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
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>
They were added to the AMDGPU driver but only half of the formats
were in the mapping table.
Fixes: b16076b "amdgpu: Add 10-bit color formats."
BUG=b:161136516
TEST=run graphics_Gbm on Grunt
Change-Id: I445da2df7b049e3c18456b978a79b28d5b7d008a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2297423
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Drew Davenport <ddavenport@chromium.org>
I cut a corner here on a previous patch and apparently it is used.
Since DRI does not give us useful horizontal & vertical strides
(especially considering things like auxiliary surfaces), do this
calculation based on offsets & buffer strides.
BUG=1061315
TEST=test_that graphics_Gbm on Zork.
Change-Id: Idbca7ce42f4f8a692129a2f8ab5d9c3ccd796496
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2100795
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
This adds modifier support to minigbm in the amdgpu driver.
This includes
(a) creation of images with modifiers
(b) imports
- Had to distinguish between legacy and non-legacy.
(c) Support for planes > format planes
BUG=b:149819940
TEST=Login on a Zork device + play a YT video.
Change-Id: If58ada081aa254932e299536c48c18937266c2e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093212
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
If the driver does not implement the new function, or
if modifier is INVALID this should return exactly the
same as before.
For LINEAR, DRI should return exactly the same as
minigbm for all the YUV formats.
BUG=b:149819940
TEST=Use with followup patch and login on a Zork device + play a YT
video.
Change-Id: I6ea3b5827876844e510794b85212be51e5dfd68f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093211
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
I tried kernel with modifier support and userspace without and it
failed due to having a linear (which is 0) modifier for the tiled
textures. Set the modifier explicitly.
BUG=b:144023522
TEST=Chrome shows the login screen on zork (with some other bugfixes)
Change-Id: I806d3bb744e52d094e5b852679057cea3f0bcad0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2043848
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
Dri backend is not used for the all use flags. When same fd is
shared between dri backend and the minigbm drv, they end up using the
same kernel DRI context.
BUG=b:111081134
TEST=cheets_SurfaceComposition
graphics_Gbm
graphics_Gralloc
Change-Id: I47ae12391acfc9c947e8281de11472fcdf5dec5b
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1164972
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
In dri path the bo handle is not closed in bo destroy. This was
resulting in memory leak. Closed the bo handle in bo destroy.
BUG=b:80546783
TEST=graphis autotest suite
Change-Id: I8d9c7fbc87fd80d03be7d9a98ac8aa95f0d175ed
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1117975
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
mapImage can return a different stride value. This value must be
used for the mapped address.
BUG=b:38152101 b:79346377
TEST=graphics_Sanity autotest passed
Change-Id: Ie0eb716291366ae6a047d704f66d24ec41738713
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1041369
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It is incorrect to force linear for BO_USE_SW usage as mapImage
in dri_bo_map converts tiled data and returns linear.
BUG=b:78200321
TEST=drm_cursor_test completes within 20 seconds.
Change-Id: Ifa3ca2218cee9ff52b049a984a70a54f4899965d
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1041448
Commit-Ready: Drew Davenport <ddavenport@chromium.org>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>