OSDN Git Service

android-x86/external-minigbm.git
7 years agominigbm: vgem: add a few more supported formats
Gurchetan Singh [Fri, 2 Dec 2016 20:32:16 +0000 (12:32 -0800)]
minigbm: vgem: add a few more supported formats

While running Android in QEMU, I encountered a few crashes
due to unsupported formats. Add them here.

BUG=chromium:616275
TEST=Run arc-cros-gralloc in QEMU
CQ-DEPEND=CL:416291

Change-Id: Ie9a9dee0cba7c8b83592c40a3249ebcb30391346
Reviewed-on: https://chromium-review.googlesource.com/416292
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: vgem: align to llvm tile size
Gurchetan Singh [Wed, 30 Nov 2016 04:36:13 +0000 (20:36 -0800)]
minigbm: vgem: align to llvm tile size

We're planning on using Mesa with llvmpipe when running
the Android container in a virtual machine. It's faster
than softpipe. llvmpipe requires alignment to a 64-byte
tile size, so add it here.  This is the analogue to
norvez@'s drm_gralloc commiti (ag/1599269).

BUG=b:28802929, chromium:616275
TEST=run arc-cros-gralloc in QEMU

CQ-DEPEND=CL:414537

Change-Id: If4160d376447ce218df3bc410a8427b284de74fd
Reviewed-on: https://chromium-review.googlesource.com/416291
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: tweak cros-gralloc flags
Gurchetan Singh [Tue, 29 Nov 2016 22:45:46 +0000 (14:45 -0800)]
minigbm: tweak cros-gralloc flags

The Play Store wants a ABGR8888 HW cursor, and we can't in
general support this, so let's ignore the cursor flag rather
than fail the allocation.

We also interpret GRALLOC_USAGE_HW_COMPOSER as BO_USE_SCANOUT
| BO_USE_RENDERING. This fails with YV12, since we can't scanout
from it on Intel/Mediatek. Let's first try to allocate with the
scanout flag enabled and then fall-back to rendering if it's
not supported (i.e, first try overlay but then try OpenGL).

In addition, let's interpret GRALLOC_USAGE_HW_FB the same as
GRALLOC_USAGE_HW_COMPOSER since the framebuffer device
(Chrome in our case) wants to scanout but can also fall back.

BUG=chromium:616275
TEST=run cts --package com.drawelements.deqp.egl on minnie
CQ-DEPEND=CL:414536

Change-Id: I57cd681ca8ff0186698bd0a046c3a7b346f3e434
Reviewed-on: https://chromium-review.googlesource.com/414537
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: flatten gralloc handle
Gurchetan Singh [Mon, 28 Nov 2016 23:25:26 +0000 (15:25 -0800)]
minigbm: flatten gralloc handle

Many GL drivers assume that first value in the native_handle data
array is the fd associated with the graphics buffer, i.e,

int prime_fd = handle->data[0];

This in our case until 4bfc7401. We added 64-bit modifiers in
our import data, so all values in the drv_import_fd_data struct get
8-byte aligned. In our cros_gralloc_handle, 4 bytes of padding
are added between native_handle_t and drv_import_fd_data to make
the alignment work. To counter-act this, we can stop embedding
drv_import_fd_data in cros_gralloc_handle.

BUG=chromium:616275
TEST=Mali driver doesn't return an error when running cros_gralloc
CQ-DEPEND=CL:414585

Change-Id: Ib6c165e98126468b96fa7119d5ca13eebee1655c
Reviewed-on: https://chromium-review.googlesource.com/414536
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: rename DRV_BO_USE_* to BO_USE_*
Gurchetan Singh [Thu, 24 Nov 2016 01:32:33 +0000 (17:32 -0800)]
minigbm: rename DRV_BO_USE_* to BO_USE_*

It's somewhat easier to read.

BUG=none
TEST=minigbm still builds

CQ-DEPEND=CL:416290

Change-Id: I9417caff22ea66e4179fe41d534d8cb9510ef7a3
Reviewed-on: https://chromium-review.googlesource.com/414585
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: vgem: allow driver creation without planes resources
Gurchetan Singh [Fri, 2 Dec 2016 19:02:47 +0000 (11:02 -0800)]
minigbm: vgem: allow driver creation without planes resources

With CL:405019, when drmModeGetPlaneResources failed, creation of
the driver failed. This was an issue for our vgem backend, which
we use to run ARC++ with QEMU. Let's not add KMS flags for vgem
since we know that doesn't work.

BUG=b:31942635
TEST=arc-cos-gralloc with vgem works

CQ-DEPEND=CL:415442

Change-Id: I33a812ab9a24e2e35a47d28f720c4cc2e83eb8f0
Reviewed-on: https://chromium-review.googlesource.com/416290
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: allow for multiple {format, modifier} pairs in combination list
Gurchetan Singh [Thu, 1 Dec 2016 21:36:04 +0000 (13:36 -0800)]
minigbm: allow for multiple {format, modifier} pairs in combination list

With CL:405019, drv_insert_supported_combination appended flags if the
{format, modifier} pair was already in the list. This would result
in the BO_USE_RENDERING flag being in the same supported combination
as BO_USE_LINEAR, even though the arrays in the drivers try to separate
these cases. Initially, add all the combinations specified by
the drivers. When querying KMS, add a helper function that modifies
existing combinations if they already exist.

BUG=b:31942635,
TEST=graphics_Gbm, Chrome boots on minnie
CQ-DEPEND=CL:414584

Change-Id: I64326be2078ae745fca2c819e8344797aef3c667
Reviewed-on: https://chromium-review.googlesource.com/415442
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: rename mutex
Gurchetan Singh [Thu, 24 Nov 2016 01:27:52 +0000 (17:27 -0800)]
minigbm: rename mutex

The mutex also protects the driver supported linked list,
so it's a misnomer to call it "table_lock".

BUG=none
TEST=minigbm builds

CQ-DEPEND=CL:405019

Change-Id: Ia9f3bb471539c5af8c71003595464046b1d7209f
Reviewed-on: https://chromium-review.googlesource.com/414584
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Fix cursor and scanout flags
Gurchetan Singh [Fri, 28 Oct 2016 17:07:35 +0000 (10:07 -0700)]
minigbm: Fix cursor and scanout flags

We were incorrectly advertising the scanout and cursor flags in
the drivers.

Chrome never used the BO_USE_CURSOR flag (see chromium:666488), and we
set it for incorrect formats.  Let's only advertise ARGB8888/XRGB8888
cursors if they were previously advertised, and prevent cursors from being
used as render targets.

For scanout, formats can vary from kernel version to kernel version.
For example, the v3.18 i915 driver can't scanout NV12, but the upstream v4.4
i915 driver can.  Let's query the KMS API in those cases.

In addition, we would also like to move to a place where our backends can
determine if a specific {format, usage, format modifier} tuple is supported.
The plan is to add modifiers to the properties that are exposed in KMS, which
can help with optimization.

BUG=b:31942635, chromium:666488
TEST=Ran graphics_Gbm and checked if Chrome boots on cyan, minnie, and
nyan_big

CQ-DEPEND=CL:413325

Change-Id: Ifd3fd1c8063db97b3f1fe057ace82d22def76943
Reviewed-on: https://chromium-review.googlesource.com/405019
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
7 years agominigbm: Sort case statements alphabetically.
Gurchetan Singh [Mon, 21 Nov 2016 19:36:31 +0000 (11:36 -0800)]
minigbm: Sort case statements alphabetically.

This makes giant case statements easier to read.

BUG=None
TEST=minigbm still builds

CQ-DEPEND=CL:405790

Change-Id: I551c411aa75b9717bad44b25e4c39d8cd7a003a0
Reviewed-on: https://chromium-review.googlesource.com/413325
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Switch to <drm_fourcc.h>
Gurchetan Singh [Mon, 21 Nov 2016 18:46:38 +0000 (10:46 -0800)]
minigbm: Switch to <drm_fourcc.h>

We were duplicating formats.  The original rationale behind this was
DRV_FORMAT_* would be a superset of Android and DRM formats.  However,
there are only 2 HAL flexible formats not defined by DRM, and we can
deal with these easily.  The DRM format namespace is large enough to
handle any additions we may need.

BUG=NONE
TEST=Ran graphics_Gbm,
     arc-cros-gralloc still builds

Change-Id: Ie173eee6ac6926947a3b98c3ae809e38a0ea8014
Reviewed-on: https://chromium-review.googlesource.com/405790
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: rockchip: remove assert.h
Gurchetan Singh [Sat, 19 Nov 2016 00:36:28 +0000 (16:36 -0800)]
minigbm: rockchip: remove assert.h

We don't use it anywhere.

BUG=None
TEST=None

CQ-DEPEND=CL:406485

Change-Id: Ibdbb19597d25e75ab99119fa6b9f81296446d6d7
Reviewed-on: https://chromium-review.googlesource.com/413048
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: Fix incorrect plane import size
Gurchetan Singh [Wed, 2 Nov 2016 17:40:51 +0000 (10:40 -0700)]
minigbm: Fix incorrect plane import size

We were incorrectly determining the plane size for buffers with
vertical subsampling.  Let's add it here.

BUG=chromium:618516
TEST=graphics_Gbm still passes

Change-Id: I47f3c01dfd2539fc669a017ecb497d754d29de9f
Reviewed-on: https://chromium-review.googlesource.com/406485
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Compile with large file support
Ricky Liang [Sat, 29 Oct 2016 07:37:45 +0000 (15:37 +0800)]
minigbm: Compile with large file support

On device with 32-bit userspace on 64-bit kernel we need to make
sure mmap64 is used to import buffer, or the call may fail because
of invalid offset.

BUG=None
TEST=Use libgbm to import drm_gralloc buffer on Elm.

Change-Id: I1b70d105e6f135d8fa534fb99cad266eed910ea9
Reviewed-on: https://chromium-review.googlesource.com/405147
Commit-Ready: Ricky Liang <jcliang@chromium.org>
Tested-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: mediatek: Do not scan out ABGR8888/XBGR8888
Nicolas Boichat [Mon, 7 Nov 2016 09:00:15 +0000 (17:00 +0800)]
minigbm: mediatek: Do not scan out ABGR8888/XBGR8888

Adding ABGR8888 breaks the software cursor on ARC++,
XBGR8888 is not supported by the DRM driver.

BUG=b:32554065
BUG=chrome-os-partner:59436
TEST=Open play store on elm, cursor appears fine.

Change-Id: I7366d2b2acfc50415c381131ba7cf8b70c0de5d8
Reviewed-on: https://chromium-review.googlesource.com/408536
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: add new GBM_BO_IMPORT_FD_PLANAR
Kristian H. Kristensen [Fri, 16 Sep 2016 18:14:16 +0000 (11:14 -0700)]
minigbm: add new GBM_BO_IMPORT_FD_PLANAR

This is helpful for importing multiplanar formats (see b/31999328)
and importing AFBC format modifiers.

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

Change-Id: If7ed9b54e18069ca69b2dbda2b01d59ce58ebeef
Reviewed-on: https://chromium-review.googlesource.com/401439
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
7 years agominigbm: Remove SCANOUT flags from YV12
Gurchetan Singh [Thu, 20 Oct 2016 00:43:43 +0000 (17:43 -0700)]
minigbm: Remove SCANOUT flags from YV12

All of these drivers don't support the ability to directly scan-out
YV12 to the display, so this should not be set.
Let's set rendering flags since the expected use case is importing
Android YV12 buffers into EGL.

BUG=b/32260847
TEST=AdaptivePlaybackTest#testH264_adaptiveDrc

Change-Id: I53d4eaf9c3f359c1c83762cf3e655cc0cf5168d5
Reviewed-on: https://chromium-review.googlesource.com/401040
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: mediatek: add required Android buffers
Gurchetan Singh [Mon, 17 Oct 2016 23:19:13 +0000 (16:19 -0700)]
minigbm: mediatek: add required Android buffers

We need ABGR8888, XBGR8888, and RGB565 buffers for mediatek.
We also need to add certain flags to our flexible YUV formats.

BUG=chromium:616275
TEST=run dEQP EGL tests on elm.
CQ-DEPEND=CL:398424

Change-Id: Ia3122b4e792911575e13fcbeb4f77b5691290a2d
Reviewed-on: https://chromium-review.googlesource.com/399924
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: i915: make Y-tiling default
Gurchetan Singh [Fri, 14 Oct 2016 02:08:48 +0000 (19:08 -0700)]
minigbm: i915: make Y-tiling default

Y-tiling should be the default case, unless the user
explicitly asks for:

(1) a linear buffer
(2) frequent SW access
(3) a scanout buffer

BUG=None
TEST=None
CQ-DEPEND=CL:392547

Change-Id: I6b7751f28c7127a458cc754bc2114ea1dad7a80c
Reviewed-on: https://chromium-review.googlesource.com/398425
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: rockchip: Enable required Android buffers
Gurchetan Singh [Fri, 14 Oct 2016 00:23:15 +0000 (17:23 -0700)]
minigbm: rockchip: Enable required Android buffers

The Play store passes down the 0x8933 flag sometimes, which translates
to:

GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN |
GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER |
GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_CURSOR

so we need to handle this case with ABGR8888 buffers.  In addition,
the dEQP EGL tests require RGB565 and XBGR8888 formats to succeed.

BUG=chromium:616275
TEST=Play angry birds on minnie, also verified all EGL dEQP tests pass:

run cts --package com.drawelements.deqp.egl

CQ-DEPEND=CL:392548

Change-Id: Ifb4953741bdd4c85a210e499061c8c4a0a6a731e
Reviewed-on: https://chromium-review.googlesource.com/398424
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: add vgem backend
Gurchetan Singh [Fri, 30 Sep 2016 21:53:32 +0000 (14:53 -0700)]
minigbm: add vgem backend

When running x86 ARC++ images on a virtual machine, we use
the vgem driver.  We should support it here too.

BUG=chromium:616275
TEST=container boots when running QEMU with cros_gralloc.  Note
videos (i.e, YUV formats) don't work on QEMU, but they never did
with gralloc_drm either.

CQ-DEPEND=CL:392548

Change-Id: If9f6b8035f2a88068980bede5121ef4599b37272
Reviewed-on: https://chromium-review.googlesource.com/392549
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: rockchip: enable NV12 for Android
Gurchetan Singh [Fri, 23 Sep 2016 22:27:07 +0000 (15:27 -0700)]
minigbm: rockchip: enable NV12 for Android

For NV12 buffers to work on Android, we need to use the same
logic that we use in gralloc_drm_rockchip.  Otherwise, video
playback doesn't work in the container.

BUG=chromium:616275
TEST=Play Youtube app.  Also ran plane_test (which defaults to NV12).
CQ-DEPEND=CL:392547

Change-Id: I8dbd989f2638c99200866f8191450c71114bdbe5
Reviewed-on: https://chromium-review.googlesource.com/392548
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: i915: enable required Android buffers
Gurchetan Singh [Fri, 23 Sep 2016 00:00:42 +0000 (17:00 -0700)]
minigbm: i915: enable required Android buffers

The Play Store wants a HAL_PIXEL_FORMAT_RGBA_8888 (ABGR with fourcc)
buffer with the 0x8933 flag sometimes, which translates to:

GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN |
GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_COMPOSER |
GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_CURSOR

Some dEQP EGL tests also need XBGR8888 buffers with
GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN flags.

In addition, we need to support YUV buffers with these usage flags:

GRALLOC_USAGE_EXTERNAL_DISP | GRALLOC_USAGE_HW_COMPOSER |
GRALLOC_USAGE_TEXTURE

for Youtube videos to work, so add that too.

BUG=chromium:616275
TEST=Play Angry birds and run Youtube app on Cyan.  Verified all dEQP
EGL tests pass:

run cts --package com.drawelements.deqp.egl

CQ-DEPEND=CL:392546

Change-Id: I3a4a03e4b300240a167e1fbc3eb3e23c55551c8b
Reviewed-on: https://chromium-review.googlesource.com/392547
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Fix the flag situation
Gurchetan Singh [Mon, 12 Sep 2016 23:21:29 +0000 (16:21 -0700)]
minigbm: Fix the flag situation

FrameBufferSurface.cpp (used by SurfaceFlinger) requires
GRALLOC_USAGE_HW_FB and GRALLOC_USAGE_HW_COMPOSER flags.

It's annoying to update so many flags in driver-supported lists, and
difficult to read.  Let's remove redundant flags and try to keep the
ones that one have a distinct and granular meaning.

CQ-DEPEND=CL:362062

Change-Id: I6e1974b02e90a4a98c350867d71050fee728ce3a
Reviewed-on: https://chromium-review.googlesource.com/392546
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Implemented cros_gralloc
Gurchetan Singh [Thu, 25 Aug 2016 01:31:23 +0000 (18:31 -0700)]
minigbm: Implemented cros_gralloc

It is desirable to have a gralloc implementation based on the same
drivers we use for minigbm. This will help synchronize the code between
CrOS and the Android container.

BUG=chromium:616275
TEST=Ran the gralloc unit test:

test_that -b veyron_minnie-cheets $IP1 graphics_Gralloc

Verified it succeeded.

CQ-DEPEND=CL:395066

Change-Id: Iff11eba3a92268327ef00eb12b4eabe6fc190cf3
Reviewed-on: https://chromium-review.googlesource.com/362062
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: More sophisticated gbm_bo_map/gbm_bo_unmap
Gurchetan Singh [Thu, 6 Oct 2016 17:58:00 +0000 (10:58 -0700)]
minigbm: More sophisticated gbm_bo_map/gbm_bo_unmap

We previously added the gbm_bo_map/gbm_bo_unmap (see CL:393927)
entry points since we wanted to do driver-specific detiling during
screenshot capture tests.  We ignored most the parameters and mapped
the entire buffer.  This CL adds the ability to:

1) Return the starting address within a byte given a specific x, y
   in the buffer.

2) Handle the case where there are more than one kernel buffers
   per buffer object.  Currently, only the Exynos driver would use
   this capability.

BUG=chromium:653284
TEST=Ran cros_gralloc with modified code

CQ-DEPEND=CL:393927

Change-Id: I19d75d2f16489c0184e96305fb643f18477e1cdb
Reviewed-on: https://chromium-review.googlesource.com/395066
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agoRevert "Add new GBM_BO_IMPORT_FD_PLANAR"
Mike Frysinger [Sun, 9 Oct 2016 02:34:30 +0000 (02:34 +0000)]
Revert "Add new GBM_BO_IMPORT_FD_PLANAR"

This reverts commit bb19d6abec19015eb16fe33d3a4128194f8c7f2f.

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

BUG=chromium:654245

Change-Id: I0d88f7731e9e90fffee1485056d787430eb0b850
Reviewed-on: https://chromium-review.googlesource.com/395727
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
7 years agoAdd new GBM_BO_IMPORT_FD_PLANAR
Kristian H. Kristensen [Fri, 16 Sep 2016 18:14:16 +0000 (11:14 -0700)]
Add new GBM_BO_IMPORT_FD_PLANAR

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

Change-Id: If7ed9b54e18069ca69b2dbda2b01d59ce58ede0b
Reviewed-on: https://chromium-review.googlesource.com/387145
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Trybot-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>

7 years agominigbm: quick and dirty implementation of gbm_bo_map/gbm_bo_unmap
Gurchetan Singh [Wed, 5 Oct 2016 22:16:22 +0000 (15:16 -0700)]
minigbm: quick and dirty implementation of gbm_bo_map/gbm_bo_unmap

We want to add gbm_bo_map/gbm_bo_unmap entry points so certain tests
and Chrome can use driver specific map logic.  This is based on the
upstream entry points in Mesa, with the addition of a plane parameter.

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

BUG=chromium:653284
TEST=minigbm builds

Change-Id: I0423c10c55bab8fac6d6d7c6a699ab71b43aa61b
Reviewed-on: https://chromium-review.googlesource.com/393927
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Add AMDGPU minigbm driver
Akshu Agrawal [Thu, 28 Jul 2016 10:05:45 +0000 (15:35 +0530)]
minigbm: Add AMDGPU minigbm driver

Add a minigbm driver to support the AMDGPU drm.

BUG=chrome-os-partner:56076
TEST=emerge-jadeite minigbm and test UI

Change-Id: I395bba57998d95074bd13a379d62d6bec888154b
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/368101
Tested-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Map and unmap correct size
Gurchetan Singh [Tue, 30 Aug 2016 02:51:45 +0000 (19:51 -0700)]
minigbm: Map and unmap correct size

We were not mapping the entire buffer for multi-plane buffer objects.

BUG=chromium:616275
TEST=NONE
CQ-DEPEND=CL:377884

Change-Id: Ia64a6eb45310abeaed3f376479a6738ccd09f0bf
Reviewed-on: https://chromium-review.googlesource.com/377841
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Added YV12 for Mali platforms
Gurchetan Singh [Tue, 30 Aug 2016 01:19:19 +0000 (18:19 -0700)]
minigbm: Added YV12 for Mali platforms

Oak-cheets is using YV12 as it's Android flexible YUV format, so
we need to support it.  Additionally, we're trying to enable
YV12 on Mali with EXT_image_dma_buf_import.  Instead of having
redundant switch statements in every driver, let's add a helper
function to do this.

BUG=chrome-os-partner:54632, b/29059119, chromium:616275
TEST=Ran plane_test, graphics_Gbm on veyron_minnie

Change-Id: I4798225db809941367e58dde962576535b8d767c
Reviewed-on: https://chromium-review.googlesource.com/377884
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Fix switch statements
Gurchetan Singh [Tue, 30 Aug 2016 02:13:51 +0000 (19:13 -0700)]
minigbm: Fix switch statements

Our switch statements were inconsistent.  Let's use kernel
style switch statements since we already follow many kernel
coding guidelines in this repo (8-space tabs, mostly 80
line limit).

Change-Id: I2b6ccc2369160bf49bbdf6479aebec7dada2e2fa
Reviewed-on: https://chromium-review.googlesource.com/377883
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agoAdd XBGR8888 to rockchip supported formats.
Daniele Castagna [Fri, 5 Aug 2016 22:50:34 +0000 (18:50 -0400)]
Add XBGR8888 to rockchip supported formats.

BUG=chromium:639111,b:29430506
TEST=Tested on minnie after changing chrome primary buffer format to XBGR

Change-Id: I2d1ba8711e9f15efa0d728948dba58c18ef5b918
Reviewed-on: https://chromium-review.googlesource.com/366900
Commit-Ready: Daniele Castagna <dcastagna@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: David Reveman <reveman@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Added support for multiplane import
Gurchetan Singh [Fri, 19 Aug 2016 23:26:46 +0000 (16:26 -0700)]
minigbm: Added support for multiplane import

Gralloc requires flexible YUV formats (YV12, NV12) to be importable.
This change modifies our internal import API to support this.

TEST=ran graphics_Gbm
BUG=chromium:616275
CQ-DEPEND=CL:373048

Change-Id: I4100e1c1639828e4adf08764b45fe5a44b7078a3
Reviewed-on: https://chromium-review.googlesource.com/374162
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Add YV12 for i915
Gurchetan Singh [Tue, 19 Jul 2016 22:52:33 +0000 (15:52 -0700)]
minigbm: Add YV12 for i915

At the moment, the ArcCodec produces YV12 on Intel.  The gralloc
module should support it, atleast temporarily until UYVY hardware
overlays are enabled on CrOS.

TEST=ran graphics_Gbm, tested Chrome boots on Cyan
BUG=b/29335168, chromium:616275
CQ-DEPEND=CL:372359

Change-Id: I27c888d3467aa89e8ca48b22523cbc76973aa314
Reviewed-on: https://chromium-review.googlesource.com/373048
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Added gralloc API to internal API
Gurchetan Singh [Wed, 17 Aug 2016 00:57:10 +0000 (17:57 -0700)]
minigbm: Added gralloc API to internal API

Added the drv analogues of the 2 flexible formats we need to support.
Added analogues of most of the gralloc use flags, except:

GRALLOC_USAGE_SW_READ_MASK
GRALLOC_USAGE_SW_WRITE_MASK
GRALLOC_USAGE_HW_MASK
GRALLOC_USAGE_FOREIGN_BUFFERS
GRALLOC_USAGE_ALLOC_MASK

These are used as masks and don't make sense as usage hints.  In
addition, put the new flags in the drivers' supported lists and
added a flexible format query function.

BUG=chromium:616275
TEST=minigbm still builds
CQ-DEPEND=CL:371501

Change-Id: Idd2ecd6fde3e6c5caaaf3a8404d0d7db20b4ecf4
Reviewed-on: https://chromium-review.googlesource.com/372359
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>
7 years agominigbm: Remove drv prefix from static backend functions
Gurchetan Singh [Wed, 17 Aug 2016 01:18:24 +0000 (18:18 -0700)]
minigbm: Remove drv prefix from static backend functions

It doesn't make sense to have the drv prefix for static backend
functions, so remove it.

TEST=minigbm still builds

CQ-DEPEND=CL:370798

Change-Id: I65272162b8c7cf5d3716c7e5fcf0475c35522c47
Reviewed-on: https://chromium-review.googlesource.com/371501
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
7 years agominigbm: Add mmap() in backends
Gurchetan Singh [Fri, 12 Aug 2016 23:38:25 +0000 (16:38 -0700)]
minigbm: Add mmap() in backends

Gralloc requires the ability to mmap a buffer into userspace. This
change adds the necessary entry points to our internal "drv"
interface.

BUG=chromium:616275
TEST=minigbm still builds.  Also ran:

./gralloctest mapping

with CL:362062 applied on minnie and cyan (decided to split that CL
into smaller patches).

CQ-DEPEND=CL:366041

Change-Id: I7396b0c79702f24eb779984805bc679c237bd932
Reviewed-on: https://chromium-review.googlesource.com/370798
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Add userspace reference counting
Gurchetan Singh [Thu, 4 Aug 2016 00:14:55 +0000 (17:14 -0700)]
minigbm: Add userspace reference counting

When a dmabuf is imported multiple times, further imports after the
first one are not refcounted, i.e. the first close() will lose the
dmabuf. To avoid this, user space needs to track the number of imports
and only close() the dmabuf once the last import is closed.

BUG=None
TEST=Ran graphics_Gbm on minnie.  Still passes.

Change-Id: Iba63556ccc94ac5d49be2f827ceead85e0e22c9c
Reviewed-on: https://chromium-review.googlesource.com/366041
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: Refactored minigbm on top a private API
Gurchetan Singh [Fri, 5 Aug 2016 21:40:07 +0000 (14:40 -0700)]
minigbm: Refactored minigbm on top a private API

We would like to reuse the same set of drivers for ChromeOS (with
a minigbm frontend) and Android (with a gralloc frontend).  Since
we don't want to pollute the gbm API with gralloc formats and usages,
we can refactor minigbm on top a private API that will be a superset
of gbm and gralloc.  This change redirects gbm calls to the
private API.

TEST=Ran graphics_Gbm on minnie and cyan, and checked if Chrome boots.
BUG=chromium:616275

CQ-DEPEND=CL:367791

Change-Id: I50d10f9d6c7ea936b0d76c5299a58d948939fdf9
Reviewed-on: https://chromium-review.googlesource.com/367780
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigm: add kind C32_2CRA and set it as default
Vince Hsu [Thu, 19 May 2016 09:46:08 +0000 (17:46 +0800)]
minigm: add kind C32_2CRA and set it as default

We need some additional minigbm API to set kind for buffer.

BUG=chromium:478339
TEST=none

Change-Id: I770e5d4d8af07d846557953ba52a3529b8715c8d
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346364
Commit-Ready: Mark Zhang <markz%nvidia.com@gtempaccount.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: One buffer for NV12
Gurchetan Singh [Fri, 15 Jul 2016 02:54:44 +0000 (19:54 -0700)]
minigbm: One buffer for NV12

Some of our Android framework code expects one fd per format.  The gbm
API allows it, so let's go with this representation.  Also fixed a bug
that comes up when bo->num_planes = 2, but the handles are the same.

BUG=chromium:616275
TEST=gbmtest, plane_test

Change-Id: Iec0e6319d144941a73c26497af2078112d5e4e64
Reviewed-on: https://chromium-review.googlesource.com/360905
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
7 years agominigbm: tegra: assign format modifier for block linear surface
Vince Hsu [Thu, 19 May 2016 10:11:56 +0000 (18:11 +0800)]
minigbm: tegra: assign format modifier for block linear surface

This modifier is vendor specific field except the vendor ID. It will be
used to extract the tiling and compression information in NVIDIA EGL
driver.

BUG=chromium:478339
TEST=none

Change-Id: I9ec88b61da4a9b2d30d7d9203e86197814291a1c
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346366
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
7 years agominigbm: add format modifiers per plane
Vince Hsu [Mon, 23 May 2016 02:32:25 +0000 (10:32 +0800)]
minigbm: add format modifiers per plane

To pass the surface format parameters to EGL, we add format modifiers
which are used for dmabuf import. The vendor ID definitions are copied
from drm_fourcc.h.

BUG=chromium:478339
TEST=none

Change-Id: Ida3e6787b29af73ff534c054006f93c3bad4c5b9
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346365
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agorockchip: add NV12 bo creation support
Zach Reizner [Wed, 27 Apr 2016 18:14:41 +0000 (11:14 -0700)]
rockchip: add NV12 bo creation support

This patch does alignment if needed on the width and height, but does
not expose this change to the public facing gbm_bo. It is expected that
framebuffer creation in the kernel with do alignment such that
applications don't have to have platform specific knowledge of alignment
requirements.

TEST=nv12_test
BUG=chromium:607241

Change-Id: I6138afb56537f516fac038ff4db39593c623fccd
Reviewed-on: https://chromium-review.googlesource.com/341010
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
8 years agoremove enum gbm_bo_format
Zach Reizner [Mon, 9 May 2016 22:00:17 +0000 (15:00 -0700)]
remove enum gbm_bo_format

The presence of this enum makes mistakes handling gbm formats very easy
to make. With this patch, no new code can use this enum. Any old code
that tries will see errors.

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

Change-Id: If3b19975a137928965f14bad26d1e895dd839810
Reviewed-on: https://chromium-review.googlesource.com/343528
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
8 years agoexynos: fix leak on error path of gbm_exynos_bo_create
Zach Reizner [Tue, 3 May 2016 22:45:16 +0000 (15:45 -0700)]
exynos: fix leak on error path of gbm_exynos_bo_create

BUG=None
TEST=None

Change-Id: Ib536047b3a7ec70f31b4065c041cc4cafa32002f
Reviewed-on: https://chromium-review.googlesource.com/342147
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
8 years agominigbm: remove GBM_BO_USE_WRITE from the drivers.
Dongseong Hwang [Tue, 3 May 2016 10:43:29 +0000 (13:43 +0300)]
minigbm: remove GBM_BO_USE_WRITE from the drivers.

We deprecated GBM_BO_USE_WRITE in Chrome OS, so we should remove it from the
drivers.

BUG=chromium:356871
CQ-DEPEND=CL:342391
Change-Id: I29c10817cf71ae51d12092f05228e92f342ca4e5
Reviewed-on: https://chromium-review.googlesource.com/341911
Commit-Ready: Dongseong Hwang <dongseong.hwang@intel.com>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
8 years agoAdd formats R8, RG88, GR88
Dongseong Hwang [Thu, 7 Apr 2016 11:51:29 +0000 (14:51 +0300)]
Add formats R8, RG88, GR88

It's follow-up patch of libdrm patch https://lists.freedesktop.org/archives/dri-devel/2015-July/086041.html
i915 allows R8 and GR88 because Mesa supports R8 and GR88 dma_bufs. https://lists.freedesktop.org/archives/mesa-commit/2015-July/057676.html
It's need to enable zero-copy video playback.

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

Change-Id: I9c822f882f4a8e448ebca68b24c7fbd7bf86155a
Reviewed-on: https://chromium-review.googlesource.com/337730
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
8 years agodeprecate GBM_BO_USE_WRITE
Zach Reizner [Tue, 8 Mar 2016 18:22:40 +0000 (10:22 -0800)]
deprecate GBM_BO_USE_WRITE

There are no users of this flag, and the only thing it is defined to
affect is gbm_bo_write, which has no implementation. I suspect this is a
leftover from the original gbm that is no longer needed.

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

BUG=None
TEST=minigbm still builds

Change-Id: I0b72efa14208b32e924292cef957273359c7d40b
Reviewed-on: https://chromium-review.googlesource.com/331289
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agominigbm: ensure drm_prime_handle struct is correctly initialized
Vincent Palatin [Fri, 8 Apr 2016 17:03:52 +0000 (10:03 -0700)]
minigbm: ensure drm_prime_handle struct is correctly initialized

the 'prime_handle' variable has a 'flags' and the kernel code for
DRM_IOCTL_PRIME_FD_TO_HANDLE will fail if 'flags' contains something
else than DRM_CLOEXEC or 0.
Right now, the 'flags' field is uninitialized and DRM initialization
fails on some VM configs with kernel 4.4.

BUG=chromium:591626
TEST=run null_platform_test and Chrome browser using the arm64-llvmpipe
overlay and kernel 4.4 on QEMU VM.

Change-Id: Ieac8eb280fe14f1e268f8869dcc9fe46c1bb9599
Reviewed-on: https://chromium-review.googlesource.com/337970
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agoRelax the restriction and permit read/write access on dma-buf
Tiago Vignatti [Tue, 26 Jan 2016 12:32:27 +0000 (10:32 -0200)]
Relax the restriction and permit read/write access on dma-buf

This patch relax the restriction and permit read/write access on dma-buf. In
particular this is necessary for the userspace mmap()ing a dma-buf fd, so
Chrome could now use it for unpriviledged Renderers write into a graphics
buffer without much difficulty. This has been discussed in upstream here:

http://lists.freedesktop.org/archives/dri-devel/2015-December/097562.html

Kernel changes are needed to use this userspace feature:

Author: Daniel Thompson <daniel.thompson@linaro.org>
Date:   Fri Jun 19 14:52:28 2015 +0100

    drm: prime: Honour O_RDWR during prime-handle-to-fd

BUG=chromium:581151
TEST=test_that -b strago $DEVICE graphics_SanAngeles
     test_that -b strago $DEVICE graphics_GLBench
     test_that -b strago $DEVICE graphics_Sanity

Change-Id: I37aff88623ba6aa45797b0ccb6cd2d15c5c51f41
Reviewed-on: https://chromium-review.googlesource.com/323990
Commit-Ready: Tiago Vignatti <tiago.vignatti@intel.com>
Tested-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agominigbm: Fill sizes[0] in gbm_bo_import
Stéphane Marchesin [Sat, 12 Mar 2016 06:01:35 +0000 (22:01 -0800)]
minigbm: Fill sizes[0] in gbm_bo_import

We need to give useable sizes to imported buffers, not just the ones
we create.

BUG=chromium:592681
TEST=run the test on lumpy

Change-Id: Ife99988600607e2f4a56bbad37b48c21829701dd
Reviewed-on: https://chromium-review.googlesource.com/332448
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agominigbm: Add virtio_gpu driver.
Vincent Palatin [Fri, 11 Mar 2016 22:05:45 +0000 (14:05 -0800)]
minigbm: Add virtio_gpu driver.

Add a minigbm driver to support the virtio_gpu DRM driver as used by
QEMU virtual machine.

BUG=chromium:591626
TEST=null_platform_test runs on emulated ARM64 virtual machine using
virtio_gpu driver and VIRTIO MMIO transport.

Change-Id: I1bbb060bb882d732b17435a2422cd7fb2c77a5f0
Reviewed-on: https://chromium-review.googlesource.com/332286
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agominigbm: constify and staticify functions/structs
Stéphane Marchesin [Fri, 26 Feb 2016 21:36:22 +0000 (13:36 -0800)]
minigbm: constify and staticify functions/structs

A lot of these can be made const/static so let's do this.

BUG=none
TEST=compiles

Change-Id: Id0b534ca477b25488b264622f062471063378c1c
Signed-off-by: Stphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329561
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
8 years agoadd GBM_BO_USE_LINEAR flag for bo creation
Zach Reizner [Thu, 25 Feb 2016 18:45:44 +0000 (10:45 -0800)]
add GBM_BO_USE_LINEAR flag for bo creation

Some drivers will enable tiling with the other GBM_BO_USE_* flags as an
optimization, but this interferes with reading/writing to mmapped
buffers and other devices that might expect linear buffers.

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

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

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

Change-Id: I8ca31c4c1753af816b13bd75e4feb5b76d153e2a
Reviewed-on: https://chromium-review.googlesource.com/329248
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agocheck usage flags against device's supported formats in gbm_bo_create
Zach Reizner [Thu, 25 Feb 2016 19:44:36 +0000 (11:44 -0800)]
check usage flags against device's supported formats in gbm_bo_create

Previously, gbm_bo_create called gbm_device_is_format_supported with 0
hardcoded as the usage flags. This meant gbm_bo_create could attempt to
create buffer objects for unsupported combos of usage flags and pixel
formats. Using 0 as the usage flag basically meant ANY usage flag that
was supported by the device would work.

Of course that's not the reality, and the usage flag should be
considered along with the pixel format during buffer object creation,
which is what this CL does.

TEST=ui works
BUG=None

Change-Id: Icd3bd0f47dc33790e4476515f2024f9765bea0a2
Reviewed-on: https://chromium-review.googlesource.com/329306
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agocirrus: add support for GBM_FORMAT_ARGB8888 and GBM_FORMAT_XRGB8888
Zach Reizner [Fri, 19 Feb 2016 20:39:35 +0000 (12:39 -0800)]
cirrus: add support for GBM_FORMAT_ARGB8888 and GBM_FORMAT_XRGB8888

Cirrus supports both formats for scanout and EGL+llvmpipe requires it.
Cirrus+llvmpipe is still used for running Chrome OS in a VM, so GBM
needs to support allocating BOs of the required format for rendering.

TEST=ui works in VM
BUG=chromium:588140

Change-Id: Ibc834c334f54e9a36173285d18c0aa97de58fdb6
Reviewed-on: https://chromium-review.googlesource.com/328750
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agoSupport multi-plane buffers.
Yuly Novikov [Wed, 9 Dec 2015 03:48:29 +0000 (22:48 -0500)]
Support multi-plane buffers.

Enable NV12 format on Exynos.

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

Change-Id: Ia149618fa086b9ba3ef998149c3557052833e33b
Signed-off-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/318550
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agominigbm: Add evdi minigbm driver.
Bartosz Bielecki [Thu, 7 Jan 2016 15:57:10 +0000 (16:57 +0100)]
minigbm: Add evdi minigbm driver.

Add a minigbm driver to support the evdi drm.

BUG=none
TEST=Ozone recognizes the evdi dri card

Change-Id: Ic0528194ecf8c388f9818e125ed72d17cfff3a4c
Reviewed-on: https://chromium-review.googlesource.com/322161
Commit-Ready: Michał Łukaszek <michal.lukaszek@displaylink.com>
Tested-by: Michał Łukaszek <michal.lukaszek@displaylink.com>
Reviewed-by: Michał Łukaszek <michal.lukaszek@displaylink.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agorockchip: Add ABGR8888 format.
David Reveman [Tue, 17 Nov 2015 00:00:02 +0000 (19:00 -0500)]
rockchip: Add ABGR8888 format.

Chromium expects this format to be supported for import of
foreign buffers.

BUG=chromium:541558
TEST=chromium glimage tests pass

Change-Id: I7ff2f53ef31fc491699f7ad9aea34b3e63289690
Reviewed-on: https://chromium-review.googlesource.com/312591
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
8 years agominigbm: Add marvell minigbm driver.
Daniel Blum [Wed, 2 Dec 2015 06:46:09 +0000 (22:46 -0800)]
minigbm: Add marvell minigbm driver.

Add a minigbm driver to support the marvell drm.

BUG=chrome-os-partner:43199
TEST=Freon boots to browser

Change-Id: Ib00d4433a6e3103505a4ceaed1e4ac1ea0d2ba5e
Signed-off-by: Daniel Blum <dblum@marvell.com>
Reviewed-on: https://chromium-review.googlesource.com/315359
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Eduardo Gallofin <eduardog@marvell.com>
8 years agoImplement gbm_bo_import
Stéphane Marchesin [Thu, 5 Nov 2015 19:43:59 +0000 (11:43 -0800)]
Implement gbm_bo_import

We only support GBM_BO_IMPORT_FD for now.

BUG=chromium:541558
TEST=run unit test (graphics_Gbm)

Change-Id: I1232cfdb57efdbbe9c3243b74c4fc5bf20cd8c08
Signed-off-by: Stphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311203
Commit-Ready: Ilja Friedel <ihf@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: David Reveman <reveman@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
8 years agoMisc style/indent fixes
Stéphane Marchesin [Wed, 4 Nov 2015 00:14:59 +0000 (16:14 -0800)]
Misc style/indent fixes

This fixes miscellaneous issues with style and indentation.

BUG=none
TEST=builds

Change-Id: I0f41a2d06687a3da5ca4a92dba76675e49d4b4cd
Signed-off-by: Stphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311202
Commit-Ready: Ilja Friedel <ihf@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
8 years agominigbm: fix YUV bpp size issue
William Xie [Fri, 23 Oct 2015 02:15:17 +0000 (10:15 +0800)]
minigbm: fix YUV bpp size issue
i915: add UYVY support

BUG=None
TEST=Auron/BDW

Change-Id: I78f26ab29d8bf3a43a09b23677fefffd70e5871d
Reviewed-on: https://chromium-review.googlesource.com/308226
Commit-Ready: William Xie <william.xie@intel.com>
Tested-by: William Xie <william.xie@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: William Xie <william.xie@intel.com>
9 years agominigbm: add spew on IOCTL failures.
Ilja H. Friedel [Thu, 9 Apr 2015 21:08:36 +0000 (14:08 -0700)]
minigbm: add spew on IOCTL failures.

Having spew on errors would have made debugging the Netflix
double fd close more obvious.

BUG=chromium:462459, chromium:464628
TEST=Builds for link, tegra, nyan.

Change-Id: I050794fbca8e9291752e52119751847ffcacd798
Reviewed-on: https://chromium-review.googlesource.com/265065
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Commit-Queue: Ilja Friedel <ihf@chromium.org>
Tested-by: Ilja Friedel <ihf@chromium.org>
9 years agoi915: align in pixels not bytes on gen3
Stéphane Marchesin [Tue, 31 Mar 2015 20:47:22 +0000 (13:47 -0700)]
i915: align in pixels not bytes on gen3

BUG=chromium:428125
TEST=freon on zgb runs a bit further

Change-Id: I9bac0871ba4e04e3a3d5ff1579a119987d889e61
Reviewed-on: https://chromium-review.googlesource.com/263288
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agominigbm: Add mediatek drm to minigbm
JB Tsai [Thu, 19 Mar 2015 06:30:31 +0000 (14:30 +0800)]
minigbm: Add mediatek drm to minigbm

Add gbm_driver_mediatek function in gbm_get_driver to support
mediatek drm

BUG=None
TEST=Use gbmtest with minigbm to verify

Change-Id: Ieaccdbf5a2bde94f70addb8ac5192fbbcecf321e
Signed-off-by: JB Tsai <jb.tsai@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/261503
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agominigbm: Set library soname to libgbm.so.1 during link
Michael Spang [Fri, 30 Jan 2015 18:05:35 +0000 (13:05 -0500)]
minigbm: Set library soname to libgbm.so.1 during link

The soname needs to match mesa exactly. The actual library is installed
as libminigbm.so.1.0.0 - this filename does not matter, and it is
probably better to be specific.

BUG=chromium:446653
TEST=chrome built against mesa boots with minigbm &
 chrome built against minigbm boots with minigbm

Change-Id: Id031cc1eb63ab27df57ef9e0313994723e24987c
Reviewed-on: https://chromium-review.googlesource.com/244782
Reviewed-by: Haixia Shi <hshi@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>

9 years agoFix missing-prototypes warnings
Lauri Peltonen [Sat, 17 Jan 2015 11:57:51 +0000 (13:57 +0200)]
Fix missing-prototypes warnings

A missing include in helpers.c triggered a bunch of missing-prototypes
warnings.

BUG=None
TEST=Local build with -Wall is now free of warnings

Change-Id: I8d6655ba48abd5cb4f48fa29520f62b076a45690
Reviewed-on: https://chromium-review.googlesource.com/241441
Reviewed-by: Lauri Peltonen <lpeltonen@nvidia.com>
Commit-Queue: Lauri Peltonen <lpeltonen@nvidia.com>
Tested-by: Lauri Peltonen <lpeltonen@nvidia.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agofix rockchip build
Dominik Behr [Tue, 13 Jan 2015 08:59:21 +0000 (00:59 -0800)]
fix rockchip build

rockchip.c needs to include helpers.h
BUG=chromium:442605
TEST=emerge-veyron_pinky minigbm

Change-Id: I21f43b5c71a6c8432e7973e9faa3d29bee0c3bdd
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/240346
Reviewed-by: David Sodman <dsodman@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agotegra: Support tiled buffers
Lauri Peltonen [Thu, 18 Dec 2014 07:01:37 +0000 (23:01 -0800)]
tegra: Support tiled buffers

If GBM_BO_USE_RENDERING flag is passed, allocate tiled buffers.  Add logic
to the Tegra backend to compute tiled buffer dimensions and tiling
parameters (kind and block height).

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

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

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

BUG=None
TEST=null_platform_test on Tegra

Change-Id: I4e0226efa401b08f7e4a009a7f74b3453c622a10
Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/236663
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agofix incorrect error detection in gbm_bo_get_fd
Zach Reizner [Fri, 9 Jan 2015 19:25:02 +0000 (11:25 -0800)]
fix incorrect error detection in gbm_bo_get_fd

TEST=None
BUG=None

Change-Id: I6404564bc847b649858232bd4c3eea54663b8d00
Reviewed-on: https://chromium-review.googlesource.com/239961
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
9 years agoi915: implement alignment restrictions
Stéphane Marchesin [Tue, 25 Nov 2014 01:09:49 +0000 (17:09 -0800)]
i915: implement alignment restrictions

The previous version was a quick and dirty implementation, this one
should be complete.

BUG=chromium:434924
TEST=

Change-Id: Ia6840bd75c7ea1c8d083ae9c5a3da6699f468273
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231731
Reviewed-by: Haixia Shi <hshi@chromium.org>
9 years agorename pc file from libgbm.pc to gbm.pc to match mesa
Dominik Behr [Wed, 12 Nov 2014 00:49:10 +0000 (16:49 -0800)]
rename pc file from libgbm.pc to gbm.pc to match mesa

BUG=none
TEST=emerge-$BOARD minigbm

Change-Id: I640b12bd31b7f93287600a636324adc8f4432dca
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229186

9 years agoFixed O_CLOEXEC and missing semicolon.
Dominik Behr [Tue, 11 Nov 2014 15:17:11 +0000 (07:17 -0800)]
Fixed O_CLOEXEC and missing semicolon.

Change-Id: I50bff28ff764610d66b362aa6859054a64a6a1df
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229180
Reviewed-by: David Sodman <dsodman@chromium.org>
9 years agoImplement gbm_bo_get_fd
Stéphane Marchesin [Thu, 6 Nov 2014 04:21:25 +0000 (20:21 -0800)]
Implement gbm_bo_get_fd

BUG=none
TEST=unit test

Change-Id: Iafeb58f8e09d4409633475341fc2675922f7350d
Reviewed-on: https://chromium-review.googlesource.com/228252
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agofix the test for environment variables
Dominik Behr [Tue, 30 Sep 2014 01:17:06 +0000 (18:17 -0700)]
fix the test for environment variables

BUG=none
TEST=emerge-$BOARD minigbm
CQ-DEPEND=CL:220465

Change-Id: I1f594e5504e85e4f60d2143d21425899e2bd00e6
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220480
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoPopulate the stride field when creating gbm_bos
Daniel Nicoara [Thu, 25 Sep 2014 22:53:19 +0000 (18:53 -0400)]
Populate the stride field when creating gbm_bos

BUG=chromium:394868,chromium:402597,chromium:413947,chromium:412508
TEST=compiled & verified stride value on pixel

Change-Id: I5555289a9549b803ee29a7d4fbf75987b02afa1b
Reviewed-on: https://chromium-review.googlesource.com/219865
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Daniel Nicoara <dnicoara@chromium.org>
Tested-by: Daniel Nicoara <dnicoara@chromium.org>
9 years agoInclude libdrm_* headers propertly
Stéphane Marchesin [Thu, 18 Sep 2014 21:42:42 +0000 (14:42 -0700)]
Include libdrm_* headers propertly

We don't want to use the misc. platform-specific libdrms, but we
still need the headers for the ioctl definitions and such. So let's
react to the GBM_* flags and use pkg-config to find the path to those
headers.

BUG=chromium:412508
TEST=emerge-daisy_freon minigbm

Change-Id: Ie8e1812fc0cebbc025d9c57a9032541c6a7e6da0
Reviewed-on: https://chromium-review.googlesource.com/219010
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoSupport pkg-config
Stéphane Marchesin [Fri, 19 Sep 2014 01:27:41 +0000 (18:27 -0700)]
Support pkg-config

Let's add pkg-config and install headers since this is needed for
ozone to build with a gbm platform.

BUG=chromium:394868,chromium:402597,chromium:413947,chromium:412508
TEST=emerge minigbm, then try pkg-config-board --libs --cflags. Rejoice that it works!

Change-Id: I94a26b1986db76e2d0dad638feda80ec10f48a9f
Reviewed-on: https://chromium-review.googlesource.com/218979
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoUse libdir from the ebuild
Stéphane Marchesin [Mon, 15 Sep 2014 22:38:37 +0000 (15:38 -0700)]
Use libdir from the ebuild

Instead of overriding with our own, let's use the libdir passed down
from the ebuild.

BUG=none
TEST=emerge minigbm

Change-Id: Ic38fd538add6d4c85e502b9dc0feeabaa8378e2e
Reviewed-on: https://chromium-review.googlesource.com/218978
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoFix type warning
Stéphane Marchesin [Mon, 15 Sep 2014 22:38:25 +0000 (15:38 -0700)]
Fix type warning

ARRAY_SIZE is unsigned, which leads to a warning. Let's fix this by
iterating with an unsigned.

BUG=none
TEST=emerge minigbm

Change-Id: I9b683d19d8ce5208bb4ec25d69292bbefcc4f91d
Reviewed-on: https://chromium-review.googlesource.com/218977
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoRemove test file
Stéphane Marchesin [Mon, 15 Sep 2014 22:38:15 +0000 (15:38 -0700)]
Remove test file

This isn't needed.

BUG=none
TEST=minigbm still builds

Change-Id: If82545066b6f1f5bea7d2fb03a24b72d07d0d791
Reviewed-on: https://chromium-review.googlesource.com/218976
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoImport minigbm
Stéphane Marchesin [Fri, 12 Sep 2014 23:18:59 +0000 (16:18 -0700)]
Import minigbm

Minigbm is a gbm implementation for a few DRM targets. Currently the
targets are:
- cirrus
- exynos
- gma500
- i915
- rockchip
- tegra
- udl

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

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

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: I36ae07f2a59827a807e19e1432891ca196b28803
Reviewed-on: https://chromium-review.googlesource.com/218030

9 years agoInitial empty repository
Aviv Keshet [Thu, 11 Sep 2014 20:53:55 +0000 (20:53 +0000)]
Initial empty repository