|
35 | 35 |
|
36 | 36 | #define IS_PRIME_VALID(prime) ((prime >= 0) ? true : false) |
37 | 37 |
|
| 38 | +#define DRM_FORMAT_MOD_VENDOR_NONE 0 |
38 | 39 | #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 |
39 | 40 |
|
40 | 41 | #define fourcc_mod_code(vendor, val) \ |
41 | 42 | ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL)) |
42 | 43 |
|
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 | | - |
46 | 44 | #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ |
47 | 45 | ((__u32)(c) << 16) | ((__u32)(d) << 24)) |
48 | 46 |
|
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 */ |
56 | 58 |
|
57 | 59 | static unsigned int ConvertMfxFourccToVAFormat(mfxU32 fourcc) |
58 | 60 | { |
@@ -603,7 +605,10 @@ mfxStatus MfxVaFrameAllocator::CreateSurfaceFromGralloc(const IMfxGrallocModule: |
603 | 605 | desc.num_objects = 1; |
604 | 606 | desc.objects[0].fd = info.prime; |
605 | 607 | 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; |
607 | 612 | //desc.objects[0].drm_format_modifier = I915_FORMAT_MOD_4_TILED; |
608 | 613 | desc.num_layers = 1; |
609 | 614 | desc.layers[0].drm_format = ConvertVAFourccToDrmFormat(va_fourcc); |
|
0 commit comments