summaryrefslogtreecommitdiff
path: root/mediatek.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-16minigbm: make drv_add_combinations return nothingGurchetan Singh1-9/+4
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: use struct vma for (*bo_map)/(*bo_unmap) callbacksGurchetan Singh1-10/+9
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-08minigbm: refactor and rename mapping structGurchetan Singh1-12/+13
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: 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-10-13minigbm: respect map_flags in all casesGurchetan Singh1-1/+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: pass in map flags to (*bo_map) callbackGurchetan Singh1-2/+3
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 buffer creation flagsGurchetan Singh1-3/+3
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 Singh1-1/+1
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-28minigbm: clang-format and various nitsGurchetan Singh1-1/+0
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: add (*bo_flush) implementationsGurchetan Singh1-1/+11
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-08-05minigbm: rockchip/mediatek: keep a local cached mapping of the bufferGurchetan Singh1-1/+33
All GEM mappings are write-combined by default. This leads to performance issues with renderscript CTS tests on ARM boards. Let's keep a local copy of the buffer in the hopes of improving the test's performance. BUG=b:38097499 TEST=run cts -m CtsViewTestCases -t android.view.cts.SurfaceViewSyncTests passes on 9776.0.0 veyron_minnie Change-Id: I74da770f42524e66ca643adfbe9475362ee397cc Reviewed-on: https://chromium-review.googlesource.com/602736 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2017-07-11Plumb buffer map permissions through gbm.Joe Kniss1-3/+2
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-06-22minigbm: Ensure DRM_FORMAT_YVU420_ANDROID meets Android requirements.Owen Lin1-1/+1
For HAL_PIXEL_FORMAT_YV12 (mapped to DRM_FORMAT_YVU420_ANDROID), it needs to meet the following requirements: - The vertical stride must equal to the buffer's height. - The chroma stride is 16-byte aligned. As a result, stop mapping DRM_FORMAT_FLEX_YCbCr_420_888 to DRM_FORMAT_YVU420_ANDROID. The format is used for hardware decoding, It has more restrictions on the alignments of the width or height. Bug: b:31479749 Test: Run the testOtherVP8ImageReader and testGoogH264ImageReader of android.media.cts.ImageReaderDecoderTest. Change-Id: Id37f51115ed8b1937ca7d6e48abd809235b43fe4 Reviewed-on: https://chromium-review.googlesource.com/526758 Commit-Ready: Owen Lin <owenlin@chromium.org> Tested-by: Owen Lin <owenlin@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-05-23minigbm: remove BO_USE_RENDERING from certain formatsGurchetan Singh1-5/+18
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-05-02Add HAL_PIXEL_FORMAT_BLOB format in cros grallocHeng-Ruey Hsu1-4/+4
We convert HAL_PIXEL_FORMAT_BLOB to DRM_FORMAT_R8 for camera picture taking. Choose DRM_FORMAT_R8 because <system/graphics.h> requires the buffers with a format HAL_PIXEL_FORMAT_BLOB have a height of 1, and width equal to their size in bytes. BUG=b:37692495 TEST=open camera app and take a picture. Change-Id: I11a82b057b7c1174dd946e0b7d3cbde9c1d630d9 Reviewed-on: https://chromium-review.googlesource.com/487552 Commit-Ready: Heng-ruey Hsu <henryhsu@google.com> Tested-by: Heng-ruey Hsu <henryhsu@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2017-03-31minigbm: fix long lines missed by clang-formatGurchetan Singh1-2/+1
We have 100-lines to work with now. BUG=none TEST=compiles Change-Id: I08f41a42d8841ac82c5a6defbcbc712722179fce Reviewed-on: https://chromium-review.googlesource.com/457286 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-15/+15
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/+4
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-20minigbm: add DRM_FORMAT_YVU420_ANDROIDGurchetan Singh1-2/+3
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-16minigbm: rework flag APIGurchetan Singh1-21/+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-02-18minigbm: align first plane to 64 bytesGurchetan Singh1-0/+6
The chroma stride of Android YV12 buffers is required to be aligned to 16 bytes (see <system/graphics.h>). Additionally, the size of the ARM L1 cache line is 64-bytes (see chrome-os-partner:45777). Let's always align the first plane to 64 bytes. The chroma strides will be aligned to 32 bytes in that case. BUG=chromium:616275 TEST= ImageReaderDecoderTest#testGoogH264ImageReader passes on veyron_minnie-cheets. Change-Id: I87a309ce0612bf8c5be8f8e47dad3da10d61a081 Reviewed-on: https://chromium-review.googlesource.com/441912 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Tomasz Figa <tfiga@chromium.org>
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-10/+9
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-09minigbm: mediatek: add support HAL_PIXEL_FORMAT_YV12Gurchetan Singh1-1/+2
For some reason, we use HAL_PIXEL_FORMAT_YV12 instead of HAL_PIXEL_FORMAT_YCbCr_420_888 as our YUV format on mediatek based boards. We also pass down a different use flags. Since mediatek only supports linear buffers the moment, just lump all the flags together for our YUV supported combination. BUG=chromium:616275 TEST=Played Youtube video in Oak ARC++ container CQ-DEPEND=CL:416292 Change-Id: Iac4797517048981235cd17ad464eb1e3852c4072 Reviewed-on: https://chromium-review.googlesource.com/416396 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-10/+10
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-21/+30
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-13/+13
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-08minigbm: mediatek: Do not scan out ABGR8888/XBGR8888Nicolas Boichat1-2/+2
Adding ABGR8888 breaks the software cursor on ARC++, XBGR8888 is not supported by the DRM driver. BUG=b:32554065 BUG=chrome-os-partner:59436 TEST=Open play store on elm, cursor appears fine. Change-Id: I7366d2b2acfc50415c381131ba7cf8b70c0de5d8 Reviewed-on: https://chromium-review.googlesource.com/408536 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-10-20minigbm: Remove SCANOUT flags from YV12Gurchetan Singh1-2/+2
All of these drivers don't support the ability to directly scan-out YV12 to the display, so this should not be set. Let's set rendering flags since the expected use case is importing Android YV12 buffers into EGL. BUG=b/32260847 TEST=AdaptivePlaybackTest#testH264_adaptiveDrc Change-Id: I53d4eaf9c3f359c1c83762cf3e655cc0cf5168d5 Reviewed-on: https://chromium-review.googlesource.com/401040 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-10-18minigbm: mediatek: add required Android buffersGurchetan Singh1-2/+10
We need ABGR8888, XBGR8888, and RGB565 buffers for mediatek. We also need to add certain flags to our flexible YUV formats. BUG=chromium:616275 TEST=run dEQP EGL tests on elm. CQ-DEPEND=CL:398424 Change-Id: Ia3122b4e792911575e13fcbeb4f77b5691290a2d Reviewed-on: https://chromium-review.googlesource.com/399924 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: Fix the flag situationGurchetan Singh1-14/+8
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-13minigbm: More sophisticated gbm_bo_map/gbm_bo_unmapGurchetan Singh1-1/+3
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-09-02minigbm: Map and unmap correct sizeGurchetan Singh1-3/+2
We were not mapping the entire buffer for multi-plane buffer objects. BUG=chromium:616275 TEST=NONE CQ-DEPEND=CL:377884 Change-Id: Ia64a6eb45310abeaed3f376479a6738ccd09f0bf Reviewed-on: https://chromium-review.googlesource.com/377841 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2016-09-02minigbm: Added YV12 for Mali platformsGurchetan Singh1-9/+24
Oak-cheets is using YV12 as it's Android flexible YUV format, so we need to support it. Additionally, we're trying to enable YV12 on Mali with EXT_image_dma_buf_import. Instead of having redundant switch statements in every driver, let's add a helper function to do this. BUG=chrome-os-partner:54632, b/29059119, chromium:616275 TEST=Ran plane_test, graphics_Gbm on veyron_minnie Change-Id: I4798225db809941367e58dde962576535b8d767c Reviewed-on: https://chromium-review.googlesource.com/377884 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: Add YV12 for i915Gurchetan Singh1-1/+1
At the moment, the ArcCodec produces YV12 on Intel. The gralloc module should support it, atleast temporarily until UYVY hardware overlays are enabled on CrOS. TEST=ran graphics_Gbm, tested Chrome boots on Cyan BUG=b/29335168, chromium:616275 CQ-DEPEND=CL:372359 Change-Id: I27c888d3467aa89e8ca48b22523cbc76973aa314 Reviewed-on: https://chromium-review.googlesource.com/373048 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-4/+14
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: Remove drv prefix from static backend functionsGurchetan Singh1-6/+5
It doesn't make sense to have the drv prefix for static backend functions, so remove it. TEST=minigbm still builds CQ-DEPEND=CL:370798 Change-Id: I65272162b8c7cf5d3716c7e5fcf0475c35522c47 Reviewed-on: https://chromium-review.googlesource.com/371501 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
2016-08-17minigbm: Add mmap() in backendsGurchetan Singh1-1/+21
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-13/+13
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-3/+4
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>
2016-01-23Support multi-plane buffers.Yuly Novikov1-4/+7
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>
2015-11-09Misc style/indent fixesStéphane Marchesin1-1/+2
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-04-10minigbm: add spew on IOCTL failures.Ilja H. Friedel1-1/+5
Having spew on errors would have made debugging the Netflix double fd close more obvious. BUG=chromium:462459, chromium:464628 TEST=Builds for link, tegra, nyan. Change-Id: I050794fbca8e9291752e52119751847ffcacd798 Reviewed-on: https://chromium-review.googlesource.com/265065 Reviewed-by: Ilja Friedel <ihf@chromium.org> Commit-Queue: Ilja Friedel <ihf@chromium.org> Tested-by: Ilja Friedel <ihf@chromium.org>
2015-03-25minigbm: Add mediatek drm to minigbmJB Tsai1-0/+47
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>