Commit graph

43 commits

Author SHA1 Message Date
Gurchetan Singh
1b1d56ae40 minigbm: add clang-format and presubmit hooks
Running the presubmit.sh script will apply our rules to every file in
the repo. Exclude gbm.h from the formatting requirements since this file
was taken from other open-source projects, and diffing will be easier
without our formatting rules.

In addition, special case drivers where the order of includes matters.

BUG=none
TEST=Verified the following commands succeed:

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

Change-Id: I6ce93fb1930da254d13d5017766c17341870ccc9
Reviewed-on: https://chromium-review.googlesource.com/447319
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-03-31 10:40:27 -07:00
Gurchetan Singh
4c3aa42a52 minigbm: rockchip: align to 128 bytes
cmemp_heap_partition in the mali driver checks if every plane is
64-byte aligned. Since we expose a fd for every plane in the
cros gralloc handle, we hit this case. We need to enforce this
alignment on our YV12 allocations.

BUG=chromium:616275
TEST=
android.media.cts.VideoEncoderTest#testGoogH264FlexArbitraryH

passes on veyron_minnie-cheets.

Change-Id: If6375eddd18fd216e7f07eb2cc47090d838f82ab
Reviewed-on: https://chromium-review.googlesource.com/459104
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-03-30 21:21:54 -07:00
Gurchetan Singh
6423ecbeca minigbm: work with strides, not widths
When doing alignment, many times we get the bytes per pixel, try
to align to a certain boundary, and then pass in the "aligned width"
to drv_bo_from_format. This back and forth is confusing and error
prone. Let's change our drivers and helpers to eliminate this, and
try to work in strides as soon as possible.

Additionally, let's make drv_bpp_from_format a static function. This
is because bits per pixel is ill-defined for YUV formats, and we should
work in strides whenever possible.

BUG=none
TEST=graphics_Gbm runs successfully on Cyan, ui boots

Change-Id: I207ce6fd5eaac472b7b82f0d952b46697e325498
Reviewed-on: https://chromium-review.googlesource.com/462479
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-03-30 21:21:54 -07:00
Gurchetan Singh
75372ca5bc minigbm: rockchip: add NV12 back in as supported format
CL:448252 inadvertently removed this format.

BUG=none
TEST=play video via Youtube app

Change-Id: Ia57c66ffdd6f9ebb401c09dab5ea82eba2fe1893
Reviewed-on: https://chromium-review.googlesource.com/457756
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-03-22 11:46:48 -07:00
Gurchetan Singh
03f13569ec minigbm: add DRM_FORMAT_YVU420_ANDROID
YV12 in <system/graphics.h> in the Android tree defines the
HAL_PIXEL_FORMAT_YV12 as:

     * y_size = stride * height
     * c_stride = ALIGN(stride/2, 16)
     * c_size = c_stride * height/2
     * size = y_size + c_size * 2
     * cr_offset = y_size
     * cb_offset = y_size + c_size

Let's add a special format DRM_FORMAT_YVU420_ANDROID that adheres to these
requirements.

Previously, our y_size on Intel not adhere to the spec. We should
change drv_bo_from_format to calculate the size of plane not based on the
aligned height, but the height that outside world sees.

BUG=chromium:616275
TEST=
ImageReaderDecoderTest#testGoogH264ImageReader

passes on cyan. Run YT app.

Change-Id: I4906300a0775cf561c4b05bf6d973cf4e82470bc
Reviewed-on: https://chromium-review.googlesource.com/441913
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-03-20 19:30:09 -07:00
Gurchetan Singh
6b41fb55de 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>
2017-03-16 11:25:47 -07:00
Gurchetan Singh
6ea14bad3f 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>
2017-02-18 00:39:28 -08:00
Gurchetan Singh
d3fbe5b50a 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>
2017-02-14 14:50:35 -08:00
Kristian H. Kristensen
d1ae0ffe89 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>
2017-02-08 16:24:40 -08:00
Gurchetan Singh
b016ffb902 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>
2017-01-20 00:05:13 -08:00
Gurchetan Singh
71611d63fe 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>
2017-01-13 01:19:06 -08:00
Kristian H. Kristensen
b1efbd8d16 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>
2016-12-21 22:24:10 -08:00
Daniele Castagna
7a755de4f3 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>
2016-12-17 19:33:05 -08:00
Gurchetan Singh
458976feb1 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>
2016-12-07 13:02:04 -08:00
Gurchetan Singh
179687e4eb 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>
2016-12-01 00:50:54 -08:00
Gurchetan Singh
f3b22da397 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>
2016-11-28 23:59:30 -08:00
Gurchetan Singh
c746dca555 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>
2016-11-21 20:46:48 +00:00
Gurchetan Singh
3001b29507 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>
2016-10-20 23:22:50 -07:00
Gurchetan Singh
3d5a9b4666 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>
2016-10-18 13:40:16 -07:00
Gurchetan Singh
10a1180108 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>
2016-10-17 21:55:52 -07:00
Gurchetan Singh
56662da3d0 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>
2016-10-17 12:54:58 -07:00
Gurchetan Singh
1a31e60977 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>
2016-10-13 04:32:23 -07:00
Gurchetan Singh
a40ca9e446 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>
2016-09-02 21:16:59 -07:00
Gurchetan Singh
42cc6d6c2a 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>
2016-09-02 07:11:27 -07:00
Gurchetan Singh
d6fb577715 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>
2016-09-02 04:26:05 -07:00
Daniele Castagna
ac50d6472c 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>
2016-08-25 01:45:50 -07:00
Gurchetan Singh
83dc4fb6e4 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>
2016-08-25 01:44:57 -07:00
Gurchetan Singh
bfba8c2697 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>
2016-08-22 14:52:30 -07:00
Gurchetan Singh
d7c84fd88f 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>
2016-08-17 19:15:52 -07:00
Gurchetan Singh
ef92053608 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>
2016-08-17 19:15:51 -07:00
Gurchetan Singh
46faf6bf43 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>
2016-08-12 22:44:40 -07:00
Gurchetan Singh
f64487b096 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>
2016-07-18 17:32:55 -07:00
Zach Reizner
58080dfa64 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>
2016-05-11 16:51:59 -07:00
Dongseong Hwang
9d3d760d99 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>
2016-05-06 03:15:32 -07:00
Stéphane Marchesin
ed475b4e6e 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>
2016-02-29 14:19:28 -08:00
Zach Reizner
1e22939922 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>
2016-02-27 03:25:52 -08:00
Yuly Novikov
96c7a3bf4c 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>
2016-01-23 06:40:51 -08:00
David Reveman
8d13cd76bb 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>
2015-12-22 13:12:35 -08:00
Stéphane Marchesin
ec88e89de8 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>
2015-11-09 12:49:31 -08:00
Ilja H. Friedel
f9d2ab79a1 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>
2015-04-10 05:48:04 +00:00
Dominik Behr
e13ac28b5a 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>
2015-01-13 21:58:41 +00:00
Daniel Nicoara
1de26dc73c 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>
2014-09-26 03:24:00 +00:00
Stéphane Marchesin
25a2606a25 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
2014-09-13 01:34:56 +00:00