Commit Graph

57 Commits

Author SHA1 Message Date
Justin Philip
d616660fe6 libhwcomposer: libgralloc Set MDP_SMP_FORCE_ALLOC flag
For PROTECTED but NON SECURE layers set MDP_SMP_FORCE_ALLOC flag
to allow SMP allocation and prevent GPU fallback
In Such cases if video resolution changes dynamically
it fails to display layer due to GPU fallback.
Use this flag for FB layer composition and depricate
MDP_BACKEND_COMPOSITION flag.

Change-Id: I9ab7cbdd2e12b56dfa67d5b4b3ff6b2dcd0096be
2014-10-21 21:34:30 -07:00
Saurabh Shah
9ff53a9d9f gralloc: Optimize ION cache clean and invalidate calls
-Clients not having WRITE_OFTEN or READ_OFTEN are uncached.
-Invalidate cache on lock only if CPU needs to read and there
are non-CPU writers in system (camera,gpu etc)
-Flush cache on unlock only if CPU writes. Since all buffers will be
read in HWC(MDP) there is no need to check if readers exist.

Change-Id: Icd114e60b7456bd71592b81016892e806c37cb22
2014-09-24 16:02:21 -07:00
Arun Kumar K.R
6e3324827f gralloc: fix getYUVPlaneInfo for YV12 format
- Use proper alignment for cstride while calculating the
  ycbcr info for YV12 format
- This fixes the corruption issue when the video is composed
  using GPU

CRs-fixed: 711696
Change-Id: I776cc6c5ce781ea3de25b5d8427345b512a8305a
2014-08-21 13:23:57 -07:00
Linux Build Service Account
8f4e1a68ba Merge "gralloc: Align NV21 to 32 pixels" 2014-06-06 06:07:17 -07:00
Naseer Ahmed
0415b73fdf gralloc: Align NV21 to 32 pixels
Graphics requires 32 pixel alignment and camera driver is being
updated to this.

Change-Id: I00fe659f7a16abeb8f65d9bbf41a24a7c8113bfb
CRs-fixed: 476475
2014-05-29 16:59:02 -04:00
Naseer Ahmed
a28d31c01c gralloc: Fix NV12 and NV21 stride
NV12 spec says that the chroma stride is the same as the luma
stride. The camera hardware produces YUV data per this spec.
NV21 has the same behaviour with the chroma samples reversed.
Venus also conforms to this.

Change-Id: I6e107b2a3ba6f51e135348bd147a9c26be003bb2
2014-05-29 15:46:29 -04:00
Saurabh Shah
8f0ea6ff81 gralloc: Remove opaque types
Remove opaque types like size_t, uintptr_t, intptr_t to support
32bit and 64bit processes together.

When a 64bit process creates a handle and a 32bit process validates
the incoming ints against expected ints, opaque types lead to
different and mismatching values.

Always use unit64_t for base address for 32bit and 64bit SF.
Use unsigned int for offset and size, since ION uses that.

Change-Id: I7db5544556a8924f98010b965f837592e9f0b4ca
2014-05-22 12:14:30 -07:00
Praveena Pachipulusu
2005e8f612 hwc: Fix klockwork errors
Resolving klockwork errors to avoid memory leaks,
improper assignments in liboverlay.

Change-Id: I82ac6ae782c7b783e89999b832bbd1d361376b9f
2014-05-16 08:45:03 +05:30
Naseer Ahmed
b29fdfdd84 gralloc: Report YUV plane info
The android_ycbcr structure in graphics.h is populated to give
the luma and chroma addresses. Use the same structure to give
this information to graphics via a gralloc perform call.

Change-Id: Ib42866a9ea90873886dcb60a1aac6cb375292642
2014-04-25 09:56:38 -07:00
Arun Kumar K.R
6c85f050b2 libgralloc: use proper types and type casts
- Use proper types for pointers
- Resolve compiler errors
- handle proper type casts
- remove unused variables

Change-Id: I628ebe174485d30abadea4ca40b67f9aab1a0652
2014-03-28 15:14:58 -07:00
Jeykumar Sankaran
2ba20513e4 libgralloc: Invoke adreno for ASTC format padding.
Invoke adreno util API to calculate padding bytes for ASTC
formats.

Change-Id: I96af0199a0029786fd2975a7c002d5414c797521
2014-03-07 10:02:13 -08:00
Manoj Kumar AVM
5a5529b817 hqd: Add support for 565 macro tile format
Extend macro tile feature support to rgb565 format.

Change-Id: I3d696d1ec66bfd95fcf3d243a1d669cb074da77f
2014-02-25 10:56:04 -08:00
Ramkumar Radhakrishnan
36bd527bc8 display: Remove klockwork warnings and errors.
Remove all klockwork warnings and errors for libgralloc,
libhwcomposer, liboverlay, libqdutils, libqservice, libvirtual,
libexternal libraries to avoid buffer overflow and memory leaks.

Change-Id: I078143bcbcf5e4b342156bd8305a644566f7cc4b
2014-02-18 12:39:21 -08:00
Linux Build Service Account
a6976555a1 Merge "h/q/d: Add missing ASTC format" 2014-02-09 19:08:39 -08:00
Jeykumar Sankaran
8f4585fc6f h/q/d: Add missing ASTC format
Adds support for Khronos format COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR

Change-Id: I2ca2c548cbcca0c56f28d2158cb5a0d01a326f0f
2014-02-05 15:23:40 -08:00
Saurabh Shah
d0b0d8f055 gralloc: Fix getSize and getAlignedWidthAndHeight
getSize was incorrectly modifying aligned height and allocating
a buffer of lesser than expected size.

All alignments should be done in getAlignedWidthAndHeight so as not
to break the GRALLOC_PERFORM functions.

getSize()'s return type is unsigned, but a signed value is returned.
Instead on error, a size of 0 should be reported.

Change-Id: Ifae5e758de8e689701cd43892324ccc0140675cd
2014-02-04 13:22:38 -08:00
Naseer Ahmed
63326f4b22 gralloc: Add support for ASTC formats
This change adds support for Khronos standard ASTC formats.

Change-Id: I6963f2ed82b5f179ed8627022746deec02ff826a
2014-01-30 12:56:37 -08:00
Manoj Kumar AVM
8a22081e49 hwc: Add support for Macro Tile feature
Macro tile is enabled only if all the conditions are met:
  1. GPU hardware should support Macro Tiling.
  2. MDSS hardware should support Macro Tiling.
  3. USAGE flags shouldnt contain GRALLOC_USAGE_SW_READ_OFTEN and
     GRALLOC_USAGE_SW_WRITE_OFTEN.
  4. RGB 16bit and 32bit formats.
  5. persist.hwc.macro_tile_enable flag should be enabled.

PRIV_FLAGS_TILE_RENDERED flag is added to indicate whether the layer
is rendered/composited in Macro Tiling or Linear format.

Change-Id: Ie3139839c84d76c5d1a2300f33910a09eb7336f4
2014-01-14 13:32:31 -08:00
Ramkumar Radhakrishnan
473f4085e3 libgralloc: Use new GFX API to calculate stride
Use new GFX API compute_aligned_width_and_height to get the stride
value for RGB surfaces.
Backward compatible with GFX old API when old GFX library is used.

Change-Id: I15b0954602b816bf4e88f48622494144fc77c14f
2013-11-20 17:55:09 -08:00
Jesse Hall
fbe96d2b78 Replace sRGB_888 with sRGB_X_8888
As sRGB_888 is not defined, replace it with sRGB_X_8888

Change-Id: Ie7e27ffea1ca6ec99de8e746c0f784e5fc9a4e53
(cherry picked from commit b81796dc9a0c4178004ae947e9d756c5cae6967a)
2013-11-08 15:23:10 -08:00
Naseer Ahmed
82fc4b733f gralloc: Add allocation support for sRGB formats
Refer to graphics.h for the definition of these new formats.
The HWC doesn't yet support output to these formats.

Change-Id: I14dade3412d262d853d3783ba77d559c76d331bf
(cherry picked from commit 3a63837a3d006aee3d176d379409bf3134f6189b)
2013-11-08 15:22:57 -08:00
Naseer Ahmed
2c215298e1 gralloc: Add padding byte for YUV 420
YUV 420 buffers have the chroma starting at consecutive bytes
but end at the same byte. This results in the second chroma size
being one byte shorter in size. This isn't a problem for
hardware, however, the gralloc lock_ycbcr API expects to read the
same number of bytes based on the cstride for both chroma
components. This could lead to it accessing memory beyond what is
allocated leading to a crash in the calling process especially
when the size aligns exactly to the page size. Add one byte
padding when allocating YUV buffers to make sure the users of
this gralloc API get enough bytes to read.

Bug: 10787131
Change-Id: Id18e0739f9fdc2c7a4fbe7724be668a989f1a4a1
(cherry picked from commit ca07ffae967e7137fb0d97fb9999a11c09b4a7b5)
2013-11-08 15:22:38 -08:00
Ramkumar Radhakrishnan
ff511027c4 display: Add support to HAL_PIXEL_FORMAT_NV21_ZSL format
Add Support to HAL_PIXEL_FORMAT_NV21_ZSL format in gralloc for
camera capture usecase.
This support is required because, CPP module requires 64 byte
aligned width and height to resolve corruption in bottom/left edge
of the landscape/portrait buffer.

Change-Id: Id3e0e5f3d695d5111f3469f78a1d52aad9bea4f4
(cherry picked from commit 512ee1dcef6fa47dfdcf3990fea29bd85f967f02)
2013-11-08 15:22:07 -08:00
Mathias Agopian
e4001e736d get rid of HAL pixelformats 5551 and 4444
This changes removes the use of 5551 and 4444 pixel formats
as its not supported anymore

Change-Id: I817510c3c7c0c3d95924c2ffc79e5727a6d6c48f
(cherry picked from commit 1fbd4a9662b07d53a3f220c91b3e85ca571a4938)
2013-11-08 15:17:17 -08:00
Prabhanjan Kandula
e8f4becdf3 gralloc : Allow support for both Widevine level-1 and level-3
MM HEAP will be used only for Widevine Level-1 secure playback.
Since Video component assures of using MM HEAP flags only for
WV Level-1 and Level-3 will not be marked with MM HEAP it is
possible to allow supporting both of these protection levels
co existing in a device.

Change-Id: I153eeebf20bdab0c2ce930a5a124369a2b3249a6
CRs-fixed: 562601
2013-10-24 18:28:50 +05:30
Ramkumar Radhakrishnan
b52399cfa0 display: Add support for interleaved YUY2 and YUYV format.
Adding support for interleaved HAL_PIXEL_FORMAT_YCbCr_422_I and
HAL_PIXEL_FORMAT_YCrCb_422_I format in display HAL.

Change-Id: Ib87d9bf481c20bf6a92293dd04746719b1d928c1
2013-09-19 11:10:45 -07:00
Linux Build Service Account
d6bf387820 Merge "gralloc: Fix caching for rarely read/write flags" 2013-08-22 19:47:40 -07:00
Naseer Ahmed
2686788a4b gralloc: Fix caching for rarely read/write flags
GRALLOC_USAGE_SW_WRITE_RARELY and GRALLOC_USAGE_SW_READ_RARELY
need to be compared directly since they share bits with
GRALLOC_USAGE_SW_WRITE_OFTEN and GRALLOC_USAGE_SW_READ_OFTEN.

Change-Id: I52692027033e1036e3ad960b9e03dd8ee60b4111
2013-08-21 19:31:34 -04:00
Naseer Ahmed
ce0c9500a4 gralloc: Fix NV12_ENCODEABLE allocation
Targets having the venus core have the same allocation and stride
requirements for HAL_PIXEL_FORMAT_NV12_ENCODEABLE as the
HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS format.

Change-Id: Ie5ab8db6639dfa791c5be0161cde6140c3dae779
2013-08-15 14:00:56 -04:00
Arun Kumar K.R
5a9bc432df libgralloc: Allow USAGE_RARELY flags to be uncached
Allow GRALLOC_USAGE_SW_READ_RARELY and GRALLOC_USAGE_SW_WRITE_RARELY
flags to be uncached.

Change-Id: I014d659e5d5465c6a27aa3979d52cbf3f7c14024
2013-06-12 17:00:17 -07:00
Naseer Ahmed
a6ad22dbd5 gralloc: Allow system heap to be uncached.
Remove an old check that prevented this from happening.

Change-Id: I938b11b27e58fc38a679dc55e31e7b51eb86bd3a
2013-06-10 19:54:40 -07:00
Linux Build Service Account
9ed6331ea3 Merge "libgralloc: Add support to use CAMERA_HEAP" 2013-05-31 20:47:31 -07:00
Arun Kumar K.R
ff78b8909f libgralloc: Add support to use CAMERA_HEAP
- Adds flag GRALLOC_USAGE_PRIVATE_CAMERA_HEAP to use the dedicated
  CAMERA_HEAP
- Remove GRALLOC_USAGE_PRIVATE_CP_BUFFER which is not used anymore

Change-Id: Iefea88d9a67d2fa0ca74492f508e1d5508d08983
2013-05-24 12:40:45 -07:00
Prabhanjan Kandula
92896b8622 libgralloc: Fix secure buffer issues.
-- Though buffer usage is not marked with any Heap, if usage flags
set with GRALLOC_USAGE_PROTECTED allocate from IOMMU heap.
-- Allow using  GRALLOC_USAGE_PROTECTED for non tz level protection.

Change-Id: Ie3c8bd8821f4ab344a2b798a723ab65d4ef5b44e
CRs-fixed: 484838
CRs-fixed: 480493
2013-05-22 22:21:33 -07:00
Naomi Luis
1b379695ef libgralloc: Don't pad if debug.gralloc.map_fb_memory is set
Don't add adreno specific padding computed by libadreno_utils if
debug.gralloc.map_fb_memory is set.
Since this is a debug property, we can disable surface padding
when the property is enabled.

Change-Id: I5ff310483930f8da04f6955889eea3973fd3d342
CRs-fixed: 480925
2013-05-06 14:14:46 -07:00
Naseer Ahmed
7669daee42 gralloc: Add support for "RAW" and "BLOB" formats
The allocation is done as specified in system/graphics.h
Raw formats are 16 bit and aligned to 32 bytes, blob formats have
a height of 1 and the size of the buffer is equal to the width.

Change-Id: If762a34dde3b78f138689ced1077c9529020ebf0
2013-04-19 18:27:06 -04:00
Naomi Luis
b65b23453f libgralloc: Set the Adreno raster mode as "unknown"
Set the raster mode as "unknown" when calling libadreno_utils to
compute the surface stride. This allows libadreno_utils to decide
the best stride to pick up based on the specific GPU.

Change-Id: Id88f5887168564398492ab03d160ddd0ce5e083a
2013-03-28 14:12:47 -07:00
Ramkumar Radhakrishnan
73f952ae3f gralloc: Override gralloc calculated size only if bufferSize is greater.
bufferSize set using native window set buffer size will override gralloc
calculated size only if bufferSize is greater.
Fix for 720P, 1080P HD content playback is not working on 7x27A due to
buffer size mismatch between requested size by frameworks and allocated
size by gralloc for HAL_PIXEL_FORMAT_YCrCb_420_SP and
HAL_PIXEL_FORMAT_YCrCb_420_SP format

Change-Id: I16d04e406ab8f1f35e0e0a70e19d99a019adc5ef
CRs-Fixed: 451783
2013-03-26 11:30:50 -07:00
Naseer Ahmed
c5e6fb0fd3 gralloc: Align protected allocations with the spec
The specification for GRALLOC_USAGE_PROTECTED indicates that
allocations with that flag must be protected by securing with
hardware. If such protection is not possible, the buffer must not
be composited. In our current software only the MM_HEAP is
secured. If we allocate protected buffers from any other heap we
block those from being displayed.

CRs-fixed: 465012
Change-Id: I9d47aba3d28192db3fcc394fd6b38efe42ae118b
2013-03-22 17:10:30 -07:00
Arun Kumar K.R
0daaa99ee9 libgralloc: Change CAMERA_HEAP to ADSP_HEAP
This changes GRALLOC_USAGE_PRIVATE_CAMERA_HEAP to
GRALLOC_USAGE_PRIVATE_ADSP_HEAP as the CAMERA_HEAP
is not used anymore

Change-Id: I5a95f68c4c7f4445ade2398dd239faad9ed16b22
2013-03-12 15:35:57 -07:00
Naseer Ahmed
2ea027b04c gralloc: Allow IOMMU memory to be uncached
The IOMMU heap can give us uncached memory, so remove this
erroneous check.

Change-Id: Ie141c55821221a1c2f75b7cf2248794d93ea6c6a
2013-03-07 08:23:34 -08:00
Naomi Luis
01f5c8eacb libgralloc: Get the stride information from libadreno_utils.so
libadreno_utils.so is an adreno utility library. It computes the
optimal stride required for a surface of a particular width and
bpp. Using this computed stride allows us to efficiently use the
dual memory channels and increase performance.
Currently the utility library only computes the optimal stride
for RGB surfaces.

Change-Id: I0f70bd11602a5144515ab07c3bd2b80a01586a06
2013-02-15 16:55:51 -08:00
Naomi Luis
a44100cafc libgralloc: Add Perform function to get the stride.
- Introduce a new class to Get the Adreno computed stride information.
This class has been added to allow adreno library computed strides to
be propagated to the allocation function as well as those clients
requesting it.
- Add a new Perform function to get the stride. The width and the format
can be passed from the calling functions (like EGL) to get the stride of
the buffer.

Change-Id: I4c2b4a02deff327f0ea5558c478997527fe9d3cf
2013-02-14 09:19:35 -08:00
Linux Build Service Account
d46feac0cb Merge "gralloc: Do not set ION_SECURE for non-contiguous heaps" 2013-02-12 10:07:40 -08:00
Duy Truong
73d36df685 Update copyright to The Linux Foundation
Change-Id: I145b66896159ff9886ed73507f17b3165ba0266d
2013-02-09 20:33:23 -08:00
Naseer Ahmed
4b9784ea29 gralloc: Do not set ION_SECURE for non-contiguous heaps
The GRALLOC_USAGE_PROTECTED flag is being used for non TZ DRM
if non contiguous heaps such as IOMMU are used. Hence do not
set the ION_SECURE flag for such heaps as they cannot be secured
through trustzone.

Change-Id: I48e9460ef66abb827c9df1b3c55037e8e4214f81
2013-02-07 14:24:04 -05:00
Sushil Chauhan
7651a80dc9 display: Use GRALLOC_USAGE_PROTECTED to indicate secure content
For secure content, use GRALLOC_USAGE_PROTECTED flag instead of
the obsolete flag GRALLOC_USAGE_PRIVATE_CP_BUFFER.

Change-Id: I69bf8cfd3a978fd472608beb44056e1bf55c1414
2013-01-15 16:50:57 -08:00
Sushil Chauhan
73dcce48d6 libgralloc: Calculate aligned width & height using common header
For Venus, calculate aligned width & height using common header.

Change-Id: I622fee19693cfc550796d5949185c146c6a7f173
2012-12-20 14:44:55 -08:00
Sushil Chauhan
e8a01791fe libgralloc: Import header for Venus buffer size calculation
Import the common header file with Venus alignment requirements
to calculate venus buffer size.

Change-Id: I86cba91de8f7a3845a4592243b4f21e7cda03315
2012-12-20 14:43:34 -08:00
Sushil Chauhan
c5e61488bf display: Add support for Venus color format for newer platforms
Change-Id: I4c9a327bd30d1321e1f8383ffc1ca978efc8e9b9

Conflicts:

	liboverlay/overlayUtils.h
	libqdutils/gpuformats.h
	libqdutils/qcom_ui.cpp
2012-12-20 14:38:57 -08:00