OSDN Git Service

android-x86/external-minigbm.git
4 years agoDO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master
Xin Li [Tue, 2 Jul 2019 19:42:45 +0000 (12:42 -0700)]
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master
am: c960faca0f

Change-Id: I7ecfedce5f9214ed1b75f7378d3b743bc02aadbd

4 years agoDO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master
Xin Li [Mon, 1 Jul 2019 20:59:32 +0000 (20:59 +0000)]
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master

Bug: 134405016
Change-Id: Ie88471035cd29f26971b4865c7c1d721bd6f5c76

4 years agoUpdate OWNERS for my new LDAP am: d0dceb46dd am: 9f8fe2bbe0
Alistair Delva [Thu, 27 Jun 2019 19:41:52 +0000 (12:41 -0700)]
Update OWNERS for my new LDAP am: d0dceb46dd am: 9f8fe2bbe0
am: 6c13d0657c

Change-Id: I34f6f5ff0da513faf3f008944885785011130997

4 years agoUpdate OWNERS for my new LDAP am: d0dceb46dd
Alistair Delva [Thu, 27 Jun 2019 19:20:24 +0000 (12:20 -0700)]
Update OWNERS for my new LDAP am: d0dceb46dd
am: 9f8fe2bbe0

Change-Id: Ice7c045feace9fe2f2876569215abd9e94481640

4 years agoUpdate OWNERS for my new LDAP
Alistair Delva [Thu, 27 Jun 2019 19:05:51 +0000 (12:05 -0700)]
Update OWNERS for my new LDAP
am: d0dceb46dd

Change-Id: I440ec83d2f236b52c442891535e866f559e282fa

4 years agoUpdate OWNERS for my new LDAP
Alistair Delva [Wed, 26 Jun 2019 18:29:55 +0000 (11:29 -0700)]
Update OWNERS for my new LDAP

Exempt-From-Owner-Approval: I was the only owner

Change-Id: Ife39959288f2414da063652739343656bccc7cf9

4 years agoModify gralloc0 implementation
Valerie Hau [Mon, 6 May 2019 16:28:35 +0000 (09:28 -0700)]
Modify gralloc0 implementation
am: 8894cf7256

Change-Id: I904b1c519f8a39284738d4d26418a00fbf2f896f

5 years agoModify gralloc0 implementation
Valerie Hau [Thu, 25 Apr 2019 18:12:42 +0000 (11:12 -0700)]
Modify gralloc0 implementation

Add validateBufferSize and getTransportSize

Bug: 131089111
Test: build, boot
Change-Id: I53195c75907c51585ed68a885d8c35fe90f1b885

5 years agoMerge master@5428150 into git_qt-dev-plus-aosp.
Bill Rassieur [Wed, 3 Apr 2019 23:29:47 +0000 (16:29 -0700)]
Merge master@5428150 into git_qt-dev-plus-aosp.
am: 2ebe94b665

Change-Id: I9324f1d823e3f971bd63a2a5bcc3d70dbec36480

5 years agoMerge master@5428150 into git_qt-dev-plus-aosp.
Bill Rassieur [Tue, 2 Apr 2019 18:30:16 +0000 (18:30 +0000)]
Merge master@5428150 into git_qt-dev-plus-aosp.

Change-Id: Iab4a62d752fbf4432cff21eb2ac34a52557582b8
BUG: 129345239

5 years agoConvert external/minigbm to Android.bp am: 9521a60253 am: 5a5d91c739
Colin Cross [Wed, 27 Mar 2019 08:26:34 +0000 (01:26 -0700)]
Convert external/minigbm to Android.bp am: 9521a60253 am: 5a5d91c739
am: 1649282621

Change-Id: I45add530e5e692a4878aa37117858c639a5711e7

5 years agoConvert external/minigbm to Android.bp am: 9521a60253
Colin Cross [Wed, 27 Mar 2019 08:10:10 +0000 (01:10 -0700)]
Convert external/minigbm to Android.bp am: 9521a60253
am: 5a5d91c739

Change-Id: I068e82860803140b3df1585e63cdf0fcdc1939b9

5 years agoConvert external/minigbm to Android.bp
Colin Cross [Wed, 27 Mar 2019 08:06:18 +0000 (01:06 -0700)]
Convert external/minigbm to Android.bp
am: 9521a60253

Change-Id: Ic3cd220fb8bd69a3e438e98550483d77f4abdfa8

5 years agoConvert external/minigbm to Android.bp
Colin Cross [Fri, 22 Mar 2019 20:15:06 +0000 (13:15 -0700)]
Convert external/minigbm to Android.bp

See build/soong/README.md for more information.

This replaces the product and BoardConfig.mk variable conditionals
with different versions of the HAL for each product, which will
also allow checkbuild to verify that they build even on products
that don't use them.

Fixes: 122332792
Test: mma
Change-Id: Ie8b6316ea09795e36339f94883c89795771c1f48

5 years agoAllow minigbm gralloc to coexist with board gralloc. am: 3fbaca6783 am: ff234ae422
Alistair Strachan [Fri, 13 Jul 2018 20:25:54 +0000 (13:25 -0700)]
Allow minigbm gralloc to coexist with board gralloc. am: 3fbaca6783 am: ff234ae422
am: 386c14aaeb

Change-Id: Ib10c60c9018feac18277737347a0fa5ae5a2ac9e

5 years agoAllow minigbm gralloc to coexist with board gralloc. am: 3fbaca6783
Alistair Strachan [Fri, 13 Jul 2018 19:56:19 +0000 (12:56 -0700)]
Allow minigbm gralloc to coexist with board gralloc. am: 3fbaca6783
am: ff234ae422

Change-Id: I3a6a0db16f4bd7048aa9b985fdd7444a8fda5cc7

5 years agoAllow minigbm gralloc to coexist with board gralloc.
Alistair Strachan [Fri, 13 Jul 2018 19:17:26 +0000 (12:17 -0700)]
Allow minigbm gralloc to coexist with board gralloc.
am: 3fbaca6783

Change-Id: I884b6bd6e0658b9b931b53d42bcee1ecbc16fc95

5 years agoAllow minigbm gralloc to coexist with board gralloc.
Alistair Strachan [Fri, 13 Jul 2018 15:56:21 +0000 (08:56 -0700)]
Allow minigbm gralloc to coexist with board gralloc.

Set the ro.hardware.gralloc property to 'minigbm' to have the new module
name be loaded preferentially.

Bug: 77276633
Change-Id: Ib247ee08486887bd76b86ed9c8b7d62c58a31af7
Signed-off-by: Alistair Strachan <astrachan@google.com>
5 years agoMerge branch 'upstream-master'
Alistair Strachan [Thu, 12 Jul 2018 18:38:52 +0000 (11:38 -0700)]
Merge branch 'upstream-master'
am: 5e2c4ec751

Change-Id: Id2b36261424b2297fdd3e65b588a3fb4af128e70

5 years agoAdd OWNERS and METADATA.
Alistair Strachan [Thu, 12 Jul 2018 18:38:40 +0000 (11:38 -0700)]
Add OWNERS and METADATA.
am: f8de45da7b

Change-Id: I9cf6883a60a3f2aec417f0533b12d9c1d31603aa

5 years agoMerge remote-tracking branch 'aosp/upstream-master' into HEAD
Casey Dahlin [Thu, 12 Jul 2018 18:37:20 +0000 (11:37 -0700)]
Merge remote-tracking branch 'aosp/upstream-master' into HEAD
am: 721abfd9a6

Change-Id: I551a4dc8b421c2824c7c2586e899ea15cc6ddb8f

5 years agoMerge branch 'upstream-master'
Alistair Strachan [Mon, 25 Jun 2018 21:45:26 +0000 (14:45 -0700)]
Merge branch 'upstream-master'

Bug: 77276633
Change-Id: I28e84c7d1c280d229cca13ec6c6bd3f9c58d0455
Signed-off-by: Alistair Strachan <astrachan@google.com>
5 years agoAdd OWNERS and METADATA.
Alistair Strachan [Mon, 25 Jun 2018 21:40:04 +0000 (14:40 -0700)]
Add OWNERS and METADATA.

Along with the licensing files required by AOSP.

Bug: 77276633
Change-Id: I9b8d8d2f32658750696c453d439a168af2b7f7fb
Signed-off-by: Alistair Strachan <astrachan@google.com>
5 years agominigbm: DRM_FORMAT_BGR888 for amdgpu
Drew Davenport [Wed, 20 Jun 2018 21:46:50 +0000 (15:46 -0600)]
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>
5 years agominigbm: Build fix for arm64
Dániel Bátyai [Fri, 15 Jun 2018 13:12:13 +0000 (15:12 +0200)]
minigbm: Build fix for arm64

When compiling for arm64 uint64_t is considered to be unsigned long,
which caused a format error.

BUG=none
TEST=emerge

Change-Id: Ic5559ba5dce1725dd34eed60609bc1a65735c7f2
Reviewed-on: https://chromium-review.googlesource.com/1102468
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daniel Batyai <dbatyai@inf.u-szeged.hu>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: add support for BG24
Gurchetan Singh [Thu, 7 Jun 2018 00:01:51 +0000 (17:01 -0700)]
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>
5 years agominigbm: run clang-format
Gurchetan Singh [Thu, 7 Jun 2018 00:15:31 +0000 (17:15 -0700)]
minigbm: run clang-format

It's good to do this now and again.

BUG=none
TEST=none

Change-Id: Ie96486b5d34c99a4b00cdfd8488a0468188d35bd
Reviewed-on: https://chromium-review.googlesource.com/1089492
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoReland "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
Kristian H. Kristensen [Wed, 4 Apr 2018 23:10:42 +0000 (16:10 -0700)]
Reland "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"

This is a reland of 1bd7b04a3ae68c0314bdee06c559093de9e5a304

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>
5 years agoRevert "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
Hirokazu Honda [Mon, 21 May 2018 06:32:57 +0000 (06:32 +0000)]
Revert "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"

This reverts commit 1bd7b04a3ae68c0314bdee06c559093de9e5a304.

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>
5 years agoi915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
Kristian H. Kristensen [Wed, 4 Apr 2018 23:10:42 +0000 (16:10 -0700)]
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>
5 years agominigbm: remove addrlib dependency for arc-cros-gralloc
Satyajit Sahu [Wed, 16 May 2018 08:52:48 +0000 (14:22 +0530)]
minigbm: remove addrlib dependency for arc-cros-gralloc

addrlib is not required now. Removing the dependency

BUG=b:72972511
TEST=Chrome boots to UI and android play store comes up

Change-Id: If0ddfe8bee2bb74bf898479f7e263ae731e8bea9
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1060935
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: Update Android.mk to export the include path
Daniel Nicoara [Thu, 10 May 2018 21:58:03 +0000 (17:58 -0400)]
minigbm: Update Android.mk to export the include path

Allows other applications depending on it to pick up minigbm headers
without explicitly specifying the path.

BUG=b:78869504
TEST=Compiled application depending on minigbm

Change-Id: Ie1681579145620ba330721393f0ad71a00109102
Reviewed-on: https://chromium-review.googlesource.com/1054615
Commit-Ready: Daniel Nicoara <dnicoara@chromium.org>
Tested-by: Daniel Nicoara <dnicoara@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: Use the stride value returned by mapImage
Satyajit Sahu [Thu, 3 May 2018 11:05:24 +0000 (16:35 +0530)]
minigbm: Use the stride value returned by mapImage

mapImage can return a different stride value. This value must be
used for the mapped address.

BUG=b:38152101 b:79346377
TEST=graphics_Sanity autotest passed

Change-Id: Ie0eb716291366ae6a047d704f66d24ec41738713
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1041369
Commit-Ready: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Drew Davenport <ddavenport@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: amdgpu: switch BO allocation domain to GTT from VRAM
Deepak Sharma [Tue, 1 May 2018 19:11:27 +0000 (12:11 -0700)]
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>
5 years agoRevert "minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16"
Gurchetan Singh [Sat, 5 May 2018 00:42:12 +0000 (00:42 +0000)]
Revert "minigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16"

This reverts commit 292da5365a373a8e1eed603fc3aa16e3595d8252.

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>
5 years agoi915: Align stride and offset per plane
Kristian H. Kristensen [Wed, 4 Apr 2018 21:21:41 +0000 (14:21 -0700)]
i915: Align stride and offset per plane

Current code over-aligns the Y-plane dimensions by a factor of two, so
as to make sure alignment requirements are still satisfied when the
subsampled plane stride and height are divided by two. Instead, this
commit changes the approach to align each plane separately after
computing the plane width and height. We stop using
drv_bo_from_format(), which divides the stride and instead loop
through the planes ourselves.

BUG=822346
TEST=test_that graphics_Gbm

Change-Id: I1ea8f2fb8b1780686d4086f51e9bab759f724d78
Reviewed-on: https://chromium-review.googlesource.com/996647
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: For BO_USE_SW usage buffer need not be linear
Satyajit Sahu [Thu, 3 May 2018 10:40:11 +0000 (16:10 +0530)]
minigbm: For BO_USE_SW usage buffer need not be linear

It is incorrect to force linear for BO_USE_SW usage as mapImage
in dri_bo_map converts tiled data and returns linear.

BUG=b:78200321
TEST=drm_cursor_test completes within 20 seconds.

Change-Id: Ifa3ca2218cee9ff52b049a984a70a54f4899965d
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1041448
Commit-Ready: Drew Davenport <ddavenport@chromium.org>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoRevert "minigbm: i915: Add necessary padding to Android YV12 buffers"
Kristian H. Kristensen [Thu, 3 May 2018 20:40:47 +0000 (20:40 +0000)]
Revert "minigbm: i915: Add necessary padding to Android YV12 buffers"

This reverts commit d846de667cba72121ec579912d0854729f013731.

When mesa switched to isl internally, dma-buf import regressed in a
few cases where isl was overly strict.  One issue was enforcing slice
alignment in calculating the minimum size of a buffer.  The alignment
is required for the slice placement, but not the size.  We worked
around it in commit d846de667cba72121ec579912d0854729f013731, but mesa
commit 4d27c6095e8385cccd225993452baad4d2e35420 fixes the problem and
we can now revert the minigbm bandaid.

The revert leaves the change to drv_bo_from_format() in place where it
was modified to look at the passed in format argument instead of
bo->format.

Original change's description:
> minigbm: i915: Add necessary padding to Android YV12 buffers
>
> All the regular formats are already aligned by current code, except
> Android YV12, which requires height of planes to be unchanged. However
> Mesa requires each plane to have at least certain required padding
> between planes. Work around this by calculating total BO size with
> aligned height to allow padding space to overlap with further planes
> and making sure that padding of last plane fits in the buffer. This is
> okay, since Mesa requirement seems to indicate that data of the padding
> area should not be affected and padding is only needed to satisfy GPU
> cache requests.
>
> Fixes following CTS tests on Intel platforms:
> android.media.cts.VideoEncoderTest#testGoogH264FlexArbitraryH
> android.media.cts.VideoEncoderTest#testGoogH264FlexNearMaxMin
> android.media.cts.VideoEncoderTest#testGoogH264SurfArbitraryH
> android.media.cts.VideoEncoderTest#testGoogH264SurfNearMaxMin
>
> BUG=b:63957026
> TEST=./cts-tradefed run cts -m CtsMediaTestCases -t
>  android.media.cts.VideoEncoderTest
>
> Change-Id: I46d44178ba983c0038b630b13b9b281251393f8f
> Reviewed-on: https://chromium-review.googlesource.com/592990
> Commit-Ready: Tomasz Figa <tfiga@chromium.org>
> Tested-by: Tomasz Figa <tfiga@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

Bug: b:63957026
Change-Id: I9a0db4f01a7ec206375f8a0ba5219b5c5d9a4c0e
Reviewed-on: https://chromium-review.googlesource.com/1042746
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoRevert "minigbm: i965: Add 64-byte padding at the end of linear buffers"
Tomasz Figa [Wed, 2 Aug 2017 05:35:52 +0000 (05:35 +0000)]
Revert "minigbm: i965: Add 64-byte padding at the end of linear buffers"

This reverts commit 581f3a5e3089cfd5bb38432eb2874d9a5b132a17.

Reason for revert: It looks like the requirements are being
removed from Mesa, due to the kernel driver being expected to
provide certain guaranties over how it manages the GPU address
space, so that they are satisfied (see CL:597567).

With this, we can stop overallocating and simplify minigbm code.

Original change's description:
> minigbm: i965: Add 64-byte padding at the end of linear buffers
>
> According to the ISL library used now by Mesa i965 driver to manage
> surfaces, linear surfaces must have 64-byte padding added at the end,
> due to the way how the GPU issues cache requests.
>
> BUG=b:63957026
> TEST=./cts-tradefed run cts --skip-preconditions --skip-device-info -m
>   CtsCameraTestCases -t
>   android.hardware.camera2.cts.MultiViewTest#testDualTextureViewAndImageReaderPreview
>   on Eve
>
> Change-Id: I4887449a8e6e090b5ab7925b6f5c764cedd7589f
> Reviewed-on: https://chromium-review.googlesource.com/582253
> Commit-Ready: Tomasz Figa <tfiga@chromium.org>
> Tested-by: Tomasz Figa <tfiga@chromium.org>
> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>

BUG=b:63957026
TEST=./cts-tradefed run cts -m CtsCameraTestCases
 -t android.hardware.camera2.cts.MultiViewTest
TEST=./cts-tradefed run cts -m CtsMediaTestCases
 -t android.media.cts.VideoEncoderTest

Change-Id: Id17d65fd9fe81e0152e37e92e8eda39c0fceebf1
Reviewed-on: https://chromium-review.googlesource.com/597529
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: Drop drv_bo_get_stride_in_pixels() helper
Kristian H. Kristensen [Wed, 4 Apr 2018 20:40:47 +0000 (13:40 -0700)]
minigbm: Drop drv_bo_get_stride_in_pixels() helper

Computing "stride in pixels" assumes the pixel size divides the
stride, which isn't always the case.  This is only used for the
cros_gralloc implementation, so lets move the calculation there
instead of providing a generic helper for an unhealthy concept.

BUG=822346
TEST=test_that graphics_Gbm

Change-Id: Iab7a363c5471e4bacef7df7095ef77723adf5e93
Reviewed-on: https://chromium-review.googlesource.com/996645
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: add support for HAL_PIXEL_FORMAT_RGBA_FP16
Gurchetan Singh [Thu, 26 Apr 2018 00:36:59 +0000 (17:36 -0700)]
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>
6 years agominigbm: cros_gralloc: fix -Wimplicit-function-declaration warnings in gralloctest
Gurchetan Singh [Wed, 25 Apr 2018 22:29:32 +0000 (15:29 -0700)]
minigbm: cros_gralloc: fix -Wimplicit-function-declaration warnings in gralloctest

The arcnext compiler seems to throw more warnings.

BUG=none
TEST=compile for kevin arc-next

Change-Id: Ib7b0518d675db06549312a2e7b814093d75424f5
Reviewed-on: https://chromium-review.googlesource.com/1029354
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: Consolidate format info in new struct planar_layout
Kristian H. Kristensen [Wed, 4 Apr 2018 21:02:50 +0000 (14:02 -0700)]
minigbm: Consolidate format info in new struct planar_layout

This consolidates the relevant information about the planar layouts we
support in one place.

Change-Id: I6fbfd59f5d56777f612e4cc44e634ed193a435ad
Reviewed-on: https://chromium-review.googlesource.com/996646
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoBuild fix against latest AOSP master.
Alistair Strachan [Tue, 10 Apr 2018 01:50:30 +0000 (18:50 -0700)]
Build fix against latest AOSP master.

Move away from using the deprecated header paths in AOSP master. Add
explicit dependencies on the header modules and library modules being
used.

Change-Id: Ifaf159129dd34d2b99f7ee86f6e5fde9276d0aea
Reviewed-on: https://chromium-review.googlesource.com/1005720
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoFix -Wcast-qual warnings.
Alistair Strachan [Tue, 10 Apr 2018 01:49:51 +0000 (18:49 -0700)]
Fix -Wcast-qual warnings.

The Android.mk file enables -Wcast-qual and clang finds problems in
gralloc0.cc where the constness of a pointer is being cast away. AOSP
master is setting -Werror, so these warnings break the build. Fix them.

Change-Id: I8820efab34a15d0653b89303d5390fb9f3eee12d
Reviewed-on: https://chromium-review.googlesource.com/1005719
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: using dri extensions
Satyajit [Fri, 12 Jan 2018 09:19:05 +0000 (14:49 +0530)]
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>
6 years agoi915: Allow allocating ARGB buffers for scanout
Kristian H. Kristensen [Wed, 11 Apr 2018 22:55:13 +0000 (15:55 -0700)]
i915: Allow allocating ARGB buffers for scanout

CL:991261 changed our primary framebuffer format from XRGB to ARGB. We
still only scanout as XRGB where the display controller doesn't
support ARGB, but minigbm doesn't know that. As a result, when we try
to allocate an ARGB buffer with the SCANOUT useflag, we get a linear
buffer.  This breaks PSR and regresses performance and, in general,
just isn't what we want.

This CL enables SCANOUT for all ARGB formats where the corresponding
XRGB formats supports scanout. In the end, it's up to the caller to
make sure a format works for scanout anyway.

BUG=827188,830969
TEST=test_that graphics_Idle on samus

Change-Id: Iab428e5b21abedcac7cee86fccc8df50dab3f471
Reviewed-on: https://chromium-review.googlesource.com/1008867
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: virtio_gpu: select dumb/virgl at runtime.
Lepton Wu [Thu, 5 Apr 2018 19:50:03 +0000 (12:50 -0700)]
minigbm: virtio_gpu: select dumb/virgl at runtime.

For using same image on legacy-qemu and virgl enabled qemu. We need
to handle dumb and virgl code path at run time. Just merge them to
one driver.

BUG=b:77302150
TEST=manual - run novato image under qemu with gl=on/off.

Change-Id: Ia12140fba16a350fe13f4258d25333ecfe8352b3
Reviewed-on: https://chromium-review.googlesource.com/998631
Commit-Ready: Lepton Wu <lepton@chromium.org>
Tested-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoUpdate Android.mk for amlogic
Albert Chaulk [Thu, 5 Apr 2018 20:56:53 +0000 (16:56 -0400)]
Update Android.mk for amlogic

This adds a separate app-linkable libminigbm target that disables
the gralloc code and links in the gbm api. Adds support for meson
buildflag.

Bug: b/76099793
Test: amlogic test tool, drawframe
Change-Id: I7aba3ec65fa39cabbb8c96c44d6d59b8225956a9
Reviewed-on: https://chromium-review.googlesource.com/998758
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: drv_bo_flush --> drv_bo_flush_or_unmap
Gurchetan Singh [Thu, 29 Mar 2018 23:34:53 +0000 (16:34 -0700)]
minigbm: drv_bo_flush --> drv_bo_flush_or_unmap

There's no flush or invalidate mechnaism with the DRI interface,
so we'll have to support mapping and unmapping.

BUG=b:72972511
TEST=gbmtest passes in CQ

Change-Id: If3aef651f8549544ed4ed499e17f7f99c597974c
Reviewed-on: https://chromium-review.googlesource.com/990892
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-by: Joe Kniss <djmk@google.com>
Reviewed-by: Satyajit Sahu <satyajit.sahu@amd.com>
6 years agominigbm: Enable vc4 driver
Jeremy Grosser [Fri, 30 Mar 2018 08:19:41 +0000 (01:19 -0700)]
minigbm: Enable vc4 driver

BUG=None
TEST=graphics_Gbm on target board

Change-Id: Id92466354e644f9237f8c19aebd0534c1b23bbc0
Reviewed-on: https://chromium-review.googlesource.com/989301
Commit-Ready: Jeremy Grosser <jeremy@synack.me>
Tested-by: Jeremy Grosser <jeremy@synack.me>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: amdgpu: Disable explicit synchronization when possible.
Bas Nieuwenhuizen [Fri, 23 Mar 2018 16:21:37 +0000 (17:21 +0100)]
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>
6 years agoUse Android log system in helpers.c.
Alistair Strachan [Mon, 19 Mar 2018 21:03:23 +0000 (14:03 -0700)]
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>
6 years agoAndroid: Support building the virtio_virgl backend.
Alistair Strachan [Tue, 20 Mar 2018 22:55:20 +0000 (15:55 -0700)]
Android: Support building the virtio_virgl backend.

Enabled automatically if BOARD_GPU_DRIVERS=virgl. If you leave this
unset, the build will still include support for virtio_dumb.

Change-Id: I2cfeab8fb3a0be7b3c1874fa036d433ff57567cd
Reviewed-on: https://chromium-review.googlesource.com/972449
Commit-Ready: Alistair Strachan <astrachan@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoFix minigbm against older kernel DRM versions.
Alistair Strachan [Tue, 20 Mar 2018 18:10:51 +0000 (11:10 -0700)]
Fix minigbm against older kernel DRM versions.

In 4.4, the DRM implementation only allowed DRM_CLOEXEC to be specified to
drmPrimeHandleToFD(), but it gave you a read/write mapping when mmap'ed.

In newer kernels the DRM_RDWR flag needs to be specified to get a
read/write mapping.

Try the new way, and if that fails, try the old way. If the handle
conversion fails for any reason other than this flag check, it'll
still fail.

Change-Id: I7fabb6a0d23e7b9b70f970aad0bc243a76583e33
Reviewed-on: https://chromium-review.googlesource.com/971461
Commit-Ready: Alistair Strachan <astrachan@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoFix the build against AOSP master.
Alistair Strachan [Mon, 19 Mar 2018 21:06:39 +0000 (14:06 -0700)]
Fix the build against AOSP master.

Clear out some bitrot and use the new mechanism for including headers.

Change-Id: I3b74a5472209c7632e7aab757ef88365141c9525
Reviewed-on: https://chromium-review.googlesource.com/971359
Commit-Ready: Alistair Strachan <astrachan@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoBuild fix for older libdrm versions.
Alistair Strachan [Mon, 19 Mar 2018 21:04:23 +0000 (14:04 -0700)]
Build fix for older libdrm versions.

When building against an older libdrm, the DRM_FORMAT_MOD_LINEAR enum
will be missing. It's OK to use DRM_FORMAT_MOD_NONE instead, because
this older libdrm has limited DRM_FORMAT_MOD_xx support and not all of
the backends actually need it.

Change-Id: I0c289c50de4ad1fe5a9b0848961f5bcb75bd4bf8
Reviewed-on: https://chromium-review.googlesource.com/971358
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: virtio_gpu: set vma->length when mmap.
Tao Wu [Tue, 13 Mar 2018 01:07:43 +0000 (18:07 -0700)]
minigbm: virtio_gpu: set vma->length when mmap.

Othewise bo_unmap won't work. Also add a ifdef guard for PAGE_SIZE
to make it also compile under ARC++.

BUG=b:70179880
TEST=Run /usr/local/autotest/bin/screenshot.py with qemu+virgl
TEST=Run Android App under ARC++ with qemu+virgl

Change-Id: I586446c56da091dd82d9bc9c1010d9b4ee4d92ee
Reviewed-on: https://chromium-review.googlesource.com/959527
Commit-Ready: Lepton Wu <lepton@chromium.org>
Tested-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agoRename amlogic backend in minigbm into meson
Sergey Volk [Tue, 6 Mar 2018 21:29:32 +0000 (13:29 -0800)]
Rename amlogic backend in minigbm into meson

The name of Amlogic DRM driver in kernel is "meson", so rename it in
minigbm to match that.

BUG=internal b/74248568
TEST=run ozone_demo on device

Change-Id: If2ef376715231f0b3c9fe320177d0e82d94214f0
Reviewed-on: https://chromium-review.googlesource.com/951912
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Alex Sakhartchouk <alexst@chromium.org>
Tested-by: Sergey Volk <servolk@chromium.org>
6 years agomsm: Align buffer dimensions for llvmpipe
Stéphane Marchesin [Thu, 1 Mar 2018 00:37:46 +0000 (16:37 -0800)]
msm: Align buffer dimensions for llvmpipe

While we are using llvmpipe, we should align the buffer dimensions
to a tile size.

Change-Id: Ia0da10851886a2c25f8a4bff779fe890ec86baef
Reviewed-on: https://chromium-review.googlesource.com/942346
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: amdgpu: support DRM_FORMAT_YVU420_ANDROID
Deepak Sharma [Tue, 20 Feb 2018 22:58:26 +0000 (14:58 -0800)]
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>
6 years agoi915: Always set the modifier when allocating BOs
Kristian H. Kristensen [Thu, 8 Feb 2018 00:10:06 +0000 (16:10 -0800)]
i915: Always set the modifier when allocating BOs

With CL:907756 we now pass modifiers around when export to and
importing from the rest of Chrome and we need to give the right answer
when ozone queries the modifier of a bo allocated with use flags.

Bug: 809670, 809666
Change-Id: Iab5ea62d5e0da9ddd90013f559f802270de1e420
Reviewed-on: https://chromium-review.googlesource.com/907848
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: Add minimal buffer allocation support for msm
Rajesh Yadav [Mon, 22 Jan 2018 12:59:06 +0000 (18:29 +0530)]
minigbm: Add minimal buffer allocation support for msm

Add minimal buffer allocation support using dumb_bo
for early enablement till the minigbm backend
implementation is avaialble for msm drv using
gem ioctls.

See CL:898422 for getting the DRV_MSM define in.

BUG=chromium:795946, b:72483556
TEST=Boot and see some graphics

Change-Id: Ieeb05923d756a3e4581a38cf6ce5cf406e2d197b
Reviewed-on: https://chromium-review.googlesource.com/897729
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: i915: Use NV12 as the main YUV format, including camera output
Tomasz Figa [Thu, 22 Jun 2017 07:52:43 +0000 (16:52 +0900)]
minigbm: i915: Use NV12 as the main YUV format, including camera output

On SKL and newer, the display controller supports NV12 natively for
overlays. Moreover it's the only output format supported by the camera
subsystem. Since it shouldn't matter for other uses cases if we use NV12
or YVU420, let's just switch everything to NV12 for simplicity.

BUG=b:32077885
TEST=Play a video in Android YouTube app on Cyan and Reef

Change-Id: I5cfcdec2b0e2020a3ae1e8364b60df3585838807
Reviewed-on: https://chromium-review.googlesource.com/544489
Commit-Ready: Owen Lin <owenlin@chromium.org>
Tested-by: Owen Lin <owenlin@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: remove gma500
Gurchetan Singh [Tue, 9 Jan 2018 22:22:04 +0000 (14:22 -0800)]
minigbm: remove gma500

We don't support this driver anymore.

BUG=none
TEST=none

Change-Id: Ib9f03a48e8825e3ac1f359e8fd75a68599790a14
Reviewed-on: https://chromium-review.googlesource.com/858169
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agoRevert "Revert "minigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR""
Gurchetan Singh [Fri, 12 Jan 2018 23:31:50 +0000 (23:31 +0000)]
Revert "Revert "minigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR""

This reverts commit 9ad07155dd9e5370e507d266766a8bcfbb4fa4d7.

Reason for revert: We haven't seen improvements in the graphs after the speculative
revert that landed in 10292.0.0:

https://chromeperf.appspot.com/group_report?keys=agxzfmNocm9tZXBlcmZyFAsSB0Fub21hbHkYgICQ6IzqogoM

Original change's description:
> Revert "minigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR"
>
> This reverts commit 9927d78669f67c2446888aa32a3e9f9c71f7228b.
>
> BUG=chromium:799639
> TEST=run graphics_GLMark2
>
> Change-Id: Idcf25de31fe2a17cc28900558e19145ca33dbff5
> Reviewed-on: https://chromium-review.googlesource.com/853223
> Commit-Ready: Dominik Behr <dbehr@chromium.org>
> Tested-by: Dominik Behr <dbehr@chromium.org>
> Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>

Bug: chromium:799639
Change-Id: I100b93e41f43c026181eef0777f76b5c2cd93d6c
Reviewed-on: https://chromium-review.googlesource.com/865773
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
6 years agominigbm: fix amlogic
Gurchetan Singh [Fri, 12 Jan 2018 23:22:53 +0000 (15:22 -0800)]
minigbm: fix amlogic

Commit 080523 ("minigbm: add amlogic backend") forgot to declare the
backend external variable.

BUG=None
TEST=None

Change-Id: I69c89645023e1cf45d7b4d480bdb85f3b838e276
Reviewed-on: https://chromium-review.googlesource.com/865771
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: add amlogic backend
Gurchetan Singh [Thu, 11 Jan 2018 23:42:36 +0000 (15:42 -0800)]
minigbm: add amlogic backend

Add dumb amlogic backend based on udl.

BUG=none
TEST=emerge-falco minigbm

Change-Id: I435d0924d8206b4058b76bf403175f9b2cbb1291
Reviewed-on: https://chromium-review.googlesource.com/861865
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Sergey Volk <servolk@chromium.org>
6 years agoRevert "minigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR"
Dominik Behr [Fri, 5 Jan 2018 22:15:15 +0000 (14:15 -0800)]
Revert "minigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR"

This reverts commit 9927d78669f67c2446888aa32a3e9f9c71f7228b.

BUG=chromium:799639
TEST=run graphics_GLMark2

Change-Id: Idcf25de31fe2a17cc28900558e19145ca33dbff5
Reviewed-on: https://chromium-review.googlesource.com/853223
Commit-Ready: Dominik Behr <dbehr@chromium.org>
Tested-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
6 years agominigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR
Gurchetan Singh [Tue, 12 Dec 2017 22:38:09 +0000 (14:38 -0800)]
minigbm: replace DRM_FORMAT_MOD_INVALID with DRM_FORMAT_MOD_LINEAR

CL:737409 replaced DRM_FORMAT_MOD_NONE with DRM_FORMAT_MOD_INVALID in
struct kms_item. We use drv_query_kms() to add the scanout flag to most
buffer combinations. That means anything with DRM_FORMAT_MOD_LINEAR
will not get the scanout flag, since drv_query_kms returns combinations
with DRM_FORMAT_MOD_INVALID. This leads to artifacts in the zero latency
app, since we end up picking a X-tiled buffer since we don't advertise
a linear buffer with scanout.

Since all hardware can scanout linear buffers, replace DRM_FORMAT_MOD_INVALID
with DRM_FORMAT_MOD_LINEAR.

BUG=chromium:762324
TEST=no overlay artifacts running Zero latency app

Change-Id: Ib8a33b9e8dde3767337b9cd32c5b2849f9c8aa04
Reviewed-on: https://chromium-review.googlesource.com/823258
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: amdgpu: use VRAM only for cursor and scanouts
Dominik Behr [Thu, 30 Nov 2017 20:23:06 +0000 (12:23 -0800)]
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>
6 years agominigbm: virtio_gpu: use resource create ioctl for rendering
Zach Reizner [Wed, 4 Oct 2017 20:15:57 +0000 (13:15 -0700)]
minigbm: virtio_gpu: use resource create ioctl for rendering

In the virtio_gpu kernel driver, there is a flag for each BO indicating
if the buffer was made with the dumb buffer create ioctl. If that flag
is set, the kernel will request a transfer to host on page flip, even if
the dumb buffer is used in host side rendering. In the case of host side
rendering, the transfer will wipe out the rendering because the transfer
copies from guest side backing memory which was never used.

To prevent that issue, the virtgpu resource create ioctl is used to
prevent the dumb flag from being set. Simple mmap'ed framebuffers will
not display properly unless they use gbm's mmap/munmap which includes a
transfer to/from the host on mmap/munmap with this change.

TEST=null_platform_test;
     mmap_test -g renders correctly but we get ENOSYS
     (function not implemented) from DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST.
     (DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST succeeds though)

That'll have to be fixed ..
BUG=None

Change-Id: Id36080f597efd00a96e625ee4301ebf26d9f19af
Reviewed-on: https://chromium-review.googlesource.com/701354
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: rockchip/mediatek: invalidate shadow buffers
Gurchetan Singh [Wed, 29 Nov 2017 00:56:17 +0000 (16:56 -0800)]
minigbm: rockchip/mediatek: invalidate shadow buffers

In the case where process A is writing to the buffer, and process
B is reading from the buffer via a shadow buffer, we should update
the shadow buffer.

This issue seems to only pop on renderscript tests on Mediatek devices,
but that's due the various differences between 3D driver implementations.
Let's modify rockchip for correctness as well.

BUG=b:69700010
TEST=run cts -m CtsViewTestCases -t android.view.cts.SurfaceViewSyncTests
     passes on Oak

Change-Id: Id551027a2093f5423ee380d8935637d6256d2295
Reviewed-on: https://chromium-review.googlesource.com/795038
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
6 years agoAdd a missing include for asserts.
Tomasz Mikolajewski [Fri, 17 Nov 2017 11:30:56 +0000 (20:30 +0900)]
Add a missing include for asserts.

The missing include would cause image builders fail on
-arcnext builds.

BUG=chromium:764871
TEST=emerge arc-cros-gralloc and minigbm on -arcnext.

Change-Id: Ifde30bcde72a1fae4d13c95b17273880512cafe2
Reviewed-on: https://chromium-review.googlesource.com/776640
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: add GBM_BO_USE_SW_{READ,WRITE}_{OFTEN,RARELY} usage flags
Shirish S [Fri, 13 Oct 2017 04:24:03 +0000 (09:54 +0530)]
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>
6 years agoRevert "minigbm: Revert "minigbm: flush buffer instead of unmapping""
Gurchetan Singh [Tue, 10 Oct 2017 19:11:16 +0000 (12:11 -0700)]
Revert "minigbm: Revert "minigbm: flush buffer instead of unmapping""

The reason the tests weren't passing is because DRM_IOCTL_I915_GEM_SET_DOMAIN
is required on x86 platforms when calling (*lock). A previous CLs added this.

BUG=b:67073097, b:67331142
TEST=

android.view.cts.SurfaceViewSyncTests
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual0720x0480
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1280x0720
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1920x1080
android.media.cts.EncodeDecodeTest#testVP8EncodeDecodeVideoFromSurfaceToSurface720p
android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromPersistentSurfaceToSurface720p
android.media.cts.EncodeDecodeTest#testVP8EncodeDecodeVideoFromPersistentSurfaceToSurface720p

pass on Eve.

This reverts commit 14033e0013b5cc0ffc5af59dda7c377d46ec761d.

v2: Make lock_data[0] null after last (*unlock)(), because user may specify different
    access regions in the next (*lock)().

Change-Id: Ia56ecd57acc4471b026c852b178d8bc0f189dec7
Reviewed-on: https://chromium-review.googlesource.com/710324
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: use drv_array for combinations and kms_items
Gurchetan Singh [Sat, 4 Nov 2017 00:17:35 +0000 (17:17 -0700)]
minigbm: use drv_array for combinations and kms_items

This de-deuplicates the various dynamic arrays we use.

BUG=chromium:764871
TEST=gbmtest passes

Change-Id: I94c8cf7c71fdb98b931aab00c5381853e2ae0d3f
Reviewed-on: https://chromium-review.googlesource.com/758149
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: make drv_add_combinations return nothing
Gurchetan Singh [Sat, 4 Nov 2017 00:18:36 +0000 (17:18 -0700)]
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>
6 years agominigbm: plumb buffer access region
Gurchetan Singh [Mon, 6 Nov 2017 19:07:52 +0000 (11:07 -0800)]
minigbm: plumb buffer access region

This will allow drivers to tile or detile only the regions requested
by the user. Note that the gralloc spec states that:

"This address will represent the top-left corner of the entire buffer,
even if accessRegion does not begin at the top-left corner."

(see hardware/interfaces/graphics/mapper/2.0/IMapper.hal in AOSP)

Also, the gralloc API makes it difficult to maintain two mappings of
the same buffer.  For example, say you have two access regions:

module->lock(mod, handle1, 0, 0, 5, 5, &addr);
module->lock(mod, handle1, 5, 5, 10, 10, &addr);

module->unlock(mod, handle1); // which access region should be unlocked?

In practice, this scenario never happens on Android.

It's not exactly clear what gbm should return.  Let's just return the
top left of the access region because that's what we where doing before.

BUG=chromium:764871
TEST=gbmtest, mmap_test -g, the following CTS tests:

android.view.cts.SurfaceViewSyncTests
android.media.cts.EncodeDecodeTest
android.video.cts.VideoEncoderDecoderTest

Change-Id: I7ca0713871e03928b1d4402aa161588990c7e775
Reviewed-on: https://chromium-review.googlesource.com/758147
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: use struct vma for (*bo_map)/(*bo_unmap) callbacks
Gurchetan Singh [Wed, 15 Nov 2017 02:20:27 +0000 (18:20 -0800)]
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>
6 years agominigbm: use drv_array for mappings
Gurchetan Singh [Fri, 3 Nov 2017 00:32:00 +0000 (17:32 -0700)]
minigbm: use drv_array for mappings

Let's start allowing multiple mappings of the same buffer when
different map flags are passed in.

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

Change-Id: I4eb0b6f4c3572a92001696c2720d5a5f7d9d73a4
Reviewed-on: https://chromium-review.googlesource.com/758146
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>
6 years agominigbm: amdgpu: add supported formats for camera
Ricky Liang [Fri, 10 Nov 2017 01:17:17 +0000 (09:17 +0800)]
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>
6 years agominigbm: introduce drv_array
Gurchetan Singh [Thu, 2 Nov 2017 23:42:49 +0000 (16:42 -0700)]
minigbm: introduce drv_array

We want to allow multiple mappings of a single buffer with different
map flags. To do this, we'll need some sort of linked list or dynamic
array of mappings. We already use dynamic arrays in minigbm, so let's
centralize that functionality and use it.

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

Change-Id: I2b391d6e8e690eac6368b1404a806b2bfbbcdf44
Reviewed-on: https://chromium-review.googlesource.com/758145
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: refactor and rename mapping struct
Gurchetan Singh [Thu, 2 Nov 2017 21:07:18 +0000 (14:07 -0700)]
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>
6 years agominigbm: fix map time assertions
Gurchetan Singh [Wed, 8 Nov 2017 01:21:58 +0000 (17:21 -0800)]
minigbm: fix map time assertions

We should assert when the refcount is equal to zero as well.

BUG=chromium:764871
TEST=gbmtest passes

Change-Id: Iaf8b5bd4bf51472ad7c564341b42a7079b58bd6e
Reviewed-on: https://chromium-review.googlesource.com/758143
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: re-const-ify driver backends
Gurchetan Singh [Tue, 31 Oct 2017 17:36:25 +0000 (10:36 -0700)]
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>
6 years agominigbm: amdgpu: Add ABGR8888 to supported render target formats
Alec Thilenius [Tue, 31 Oct 2017 20:39:16 +0000 (14:39 -0600)]
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>
6 years agominigbm: remove cirrus driver
Gurchetan Singh [Tue, 31 Oct 2017 17:39:43 +0000 (10:39 -0700)]
minigbm: remove cirrus driver

Nobody should use this anymore -- virtio_gpu is the future.

BUG=chromium:710629
TEST=Should already be unused, CQ will check

Change-Id: I8e4184875140e0c74d886c20fcf2d1c9664fa44c
Reviewed-on: https://chromium-review.googlesource.com/747983
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: amdgpu: Add RGB565 to supported render target formats
Alec Thilenius [Thu, 26 Oct 2017 16:23:46 +0000 (10:23 -0600)]
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>
6 years agominigbm/i915: Implement bo_create_with_modifiers
Kristian H. Kristensen [Tue, 3 Oct 2017 20:53:19 +0000 (13:53 -0700)]
minigbm/i915: Implement bo_create_with_modifiers

This implements the bo_create_with_modifiers driver functions, which
enables the gbm_bo_create_with_modifiers() entry point. This will
allow ozone to allocate with the modifiers it queries from KMS.

BUG=chromium:763760
TEST=Allocates Y-tiled scanout on SKL+

Change-Id: Id770e571a51aef4d753b30e12cd67d935c5228b7
Reviewed-on: https://chromium-review.googlesource.com/729279
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: Use more descriptive modifier names
Kristian H. Kristensen [Wed, 25 Oct 2017 01:36:32 +0000 (18:36 -0700)]
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>
6 years agominigbm: amdgpu: make AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED default
Shirish S [Thu, 19 Oct 2017 06:20:34 +0000 (11:50 +0530)]
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>
6 years agominigbm: Link amdgpuaddr for DRV_AMDGPU.
Justin TerAvest [Wed, 18 Oct 2017 17:27:33 +0000 (11:27 -0600)]
minigbm: Link amdgpuaddr for DRV_AMDGPU.

The amdgpu driver requires functions provided by amdgpuaddr:
  * AddrComputeSurfaceInfo
  * AddrConvertTileInfoToHW
  * AddrCreate
  * AddrDestroy

We need to link against amdgpuaddr when using this driver.

BUG=b:64515630
TEST=Built modified arc-cros-gralloc, got ARC++ graphics on AMD

Change-Id: I5bfa32f0c912ac5d3a19ab4f337614a1d91a6328
Reviewed-on: https://chromium-review.googlesource.com/726364
Commit-Ready: Justin TerAvest <teravest@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: i915: add XR30 and XB30 formats.
Daniele Castagna [Wed, 18 Oct 2017 20:15:44 +0000 (16:15 -0400)]
minigbm: i915: add XR30 and XB30 formats.

i915 supports 30bit per component formats.
This CL adds XR30 and XB30 to minigbm i915 backend.

This CL also sorts render_target_formats alphabetically.

BUG=chromium:776093
TEST=Ran a modifier version of null_platform_test that will be
uploaded soon.

Change-Id: If4f2f74cb10a0534023b9b6142ee84ced0ed8a38
Reviewed-on: https://chromium-review.googlesource.com/726318
Commit-Ready: Daniele Castagna <dcastagna@chromium.org>
Tested-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: i915: Allow protected allocations
Tomasz Figa [Fri, 4 Aug 2017 03:50:03 +0000 (12:50 +0900)]
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>
6 years agominigbm: i915: call DRM_IOCTL_I915_GEM_SET_DOMAIN when invalidating
Gurchetan Singh [Tue, 10 Oct 2017 21:12:46 +0000 (14:12 -0700)]
minigbm: i915: call DRM_IOCTL_I915_GEM_SET_DOMAIN when invalidating

In the kernel, the i915_gem_set_domain_ioctl function calls these
functions:

- i915_gem_object_set_to_gtt_domain
- i915_gem_object_set_to_cpu_domain

These functions do various interesting things with caches, and some
CTS tests require this to pass.

BUG=b:67073097, b:67331142, chromium:764871
TEST=The following tests:

android.view.cts.SurfaceViewSyncTests
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual0720x0480
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1280x0720
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1920x1080
android.media.cts.EncodeDecodeTest#testVP8EncodeDecodeVideoFromSurfaceToSurface720p
android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromPersistentSurfaceToSurface720p
android.media.cts.EncodeDecodeTest#testVP8EncodeDecodeVideoFromPersistentSurfaceToSurface720p

passes on Eve with the next patch applied.

Change-Id: I9acc14580f65eab6039d8b354bfbf51c31dfcf14
Reviewed-on: https://chromium-review.googlesource.com/710323
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: add buffer invalidation function
Gurchetan Singh [Tue, 10 Oct 2017 00:59:47 +0000 (17:59 -0700)]
minigbm: add buffer invalidation function

We may need to invalidate a buffer before reading it. Some use
cases are:

- DRM_IOCTL_I915_GEM_SET_DOMAIN
        - DMA_BUF_IOCTL_SYNC with the SYNC_START option
        - DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST

This patch adds the function hook.

BUG=chromium:764871
TEST=compiles

Change-Id: I85811407252b859a12294381c65ff3545424636b
Reviewed-on: https://chromium-review.googlesource.com/710322
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
6 years agominigbm: amdgpu: make bo's created with SCANOUT flag mmapable
Shirish S [Fri, 13 Oct 2017 04:24:03 +0000 (09:54 +0530)]
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>
6 years agominigbm: respect map_flags in all cases
Gurchetan Singh [Thu, 5 Oct 2017 21:52:24 +0000 (14:52 -0700)]
minigbm: respect map_flags in all cases

When the map flags do not feature BO_TRANSFER_WRITE, we should
not copy back any shadow buffers we maintain.

BUG=b:67434931
TEST=android.view.cts.SurfaceViewSyncTests on Mediatek/Rockchip

Change-Id: I7078bfc5a8d770a52949d43ea68efc4a870e9227
Reviewed-on: https://chromium-review.googlesource.com/703875
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>

6 years agominigbm: move gralloctest to this repo
Gurchetan Singh [Tue, 3 Oct 2017 17:39:13 +0000 (10:39 -0700)]
minigbm: move gralloctest to this repo

The autotest eclass has issues when compiling for multilib, and plus
we can keep the test with the source code.

BUG=b:63610343
TEST=emerge-eve arc-cros-gralloc
CQ-DEPEND=CL:699675, CL:699734

Change-Id: I9ec3185f7e18f4717ef560e599e635f03b0a999d
Reviewed-on: https://chromium-review.googlesource.com/699676
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>