Skip to content

Commit fcbd3ee

Browse files
zhangyichixsysopenci
authored andcommitted
[c2][encoder] Fixed the issue scrcpy failure
drm_format_modifier is assigned NONE when encoding. Tracked-On: OAM-111860 Signed-off-by: zhangyichix <yichix.zhang@intel.com>
1 parent 22f04c3 commit fcbd3ee

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

c2_utils/src/mfx_va_allocator.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,26 @@
3535

3636
#define IS_PRIME_VALID(prime) ((prime >= 0) ? true : false)
3737

38+
#define DRM_FORMAT_MOD_VENDOR_NONE 0
3839
#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01
3940

4041
#define fourcc_mod_code(vendor, val) \
4142
((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
4243

43-
#define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9)
44-
#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2)
45-
4644
#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
4745
((__u32)(c) << 16) | ((__u32)(d) << 24))
4846

49-
#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
50-
#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
51-
#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
52-
#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */
53-
#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
54-
#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
55-
#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
47+
#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
48+
#define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9)
49+
#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2)
50+
51+
#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
52+
#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
53+
#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
54+
#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel */
55+
#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
56+
#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
57+
#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
5658

5759
static unsigned int ConvertMfxFourccToVAFormat(mfxU32 fourcc)
5860
{
@@ -603,7 +605,10 @@ mfxStatus MfxVaFrameAllocator::CreateSurfaceFromGralloc(const IMfxGrallocModule:
603605
desc.num_objects = 1;
604606
desc.objects[0].fd = info.prime;
605607
desc.objects[0].size = decode_target ? info.pitches[0] * ((height + 31) & ~31) * 1.5 : info.pitches[0] * ((height + 15) & ~15) * 1.5;
606-
desc.objects[0].drm_format_modifier = I915_FORMAT_MOD_Y_TILED;
608+
if (HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL == info.format || HAL_PIXEL_FORMAT_P010_INTEL == info.format)
609+
desc.objects[0].drm_format_modifier = I915_FORMAT_MOD_Y_TILED;
610+
else
611+
desc.objects[0].drm_format_modifier = DRM_FORMAT_MOD_LINEAR;
607612
//desc.objects[0].drm_format_modifier = I915_FORMAT_MOD_4_TILED;
608613
desc.num_layers = 1;
609614
desc.layers[0].drm_format = ConvertVAFourccToDrmFormat(va_fourcc);

0 commit comments

Comments
 (0)