summaryrefslogtreecommitdiff
path: root/gbm.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-16Revert "minigbm: Revert "minigbm: flush buffer instead of unmapping""Gurchetan Singh1-1/+1
The reason the tests weren't passing is because DRM_IOCTL_I915_GEM_SET_DOMAIN is required on x86 platforms when calling (*lock). A previous CLs added this. BUG=b:67073097, b:67331142 TEST= android.view.cts.SurfaceViewSyncTests android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual0720x0480 android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1280x0720 android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1920x1080 android.media.cts.EncodeDecodeTest#testVP8EncodeDecodeVideoFromSurfaceToSurface720p android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromPersistentSurfaceToSurface720p android.media.cts.EncodeDecodeTest#testVP8EncodeDecodeVideoFromPersistentSurfaceToSurface720p pass on Eve. This reverts commit 14033e0013b5cc0ffc5af59dda7c377d46ec761d. v2: Make lock_data[0] null after last (*unlock)(), because user may specify different access regions in the next (*lock)(). Change-Id: Ia56ecd57acc4471b026c852b178d8bc0f189dec7 Reviewed-on: https://chromium-review.googlesource.com/710324 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-16minigbm: plumb buffer access regionGurchetan Singh1-2/+12
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-1/+1
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-05minigbm: Revert "minigbm: flush buffer instead of unmapping"Gurchetan Singh1-1/+1
It looks like munmap is probably necessary for i915 and serves some important function. Let's revert until we can figure out what's going on. BUG=b:67073097 TEST=android.view.cts.SurfaceViewSyncTests#testVideoSurfaceViewCornerCoverage This reverts commit 254dbb19c49fad4ab4f28b2d1f2982bd10bb7c0b. Change-Id: Idac50930f9f13b4867110a31fadb1a2547d05d07 Reviewed-on: https://chromium-review.googlesource.com/699802 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-02minigbm: standardize naming of map flagsGurchetan Singh1-4/+5
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-8/+8
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-4/+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: flush buffer instead of unmappingGurchetan Singh1-1/+1
As an optimization, let's call: - drv_bo_flush when calling (*unlock). - drv_bo_flush during gbm_bo_unmap() CL:441916 makes sure that the buffer is unmapped before the buffer destroy ioctl is called, so we will not be leaking mappings in any case. BUG=chromium:764871 TEST=Android boots, 8 CTS tests, and Youtube app works on Eve gbmtest, mmap_test -g Change-Id: I429739a8c6435a434dac41ad125761364a3775d0 Reviewed-on: https://chromium-review.googlesource.com/668220 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-09-22minigbm: Store usage in driver data flagsSatyajit Sahu1-1/+1
Storing usage flag in drv_data.flags in gbm_bo_import method. BUG=b:38152101 TEST=Tested by running graphics_Sanity autotest and mmap_test. Change-Id: I8d1bd8473f8aa6c63da014f86ddcec42e250998a Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com> Reviewed-on: https://chromium-review.googlesource.com/676554 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-07-11Plumb buffer map permissions through gbm.Joe Kniss1-1/+4
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-03-31minigbm: add clang-format and presubmit hooksGurchetan Singh1-88/+46
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-18minigbm: deal with ArcCodec use case by exposing struct map_infoGurchetan Singh1-1/+2
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-2/+1
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>
2016-12-21rockchip: Add support for AFBC buffersKristian H. Kristensen1-0/+26
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-01minigbm: Fix cursor and scanout flagsGurchetan Singh1-1/+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-7/+4
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-4/+16
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-18/+34
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-13minigbm: More sophisticated gbm_bo_map/gbm_bo_unmapGurchetan Singh1-9/+2
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-26/+16
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-16/+26
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-10-06minigbm: quick and dirty implementation of gbm_bo_map/gbm_bo_unmapGurchetan Singh1-0/+26
We want to add gbm_bo_map/gbm_bo_unmap entry points so certain tests and Chrome can use driver specific map logic. This is based on the upstream entry points in Mesa, with the addition of a plane parameter. Currently, we just map the entire buffer and don't attempt to do partial mappings or use the map flags. We should do this in the future... BUG=chromium:653284 TEST=minigbm builds Change-Id: I0423c10c55bab8fac6d6d7c6a699ab71b43aa61b Reviewed-on: https://chromium-review.googlesource.com/393927 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-08-25minigbm: Added support for multiplane importGurchetan Singh1-2/+11
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-12minigbm: Refactored minigbm on top a private APIGurchetan Singh1-164/+45
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-05-29minigbm: add format modifiers per planeVince Hsu1-0/+13
To pass the surface format parameters to EGL, we add format modifiers which are used for dmabuf import. The vendor ID definitions are copied from drm_fourcc.h. BUG=chromium:478339 TEST=none Change-Id: Ida3e6787b29af73ff534c054006f93c3bad4c5b9 Signed-off-by: Vince Hsu <vince.h@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/346365 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-05-10remove enum gbm_bo_formatZach Reizner1-5/+0
The presence of this enum makes mistakes handling gbm formats very easy to make. With this patch, no new code can use this enum. Any old code that tries will see errors. BUG=None TEST=drm-tests CQ-DEPEND=CL:343592 Change-Id: If3b19975a137928965f14bad26d1e895dd839810 Reviewed-on: https://chromium-review.googlesource.com/343528 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Haixia Shi <hshi@chromium.org>
2016-04-13minigbm: ensure drm_prime_handle struct is correctly initializedVincent Palatin1-0/+1
the 'prime_handle' variable has a 'flags' and the kernel code for DRM_IOCTL_PRIME_FD_TO_HANDLE will fail if 'flags' contains something else than DRM_CLOEXEC or 0. Right now, the 'flags' field is uninitialized and DRM initialization fails on some VM configs with kernel 4.4. BUG=chromium:591626 TEST=run null_platform_test and Chrome browser using the arm64-llvmpipe overlay and kernel 4.4 on QEMU VM. Change-Id: Ieac8eb280fe14f1e268f8869dcc9fe46c1bb9599 Reviewed-on: https://chromium-review.googlesource.com/337970 Commit-Ready: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-03-24Relax the restriction and permit read/write access on dma-bufTiago Vignatti1-1/+5
This patch relax the restriction and permit read/write access on dma-buf. In particular this is necessary for the userspace mmap()ing a dma-buf fd, so Chrome could now use it for unpriviledged Renderers write into a graphics buffer without much difficulty. This has been discussed in upstream here: http://lists.freedesktop.org/archives/dri-devel/2015-December/097562.html Kernel changes are needed to use this userspace feature: Author: Daniel Thompson <daniel.thompson@linaro.org> Date: Fri Jun 19 14:52:28 2015 +0100 drm: prime: Honour O_RDWR during prime-handle-to-fd BUG=chromium:581151 TEST=test_that -b strago $DEVICE graphics_SanAngeles test_that -b strago $DEVICE graphics_GLBench test_that -b strago $DEVICE graphics_Sanity Change-Id: I37aff88623ba6aa45797b0ccb6cd2d15c5c51f41 Reviewed-on: https://chromium-review.googlesource.com/323990 Commit-Ready: Tiago Vignatti <tiago.vignatti@intel.com> Tested-by: Tiago Vignatti <tiago.vignatti@intel.com> Reviewed-by: Ilja Friedel <ihf@chromium.org> Reviewed-by: Tiago Vignatti <tiago.vignatti@intel.com> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-03-12minigbm: Fill sizes[0] in gbm_bo_importStéphane Marchesin1-2/+3
We need to give useable sizes to imported buffers, not just the ones we create. BUG=chromium:592681 TEST=run the test on lumpy Change-Id: Ife99988600607e2f4a56bbad37b48c21829701dd Reviewed-on: https://chromium-review.googlesource.com/332448 Commit-Ready: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Ilja Friedel <ihf@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-03-11minigbm: Add virtio_gpu driver.Vincent Palatin1-0/+2
Add a minigbm driver to support the virtio_gpu DRM driver as used by QEMU virtual machine. BUG=chromium:591626 TEST=null_platform_test runs on emulated ARM64 virtual machine using virtio_gpu driver and VIRTIO MMIO transport. Change-Id: I1bbb060bb882d732b17435a2422cd7fb2c77a5f0 Reviewed-on: https://chromium-review.googlesource.com/332286 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-02-25check usage flags against device's supported formats in gbm_bo_createZach Reizner1-1/+1
Previously, gbm_bo_create called gbm_device_is_format_supported with 0 hardcoded as the usage flags. This meant gbm_bo_create could attempt to create buffer objects for unsupported combos of usage flags and pixel formats. Using 0 as the usage flag basically meant ANY usage flag that was supported by the device would work. Of course that's not the reality, and the usage flag should be considered along with the pixel format during buffer object creation, which is what this CL does. TEST=ui works BUG=None Change-Id: Icd3bd0f47dc33790e4476515f2024f9765bea0a2 Reviewed-on: https://chromium-review.googlesource.com/329306 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-01-23Support multi-plane buffers.Yuly Novikov1-18/+70
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-22minigbm: Add evdi minigbm driver.Bartosz Bielecki1-0/+2
Add a minigbm driver to support the evdi drm. BUG=none TEST=Ozone recognizes the evdi dri card Change-Id: Ic0528194ecf8c388f9818e125ed72d17cfff3a4c Reviewed-on: https://chromium-review.googlesource.com/322161 Commit-Ready: Michał Łukaszek <michal.lukaszek@displaylink.com> Tested-by: Michał Łukaszek <michal.lukaszek@displaylink.com> Reviewed-by: Michał Łukaszek <michal.lukaszek@displaylink.com> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2015-12-03minigbm: Add marvell minigbm driver.Daniel Blum1-0/+6
Add a minigbm driver to support the marvell drm. BUG=chrome-os-partner:43199 TEST=Freon boots to browser Change-Id: Ib00d4433a6e3103505a4ceaed1e4ac1ea0d2ba5e Signed-off-by: Daniel Blum <dblum@marvell.com> Reviewed-on: https://chromium-review.googlesource.com/315359 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Eduardo Gallofin <eduardog@marvell.com>
2015-11-13Implement gbm_bo_importStéphane Marchesin1-7/+58
We only support GBM_BO_IMPORT_FD for now. BUG=chromium:541558 TEST=run unit test (graphics_Gbm) Change-Id: I1232cfdb57efdbbe9c3243b74c4fc5bf20cd8c08 Signed-off-by: Stphane Marchesin <marcheu@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311203 Commit-Ready: Ilja Friedel <ihf@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Ilja Friedel <ihf@chromium.org> Reviewed-by: David Reveman <reveman@chromium.org> Reviewed-by: Haixia Shi <hshi@chromium.org>
2015-11-09Misc style/indent fixesStéphane Marchesin1-25/+12
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-03-25minigbm: Add mediatek drm to minigbmJB Tsai1-0/+6
Add gbm_driver_mediatek function in gbm_get_driver to support mediatek drm BUG=None TEST=Use gbmtest with minigbm to verify Change-Id: Ieaccdbf5a2bde94f70addb8ac5192fbbcecf321e Signed-off-by: JB Tsai <jb.tsai@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/261503 Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2015-01-12tegra: Support tiled buffersLauri Peltonen1-0/+6
If GBM_BO_USE_RENDERING flag is passed, allocate tiled buffers. Add logic to the Tegra backend to compute tiled buffer dimensions and tiling parameters (kind and block height). The tiling parameters must somehow be passed to EGL at EGLImage creation. The long term plan is to introduce an extensible structure that can contain arbitrary vendor specific metadata. For now, we abuse the PITCH attribute to pass tiling parameters. Add a new GBM utility function gbm_bo_get_stride_or_tiling, which returns either the tiling parameters or byte pitch, depending whether the buffer is tiled or not. The Nvidia term for our tiled layout is "blocklinear". BUG=None TEST=null_platform_test on Tegra Change-Id: I4e0226efa401b08f7e4a009a7f74b3453c622a10 Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/236663 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Commit-Queue: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org>
2015-01-09fix incorrect error detection in gbm_bo_get_fdZach Reizner1-2/+2
TEST=None BUG=None Change-Id: I6404564bc847b649858232bd4c3eea54663b8d00 Reviewed-on: https://chromium-review.googlesource.com/239961 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Commit-Queue: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org>
2014-11-12Fixed O_CLOEXEC and missing semicolon.Dominik Behr1-3/+4
Change-Id: I50bff28ff764610d66b362aa6859054a64a6a1df Signed-off-by: Dominik Behr <dbehr@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229180 Reviewed-by: David Sodman <dsodman@chromium.org>
2014-11-06Implement gbm_bo_get_fdStéphane Marchesin1-1/+9
BUG=none TEST=unit test Change-Id: Iafeb58f8e09d4409633475341fc2675922f7350d Reviewed-on: https://chromium-review.googlesource.com/228252 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Commit-Queue: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org>
2014-09-13Import minigbmStéphane Marchesin1-0/+281
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