Commit Graph

76 Commits

Author SHA1 Message Date
Ranjith Kagathi Ananda
330b21d64e gralloc: change the IMPLEMENTATION_DEFINED preview buffers format
Set the preview buffers format be the same as the video buffers
in order to improve camera power usage.

Change-Id: Iaf69dad9d15b0b6fdc4cfe538104f404008e84fb
2015-09-09 13:04:34 -07:00
Naomi Luis
cffc5bd986 gralloc: Modify check for uncompressed RGB buffers
The previous check for RGB formats skipped certain formats and hence
the alignment was incorrect.
Add a check for all non-compressed RGB formats before calling
getGpuAlignedWidthHeight

CRs-fixed: 888733

Change-Id: Icae4cfb92ceae5e593fd6c5658999fc90ef97ea1
2015-09-02 15:25:26 -06:00
Sushil Chauhan
7807d19bfe gralloc: De-couple the UBWC decision for GPU and Rotator
Allow UBWC, if an OpenGL client sets UBWC usage flag and GPU plus MDP
support the format. OR if a non-OpenGL client like Rotator, sets UBWC
usage flag and MDP supports the format. It de-couples the UBWC decision
for Rotator output buffer format from GPU.

Change-Id: I5e78b615f71c1781a40b8c137a37b111eb786323
2015-08-13 10:40:25 -07:00
Ajay Dudani
4dc06493ae gralloc: Remove unsupported formats
- Remove RAW_SENSOR in favor of RAW16
- Remove use of sRGB format enums

Change-Id: I189a168f75a5573648aebdde3bbacb90f4cdc354
2015-08-04 16:55:57 -07:00
Sushil Chauhan
6cfffe2a9a gralloc: UBWC aligned buffers are tiled
UBWC aligned buffers are tiled. So EGL will set the tileMode to Macro
internally, if UBWC_ALIGNED bit is set in handle flags. There is no
need to set TILE_RENDERED bit explicitly. It simplifies the logic.

CRs-Fixed: 855474

Change-Id: I76ea8991ffa576ec3198daecd9e5dc97667d0ba1
2015-06-26 18:53:29 -07:00
Linux Build Service Account
8c6b491d19 Merge "sde: Change the secure buffer alignment requirement" 2015-05-19 21:45:11 -07:00
Shalaj Jain
3b0b57062a sde: Change the secure buffer alignment requirement
Change the secure buffer alignment requirement to accomodate
both new system secure heap and old MM CMA heap between master
side and slave side CP architectures.

Change-Id: If1f8e2d67a9658d02faebfdfb12c7e6b68527589
2015-05-12 14:26:29 -07:00
Sushil Chauhan
e61fac5be4 gralloc: UBWC aligned buffers are Macro Tiled
All UBWC aligned buffers are Macro tiled.

Change-Id: I71bb0269d337d1ca2017ce9665010f738674f1a8
2015-05-01 10:17:29 -07:00
Linux Build Service Account
3eac1c3cd9 Merge "gralloc: Make all secure heaps and flags backward compatible" 2015-04-29 08:20:37 -07:00
Linux Build Service Account
44e2330484 Merge "gralloc: Add support to enable UBWC aligned framebuffer" 2015-04-24 23:48:26 -07:00
Shalaj Jain
3c49041532 gralloc: Make all secure heaps and flags backward compatible
Make all content protection and secure display heaps and flags
backward compatible. Honor the different requirements for master
side and slave side content protection and secure display.

Change-Id: I21a5170f2ae7ffd9c447e8af795e3665e673248f
2015-04-24 11:52:48 -07:00
Linux Build Service Account
5292c4fa4c Merge "gralloc: Query GPU for UBWC use cases only" 2015-04-21 02:41:01 -07:00
Sushil Chauhan
68c793aea5 gralloc: Add support to enable UBWC aligned framebuffer
Gralloc checks the system property "debug.gralloc.enable_fb_ubwc"
to enable UBWC aligned allocation for framebuffer. The allocation
will be linear by default.

Change-Id: I7fdb5878eec620f264ba3a6425a9810b28b54604
2015-04-16 17:41:53 -07:00
Sushil Chauhan
8516eccba7 gralloc: Query GPU for UBWC use cases only
1. Query GPU only if the client uses UBWC specific HAL pixel format
or sets UBWC gralloc flag in the usage flags.
2. Add an adreno pixel format in the utils.

Change-Id: I84a4701b40deae349f49440f0508972974c4b12a
2015-04-13 15:32:32 -07:00
Shalaj Jain
1f9725a296 gralloc: App support for new secure system heap and flags
Add support for new secure system heap and corresponding flags
for all pixel buffers. Keep the old mm heap for secure display
buffers.

Change-Id: Ic0ee7783a2d1ff420c34396f7cc4bd5ac3058c44
2015-03-30 14:41:36 -07:00
Naseer Ahmed
8d0d72ad40 gralloc: Deprecate old stuff.
1. Reclaim some old gralloc flags.
2. System heap allocation happens by default.
3. Remove some unused private flags.
4. Add heapid member to alloc_data to better line up with ion
   header
5. Remove check for MDSS_TARGET

Change-Id: I37be0a2fcd5fd4a14bb9ca235fcae41f6f3ec19e
2015-03-19 13:39:21 -04:00
Sushil Chauhan
3233329902 gralloc: Add UBWC support for Camera
Camera sends IMPLEMENTATION_DEFINED format, so if UBWC gralloc usage
flag is set, it expects gralloc to set the pixel format as NV12_UBWC
instead of use-case specific pixel formats.

Change-Id: Id0a11893401d1338f4f123ca8df029ed96b18ab9
2015-02-04 19:03:16 -08:00
Sushil Chauhan
81594f6d66 gralloc: Allow UBWC for explicitly defined UBWC HAL pixel format
1. Allow UBWC allocation, if client is using an explicitly defined
UBWC HAL pixel format OR if client sets UBWC gralloc usage flag and
GPU supports the format.

2. EGL wants gralloc to set PRIV_FLAGS_UBWC_ALIGNED bit in private
handle flags, only if GPU supports UBWC for that format.

Change-Id: I4194a046217cbc4c0a8ac2b2fb4b73ebd5076fc2
2015-01-30 10:21:19 -08:00
Sushil Chauhan
65e26307e6 display: Add support for UBWC in display hal
1. Add support for UBWC allocation in the Gralloc APIs for aligned
width, aligned height and buffer size. A client can request for UBWC
allocation by sending UBWC specific HAL pixel format or by setting
GRALLOC_USAGE_PRIVATE_ALLOC_UBWC flag in the usage flags.

2. Gralloc allocates UBWC aligned buffer, only if format is supported
by GPU and MDP and no CPU usage flags are set. Otherwise it allocates
linear buffer.

3. If UBWC conditions are met, gralloc sets PRIV_FLAGS_UBWC_ALIGNED
in private handle flags to tell client that allocated buffer has UBWC
alignment. This flag remains unset by default.

4. Add helper functions in gralloc to calculate UBWC meta buffer size
for RGB* formats.

5. Add UBWC HAL pixel format HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC
which has been defined by Video module.

6. Add AdrenoMemInfo api to query, if GPU supports UBWC for a format.

7.MDP driver expects UBWC specific pixel format defined by MDP header.

Change-Id: I5b4344bc90aa498dbdb7bb8100e70ed7728e6ea5
2015-01-16 11:00:01 -08:00
Saurabh Shah
1adcafe634 gralloc: Allocate cached by default, don't use bitops on SW flags
Allocate gralloc buffers cached by default unless clients specify
uncached using PRIVATE_UNCACHED or READ_RARELY or WRITE_RARELY at
allocation time. Some clients could use gralloc for allocation but
later won't use lock()/unlock() for CPU operations and likely use
their own caching methods. Cached by default helps such clients.

SW usage flags are not defined as bit values, so do not use bitops
on those flags.

Change-Id: Id371de2ec6efbfa0ed84172b3540f3ebc8f5d459
2014-12-19 18:30:00 -08:00
Saurabh Shah
36b9256b38 gralloc: In lock use writer info from allocation time
lock() can be called from a CpuConsumer with only the READ_OFTEN flag
so relying only on that makes gralloc assume there are no non cpu
writers.

Store the writer information during allocation in private flags of
handle and refer to those during lock()

Change-Id: Ifbf25ebc74dbf4e422a2fdec52ec000cd75e549b
2014-12-08 19:02:25 -08:00
Arun Kumar K.R
f0f853f442 gralloc: Use ION fd in FB handle
- After mmap, use the meta data ioctl to get the ION fd
  for the framebuffer memory as GPU expects buffers to
  from ION
- Set appropriate flags for the framebuffer private handle
- Remove unused members

Change-Id: I45c4917d9811cd3b3800adf222b92f41f97430c0
2014-08-08 10:46:30 -07:00
Arun Kumar K.R
d7d5f8d2ae Revert "libgralloc: Add support for custom buffer size."
This reverts commit 3d4c0ac4f2.

Conflicts:
	libgralloc/gpu.cpp

Change-Id: I6a9df303a4af33610e866e6651e1e2253b94d9cf
2014-07-23 14:50:35 -07:00
Linux Build Service Account
995d0a8ac9 Merge "display: remove compiler warnings" 2014-06-20 18:39:25 -07:00
Shalaj Jain
a70b435d10 display: remove compiler warnings
Use correct typecasts and format specifiers and resolve
compiler warnings

Change-Id: I51b12ecb78a9a496cf1f76c3d32892a203f70c43
2014-06-19 15:44:51 -07:00
Ramkumar Radhakrishnan
9d20b39e4a hwc: Rotate RGB layer using MDP Rotator
1. Use MDP rotator to rotate RGB layers which are rendered by software
2. Restrict total number of rotator sessions to 4 for all displays
3. Disable RGB layer rotation for all MDP versions < MDP5

Change-Id: Ie93111082dff9a16b614e9768df5d8ce83ff9e25
2014-06-16 12:10:40 -07:00
Praveena Pachipulusu
95e16d4911 libgralloc: Set Alignment to 1M only for Secured buffers.
Set Data alignment to 1M only for secureed buffers which
are allocated via MM heap. IOMMU heap allocated buffers
should have buffer alignment of 4k.

Change-Id: I501b35ab103b687f1081338e0c100c29e0b9c4bf
2014-06-03 19:44:25 +05:30
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
Saurabh Shah
02da5798cd gralloc: Fix RGB888 marked as VIDEO
RGB888 layers were marked as VIDEO and treated as YUV along the path.
If RGB888 is ever required to be a video format we need to make sure
to have other differentiation mechanisms between a UI RGB888 and a
Video RGB888 if any special handling is necessary.

Change-Id: I94c74ac10d589e20dd600db0d1e32645613b1b21
2014-04-08 15:59:55 -07:00
Linux Build Service Account
2c73b5fe29 Merge "gralloc: Set colorspace in the metadata" 2014-04-02 07:36:39 -07:00
Naseer Ahmed
34d33bc907 gralloc: Add support for lock_ycbcr
Fill the android_ycbcr struct for HAL_PIXEL_FORMAT_YCbCr_*_888
formats.
This is a flexible YUV format that allows gralloc to set a
hardware specific YUV format based on the usage flags passed in.
Here we set the format similar to how we set the implementation
defined format and set the android_ycbcr structure to point to
the appropriate plane offsets.
Reference:  HAL_PIXEL_FORMAT_YCbCr_420_888 definition in
system/core/include/system/graphics.h

Change-Id: If0c7abf5e206bf982ad333da2dae57cbac302733
2014-04-01 18:17:38 -04:00
Naseer Ahmed
42e5dde2ed gralloc: Set colorspace in the metadata
Since camera now uses the metadata to store the color space,
store the default color space values here as well instead of
storing in the flags.

Change-Id: I11ee84f391a8ee9d06267aa05645fa9467dc23a6
2014-03-28 20:31:09 -04: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
Manoj Kumar AVM
1f6a82159c gralloc: Add GRALLOC_PRIVATE_USAGE_WFD flag
1. Screenrecord and WFD use virtual display and encoder.
   Since HAL supports only one virtual display, we need a
   definite way to distinguish both use-cases.

   Failure to differentiate will break Screen record + WFD
   concurrent usecase.

   WFD stack will set this usage flag and SF will query the usage
   flags to differentiate WFD and screenrecord usecase.

2. Deprecate GRALLOC_USAGE_PRIVATE_EXTERNAL_CC and
   GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK flags as these are no
   longer used.

Change-Id: Ifa260c5af2371eea830744ce62a5a83b8cfd0de7
2014-02-20 11:22:33 -08:00
Manoj Kumar AVM
cdb4fd513c gralloc: Set default value for implementation defined formats
For implementation defined formats which go via HWC, set the
default value to RGBA8888

Change-Id: I7f8c46bc47746dcf1c4a03438b8f93d7bab78bb1
2014-02-03 12:51:04 -08:00
Linux Build Service Account
bbba2e6206 Merge "hwc: RGB888 is considered as a VIDEO type" 2014-01-21 12:34:06 -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
Zohaib Alam
17e4856b9e hwc: RGB888 is considered as a VIDEO type
For mpq8092, RGB888 is the output video format, so need to make
it a video buffer type, so that VIG pipe gets allocated for
it. Another reason is that GPU cannot process RGB888, so marking
it as a VIDEO layer will ensure that it will get picked by MDP.

Change-Id: I5d1812a70f5e4d1fb7448d0a145a15c07c6fc188
2014-01-09 13:34:12 -05:00
Baldev Sahu
5f673b4749 libgralloc: correct assigment of HAL_PIXEL_FORMAT_RGBA_8888
For implementation defined formats which go via HWC, set the
default value to RGBA8888.

Change-Id: I741504d54694ac061ecd6c870cb8f815cc61ab24
CRs-Fixed: 588596
2013-12-13 14:00:20 +05:30
Naseer Ahmed
f2feca9bcf Revert "display: Video Encoding not working"
This reverts commit 0a1db6aef28c3b90d1f992f56abc562dbae10b55.
Video encoder uses the NV12 encodeable format again.

Change-Id: I1b5170a5c2b5c7de0791cc5bc44457257519f749
2013-11-08 15:32:52 -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
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
Ramkumar Radhakrishnan
ba713389c2 hwc: Add support for Secure display
- Identify secure display layer in the hwc_list
- Need to set both SECURE_OVERLAY and SECURE_DISPLAY flags for the secure
  display layer
- Disable idle timeout for secure display usecase, as GPU should not be
  accessing secure display layer

Change-Id: I555910db77c466b5e103b24b4f0ec7f47bb210a5
2013-10-08 16:03:24 -07:00
Arun Kumar K.R
1062ea1607 libgralloc: Don't set buffer type to be BUFFER_TYPE_VIDEO
For buffers with usage set as GRALLOC_USAGE_EXTERNAL_DISP or
GRALLOC_USAGE_PROTECTED, dont mark them as BUFFER_TYPE_VIDEO,
as they can be either RGB/YUV

Change-Id: If4ee80ae85427b2bd850a9f6aeb2c914d4c7c198
CRs-fixed: 537052
2013-09-06 17:29:43 -07:00
Naseer Ahmed
22fa2d3545 gralloc: Fix ITU formats for camera
Make sure ITU formats are applied exclusively for camera buffers.
Camera HW_TEXTURE buffers go to GPU and should be marked as 601 FR.
Earlier, this was OR'd with video encoder due to which it
incorrectly got marked as 709.

Change-Id: Icaf3692b581b7861229e613dd632123d21dda2cf
2013-08-14 13:28:54 -04:00
Naseer Ahmed
8478672bdb gralloc: Use compile time flag for mdss.
The gralloc allocation can happen from processes other than
surfaceflinger in which case we cannot open the framebuffer
device to get the mdp version. Use the MDSS_TARGET flag to
differentiate.

Change-Id: I69bc9ff6004b382a2836274a32fbbd3b2e67dea2
2013-06-14 17:39:22 -04:00
Naseer Ahmed
fc940ef958 gralloc: Add ITU-R standard info for YUV formats
These format qualifiers will help graphics decide which
standard to use when working with a YUV texture.

Change-Id: I6ad464e6b070d3b375c5e07f03228308d15407cd
2013-05-08 12:21:02 -07:00
Linux Build Service Account
08746980da Merge "gralloc: Set correct private gralloc format for video buffers" 2013-04-23 20:01:49 -07:00
Shuzhen Wang
a11b6ba75c gralloc: Set correct private gralloc format for video buffers
For IMPLEMENTATION_DEFINED pixel format, if the usage flag is
HW_VIDEO_ENCODER, the private gralloc format should be
HAL_PIXEL_FORMAT_NV12_ENCODEABLE.

Change-Id: I61e8aabe124179e8bebda5d50ad1d8681060b99a
2013-04-21 14:29:05 -07:00