summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/libva/files/0002-Add-DRM-format-mappings-for-JPEG-decoder-output.patch
blob: 423614ac5de8f8a6aa10d02336bb4c38f9d7155b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From ea6cd2db43bab97744884001e0d98ba2ff5d3903 Mon Sep 17 00:00:00 2001
From: Philip Langdale <philipl@overt.org>
Date: Sat, 5 Aug 2023 11:46:26 +0800
Subject: [PATCH 2/4] Add DRM format mappings for JPEG decoder output

The output formats from the JPEG decoder are currently not included
in the DRM format mapping functions. This means that any attempt to
call vaExportSurface on JPEG images will fail.

However, there is no functional gap beyond the missing mappings, so if
we add them in, exporting will then work correctly.

The four formats in question are IMC3, 422H, 422V, and 444P.

* 422H and 444P have trivial 1:1 mappings.
* IMC3 can be treated the same as I420, because the only difference is
  the chroma pitch, and that's explicitly set in the descriptor
* 422V (aka 440P) has the same memory layout as 422H - it's just a
  difference in how the consumer handle the chroma

I also added the missing XYUV composite object mapping - it was already
present for separate planes.

Tested with ffmpeg+mpv.

Upstream-Status: Backport [https://github.com/intel/media-driver/commit/c7cd5a68315674d44ac97ec7cc78856fa90b8036]
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
---
 media_driver/linux/common/ddi/media_libva.cpp | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp
index af35be841..1706138a1 100755
--- a/media_driver/linux/common/ddi/media_libva.cpp
+++ b/media_driver/linux/common/ddi/media_libva.cpp
@@ -6981,8 +6981,12 @@ static uint32_t DdiMedia_GetDrmFormatOfSeparatePlane(uint32_t fourcc, int plane)
         {
         case VA_FOURCC_NV12:
         case VA_FOURCC_I420:
+        case VA_FOURCC_IMC3:
         case VA_FOURCC_YV12:
         case VA_FOURCC_YV16:
+        case VA_FOURCC_422H:
+        case VA_FOURCC_422V:
+        case VA_FOURCC_444P:
         case VA_FOURCC_Y800:
         case VA_FOURCC_RGBP:
         case VA_FOURCC_BGRP:
@@ -7055,8 +7059,12 @@ static uint32_t DdiMedia_GetDrmFormatOfSeparatePlane(uint32_t fourcc, int plane)
         case VA_FOURCC_NV12:
             return DRM_FORMAT_GR88;
         case VA_FOURCC_I420:
+        case VA_FOURCC_IMC3:
         case VA_FOURCC_YV12:
         case VA_FOURCC_YV16:
+        case VA_FOURCC_422H:
+        case VA_FOURCC_422V:
+        case VA_FOURCC_444P:
         case VA_FOURCC_RGBP:
         case VA_FOURCC_BGRP:
             return DRM_FORMAT_R8;
@@ -7070,7 +7078,6 @@ static uint32_t DdiMedia_GetDrmFormatOfSeparatePlane(uint32_t fourcc, int plane)
     }
     return 0;
 }
-
 static uint32_t DdiMedia_GetDrmFormatOfCompositeObject(uint32_t fourcc)
 {
     switch (fourcc)
@@ -7079,10 +7086,18 @@ static uint32_t DdiMedia_GetDrmFormatOfCompositeObject(uint32_t fourcc)
         return DRM_FORMAT_NV12;
     case VA_FOURCC_I420:
         return DRM_FORMAT_YUV420;
+    case VA_FOURCC_IMC3:
+        return DRM_FORMAT_YUV420;
     case VA_FOURCC_YV12:
         return DRM_FORMAT_YVU420;
     case VA_FOURCC_YV16:
         return DRM_FORMAT_YVU422;
+    case VA_FOURCC_422H:
+        return DRM_FORMAT_YUV422;
+    case VA_FOURCC_422V:
+        return DRM_FORMAT_YUV422;
+    case VA_FOURCC_444P:
+        return DRM_FORMAT_YUV444;
     case VA_FOURCC_YUY2:
         return DRM_FORMAT_YUYV;
     case VA_FOURCC_YVYU:
@@ -7093,6 +7108,10 @@ static uint32_t DdiMedia_GetDrmFormatOfCompositeObject(uint32_t fourcc)
         return DRM_FORMAT_UYVY;
     case VA_FOURCC_AYUV:
         return DRM_FORMAT_AYUV;
+#if VA_CHECK_VERSION(1, 13, 0)
+    case VA_FOURCC_XYUV:
+        return DRM_FORMAT_XYUV8888;
+#endif
     case VA_FOURCC_Y210:
         return DRM_FORMAT_Y210;
 #if VA_CHECK_VERSION(1, 9, 0)
-- 
2.40.1