Commit graph

114 commits

Author SHA1 Message Date
Shirish S
4eebcea0cc amdgpu: make AMDGPU_GEM_CREATE_CPU_GTT_USWC flag default
amdgpu kernel driver requires USWC flag for allowing bo
allocation in GTT domain, hence enable it by default.

BUG=b:152378755
TEST=On Dali play 4k YouTube video

Signed-off-by: Shirish S <shirish.s@amd.com>
Change-Id: Ic509701f683d184d3fb85b7616dc9a7ed467cfe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2128147
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Drew Davenport <ddavenport@chromium.org>
2020-04-04 13:25:25 +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
Satyajit Sahu
cfcea2f165 arc-cros-gralloc: amdgpu: Use DRI_PATH to load radeonsi
Use DRI_PATH cpp flag exported by ebuild to load the radeonsi
library. This ensures 64/32 bit libraries are loaded as per arch.

BUG=b:148405947, b:148045046, b:139690910, b:150425665, b:150422260,
b:150742051, b:150742059
TEST=Launch play store, no black screen observed

Cq-Depend: chromium:2098992
Change-Id: I12649457c82808aafb468d3d3123ff3eb028e7b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2087294
Reviewed-by: Drew Davenport <ddavenport@chromium.org>
Tested-by: Drew Davenport <ddavenport@chromium.org>
Commit-Queue: Drew Davenport <ddavenport@chromium.org>
2020-03-13 14:01:57 +00:00
ChromeOS Developer
9b367b3efe minigbm: dri,amdgpu: Modifier support.
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>
2020-03-10 15:39:10 +00:00
ChromeOS Developer
44588bb282 minigbm: dri: Support 2+ planes query for modifiers.
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>
2020-03-10 15:39:09 +00:00
Bas Nieuwenhuizen
7119d33191 minigbm: Set modifiers for amdgpu/dri.
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>
2020-02-18 13:45:31 +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
cf9ed9dc8e amdgpu: make libdir work on stock Linux
BUG=b:145747113
TEST=emerge-grunt minigbm

Cq-Depend: chromium:1967711
Change-Id: I10e721ffcbe8e36551269cf54e981be411389eaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1967731
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:23 +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
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
Hirokazu Honda
5dc63faf56 amdgpu: Enable to allocate YVU420 buffer with BO_USE_TEXTURE_MASK flag
Chrome needs to allocate YUV420 buffer that cpu can read and write with a linear
view. YUV420 is not supported by gbm widely. YVU420 is used on behalf of YUV420.
This CL adds YVU420 to texture_source_formats so that YVU420 buffer can be
allocated on AMD platform.

BUG=chromium:987860
TEST=None

Change-Id: I11af92e74ad1d3c7c5631e67c5a2fef90077d887
Reviewed-on: https://chromium-review.googlesource.com/1728730
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Commit-Ready: Hirokazu Honda <hiroh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2019-08-09 01:34:30 -07:00
Gurchetan Singh
0d44d48d52 minigbm: modify resolve format hooks a bit
Plumb the driver backend to the resolve format hook.

BUG=b:132939420
TEST=compile

Change-Id: I3ac10f5c986bc5dae5b34cd70654676d4ad289ea
Reviewed-on: https://chromium-review.googlesource.com/1645879
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
2019-07-03 02:02:15 -07:00
Bas Nieuwenhuizen
582bdbf1d7 amdgpu: Add ABGR8888 using non-linear tiling too.
BUG=b:129625642
TEST=test_that ${IP} cheets_CTS_P.9.0_r7.x86.CtsGraphicsTestCases on Grunt

Change-Id: I716533df9e56e52818b4c52ee557747dc3a68e40
Reviewed-on: https://chromium-review.googlesource.com/1550921
Commit-Ready: Drew Davenport <ddavenport@chromium.org>
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Drew Davenport <ddavenport@chromium.org>
2019-04-04 15:11:09 -07:00
Drew Davenport
5d215249f4 amdgpu: Add ABGR8888 for scanout
BUG=b:127868532
TEST=Complete glbench without errors in crosvm

Change-Id: I921ab9dd1611d6b45eb980ed7988941806eb6761
Reviewed-on: https://chromium-review.googlesource.com/1538374
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-03-27 05:57:27 -07:00
Satyajit Sahu
eea88fad3a minigbm:amdgpu: align stride to 256
Previously stride was alinged to 256 only in linear path and
android. Now it is aligned to 256 for all cases.

BUG=b:122049612
TEST=suspend_stress_test

Change-Id: I757f2d056176fe5ebfd858a017273cf02bad6020
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1457777
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2019-02-13 01:38:00 -08:00
Deepak Sharma
ff66c801c9 amdgpu: use amdgpu_gem_wait_idle_ioctl to wait for GPU to finish.
For linear path we don't wait for GPU to finish before CPU access
which may case issues in gralloc lock() case.

Bug=b:115585732
TEST=android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1920x1080

Change-Id: If827fe4a18726797082046b4f24fc8c75ff1bcb7
Signed-off-by: Deepak Sharma <Deepak.sharma@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1340484
Commit-Ready: Deepak Sharma <deepak.sharma@amd.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-11-18 07:11:06 -08:00
Deepak Sharma
74e4893783 amdgpu: Don't use AMDGPU_GEM_CREATE_EXPLICIT_SYNC flag.
some of the android.media.cts.EncodeDecodeTest in media test are
failing when enabled.

Bug=b:115585732
TEST=run android.media.cts.EncodeDecodeTest tests

Change-Id: Id54236a4441e6441bd8500a81f83c00e2fa405d8
Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1329993
Commit-Ready: Deepak Sharma <deepak.sharma@amd.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-11-17 12:00:08 -08:00
Gurchetan Singh
d7630cde46 amdgpu: fix misplaced code block
We only need this workaround for DRI Android buffers, not
all buffers.

Also, we don't need this for buffers with non-SW uses.

BUG=b:117942643
TEST=compile

Change-Id: I7ea24b0dc3b040b726f6c1223c96998f078a20fc
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1300595
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
2018-11-04 05:16:52 -08:00
Satyajit Sahu
ee98f4ecbe minigbm: align width so that stride aligns to 256
map stride is bigger than the allocation stride. Currently
gralloc_lock does not consider map_stride. Align the width so
that stride get alinged to 256.

BUG=b:115946221
TEST= CtsNativeHardwareTestCases GpuColorOutputCpuRead* tests

Change-Id: I0e1ccfba4ec981702498a76fa5a0b2c662b6e728
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1242767
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-10-09 21:14:31 -07:00
Gurchetan Singh
71bc665179 minigbm: don't advertise BGR24 as a render/texture target
Mesa drivers can't use it, in general.

I'm leaving in Rockchip since I haven't gotten any reports
about this test failing on kevin-arcnext.

Fixes: abe44f ("minigbm: add support for BG24")

BUG=b:77876551, b:115564746
TEST=The following tests should pass on Eve/Grunt arc-next:

  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuColorOutputAndSampledImage_R8G8B8_UNORM
  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuColorOutputCpuRead_R8G8B8_UNORM
  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuColorOutputIsRenderable_R8G8B8_UNORM
  android.hardware.nativehardware.cts.AHardwareBufferNativeTests#SingleLayer_ColorTest_GpuSampledImageCanBeSampled_R8G8B8_UNORM

Change-Id: Ic7aec07c89fdc21e0c8392238e833f7980062049
Reviewed-on: https://chromium-review.googlesource.com/1229439
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2018-09-21 03:38:13 -07:00
Keiichi Watanabe
79155d7822 minigbm: run clang-format
Though presubmit.sh requires formatting by clang-format, some files
are not formatted.

BUG=None
TEST=compile

Change-Id: I828dd85536cb94dc98cd11e83ec86af53a425070
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1172241
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-08-14 02:13:26 -07:00
Satyajit Sahu
dc8554f435 minigbm: amdgpu: align the stride to 256
amdgpu has a requirement of stride to be aligned to 256.
Otherwise gpu faults and corruptions are observed for some
resolutions.

BUG=b:80148696 b:110472790
TEST=graphics autotest suite

Change-Id: Ic13c19cd1641a6ce206de9b1016a242ed21c2631
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1133060
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-07-11 23:06:45 -07:00
Miguel Casas
dea0ccbaac minigbm: Add BO_USE_HW_VIDEO_DECODER to supported flags
This CL adds BO_USE_HW_VIDEO_DECODER to the potential list of flags
supported by RockChip, AMD and MediaTek for formats that can be used
for video playback -or- for protected buffer allocation.

Change-Id: Ib617a4138ecdf2fa00900aacd8afb412f77f78d5
BUG=chromium:857095
TEST=compiled minigbm for the said platforms.
Reviewed-on: https://chromium-review.googlesource.com/1117606
Commit-Ready: Miguel Casas <mcasas@chromium.org>
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-07-02 15:32:45 -07:00
Drew Davenport
293d9e3edf minigbm: DRM_FORMAT_BGR888 for amdgpu
Move DRM_FORMAT_BGR888 from render_target_formats to texture_source_formats

BUG=b:110472317
TEST=test_that --board=grunt graphics_Gbm

Change-Id: I4da4ca1544b0596ef39c24f268c85014ef58ad7e
Reviewed-on: https://chromium-review.googlesource.com/1108756
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-06-21 16:31:53 -07:00
Gurchetan Singh
abe44f6220 minigbm: add support for BG24
Some CTS tests apparently require HAL_PIXEL_FORMAT_RGB_888 now.
This format is DRM_FORMAT_BGR888 in <drm_fourcc.h>.  Let's add it
to the revelant drivers.

BUG=b:80496655
TEST=emerge-eve minigbm, let lab test

Change-Id: Ia9dadbd2c17c137262865679af1d97d55b1a7087
Reviewed-on: https://chromium-review.googlesource.com/1089493
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
2018-06-07 23:33:11 -07:00
Deepak Sharma
62a9c4ee5a minigbm: amdgpu: switch BO allocation domain to GTT from VRAM
With SG feature enabled, will move all bo allocation to GTT.

BUG=b:69941535
TEST=boot Grunt, run graphics_Stress.tabopenclose

Change-Id: If424709315e36e29bc99400d9333df72d5979aa0
Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1037914
Commit-Ready: Deepak Sharma <deepak.sharma@amd.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-05-09 22:36:25 -07:00
Gurchetan Singh
767c538889 Revert "minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16"
This reverts commit 292da5365a.

Reason for revert: The Android framework uses successful allocation of HAL_PIXEL_FORMAT_RGBA_FP16 to test for wide-gamut capabilities.  We don't want to advertise this, so let's revert.

android.graphics.cts.BitmapColorSpaceTest#test16bitHardware

can pass if the framework falls back to RGBA8888, as is the plan.

Original change's description:
> minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16
>
> This is needed to support the following CTS test:
>
> android.graphics.cts.BitmapColorSpaceTest#test16bitHardware
>
> There have been some rumblings about adding 64-bit formats to <drm_fourcc.h>:
>
> https://lists.freedesktop.org/archives/intel-gvt-dev/2017-July/001469.html
>
> However, nothing has landed, so let's just define our own format
> for the time being.
>
> BUG=b:77973662
> TEST=Compile for kevin and kevin-arcnext
>      Unfortunately, my P setup refuses to work, so let the lab
>      test.
>
> Change-Id: I1fea16400ba6632a8ef17105e27bc7799d2af515
> Reviewed-on: https://chromium-review.googlesource.com/1029355
> Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

Bug: b:77973662
Change-Id: I9e4b79b06dd565189a2e783e8453f08af173d84c
Reviewed-on: https://chromium-review.googlesource.com/1045805
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-05-08 21:15:47 -07:00
Gurchetan Singh
292da5365a minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16
This is needed to support the following CTS test:

android.graphics.cts.BitmapColorSpaceTest#test16bitHardware

There have been some rumblings about adding 64-bit formats to <drm_fourcc.h>:

https://lists.freedesktop.org/archives/intel-gvt-dev/2017-July/001469.html

However, nothing has landed, so let's just define our own format
for the time being.

BUG=b:77973662
TEST=Compile for kevin and kevin-arcnext
     Unfortunately, my P setup refuses to work, so let the lab
     test.

Change-Id: I1fea16400ba6632a8ef17105e27bc7799d2af515
Reviewed-on: https://chromium-review.googlesource.com/1029355
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-04-27 12:22:38 -07:00
Satyajit
cdcebd879c minigbm: using dri extensions
addrlib dependency removed. dri extensions are called instead.
dri.c/dri.h implements the generic dri extensions call.
amdgpu.c implements amdgpu specific.

BUG=b:72972511
TEST=Chrome booted to UI and passed graphics_Gbm autotest

Change-Id: Ia0edec7752a258fe2f70bc4838dac6398d46def2
Signed-off-by: Satyajit <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/863723
Commit-Ready: Satyajit Sahu <satyajit.sahu@amd.com>
Tested-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-04-16 09:20:20 -07:00
Bas Nieuwenhuizen
3cf8c92dc2 minigbm: amdgpu: Disable explicit synchronization when possible.
With drm minor 21 both radv and mesa can do all the explicit
synchornization extensions and hence explicit synchronization gets
used.

However, as implicit synchronization is not disabled we can get
surprises like cyclic dependencies if producer and consumer are too
far out of sync with each other.

Therefore this disables implicit synchronization if the kernel is
new enough for explicit synchronization to get used.

v2: - Fix up compile errors
    - Actually set priv->addrlib

BUG=b:76135512
TEST=Run dEQP-VK.wsi.android.swapchain.render.basic 10 times on
     Kahlee.

Change-Id: I6e5389793e82b167e025b7d94958effad278c361
Reviewed-on: https://chromium-review.googlesource.com/978166
Commit-Ready: Bas Nieuwenhuizen <basni@chromium.org>
Tested-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-03-29 10:25:27 -07:00
Alistair Strachan
0cfaaa5adb Use Android log system in helpers.c.
This code might be loaded by a daemonized process now, so the existing
logging to stderr goes nowhere. It's better to use the Android logger.

Change-Id: I19f088b8f049f07c9c6839038d2971fad1a0e852
Reviewed-on: https://chromium-review.googlesource.com/971360
Commit-Ready: Alistair Strachan <astrachan@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-03-21 23:23:37 -07:00
Deepak Sharma
adc70faad6 minigbm: amdgpu: support DRM_FORMAT_YVU420_ANDROID
Add support for DRM_FORMAT_YVU_420 for CTS.

BUG=b:70373715
TEST=build cros-gralloc and run ctsMediaTestcases.

Change-Id: I09f0a3da5ba56a5f275f33348fdb4d61e2fde7db
Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/935491
Commit-Ready: Deepak Sharma <deepak.sharma@amd.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2018-02-23 21:06:56 -08:00
Dominik Behr
fa17cdde2d minigbm: amdgpu: use VRAM only for cursor and scanouts
Everything else should use GTT (USWC preferably). We should also switch
scanouts to GTT after we enable display VM.

BUG=b:69941535,b:69647975
TEST=run WebGL Aquarium on Kahlee

Change-Id: I939b159551305f74102ba47eb551e2bed2e32e06
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/801797
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-12-08 23:14:00 -08:00
Gurchetan Singh
d300145b09 minigbm: make drv_add_combinations return nothing
Two reasons for this:

	1) We can use drv_array for driver combinations (see next patch)
	2) It's less verbose.

BUG=chromium:764871
TEST=gbmtest passes

Change-Id: I39bea6e2e9e4c76d2ca78566926a79bdc17f11d0
Reviewed-on: https://chromium-review.googlesource.com/758148
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:02 -08:00
Gurchetan Singh
ee43c301c2 minigbm: use struct vma for (*bo_map)/(*bo_unmap) callbacks
This sets better expectations for what we expect from the
backends.

BUG=chromium:764871
TEST=mmap_test

Change-Id: I7fb815b58fae8e9fbd73bf7c0263c7db44488844
Reviewed-on: https://chromium-review.googlesource.com/770519
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Joe Kniss <djmk@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-16 10:46:57 -08:00
Ricky Liang
0b78e0716b minigbm: amdgpu: add supported formats for camera
Set the CAMERA_{READ|WRITE} flags for formats that are used by the
camera stack.

BUG=b:69109002
TEST=Verify that camera works on Kahlee.

Change-Id: I4c9aacdc71d3b18188783007f8c88da37ed28dca
Reviewed-on: https://chromium-review.googlesource.com/762687
Commit-Ready: Ricky Liang <jcliang@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-11-11 05:28:27 -08:00
Gurchetan Singh
47e629b70d minigbm: refactor and rename mapping struct
Since some drivers (AMDGPU, Tegra) may have to do expensive tiling
and detiling operations, we should try to take advantage of the
access regions passed in by gralloc and gbm. Let's refactor struct
map_data so we can separate the actual mapping and access region.

Here is the Coccinelle rule used in this change:

@@ struct map_info *M; @@
-   (M)
+   M->vma

In addition, struct map_data was also renamed to struct mapping.

BUG=chromium:764871
TEST= mmap_test -g on Kevin

Change-Id: Idb094aa3b5f81e45ce3a2f4fb2d9bf8fba32bf29
Reviewed-on: https://chromium-review.googlesource.com/758144
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Joe Kniss <djmk@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-08 22:21:56 -08:00
Gurchetan Singh
3e9d3830dc minigbm: re-const-ify driver backends
minigbm driver creation needs to be re-entrant (see CL:674528). Let's
re-constify to make this behavior explicit.

BUG=none
TEST=emerge-eve {minigbm, arc-cros-gralloc}

Change-Id: I037966199d4aa6de60432127e10fea1fb602694b
Reviewed-on: https://chromium-review.googlesource.com/758142
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-08 15:10:09 -08:00
Alec Thilenius
a29bf678db minigbm: amdgpu: Add ABGR8888 to supported render target formats
Added DRM_FORMAT_ABGR8888 to the list of supported
render_target_formats.

BUG=b:67707215
TEST=teravest@chromium.org confirmed that this worked.

Change-Id: I0d1578f9a0ca98f28ebf60d396d1dbdae25435f1
Reviewed-on: https://chromium-review.googlesource.com/747723
Commit-Ready: Alec Thilenius <athilenius@chromium.org>
Tested-by: Alec Thilenius <athilenius@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-11-01 14:06:31 -07:00
Alec Thilenius
d9354b69f2 minigbm: amdgpu: Add RGB565 to supported render target formats
Added DRM_FORMAT_RGB565 to the list of supported render_target_formats.

BUG=b:67914863
TEST=On Kahlee, sample Android GL application renders a red triangle correctly
using the RGB565 render target format.

Change-Id: I79c6cafebfb111bb75182fc48ce0216f1bc789fd
Reviewed-on: https://chromium-review.googlesource.com/739758
Commit-Ready: Alec Thilenius <athilenius@chromium.org>
Tested-by: Alec Thilenius <athilenius@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-27 16:14:12 -07:00
Kristian H. Kristensen
bc8c5930f7 minigbm: Use more descriptive modifier names
DRM_FORMAT_MOD_NONE means that the buffer layout is "not modified", as
opposed to "no modifier present". In other words, linear, since the
assumption is that that's the starting point.  This was later
clarified by introducing the DRM_FORMAT_MOD_LINEAR as a alias for
DRM_FORMAT_MOD_NONE and DRM_FORMAT_MOD_INVALID as a NULL-like value
for modifiers.

This commit replaces DRM_FORMAT_MOD_NONE with DRM_FORMAT_MOD_LINEAR
where we mean linear (which is most places) and DRM_FORMAT_MOD_INVALID
where we want to indicate "no modifier" (in struct kms_item).

BUG=chromium:763760
TEST=Intel GPU board boots and has X-tiled framebuffers.

Change-Id: I93e1419e1ab4c04ad6ef3d48ada19487b880886d
Reviewed-on: https://chromium-review.googlesource.com/737409
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-26 11:30:36 -07:00
Shirish S
0913b8bcf1 minigbm: amdgpu: make AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED default
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED is required for mmapping
buffers in the amdgpu kernel driver.

This patch makes it default for all buffers on create.

However it should be noted that in case we find any performance related
regression in an un-tested scenario this patch needs to be reverted.

BUG=b:65297611
TEST=On Kahlee,
     UI comes up.
     GLMark2 & GLbench.bvt autotests pass
     atomictest -t multiplanes passes
     WebGL Aquarium

Change-Id: Ic82b25de63e66aac7aa04b4b255eb432c10c911b
Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/727824
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-24 02:20:34 -07:00
Shirish S
8317bc0658 minigbm: amdgpu: make bo's created with SCANOUT flag mmapable
amdgpu kenrel driver can mmap a 'bo' only if it has
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED  flag set.
This flag was not set in case if the 'bo' is used as a SCANOUT buffer,
for several reasons like it might impact performance etc.
But due to several requirements realted testing drm functionalitites
like atomicity, multi-planes etc., this restriction needs to be
removed.
Several known tests related to performance have been done after making
this change and none have shown glaring performance regressions.

However it should be noted that in case we find any performance related
regression in an un-tested scenario this patch needs to be reverted.

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

Change-Id: If629b64f3a14f843972b25d393a0a16058b3044e
Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/715037
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-14 03:18:34 -07:00
Gurchetan Singh
cfb8876755 minigbm: pass in map flags to (*bo_map) callback
Some eagle-eyed observers have commented that we lose some
potentially useful information for the (*bo_map) callback when
we convert our map flags to page protection flags. Let's not
lose this information, so pass in the map flags. We can convert
to page protection flags using a helper function.

BUG=chromium:764871
TEST=Boot Android and play games on Eve

Change-Id: Ie2cf395109eb5a8de663dfb97a343d20ff0df30c
Reviewed-on: https://chromium-review.googlesource.com/691425
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-02 23:28:25 -07:00
Deepak Sharma
4a4646a555 minigbm: amdgpu: Add formats R8, GR88
Add R8 and GR88 format for dma_bufs in amdgpu.
Required to support native GMB video playback.
If native GMB is enbaled,chrome transcodes NV12 to
RGB by importing Y plane as R8 EGLImage and the UV plane as GR88 EGLImage.

BUG=b:65302612
TEST=Boot Kahlee with --enable-native-gpu-memory-buffers and play youtube.

Change-Id: Ifa7e50959bb5417088357a0c0aa3ac874ecf6fc9
Signed-off-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/695850
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-02 20:25:37 -07:00
Gurchetan Singh
a1892b2800 minigbm: standardize naming of buffer creation flags
We use the terms "flags" and "usage" interchangeably in this repo,
since they essentally mean the same thing.  However, let's be a
little more consistent since it's kind of confusing, especially
when buffer map flags come to play. Let's:

	- refer to everything in the drv_* layer as use_flags
	- refer to everything in the gbm/gralloc layers as
	  usages

BUG=chromium:764871
TEST=emerge-eve {arc-cros-gralloc, minigbm}

Change-Id: If987d72369b895f38cde87e50ce1080f78f2a084
Reviewed-on: https://chromium-review.googlesource.com/691423
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-02 17:27:17 -07:00
Gurchetan Singh
60ee5833b1 minigbm: pass in buffer creation flags of the right size
The buffer creation flags are uint64_t, not uint32_t.

BUG=none
TEST=emerge-eve {minigbm, arc-cros-gralloc}

Change-Id: Id94911c5e19c00d47f2fbdca570a6a08fc92b82e
Reviewed-on: https://chromium-review.googlesource.com/691422
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2017-09-29 14:35:25 -07:00
Gurchetan Singh
ba6bd503a8 minigbm: add a default (*bo_unmap) implementation
The (*bo_unmap) function is responsible for unmapping the buffer
and cleaning up any data allocated during (*bo_map). Previously,
we called munmap in drv_bo_unmap(), which caused some confusion.
This method is cleaner.

BUG=chromium:764871
TEST=emerge-betty minigbm

Change-Id: I4dc20cd6b15e79bce21d33f03ebc84480c582981
Reviewed-on: https://chromium-review.googlesource.com/671693
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Joe Kniss <djmk@google.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2017-09-26 20:43:59 -07:00
Joe Kniss
6570585576 Plumb buffer map permissions through gbm.
Map read/write permissions were being ignored by minigbm.  This can
cause segfaults or failed mappings if the device FD permissions are not
rw.

Also adds bounds checking in tegra.c for tile/untile transfers.

BUG=chromium:737328
TEST=cyan, nyan graphicsSanity with read only on device

Change-Id: I8fccaed4e908cda3ff7d7cf451d0ad75d65039e6
Reviewed-on: https://chromium-review.googlesource.com/556980
Commit-Ready: Joe Kniss <djmk@google.com>
Tested-by: Joe Kniss <djmk@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-07-11 10:25:12 -07:00
Tomasz Figa
ce1ae023e9 minigbm: Resolve format based on BO usage flags
On certain platforms, depending on buffer usage, the preference for
implementation defined or flexible YUV formats might be different.
For example, the camera subsystem on Poppy (i915) requires NV12 for
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, but it can't be used in place
of RGBX as a render target.

Allow this by extending the .resolve_format driver callback to take BO
flags as argument and let the driver include this in the format
selection logic.

BUG=b:37615277
TEST=compile

Change-Id: Ieb44c294584ab25f106a92f406353212989d0724
Reviewed-on: https://chromium-review.googlesource.com/487553
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-07-10 11:22:36 -07:00