summaryrefslogtreecommitdiffstats
path: root/cros_gralloc/gralloc0
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'aosp/upstream-master' into HEADJason Macnak2020-09-181-0/+23
|\ | | | | | | | | | | | | | | | | | | ... to update Minigbm for Cuttlefish to have Gralloc3 and Gralloc4 support. Bug: b/161909468 Test: launch_cvd Merged-In: I27f020b4f661890bcc2817deb09ffb9af1c76f1b Change-Id: I11e31543d3298c2cac67d80e77058d7cd95907db
| * cros_gralloc: Add new perform op for getting buffer infoKristian H. Kristensen2020-08-181-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This perform op gives us all the underlying info about the BO, which lets us import multiplane BOs (such as Intel compressed BOs). This eliminates a lot of guessing and fudging in EGL and wayland_service when trying to determine this info from the Android handle. This generalizes the GET_MODIFIER op, which nothing was using yet. BUG=b:145579089, b:79682290. b:163562363 TEST=arc++ apps using non-linear format layouts Change-Id: I821e14477d35794b7247fab59649f564e8ff6985 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2353750 Reviewed-by: Jason Macnak <natsu@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org> Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
| * cros_gralloc: Add perform action for getting the modifierKristian H. Kristensen2020-07-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | BUG=b:145579089, b:79682290 TEST=arc++ apps using non-linear format layouts Change-Id: I9d71852b52b984d89428a07fad5c82d61150e8a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2316523 Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Jason Macnak <natsu@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
* | Merge 'aosp/upstream-master' into 'aosp/master'Jason Macnak2020-07-082-8/+10
|\| | | | | | | | | | | | | | | | | | | | | ... to update Minigbm for Cuttlefish to support Gralloc3 on Minigbm. Bug: b/157902551 Test: m && launch_cvd --gpu_mode=gfxstream Test: m && launch_cvd --gpu_mode=drm_virgl Merged-In: I27f020b4f661890bcc2817deb09ffb9af1c76f1b Change-Id: Ic96add709a99005ff7aa6c7d886e3069b827e4bc
| * cros_gralloc: Adds gralloc 3.0 supportJason Macnak2020-07-082-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements the allocator 3.0 and mapper 3.0 interfaces which: - Implements HIDL interface directly (older versions are wrapped in a passthrough HIDL interface) - Adds isSupported() to allow checking for format and usage combination support before allocating. Adds emulated multi-planar buffer support to virtio backend for non gbm enabled hosts. Updates cros_gralloc_handle to use uint64_t instead of two uint32_t for some members. Updates cros_gralloc_handle to have a single format modifier. Replaces Android makefiles with Android bp files. BUG=b:146515640 TEST=run Cuttlefish w/ gralloc3 and run CTS tests Change-Id: I43ed9788a2413201bddce17ffb69b76006ef39fd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2273554 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Jason Macnak <natsu@google.com> Commit-Queue: Jason Macnak <natsu@google.com>
* | Merge 'aosp/upstream-master' into 'aosp/master'Jason Macnak2020-05-182-6/+31
|\| | | | | | | | | | | | | | | | | | | | | | | | | ... to merge in http://crrev.com/c/2171157 which is needed for Cuttlefish on Minigbm Gralloc 4. Also adds OWNERS.android to avoid merge conflicts with upstream OWNERS file. Bug: b/146515640 Test: launch_cvd Test: launch_cvd --gpu_mode=drm_virgl Change-Id: I6dafb814cc47e3193439cc10af74a0099962813e
| * minigbm: Fix cast to avoid null pointer arithmeticJason Macnak2020-05-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'external/minigbm/cros_gralloc/gralloc0/gralloc0.cc:417:50: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension' BUG=b:146515640 TEST=m gralloc.minigbm Change-Id: I2e86b676224657bdb656a45db4cfa49e84b61c2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2202518 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Auto-Submit: Jason Macnak <natsu@google.com> Tested-by: Jason Macnak <natsu@google.com> Commit-Queue: Jason Macnak <natsu@google.com>
| * minigbm: add resource_info callback for virtio-gpuGurchetan Singh2020-03-261-5/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In ARC++, the wayland sevice and the video stack rely on GRALLOC_DRM_GET_STRIDE and (*lock_ycbcr) with zero flags to return the metadata associated with the buffer. In the past, we've simply returned the metadata that was calculated during allocation. Since the current virtio-gpu API relies on shadow buffers, there's actually two different sets of metadata: 1) The metadata of the shadow buffer --> useful for mapping 2) The metadata of the host resource --> useful for passing to Chrome For the wayland_service and video stack, we want to return (2). For the Android framework, we want to return (1). BUG=b:132939420 TEST=compile Change-Id: I1134d651396ba68e064eaf2e3cad3cb3225d7c5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1681383 Reviewed-by: David Stevens <stevensd@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
| * minigbm: run presubmit.sh, modify OWNERsGurchetan Singh2020-03-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | BUG=none TEST=none Change-Id: I07ae6fa603117f16dee39b1b7e9ca3162daa0c97 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2118462 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
* | Merge 'aosp/upstream-master' into 'aosp/master'Jason Macnak2020-03-051-4/+27
|\| | | | | | | | | | | | | | | | | | | | | | | | | ... to update Minigbm for Cuttlefish to support always using Minigbm as its Gralloc implementation with the 2D virtio-gpu backend and for updating the base for implementing the latest Gralloc version. Bug: b/123764798 Bug: b/146515640 Test: m && launch_cvd Test: m && launch_cvd --gpu_mode=drm_virgl Change-Id: I196928cceb6bfede8a0cd302fe93f5cc1a9c29e5
| * minigbm: Reformat with clang-format.Junichi Uekawa2020-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Touching the files seem to cause reformatting. BUG=None TEST=None Change-Id: I31d2fbb01f4ee803da2b740dea036971e861bf60 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2027288 Tested-by: Junichi Uekawa <uekawa@chromium.org> Reviewed-by: Lepton Wu <lepton@chromium.org> Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
| * gralloc0: Unmask HW_VIDEO_ENCODER usage in the case of non-YUV formatsHirokazu Honda2019-12-041-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-yuv formats are allocated with HW_VIDEO_ENCODER usage as an intermediate buffers, for example, camera fills. They are converted to YUV formats finally when they are fed to a hw encoder. So there is no need of allocating the buffers with HW_VIDEO_ENCODER. TEST=Recording with GCA TEST=android.media.cts.EncodeVirtualDisplayTest#testEncodeVirtualDisplay on kevin Cq-Depend: chromium:1947685 Change-Id: Ic5c09823de1f53ffb6117d07327779e46f32a3f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1940034 Tested-by: Hirokazu Honda <hiroh@chromium.org> Auto-Submit: Hirokazu Honda <hiroh@chromium.org> Commit-Queue: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
| * gralloc0: Add BO_USE_HW_VIDEO_ENCODER mask in GRALLOC_USAGE_HW_VIDEO_ENCODERHirokazu Honda2019-11-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | BUG=b:144135251 TEST=ARC++ encoder on kukui Change-Id: Ic15adebf2266b51aeaa19e863369e1c49c4fab03 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1904910 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Hirokazu Honda <hiroh@chromium.org> Auto-Submit: Hirokazu Honda <hiroh@chromium.org> Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
| * minigbm: cros_gralloc: handle video decoder flagDavid Stevens2019-09-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although gralloc0 doesn't include a video decoder flag, the IAllocator gralloc0 passthrough gives the lower 32 bits of the BufferUsage flags to gralloc0. This change makes cros_gralloc add the video decoder BO_USE flag when that happens. It also adds some missing combinations for when the BO_USE_HW_VIDEO_DECODER flag is actually set. Change-Id: If2248f33ac2456c077fe63e90d2c39e7f57e2568 Reviewed-on: https://chromium-review.googlesource.com/1786419 Tested-by: David Stevens <stevensd@chromium.org> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
| * minigbm: clang formatGurchetan Singh2019-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | It's good to run this once and a while. Change-Id: I69b6f9252455360b6d326a3ec89fe51517abda2f Reviewed-on: https://chromium-review.googlesource.com/1719976 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
| * minigbm: run clang-formatGurchetan Singh2018-09-181-8/+8
| | | | | | | | | | | | | | | | Change-Id: I9b5c3db33bd0c7914a214e2181d655aec84632c5 Reviewed-on: https://chromium-review.googlesource.com/1229436 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
| * minigbm: run clang-formatKeiichi Watanabe2018-08-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Though presubmit.sh requires formatting by clang-format, some files are not formatted. BUG=None TEST=compile Change-Id: I828dd85536cb94dc98cd11e83ec86af53a425070 Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1172241 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* | Modify gralloc0 implementationandroid-mainline-10.0.0_r9android-mainline-10.0.0_r7android-mainline-10.0.0_r5android-mainline-10.0.0_r4android-mainline-10.0.0_r10android-10.0.0_r9android-10.0.0_r8android-10.0.0_r7android-10.0.0_r45android-10.0.0_r44android-10.0.0_r43android-10.0.0_r42android-10.0.0_r41android-10.0.0_r40android-10.0.0_r39android-10.0.0_r38android-10.0.0_r37android-10.0.0_r36android-10.0.0_r35android-10.0.0_r34android-10.0.0_r33android-10.0.0_r32android-10.0.0_r31android-10.0.0_r30android-10.0.0_r14android-10.0.0_r13android-10.0.0_r12android10-qpr3-s1-releaseandroid10-qpr3-releaseandroid10-qpr2-s4-releaseandroid10-qpr2-s3-releaseandroid10-qpr2-s2-releaseandroid10-qpr2-s1-releaseandroid10-qpr2-releaseandroid10-qpr1-mainline-releaseandroid10-mainline-media-releaseandroid10-devandroid10-d4-s1-releaseandroid10-d4-releaseandroid10-c2f2-s2-releaseandroid10-c2f2-s1-releaseandroid10-c2f2-releaseValerie Hau2019-04-251-0/+2
|/ | | | | | | | Add validateBufferSize and getTransportSize Bug: 131089111 Test: build, boot Change-Id: I53195c75907c51585ed68a885d8c35fe90f1b885
* minigbm: cros_gralloc: fix -Wimplicit-function-declaration warnings in ↵Gurchetan Singh2018-04-261-0/+2
| | | | | | | | | | | | | | | gralloctest The arcnext compiler seems to throw more warnings. BUG=none TEST=compile for kevin arc-next Change-Id: Ib7b0518d675db06549312a2e7b814093d75424f5 Reviewed-on: https://chromium-review.googlesource.com/1029354 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* Fix -Wcast-qual warnings.Alistair Strachan2018-04-171-10/+12
| | | | | | | | | | | | | The Android.mk file enables -Wcast-qual and clang finds problems in gralloc0.cc where the constness of a pointer is being cast away. AOSP master is setting -Werror, so these warnings break the build. Fix them. Change-Id: I8820efab34a15d0653b89303d5390fb9f3eee12d Reviewed-on: https://chromium-review.googlesource.com/1005719 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* Use Android log system in helpers.c.Alistair Strachan2018-03-211-11/+11
| | | | | | | | | | | | This code might be loaded by a daemonized process now, so the existing logging to stderr goes nowhere. It's better to use the Android logger. Change-Id: I19f088b8f049f07c9c6839038d2971fad1a0e852 Reviewed-on: https://chromium-review.googlesource.com/971360 Commit-Ready: Alistair Strachan <astrachan@google.com> Tested-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* Add a missing include for asserts.Tomasz Mikolajewski2017-11-171-0/+1
| | | | | | | | | | | | | | The missing include would cause image builders fail on -arcnext builds. BUG=chromium:764871 TEST=emerge arc-cros-gralloc and minigbm on -arcnext. Change-Id: Ifde30bcde72a1fae4d13c95b17273880512cafe2 Reviewed-on: https://chromium-review.googlesource.com/776640 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: plumb buffer access regionGurchetan Singh2017-11-161-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow drivers to tile or detile only the regions requested by the user. Note that the gralloc spec states that: "This address will represent the top-left corner of the entire buffer, even if accessRegion does not begin at the top-left corner." (see hardware/interfaces/graphics/mapper/2.0/IMapper.hal in AOSP) Also, the gralloc API makes it difficult to maintain two mappings of the same buffer. For example, say you have two access regions: module->lock(mod, handle1, 0, 0, 5, 5, &addr); module->lock(mod, handle1, 5, 5, 10, 10, &addr); module->unlock(mod, handle1); // which access region should be unlocked? In practice, this scenario never happens on Android. It's not exactly clear what gbm should return. Let's just return the top left of the access region because that's what we where doing before. BUG=chromium:764871 TEST=gbmtest, mmap_test -g, the following CTS tests: android.view.cts.SurfaceViewSyncTests android.media.cts.EncodeDecodeTest android.video.cts.VideoEncoderDecoderTest Change-Id: I7ca0713871e03928b1d4402aa161588990c7e775 Reviewed-on: https://chromium-review.googlesource.com/758147 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* minigbm: move gralloctest to this repoGurchetan Singh2017-10-102-0/+733
| | | | | | | | | | | | | | | The autotest eclass has issues when compiling for multilib, and plus we can keep the test with the source code. BUG=b:63610343 TEST=emerge-eve arc-cros-gralloc CQ-DEPEND=CL:699675, CL:699734 Change-Id: I9ec3185f7e18f4717ef560e599e635f03b0a999d Reviewed-on: https://chromium-review.googlesource.com/699676 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* minigbm: standardize naming of map flagsGurchetan Singh2017-10-021-6/+18
| | | | | | | | | | | | | | | | It's helpful to differentiate map flags from normal buffer creation flags. Note gralloc doesn't differentiate between map flags and buffer creation flags. However, since flags are passed in with gralloc (*lock)(), we can use a separate conversion function there. BUG=chromium:764871 TEST=Boot Android and play games on Eve Change-Id: Ic8aee84d9ac945abf93d9a9bda78fe3f77711cc3 Reviewed-on: https://chromium-review.googlesource.com/691424 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* minigbm: standardize naming of buffer creation flagsGurchetan Singh2017-10-021-44/+44
| | | | | | | | | | | | | | | | | | | | We use the terms "flags" and "usage" interchangeably in this repo, since they essentally mean the same thing. However, let's be a little more consistent since it's kind of confusing, especially when buffer map flags come to play. Let's: - refer to everything in the drv_* layer as use_flags - refer to everything in the gbm/gralloc layers as usages BUG=chromium:764871 TEST=emerge-eve {arc-cros-gralloc, minigbm} Change-Id: If987d72369b895f38cde87e50ce1080f78f2a084 Reviewed-on: https://chromium-review.googlesource.com/691423 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* minigbm: gralloc0: Fix coding style errorTomasz Figa2017-08-091-1/+3
| | | | | | | | | | | | | | | | | There is a missing whitespace error in gralloc0.cc, which is automatically corrected by some git hook, so let's fix it finally. Since the original style issue seems to be caused by a bug in clang-format used in ChromeOS chroot (and corrected by any other, not broken, clang-format), just annotate the line to have clang-format bypassed. BUG=none TEST=compile Change-Id: I6df1963eedc3b908d4a0abaffb2db9081eaba043 Reviewed-on: https://chromium-review.googlesource.com/597330 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* minigbm: add the BO_USE_RENDERSCRIPT flag back inGurchetan Singh2017-08-051-2/+1
| | | | | | | | | | | | | | | | | | | Previously, we mapped BO_USE_RENDERSCRIPT to BO_USE_LINEAR, which made sense at the moment. However, we know have a case where we need to special things with renderscript buffers on ARM boards. Let's add back in the flag so we can differentiate between normal linear buffers and renderscript buffers at map and unmap time. BUG=b:38097499 TEST=run cts -m CtsViewTestCases -t android.view.cts.SurfaceViewSyncTests passes on 9776.0.0 veyron_minnie Change-Id: I7f1ee76735280ab6495a2d4af332cce5bc1c1727 Reviewed-on: https://chromium-review.googlesource.com/602735 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* minigbm: cros_gralloc: fix initialization race conditionGurchetan Singh2017-08-031-22/+36
| | | | | | | | | | | | | | | | | | | | | On Android M, since we don't hold a lock during cros_gralloc_driver::init(), another thread would sometimes access data before the driver was initialized. This would lead to dEQP crashes. We don't experience this issue on Android N since the framework has it's own layer of locks in the Gralloc1On0Adapter. This patch makes the module initialization during (*registerBuffer) and gralloc_open re-entrant. BUG=b:63511976 TEST=run cts --package com.drawelements.deqp.gles2 on veyron_tiger has no crashes Change-Id: I2b72f2f8ed5e4a5afbacb291ed8cd928beb2a3b3 Reviewed-on: https://chromium-review.googlesource.com/597015 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>
* minigbm: cros_gralloc: support GRALLOC_MODULE_API_VERSION_0_3Gurchetan Singh2017-07-291-27/+57
| | | | | | | | | | | | | | | | | | | | Let's support GRALLOC_MODULE_API_VERSION_0_3. This will more closely mirror what gralloc1 and HIDL gralloc does. We have the option to asychronously unlock with this version of the API, but decided the added complexity wouldn't lead to any performance benefits. We'll just set the release fence pointer to be -1, indicating the the buffer is ready to use after the (*unlock_Async) call. BUG=b:62069164 TEST=Android boots, play Youtube app, ./gralloctest all passes Change-Id: Ia21a11b541796c4b36003c50cd8627d189b4bc56 Reviewed-on: https://chromium-review.googlesource.com/422661 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
* minigbm: cros_gralloc: Use standard error codesTomasz Figa2017-07-251-18/+18
| | | | | | | | | | | | | | | | Since we decided not to support gralloc1 and gralloc0 requires standard errno-based error codes to be returned to callers, remove the custom error code enumeration and use standard codes everywhere in cros_gralloc. BUG=b:63915090 TEST=Play store starts on Eve Change-Id: I4f466e8cac6323554f29a7da5c2c00ab47b0abf2 Reviewed-on: https://chromium-review.googlesource.com/580735 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: Remove _HW_ from BO_USE_HW_CAMERA_* usage flagsTomasz Figa2017-07-131-2/+2
| | | | | | | | | | | | | | Camera is supposed to mean camera hardware and the superfluous _HW_ does not give us anything other than making the names longer. BUG=b:62358788 TEST=compile Change-Id: I3608470f17efe700fa43901167fa614ff9eac09c Reviewed-on: https://chromium-review.googlesource.com/566774 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: gralloc0: Fix invalid cast from integer to pointerTomasz Figa2017-07-131-1/+1
| | | | | | | | | | | | | | | We should be casting a pointer to the fourcc to a char * pointer, instead of casting the fourcc value itself (which unluckily happens to be of the same size as pointer, so compilator fails to detect it). BUG=b:62358788 TEST=Try to allocate with invalid usage Change-Id: I2bb94d145dc3765d5193712aad7682c0fb383dd8 Reviewed-on: https://chromium-review.googlesource.com/566791 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: gralloc0: Remove BO_USE_HW_CAMERA_ZSLTomasz Figa2017-07-131-2/+0
| | | | | | | | | | | | | | | | | | | | | In gralloc0, the flag GRALLOC_USAGE_HW_CAMERA_ZSL is defined to be a bitwise OR of GRALLOC_USAGE_HW_CAMERA_WRITE and GRALLOC_USAGE_HW_CAMERA_READ. So it is incorrect to treat it as a separate usage flag, not even thinking about using it with the bitwise AND operator for conditional tests. Fix the current broken state by removing BO_USE_HW_CAMERA_ZSL, which does not have any reason to exist. BUG=b:62358788 TEST=Camera preview renders correctly on Poppy. Change-Id: I883713f7e1c82c7747b20ac2000fb2edd5207616 Reviewed-on: https://chromium-review.googlesource.com/561034 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Ricky Liang <jcliang@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: gralloc0: Allow lock_ycbcr for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINEDTomasz Figa2017-07-111-1/+2
| | | | | | | | | | | | | | | | We can use lock_ycbcr as a way to partially work around the format resolve problem - with the assumption that if lock_ycbcr succeeds, the android_ycbcr struct returned describes a YCbCr 4:2:0 image, we can query gralloc for the format instead of hardcoding one statically. BUG=b:32077885 TEST=Camera preview renders correctly on Poppy. Change-Id: Ic20f5aa89809bf89941f3b4851c0d28965da54ac Reviewed-on: https://chromium-review.googlesource.com/544487 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: gralloc0: Fix error handling in lock_ycbcrTomasz Figa2017-07-111-0/+3
| | | | | | | | | | | | | | | | | | | | | cros_gralloc_lock_ycbcr() obtains the mapping first and then fills in the android_ycbcr struct. However the last step can fail if the backing format is not included in the switch statement. In this case the function returns without releasing the mapping. Fix it by calling mod->drv->unlock() before returning, when the format is unsupported. Also do not attempt to fill in the struct if the earlier mod->drv->lock(() fails. BUG=b:32077885 TEST=lock_ycbcr() fails properly for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED when it is backed by a RGBX_8888 buffer on Poppy. Change-Id: I0b8cf91c578595a1b6ddc6e21009a8a84b8ac4de Reviewed-on: https://chromium-review.googlesource.com/544486 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
* minigbm: cros_gralloc: refactor for future HALsGurchetan Singh2017-06-281-0/+351
We want the ability to support gralloc0, gralloc1 and HIDL gralloc in this repo. This commit moves gralloc0 specific code to the gralloc0 subdirectory, and refactors the rest of the code so it can be eventually used by whichever APIs we choose to implement. In addition, all of the data by the module is now handled by managed pointers instead of process data, since we get a number of crash reports when we try to access data in gralloc_close(). BUG=b:62069164, b:62221166 TEST=gralloctest all, Android boots, Youtube videos, 5-10 CTS tests Change-Id: Ic29a777573936216d99498d0b814ea50015fd435 Reviewed-on: https://chromium-review.googlesource.com/521794 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>