OSDN Git Service
summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Shawn Guo [Tue, 9 Jun 2020 13:33:13 +0000 (21:33 +0800)]
gralloc_gbm: add .lock_ycbcr to support video playback use case
The .lock_ycbcr function hook is currently missing from gralloc driver,
and that stops video playback from working. Add a .lock_ycbcr function
implementation to get SW video playback test start working, where
HAL_PIXEL_FORMAT_YV12 format is used/tested.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
[AmitP: Verified by playing a mp4 format file using s/w codec
(medaswcodec) on db845c running AOSP.]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Shawn Guo [Tue, 9 Jun 2020 01:30:40 +0000 (09:30 +0800)]
gralloc_gbm: fix gralloc_gbm_bo_lock() declaration
The variable names in gralloc_gbm_bo_lock() function declaration don't
match the definition in gralloc_gbm.cpp. Let's fix them to stop the
confusion.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Rob Herring [Tue, 3 Mar 2020 13:51:41 +0000 (07:51 -0600)]
Merge pull request #14 from johnstultz-work/null-crop-fix
gralloc_gbm: Handle null crop values
John Stultz [Tue, 3 Mar 2020 05:54:11 +0000 (05:54 +0000)]
gralloc_gbm: Handle null crop values
Yongqin recently reported an issue here:
https://bugs.linaro.org/show_bug.cgi?id=5566
Where the CTS VirtualDisplayTest is failing on db845c.
The trace looks like this:
arm64-v8a CtsDisplayTestCases[instant]: Instrumentation run failed
due to 'Process crashed.'
Crash Message:lock buffer failed for format 0x1
java.lang.RuntimeException: lock buffer failed for format 0x1
at android.media.ImageReader$SurfaceImage.nativeCreatePlanes(Native Method)
at android.media.ImageReader$SurfaceImage.getPlanes(ImageReader.java:898)
at android.display.cts.VirtualDisplayTest$ImageListener.scanImage(VirtualDisplayTest.java:381)
at android.display.cts.VirtualDisplayTest$ImageListener.onImageAvailable(VirtualDisplayTest.java:364)
at android.media.ImageReader$ListenerHandler.handleMessage(ImageReader.java:798)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.os.HandlerThread.run(HandlerThread.java:67)
What seems to be happening, is that the call chain looks like:
in frameworks/base/media/jni/android_media_ImageReader.cpp:
nativeCreatePlanes() ->
Image_createSurfacePlanes() ->
Image_getLockedImage() ->
frameworks/base/media/jni/android_media_Utils.cpp:
lockImageFromBuffer():
Which then calls the other lockImageFromBuffer() with a uninitialized
bufferItem->mCrop value:
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/media/jni/android_media_Utils.cpp;l=386
That then calls: buffer->lockAsync(inUsage, rect, &pData, fenceFd);
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/media/jni/android_media_Utils.cpp;l=353
which calls into gralloc::lock() in the gralloc_gbm implementation.
gralloc_gbm::gralloc_gbm_bo_lock() calls gbm_map():
https://github.com/robherring/gbm_gralloc/blob/master/gralloc_gbm.cpp#L435
gralloc_gbm::gbm_map() calls gbm_bo_map():
https://github.com/robherring/gbm_gralloc/blob/master/gralloc_gbm.cpp#L284
Which returns an error if height or width is zero:
https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/src/gbm/main/gbm.c#L560
While not common, since some users are passing null crop rects,
I propose we consider null crop rects to be the same as the
entire buffer.
Thus this patch special cases these null rects and changes the
width and height value to be the full buffer width and height.
With this patch, the affected CTS tests no longer fail.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Rob Herring [Mon, 19 Aug 2019 11:01:35 +0000 (06:01 -0500)]
Merge pull request #12 from rsglobal/fixes-pr
Fixes
Roman Stratiienko [Sat, 10 Aug 2019 19:37:09 +0000 (22:37 +0300)]
Use log/log.h instead of cutils/log.h
Using cutils/log.h is deprecated and produces build warning.
Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Roman Stratiienko [Sat, 10 Aug 2019 19:22:46 +0000 (22:22 +0300)]
Add libhardware dependency
Fixes missing hardware/gralloc.h header build error.
Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Roman Stratiienko [Sat, 10 Aug 2019 19:13:40 +0000 (22:13 +0300)]
Add missing include required for close()
Fixes build error with Android-Q
Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
Roman Stratiienko [Sat, 10 Aug 2019 19:09:21 +0000 (22:09 +0300)]
Revert "replace delete with free"
Fixes "handle is undefined" build error.
This reverts commit
4a94ab2ef43bbbd0abe636b5988119ebe933e846.
Elliott Wen [Tue, 3 Jul 2018 04:38:39 +0000 (16:38 +1200)]
replace delete with free
Mauro Rossi [Fri, 29 Jun 2018 11:45:10 +0000 (13:45 +0200)]
Update usage flag handling for hwc
Add support for GRALLOC_USAGE_HW_COMPOSER usage flag
mapping it to GBM flags, inspired by minigbm implementation.
Fixes the artifacts issues with vulkan hal radv with the following apps
with benefit to all apps using HWC layers:
V1 - GPU Benchmark Pro (Vulkan API)
PPSSPP - PSP emulator
Sascha Willems Vulkan Examples (e.g. Vulkan Gears, Vulkan Texture)
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 15 Feb 2018 21:59:41 +0000 (15:59 -0600)]
Switch to use gralloc handle defined in libdrm
Remove our custom handle definition and use the one defined in libdrm.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 15 Feb 2018 22:15:57 +0000 (16:15 -0600)]
Use a std::unordered_map to lookup BOs from handles
Remove the fragile dependency on the handle 'data' pointer and
'data_owner' flag.
This idea is stolen from the CrOS minigbm gralloc implementation.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 16 Feb 2018 14:07:42 +0000 (08:07 -0600)]
Remove GRALLOC_MODULE_PERFORM_GET_USAGE
This is no longer used by drm_hwc and can be removed.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 16 Feb 2018 16:23:26 +0000 (10:23 -0600)]
Move gralloc_gbm_handle_t accesses into gralloc_gbm.cpp
The only access to the gralloc_gbm_handle_t in gralloc.cpp is to set the
stride of allocated buffers. Move this into gralloc_gbm.cpp to isolate
accesses to the struct in one place.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 24 Jan 2018 14:21:50 +0000 (08:21 -0600)]
Explicitly include string.h
The master build started failing on strcmp and memset being undeclared, so
explicitly include string.h.
Change-Id: I55d042b34e55375ed50f9300ab0c3abdfa0f2631
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 29 Nov 2017 16:29:38 +0000 (10:29 -0600)]
Fix unused parameter 'handle' warning
AOSP now builds with -Werror. Fix this warning:
gralloc_drm_handle.h:90:62: error: unused parameter 'handle' [-Werror,-Wunused-parameter]
Change-Id: Ief13c01f0ca1ede2b9ef5662acbdc6d0f27f6cd4
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 25 Oct 2017 18:41:54 +0000 (13:41 -0500)]
Use native_handle functions
Use native_handle_{create,delete} functions instead of the C++
alloc/free. This will do the initialization for us instead of open
coding it.
Change-Id: I285292770ca756c1d2c2effa5c73e252526bae0c
Signed-off-by: Rob Herring <robh@kernel.org>
Chih-Wei Huang [Wed, 4 Oct 2017 07:31:02 +0000 (15:31 +0800)]
Fix 32-bit app crashing in 64-bit Android
Seemingly the 64-bit int is always aligned to 8 in LP64.
But this is not hold in LP32.
Consequently sizeof(gralloc_drm_handle_t) are different
between LP64 (which is 18 ints) and LP32 (which is 16 ints).
As a result, 32-bit apps will crash in 64-bit OS since the
checking handle->base.numInts != GRALLOC_GBM_HANDLE_NUM_INTS
is true.
Fix it by always aligning 64-bit int to 8. Besides, to avoid
additional padding, just exchange the order of data_owner
and modifier. It aligns modifier to 8 natually.
This makes gralloc_drm_handle_t fit in 16 ints perfectly.
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Rob Herring [Fri, 15 Sep 2017 13:51:29 +0000 (08:51 -0500)]
Android: move libraries to /vendor
As part of Treble project in Android O, all the device specific files have
to be located in a separate vendor partition. This is done by setting
LOCAL_PROPRIETARY_MODULE (the name is misleading). This change will not
break existing platforms without a vendor partition as it will just move
files to /system/vendor.
Change-Id: I0e863d55406b3e2457bbaded818e7fd4f19f064a
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 30 Aug 2017 13:41:45 +0000 (08:41 -0500)]
Convert gralloc_gbm_bo_t to gbm user data
Instead of wrapping struct gbm_bo with our own BO struct, make the
struct GBM BO userdata instead. This makes things clearer as to what a
BO is.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 30 Aug 2017 00:23:35 +0000 (19:23 -0500)]
kill off gralloc_gbm_get_pid
Caching getpid() calls seems pointless, so remove the added
complexity and just use getpid() directly when needed.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 30 Aug 2017 00:14:21 +0000 (19:14 -0500)]
Rework handle register/unregister calls
What validate_handle() did was ambiguous and broken for binderized
gralloc. Reusing the existing BO pointer for gralloc_gbm_handle_register
is broken because the BO may get freed. It is necessary to always import
the buffer. So split validate handle into separate functions to retrieve
the BO ptr and import the buffer.
Change-Id: I4ea18aa0ded2d201c8f71f4e33a8fc893240d109
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Tue, 29 Aug 2017 23:00:50 +0000 (18:00 -0500)]
remove handle from BO
Pass the handle to internal functions instead of the BO pointer, then we
can always get the BO from the handle and never need to get the handle
from the BO.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Tue, 29 Aug 2017 23:43:12 +0000 (18:43 -0500)]
Rework unregister/free code
It is not necessary to track imported buffers nor ref count them and
doing so is broken when native handles are cloned. So remove all the
related code and separate the unregister and free code paths.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 24 Aug 2017 14:38:25 +0000 (09:38 -0500)]
Don't close fds on imported buffers
The fds should only be closed if we allocated the handle.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Tue, 11 Jul 2017 23:13:57 +0000 (18:13 -0500)]
gbm_import: fix missing gbm_import_fd_modifier_data initialization
With gbm_import_fd_modifier_data, some fields are not getting
initialized and in particular offset[0] is not which causes import
failures. Add memset to ensure all fields are initialized.
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Rob Herring <robh@kernel.org>
Aleksander Morgado [Tue, 4 Jul 2017 21:08:27 +0000 (23:08 +0200)]
Sync with the gbm API to import FD with modifier
Commit
4026744fcb31f1d27c1b32e6945aadd4da415c6d in mesa introduced an
updated `struct gbm_import_fd_modifier_data' with arrays for fds,
strides and offsets, instead of single values.
Fix just by specifying one single item in the arrays.
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Robert Foss [Thu, 1 Jun 2017 00:39:58 +0000 (20:39 -0400)]
Add support for modifiers
Modifiers are used to describe buffer metadata like if and how they are
compressed or if tiling is used.
This is needed to allow different devices to communicate about buffers
that have these properties.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Robert Foss [Tue, 16 May 2017 16:27:58 +0000 (12:27 -0400)]
Add description of GRALLOC_MODULE_PERFORM_GET_DRM_FD
Add description of the perform call GRALLOC_MODULE_PERFORM_GET_DRM_FD.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Robert Foss [Thu, 11 May 2017 21:32:56 +0000 (17:32 -0400)]
Change #include guard to reflect filename
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Rob Herring [Thu, 8 Jun 2017 20:45:53 +0000 (15:45 -0500)]
Add libgralloc_drm library to export headers to mesa
Mesa mainline depends on libgralloc_drm shared library for importing
include paths. Add a dummy library for this purpose. This gets mesa master
building without any additional patches. Patches are still needed for
proper functioning.
Change-Id: Ib9577d0b7af028091f0c6f61d8dd2340cc8425d0
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 13 Apr 2017 18:54:36 +0000 (13:54 -0500)]
Fix missing 0 init of alloc_device_t
This fixes a crash of "dumpsys SurfaceFlinger" because the dump() pointer
is not NULL.
Change-Id: If4c1f71fd532e21bb246c1b815b8b9ca00bb405b
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 13 Apr 2017 18:53:26 +0000 (13:53 -0500)]
Quiet log prints changing them to verbose level
Quiet down various informational tracing messages switching them to
verbose log level
Change-Id: I0a78a9bcb1f807dc2db060ab1551cd5f62fa3f2d
Signed-off-by: Rob Herring <robh@kernel.org>
John Stultz [Wed, 29 Mar 2017 03:48:36 +0000 (20:48 -0700)]
gbm_gralloc: Remove the invalid int cast and assignment in gbm_mod_perform()
In gbm_mod_perform(), for the cmd GRALLOC_MODULE_PERFORM_GET_USAGE,
the code takes the third argument, casts it as an int* and then writes
a zero into what the pointer points to.
The problem with this is that the third argument to that function is
actually a native_handle_t, so writing zero to the first int in that
structure ends up overwriting the version value, causing the
native_handle_t code to see the value as corrupt.
This results in lots of warnings and leaked fds.
Change-Id: If64770c164557b467f76ca97ddc182565730d394
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Wed, 22 Mar 2017 16:45:29 +0000 (11:45 -0500)]
Change module name to gralloc.gbm
Originally, the intent was to make GBM gralloc a drop-in replacement for
DRM gralloc, but this isn't really happening or needed. Change the name
so both can coexist.
Change-Id: I4eff839523213cc76c56746275d8ba7534ba9c12
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Tue, 13 Dec 2016 15:37:06 +0000 (09:37 -0600)]
Fix mapping for non-zero starting coordinates
While the gralloc API allows for specifying the starting coordinates (L,T),
it seems this doesn't really work. No other gralloc implementations found
use the rectangle bounds. Not exactly sure how this ever worked, but it
broke recently with AOSP master.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Thu, 8 Sep 2016 22:45:03 +0000 (17:45 -0500)]
Add YV12 pixel format support
GBM doesn't support YV12 and we need a single buffer, so request GR88 from
GBM instead and adjust the width and height. GR88 also ensures (hopefully)
that the GPU texture alignment requirements are met.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Tue, 19 Jul 2016 03:06:03 +0000 (22:06 -0500)]
Remove unused gralloc_drm_handle_t::name
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
[robh: keep the name member for now for ABI/API compatibility with mesa]
Signed-off-by: Rob Herring <robh@kernel.org>
Emil Velikov [Mon, 18 Jul 2016 15:10:26 +0000 (16:10 +0100)]
Use alternative GRALLOC_GBM_HANDLE_MAGIC
Using 0x5f47424d ("_GBM") is less likely to colide than the generic
0x12345678.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Mon, 18 Jul 2016 15:51:12 +0000 (16:51 +0100)]
Open the device node with O_CLOEXEC
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
Not 100% sure it is supported on Android.
Emil Velikov [Mon, 18 Jul 2016 15:47:54 +0000 (16:47 +0100)]
Don't leak the FD in the gbm_dev_create error path
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Mon, 18 Jul 2016 15:46:51 +0000 (16:46 +0100)]
Kill off unused variable
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Rob Herring [Tue, 25 Oct 2016 21:52:01 +0000 (16:52 -0500)]
Merge pull request #2 from robertfoss/master
GRALLOC_MODULE_PERFORM_GET_USAGE stub and compiler warning fix
Robert Foss [Fri, 16 Sep 2016 21:21:11 +0000 (17:21 -0400)]
Stub out GRALLOC_MODULE_PERFORM_GET_USAGE
This implements an initial stub for GRALLOC_MODULE_PERFORM_GET_USAGE
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Robert Foss [Fri, 16 Sep 2016 22:28:26 +0000 (18:28 -0400)]
Silence compiler type narrowing errors
Add static_cast to op, to prevent compiler warnings.
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Rob Herring [Wed, 1 Jun 2016 21:30:34 +0000 (16:30 -0500)]
Fix RGB565 pixel format type
The component ordering was wrong causing GBM allocation failures.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 22 Apr 2016 17:54:14 +0000 (12:54 -0500)]
Clean-up of unused code
Remove some unused code throwing warnings.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 22 Apr 2016 17:52:45 +0000 (12:52 -0500)]
gbm_map: update to revised gbm_bo_map API
Add stride return parameter and properly pass usage flags.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Fri, 22 Apr 2016 17:50:35 +0000 (12:50 -0500)]
Update usage flag handling
Add missing support for GRALLOC_USAGE_SW_READ_OFTEN,
GRALLOC_USAGE_SW_WRITE_OFTEN, GRALLOC_USAGE_HW_TEXTURE, and
GRALLOC_USAGE_CURSOR usage flags mapping them to GBM flags.
For now, cursor flag is commented out because the Android side doesn't seem
to honor a larger stride.
Signed-off-by: Rob Herring <robh@kernel.org>
Rob Herring [Sun, 12 Jun 2011 08:21:30 +0000 (16:21 +0800)]
Initial GBM based gralloc
Based on drm_gralloc. Some remants of drm_gralloc remain to be
compatible with mesa and drm_hwcomposer.
Signed-off-by: Rob Herring <robh@kernel.org>