summaryrefslogtreecommitdiff
path: root/drv.h
AgeCommit message (Collapse)AuthorFilesLines
2017-11-16minigbm: plumb buffer access regionGurchetan Singh1-2/+13
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>
2017-11-08minigbm: refactor and rename mapping structGurchetan Singh1-5/+9
Since some drivers (AMDGPU, Tegra) may have to do expensive tiling and detiling operations, we should try to take advantage of the access regions passed in by gralloc and gbm. Let's refactor struct map_data so we can separate the actual mapping and access region. Here is the Coccinelle rule used in this change: @@ struct map_info *M; @@ - (M) + M->vma In addition, struct map_data was also renamed to struct mapping. BUG=chromium:764871 TEST= mmap_test -g on Kevin Change-Id: Idb094aa3b5f81e45ce3a2f4fb2d9bf8fba32bf29 Reviewed-on: https://chromium-review.googlesource.com/758144 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Joe Kniss <djmk@google.com> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-17minigbm: add buffer invalidation functionGurchetan Singh1-0/+2
We may need to invalidate a buffer before reading it. Some use cases are: - DRM_IOCTL_I915_GEM_SET_DOMAIN - DMA_BUF_IOCTL_SYNC with the SYNC_START option - DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST This patch adds the function hook. BUG=chromium:764871 TEST=compiles Change-Id: I85811407252b859a12294381c65ff3545424636b Reviewed-on: https://chromium-review.googlesource.com/710322 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-13minigbm: respect map_flags in all casesGurchetan Singh1-0/+1
When the map flags do not feature BO_TRANSFER_WRITE, we should not copy back any shadow buffers we maintain. BUG=b:67434931 TEST=android.view.cts.SurfaceViewSyncTests on Mediatek/Rockchip Change-Id: I7078bfc5a8d770a52949d43ea68efc4a870e9227 Reviewed-on: https://chromium-review.googlesource.com/703875 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-02minigbm: standardize naming of map flagsGurchetan Singh1-6/+6
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>
2017-10-02minigbm: standardize naming of buffer creation flagsGurchetan Singh1-5/+5
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>
2017-09-29minigbm: remove buffer sizes when importingGurchetan Singh1-3/+0
CL:662919 started using lseek() and the buffer offsets when importing, so let's remove buffer sizes here. BUG=b:65566935 TEST=emerge-eve {minigbm, arc-cros-gralloc} Change-Id: I43fda28bfe530139e8e0d68c6b9c213489077b4c Reviewed-on: https://chromium-review.googlesource.com/691421 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2017-09-27minigbm: add drv_bo_flushGurchetan Singh1-1/+3
As an optimization, we would like to separate buffer flush/writeback and unmap. This patch adds the appropriate entry point in our internal driver API. Overall, the proposed flow is: - drv_bo_map(..) creates a mapping and associated metadata - drv_bo_flush(..) writes memory from any cache or temporary buffer back to memory - drv_bo_unmap(..) flushes, and frees the mapping and associated metadata. The drv_bo_flush function just does some sanity checks on the map data at this point, but otherwise is a no-op. BUG=chromium:764871 TEST=gbmtest, mmap_test -g on eve Change-Id: If306f066a76bc5e0943c1170e2d6933fa5630eff Reviewed-on: https://chromium-review.googlesource.com/668218 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-08-05minigbm: store BO_USE_* flags in buffer objectGurchetan Singh1-1/+3
Currently, minigbm only cares about the buffer use flags during buffer creation. We would like to use cached renderscript buffers, so we need knowledge about how the buffer was created at map time. Let's add this to the buffer object struct. BUG=b:38097499 TEST=run cts -m CtsViewTestCases -t android.view.cts.SurfaceViewSyncTests passes on 9776.0.0 veyron_minnie Change-Id: I73943dae309e60038affb78385aef4b6d3b678ed Reviewed-on: https://chromium-review.googlesource.com/602734 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-07-13minigbm: Remove _HW_ from BO_USE_HW_CAMERA_* usage flagsTomasz Figa1-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>
2017-07-13minigbm: gralloc0: Remove BO_USE_HW_CAMERA_ZSLTomasz Figa1-1/+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>
2017-07-11Plumb buffer map permissions through gbm.Joe Kniss1-0/+6
Map read/write permissions were being ignored by minigbm. This can cause segfaults or failed mappings if the device FD permissions are not rw. Also adds bounds checking in tegra.c for tile/untile transfers. BUG=chromium:737328 TEST=cyan, nyan graphicsSanity with read only on device Change-Id: I8fccaed4e908cda3ff7d7cf451d0ad75d65039e6 Reviewed-on: https://chromium-review.googlesource.com/556980 Commit-Ready: Joe Kniss <djmk@google.com> Tested-by: Joe Kniss <djmk@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-07-10minigbm: Resolve format based on BO usage flagsTomasz Figa1-1/+1
On certain platforms, depending on buffer usage, the preference for implementation defined or flexible YUV formats might be different. For example, the camera subsystem on Poppy (i915) requires NV12 for HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, but it can't be used in place of RGBX as a render target. Allow this by extending the .resolve_format driver callback to take BO flags as argument and let the driver include this in the format selection logic. BUG=b:37615277 TEST=compile Change-Id: Ieb44c294584ab25f106a92f406353212989d0724 Reviewed-on: https://chromium-review.googlesource.com/487553 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-23minigbm: remove BO_USE_RENDERING from certain formatsGurchetan Singh1-4/+0
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-03-31minigbm: add clang-format and presubmit hooksGurchetan Singh1-64/+33
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-30minigbm: work with strides, not widthsGurchetan Singh1-3/+3
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-30minigbm: add bytes per pixel functionGurchetan Singh1-3/+3
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-20minigbm: add DRM_FORMAT_YVU420_ANDROIDGurchetan Singh1-0/+1
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-18minigbm: deal with ArcCodec use case by exposing struct map_infoGurchetan Singh1-2/+11
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-16minigbm: rework flag APIGurchetan Singh1-3/+7
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-08minigbm: add BO_USE_TEXTUREGurchetan Singh1-0/+1
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>
2016-12-21rockchip: Add support for AFBC buffersKristian H. Kristensen1-0/+6
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-17minigbm: Remove (c) from copyright notice.Daniele Castagna1-1/+1
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-07minigbm: rename DRV_BO_USE_* to BO_USE_*Gurchetan Singh1-19/+19
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-01minigbm: Fix cursor and scanout flagsGurchetan Singh1-2/+2
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-11-28minigbm: Switch to <drm_fourcc.h>Gurchetan Singh1-85/+17
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-19minigbm: Fix incorrect plane import sizeGurchetan Singh1-0/+7
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>
2016-10-21minigbm: add new GBM_BO_IMPORT_FD_PLANARKristian H. Kristensen1-1/+1
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>
2016-10-17minigbm: Fix the flag situationGurchetan Singh1-12/+7
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-17minigbm: Implemented cros_grallocGurchetan Singh1-1/+10
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>
2016-10-13minigbm: More sophisticated gbm_bo_map/gbm_bo_unmapGurchetan Singh1-5/+6
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-09Revert "Add new GBM_BO_IMPORT_FD_PLANAR"Mike Frysinger1-1/+1
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>
2016-10-07Add new GBM_BO_IMPORT_FD_PLANARKristian H. Kristensen1-1/+1
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>
2016-08-25minigbm: Added support for multiplane importGurchetan Singh1-10/+12
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>
2016-08-22minigbm: Added gralloc API to internal APIGurchetan Singh1-0/+23
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-17minigbm: Add mmap() in backendsGurchetan Singh1-0/+6
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-12minigbm: Refactored minigbm on top a private APIGurchetan Singh1-0/+186
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>