Commit graph

161 commits

Author SHA1 Message Date
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
Yiwei Zhang
c1413ea43a minigbm: conditionally fallback to strip scanout use_flag
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>
2021-09-22 19:47:06 +00:00
Drew Davenport
862d36fb03 i915: Run clang-format
BUG=none
TEST=none

Change-Id: I3955a96b2edf76d4adc290dd26b53a127a8dbeae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2952006
Tested-by: Drew Davenport <ddavenport@chromium.org>
Commit-Queue: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-06-17 16:48:38 +00:00
Abhishek Kumar
70cf2460d2 i915: Enable Render Buffer compression for Gen11
crrev/c/2657180 disabled RBC for gen11, this cl enables RBC for
gen11.Garbage issue was caused by bug in mesa iris driver[1] and
patch fixing garbage issue [2] is available in chrome mesa-iris branch.

[1]https://gitlab.freedesktop.org/mesa/mesa/-/issues/3425#note_599864
[2]upstream commit:5194cbc76633e4458f1c5f1db388950cae0200a9

BUG=b:188476661
TEST=Play video in fullscreen, check sigin/sigout

Change-Id: I9f7d2f865d42d8b637f02e87074a6f52eb9e9d12
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2944608
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Tested-by: Abhishek Kumar <abhishek4.kumar@intel.com>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
2021-06-15 07:49:08 +00:00
Nathan Ciobanu
87ec79bfdf minigbm: Round up stride to power of two for ADL-P
Stride alignment required for tiled buffers for Intel ADL-P
based platforms

BUG=b:179666412
TEST=Checked UI and video playback on brya and volteer to
	ensure no graphics distortions were introduced

Change-Id: Ie274558a10f3a3c4a166c59bda4db53fc9b82e14
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2840803
Tested-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
2021-05-07 03:23:09 +00:00
Sushma Venkatesh Reddy
0b57ebff9c i915: Ensure TGL/JSL surface is aligned to LCU size
Gmmlib expects surfaces of certain formats to be LCU (Largest
Coded Unit) aligned on Gen11 and Gen12 devices [1, 2, 3, 4], so
to match with its expectations, these minigbm changes are needed.

[1] cac1a15c98/Source/GmmLib/Texture/GmmGen12Texture.cpp (L858-L863)
[2] https://github.com/intel/media-driver/pull/1166/commits/d3125c236fe7c14f17182aa67242c96a487d918c
[3] cf70857349/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp (L159-L160)
[4] cac1a15c98/Source/GmmLib/Utility/GmmUtility.cpp (L171-L193)

BUG=b:183410292
TEST=Camera preview buffer size should be higher than the previous

Signed-off-by: Sushma Venkatesh Reddy <sushma.venkatesh.reddy@intel.com>
Change-Id: I1874d2c0e10b4e4632205d5ef59d32495534d615
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2851909
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
2021-05-06 05:22:56 +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
Miguel Casas
b5a95bb303 minigbm: i915_add_combinations() cleanup: simplify Y-tile scanout
This CL follows up on a comment in crrev.com/c/2830692 by:
- Not defining a new |render_not_linear_nor_sw_read_write| since
that's equivalent to |render_not_linear| (a tiny change in the
definition of |scanout_and_render_not_linear| makes it obvious).
- Leaves a comment as to why |scanout_render_formats| are added
without BO_USE_SCANOUT for Y-Tiled formats.

No new functionality intended, just cleanup.

BUG=b:183760490
TEST=CQ

Change-Id: Ibc3d17026034a3ad9ba8448392a8dcb0f063671c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2830337
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-04-24 04:52:44 +00:00
Miguel Casas
abeaddebd5 minigbm: i915_add_combinations() cleanup: update |linear_mask|
Following up a comment in crrev.com/c/2830692, |linear_mask|
should include BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY.
This CL does just that.

No new functionality intended, just cleanup.

BUG=b:183760490
TEST=CQ

Change-Id: I18e26a92e5c45f0b26170c1232eb634eea85db19
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2830336
Tested-by: Miguel Casas <mcasas@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-04-23 23:10:28 +00:00
Miguel Casas
da47b7d8a0 minigbm: i915_add_combinations() cleanup: don't reuse USE masks
|render| and |scanout_and_render| are modified a couple of times
in the mentioned function, this makes the code hard to read.
This CL uses a different variable for each case.

No new functionality intended, just cleanup.

BUG=b:183760490
TEST=CQ

Change-Id: I40f5a0c600a2d1f0d5caa8f2520d9ad0a6498c02
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2830692
Tested-by: Miguel Casas <mcasas@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2021-04-22 02:59:43 +00:00
Miguel Casas
f2dc08e5a4 minigbm: i915_add_combinations() cleanup: don't reuse |metadata|
|metadata| is reused for a couple of different tiling modes
which makes it hard to read what's used where. This CL
uses a different, named, variable for each case.

No new functionality intended, just cleanup.

BUG=b:183760490
TEST=CQ

Change-Id: If92fddd1cb458598277af51968e0446a8a0abbc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2830691
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
2021-04-19 22:20:15 +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
Mark Yacoub
6e27708ff2 Enable Rendering Buffer Compression
Enabling Rendering buffer compression (allocating buffers using I915_FORMAT_MOD_Y_TILED_CCS
modifier).

http://go/cros-intelrbc

Requirement:
Using modifier might require more resources than the system can support. Enabling RBC is dependent on the ability of Chrome to test-modeset before modesetting, and falling back to less demanding modifiers such as Linear modifier (crrev.com/c/2567263).

BUG: 979736
TEST: (Kohaku eDP(4K) with 4K external) and (Kohaku eDP and 2 external monitors)
Change-Id: I304b9cd973e5fec67711411ee2706140b3e76e03
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2577977
Tested-by: Mark Yacoub <markyacoub@google.com>
Commit-Queue: Mark Yacoub <markyacoub@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
2021-02-08 17:32:43 +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
Evan Green
71097240c5 i915: Disable Render Buffer Compression for Gen11
We're seeing instance of garbage on the screen in certain scenarios.
It's been suggested this is a driver problem, but so far that has not
been confirmed. Disabling RBC seems to fix the garbage.

BUG=b:174442467, b:178169384, b:178149807
TEST=Try signing out, fullscreening video, observe no artifacts

Change-Id: I908b02065ab2e2874084e5f57908b23fd6ae3ac4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2657180
Tested-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Evan Green <evgreen@chromium.org>
2021-02-04 00:31:53 +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
Kristian H. Kristensen
8e9c241b85 i915: Fall back to GEM_MMAP_GTT if GEM_MMAP fails
DRM_IOCTL_I915_GEM_MMAP mmaps the underlying shm file and returns a
user space address directly, ie, doesn't go through mmap. If we try
that on a dma-buf that doesn't have a shm file, i915.ko returns ENXIO.
Fall through to DRM_IOCTL_I915_GEM_MMAP_GTT in that case, which will
mmap on the drm fd instead.

BUG=b:167236452
TEST=dmabuf_test from drm-tests passes

Change-Id: I41cd0b0150d2d489bd055e23f4495cd13624b831
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2561378
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
2020-12-10 23:33:02 +00:00
Jeffrey Kardatzke
dba1987966 minigbm: Add SCANOUT and PROTECTED for P010 buffers
BUG=b:153111783,b:155511259
TEST=P010 buffers scanout to overlay on TGL

Change-Id: Ib06508a38c8c86b40d3e6082a79051594252697d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2574672
Tested-by: J Kardatzke <jkardatzke@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-12-08 18:37:14 +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
Dominik Behr
1c6e70afec minigbm: add option to force 256 byte alignment of linear buffers
BUG=b:172617736
TEST=run glxgears crostini on mushu

Change-Id: I0a5934e3676a70dd0bdb5f53701114fb0c19f016
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2522635
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Dominik Behr <dbehr@chromium.org>
Auto-Submit: Dominik Behr <dbehr@chromium.org>
Commit-Queue: Dominik Behr <dbehr@chromium.org>
2020-11-26 07:40:33 +00:00
Gurchetan Singh
f98d1c10f3 minigbm: i915: use protected content feature
This enables protected content playback on gen 12 and greater
i915.

BUG=b:153111783,b:155511259
TEST=Protected playback works w/ associated Chrome OS changes

Change-Id: I829dddf506b3b765e5d2f25f2b77af9ecc4f7309
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2459532
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-11-25 22:35:16 +00:00
Gurchetan Singh
13b0012204 minigbm: i915: use local i915 drm header
Taken from libdrm.  Mainly so we can have local header for
development purposes.

BUG=b:153111783,b:155511259
TEST=Protected playback works w/ associated Chrome OS changes

Change-Id: I947ab11d5fbc0c2b62dbaf8806e7897d2df79621
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2459530
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-11-25 22:35:14 +00:00
Abhishek Kumar
6085bf30a3 minigbm i915: Enable Y tiling for buffer width greater than 4096
Vappi hardware decoder requires NV12 buffer to be Y-tiled only ,so
enable Y tiling for buffer width > 4096.Intel GEN9/10 Gpu does not
support Y tiled buffers scanout and overlay plane will not be used.

BUG=b:168706685,b:171518235
TEST= play 5k video on hatch

Change-Id: Icb3ad0ebe58b733f22614d95f2ba3976e7d6e33d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2465962
Tested-by: Andres Calderon Jaramillo <andrescj@google.com>
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
2020-11-10 02:18:30 +00:00
Gurchetan Singh
238001ffd0 minigbm: add back in udl/evdi
These drivers are still in use for MIMO displays.

BUG=b:171725208
TEST=enterprise_RemoraRequisitionDisplayUsage

Change-Id: Idecc686e7977a1739943ccb01df849552e40f979
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2505738
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-10-29 03:44:07 +00:00
Abhishek Kumar
d39fe4ed83 i915: Enable Y-tiling for huge buffer object for GEN11 GPU
Intel GEN11+ Gpu can scan out Y-tiled buffers with maximum width
5320, so enable Y-tiled buffer for GEN11.

BUG=b:168573604 b:168706685
TEST=play 5k video on JSL device

Change-Id: Idb99c9512591e786f796fb32c0e60f549cec03da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2462328
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Tested-by: Girish DS <girish.ds@intel.corp-partner.google.com>
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
2020-10-22 07:30:52 +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
Sushma Venkatesh Reddy
20604bea13 i915: Add gen12 ids for TGL
During 5K/8K HW accelerated video playback, corruptions are observed on
gen12 TGL devices as (i915->gen <= 11) condition is returning true, and
I915_TILING_NONE tile is being set to bo. Adding gen12 ids ensures
buffer allocations happen as per the device's capabilities and here, it
resolves the video corruption issues.

BUG=b:168706685
TEST=Play 5K/8K VP9 codec video

Signed-off-by: Sushma Venkatesh Reddy <sushma.venkatesh.reddy@intel.com>
Change-Id: I24cd0b667f2bf74f73d2377a32f92a148d21c793
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2462345
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Kevin L Derossett <kevin.l.derossett@intel.com>
2020-10-13 16:53:52 +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
Binu R S
8d70518f51 i915: Enable Render Buffer Compression for Gen-11
Enable Render Buffer Compression only for Gen 11

BUG=b:161520827
TEST=Boot target board to UI

Signed-off-by: Binu R S <binu.r.s@intel.com>
Change-Id: I40739732e915a516837a2c7530b4a81679597efe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2306853
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Tested-by: Mohanram Meenakshisundaram <mohanram.meenakshisundaram@intel.com>
Commit-Queue: Justin TerAvest <teravest@chromium.org>
2020-08-05 20:41:40 +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
Sean Paul
a9d3f77c42 i915: Avoid using y-tiling on huge buffer objects
<= GEN11 i915 devices can't scan out Y-tiled buffers greater than 4096
in width. This patch downgrades these huge buffers to X-tiled which can
be scanned out.

BUG=b:151166605
BUG=chromium:988091
TEST=Tested with hatch on Samsung CRG9 5k display

Change-Id: I9f83ab1f9d1f2a254ca0ae7028c138f87be378eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2207670
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
Tested-by: Sean Paul <seanpaul@chromium.org>
Auto-Submit: Sean Paul <seanpaul@chromium.org>
Commit-Queue: Sean Paul <seanpaul@chromium.org>
2020-05-20 21:14:17 +00:00
Mark Yacoub
2b1ee85844 Remove i915_FORMAT_MOD_Y_TILED_CCS from modifier_order
Revert adding i915_FORMAT_MOD_Y_TILED_CCS to the modifiers options.
Reason for revert: Devices with internal 4K displays aren't able to drive external 4K monitors as well.

(This is a partial revert of crrev.com/c/2044490)

BUG=chromium:979736,b:153731006

Change-Id: I40a0c686ee348f94e25b399b9ab91d4d6d377bc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2154983
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Mark Yacoub <markyacoub@google.com>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Mark Yacoub <markyacoub@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Mark Yacoub <markyacoub@google.com>
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
Commit-Queue: Matthew Blecker <matthewb@chromium.org>
2020-04-18 10:50:39 +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
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
Ilja H. Friedel
f39dcbc6a0 Reland "minigbm: i915: remove KMS query"
This reverts commit b0787a9fdb.

Reason for revert: I want to avoid a potentially broken build due to the revert. My local build is taking too long.

BUG=b:149959202
Exempt-From-Owner-Approval: reland change.

Original change's description:
> Revert "minigbm: i915: remove KMS query"
> 
> This reverts commit 0254a661f1.
> 
> Reason for revert: speculative revert to address octopus breakages
> 
> BUG=b:149959202
> Exempt-From-Owner-Approval: revert change.
> 
> 
> Original change's description:
> > minigbm: i915: remove KMS query
> >
> > This simplifies the code.  We just have to make sure:
> >
> > - the scanout flag goes to X-tiled.
> >
> > BUG=b:145747132
> > TEST=compile and run on Nami
> >
> > Cq-Depend: chromium:1998011
> > Change-Id: Ic2a1c367017c28abc3a9307bea53c577bc33e31e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1976275
> > Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> > Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
> > Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
> > Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
> 
> Bug: b:145747132
> Change-Id: If6aa7e3623461b8f837dec581934ed86d4c4a573
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2073173
> Tested-by: Ilja H. Friedel <ihf@chromium.org>
> Reviewed-by: Jao-ke Chin-Lee <jchinlee@google.com>
> Commit-Queue: Jao-ke Chin-Lee <jchinlee@google.com>

Bug: b:149959202, b:145747132
Change-Id: I529f24309ee33bc6b500c65fd83a7f282dafef05
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2073478
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Jao-ke Chin-Lee <jchinlee@google.com>
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
2020-02-26 02:53:19 +00:00
Jao-ke Chin-Lee
b0787a9fdb Revert "minigbm: i915: remove KMS query"
This reverts commit 0254a661f1.

Reason for revert: speculative revert to address octopus breakages

BUG=b:149959202
Exempt-From-Owner-Approval: revert change.


Original change's description:
> minigbm: i915: remove KMS query
>
> This simplifies the code.  We just have to make sure:
>
> - the scanout flag goes to X-tiled.
>
> BUG=b:145747132
> TEST=compile and run on Nami
>
> Cq-Depend: chromium:1998011
> Change-Id: Ic2a1c367017c28abc3a9307bea53c577bc33e31e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1976275
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
> Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>

Bug: b:145747132
Change-Id: If6aa7e3623461b8f837dec581934ed86d4c4a573
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2073173
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Jao-ke Chin-Lee <jchinlee@google.com>
Commit-Queue: Jao-ke Chin-Lee <jchinlee@google.com>
2020-02-26 02:18:55 +00:00
Gurchetan Singh
0254a661f1 minigbm: i915: remove KMS query
This simplifies the code.  We just have to make sure:

- the scanout flag goes to X-tiled.

BUG=b:145747132
TEST=compile and run on Nami

Cq-Depend: chromium:1998011
Change-Id: Ic2a1c367017c28abc3a9307bea53c577bc33e31e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1976275
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
2020-02-18 17:52:02 +00:00
Mark Yacoub
c95656442e minigbm/i915: Add support for I915_FORMAT_MOD_Y_TILED_CCS
This adds support for allocating buffers with the
I915_FORMAT_MOD_Y_TILED_CCS modifier, which enables Intel's rendering
buffer compression.

(reland of crrev.com/c/1706735)

BUG=979736

Change-Id: I90a8bc5fad0e1133d527b5ef4cff56d371763fc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2044490
Reviewed-by: Mark Yacoub <markyacoub@google.com>
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
Tested-by: Mark Yacoub <markyacoub@google.com>
Tested-by: Robert Tarasov <tutankhamen@chromium.org>
Auto-Submit: Mark Yacoub <markyacoub@google.com>
Commit-Queue: Mark Yacoub <markyacoub@google.com>
2020-02-15 18:09:21 +00:00
Junichi Uekawa
d441f4ec33 minigbm: Reformat with clang-format.
Touching the files seem to cause reformatting.

BUG=None
TEST=None

Change-Id: I31d2fbb01f4ee803da2b740dea036971e861bf60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2027288
Tested-by: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
2020-02-03 06:12:15 +00:00
Gurchetan Singh
9d20b9e388 minigbm: i915: get rid of tileable texture formats
I don't think Chrome ever used DRM_FORMAT_UYVY + DRM_FORMAT_YUYV.
Plus, R8 tiled isn't really useful.

BUG=b:145747113
TEST=compile

Change-Id: I30bc3d966cc935dab725f96d39d86629436f5640
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1976273
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-01-21 20:43:25 +00:00
Hirokazu Honda
b6c4cf7b91 Revert "Enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage"
This reverts commit aa6b072d4c.

Reason for revert: This change is unnecessary because HW_VIDEO_ENCODER
usage is unmasked in crrev.com/c/1940034.

Original change's description:
> Enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage
>
> crrev.com/c/1904910 masks the HW_VIDEO_ENCODER usage when
> BO_USE_HW_VIDEO_ENCODER is specified in gralloc. A camera stack allocates
> XBGR8888 buffer with BO_USE_HW_VIDEO_ENCODER usage in ARC++ video
> recording if the camera HAL version is V1. Thanks to crrev.com/c/1904910,
> it is necessary to enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage.
>
> BUG=b:144135251
> TEST=Recording with GCA
>
> Change-Id: I61beee87a1531c0dea371861ffb31ce2189ef854
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1934068
> Tested-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
> Commit-Queue: Hirokazu Honda <hiroh@chromium.org>

Bug: b:144135251
Cq-Depend: chromium:1940034
Change-Id: I8d64c97399a601487fc84a6ecae337c235bd4464
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1947685
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2019-12-04 11:50:39 +00:00
Hirokazu Honda
aa6b072d4c Enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage
crrev.com/c/1904910 masks the HW_VIDEO_ENCODER usage when
BO_USE_HW_VIDEO_ENCODER is specified in gralloc. A camera stack allocates
XBGR8888 buffer with BO_USE_HW_VIDEO_ENCODER usage in ARC++ video
recording if the camera HAL version is V1. Thanks to crrev.com/c/1904910,
it is necessary to enable to allocate XBGR8888 with HW_VIDEO_ENCODER usage.

BUG=b:144135251
TEST=Recording with GCA

Change-Id: I61beee87a1531c0dea371861ffb31ce2189ef854
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1934068
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
2019-11-27 10:37:55 +00:00
Miguel Casas
5548540364 i915: allow allocating AR30/AB30 for scanout
This CL extends the current M.O. of allowing ARGB formats for
scanout if the corresponding XRGB format supports it, for XR30
and XB30.

(Needs crrev.com/c/1925247 patched in).

BUG=chromium:949260
TEST=null_platform_tests -f AR30 etc on kohaku/hatch

Change-Id: I720e82a17873e5f635f530bf3eefff24c2e3ab77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1925250
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
2019-11-25 16:49:14 +00:00
David Stevens
793675a1c0 minigbm: i915: fix planar height alignment
Aligned planar height should be calculated from the planar height, not
the buffer height.

BUG=b:133292033
TEST=ArcVideoTest renders video correctly (w/a few other changes)

Change-Id: I1dc35ab4eebf9a5a86b2a9befaeb817a56dcfec2
Reviewed-on: https://chromium-review.googlesource.com/1824304
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2019-10-10 16:38:03 -07: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
David Stevens
6116b3180d minigbm: cros_gralloc: handle video decoder flag
Although gralloc0 doesn't include a video decoder flag, the IAllocator
gralloc0 passthrough gives the lower 32 bits of the BufferUsage flags
to gralloc0. This change makes cros_gralloc add the video decoder BO_USE
flag when that happens. It also adds some missing combinations for when
the BO_USE_HW_VIDEO_DECODER flag is actually set.

Change-Id: If2248f33ac2456c077fe63e90d2c39e7f57e2568
Reviewed-on: https://chromium-review.googlesource.com/1786419
Tested-by: David Stevens <stevensd@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-09-20 19:28:02 -07:00