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
If status < 0, we'd silently leak dev.
Bug: None
Test: Ran the analyzer; memory leak warnings are gone.
Change-Id: I76a78feea4c92aa167de908f5571481864d61d73
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
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
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>
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>
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>
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
Note: The code under hardware/libhardware/modules/gralloc/ is only used
when running the system under the emulator.
Change-Id: I022978aeaacc5137c9917cd2ef6952dd3897ece4
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
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
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.