Commit graph

47 commits

Author SHA1 Message Date
Jean-François Thibert
fd19358a25 Revert^2 "Merge upstream-main into main"
This reverts commit b7a9a2b7d5.

Reason for revert: Crash resolved by Ieb07b5bbc206f07f69e4afba921149f49d6fe8c4
Bug: 349870098

Change-Id: I49848f6e7311c1f44e6c988cb42107ed79da3a6b
2024-07-03 18:21:13 +00:00
Jason Macnak
b7a9a2b7d5 Revert "Merge upstream-main into main"
This reverts commit 018f7ff8fa.

Reason for revert: b/349870098

Change-Id: I942c713e4f7a24881b7ea3cff30df13a2b4a7c9c
2024-06-27 21:40:26 +00:00
Ryan Neph
698c5e9e8d minigbm: #define MINIGBM_HAS_GBM_BO_GET_MAP_INFO
Mark the availability of minigbm's newer gbm_bo_get_map_info() API.

Virglrenderer (and others) can test for its existence at build-time and
conditionally use it.

BUG=b:338254311
TEST=emerge minigbm
TEST=virglrenderer can conditionally build with gbm_bo_get_map_info()

Change-Id: I2685813fa99b73316477bef7edfd96e5dd9699a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5636516
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Tested-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dawn Han <dawnhan@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2024-06-18 03:02:33 +00:00
Marcin Radomski
40b28f098a minigbm: add gbm_{bo,surface}_create_with_modifiers2
Rationale: this will help get Rust gbm bindings into Android
(go/drm-gbm-rust-crates-for-android) without needing minigbm-specific
patches to upstream Rust code.

Upstream Mesa gbm defines those functions as variants with an extra
"flags" argument[2][3] (these don't exist in the mesa version checked
into Chromium though). The definitions added in this CL provide variants
that fail for any non-zero flags.

[1] https://crates.io/crates/gbm
[2] b7d6d90dab/src/gbm/main/gbm.h (L303)
[3] b7d6d90dab/src/gbm/main/gbm.h (L443)

Bug: 328363177
Test: cros build-packages --board=amd64-generic minigbm drm-tests
Change-Id: I9284d597e2d4de5ff9b677db0a0ffe6d274e4f57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352371
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Marcin Radomski <dextero@google.com>
Tested-by: Marcin Radomski <dextero@google.com>
2024-03-12 11:19:37 +00:00
Marcin Radomski
3b508e145f minigbm: use int instead of size_t for plane index
Rationale: this will help get Rust gbm bindings into Android
(go/drm-gbm-rust-crates-for-android) without needing minigbm-specific
patches to upstream Rust code.

Mesa gbm defines the plane argument for some functions as int rather
than size_t. While this doesn't bother C/C++ compilers too much,
attempting to use bindgen-generated Rust bindings to minigbm with gbm
Rust crate[1] fails.

[1] https://crates.io/crates/gbm

Bug: 328363177
Test: cros build-packages --board=amd64-generic minigbm drm-tests
Change-Id: I5938633e0936bf1b9aafb856bfb966ceb1fb1a2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5352370
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Marcin Radomski <dextero@google.com>
Tested-by: Marcin Radomski <dextero@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2024-03-12 11:19:34 +00:00
Rob Clark
958cd774ae minigbm: Add an API to return cache attributes
Crosvm currently makes the simplistic assumption that if driver==i915
then cached mappings to guest should be used for minigbm allocated
buffers.  But this may not always be the correct choice.  And other
drivers can do cached mappings to, in certain cases.  But on ARM devices
in particular, we should be consistent in cachability when it comes to
CPU mappings.  So add a new minigbm API which crosvm can use to
determine how to map to guest.

BUG=b:239718180, b:306548532
TEST=no artifact in Camera FOV Calibration of CtsVerifier on rex

Change-Id: I5c9b6346270f6a2eb83e6637a911f2153f6120ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3777567
Tested-by: Chia-I Wu <olv@google.com>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Chia-I Wu <olv@google.com>
2024-02-01 17:40:19 +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
Miguel Casas
231913e757 minigbm: support P010 SCANOUT
This CL adds GBM_FORMAT_P010 which somehow wasn't there (Chrome used
DRM_FORMAT_P010) and adds SCANOUT support for it: P010 can be
scanned out in JSL and TGL (Gen 11 and Gen12 GPUs).

crrev/c/2808787 adds P010 support to drm-tests plane_test.

[1] https://source.chromium.org/search?q=I915_SCANOUT_Y_TILED

BUG=b:183760490
TEST=on volteer:
  /usr/bin/plane_test -f P010
  /usr/bin/plane_test --format NV12 --size 600x400 -p --format P010 --size 200x200 -d 200,200
work as expected.

Change-Id: I535b05102ab8d2c3bd7cd0d63029bfca5fe3d79f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2808788
Tested-by: Miguel Casas <mcasas@chromium.org>
Auto-Submit: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
2021-04-08 06:55:47 +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
dcdd245451 minigbm: remove gbm_bo_map(..) discrepancy
We can now use the upstream gbm_bo_map(..) prototype.

BUG=b:145747350
TEST=compile

Change-Id: Ic3e25ebad903da29be4eb085e5a46bf8109de63f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2118475
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
2020-09-10 23:54:47 +00:00
David Stevens
26fe682306 Reland "minigbm: introduce test allocation"
This reverts commit 08d8dbf094.

The original change returned early from drv_bo_create_with_modifiers,
which broke reference counting. This must have hit some race condition
in the tests, as they no longer flake after fixing reference counting.

Original change's description:
> Revert "minigbm: introduce test allocation"
>
> This reverts commit f0e607c7d4.
>
> Reason for revert: caused flaky regressions across the board.
>
> BUG=b:150997559
> Exempt-From-Owner-Approval: revert.
>
> Original change's description:
> > minigbm: introduce test allocation
> >
> > This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
> > for the creation of fake buffers that can be used to determine buffer
> > metadata without actually allocating a full buffer. The new flag is
> > supported by the i915 backends. This flag also alleviates the need to
> > cache buffers when virtio_gpu queries metadata properties.
> >
> > BUG=b:145994510
> > TEST=play youtube with arcvm demo image plus this and virgl change
> >
> > Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
> > Tested-by: David Stevens <stevensd@chromium.org>
> > Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> > Commit-Queue: David Stevens <stevensd@chromium.org>
>
> Bug: b:145994510
> Change-Id: I50079b7f0aabf38e1f373cac0f28c0e057eed760
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093923
> Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
> Tested-by: Ilja H. Friedel <ihf@chromium.org>
> Reviewed-by: Ilja H. Friedel <ihf@chromium.org>

Bug: b:150997559, b:145994510
Change-Id: If0f02a4701bb6960b6413d6b0c00b481146914d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2094068
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
2020-03-10 04:17:30 +00:00
Ilja H. Friedel
08d8dbf094 Revert "minigbm: introduce test allocation"
This reverts commit f0e607c7d4.

Reason for revert: caused flaky regressions across the board.

BUG=b:150997559
Exempt-From-Owner-Approval: revert.

Original change's description:
> minigbm: introduce test allocation
>
> This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
> for the creation of fake buffers that can be used to determine buffer
> metadata without actually allocating a full buffer. The new flag is
> supported by the i915 backends. This flag also alleviates the need to
> cache buffers when virtio_gpu queries metadata properties.
>
> BUG=b:145994510
> TEST=play youtube with arcvm demo image plus this and virgl change
>
> Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
> Tested-by: David Stevens <stevensd@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Commit-Queue: David Stevens <stevensd@chromium.org>

Bug: b:145994510
Change-Id: I50079b7f0aabf38e1f373cac0f28c0e057eed760
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093923
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
2020-03-08 09:17:47 +00:00
David Stevens
f0e607c7d4 minigbm: introduce test allocation
This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
for the creation of fake buffers that can be used to determine buffer
metadata without actually allocating a full buffer. The new flag is
supported by the i915 backends. This flag also alleviates the need to
cache buffers when virtio_gpu queries metadata properties.

BUG=b:145994510
TEST=play youtube with arcvm demo image plus this and virgl change

Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
2020-03-05 03:12:45 +00:00
Maksim Sisov
706cd46706 minigbm: Remove deprecated methods.
We have been running an effort to align minigbm apis with
the upstream libgbm.

The clients of minigbm are fixed, and the deprecated methods can be
removed now.

Change-Id: I09043ef5728af36298e3331c6694fde656b0d7e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1505613
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-01-21 20:43:25 +00:00
Gurchetan Singh
064a36b45c minigbm: add gbm_bo_map2
Plan is convert all users to gbm_bo_map2, and then make gbm_bo_map
follow the upstream convention.

BUG=b:145747350
TEST=emerge-nami minigbm

Change-Id: I7c7d54d519277e21ebfa99c57d9a738e9d257a57
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1965671
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-01-17 02:58:15 +00:00
Gurchetan Singh
e32ec0be67 minigbm: gbm.h: organize our downstream patches
This patch series is not bisectable.

BUG=b:145747113
TEST=compile

Change-Id: I447e554f27e55e43a4f5d3ca8f1725eda46852fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1963001
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-01-17 02:58:14 +00:00
Gurchetan Singh
555ed29571 minigbm: gbm.h sync gbm header
First step to removing technical debt: sync header.

This patch series is not bisectable.

The header was copied from commit 1abca2b3c84a42ab64c466bc209db42c41bba5e3.

BUG=b:145747113
TEST=emerge-nami minigbm

Cq-Depend: chromium:1963000
Change-Id: Ic19a471887f57a46de75e71c3db4791d4ae9795d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1963000
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2020-01-17 02:58:12 +00:00
Hirokazu Honda
3b8d4d0c83 Add GBM_BO_USE_HW_VIDEO_ENCODER use flag
Chrome needs to allocate a linear buffer that a hardware video encoder can read
and cpu can read and write. There is no use flag in gbm that specifies the
former. This CL introduces a new use flag for that.

BUG=b:138703716
TEST=None

Change-Id: Ied0321914a366294a47e4fc5c2a8f08ee0351bd8
Reviewed-on: https://chromium-review.googlesource.com/1728729
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-08-16 12:40:30 -07:00
Maksim Sisov
4fe3038be5 Reland "minigbm: define GBM_BO_IMPORT_FD_MODIFIER"
It seems like the problem was that the
GBM_BO_IMPORT_FD_PLANAR was redifened to 0x5505
from 0x5504. And GBM_BO_IMPORT_FD_MODIFIER
was added as 0x5504, which lead to crashes.

In order to minimize risks, do it other way round -
leave GBM_BO_IMPORT_FD_PLANAR as 0x5504 and
add GBM_BO_IMPORT_FD_MODIFIER as 0x5505.

Once all the call sites are changed to use
GBM_BO_IMPORT_FD_MODIFIER, remove GBM_BO_IMPORT_FD_PLANAR
and make GBM_BO_IMPORT_FD_MODIFIER to be 0x5505.

Original change's description:
> minigbm: define GBM_BO_IMPORT_FD_MODIFIER
>
> This CL aligns the minigbm more with the upstream GBM
> by defining GBM_BO_IMPORT_FD_MODIFIER and using
> gbm_import_fd_modifier_data instead.
>
> That is, the main difference between the old
> gbm_import_fd_planar_data one and the new one is
> the format_modifiers variable. In the upstream
> GBM, it's a single variable. In the minigbm, it is
> an array.
>
> As we know there are no cases when modifiers would
> be different for each plane. Thus, it's safe to eliminate
> that and adapt more to the upstream.
>
> Change-Id: Iaae062ef1fe9fc9ab0ead09c5f4bfa91d2db67c3
> Reviewed-on: https://chromium-review.googlesource.com/1360771
> Commit-Ready: Maksim Sisov <msisov@igalia.com>
> Tested-by: Maksim Sisov <msisov@igalia.com>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

Change-Id: I1617de54914734c903cb05e1694cc782a7bb171a
Reviewed-on: https://chromium-review.googlesource.com/1454658
Commit-Ready: Maksim Sisov <msisov@igalia.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-02-14 18:00:23 -08:00
Naoki Fukino
400e928a09 Revert "minigbm: define GBM_BO_IMPORT_FD_MODIFIER"
This reverts commit bc667c3ef6.

Reason for revert: This change might cause crbug.com/913329.

Original change's description:
> minigbm: define GBM_BO_IMPORT_FD_MODIFIER
>
> This CL aligns the minigbm more with the upstream GBM
> by defining GBM_BO_IMPORT_FD_MODIFIER and using
> gbm_import_fd_modifier_data instead.
>
> That is, the main difference between the old
> gbm_import_fd_planar_data one and the new one is
> the format_modifiers variable. In the upstream
> GBM, it's a single variable. In the minigbm, it is
> an array.
>
> As we know there are no cases when modifiers would
> be different for each plane. Thus, it's safe to eliminate
> that and adapt more to the upstream.
>
> Change-Id: Iaae062ef1fe9fc9ab0ead09c5f4bfa91d2db67c3
> Reviewed-on: https://chromium-review.googlesource.com/1360771
> Commit-Ready: Maksim Sisov <msisov@igalia.com>
> Tested-by: Maksim Sisov <msisov@igalia.com>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

Change-Id: I7dec62abd4243554847930cce33f0d5db069c3f4
Reviewed-on: https://chromium-review.googlesource.com/1369469
Commit-Ready: Naoki Fukino <fukino@chromium.org>
Tested-by: Naoki Fukino <fukino@chromium.org>
Reviewed-by: Naoki Fukino <fukino@chromium.org>
2018-12-10 08:42:38 -08:00
Maksim Sisov
bc667c3ef6 minigbm: define GBM_BO_IMPORT_FD_MODIFIER
This CL aligns the minigbm more with the upstream GBM
by defining GBM_BO_IMPORT_FD_MODIFIER and using
gbm_import_fd_modifier_data instead.

That is, the main difference between the old
gbm_import_fd_planar_data one and the new one is
the format_modifiers variable. In the upstream
GBM, it's a single variable. In the minigbm, it is
an array.

As we know there are no cases when modifiers would
be different for each plane. Thus, it's safe to eliminate
that and adapt more to the upstream.

Change-Id: Iaae062ef1fe9fc9ab0ead09c5f4bfa91d2db67c3
Reviewed-on: https://chromium-review.googlesource.com/1360771
Commit-Ready: Maksim Sisov <msisov@igalia.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-12-04 17:40:13 -08:00
Maksim Sisov
11161ac65b minigbm: add MINIGBM define.
This patch does not bring any functionality changes, but just
adds a MINIGBM define in order to be able to distiguish if
Chromium, for example, uses a system libgbm (needed by Ozone/Wayland
builds for Linux due to some diffirences, which we cannot fix yet)
or minigbm.

Change-Id: I82366ce9a1c302124b75a6c21028a67127497065
Reviewed-on: https://chromium-review.googlesource.com/1281887
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-10-18 19:01:12 -07:00
Maksim Sisov
ff1ecaf101 minigbm: fixup! align minigbm functions names with upstream libgbm
Adding missing plane handle API renaming.

Change-Id: I33c4b4bcc5097ca568c95eb8c3718c3f790fd996
Reviewed-on: https://chromium-review.googlesource.com/1170773
Commit-Ready: Maksim Sisov <msisov@igalia.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-08-13 14:25:18 -07:00
Maksim Sisov
79205a57e2 minigbm: align minigbm functions names with upstream libgbm
This patch simply changes some methods' names in order to
align them with the upstream ones. It's needed because Chromium/Wayland
implementation is going to have a gbm implementation used by a GPU
split effort.

In order to avoid to have a per compile gn flags, we would like
to standartize the gbm APIs and be able to use the same binary without
recompilations.

In follow-up CLs, I will fix callers and finally remove the old APIs
namings in favor of new ones.

Change-Id: I850824e7194077c47baa761cddb2947959dff9c3
Reviewed-on: https://chromium-review.googlesource.com/1162170
Commit-Ready: Michael Spang <spang@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-08-09 22:04:29 -07:00
Kristian H. Kristensen
3cb5bbacc5 Reland "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
This is a reland of 1bd7b04a3a

We've landed CL:1070995 which fixes the missing modifier that
caused tiling corruption on pre-KBL Intel devices and CL:1072638
which makes the failing vda unittests use SCANOUT_VDA_WRITE as
they were supposed to.

Original change's description:
> i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
>
> This flag is used to indicate that the platform video decoder will be
> writing into this buffer and that it should be allocated
> accordingly. On Intel, this means that we have to allocate y-tiled
> NV12 for libva to be able to decode to the buffer.
>
> We force gralloc NV12 allocations to be linear for now, since ARC++
> doesn't properly pass modifiers to ChromeOS.
>
> BUG=822346
> TEST=test_that graphics_Gbm
>
> Change-Id: I840c30d22355d26816df718b49717407e2e4620f
> Reviewed-on: https://chromium-review.googlesource.com/996648
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Bug: 822346
Change-Id: Icf0921dc91ac422da26371bffea34b26550b8234
Reviewed-on: https://chromium-review.googlesource.com/1073877
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-05-30 12:50:33 -07:00
Hirokazu Honda
2b682fde2d Revert "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
This reverts commit 1bd7b04a3a.

Reason for revert: Breaks video decoding on most intel platforms, e.g., caroline and samus

Original change's description:
> i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
> 
> This flag is used to indicate that the platform video decoder will be
> writing into this buffer and that it should be allocated
> accordingly. On Intel, this means that we have to allocate y-tiled
> NV12 for libva to be able to decode to the buffer.
> 
> We force gralloc NV12 allocations to be linear for now, since ARC++
> doesn't properly pass modifiers to ChromeOS.
> 
> BUG=822346
> TEST=test_that graphics_Gbm
> 
> Change-Id: I840c30d22355d26816df718b49717407e2e4620f
> Reviewed-on: https://chromium-review.googlesource.com/996648
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Bug: 822346, 845076
Change-Id: I7681ddb66e4789951e840821993fc5562a55d1af
Reviewed-on: https://chromium-review.googlesource.com/1066032
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kuo Jen Wei <inker@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2018-05-22 08:06:31 +00:00
Kristian H. Kristensen
1bd7b04a3a i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
This flag is used to indicate that the platform video decoder will be
writing into this buffer and that it should be allocated
accordingly. On Intel, this means that we have to allocate y-tiled
NV12 for libva to be able to decode to the buffer.

We force gralloc NV12 allocations to be linear for now, since ARC++
doesn't properly pass modifiers to ChromeOS.

BUG=822346
TEST=test_that graphics_Gbm

Change-Id: I840c30d22355d26816df718b49717407e2e4620f
Reviewed-on: https://chromium-review.googlesource.com/996648
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-05-18 20:08:25 -07:00
Shirish S
355b156a78 minigbm: add GBM_BO_USE_SW_{READ,WRITE}_{OFTEN,RARELY} usage flags
Need for these flags has arisen because buffer's allocated
BO_USE_SCANOUT flag is not mmapable in amd, whereas going further
for ensuring atomictity related operations are functional, one
needs buffer to be mmap'd.

These flags shall be used to strike balance in enabling
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED on amd and mmap X-tiled buffers
on Intel platforms.

BUG=b:65297611, chromium:777706
TEST=On Kahlee,
     UI comes up.
     GLMark2 & GLbench autotests show no performance regression
     atomictest -t multiplanes passes
     WebGL Aquarium

Change-Id: I582452d331f4a05106939447784a76eba06d13c2
Reviewed-on: https://chromium-review.googlesource.com/758618
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-16 13:52:03 -08:00
Tomasz Figa
e0807b1eaa minigbm: i915: Allow protected allocations
Allow allocations with BO_USE_PROTECTED.
Moreover, disallow mapping of such BOs, as for GBM/Gralloc API callers
it should not be mappable and considered as metadata alone, without
usable content.

BUG=b:64323695
TEST=emerge-eve arc-cros-gralloc

Change-Id: I1dd1846a2042f97eee2fcc7581a91a60854e62cc
Reviewed-on: https://chromium-review.googlesource.com/607808
Commit-Ready: Pawel Osciak <posciak@chromium.org>
Tested-by: Pawel Osciak <posciak@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-19 12:56:48 -07:00
Tomasz Figa
11f3d085d1 minigbm: Add GBM_BO_USE_CAMERA_{READ,WRITE} usage flags
Add a new GBM usage flag for buffers used a output for camera subsystem.
It corresponds to Android GRALLOC_USAGE_HW_CAMERA_{READ,WRITE} flags and
translates to the same BO_USE_HW_CAMERA_{READ,WRITE} flags of drv.

BUG=b:62358788
TEST=compile

Change-Id: Ib7063437e39d1e08f643763c6ce383ce8657f5ce
Reviewed-on: https://chromium-review.googlesource.com/560935
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-07-13 19:45:56 -07:00
Dongseong Hwang
3909dc011b minigbm: add GBM_BO_USE_TEXTURING
Chromium passes in no flags to gbm_bo_create() to indicate the buffer will be
used as a texture. This convention has caused confusion in the past.

CL:448251 introduced BO_USE_TEXTURE, so it makes sense to match the more
explicit internal semantics.

TEST=run mapped_texture_test -f NV12 of drm-tests package on amd64-generic
BUG=chromium:683347

Change-Id: I40782763d125e640b4bb6a157035b17ebc32cc8c
Reviewed-on: https://chromium-review.googlesource.com/546884
Commit-Ready: Dongseong Hwang <dongseong.hwang@intel.com>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-06-29 14:16:37 -07:00
Kristian H. Kristensen
b1efbd8d16 rockchip: Add support for AFBC buffers
This adds support for allocating AFBC (ARM FrameBuffer Compression)
buffers with minigbm for Rockchip SoCs. AFBC buffers are allocated
through the new gbm_bo_create_with_modifiers() entry point. Callers are
responsible for determining which modifiers are valid for the intended
use case and pass in that list. gbm will then pick the optimal modifier
and allocate a buffer with that layout.  The chosen modifier can be
queries through gbm_bo_get_format_modifier().

Callers of the new entry point are expected to forward the modifier when
using the buffer with other APIs (EGL, KMS etc). The old gbm_bo_create()
entry point continues to work as before and won't allocate AFBC buffers.

BUG=chrome-os-partner:56407
TEST=drm-tests null_platform_test with AFBC support

Change-Id: I1aa345b0d79c4545b7bfc17e9699ef6ad57c68e2
Reviewed-on: https://chromium-review.googlesource.com/386318
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2016-12-21 22:24:10 -08:00
Heng-Ruey Hsu
3fa6dff290 minigbm: fix size_t type not found
BUG=b:24674340
TEST=build pass on kevin

Change-Id: Idd780ee5e99e864ed0f97503e7b38673761201e8
Reviewed-on: https://chromium-review.googlesource.com/422808
Commit-Ready: Heng-ruey Hsu <henryhsu@chromium.org>
Tested-by: Heng-ruey Hsu <henryhsu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2016-12-21 22:24:05 -08:00
Kristian H. Kristensen
3345977b5e minigbm: add new GBM_BO_IMPORT_FD_PLANAR
This is helpful for importing multiplanar formats (see b/31999328)
and importing AFBC format modifiers.

BUG=chrome-os-partner:56407
TEST=drm-tests null_platform_test with AFBC support
     test_that -b cyan $IP1 graphics_Gbm to check for regressions

Change-Id: If7ed9b54e18069ca69b2dbda2b01d59ce58ebeef
Reviewed-on: https://chromium-review.googlesource.com/401439
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
2016-10-21 21:20:47 -07:00
Mike Frysinger
602bd16a60 Revert "Add new GBM_BO_IMPORT_FD_PLANAR"
This reverts commit bb19d6abec.

This was chumped w/out explanation, and the bots have all been
dead since due to graphics_Gbm check failures.  Reverting in
the hope it'll fix things.  It can reland via the CQ.

BUG=chromium:654245

Change-Id: I0d88f7731e9e90fffee1485056d787430eb0b850
Reviewed-on: https://chromium-review.googlesource.com/395727
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2016-10-09 02:35:09 +00:00
Kristian H. Kristensen
bb19d6abec Add new GBM_BO_IMPORT_FD_PLANAR
BUG=chrome-os-partner:56407
TEST=drm-tests null_platform_test with AFBC support

Change-Id: If7ed9b54e18069ca69b2dbda2b01d59ce58ede0b
Reviewed-on: https://chromium-review.googlesource.com/387145
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Trybot-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
2016-10-07 15:04:59 +00:00
Gurchetan Singh
5753c3129a minigbm: quick and dirty implementation of gbm_bo_map/gbm_bo_unmap
We want to add gbm_bo_map/gbm_bo_unmap entry points so certain tests
and Chrome can use driver specific map logic.  This is based on the
upstream entry points in Mesa, with the addition of a plane parameter.

Currently, we just map the entire buffer and don't attempt to do partial
mappings or use the map flags.  We should do this in the future...

BUG=chromium:653284
TEST=minigbm builds

Change-Id: I0423c10c55bab8fac6d6d7c6a699ab71b43aa61b
Reviewed-on: https://chromium-review.googlesource.com/393927
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-10-06 23:32:58 -07:00
Vince Hsu
a6878fe5ae minigbm: add format modifiers per plane
To pass the surface format parameters to EGL, we add format modifiers
which are used for dmabuf import. The vendor ID definitions are copied
from drm_fourcc.h.

BUG=chromium:478339
TEST=none

Change-Id: Ida3e6787b29af73ff534c054006f93c3bad4c5b9
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346365
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-05-29 22:03:31 -07:00
Zach Reizner
345278df00 remove enum gbm_bo_format
The presence of this enum makes mistakes handling gbm formats very easy
to make. With this patch, no new code can use this enum. Any old code
that tries will see errors.

BUG=None
TEST=drm-tests
CQ-DEPEND=CL:343592

Change-Id: If3b19975a137928965f14bad26d1e895dd839810
Reviewed-on: https://chromium-review.googlesource.com/343528
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
2016-05-10 19:41:47 -07:00
Dongseong Hwang
b26f26d3c6 Add formats R8, RG88, GR88
It's follow-up patch of libdrm patch https://lists.freedesktop.org/archives/dri-devel/2015-July/086041.html
i915 allows R8 and GR88 because Mesa supports R8 and GR88 dma_bufs. https://lists.freedesktop.org/archives/mesa-commit/2015-July/057676.html
It's need to enable zero-copy video playback.

BUG=chromium:356871
TEST=AMD64/HSW,BDW,SKL

Change-Id: I9c822f882f4a8e448ebca68b24c7fbd7bf86155a
Reviewed-on: https://chromium-review.googlesource.com/337730
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
2016-05-03 15:40:45 -07:00
Zach Reizner
5c22777ca4 deprecate GBM_BO_USE_WRITE
There are no users of this flag, and the only thing it is defined to
affect is gbm_bo_write, which has no implementation. I suspect this is a
leftover from the original gbm that is no longer needed.

This also removes the declaration of gbm_bo_write to keep others from
thinking minigbm actually implements it.

BUG=None
TEST=minigbm still builds

Change-Id: I0b72efa14208b32e924292cef957273359c7d40b
Reviewed-on: https://chromium-review.googlesource.com/331289
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-04-22 10:14:03 -07:00
Zach Reizner
1e22939922 add GBM_BO_USE_LINEAR flag for bo creation
Some drivers will enable tiling with the other GBM_BO_USE_* flags as an
optimization, but this interferes with reading/writing to mmapped
buffers and other devices that might expect linear buffers.

This CL adds an explicit request to minigbm to only allocate linear
buffer objects. This request is only honored for buffers that meet all
the following requirements:
 - YUV formats or ARGB/XRGB 32-bit formats.
 - Not combined with GBM_BO_USE_RENDERING
A backend might still reject an allocation even if it meets those
requirements.

This CL also raises the limit on the number of driver formats to 16.

TEST=on samus, run vgem_fb_test with GBM_BO_USE_LINEAR flag in
     gbm_bo_create
BUG=None

Change-Id: I8ca31c4c1753af816b13bd75e4feb5b76d153e2a
Reviewed-on: https://chromium-review.googlesource.com/329248
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-02-27 03:25:52 -08:00
Yuly Novikov
96c7a3bf4c Support multi-plane buffers.
Enable NV12 format on Exynos.

BUG=chromium:368775
TEST=HW video overlay works on snow and peach_pi

Change-Id: Ia149618fa086b9ba3ef998149c3557052833e33b
Signed-off-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/318550
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-01-23 06:40:51 -08:00
Lauri Peltonen
7842d8fdd9 tegra: Support tiled buffers
If GBM_BO_USE_RENDERING flag is passed, allocate tiled buffers.  Add logic
to the Tegra backend to compute tiled buffer dimensions and tiling
parameters (kind and block height).

The tiling parameters must somehow be passed to EGL at EGLImage creation.
The long term plan is to introduce an extensible structure that can contain
arbitrary vendor specific metadata.  For now, we abuse the PITCH attribute
to pass tiling parameters.

Add a new GBM utility function gbm_bo_get_stride_or_tiling, which returns
either the tiling parameters or byte pitch, depending whether the buffer
is tiled or not.

The Nvidia term for our tiled layout is "blocklinear".

BUG=None
TEST=null_platform_test on Tegra

Change-Id: I4e0226efa401b08f7e4a009a7f74b3453c622a10
Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/236663
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
2015-01-12 20:07:24 +00:00
Stéphane Marchesin
25a2606a25 Import minigbm
Minigbm is a gbm implementation for a few DRM targets. Currently the
targets are:
- cirrus
- exynos
- gma500
- i915
- rockchip
- tegra
- udl

Right some targets are controlled with GBM_{TARGET} flags. I would
like to get to a place where we can just build all the targets in a
single library, but we need the drm headers for all targets for that
to happen so this needs more thinking.

BUG=chromium:394868,chromium:402597,chromium:413947,chromium:412508
TEST=unit tests, which I will need to import later

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: I36ae07f2a59827a807e19e1432891ca196b28803
Reviewed-on: https://chromium-review.googlesource.com/218030
2014-09-13 01:34:56 +00:00