Commit graph

152 commits

Author SHA1 Message Date
Alistair Strachan
f8de45da7b Add OWNERS and METADATA.
Along with the licensing files required by AOSP.

Bug: 77276633
Change-Id: I9b8d8d2f32658750696c453d439a168af2b7f7fb
Signed-off-by: Alistair Strachan <astrachan@google.com>
2018-06-25 14:40:05 -07:00
Casey Dahlin
721abfd9a6 Merge remote-tracking branch 'aosp/upstream-master' into HEAD
Test: None
Bug: 37224300
Change-Id: Ie84cf493bacb6afe0eb1e647cb8d1b20fe92edd0
2017-06-12 19:26:20 -07:00
kuantung
69c8992400 Initial empty repository 2017-06-08 11:59:40 -07:00
Shirish S
df423df7f8 minigbm: amdgpu: enable handling of NV12 & NV21 format
This patch does the below:
1. Adds DRM_FORMAT_NV12 & DRM_FORMAT_NV21
   to the list of formats supported by amdgpu driver
2. bo_create() updates parameter's of video planes
   appropriately.
3. add DRM_FORMAT_NV21 in drv.c & helpers.c

This patch is a step towards enabling overlay based video rendering
capability available in hardware.

BUG=b:37526302
TEST=emerge-kahlee media-libs/minigbm
TEST=Boots to UI on jadeite & kahlee
TEST=With all the changes in kernel(not upstreamed) execute below:
     plane_test --format AR24 --size 500x50 -p --format NV12 --size 500x500
     plane_test --format AR24 --size 500x50 -p --format NV12 --size 1280x720
     plane_test --format AR24 --size 500x50 -p --format NV12 --size 1366x768
     plane_test --format AR24 --size 500x50 -p --format NV21 --size 1366x768
TEST=displays same colored layers on video and RGB plane.

Change-Id: If75a4586b636b600a5b4b2d909f10bcf03613cc2
Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/479043
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-06-05 13:01:47 -07:00
Gurchetan Singh
989873c44c minigbm: cros_gralloc: fix incorrect handle calculations
We were including native handle size in our numInts calculations.
Fix this.

BUG=b:62060380
TEST=gralloc related ASAN errors go away

Change-Id: I9ae66655f9e40d82a9cd3fe91ddca9f300fda911
Reviewed-on: https://chromium-review.googlesource.com/517279
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Luis Hector Chavez <lhchavez@chromium.org>
2017-05-31 02:15:28 -07:00
Gurchetan Singh
8ac0c9a955 minigbm: remove BO_USE_RENDERING from certain formats
We can't use GR88, R8, YV12, NV12, UYVY, YUYV buffers as render
targets, so let's remove the BO_USE_RENDERING flag from these
formats. However, we can sample from these formats (though this
feature still needs to be enabled in our drivers), so the
BO_USE_TEXTURE flag remains set.

Also, change our interpretation of the GRALLOC_USAGE_HW_COMPOSER
flag such that it implies BO_USE_SCANOUT | BO_USE_TEXTURE. This
is because the OpenGL fallback textures from the buffer if
can't be scanned-out, not renders to it.

BUG=none
TEST=run Youtube app on Kevin

Change-Id: I9ea8452279e110bc1a9579f162abe1c72192eb40
Reviewed-on: https://chromium-review.googlesource.com/506812
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-23 23:59:12 -07:00
Daniel Kurtz
de558ae8a2 minigbm: cros_gralloc: Do not lock gralloc_close
cros_gralloc implements Gralloc Module API 0.2.  Android framework's
libui uses a Gralloc1On0Adapter adapter on top of gralloc modules < 1.0.

The Gralloc1On0Adapter is a singleton object that calls gralloc_close in
its destructor.  cros_gralloc implements gralloc_close() as
cros_gralloc_close().

In other words cros_gralloc_close() is called at process exit during
__cxa_finalize, which is not a safe place to do std::mutex operations.
In fact, the lock_guard() sometimes hangs while trying to aquire the
lock resulting in a non-responsive app.

Fix this by removing the lock_guard in cros_gralloc_close().

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

BUG=b/38016927
TEST=Use cherry to run 1 dEQP test.
 => No anr crash after 30 seconds in com.drawelements.deqp:testercore

Change-Id: I469516b8b3a7d8ac6b89e571f137935f097c9af9
Reviewed-on: https://chromium-review.googlesource.com/504429
Commit-Ready: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-20 20:47:11 -07:00
Gurchetan Singh
cb1471bc69 minigbm: fix typo in PRESUBMIT.cfg
Now clang-format will be run everytime a committer runs repo upload
with the --no-verify option. The committer will have to resolve
differences, i.e:

1) add clang-format off / clang-format on.
2) change files such that clang-format does not complain.

Since our version of clang-format was updated (in the LLVM ebuild), I had to
resolve a few conflicts in rockchip.c and tegra.c.

BUG=none
TEST=none

Change-Id: Ia32d3c47243957f2d674f142bda9daf7917aab0b
Reviewed-on: https://chromium-review.googlesource.com/506508
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-20 03:55:21 -07:00
Tomasz Figa
51de1f529f minigbm: cros_gralloc: Use pkg-config for LIBS
This changes the Makefile to use pkg-config to query for necessary
library paths and names instead of hardcoding -ldrm.

BUG=b:36540057
TEST=emerge-reef arc-cros-gralloc with multilib patches
CQ-DEPEND=CL:505794

Change-Id: Id223203506d71b3966e9730f92badb461eb6cb1b
Reviewed-on: https://chromium-review.googlesource.com/499971
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Luis Hector Chavez <lhchavez@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-05-19 13:57:42 -07:00
Luis Hector Chavez
5272e812b5 minigbm: cros_gralloc: Use pkg-config
This change uses pkg-config to find the libdrm headers instead of
relying on the arc-toolchain sysroot.

BUG=b:26864637
TEST=reef compiles, surfaceflinger is happy
CQ-DEPEND=CL:494886

Change-Id: Ic6142424ff5593ab5552dd61b8ae4b7dc38497fc
Reviewed-on: https://chromium-review.googlesource.com/495267
Commit-Ready: Luis Hector Chavez <lhchavez@chromium.org>
Tested-by: Luis Hector Chavez <lhchavez@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-08 12:40:51 -07:00
Heng-Ruey Hsu
f4b7b8da0d Add HAL_PIXEL_FORMAT_BLOB format in cros gralloc
We convert HAL_PIXEL_FORMAT_BLOB to DRM_FORMAT_R8 for camera picture
taking. Choose DRM_FORMAT_R8 because <system/graphics.h> requires the
buffers with a format HAL_PIXEL_FORMAT_BLOB have a height of 1, and
width equal to their size in bytes.

BUG=b:37692495
TEST=open camera app and take a picture.

Change-Id: I11a82b057b7c1174dd946e0b7d3cbde9c1d630d9
Reviewed-on: https://chromium-review.googlesource.com/487552
Commit-Ready: Heng-ruey Hsu <henryhsu@google.com>
Tested-by: Heng-ruey Hsu <henryhsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-02 22:50:31 -07:00
Gurchetan Singh
68af9c2b9e minigbm: i915: use explicit cache flush to maintain coherency
The Intel last level cache (LLC) acts a coherency controller on
hardware that has it. Use I915_PARAM_HAS_LLC to determine if the
hardware has LLC.

We can maintain coherency by doing a clflush on non-LLC platforms, like the
Vulkan driver in Mesa does.

BUG=none
TEST=gbmtest on Cyan, Chrome boots, Android boots, mmap_test -g, 5-10 CTS
tests. No regressions.

CQ-DEPEND=CL:425716

Change-Id: I054e69c23016cd3336c2de1d07b49bb2c3709389
Reviewed-on: https://chromium-review.googlesource.com/454105
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-05-01 12:20:01 -07:00
Gurchetan Singh
fcad5ad553 minigbm: i915: use DRM_IOCTL_I915_GEM_MMAP when needed
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.

Note the final form of unmap will be a clfush.

BUG=none
TEST=The 3 CTS tests pass.
CQ-DEPEND=CL:454104

Change-Id: I60826d0006da345eceb89f26543e1cc436bbf312
Reviewed-on: https://chromium-review.googlesource.com/425716
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-05-01 12:20:01 -07:00
Gurchetan Singh
cc015e8b84 Revert "minigbm: i915: libdrm-ize backend"
As per offline discussion, libdrm_intel doesn't maintain cache coherency
correctly for a number of edge cases.

The plan is to:

1) Revert the libdrm CL.
2) Use simpler mmap/unmap logic to deal CTS failures.
3) Use explicit flush to deal with coherency.

CQ-DEPEND=CL:454105

This reverts commit 82a8eedaa5.
Conflicts: i915.c

Change-Id: I6c0bf746b71ea08f5cf4f1aa80d17d28b26ec4c6
Reviewed-on: https://chromium-review.googlesource.com/454104
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Dominik Behr <dbehr@chromium.org>
2017-05-01 12:20:01 -07:00
Tomasz Figa
606408e81a minigbm: cros_gralloc: Fix type mismatch on 64-bit builds
For some reason GCC does not like using %llu print format for uint64_t, which
maps to unsigned long on Linux x86_64. However on Linux i386 unsigned
long is a 32-bit type and uint64_t maps effectively to unsigned long
long and we need to use %llu. To work this around, simply cast the value
to unsigned long long.

BUG=b:36540057
TEST=emerge-reef arc-cros-gralloc with multilib patches applied

Change-Id: Ic585d40d690346babc280a04111fc8aedf8a30cd
Reviewed-on: https://chromium-review.googlesource.com/487766
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-04-27 11:15:44 -07:00
Casey Dahlin
5479366c11 minigbm: Add a LICENSE file
Minigbm is under the Chromium OS LICENSE

TEST=None
BUG=None

Change-Id: Iec28c6f793b40867d01c2b445d8f94ba4a2a2e04
Reviewed-on: https://chromium-review.googlesource.com/482408
Commit-Ready: Casey Dahlin <sadmac@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-04-21 21:57:32 -07:00
Gurchetan Singh
e2b3a0605a minigbm: virtio-gpu: add more supported formats
There is a desire to use virtio-gpu + Android with kernel v4.4. Let's
make it like the vgem backend, which aligns widths and heights to
64-pixel boundaries to support LLVM requirements.

BUG=chromium:616275
TEST=no crashes when running Android with amd64-generic-cheets

Change-Id: I5640a0f9cc84260d30eecddd84307170fa41d2ce
Reviewed-on: https://chromium-review.googlesource.com/471879
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-04-12 20:22:38 -07:00
Gurchetan Singh
e4727d60b4 minigbm: disable default Chromium style checks
Adding these hook overrides disables all of the default ChromiumOS
source style checks. This way repo upload . should just run
our presubmit script.

BUG=none
TEST=none

Change-Id: I18803f5a94ef4c17043dcb12c817e8cf78b64d66
Reviewed-on: https://chromium-review.googlesource.com/467646
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-04-04 16:27:24 -07:00
Gurchetan Singh
2de66f78ea minigbm: vgem: add more supported formats
The VM-tests in the Android PFQ require this now.

BUG=chromium:616275
TEST=-cheets_CTSHelper.smoke doesn't crash in a VM

Change-Id: Icd062210852810036ab349af10b350507e1b560b
Reviewed-on: https://chromium-review.googlesource.com/467626
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-04-04 14:08:14 -07:00
Gurchetan Singh
f1afe32a3d minigbm: cros_gralloc: fix modifier serialization/de-serialization
We were only filling up the first five entries of the modifier array
in the handle, and we were doing it incorrectly. Fix this.

BUG=chromium:616275
TEST=compiles

Change-Id: I435f88db1b16af919081122a502cbe7d7fc9e3d9
Reviewed-on: https://chromium-review.googlesource.com/457289
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-03-31 10:40:28 -07:00
Gurchetan Singh
b7538e29a4 minigbm: cros_gralloc: remove constexpr functions
There's no reason to have these as functions. Also eliminate
sw_write() and sw_read(), the only reason I added them because
I was hitting the 80 column limit (we're 100 columns wide now).

BUG=chromium:616275
TEST=compiles

Change-Id: If0d406df64dc760f2c007eeecf79874c1deb3ec7
Reviewed-on: https://chromium-review.googlesource.com/457288
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:28 -07:00
Gurchetan Singh
eb86a70aa5 minigbm: cros_gralloc: remove memsets
The C++ standard says value initialization results in
zero initialization for structs, so our memsets are
unecessary.

BUG=chromium:616275
TEST=compiles

Change-Id: I1744b237790cb79d2a8be92beffdb2ee9829f4e2
Reviewed-on: https://chromium-review.googlesource.com/457287
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>
2017-03-31 10:40:28 -07:00
Gurchetan Singh
085bff124f minigbm: fix long lines missed by clang-format
We have 100-lines to work with now.

BUG=none
TEST=compiles

Change-Id: I08f41a42d8841ac82c5a6defbcbc712722179fce
Reviewed-on: https://chromium-review.googlesource.com/457286
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
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
4f298f9fd2 minigbm: add bytes per pixel function
We were using the drv_stride_from_format as a shorthand to calculate
bytes per pixel. This is incorrect with the addition of
DRM_FORMAT_YVU420_ANDROID, which always aligns to 16 bytes.

Let's have a separate bytes_per_pixel function to better express what
we want.

BUG=chromium:616275
TEST=android.media.cts.DecodeAccuracyTest
     #testVP9GLViewLargerHeightVideoDecode

passes on veyron_minnie-cheets.

Change-Id: I2d740828d66031c3a032932c09d79dbce21b8986
Reviewed-on: https://chromium-review.googlesource.com/458978
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 00:15:53 -07:00
Gurchetan Singh
102dcb88f9 minigbm: fix stride logic
We shouldn't round up to the nearest byte. This way we can represent
formats like Y41P.  Makes no difference currently since
drv_bpp_from_format only returns numbers divisible by eight.

Change-Id: I57bcab383f1661ea11e9aa1d30e18750574143e2
Reviewed-on: https://chromium-review.googlesource.com/462478
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-03-29 20:48:33 -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
d5f8e44e19 vgem: support DRM_FORMAT_YVU420_ANDROID
drv_dumb_bo_create function only allocates single-plane formats at the
moment, even though the vgem driver has a resolve format hook that
leads to DRM_FORMAT_YVU420_ANDROID. Let's allocate a single buffer
that's big enough to support DRM_FORMAT_YVU420_ANDROID, as drm_gralloc
does. Note videos don't work with Android emulation, but they never
did with drm_gralloc and that's a separate problem.

BUG=chromium:616275
TEST=no regressions with gbmtest when running qemu + trybots

Change-Id: I9b081dbe553fe1159feaa7eed104ac340c59e41b
Reviewed-on: https://chromium-review.googlesource.com/456404
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-03-21 16:47:39 -07:00
Gurchetan Singh
507f5ddba2 minigbm: i915: align YV12 to HW requirements
As per drm_gralloc we need to:

 (1) align the Y plane to 128 bytes so the chroma planes would be
     aligned to 64 bytes boundaries.
 (2) Have no tiling with YV12.

BUG=chromium:616275
TEST=DecodeEditEncodeTest#testVideoEdit720p

passes on cyan. Run YT app.

Change-Id: I339163c94d4481991702b8bfd232a70f3a275506
Reviewed-on: https://chromium-review.googlesource.com/456403
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
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
80fc2b9ed9 minigbm: deal with ArcCodec use case by exposing struct map_info
Let's keep a count of how many times a buffer has been locked, since
we have special lock_ycbcr() behavior that returns the offsets and
strides of a YUV buffer when an usage of zero is passed in. This behavior
is used by the ArcCodec. We have to take care not to call drv_bo_unmap
if we didn't map anything.

We also have to expose struct map_info so we can return the address if
we have mapped data, rather than incrementing the drv map count.

Additionally, the gralloc.h says:

"THREADING CONSIDERATIONS
It is legal for several different threads to lock a buffer from
read access, none of the threads are blocked."

This implies recursive locking, which this commit implements.

BUG=b:34419220
TEST=
android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual0320x0240

Change-Id: Ibbe7dd5349594117aaaecca9647ad45264448575
Reviewed-on: https://chromium-review.googlesource.com/442835
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-03-18 00:32:51 -07:00
Gurchetan Singh
e02b8e4237 minigbm: fix renderscipt allocation
A few CTS tests are failing due to incompatible usage flags.
Specifically, these combinations are passed in:

{ format: HAL_PIXEL_FORMAT_YCbCr_420_888,
  HAL flags: GRALLOC_USAGE_RENDERSCRIPT |
	     GRALLOC_USAGE_SW_READ_OFTEN |
	     GRALLOC_USAGE_SW_WRITE_OFTEN }

Let's set the renderscript flag to BO_USE_LINEAR since in our
case renderscript code is executed on the CPU.
Change drivers to make sure linear flags are available.

BUG=b:34422476
TEST=

run cts --package android.security
run cts -m CtsRenderscriptTestCases --skip-device-info
run cts --package android.widget

don't crash due to createGraphicBuffer failures.

Change-Id: I47a97118ae5b6a732e6d5c1f090aa7c3a7cc95a5
Reviewed-on: https://chromium-review.googlesource.com/441915
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 22:28:23 -07:00
Gurchetan Singh
de3284909f 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>
2017-03-16 11:25:47 -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
4d22b4e285 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>
2017-03-16 11:25:47 -07:00
Gurchetan Singh
2a30f8a988 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>
2017-03-08 22:27:41 -08:00
Kalyan Kondapally
bc7dc78e79 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>
2017-03-06 16:28:33 -08: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
7831b04a2d 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>
2017-02-14 14:50:35 -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
Niklas Schulze
878fed4088 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>
2017-02-08 20:31:54 -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
Akshu Agrawal
42e5bc0c83 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>
2017-01-19 02:43:15 -08:00
Gurchetan Singh
82a8eedaa5 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>
2017-01-13 01:19:09 -08:00
Gurchetan Singh
3eb8d8fdba 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>
2017-01-13 01:19:07 -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
Pratik Vishwakarma
bc1b535fde 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>
2017-01-11 04:07:16 -08:00