OSDN Git Service

android-x86/external-minigbm.git
4 years agominigbm: virtio-gpu: Allocate one buffer even for multi plane format
Kansho Nishida [Fri, 14 Jun 2019 09:28:18 +0000 (18:28 +0900)]
minigbm: virtio-gpu: Allocate one buffer even for multi plane format

It seems that DRM_IOCTL_VIRTGPU_RESOURCE_INFO ioctl doesn't work.

BUG=b:133385154 b:132939420
TEST=None

Change-Id: I3eec946894b0935a5fcd774346194087bb831249
Signed-off-by: Kansho Nishida <kansho@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1659792
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Ready: Keiichi Watanabe <keiichiw@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
4 years agorockchip: Don't align height in NV12 format
Hirokazu Honda [Fri, 30 Aug 2019 02:07:53 +0000 (11:07 +0900)]
rockchip: Don't align height in NV12 format

crrev.com/c/1729176 corrected a wrong NV12 buffer allocation on rockchip. After
the CL, the width and height both are aligned by 16. Since GBM API doesn't
notify the aligned height to an application. The application must handle the
planes with offsets.

It turns out that Camera HAL on ChromeOS doesn't handle the allocated buffer
with offsets. In other words, it doesn't think of extra data between planes.
This causes, in a camera preview, a green line at bottom and a strange blue line
due to misposition of color planes.

This CL is a temproal workaround for the Camera HAL issue. This CL changes
minigbm implementation to not align height. This works because present video
encoder and decoder always calls GBM API with the height already aligned by
video driver. Note that a camera stack on encoding process will have to allocate
a proper buffer with non-aligned height in the future. This must be a temporal
workaround.

BUG=b:140152839
TEST=Confirm no green line in camera view and recorded video with Camera app
Change-Id: Ide53fa6801fc4bdabcfbe46004d01f5ab83a002f
Reviewed-on: https://chromium-review.googlesource.com/1775953
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: Tomasz Figa <tfiga@chromium.org>
4 years agomediatek/rockchip: Use PRIu64 to print uint64_t variables
Nicolas Boichat [Thu, 29 Aug 2019 13:46:29 +0000 (21:46 +0800)]
mediatek/rockchip: Use PRIu64 to print uint64_t variables

Required to build for arm64 on mediatek, and let's fix the
rockchip one, while we're at it.

BUG=b:140228960
TEST=emerge-kevin-arc64 -av arc-cros-gralloc
TEST=emerge-kukui -av arc-cros-gralloc (with ARC++ 64-bit)

Change-Id: I8e04355a4d247b44ac86963331be72495655d321
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1775949
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Auto-Submit: Nicolas Boichat <drinkcat@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>

5 years agomediatek: Change android flexible format to allocate YVU420 buffer
Hirokazu Honda [Fri, 23 Aug 2019 05:31:31 +0000 (14:31 +0900)]
mediatek: Change android flexible format to allocate YVU420 buffer

crrev.com/c/1716864 made gralloc allocae NV12 buffer with the android flexible
format, DRM_FORMAT_FLEX_YCbCr_420_888. However, the change broke many CTS tests.
This partially reverts the commit. The allocated buffer fromat becomes YVU420.

BUG=chromium:987185
BUG=b:139714614
Cq-Depend: chromium:1767680
Change-Id: I9fcde88cff79fac2655fb627418b371b314077c1
Reviewed-on: https://chromium-review.googlesource.com/1767450
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: Tomasz Figa <tfiga@chromium.org>
5 years agoRevert "minigbm/i915: Add support for I915_FORMAT_MOD_Y_TILED_CCS"
Mark Yacoub [Wed, 21 Aug 2019 19:32:43 +0000 (19:32 +0000)]
Revert "minigbm/i915: Add support for I915_FORMAT_MOD_Y_TILED_CCS"

This reverts commit a0868975d7d0242fd47c0090c2f779f8f2049dba.

Reason for revert: Broke many tests such as the screenshot test and using a 2nd external monitor.

Original change's description:
> minigbm/i915: Add support for I915_FORMAT_MOD_Y_TILED_CCS
>
> This adds support for allocating buffers with the
> I915_FORMAT_MOD_Y_TILED_CCS modifier, which enables Intels render
> buffer compression.
>
> BUG=979736
>
> Change-Id: I2f3d19be8b7661693054da8a153c2412c65233f1
> Reviewed-on: https://chromium-review.googlesource.com/1706735
> Tested-by: Mark Yacoub <markyacoub@google.com>
> 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>
> Reviewed-by: Mark Yacoub <markyacoub@google.com>

Bug: 996011,988559,995549,996036,
Change-Id: I5fbed90c5d8774b9385811a145b14a11423bb707
Reviewed-on: https://chromium-review.googlesource.com/1759155
Tested-by: Mark Yacoub <markyacoub@google.com>
Commit-Ready: Mark Yacoub <markyacoub@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Mark Yacoub <markyacoub@google.com>
5 years agominigbm: virtio_gpu: Add camera usage to all NV12 combinations
David Stevens [Fri, 9 Aug 2019 11:20:23 +0000 (20:20 +0900)]
minigbm: virtio_gpu: Add camera usage to all NV12 combinations

This change adds camera usage to all NV12 combinations after all
combinations have been added. This fixes an issue where a virtio_gpu
with 3d support would not have any camera compatible NV12 combinations.

BUG=b:132939858
TEST=Camera apps run on arcvm with no gralloc errors (although they
don't actually work for separate reasons).

Change-Id: Icc868398d6e036f8430afb9a351809bb7965202e
Reviewed-on: https://chromium-review.googlesource.com/1746346
Tested-by: Tomasz Figa <tfiga@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: Tomasz Figa <tfiga@chromium.org>
5 years agoAdd GBM_BO_USE_HW_VIDEO_ENCODER use flag
Hirokazu Honda [Wed, 31 Jul 2019 07:35:52 +0000 (16:35 +0900)]
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>
5 years agomediatek: Add NV12 format for output frame in HW decoder
Hirokazu Honda [Wed, 24 Jul 2019 10:40:20 +0000 (19:40 +0900)]
mediatek: Add NV12 format for output frame in HW decoder

YV12 have been a pixel format of output frame in HW decoder on MediaTek device.
Since all other platforms uses NV12 for the format, it is good to change the
format to NV12 on MediaTek as well. So we can only think about NV12 for a pixel
format in HW decoder.

BUG=chromium:987185
TEST=video_decode_accelerator_tests
TEST=Play video with Chrome
Cq-Depend:chromium:1716844
Change-Id: Ic7e4f66d503247bdeba9cb66c8a598b233ed6df9
Reviewed-on: https://chromium-review.googlesource.com/1716864
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>
5 years agorockchip: Fix the size computation with NV12 buffer
Hirokazu Honda [Thu, 1 Aug 2019 07:37:47 +0000 (16:37 +0900)]
rockchip: Fix the size computation with NV12 buffer

The size and offsets are computed with the given height that is not aligned.
This CL changes to compute them with an aligned height

Bug: None
Test: video_decode_accelerator_tests on kevin
Change-Id: I3e316400d2ab40beee8785f337e9451408ef7318
Reviewed-on: https://chromium-review.googlesource.com/1729176
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>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
5 years agoamdgpu: Enable to allocate YVU420 buffer with BO_USE_TEXTURE_MASK flag
Hirokazu Honda [Wed, 31 Jul 2019 08:33:06 +0000 (17:33 +0900)]
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>
5 years agominigbm: cros_gralloc: fix fd leaks
Gurchetan Singh [Sat, 27 Jul 2019 01:11:18 +0000 (18:11 -0700)]
minigbm: cros_gralloc: fix fd leaks

We were leaking fds.

BUG=none
TEST=compile

Change-Id: I75f43d6f696f619c0ae284695b38586bc9ffff8c
Reviewed-on: https://chromium-review.googlesource.com/1722289
Tested-by: Gurchetan Singh <gurchetansingh@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: Tomasz Figa <tfiga@chromium.org>
5 years agominigbm: clang format
Gurchetan Singh [Fri, 26 Jul 2019 03:48:28 +0000 (20:48 -0700)]
minigbm: clang format

It's good to run this once and a while.

Change-Id: I69b6f9252455360b6d326a3ec89fe51517abda2f
Reviewed-on: https://chromium-review.googlesource.com/1719976
Tested-by: Gurchetan Singh <gurchetansingh@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>
5 years agominigbm/i915: Add support for I915_FORMAT_MOD_Y_TILED_CCS
Mark Yacoub [Thu, 25 Jul 2019 15:08:07 +0000 (11:08 -0400)]
minigbm/i915: Add support for I915_FORMAT_MOD_Y_TILED_CCS

This adds support for allocating buffers with the
I915_FORMAT_MOD_Y_TILED_CCS modifier, which enables Intels render
buffer compression.

BUG=979736

Change-Id: I2f3d19be8b7661693054da8a153c2412c65233f1
Reviewed-on: https://chromium-review.googlesource.com/1706735
Tested-by: Mark Yacoub <markyacoub@google.com>
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>
Reviewed-by: Mark Yacoub <markyacoub@google.com>
5 years agoFix potential uninitialed read
Greg Hartman [Wed, 17 Jul 2019 22:55:17 +0000 (15:55 -0700)]
Fix potential uninitialed read

BUG=none
Test=can compile crosvm
Change-Id: I65577ca08f4d41ff6a7b6d2a2af42f82798608bf
Tested-by: ghartman@google.com
Reviewed-by: adelva@google.com
Reviewed-on: https://android-review.googlesource.com/c/platform/external/minigbm/+/1056177
Reviewed-on: https://chromium-review.googlesource.com/1707385
Tested-by: Greg Hartman <ghartman@google.com>
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>
5 years agominigbm: enable BO_USE_HW_VIDEO_DECODER for P010
Miguel Casas [Thu, 18 Jul 2019 17:07:30 +0000 (13:07 -0400)]
minigbm: enable BO_USE_HW_VIDEO_DECODER for P010

This should be enabled for decoding P010 buffers, but had forgotten
to add this BO explicitly.

Change-Id: Icd3bbd419711b649299c7eea92d93b3c7f9a5ada
Bug: 911754
Reviewed-on: https://chromium-review.googlesource.com/1708514
Tested-by: Miguel Casas <mcasas@chromium.org>
Commit-Ready: Miguel Casas <mcasas@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: i915: Add support for AR30 DRM_FORMAT_ARGB2101010.
David Riley [Tue, 28 May 2019 20:08:12 +0000 (13:08 -0700)]
minigbm: i915: Add support for AR30 DRM_FORMAT_ARGB2101010.

BUG=chromium:963559
TEST=freecad starts under crosvm

Change-Id: I01c9bfcb0eb8419f06fff69edff6f5eb09232403
Reviewed-on: https://chromium-review.googlesource.com/1631946
Tested-by: David Riley <davidriley@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>
5 years agominigbm: Reland "minigbm: virtio-gpu: remove NV12 as texture source format"
Gurchetan Singh [Mon, 8 Jul 2019 16:50:01 +0000 (09:50 -0700)]
minigbm: Reland "minigbm: virtio-gpu: remove NV12 as texture source format"

Add the SW mask and linear flags too, which are required for WebRTC tests.

BUG=b:135504137
TEST=tast.camera.WebRTC

Change-Id: Ifa37546e855471e3a125acb483c57d5b34d61edf
Reviewed-on: https://chromium-review.googlesource.com/1691068
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: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 years agoChange Assert to Check and return NULL
Mark Yacoub [Tue, 9 Jul 2019 17:59:50 +0000 (13:59 -0400)]
Change Assert to Check and return NULL

Security wise, we now end up relying on gbm_bo_import failing.
gbm does some basic validation based on lseek and the provided format.
For robustness, return NULL instead of crashing the system.

BUG=979736

Change-Id: Ib25a770a3a986a3079fe8db183ea78ac5f777602
Reviewed-on: https://chromium-review.googlesource.com/1693301
Tested-by: Mark Yacoub <markyacoub@google.com>
Commit-Ready: Mark Yacoub <markyacoub@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Mark Yacoub <markyacoub@google.com>
5 years agoRevert "minigbm: virtio-gpu: remove NV12 as texture source format"
Tomasz Figa [Thu, 4 Jul 2019 02:41:30 +0000 (02:41 +0000)]
Revert "minigbm: virtio-gpu: remove NV12 as texture source format"

This reverts commit 2efa6b924c3cafc1bd6b25998978aa0e9e63f526.

Reason for revert: Broke camera VM tests, b/135504137.

The intention was to apparently just disable the texturing usage,
but the change effectively reduced NV12 from the whole
BO_USE_TEXTURE_MASK down to just BO_USE_CAMERA_READ |
BO_USE_CAMERA_WRITE. Given the definition of the former, which is

#define BO_USE_TEXTURE_MASK BO_USE_LINEAR | BO_USE_PROTECTED | BO_USE_RENDERSCRIPT | \
                            BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
                            BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE

it removed even the SW access flags, which are needed in the capture
stack, and thus broke the camera.

Original change's description:
> minigbm: virtio-gpu: remove NV12 as texture source format
>
> This breaks the Ozone EGL unit tests.  This should still work for
> Vivid Camera testing.
>
> BUG=chromium:970923
> TEST=ozone EGL unit test
>
> Change-Id: I850584f926a7bd1cdd4dbc749d446ba775363e2a
> Reviewed-on: https://chromium-review.googlesource.com/1646884
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
> Reviewed-by: Stphane Marchesin <marcheu@chromium.org>
> Reviewed-by: Miguel Casas <mcasas@chromium.org>

Bug: chromium:970923
Bug: b:135504137
Change-Id: Ic506f38a85f1fa164f0ac7fd9f562872e4cac700
Test: tast.camera.WebRTC on betty
Reviewed-on: https://chromium-review.googlesource.com/1687732
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Ready: Keiichi Watanabe <keiichiw@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
5 years agominigbm: virtio-gpu: use NV12 as flexible media format
Gurchetan Singh [Wed, 5 Jun 2019 02:43:41 +0000 (19:43 -0700)]
minigbm: virtio-gpu: use NV12 as flexible media format

All of our future drivers (including MTK_MT8183) seem to
prefer NV12 as their flexible media format, so advertise that.

In the unlikely event that changes, we can set either use the
capabilities or resource create versioning (a planned feature).

This has the benefit of keeping Android flexible formats in
Android userspace.

BUG=b:132939420
TEST=compile

Change-Id: I486f7be23f8431aa8bbaea89dca7c1304536e9ac
Reviewed-on: https://chromium-review.googlesource.com/1644464
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>
5 years agominigbm: modify resolve format hooks a bit
Gurchetan Singh [Wed, 5 Jun 2019 02:39:51 +0000 (19:39 -0700)]
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>
5 years agominigbm: update virgl_hw.h
Gurchetan Singh [Wed, 5 Jun 2019 15:48:02 +0000 (08:48 -0700)]
minigbm: update virgl_hw.h

Taken from ToT virglrenderer (commit e27247), which contains the
upstream version of this file.

BUG=b:132939420
TEST=compile

Change-Id: I6efc5faa55dfc2841ca17d04db9f16eaeac39d7e
Reviewed-on: https://chromium-review.googlesource.com/1645878
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>
5 years agominigbm: fix subsampling issue
Gurchetan Singh [Fri, 28 Jun 2019 00:53:24 +0000 (17:53 -0700)]
minigbm: fix subsampling issue

For YUV, we're not consistent.  For the "y" component, we assume
the offset is just y * plane_stride, letting the API user take
care of the subsampling.  For the "x" component, we subsample the
"x" the user passes in (see drv_stride_from_format(..)).

Let's be consistent and not subsample.

This likely makes neglible difference since the users of the API map
the entire plane.

BUG=b:132939420
TEST=none

Change-Id: I0fcfd8ba6a2ae59a419af963eb7b54245f697d77
Reviewed-on: https://chromium-review.googlesource.com/1681382
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>
5 years agominigbm: fix uninitialized variable error
Ludovico de Nittis [Wed, 29 May 2019 08:02:21 +0000 (10:02 +0200)]
minigbm: fix uninitialized variable error

To fix the maybe uninitialized error we assign plane_type a starting
value.
The number zero corresponds to DRM_PLANE_TYPE_OVERLAY, so instead we
initialize plane_type to UINT64_MAX.

Bug: chromium:968030
Change-Id: I4fe119c1491926227151742041a73207971f56f0
Reviewed-on: https://chromium-review.googlesource.com/1634771
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: virtio-gpu: remove NV12 as texture source format
Gurchetan Singh [Thu, 6 Jun 2019 00:07:56 +0000 (17:07 -0700)]
minigbm: virtio-gpu: remove NV12 as texture source format

This breaks the Ozone EGL unit tests.  This should still work for
Vivid Camera testing.

BUG=chromium:970923
TEST=ozone EGL unit test

Change-Id: I850584f926a7bd1cdd4dbc749d446ba775363e2a
Reviewed-on: https://chromium-review.googlesource.com/1646884
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
5 years agominigbm: run presubmit.sh and add OWNERS file
Gurchetan Singh [Wed, 29 May 2019 00:49:09 +0000 (17:49 -0700)]
minigbm: run presubmit.sh and add OWNERS file

This now apparently is required.

Change-Id: I28b19684d207aad50493974dc71d8249bc82ca21
Reviewed-on: https://chromium-review.googlesource.com/1633452
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 years agoAdd dri.c to the MINIGBM_SRC list
Ludovico de Nittis [Tue, 28 May 2019 14:03:34 +0000 (16:03 +0200)]
Add dri.c to the MINIGBM_SRC list

dri.c needs to be included in the minigbm build because it is required
when using an AMD gpu.

Bug: chromium:967346
Change-Id: I642836bb970d2b738c98a9869a245ca36c80f3ed
Reviewed-on: https://chromium-review.googlesource.com/1631282
Commit-Ready: Daniel Nicoara <dnicoara@chromium.org>
Tested-by: Daniel Nicoara <dnicoara@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Nicoara <dnicoara@chromium.org>
5 years agominigbm: Add formats support for MT8183 camera
Nick Fan [Mon, 8 Oct 2018 03:53:26 +0000 (11:53 +0800)]
minigbm: Add formats support for MT8183 camera

Add NV21, YUYV and YVU420 formats support for MT8183 camera
Use config to seperate modification only for MT8183

BUG=b:109911488
TEST=emerge-kukui minigbm

Change-Id: I7201b89de3fa062f96cd69e4b91a2a4b434c738e
Signed-off-by: Nick Fan <Nick.Fan@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/1267857
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Nick Fan <nick.fan@mediatek.corp-partner.google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoAdd support for DRM_FORMAT_P010
Miguel Casas [Tue, 30 Apr 2019 22:11:40 +0000 (18:11 -0400)]
Add support for DRM_FORMAT_P010

Test: Tested with chrome's ozone_gl_unittests: crrev.com/c/1561136
Bug: 911754
Change-Id: I8a9a28ba1c3a1186fd88b43c85098a5550fa1c8b
Reviewed-on: https://chromium-review.googlesource.com/1590464
Commit-Ready: Miguel Casas <mcasas@chromium.org>
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 years agominigbm: virgl: Map BO_USE_SCANOUT to VIRGL_BIND_SCANOUT
Lepton Wu [Fri, 19 Apr 2019 19:26:39 +0000 (12:26 -0700)]
minigbm: virgl: Map BO_USE_SCANOUT to VIRGL_BIND_SCANOUT

Now crosvm use VIRGL_BIND_SCANOUT to decide if we should allocate buffer from
host minigbm. For buffers sent to Wayland, they have to be allocated from host
minigbm. Since arc-cros-gralloc already maps GRALLOC_USAGE_HW_COMPOSER to
BO_USE_SCANOUT, we only need to mark related formats good for BO_USE_SCANOUT and
then map BO_USE_SCANOUT to VIRGL_BIND_SCANOUT.

BUG=b:130848979
TEST=manual - Run arcvm with updated arc-cros-gralloc

Change-Id: If6a126707701198911409f39627c860573be34f4
Reviewed-on: https://chromium-review.googlesource.com/1575526
Commit-Ready: Lepton Wu <lepton@chromium.org>
Tested-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: msm: Silence printf warning on 64-bit build
Stephen Boyd [Tue, 9 Apr 2019 18:03:00 +0000 (11:03 -0700)]
minigbm: msm: Silence printf warning on 64-bit build

Compiling this file with a 64-bit userland fails like so:

 /mnt/host/source/src/platform/minigbm/msm.c:243:70: error: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
                 drv_log("invalid format = %d, flags = %llx combination\n", format, flags);
                                                       ~~~~                         ^~~~~
                                                       %lx

Fix the error by using the appropriate hex printing printf format for
uint64_t types.

BUG=None
TEST=Compile with arm64 userland

Change-Id: If1b0298ccf12b8ed4e162a8e5668de1be7ad29e5
Reviewed-on: https://chromium-review.googlesource.com/1559755
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 years agoamdgpu: Add ABGR8888 using non-linear tiling too.
Bas Nieuwenhuizen [Wed, 3 Apr 2019 16:12:12 +0000 (18:12 +0200)]
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>
5 years agominigbm: mediatek: Implement bo_create_with_modifiers
Fritz Koenig [Tue, 19 Mar 2019 20:25:45 +0000 (13:25 -0700)]
minigbm: mediatek: Implement bo_create_with_modifiers

Mediatek MT8183 only supports DRM_FORMAT_MOD_LINEAR.

BUG=b:123042223, b:129645475
TEST=null_platform_test -m DRM_FORMAT_MOD_LINEAR

Change-Id: I1938e52a9b221f25b62ddd27916a2222be8c0a46
Reviewed-on: https://chromium-review.googlesource.com/1529226
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoamdgpu: Add ABGR8888 for scanout
Drew Davenport [Mon, 25 Mar 2019 15:18:42 +0000 (09:18 -0600)]
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>
5 years agominigbm: Fix consistency in return values
Stéphane Marchesin [Thu, 21 Mar 2019 19:23:29 +0000 (12:23 -0700)]
minigbm: Fix consistency in return values

minigbm functions don't use errno; however drmIoctl does. So we need
to return -errno instead of returning exactly what drmIoctl returns.

BUG=none
TEST=builds

Change-Id: I20e00141782ac1407133ee72259fe43381954d26
Reviewed-on: https://chromium-review.googlesource.com/1534878
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: i915: align to page size always
Gurchetan Singh [Thu, 28 Feb 2019 23:44:54 +0000 (15:44 -0800)]
minigbm: i915: align to page size always

Upstream commit 2e7bd10e05af ("drm/i915: Prevent a race during
I915_GEM_MMAP ioctl with WC set") started checking this apparently.

BUG=b:126609463
TEST=gbmtest on octopus

Change-Id: Idfcef40b2c49c8ec6a8c18351d7da7d0edeaea1f
Reviewed-on: https://chromium-review.googlesource.com/1495920
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
5 years agoReland "minigbm: define GBM_BO_IMPORT_FD_MODIFIER"
Maksim Sisov [Mon, 7 Jan 2019 13:11:47 +0000 (15:11 +0200)]
Reland "minigbm: define GBM_BO_IMPORT_FD_MODIFIER"

It seems like the problem was that the
GBM_BO_IMPORT_FD_PLANAR was redifened to 0x5505
from 0x5504. And GBM_BO_IMPORT_FD_MODIFIER
was added as 0x5504, which lead to crashes.

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

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

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

Change-Id: I1617de54914734c903cb05e1694cc782a7bb171a
Reviewed-on: https://chromium-review.googlesource.com/1454658
Commit-Ready: Maksim Sisov <msisov@igalia.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm:amdgpu: align stride to 256
Satyajit Sahu [Thu, 31 Jan 2019 04:28:24 +0000 (09:58 +0530)]
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>
5 years agominigbm: msm: Add modifier for tiled buffer allocation
Tanmay Shah [Mon, 26 Nov 2018 18:05:18 +0000 (10:05 -0800)]
minigbm: msm: Add modifier for tiled buffer allocation

Allow ubwc buffer allocation and calculate its layout
for XBGR8888, ABGR8888 and NV12 formats

BUG=b:120118851
TEST=null_platform_test -f XB24 -m DRM_FORMAT_MOD_QCOM_COMPRESSED

For above test case display might be corrupted if UBWC content is not passed
to input buffer. But using crtc status, modifier information can be verified.

Change-Id: If040754d0cd52200feef56e40e931da0c4d2508d
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
Reviewed-on: https://chromium-review.googlesource.com/1363690
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
5 years agominigbm: Fix some clang-format issues
Tomasz Figa [Sun, 2 Dec 2018 01:01:56 +0000 (10:01 +0900)]
minigbm: Fix some clang-format issues

No functional changs.

BUG=none
TEST=compile

Change-Id: I6b302e9bbf9d46489bfaa03d3b5cf2b070cb1d24
Reviewed-on: https://chromium-review.googlesource.com/1356697
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: msm: Add platform specific alignment for NV12 linear format
Tanmay Shah [Wed, 21 Nov 2018 17:14:14 +0000 (09:14 -0800)]
minigbm: msm: Add platform specific alignment for NV12 linear format

Venus driver requires extra padding for NV12 buffers.

BUG=b:120118851
TEST=plane_test -f NV12
TEST=plane_test -f NV12 -z 640x480

Change-Id: If86c548350278cc8d87159b58e56802b2598d448
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
Reviewed-on: https://chromium-review.googlesource.com/1362202
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoRevert "minigbm: define GBM_BO_IMPORT_FD_MODIFIER"
Naoki Fukino [Mon, 10 Dec 2018 06:22:23 +0000 (06:22 +0000)]
Revert "minigbm: define GBM_BO_IMPORT_FD_MODIFIER"

This reverts commit bc667c3ef6f3cc739406bc008341bd4505c1b51f.

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

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

Change-Id: I7dec62abd4243554847930cce33f0d5db069c3f4
Reviewed-on: https://chromium-review.googlesource.com/1369469
Commit-Ready: Naoki Fukino <fukino@chromium.org>
Tested-by: Naoki Fukino <fukino@chromium.org>
Reviewed-by: Naoki Fukino <fukino@chromium.org>
5 years agominigbm: define GBM_BO_IMPORT_FD_MODIFIER
Maksim Sisov [Wed, 10 Oct 2018 10:41:51 +0000 (13:41 +0300)]
minigbm: define GBM_BO_IMPORT_FD_MODIFIER

This CL aligns the minigbm more with the upstream GBM
by defining GBM_BO_IMPORT_FD_MODIFIER and using
gbm_import_fd_modifier_data instead.

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

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

Change-Id: Iaae062ef1fe9fc9ab0ead09c5f4bfa91d2db67c3
Reviewed-on: https://chromium-review.googlesource.com/1360771
Commit-Ready: Maksim Sisov <msisov@igalia.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agoamdgpu: use amdgpu_gem_wait_idle_ioctl to wait for GPU to finish.
Deepak Sharma [Fri, 16 Nov 2018 20:10:54 +0000 (12:10 -0800)]
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>
5 years agoamdgpu: Don't use AMDGPU_GEM_CREATE_EXPLICIT_SYNC flag.
Deepak Sharma [Fri, 9 Nov 2018 22:12:04 +0000 (14:12 -0800)]
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>
5 years agoamdgpu: fix misplaced code block
Gurchetan Singh [Fri, 26 Oct 2018 00:12:18 +0000 (17:12 -0700)]
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>
5 years agominigbm: i915: Do not use I915_MMAP_WC for camera buffers
Tomasz Figa [Wed, 31 Oct 2018 15:45:31 +0000 (00:45 +0900)]
minigbm: i915: Do not use I915_MMAP_WC for camera buffers

Some camera use cases, such as camera output buffers shared between
video encoder and hwcomposer, require CPU access to the buffers (the
ARC++ encoder stack is not zero-copy yet) and having uncached mapping
slows them down significantly, to the point that respective CTS tests
start failing. Fix it by excluding buffers with BO_CAMERA_READ and
BO_CAMERA_WRITE from the WC mapping condition.

BUG=b:117978452
TEST=android.hardware.camera2.cts.RecordingTest#testVideoPreviewSurfaceSharing on Nocturne

Change-Id: Icc3c7104029403fbf64a7fcc8476d52a3f9ea3f0
Reviewed-on: https://chromium-review.googlesource.com/1309914
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
5 years agominigbm: add MINIGBM define.
Maksim Sisov [Tue, 16 Oct 2018 08:24:05 +0000 (11:24 +0300)]
minigbm: add MINIGBM define.

This patch does not bring any functionality changes, but just
adds a MINIGBM define in order to be able to distiguish if
Chromium, for example, uses a system libgbm (needed by Ozone/Wayland
builds for Linux due to some diffirences, which we cannot fix yet)
or minigbm.

Change-Id: I82366ce9a1c302124b75a6c21028a67127497065
Reviewed-on: https://chromium-review.googlesource.com/1281887
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: align width so that stride aligns to 256
Satyajit Sahu [Thu, 4 Oct 2018 04:49:50 +0000 (10:19 +0530)]
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>
5 years agominigbm: minimal buffer allocation support using msm gem ioctls
Tanmay Shah [Wed, 11 Jul 2018 23:41:05 +0000 (16:41 -0700)]
minigbm: minimal buffer allocation support using msm gem ioctls

DRM_IOCTL_MSM_GEM_NEW is used to create buffer and
DRM_IOCTL_MSM_GEM_INFO is used to map buffer.

BUG=none
TEST=mmap_test, plane_test

Change-Id: I7db0cf36b03625f02828b63946550c768c422419
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
Reviewed-on: https://chromium-review.googlesource.com/1134481
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: don't advertise BGR24 as a render/texture target
Gurchetan Singh [Tue, 18 Sep 2018 00:42:05 +0000 (17:42 -0700)]
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>
5 years agominigbm: use drv_add_combination when adding a single combination
Gurchetan Singh [Tue, 18 Sep 2018 00:13:45 +0000 (17:13 -0700)]
minigbm: use drv_add_combination when adding a single combination

We defined the function, but it's since gone unused.

Change-Id: I23e7e57413c4a7c82d9da302b79e6b9c5068654d
Reviewed-on: https://chromium-review.googlesource.com/1229438
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 years agominigbm: delete unused functions and definitions
Gurchetan Singh [Tue, 18 Sep 2018 00:03:17 +0000 (17:03 -0700)]
minigbm: delete unused functions and definitions

Change-Id: Ie5f8b148e3f051edde08b0b46ab22a80f034ff80
Reviewed-on: https://chromium-review.googlesource.com/1229437
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
5 years agominigbm: run clang-format
Gurchetan Singh [Mon, 17 Sep 2018 23:58:16 +0000 (16:58 -0700)]
minigbm: run clang-format

Change-Id: I9b5c3db33bd0c7914a214e2181d655aec84632c5
Reviewed-on: https://chromium-review.googlesource.com/1229436
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 agominigbm: mediatek: always provide munmap() with a valid address
Luigi Santivetti [Wed, 12 Sep 2018 15:28:21 +0000 (16:28 +0100)]
minigbm: mediatek: always provide munmap() with a valid address

Before this change, a NULL pointer could have been passed to munmap(),
making impossible for it to unmap previoulsy mapped memory. After this
change, munmap() always receives a valid pointer.

BUG=b:71835379 b:114699642
TEST=adb shell "am instrument -w --abi armeabi-v7a -e class\
 android.uirendering.cts.testclasses.InfrastructureTests#testScreenshot\
 android.uirendering.cts/android.support.test.runner.AndroidJUnitRunner"

Change-Id: Ic1b15807623209ab28d0d4ed63fe0d6ef2dcc6f8
Signed-off-by: Luigi Santivetti <luigi.santivetti@imagination.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1221667
Commit-Ready: Kazuhiro Inaba <kinaba@chromium.org>
Tested-by: Pin-chih Lin <johnylin@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: mediatek: wait for outstanding operations when invalidating
Luigi Santivetti [Tue, 28 Aug 2018 09:09:20 +0000 (10:09 +0100)]
minigbm: mediatek: wait for outstanding operations when invalidating

Without doing this it's possible for the CPU to access the memory when it's
in use by another device.

TEST=adb shell "am instrument -w --abi armeabi-v7a -e class\
 android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromPersistentSurfaceToSurfaceQCIF\
 android.media.cts/android.support.test.runner.AndroidJUnitRunner"
BUG=b:71835379

Change-Id: I3b1508a0eab3b020b7c42978cb1e1099ebc029fd
Signed-off-by: Luigi Santivetti <luigi.santivetti@imagination.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1193302
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
5 years agominigbm: msm: add supported formats
Gurchetan Singh [Tue, 28 Aug 2018 21:17:05 +0000 (14:17 -0700)]
minigbm: msm: add supported formats

Since we should be using llvmpipe with MSM for now, add formats
we know work well with vgem (which also uses llvmpipe).

BUG=none
TEST=none

Change-Id: I88bf183a23a593029ed303c16ef960eb36d59f9f
Reviewed-on: https://chromium-review.googlesource.com/1194189
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm/i915.c: Android's HAL_PIXEL_FORMAT_BLOB is not tilable if BO_USE_PROTECTED
Hirokazu Honda [Wed, 15 Aug 2018 03:39:35 +0000 (12:39 +0900)]
minigbm/i915.c: Android's HAL_PIXEL_FORMAT_BLOB is not tilable if BO_USE_PROTECTED

Originally, Android's HAL_PIXEL_FORMAT_BLOB always regards tilable.
It is not true if it is allocated with BO_USE_PROTECTED.
This CL enables to allocated protected non-tiled Android's HAL_PIXEL_FORMAT_BLOB.

BUG=b:112565837
TEST=Play protected videos with ARC++ at eve

Change-Id: I0e45f658f170cd380a74b9207ba57b08b6edab8b
Reviewed-on: https://chromium-review.googlesource.com/1175641
Commit-Ready: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
6 years agominigbm: move height adjustments to helper function
Keiichi Watanabe [Mon, 13 Aug 2018 07:54:56 +0000 (16:54 +0900)]
minigbm: move height adjustments to helper function

Because HAL_PIXEL_FORMAT_YV12 requires that height is not aligned,
adjustments are needed when the format is DRM_FORMAT_YVU420_ANDROID.
This adjustment was done in each driver, but it can be moved to the
helper function.

BUG=None
TEST=VDA test in import mode on Cheza

Change-Id: I23a8a6e674664e80c30ea66b75d79e10edc28d5d
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1172262
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: run clang-format
Keiichi Watanabe [Mon, 13 Aug 2018 07:44:54 +0000 (16:44 +0900)]
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>
6 years agominigbm: support NV12 in virtio_gpu
Keiichi Watanabe [Thu, 2 Aug 2018 13:45:05 +0000 (22:45 +0900)]
minigbm: support NV12 in virtio_gpu

To use vivid on VM as an external camera, virtio_gpu has to support
NV12.

BUG=chromium:852302
TEST=Use camera app on betty by using vivid as an external camera
Change-Id: I84ddcbae473a06337918328afe1db8d32003ad84
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1160434
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: adjust height of NV12 buffer in helper
Keiichi Watanabe [Mon, 6 Aug 2018 09:37:21 +0000 (18:37 +0900)]
minigbm: adjust height of NV12 buffer in helper

When the format is NV12, additional buffer is required for the UV plane.
Though size adjustment for this requirement is currently implemented
only in the msm driver, it is not specific to this device.

This commit moves the adjustment to helper function
'drv_dumb_bo_create', which is called from each driver.

BUG=chromium:852302
TEST=video playback on msm

Change-Id: I690f79ccc6a2c99e680b0d293ffa6002f74ae6bf
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1163582
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: fixup! align minigbm functions names with upstream libgbm
Maksim Sisov [Fri, 10 Aug 2018 11:53:34 +0000 (14:53 +0300)]
minigbm: fixup! align minigbm functions names with upstream libgbm

Adding missing plane handle API renaming.

Change-Id: I33c4b4bcc5097ca568c95eb8c3718c3f790fd996
Reviewed-on: https://chromium-review.googlesource.com/1170773
Commit-Ready: Maksim Sisov <msisov@igalia.com>
Tested-by: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: align minigbm functions names with upstream libgbm
Maksim Sisov [Fri, 3 Aug 2018 13:31:20 +0000 (16:31 +0300)]
minigbm: align minigbm functions names with upstream libgbm

This patch simply changes some methods' names in order to
align them with the upstream ones. It's needed because Chromium/Wayland
implementation is going to have a gbm implementation used by a GPU
split effort.

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

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

Change-Id: I850824e7194077c47baa761cddb2947959dff9c3
Reviewed-on: https://chromium-review.googlesource.com/1162170
Commit-Ready: Michael Spang <spang@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
6 years agominigbm: Opening new fd for dri backend
Satyajit Sahu [Tue, 7 Aug 2018 09:47:18 +0000 (15:17 +0530)]
minigbm: Opening new fd for dri backend

Dri backend is not used for the all use flags. When same fd is
shared between dri backend and the minigbm drv, they end up using the
same kernel DRI context.

BUG=b:111081134
TEST=cheets_SurfaceComposition
     graphics_Gbm
     graphics_Gralloc

Change-Id: I47ae12391acfc9c947e8281de11472fcdf5dec5b
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1164972
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: increment ref count in drv_bo_import
Satyajit Sahu [Thu, 12 Jul 2018 06:59:39 +0000 (12:29 +0530)]
minigbm: increment ref count in drv_bo_import

increment the reference count of gem handle in
drv_bo_import instead of backend.

BUG=b:111378370
TEST=graphics autotest suite

Change-Id: I68bc64e421f8505be5cd46874f02ab5c32805f04
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1134720
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 years agominigbm: amdgpu: align the stride to 256
Satyajit Sahu [Wed, 11 Jul 2018 08:11:56 +0000 (13:41 +0530)]
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>
6 years agomsm: allow allocation of NV12 dumb buffers
Alexandre Courbot [Mon, 21 May 2018 10:05:10 +0000 (19:05 +0900)]
msm: allow allocation of NV12 dumb buffers

Cheza's codec validation requires the ability to import external buffers
into the codec driver. However the only possible provider of such
buffers so far is the display. Make it possible to allocate dumb NV12
buffers by adding the format to the list of allowed formats, and
adjusting the requested buffers' height to include room for the UV plane
and extra padding the venus driver requires.

BUG=b:80589901
TEST=Checked that VDA unittest's TestDecodeTimeMedian passed in import
mode on Cheza.

Change-Id: I6993f654a3bf5e64cdf8a1c665c60bb4c7d9cc9a
Reviewed-on: https://chromium-review.googlesource.com/1118078
Commit-Ready: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
6 years agominigbm: Add BO_USE_HW_VIDEO_DECODER to supported flags
Miguel Casas [Mon, 2 Jul 2018 13:40:25 +0000 (09:40 -0400)]
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>
6 years agominigbm: close bo handle in bo destroy
Satyajit Sahu [Wed, 27 Jun 2018 06:41:12 +0000 (12:11 +0530)]
minigbm: close bo handle in bo destroy

In dri path the bo handle is not closed in bo destroy. This was
resulting in memory leak. Closed the bo handle in bo destroy.

BUG=b:80546783
TEST=graphis autotest suite

Change-Id: I8d9c7fbc87fd80d03be7d9a98ac8aa95f0d175ed
Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1117975
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>