Skip to content

Commit

Permalink
[VP] Add XRGB 10 bit format support
Browse files Browse the repository at this point in the history
Add XRGB 10 bit format  support.

Change-Id: Ie6ee33eed82d878078b684e04e2ca265a60409e6
  • Loading branch information
Jister authored and intel-mediadev committed Feb 28, 2020
1 parent 7898bbf commit 2baead9
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 128 deletions.
98 changes: 76 additions & 22 deletions media_driver/linux/common/ddi/media_libva.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ int32_t DdiMedia_MediaFormatToOsFormat(DDI_MEDIA_FORMAT format)
return VA_FOURCC_ARGB;
case Media_Format_B10G10R10A2:
return VA_FOURCC_A2R10G10B10;
case Media_Format_R10G10B10X2:
return VA_FOURCC_X2B10G10R10;
case Media_Format_B10G10R10X2:
return VA_FOURCC_X2R10G10B10;
case Media_Format_R5G6B5:
return VA_FOURCC_R5G6B5;
case Media_Format_R8G8B8:
Expand Down Expand Up @@ -501,6 +505,10 @@ DDI_MEDIA_FORMAT DdiMedia_OsFormatToMediaFormat(int32_t fourcc, int32_t rtformat
return Media_Format_B10G10R10A2;
case VA_FOURCC_A2B10G10R10:
return Media_Format_R10G10B10A2;
case VA_FOURCC_X2R10G10B10:
return Media_Format_B10G10R10X2;
case VA_FOURCC_X2B10G10R10:
return Media_Format_R10G10B10X2;
case VA_FOURCC_BGRA:
case VA_FOURCC_ARGB:
#ifdef VA_RT_FORMAT_RGB32_10BPP
Expand Down Expand Up @@ -4018,6 +4026,8 @@ VAStatus DdiMedia_CreateImage(
case VA_FOURCC_IYUV:
case VA_FOURCC_A2R10G10B10:
case VA_FOURCC_A2B10G10R10:
case VA_FOURCC_X2R10G10B10:
case VA_FOURCC_X2B10G10R10:
gmmParams.BaseHeight = height;
gmmParams.Flags.Info.Linear = true;
break;
Expand Down Expand Up @@ -4104,6 +4114,8 @@ VAStatus DdiMedia_CreateImage(
case VA_FOURCC_RGB565:
case VA_FOURCC_A2R10G10B10:
case VA_FOURCC_A2B10G10R10:
case VA_FOURCC_X2R10G10B10:
case VA_FOURCC_X2B10G10R10:
vaimg->num_planes = 1;
vaimg->pitches[0] = gmmPitch;
vaimg->offsets[0] = 0;
Expand Down Expand Up @@ -4346,6 +4358,14 @@ VAStatus DdiMedia_DeriveImage (
vaimg->pitches[0] = mediaSurface->iPitch;
vaimg->offsets[0] = 0;
break;
case Media_Format_R10G10B10X2:
case Media_Format_B10G10R10X2:
vaimg->format.bits_per_pixel = 32;
vaimg->data_size = mediaSurface->iPitch * mediaSurface->iHeight;
vaimg->num_planes = 1;
vaimg->pitches[0] = mediaSurface->iPitch;
vaimg->offsets[0] = 0;
break;
case Media_Format_R5G6B5:
vaimg->format.bits_per_pixel = 16;
vaimg->data_size = mediaSurface->iPitch * mediaSurface->iHeight;
Expand Down Expand Up @@ -6111,18 +6131,30 @@ static uint32_t DdiMedia_GetDrmFormatOfSeparatePlane(uint32_t fourcc, int plane)
// These are not representable as separate planes.
return 0;

case VA_FOURCC_RGBA:
return DRM_FORMAT_ABGR8888;
case VA_FOURCC_RGBX:
return DRM_FORMAT_XBGR8888;
case VA_FOURCC_BGRA:
return DRM_FORMAT_ARGB8888;
case VA_FOURCC_BGRX:
return DRM_FORMAT_XRGB8888;
case VA_FOURCC_ARGB:
return DRM_FORMAT_BGRA8888;
return DRM_FORMAT_ARGB8888;
case VA_FOURCC_ABGR:
return DRM_FORMAT_ABGR8888;
case VA_FOURCC_RGBA:
return DRM_FORMAT_RGBA8888;
case VA_FOURCC_BGRA:
return DRM_FORMAT_BGRA8888;
case VA_FOURCC_XRGB:
return DRM_FORMAT_XRGB8888;
case VA_FOURCC_XBGR:
return DRM_FORMAT_XBGR8888;
case VA_FOURCC_RGBX:
return DRM_FORMAT_RGBX8888;
case VA_FOURCC_BGRX:
return DRM_FORMAT_BGRX8888;
case VA_FOURCC_A2R10G10B10:
return DRM_FORMAT_ARGB2101010;
case VA_FOURCC_A2B10G10R10:
return DRM_FORMAT_ABGR2101010;
case VA_FOURCC_X2R10G10B10:
return DRM_FORMAT_XRGB2101010;
case VA_FOURCC_X2B10G10R10:
return DRM_FORMAT_XBGR2101010;
}
}
else
Expand Down Expand Up @@ -6158,28 +6190,50 @@ static uint32_t DdiMedia_GetDrmFormatOfCompositeObject(uint32_t fourcc)
return DRM_FORMAT_YVU422;
case VA_FOURCC_YUY2:
return DRM_FORMAT_YUYV;
case VA_FOURCC_YVYU:
return DRM_FORMAT_YVYU;
case VA_FOURCC_VYUY:
return DRM_FORMAT_VYUY;
case VA_FOURCC_UYVY:
return DRM_FORMAT_UYVY;
case VA_FOURCC_Y210:
return DRM_FORMAT_Y210;
case VA_FOURCC_Y216:
return DRM_FORMAT_Y216;
case VA_FOURCC_Y410:
return DRM_FORMAT_Y410;
case VA_FOURCC_Y416:
return DRM_FORMAT_Y416;
case VA_FOURCC_Y800:
return DRM_FORMAT_R8;
case VA_FOURCC_P010:
return DRM_FORMAT_P010;
case VA_FOURCC_I010:
// These currently have no composite DRM format - they are usable
// only as separate planes.
return 0;
case VA_FOURCC_RGBA:
return DRM_FORMAT_ABGR8888;
case VA_FOURCC_RGBX:
return DRM_FORMAT_XBGR8888;
case VA_FOURCC_BGRA:
return DRM_FORMAT_ARGB8888;
case VA_FOURCC_BGRX:
return DRM_FORMAT_XRGB8888;
case VA_FOURCC_P016:
return DRM_FORMAT_P016;
case VA_FOURCC_ARGB:
return DRM_FORMAT_BGRA8888;
return DRM_FORMAT_ARGB8888;
case VA_FOURCC_ABGR:
return DRM_FORMAT_ABGR8888;
case VA_FOURCC_RGBA:
return DRM_FORMAT_RGBA8888;
case VA_FOURCC_BGRA:
return DRM_FORMAT_BGRA8888;
case VA_FOURCC_XRGB:
return DRM_FORMAT_XRGB8888;
case VA_FOURCC_XBGR:
return DRM_FORMAT_XBGR8888;
case VA_FOURCC_RGBX:
return DRM_FORMAT_RGBX8888;
case VA_FOURCC_BGRX:
return DRM_FORMAT_BGRX8888;
case VA_FOURCC_A2R10G10B10:
return DRM_FORMAT_ARGB2101010;
case VA_FOURCC_A2B10G10R10:
return DRM_FORMAT_ABGR2101010;
case VA_FOURCC_X2R10G10B10:
return DRM_FORMAT_XRGB2101010;
case VA_FOURCC_X2B10G10R10:
return DRM_FORMAT_XBGR2101010;
}
return 0;
}
Expand Down
6 changes: 5 additions & 1 deletion media_driver/linux/common/ddi/media_libva_caps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3075,7 +3075,9 @@ GMM_RESOURCE_FORMAT MediaLibvaCaps::ConvertMediaFmtToGmmFmt(
case Media_Format_Buffer : return GMM_FORMAT_RENDER_8BIT;
case Media_Format_P010 : return GMM_FORMAT_P010_TYPE;
case Media_Format_R10G10B10A2: return GMM_FORMAT_R10G10B10A2_UNORM_TYPE;
case Media_Format_B10G10R10A2: return GMM_FORMAT_B10G10R10A2_UNORM_TYPE;
case Media_Format_B10G10R10A2: return GMM_FORMAT_B10G10R10A2_UNORM_TYPE;
case Media_Format_R10G10B10X2: return GMM_FORMAT_R10G10B10A2_UNORM_TYPE;
case Media_Format_B10G10R10X2: return GMM_FORMAT_B10G10R10A2_UNORM_TYPE;
default : return GMM_FORMAT_INVALID;
}
}
Expand Down Expand Up @@ -3117,6 +3119,8 @@ GMM_RESOURCE_FORMAT MediaLibvaCaps::ConvertFourccToGmmFmt(uint32_t fourcc)
case VA_FOURCC_Y800 : return GMM_FORMAT_GENERIC_8BIT;
case VA_FOURCC_A2R10G10B10 : return GMM_FORMAT_R10G10B10A2_UNORM_TYPE;
case VA_FOURCC_A2B10G10R10 : return GMM_FORMAT_B10G10R10A2_UNORM_TYPE;
case VA_FOURCC_X2R10G10B10 : return GMM_FORMAT_R10G10B10A2_UNORM_TYPE;
case VA_FOURCC_X2B10G10R10 : return GMM_FORMAT_B10G10R10A2_UNORM_TYPE;
default : return GMM_FORMAT_INVALID;
}
}
Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/ddi/media_libva_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ void DdiMedia_MediaSurfaceToMosResource(DDI_MEDIA_SURFACE *mediaSurface, MOS_RES
mosResource->Format = Format_Y16U;
break;
case Media_Format_R10G10B10A2:
case Media_Format_R10G10B10X2:
mosResource->Format = Format_R10G10B10A2;
break;
case Media_Format_B10G10R10A2:
case Media_Format_B10G10R10X2:
mosResource->Format = Format_B10G10R10A2;
break;
case Media_Format_UYVY:
Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/ddi/media_libva_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ typedef enum _DDI_MEDIA_FORMAT
Media_Format_R5G6B5 ,
Media_Format_R10G10B10A2 ,
Media_Format_B10G10R10A2 ,
Media_Format_R10G10B10X2 ,
Media_Format_B10G10R10X2 ,
Media_Format_CPU ,

Media_Format_YUY2 ,
Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/ddi/media_libva_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ VAStatus DdiMediaUtil_AllocateSurface(
case Media_Format_R8G8B8:
case Media_Format_R10G10B10A2:
case Media_Format_B10G10R10A2:
case Media_Format_R10G10B10X2:
case Media_Format_B10G10R10X2:
case Media_Format_A16R16G16B16:
case Media_Format_A16B16G16R16:
if (VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER != mediaSurface->surfaceUsageHint)
Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/os/mos_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,11 @@ MOS_STATUS MosInterface::ConvertResourceFromDdi(
resource->Format = Format_Y16U;
break;
case Media_Format_R10G10B10A2:
case Media_Format_R10G10B10X2:
resource->Format = Format_R10G10B10A2;
break;
case Media_Format_B10G10R10A2:
case Media_Format_B10G10R10X2:
resource->Format = Format_B10G10R10A2;
break;
case Media_Format_UYVY:
Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/vp/ddi/media_libva_vp.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,11 @@ MOS_FORMAT VpGetFormatFromMediaFormat(DDI_MEDIA_FORMAT mf)
format = Format_P016;
break;
case Media_Format_R10G10B10A2:
case Media_Format_R10G10B10X2:
format = Format_R10G10B10A2;
break;
case Media_Format_B10G10R10A2:
case Media_Format_B10G10R10X2:
format =Format_B10G10R10A2;
break;
case Media_Format_RGBP:
Expand Down
50 changes: 27 additions & 23 deletions media_driver/linux/gen10/ddi/media_libva_caps_g10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,33 @@
#include "media_libva_caps_factory.h"

const VAImageFormat m_supportedImageformatsG10[] =
{ {VA_FOURCC_BGRA, VA_LSB_FIRST, 32, 32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff}, /* [31:0] B:G:R:A 8:8:8:8 little endian */
{VA_FOURCC_ARGB, VA_LSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}, /* [31:0] A:R:G:B 8:8:8:8 little endian */
{VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff}, /* [31:0] R:G:B:A 8:8:8:8 little endian */
{VA_FOURCC_ABGR, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000}, /* [31:0] A:B:G:R 8:8:8:8 little endian */
{VA_FOURCC_BGRX, VA_LSB_FIRST, 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0}, /* [31:0] B:G:R:x 8:8:8:8 little endian */
{VA_FOURCC_XRGB, VA_LSB_FIRST, 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0}, /* [31:0] x:R:G:B 8:8:8:8 little endian */
{VA_FOURCC_RGBX, VA_LSB_FIRST, 32, 24, 0xff000000, 0x00ff0000, 0x0000ff00, 0}, /* [31:0] R:G:B:x 8:8:8:8 little endian */
{VA_FOURCC_XBGR, VA_LSB_FIRST, 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0}, /* [31:0] x:B:G:R 8:8:8:8 little endian */
{VA_FOURCC_RGB565, VA_LSB_FIRST, 16, 16, 0xf800, 0x07e0, 0x001f, 0},
{VA_FOURCC_AYUV, VA_LSB_FIRST, 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
{VA_FOURCC_NV12, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_NV21, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_YUY2, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_UYVY, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_YV12, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_I420, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_422H, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_422V, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_444P, VA_LSB_FIRST, 24, 0,0,0,0,0},
{VA_FOURCC_IMC3, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_P010, VA_LSB_FIRST, 24, 0,0,0,0,0},
{VA_FOURCC_A2R10G10B10, VA_LSB_FIRST, 32, 30, 0x3ff00000, 0x000ffc00, 0x000003ff, 0x30000000}, /* [31:0] A:R:G:B 2:10:10:10 little endian */
{VA_FOURCC_A2B10G10R10, VA_LSB_FIRST, 32, 30, 0x000003ff, 0x000ffc00, 0x3ff00000, 0x30000000} /* [31:0] A:B:G:R 2:10:10:10 little endian */
{ {VA_FOURCC_BGRA, VA_LSB_FIRST, 32, 32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff}, /* [31:0] B:G:R:A 8:8:8:8 little endian */
{VA_FOURCC_ARGB, VA_LSB_FIRST, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}, /* [31:0] A:R:G:B 8:8:8:8 little endian */
{VA_FOURCC_RGBA, VA_LSB_FIRST, 32, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff}, /* [31:0] R:G:B:A 8:8:8:8 little endian */
{VA_FOURCC_ABGR, VA_LSB_FIRST, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000}, /* [31:0] A:B:G:R 8:8:8:8 little endian */
{VA_FOURCC_BGRX, VA_LSB_FIRST, 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0}, /* [31:0] B:G:R:x 8:8:8:8 little endian */
{VA_FOURCC_XRGB, VA_LSB_FIRST, 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0}, /* [31:0] x:R:G:B 8:8:8:8 little endian */
{VA_FOURCC_RGBX, VA_LSB_FIRST, 32, 24, 0xff000000, 0x00ff0000, 0x0000ff00, 0}, /* [31:0] R:G:B:x 8:8:8:8 little endian */
{VA_FOURCC_XBGR, VA_LSB_FIRST, 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0}, /* [31:0] x:B:G:R 8:8:8:8 little endian */
{VA_FOURCC_A2R10G10B10, VA_LSB_FIRST, 32, 30, 0x3ff00000, 0x000ffc00, 0x000003ff, 0x30000000}, /* [31:0] A:R:G:B 2:10:10:10 little endian */
{VA_FOURCC_A2B10G10R10, VA_LSB_FIRST, 32, 30, 0x000003ff, 0x000ffc00, 0x3ff00000, 0x30000000}, /* [31:0] A:B:G:R 2:10:10:10 little endian */
{VA_FOURCC_X2R10G10B10, VA_LSB_FIRST, 32, 30, 0x3ff00000, 0x000ffc00, 0x000003ff, 0}, /* [31:0] X:R:G:B 2:10:10:10 little endian */
{VA_FOURCC_X2B10G10R10, VA_LSB_FIRST, 32, 30, 0x000003ff, 0x000ffc00, 0x3ff00000, 0}, /* [31:0] X:B:G:R 2:10:10:10 little endian */
{VA_FOURCC_RGB565, VA_LSB_FIRST, 16, 16, 0xf800, 0x07e0, 0x001f, 0}, /* [15:0] R:G:B 5:6:5 little endian */
{VA_FOURCC_AYUV, VA_LSB_FIRST, 32, 0,0,0,0,0},
{VA_FOURCC_Y800, VA_LSB_FIRST, 8, 0,0,0,0,0},
{VA_FOURCC_NV12, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_NV21, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_YUY2, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_UYVY, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_YV12, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_I420, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_411P, VA_LSB_FIRST, 12, 0,0,0,0,0},
{VA_FOURCC_422H, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_422V, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_444P, VA_LSB_FIRST, 24, 0,0,0,0,0},
{VA_FOURCC_IMC3, VA_LSB_FIRST, 16, 0,0,0,0,0},
{VA_FOURCC_P010, VA_LSB_FIRST, 24, 0,0,0,0,0}
};

VAStatus MediaLibvaCapsG10::QueryImageFormats(VAImageFormat *formatList, int32_t *numFormats)
Expand Down
Loading

0 comments on commit 2baead9

Please sign in to comment.