summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-12-01amdgpu: force linear surfaces with camera use flagswipNicolai Hähnle1-1/+15
2017-12-01dri: use drm and local defines instead of gbm definesNicolai Hähnle1-20/+19
It seems the design really doesn't want us to include gbm.h here.
2017-11-30Proof of concept: amdgpu backend based on dri_interfaceNicolai Hähnle4-360/+381
2017-11-30helpers: silence an uninitialized variable warningNicolai Hähnle1-1/+1
This may be hiding a bug.
2017-11-28Tiled to linear and removal of addrlib dependencySatyajit Sahu2-218/+250
Tiled to linear conversion added in bo_map. Also writing back to tiled data in bo_unmap. addrlib dependency removed and mesa apis (radeonsi_dri.so) called directly. Change-Id: Icb6e5d425c995d3bc4e3b4b8c1e9a7de7947b7b8 Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
2017-11-17Add a missing include for asserts.Tomasz Mikolajewski1-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>
2017-11-16minigbm: add GBM_BO_USE_SW_{READ,WRITE}_{OFTEN,RARELY} usage flagsShirish S2-1/+19
Need for these flags has arisen because buffer's allocated BO_USE_SCANOUT flag is not mmapable in amd, whereas going further for ensuring atomictity related operations are functional, one needs buffer to be mmap'd. These flags shall be used to strike balance in enabling AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED on amd and mmap X-tiled buffers on Intel platforms. BUG=b:65297611, chromium:777706 TEST=On Kahlee, UI comes up. GLMark2 & GLbench autotests show no performance regression atomictest -t multiplanes passes WebGL Aquarium Change-Id: I582452d331f4a05106939447784a76eba06d13c2 Reviewed-on: https://chromium-review.googlesource.com/758618 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-16Revert "minigbm: Revert "minigbm: flush buffer instead of unmapping""Gurchetan Singh2-2/+2
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: use drv_array for combinations and kms_itemsGurchetan Singh6-113/+69
This de-deuplicates the various dynamic arrays we use. BUG=chromium:764871 TEST=gbmtest passes Change-Id: I94c8cf7c71fdb98b931aab00c5381853e2ae0d3f Reviewed-on: https://chromium-review.googlesource.com/758149 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: make drv_add_combinations return nothingGurchetan Singh17-154/+73
Two reasons for this: 1) We can use drv_array for driver combinations (see next patch) 2) It's less verbose. BUG=chromium:764871 TEST=gbmtest passes Change-Id: I39bea6e2e9e4c76d2ca78566926a79bdc17f11d0 Reviewed-on: https://chromium-review.googlesource.com/758148 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 Singh9-29/+89
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-16minigbm: use struct vma for (*bo_map)/(*bo_unmap) callbacksGurchetan Singh10-48/+48
This sets better expectations for what we expect from the backends. BUG=chromium:764871 TEST=mmap_test Change-Id: I7fb815b58fae8e9fbd73bf7c0263c7db44488844 Reviewed-on: https://chromium-review.googlesource.com/770519 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-11-14minigbm: use drv_array for mappingsGurchetan Singh3-40/+56
Let's start allowing multiple mappings of the same buffer when different map flags are passed in. BUG=chromium:764871 TEST=mmap_test -g on Kevin, gbmtest Change-Id: I4eb0b6f4c3572a92001696c2720d5a5f7d9d73a4 Reviewed-on: https://chromium-review.googlesource.com/758146 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-11-11minigbm: amdgpu: add supported formats for cameraRicky Liang1-0/+16
Set the CAMERA_{READ|WRITE} flags for formats that are used by the camera stack. BUG=b:69109002 TEST=Verify that camera works on Kahlee. Change-Id: I4c9aacdc71d3b18188783007f8c88da37ed28dca Reviewed-on: https://chromium-review.googlesource.com/762687 Commit-Ready: Ricky Liang <jcliang@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-11-09minigbm: introduce drv_arrayGurchetan Singh3-1/+119
We want to allow multiple mappings of a single buffer with different map flags. To do this, we'll need some sort of linked list or dynamic array of mappings. We already use dynamic arrays in minigbm, so let's centralize that functionality and use it. BUG=chromium:764871 TEST=emerge-kevin {minigbm, arc-cros-gralloc} Change-Id: I2b391d6e8e690eac6368b1404a806b2bfbbcdf44 Reviewed-on: https://chromium-review.googlesource.com/758145 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 Singh14-104/+118
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-11-08minigbm: fix map time assertionsGurchetan Singh1-2/+2
We should assert when the refcount is equal to zero as well. BUG=chromium:764871 TEST=gbmtest passes Change-Id: Iaf8b5bd4bf51472ad7c564341b42a7079b58bd6e Reviewed-on: https://chromium-review.googlesource.com/758143 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: re-const-ify driver backendsGurchetan Singh17-33/+33
minigbm driver creation needs to be re-entrant (see CL:674528). Let's re-constify to make this behavior explicit. BUG=none TEST=emerge-eve {minigbm, arc-cros-gralloc} Change-Id: I037966199d4aa6de60432127e10fea1fb602694b Reviewed-on: https://chromium-review.googlesource.com/758142 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-11-01minigbm: amdgpu: Add ABGR8888 to supported render target formatsAlec Thilenius1-2/+3
Added DRM_FORMAT_ABGR8888 to the list of supported render_target_formats. BUG=b:67707215 TEST=teravest@chromium.org confirmed that this worked. Change-Id: I0d1578f9a0ca98f28ebf60d396d1dbdae25435f1 Reviewed-on: https://chromium-review.googlesource.com/747723 Commit-Ready: Alec Thilenius <athilenius@chromium.org> Tested-by: Alec Thilenius <athilenius@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-31minigbm: remove cirrus driverGurchetan Singh3-38/+4
Nobody should use this anymore -- virtio_gpu is the future. BUG=chromium:710629 TEST=Should already be unused, CQ will check Change-Id: I8e4184875140e0c74d886c20fcf2d1c9664fa44c Reviewed-on: https://chromium-review.googlesource.com/747983 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-27minigbm: amdgpu: Add RGB565 to supported render target formatsAlec Thilenius1-2/+2
Added DRM_FORMAT_RGB565 to the list of supported render_target_formats. BUG=b:67914863 TEST=On Kahlee, sample Android GL application renders a red triangle correctly using the RGB565 render target format. Change-Id: I79c6cafebfb111bb75182fc48ce0216f1bc789fd Reviewed-on: https://chromium-review.googlesource.com/739758 Commit-Ready: Alec Thilenius <athilenius@chromium.org> Tested-by: Alec Thilenius <athilenius@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-26minigbm/i915: Implement bo_create_with_modifiersKristian H. Kristensen3-8/+64
This implements the bo_create_with_modifiers driver functions, which enables the gbm_bo_create_with_modifiers() entry point. This will allow ozone to allocate with the modifiers it queries from KMS. BUG=chromium:763760 TEST=Allocates Y-tiled scanout on SKL+ Change-Id: Id770e571a51aef4d753b30e12cd67d935c5228b7 Reviewed-on: https://chromium-review.googlesource.com/729279 Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-26minigbm: Use more descriptive modifier namesKristian H. Kristensen5-10/+10
DRM_FORMAT_MOD_NONE means that the buffer layout is "not modified", as opposed to "no modifier present". In other words, linear, since the assumption is that that's the starting point. This was later clarified by introducing the DRM_FORMAT_MOD_LINEAR as a alias for DRM_FORMAT_MOD_NONE and DRM_FORMAT_MOD_INVALID as a NULL-like value for modifiers. This commit replaces DRM_FORMAT_MOD_NONE with DRM_FORMAT_MOD_LINEAR where we mean linear (which is most places) and DRM_FORMAT_MOD_INVALID where we want to indicate "no modifier" (in struct kms_item). BUG=chromium:763760 TEST=Intel GPU board boots and has X-tiled framebuffers. Change-Id: I93e1419e1ab4c04ad6ef3d48ada19487b880886d Reviewed-on: https://chromium-review.googlesource.com/737409 Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-24minigbm: amdgpu: make AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED defaultShirish S1-8/+1
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED is required for mmapping buffers in the amdgpu kernel driver. This patch makes it default for all buffers on create. However it should be noted that in case we find any performance related regression in an un-tested scenario this patch needs to be reverted. BUG=b:65297611 TEST=On Kahlee, UI comes up. GLMark2 & GLbench.bvt autotests pass atomictest -t multiplanes passes WebGL Aquarium Change-Id: Ic82b25de63e66aac7aa04b4b255eb432c10c911b Signed-off-by: Shirish S <shirish.s@amd.com> Reviewed-on: https://chromium-review.googlesource.com/727824 Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-20minigbm: Link amdgpuaddr for DRV_AMDGPU.Justin TerAvest1-0/+4
The amdgpu driver requires functions provided by amdgpuaddr: * AddrComputeSurfaceInfo * AddrConvertTileInfoToHW * AddrCreate * AddrDestroy We need to link against amdgpuaddr when using this driver. BUG=b:64515630 TEST=Built modified arc-cros-gralloc, got ARC++ graphics on AMD Change-Id: I5bfa32f0c912ac5d3a19ab4f337614a1d91a6328 Reviewed-on: https://chromium-review.googlesource.com/726364 Commit-Ready: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-19minigbm: i915: add XR30 and XB30 formats.Daniele Castagna1-2/+3
i915 supports 30bit per component formats. This CL adds XR30 and XB30 to minigbm i915 backend. This CL also sorts render_target_formats alphabetically. BUG=chromium:776093 TEST=Ran a modifier version of null_platform_test that will be uploaded soon. Change-Id: If4f2f74cb10a0534023b9b6142ee84ced0ed8a38 Reviewed-on: https://chromium-review.googlesource.com/726318 Commit-Ready: Daniele Castagna <dcastagna@chromium.org> Tested-by: Daniele Castagna <dcastagna@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-19minigbm: i915: Allow protected allocationsTomasz Figa4-6/+15
Allow allocations with BO_USE_PROTECTED. Moreover, disallow mapping of such BOs, as for GBM/Gralloc API callers it should not be mappable and considered as metadata alone, without usable content. BUG=b:64323695 TEST=emerge-eve arc-cros-gralloc Change-Id: I1dd1846a2042f97eee2fcc7581a91a60854e62cc Reviewed-on: https://chromium-review.googlesource.com/607808 Commit-Ready: Pawel Osciak <posciak@chromium.org> Tested-by: Pawel Osciak <posciak@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-18minigbm: i915: call DRM_IOCTL_I915_GEM_SET_DOMAIN when invalidatingGurchetan Singh1-12/+25
In the kernel, the i915_gem_set_domain_ioctl function calls these functions: - i915_gem_object_set_to_gtt_domain - i915_gem_object_set_to_cpu_domain These functions do various interesting things with caches, and some CTS tests require this to pass. BUG=b:67073097, b:67331142, chromium:764871 TEST=The following tests: 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 passes on Eve with the next patch applied. Change-Id: I9acc14580f65eab6039d8b354bfbf51c31dfcf14 Reviewed-on: https://chromium-review.googlesource.com/710323 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-17minigbm: add buffer invalidation functionGurchetan Singh4-1/+18
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-14minigbm: amdgpu: make bo's created with SCANOUT flag mmapableShirish S1-3/+3
amdgpu kenrel driver can mmap a 'bo' only if it has AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED flag set. This flag was not set in case if the 'bo' is used as a SCANOUT buffer, for several reasons like it might impact performance etc. But due to several requirements realted testing drm functionalitites like atomicity, multi-planes etc., this restriction needs to be removed. Several known tests related to performance have been done after making this change and none have shown glaring performance regressions. However it should be noted that in case we find any performance related regression in an un-tested scenario this patch needs to be reverted. BUG=b:65297611 TEST=On Kahlee, UI comes up. GLMark2 & GLbench autotests show no performance regression atomictest -t multiplanes passes WebGL Aquarium Change-Id: If629b64f3a14f843972b25d393a0a16058b3044e Signed-off-by: Shirish S <shirish.s@amd.com> Reviewed-on: https://chromium-review.googlesource.com/715037 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-13minigbm: respect map_flags in all casesGurchetan Singh5-5/+7
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-10minigbm: move gralloctest to this repoGurchetan Singh2-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>
2017-10-09minigbm: add validation during importGurchetan Singh1-7/+30
A common cause of bugs and security exploits are out-of-bounds memory accesses. Let's add some validation when importing the buffer to protect against this. BUG=b:65566935 TEST=Boot Android and play games on Eve Change-Id: I557f9b9849f267f5c87bb29648119b1c29695cd3 Reviewed-on: https://chromium-review.googlesource.com/692624 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-10-06Revert "minigbm: align multi-planar formats to 16"Daniel Charles1-6/+0
This reverts commit 6a8828492f4252a7c125a984823599bd65e3cb03. Revert reason: intel-vaapi-driver can relax height alignment alignment is only enforced on tiled surfaced, after confirming minigbm will provide linear surfaces, surfaces height needs to be 4 bit aligned. BUG=b/65272348 TEST="intel-vaapi-driver regular testing, VAVDA, VAVEA, VAJDA" TEST="minigbm media tests within container" TEST="tests mentioned in the bug" CQ-DEPEND=CL:671650 Change-Id: Ifdccca9d7f85be0cbb504c0c0a2b4712aed99826 Signed-off-by: Daniel Charles <daniel.charles@intel.com> Reviewed-on: https://chromium-review.googlesource.com/685296 Tested-by: Ricky Liang <jcliang@chromium.org> Reviewed-by: Ricky Liang <jcliang@chromium.org>
2017-10-05minigbm: Revert "minigbm: flush buffer instead of unmapping"Gurchetan Singh2-4/+7
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: pass in map flags to (*bo_map) callbackGurchetan Singh10-23/+35
Some eagle-eyed observers have commented that we lose some potentially useful information for the (*bo_map) callback when we convert our map flags to page protection flags. Let's not lose this information, so pass in the map flags. We can convert to page protection flags using a helper function. BUG=chromium:764871 TEST=Boot Android and play games on Eve Change-Id: Ie2cf395109eb5a8de663dfb97a343d20ff0df30c Reviewed-on: https://chromium-review.googlesource.com/691425 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 map flagsGurchetan Singh8-26/+39
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: amdgpu: Add formats R8, GR88Deepak Sharma1-1/+2
Add R8 and GR88 format for dma_bufs in amdgpu. Required to support native GMB video playback. If native GMB is enbaled,chrome transcodes NV12 to RGB by importing Y plane as R8 EGLImage and the UV plane as GR88 EGLImage. BUG=b:65302612 TEST=Boot Kahlee with --enable-native-gpu-memory-buffers and play youtube. Change-Id: Ifa7e50959bb5417088357a0c0aa3ac874ecf6fc9 Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> Reviewed-on: https://chromium-review.googlesource.com/695850 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-10-02minigbm: standardize naming of buffer creation flagsGurchetan Singh21-189/+192
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: pass in buffer creation flags of the right sizeGurchetan Singh12-14/+14
The buffer creation flags are uint64_t, not uint32_t. BUG=none TEST=emerge-eve {minigbm, arc-cros-gralloc} Change-Id: Id94911c5e19c00d47f2fbdca570a6a08fc92b82e Reviewed-on: https://chromium-review.googlesource.com/691422 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2017-09-29minigbm: remove buffer sizes when importingGurchetan Singh7-28/+19
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-28minigbm: clang-format and various nitsGurchetan Singh3-7/+2
BUG=NONE TEST=emerge-eve {minigbm, arc-cros-gralloc} Change-Id: I3418680828e7b69c6b5e1c56dcdba171aba92473 Reviewed-on: https://chromium-review.googlesource.com/691420 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-09-27minigbm: i915: use I915_MMAP_WC in certain casesGurchetan Singh1-0/+3
The Zero Latency Ink app is scanned out while the buffer is being updated (by design). The buffer update is racy with the display, leading to artifacts. Calling clflush on the buffer, even only on the rectangle specified by gralloc (*lock), makes no difference. As a result, let's map the buffer as uncached when it's being scanned out (we do the same thing on ARM). Let's make sure not affect renderscript buffers, since certain renderscript CTS tests require caching. BUG=chromium:762324 TEST=no overlay artifacts while using Zero Latency Ink app on Eve. Change-Id: I6f79dc8e48deee441790f737aba79c7f79ca4cb9 Reviewed-on: https://chromium-review.googlesource.com/665390 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: David Reveman <reveman@chromium.org>
2017-09-27minigbm: flush buffer instead of unmappingGurchetan Singh2-7/+4
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-27minigbm: add (*bo_flush) implementationsGurchetan Singh4-8/+38
Let's take the flush and writeback steps in the driver unmap functions and move them to the (*bo_flush) callback. BUG=chromium:764871 TEST=gbmtest, mmap_test -g on eve Change-Id: Iecccafc25642b120bc84f2d1b8538303c8ce36eb Reviewed-on: https://chromium-review.googlesource.com/668219 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-09-27minigbm: add drv_bo_flushGurchetan Singh3-5/+19
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-09-27minigbm: unmap right before buffer destructionGurchetan Singh3-12/+32
Regardless of the allocator, we want to make sure any mappings we create are eventually freed. This patch adds logic to drv_bo_destroy to free any mappings before the GEM close ioctl is called. BUG=chromium:764871 TEST=gbmtest, mmap_test -g on eve Change-Id: I8f4edb4bc01ff6e1d71a60e0309e77e9fc3840f4 Reviewed-on: https://chromium-review.googlesource.com/441916 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> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2017-09-26minigbm: add a default (*bo_unmap) implementationGurchetan Singh15-4/+19
The (*bo_unmap) function is responsible for unmapping the buffer and cleaning up any data allocated during (*bo_map). Previously, we called munmap in drv_bo_unmap(), which caused some confusion. This method is cleaner. BUG=chromium:764871 TEST=emerge-betty minigbm Change-Id: I4dc20cd6b15e79bce21d33f03ebc84480c582981 Reviewed-on: https://chromium-review.googlesource.com/671693 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Joe Kniss <djmk@google.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
2017-09-26minigbm: rockchip: Add support for buffers required by new camera subsystemJeffy Chen1-0/+13
It's much the same as what we did for i915 in: d30c0a5 (minigbm: i915: Add support for buffers required by new camera subsystem) https://chromium-review.googlesource.com/559315 BUG=b:65390035 TEST=test arc_camera3_test on scarlet, no more this error: [0905/104926:ERROR:camera3_test_gralloc.cc (76)] Can't detect flexible YUV 420 format Change-Id: Ib99687ff2aaaca0233fa950abbe8581bc3572b74 Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/670888 Reviewed-by: Tomasz Figa <tfiga@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>