summaryrefslogtreecommitdiff
path: root/marvell.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-16minigbm: make drv_add_combinations return nothingGurchetan Singh1-5/+2
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-08minigbm: re-const-ify driver backendsGurchetan Singh1-1/+1
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-09-26minigbm: add a default (*bo_unmap) implementationGurchetan Singh1-0/+1
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-05-23minigbm: remove BO_USE_RENDERING from certain formatsGurchetan Singh1-2/+9
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-7/+3
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-16minigbm: rework flag APIGurchetan Singh1-10/+5
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-01-13minigbm: add bo import callbackGurchetan Singh1-0/+1
Some drivers may want to import their own private data, so let's add a driver callback. BUG=none TEST=minigbm builds, gbmtest Change-Id: I96c06a84446c9be4ac3f5f858094c500d43a077f Reviewed-on: https://chromium-review.googlesource.com/424934 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2016-12-20minigbm: consolidate flagsGurchetan Singh1-5/+7
Let's try to organize the flags such that one entry in the supported combination list implies a certain type of buffer. For example, we only create linear buffers in our Mediatek, so the following entries are equivalent: {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, Since they both translate into a XRGB8888 linear buffer on Mediatek, let's merge the two entries. Do similiar operations for every driver. BUG=none TEST=try-bots Change-Id: I0be97c2deec5310f426632f85d1525a1345498e6 Reviewed-on: https://chromium-review.googlesource.com/421499 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-12-07minigbm: rename DRV_BO_USE_* to BO_USE_*Gurchetan Singh1-4/+4
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-7/+16
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-4/+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-08-17minigbm: Add mmap() in backendsGurchetan Singh1-0/+1
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-9/+9
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-06minigbm: remove GBM_BO_USE_WRITE from the drivers.Dongseong Hwang1-4/+4
We deprecated GBM_BO_USE_WRITE in Chrome OS, so we should remove it from the drivers. BUG=chromium:356871 CQ-DEPEND=CL:342391 Change-Id: I29c10817cf71ae51d12092f05228e92f342ca4e5 Reviewed-on: https://chromium-review.googlesource.com/341911 Commit-Ready: Dongseong Hwang <dongseong.hwang@intel.com> Tested-by: Dongseong Hwang <dongseong.hwang@intel.com> Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
2016-02-29minigbm: constify and staticify functions/structsStéphane Marchesin1-1/+1
A lot of these can be made const/static so let's do this. BUG=none TEST=compiles Change-Id: Id0b534ca477b25488b264622f062471063378c1c Signed-off-by: Stphane Marchesin <marcheu@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/329561 Commit-Ready: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
2016-02-27add GBM_BO_USE_LINEAR flag for bo creationZach Reizner1-0/+2
Some drivers will enable tiling with the other GBM_BO_USE_* flags as an optimization, but this interferes with reading/writing to mmapped buffers and other devices that might expect linear buffers. This CL adds an explicit request to minigbm to only allocate linear buffer objects. This request is only honored for buffers that meet all the following requirements: - YUV formats or ARGB/XRGB 32-bit formats. - Not combined with GBM_BO_USE_RENDERING A backend might still reject an allocation even if it meets those requirements. This CL also raises the limit on the number of driver formats to 16. TEST=on samus, run vgem_fb_test with GBM_BO_USE_LINEAR flag in gbm_bo_create BUG=None Change-Id: I8ca31c4c1753af816b13bd75e4feb5b76d153e2a Reviewed-on: https://chromium-review.googlesource.com/329248 Commit-Ready: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2015-12-03minigbm: Add marvell minigbm driver.Daniel Blum1-0/+23
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>