Commit graph

85 commits

Author SHA1 Message Date
Peter Collingbourne
f2ed293b9b gralloc: Configure framebuffer mode according to requested image format.
Previously we were ignoring the requested image format when mapping a graphics
device via gralloc_alloc, and using the mode that the framebuffer started up
in. This meant that on devices whose framebuffer starts up in a mode other
than RGBA8888, we would map the framebuffer in the other mode and attempt to
use it as an RGBA8888 framebuffer, which would lead to crashes or incorrecet
rendering. This is the case in the ARM FVP, whose framebuffer starts up in
RGB565 mode.

Unfortunately there is no preferred image format passed in to fb_device_open,
and we presumably cannot start passing one in for backwards compatibility
reasons. Therefore, we set the image format to RGBA8888, which appears to
be the only format that the platform ends up using.

Bug: 142352330
Change-Id: I24000fd36910b4044ce7659605efc423e36cba00
2019-10-15 17:50:25 -07:00
George Burgess IV
4028ac9ae6 Fix a memory leak
If status < 0, we'd silently leak dev.

Bug: None
Test: Ran the analyzer; memory leak warnings are gone.
Change-Id: I76a78feea4c92aa167de908f5571481864d61d73
2018-02-13 00:33:26 +00:00
Chih-Hung Hsieh
5c0702fb58 Fix compiler warnings.
* Remove unused local variables, functions, and private fields.

Bug: 66996870
Test: normal build
Change-Id: I3a5d6035a61be1b846dc8df3807088d2ca5dc4a3
2017-12-19 13:42:15 -08:00
Steven Moreland
a81298a515 gralloc: fix dependencies
am: e7722d4e3f

Change-Id: Ic543ed400eacd52ee4a99119776e1378e2358e91
2017-04-18 02:01:48 +00:00
Steven Moreland
e7722d4e3f gralloc: fix dependencies
Test: works with BOARD_VNDK_VERSION := current
Bug: 33241851
Change-Id: I145488dbf9b6e5257bee47920643c03c31eafbf4
2017-04-17 16:30:05 -07:00
Mark Salyzyn
1ae7379baa resolve merge conflicts of 7c451a93 to oc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: 34250038
Change-Id: I4196a6d5a1365106643ac6c1548fd86faffead6f
2017-04-12 09:11:38 -07:00
Mark Salyzyn
d88dfe8607 libhardware: deprecate cutils/log.h
Replace cutils/log.h with log/log.h. Sort headers. Minimize conflicts.
Add missing required headers.

Test: compile
Bug: 34250038
Change-Id: I5c0f231cbfed90b73e0538c9d32ad3226c7cc5e4
2017-04-11 10:50:06 -07:00
Po-Chien Hsueh
c535b2fded Move default HAL libraries to vendor
Libraries under /hardware/libhardware/modules should go to /vendor/.

These are conventionl HALs for default implementations, most of them
are not used.

Camera and thermal are already moved in other CLs.

Bug: 35907904
Test: Compiled and checked install path. Verified on Sailfish with
$ lsof | grep default.

Change-Id: Ibde574001c01cbfea014a20a0fbbb3265e6cdc8a
2017-03-07 11:28:32 +08:00
Romain Guy
d0eb44c6da Add support for *_FP16 pixel formats
Bug: 32984164
Test: compile
Change-Id: I0851c62f140801c6784fdb597b3d947402aa5876
2016-12-16 09:53:20 -08:00
Chih-Hung Hsieh
5aeef066b1 Merge \"Fix google-explicit-constructor warnings in libhardware\"
am: 99d2543a12

Change-Id: I28fe5fb49377f03bc962730ad8b51202e16f5854
2016-06-30 23:14:35 +00:00
Chih-Hung Hsieh
928e679cf3 Fix google-explicit-constructor warnings in libhardware
Bug: 28341362
Change-Id: I29a56734e54740e4b15fe2f6cacbbd867163ae79
Test: build with clang-tidy
2016-06-30 14:21:20 -07:00
Nicolas Capens
bd9860160a Adjust gralloc to SwiftShader's requirements.
SwiftShader processes 2x2 tiles of pixels simultaneously.
4 bytes of padding are required for reading 4-byte pixels in 8-byte chunks.

Change-Id: Ieb73df07859251cd0e5a649f9f3f16a318276e28
2015-10-05 17:12:46 -04:00
Elliott Hughes
8a241b82a9 am 69164f04: Merge "Lose HAVE_ANDROID_OS from hardware/libhardware."
* commit '69164f045f62741460fcb4308025fcefa49fe38a':
  Lose HAVE_ANDROID_OS from hardware/libhardware.
2015-08-13 00:40:27 +00:00
Elliott Hughes
ca6ccd924e Lose HAVE_ANDROID_OS from hardware/libhardware.
Change-Id: I9f6bd154479e368aab0ff20798676d9cd409955c
2015-08-12 16:42:13 -07:00
Eino-Ville Talvala
e69efbbabf Replace/rename old HAL graphics formats
- Replace RAW_SENSOR with RAW16
 - Remove sRGB formats

Change-Id: Ic5c44878c638c3d3559495ea5685e10fcc2c39e1
2015-03-06 13:19:36 -08:00
Elliott Hughes
65d51a15a7 Remove ARCH_X86.
Should have been __GLIBC__, but the code is dead anyway.

Change-Id: I773f296a9c31949fa631cad863b841584c71f0ef
2014-12-04 16:20:52 -08:00
David Turner
3e618a6aa1 Merge "gralloc: let target configure page flipping ioctl" 2014-07-04 08:02:36 +00:00
Bernhard Rosenkraenzer
5641642a20 gralloc: let target configure page flipping ioctl
Let vendor choose which framebuffer ioctl (FBIOPUT_VSCREENINFO or
FBIOPAN_DISPLAY) is best suited to do page-flip on its target platform.
Neither API is well documented about their usage and most of the
time it really depends on the respective framebuffer driver implementation.

* Default ioctl to do page-flip is FBIOPUT_VSCREENINFO.
* Set "TARGET_USE_PAN_DISPLAY=true" in board config file to use FBIOPAN_DISPLAY.

Change-Id: Ic3a50bd0f5fe37ac0149e11649c4abdadea85529
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2014-06-02 17:41:36 +05:30
Jesse Hall
282ab1b6b1 Merge "gralloc: dont hardcode 32bpp as RGBX" 2014-03-06 19:04:07 +00:00
Greg Hackmann
f5811ba2df gralloc: make private_handle_t layout consistent on 32/64-bit
private_handle_t's memory layout must be consistent between the 32-bit
and 64-bit gralloc, in case buffers are passed between processes.
Replace the (variably sized) uintptr_t base with a fixed size uint64_t,
and enforce 8-byte alignment for architectures where uint64_t alignment
varies between 32-bit and 64-bit.

Change-Id: I06cb31d4b9620ea18e5b50d3a3142b5adb2d2a14
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-03-03 13:37:11 -08:00
Elliott Hughes
6caa78dc37 Move libhardware of <asm/page.h>.
Change-Id: I7cf9d04828f19b8d7d1d3b8948bef580b101b10c
2014-02-24 15:50:34 -08:00
Bernhard Rosenkraenzer
5e3ac6bc71 gralloc: dont hardcode 32bpp as RGBX
Not every 32bpp is in RGBX format.

Change-Id: Ic3c6a0cbf475bff2fe2fc4b023c6bc58e4fc295e
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2014-02-21 19:28:56 +05:30
Ashok Bhat
d2be74aa57 AArch64: Calculate private_handle_t's numInts
A constant sNumInts with a value of 6 was being assigned to the numInts
attribute in the private_handle_t constructor, and was also used in the
validate method. That constant value is appropriate for 32-bit systems
but is not appropriate for a 64-bit system where uintptr_t used for
base attribute will be 64-bit.

sNumInts is now changed to a static inline function that calculates
numInts.

Change-Id: I482ddb5915c9ff55fb2e2a87887a0ec2dc2299ed
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-07 17:52:08 +00:00
Colin Cross
febaaa937f gralloc: fix warnings
Fix LP64 pointer casting warnings, unused parameters, and
turn off missing initializer warnings.

Change-Id: Idb70f4534282fed64ae81cb1e154d3f5b93091b0
2014-02-05 18:21:09 -08:00
Colin Cross
3557abaae2 hardware/libhardware: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH
LOCAL_MODULE_PATH doesn't work for multiarch builds, replace it
with LOCAL_MODULE_RELATIVE_PATH.

Change-Id: I4e4ceec61d026bbe74ba604554c06104bde42e5e
2014-01-24 21:00:32 -08:00
Rom Lemarchand
0287721d28 gralloc: delete unused mutex declaration
Change-Id: Ibc7e70887b61f7dd885c86d412387636d3a6a867
2013-11-26 10:01:25 -08:00
The Android Open Source Project
bae5cf92cf Merge commit 'c9940a2bfe94dbe2ef3bfe5e8692bf4e3cea5ba0' into HEAD 2013-11-22 10:35:26 -08:00
synergy dev
6abbed5093 gralloc: do not use GNU old-style field designators
Avoiding the use of gnu extensions improves code portability

Change-Id: Icf8e3d4813bcddff40548bb5e65e615f8697b75c
2013-11-06 17:29:22 -08:00
Mathias Agopian
ba9c8badb7 get rid of HAL pixelformats 5551 and 4444
Change-Id: I196ee30ed57707ed4cc46fb3a9c5c07c5bac6fff
2013-07-26 16:23:33 -07:00
Jesse Hall
0d8f81a984 Log when creating a second buffer mapping in a process
Bug: 8468756
Change-Id: Ia883f459ea9e2648ca4a0b5a6f09ded4f46f13b3
2013-03-28 16:51:25 -07:00
Jesse Hall
c71b6caece Remove pid check in register/unregister
The register/unregister gralloc calls were avoiding
mmapping/munmapping the shared memory region if the buffer was created
by the current process. This is left over from the pmem-based
implementation, where trying to map the same region twice in the same
process would fail, or would reuse a single mapping without
refcounting.

This causes problems if a buffer is
- allocated in process A,
- transferred from A to process B and registered there
- unregistered/freed in A
- transferred back from B to A and re-registered

Process A then has a new handle to the buffer, but since it originally
created the buffer it will not be mmapped, so trying to read or write
the buffer will crash.

With ashmem, mmaping a region twice in the same process creates two
distinct mappings which can be used and munmapped independently. So
we no longer need to avoid mmapping again in the allocating process.

Bug: 8468756
Change-Id: I167bec5ca07e5534c5e2115630fe8386e481388e
2013-03-28 11:21:25 -07:00
Jean-Baptiste Queru
186f8c5268 am 8405fe5a: am 1fbbb08d: Merge "remove seemed useless gralloc_open() call in fb_device_open()"
* commit '8405fe5a5203af18f39fd47b35606f0b32cd956c':
  remove seemed useless gralloc_open() call in fb_device_open()
2012-06-12 15:18:23 -07:00
Jean-Baptiste Queru
8405fe5a52 am 1fbbb08d: Merge "remove seemed useless gralloc_open() call in fb_device_open()"
* commit '1fbbb08ddda4321ccdb05345658044c1f0235997':
  remove seemed useless gralloc_open() call in fb_device_open()
2012-06-12 15:16:18 -07:00
Eino-Ville Talvala
984272d92e Add RAW_SENSOR to gralloc sample
Change-Id: I0621bd70896385c3d522d283a1be714f5f29df3b
2012-05-07 11:01:17 -07:00
suyi Yuan
539c9936ae remove seemed useless gralloc_open() call in fb_device_open()
Change-Id: I520e460bd558934c71042b5a4fdb03b3935ad720
Signed-off-by: suyi Yuan <yuan.suyi@gmail.com>
2012-03-15 15:27:02 +08:00
Steve Block
60d056bf29 Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: I0cbe865d464a37365fa3be84948b07e5a0d181d0
2012-01-08 11:03:25 +00:00
Steve Block
22d351317a Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I135fadaf10e95af1eb918889a22980c194c650ca
2012-01-05 23:27:52 +00:00
Steve Block
b224b78c14 Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ia8b6f74b27098b3dba27f177a76264eb23f849ee
2012-01-04 20:07:12 +00:00
Steve Block
cee8501c16 Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I98e83cc9d22f0ea8fbf397ccccd9ce7773119551
2012-01-03 22:31:17 +00:00
Jean-Baptiste Queru
57adb36c30 Remove workarounds for buggy /dev/fb0 drivers
Change-Id: Ideadd5f39693d05cf29a81d9f87ed804d7e52380
2011-06-06 13:28:45 -07:00
Jean-Baptiste Queru
c9881d8c56 am cb4ea7ac: am 7b584867: am cd347fdf: Allow to force 16bpp when 32bpp has problems
* commit 'cb4ea7ac8af7ac0732f480dc4938e62566bd5550':
  Allow to force 16bpp when 32bpp has problems
2011-04-05 11:27:14 -07:00
Jean-Baptiste Queru
cd347fdf74 Allow to force 16bpp when 32bpp has problems
Bug: 4197654

Change-Id: Icf1e8793d6a4d2e070a8f232efd4136d79339496
2011-03-31 19:58:27 -07:00
Iliyan Malchev
14e3641c32 hardware/libhardware: remove LOCAL_PRELINK_MODULE
Change-Id: I8a0ba7e4c99e334b9789d88b48383439eb7cc780
Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-03-14 14:24:25 -07:00
David 'Digit' Turner
25b68b5c24 gralloc: Add support for 32-bit framebuffers.
Note: The code under hardware/libhardware/modules/gralloc/ is only used
      when running the system under the emulator.

Change-Id: I022978aeaacc5137c9917cd2ef6952dd3897ece4
2011-01-17 22:04:52 +01:00
David 'Digit' Turner
80d3699c9e gralloc: Fix division-by-0 during system emulation.
This patch avoids a division-by-0 when the system is running
under emulation (the kernel driver reports pixclock as 0, for
some reason). Which results in a SIGFPE during the boot sequence.

Change-Id: Idb6bcdd58999ea9231f2411481c25929d5d02f1d
2011-01-15 21:06:12 +01:00
Jean-Baptiste Queru
118b5d7961 Allow disabling page-flipping.
Some devices have low-level bugs in their page-flip.

Disabling it at this level gives us more flexibility
than trying to control it elsewhere.

Bug: 3097357
Change-Id: Icc6ae172264e453bec0680e74a497a2b24299c4a
2010-10-14 19:05:09 -07:00
Mathias Agopian
9da751bbf7 fix [2444483] gralloc size for YUV formats 2010-02-16 14:04:00 -08:00
Mathias Agopian
ee4e57e949 remove unused code 2009-12-15 17:22:56 -08:00
Mathias Agopian
f96b2064d7 remove all references to pmem and simplify the lock/unlock hooks
this gralloc module is only used on the emulator or without a h/w
renderer. therefore there is no synchronization to do in lock/unlock
and pmem buffers are not relevant.

hopefully this will remove some of the confusion about how gralloc
should be implemented and make it more obvious that this implementation
is not intended to be used by h/w renderers.
2009-12-15 15:00:57 -08:00
Patrick Scott
baf99300f7 Remove call to dump_l.
This fail to compile without NDEBUG and the following log statement does
something similar.
2009-10-29 08:33:42 -04:00