Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
Add P010 support
Browse files Browse the repository at this point in the history
P010 is 10bit 2 planes YUV420 format
which can be used by HEVC 10 bit

Change-Id: I0fc3c56e8a09fca0640c34699c3c149772c978a0
Jira: https://jira01.devtools.intel.com/browse/OAM-50293
Signed-off-by: Lin Johnson <[email protected]>
  • Loading branch information
js0701 authored and kalyankondapally committed Oct 29, 2017
1 parent 03bb0b1 commit 9e49f05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cros_gralloc/i915_private_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ uint32_t i915_private_convert_format(int format)
return DRM_FORMAT_NV16;
case HAL_PIXEL_FORMAT_YCbCr_422_888:
return DRM_FORMAT_YUV422;
case HAL_PIXEL_FORMAT_P010_INTEL:
return DRM_FORMAT_P010;
}

return DRM_FORMAT_NONE;
Expand Down Expand Up @@ -65,6 +67,8 @@ int32_t i915_private_invert_format(int format)
return HAL_PIXEL_FORMAT_YCbCr_422_I;
case DRM_FORMAT_R16:
return HAL_PIXEL_FORMAT_Y16;
case DRM_FORMAT_P010:
return HAL_PIXEL_FORMAT_P010_INTEL;
case DRM_FORMAT_YUV444:
return HAL_PIXEL_FORMAT_YCbCr_444_888;
case DRM_FORMAT_NV21:
Expand All @@ -90,6 +94,7 @@ bool i915_private_supported_yuv_format(uint32_t droid_format)
case HAL_PIXEL_FORMAT_YCbCr_444_888:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_Y16:
case HAL_PIXEL_FORMAT_P010_INTEL:
return true;
default:
return false;
Expand Down
9 changes: 7 additions & 2 deletions i915_private.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

static const uint32_t private_linear_source_formats[] = { DRM_FORMAT_R16, DRM_FORMAT_NV16,
DRM_FORMAT_YUV420, DRM_FORMAT_YUV422,
DRM_FORMAT_YUV444, DRM_FORMAT_NV21 };
DRM_FORMAT_YUV444, DRM_FORMAT_NV21,
DRM_FORMAT_P010 };

static const uint32_t private_source_formats[] = { DRM_FORMAT_NV12_Y_TILED_INTEL };
static const uint32_t private_source_formats[] = { DRM_FORMAT_P010, DRM_FORMAT_NV12_Y_TILED_INTEL };

#if !defined(DRM_CAP_CURSOR_WIDTH)
#define DRM_CAP_CURSOR_WIDTH 0x8
Expand Down Expand Up @@ -140,6 +141,8 @@ uint32_t i915_private_bpp_from_format(uint32_t format, size_t plane)
switch (format) {
case DRM_FORMAT_NV12_Y_TILED_INTEL:
return (plane == 0) ? 8 : 4;
case DRM_FORMAT_P010:
return (plane == 0) ? 16 : 8;
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YUV444:
Expand All @@ -159,6 +162,7 @@ void i915_private_vertical_subsampling_from_format(uint32_t *vertical_subsamplin
switch (format) {
case DRM_FORMAT_NV12_Y_TILED_INTEL:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_P010:
*vertical_subsampling = (plane == 0) ? 1 : 2;
break;
default:
Expand All @@ -173,6 +177,7 @@ size_t i915_private_num_planes_from_format(uint32_t format)
return 1;
case DRM_FORMAT_NV12_Y_TILED_INTEL:
case DRM_FORMAT_NV16:
case DRM_FORMAT_P010:
return 2;
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YUV422:
Expand Down

0 comments on commit 9e49f05

Please sign in to comment.