OSDN Git Service

android-x86/external-minigbm.git
7 years agominigbm: cros_gralloc: make HW_FB a no-op
Gurchetan Singh [Wed, 15 Mar 2017 22:14:56 +0000 (15:14 -0700)]
minigbm: cros_gralloc: make HW_FB a no-op

GRALLOC_USAGE_HW_FB is a legacy flag, and doesn't make
sense in our setup.

BUG=chromium:616275
TEST=compiles

Change-Id: If39634a12ad325b4d28afbd3db335e6ee9e287f6
Reviewed-on: https://chromium-review.googlesource.com/455282
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: rework flag API
Gurchetan Singh [Thu, 2 Mar 2017 04:14:39 +0000 (20:14 -0800)]
minigbm: rework flag API

We've been back and forth on the semantics of the flag API many
times, and the current situation is confusing.

Change the drivers so every combination defines a distinct type of
buffer. That means if the same format is in the combination list three
times, the tiling or format modifiers of one of those combinations must
be different from the other two.

Let's add a priority variable in struct supported_combination that
breaks ties. For example, if a consumer specifies BO_USE_TEXTURE,
we of course can texture from both linear and tiled buffers, but
because a tiled buffer's priority is greater, it will be chosen.

If a consumer specifies BO_USE_TEXTURE | BO_USE_SW_WRITE_OFTEN, the
tiled combination won't have the BO_USE_SW_WRITE_OFTEN flag and the
linear combination will be chosen.

We expect drivers to modify the combinations after querying KMS.
This is clunky using linked lists, so get rid of list.h and use arrays.

BUG=chromium:616275
TEST=all the following compiles:

emerge-cyan minigbm/arc-cros-gralloc
emerge-oak minigbm/arc-cros-gralloc
emerge-veyron_minnie-cheets minigbm/arc-cros-gralloc
emerge-peach_pi minigbm
emerge-nyan_big minigbm
emerge-jadeite minigbm

Tested with gbmtest on cyan, checked if Chrome boots

Change-Id: Ib3fccf6f0cb86c8ded45924297df3c06f8e49271
Reviewed-on: https://chromium-review.googlesource.com/448252
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: cros_gralloc: back out of scanout flag with more clarity
Gurchetan Singh [Thu, 9 Mar 2017 01:28:28 +0000 (17:28 -0800)]
minigbm: cros_gralloc: back out of scanout flag with more clarity

We interpret the following flags as GRALLOC_USAGE_HW_COMPOSER
as BO_USE_SCANOUT | BO_USE_RENDERING:

If the combination is not supported by the driver, let's check if
the gralloc flag is present before we back out for clarity.

BUG=chromium:616275
TEST=compiles

Change-Id: If546ce653f1088cbb1d31cf2f90aba0621ed8b4a
Reviewed-on: https://chromium-review.googlesource.com/451978
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 BO_USE_TEXTURE
Gurchetan Singh [Thu, 2 Mar 2017 17:48:49 +0000 (09:48 -0800)]
minigbm: add BO_USE_TEXTURE

Many people have requested re-adding BO_USE_TEXTURE as a flag
since:

BO_USE_RENDERING means the buffer will be used as a render target.
BO_USE_TEXTURE means the buffer will be textured from.

BUG=chromium:616275
TEST=minigbm/arc-cros-gralloc compiles

Change-Id: I63be6682cf4e2415dc42c78b2cab3ad694bcd818
Reviewed-on: https://chromium-review.googlesource.com/448251
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 support to build with Android.
Kalyan Kondapally [Sat, 4 Feb 2017 20:10:50 +0000 (12:10 -0800)]
Add support to build with Android.

BUG=None
TEST=Able to build Minigbm in a pure Android environment
     i.e. Android IA.

Change-Id: Ib12e8411b4ba42b8dd83974fc372bf4884ed6e41
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/448841
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: align first plane to 64 bytes
Gurchetan Singh [Wed, 8 Feb 2017 23:09:13 +0000 (15:09 -0800)]
minigbm: align first plane to 64 bytes

The chroma stride of Android YV12 buffers is required to be
aligned to 16 bytes (see <system/graphics.h>).

Additionally, the size of the ARM L1 cache line is 64-bytes
(see chrome-os-partner:45777).

Let's always align the first plane to 64 bytes. The chroma strides
will be aligned to 32 bytes in that case.

BUG=chromium:616275
TEST=

ImageReaderDecoderTest#testGoogH264ImageReader

passes on veyron_minnie-cheets.

Change-Id: I87a309ce0612bf8c5be8f8e47dad3da10d61a081
Reviewed-on: https://chromium-review.googlesource.com/441912
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agominigbm: add map_info to proper table
Gurchetan Singh [Mon, 13 Feb 2017 18:29:32 +0000 (10:29 -0800)]
minigbm: add map_info to proper table

The map_info data allocated drv_bo_map() should be added to the
map_table, not the buffer_table.

BUG=b:34580741, b:34528332
TEST=
android.uirendering.cts.testclasses.InfrastructureTests#testScreenshot

passes on Cyan.

Change-Id: I14a70df8fb174bc572ef3488f14c494808bab0e0
Reviewed-on: https://chromium-review.googlesource.com/441911
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agominigbm: rockchip: use height to calculate h_mbs
Gurchetan Singh [Mon, 23 Jan 2017 15:58:59 +0000 (07:58 -0800)]
minigbm: rockchip: use height to calculate h_mbs

The block height should be calculated from the height,
not the width.

BUG=none
TEST=none

Change-Id: Ica4bca0831c12a2594e16c06c42074592a8fd560
Reviewed-on: https://chromium-review.googlesource.com/441910
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
7 years agominigbm: Add VC4 backend
Niklas Schulze [Wed, 8 Feb 2017 14:29:21 +0000 (15:29 +0100)]
minigbm: Add VC4 backend

BUG=None
TEST=None

Change-Id: I6cece89a42ea41066cd8c4e2fc332898d5edb60a
Reviewed-on: https://chromium-review.googlesource.com/439448
Commit-Ready: Niklas Schulze <me@jns.io>
Tested-by: Niklas Schulze <me@jns.io>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agorockchip: Don't enable AFBC if width > 2560
Kristian H. Kristensen [Tue, 7 Feb 2017 06:16:55 +0000 (22:16 -0800)]
rockchip: Don't enable AFBC if width > 2560

BUG=chrome-os-partner:62585
TEST=Plug in monitor with native resolution over 2560 (eg 4k monitor)
and verify the output looks correct.

Change-Id: Iec925f54d74be19342d710313e5ac4ddca529e62
Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-on: https://chromium-review.googlesource.com/438831
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: support YV12 with frequent software access
Gurchetan Singh [Thu, 19 Jan 2017 18:43:44 +0000 (10:43 -0800)]
minigbm: support YV12 with frequent software access

android.media and android.mediastresss use this combination a lot.

BUG=b:34422476
TEST=run cts -c android.media.cts.AdaptivePlaybackTest -m testH263_adaptiveDrc
     passes on cyan

Change-Id: I906c601f24b8454ab98e7297ac663bfe85f55589
Reviewed-on: https://chromium-review.googlesource.com/430200
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agoamdgpu: Send correct flags to AMDGPU_GEM_CREATE
Akshu Agrawal [Mon, 9 Jan 2017 09:10:32 +0000 (14:40 +0530)]
amdgpu: Send correct flags to AMDGPU_GEM_CREATE

On the basis of gbm flags, send proper flags to AMDGPU_GEM_CREATE

BUG:chrome-os-partner:61504
TEST: With CL:418518 drm_cursor_test passess

Change-Id: Ia1c55a6494ceebe9446d68cdc2cd70eb5d290529
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/427482
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: i915: libdrm-ize backend
Gurchetan Singh [Tue, 3 Jan 2017 21:01:37 +0000 (13:01 -0800)]
minigbm: i915: libdrm-ize backend

With cros_gralloc enabled, the following three CTS tests fail with an i915
backend:

EncodeVirtualDisplayWithCompositionTest#testRendering800x480Locally
EncodeVirtualDisplayWithCompositionTest#testRenderingMaxResolutionRemotely
EncodeVirtualDisplayWithCompositionTest#testVirtualDisplayRecycles

The reason for the failures is the bo_map() function calls
DRM_IOCTL_I915_GEM_MMAP_GTT with untiled buffers, leading to
Surface::dequeueBuffer not completing in time.

In addition, we never set the domain when we map, which can lead to
cache coherency issues.

libdrm already has functions for regular and GTT mapppings, so let's just
add it here rather than duplicating the logic.

TEST=Chrome boots and container boots
     gbmtest, tiled_bo_test, all CTS tests specified in go/arc++gfx pass
BUG=chromium:616275
CQ-DEPEND=CL:424674

Change-Id: I68943367205abd3b470adb0597109fe30aa3e381
Reviewed-on: https://chromium-review.googlesource.com/424832
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: group helper functions
Gurchetan Singh [Tue, 3 Jan 2017 21:36:13 +0000 (13:36 -0800)]
minigbm: i915: group helper functions

Looks slightly better.

TEST=none
BUG=none

Change-Id: I9820e52e5360e2a6a9de26e1a84a1260311d2129
Reviewed-on: https://chromium-review.googlesource.com/424792
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 bo import callback
Gurchetan Singh [Wed, 4 Jan 2017 00:49:56 +0000 (16:49 -0800)]
minigbm: add bo import callback

Some drivers may want to import their own private data,
so let's add a driver callback.

BUG=none
TEST=minigbm builds, gbmtest

Change-Id: I96c06a84446c9be4ac3f5f858094c500d43a077f
Reviewed-on: https://chromium-review.googlesource.com/424934
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: amdgpu: Add mmap implementation for amdgpu
Pratik Vishwakarma [Mon, 12 Dec 2016 08:52:10 +0000 (14:22 +0530)]
minigbm: amdgpu: Add mmap implementation for amdgpu

BUG=chrome-os-partner:61504
TEST=graphics_Gbm

Change-Id: I4ad23fa5b55a249e75ec44fe499c499052f687e0
Reviewed-on: https://chromium-review.googlesource.com/418425
Commit-Ready: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
Tested-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: cros_gralloc: don't fail BO_USE_SW_*_OFTEN | BO_USE_RENDERING allocation
Gurchetan Singh [Tue, 27 Dec 2016 18:25:18 +0000 (10:25 -0800)]
minigbm: cros_gralloc: don't fail BO_USE_SW_*_OFTEN | BO_USE_RENDERING allocation

Some camera CTS tests pass down the following usage:

GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_WRITE_OFTEN,

which we convert. Since we generally want to create a tiled buffer when
GRALLOC_USAGE_HW_TEXTURE is specified and tiled buffers are inefficient for
frequent software access, many drivers don't support this combination.

When this occurs, let's drop the BO_USE_RENDERING flag and try the allocation again
with different flags.

BUG=chromium:616275
TEST=run cts --disable-reboot --class android.hardware.camera2.cts.MultiViewTest
passes on kevin

Change-Id: Id3364edb849fe92d4710c765ed664e8aa4a4738d
Reviewed-on: https://chromium-review.googlesource.com/424318
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agorockchip: Add support for AFBC buffers
Kristian H. Kristensen [Tue, 6 Sep 2016 18:43:26 +0000 (11:43 -0700)]
rockchip: Add support for AFBC buffers

This adds support for allocating AFBC (ARM FrameBuffer Compression)
buffers with minigbm for Rockchip SoCs. AFBC buffers are allocated
through the new gbm_bo_create_with_modifiers() entry point. Callers are
responsible for determining which modifiers are valid for the intended
use case and pass in that list. gbm will then pick the optimal modifier
and allocate a buffer with that layout.  The chosen modifier can be
queries through gbm_bo_get_format_modifier().

Callers of the new entry point are expected to forward the modifier when
using the buffer with other APIs (EGL, KMS etc). The old gbm_bo_create()
entry point continues to work as before and won't allocate AFBC buffers.

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

Change-Id: I1aa345b0d79c4545b7bfc17e9699ef6ad57c68e2
Reviewed-on: https://chromium-review.googlesource.com/386318
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: fix size_t type not found
Heng-Ruey Hsu [Wed, 21 Dec 2016 05:59:20 +0000 (13:59 +0800)]
minigbm: fix size_t type not found

BUG=b:24674340
TEST=build pass on kevin

Change-Id: Idd780ee5e99e864ed0f97503e7b38673761201e8
Reviewed-on: https://chromium-review.googlesource.com/422808
Commit-Ready: Heng-ruey Hsu <henryhsu@chromium.org>
Tested-by: Heng-ruey Hsu <henryhsu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: consolidate flags
Gurchetan Singh [Mon, 19 Dec 2016 23:14:18 +0000 (15:14 -0800)]
minigbm: consolidate flags

Let's try to organize the flags such that one entry in the supported
combination list implies a certain type of buffer. For example, we only
create linear buffers in our Mediatek, so the following entries are
equivalent:

{DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY},

{DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE,
BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN |
BO_USE_SW_WRITE_OFTEN},

Since they both translate into a XRGB8888 linear buffer on Mediatek, let's merge
the two entries. Do similiar operations for every driver.

BUG=none
TEST=try-bots

Change-Id: I0be97c2deec5310f426632f85d1525a1345498e6
Reviewed-on: https://chromium-review.googlesource.com/421499
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: tegra: add blocklinear detiling logic
Gurchetan Singh [Wed, 14 Dec 2016 16:51:28 +0000 (08:51 -0800)]
minigbm: tegra: add blocklinear detiling logic

With CL:397941, hshi@ figured out how to detile blocklinear buffers
for tegra. Let's add that logic to our tegra map()/unmap() functions.
This can be useful for various tests.

BUG=chromium:673570
TEST=tiled_bo_test draws ellipse texture on Tegra (there are artifacts
     due another bug though)

Change-Id: I7c2e7222ba67457ffd3641ba42a775ac4a667ec8
Reviewed-on: https://chromium-review.googlesource.com/421279
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
7 years agominigbm: Remove (c) from copyright notice.
Daniele Castagna [Fri, 16 Dec 2016 22:32:30 +0000 (17:32 -0500)]
minigbm: Remove (c) from copyright notice.

The pre-submit hook script checks that copyright messages don't
contain "(c)".

This CL removes "(c)" from all the copyrights header in minigbm
that still have it.

BUG=None
TEST=emerge-$BOARD minigbm.

Change-Id: I1922d9d29b78d124302d497310fe1c1cfd6fc695
Reviewed-on: https://chromium-review.googlesource.com/421588
Commit-Ready: David Reveman <reveman@chromium.org>
Commit-Ready: Daniele Castagna <dcastagna@chromium.org>
Tested-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: Add dumb buffer 'nouveau' backend.
Daniele Castagna [Fri, 16 Dec 2016 21:24:06 +0000 (16:24 -0500)]
minigbm: Add dumb buffer 'nouveau' backend.

Adding a nouveau backend to minigbm can be useful to test ozone code
on our workstations.

This CL adds a nouveau backend that uses dumb buffers.
This is enough to run ozone_gl_unittests and ozone_demo on our
workstations.

BUG=None
TEST='Ran ozone_demo on my workstation.'

Change-Id: I4e690192c9d9944b9907e64253205a94605a76eb
Reviewed-on: https://chromium-review.googlesource.com/421606
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: tegra: align linear buffers to 64-byte boundaries
Gurchetan Singh [Fri, 16 Dec 2016 23:51:46 +0000 (15:51 -0800)]
minigbm: tegra: align linear buffers to 64-byte boundaries

Tegra20 and Tegra30 both required the buffer line stride to be aligned
on 8 byte boundaries. Tegra114 and Tegra124 increased the alignment to
64 bytes.

The kernel automatically does this for us for dumb buffers, but since the
tegra gem create API doesn't return the stride, we'll have to do it here.

BUG=chromium:673570
TEST=tiled_bo_test succeeds

Change-Id: I2222f033813a31d3eed1a6794fbf044fba33eec0
Reviewed-on: https://chromium-review.googlesource.com/421278
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
7 years agominigbm: Move c99 flag from CPPFLAGS to CFLAGS
Stéphane Marchesin [Tue, 29 Nov 2016 23:22:04 +0000 (15:22 -0800)]
minigbm: Move c99 flag from CPPFLAGS to CFLAGS

It has nothing to do with the preprocessor.

BUG=none
TEST=builds

Change-Id: Ib5c851b0127d36bf52cce1e5c81cfed0eb3b541d
Reviewed-on: https://chromium-review.googlesource.com/415112
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agominigbm: add width and height in dumb create
Gurchetan Singh [Tue, 6 Dec 2016 23:43:17 +0000 (15:43 -0800)]
minigbm: add width and height in dumb create

We never set the width and height in drv_dumb_bo_create.
We really should do this.

TEST=none
BUG=none

Change-Id: I630866bcf5086fbb3679f772fe0f2857d37f22c2
Reviewed-on: https://chromium-review.googlesource.com/417164
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: cros_gralloc: remove unnecessary information from handle
Gurchetan Singh [Mon, 5 Dec 2016 19:02:55 +0000 (11:02 -0800)]
minigbm: cros_gralloc: remove unnecessary information from handle

Only include information needed to import in the handle. We
were previously including the address space of another process in
the handle, which is a potential security risk.

BUG=chromium:616275
TEST=arc-cros-gralloc works on oak, minnie, cyan
CQ-DEPEND=CL:416399

Change-Id: I10230053e305865db0dde26a596403ec0b9e4f4c
Reviewed-on: https://chromium-review.googlesource.com/416400
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: cros_gralloc: Don't build gbm
Gurchetan Singh [Mon, 5 Dec 2016 17:47:45 +0000 (09:47 -0800)]
minigbm: cros_gralloc: Don't build gbm

Reduces binary size by 4.5 KB.

BUG=chromium:616275
TEST=arc-cros-gralloc builds
CQ-DEPEND=CL:416398

Change-Id: I0d73373657076ce540726225993e1b6c5bb12ae2
Reviewed-on: https://chromium-review.googlesource.com/416399
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: cros_gralloc: modify error statements
Gurchetan Singh [Sat, 3 Dec 2016 02:28:38 +0000 (18:28 -0800)]
minigbm: cros_gralloc: modify error statements

The error statements now look like what's printed in
Chrome's /var/log/ui/ui.LATEST, which I think looks nice.

BUG=chromium:616275
TEST=None
CQ-DEPEND=CL:416397

Change-Id: Ide3eb381ac710f016e9d002e4dd5f9e5ab8eda7f
Reviewed-on: https://chromium-review.googlesource.com/416398
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: cros_gralloc: fix rendernode query
Gurchetan Singh [Sat, 3 Dec 2016 02:15:35 +0000 (18:15 -0800)]
minigbm: cros_gralloc: fix rendernode query

If the vgem driver and a hardware driver are both present on
a machine, and if the vgem driver corresponds to a lower
number rendernode, we'll end up picking the vgem driver. This is
not the desired behavior, so let's fix it.

BUG=chromium:616275
TEST=mediatek driver loads
CQ-DEPEND=CL:416396

Change-Id: Ib2647f4dbaf3c45fab97bbbcbb94e09c1daa6d5d
Reviewed-on: https://chromium-review.googlesource.com/416397
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 support HAL_PIXEL_FORMAT_YV12
Gurchetan Singh [Sat, 3 Dec 2016 01:54:09 +0000 (17:54 -0800)]
minigbm: mediatek: add support HAL_PIXEL_FORMAT_YV12

For some reason, we use HAL_PIXEL_FORMAT_YV12 instead of
HAL_PIXEL_FORMAT_YCbCr_420_888 as our YUV format on mediatek
based boards. We also pass down a different use flags. Since
mediatek only supports linear buffers the moment, just lump all
the flags together for our YUV supported combination.

BUG=chromium:616275
TEST=Played Youtube video in Oak ARC++ container
CQ-DEPEND=CL:416292

Change-Id: Iac4797517048981235cd17ad464eb1e3852c4072
Reviewed-on: https://chromium-review.googlesource.com/416396
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: 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>