diff options
| author | John Toomey <john.toomey@amd.com> | 2023-11-16 14:12:47 +0000 |
|---|---|---|
| committer | Mark Hatle <mark.hatle@amd.com> | 2023-11-22 12:07:57 -0600 |
| commit | 67f3300d447c53e427d709867166d3f79ea198ee (patch) | |
| tree | 31dadbfa599e0a4e3213ef5c6b0514a3165125ec | |
| parent | 7ae7c3955bd67fb5405eec09ec5b6172fdc0b9ba (diff) | |
| download | meta-xilinx-67f3300d447c53e427d709867166d3f79ea198ee.tar.gz | |
libdrm: Move libdrm patches to meta-xilinx
Move all libdrm patches from meta-petalinux to meta-xilinx
Signed-off-by: John Toomey <john.toomey@amd.com>
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
7 files changed, 1350 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-graphics/drm/files/0001-PATCH-libdrm-Update-drm-header-file-with-XV15-and-XV.patch b/meta-xilinx-core/recipes-graphics/drm/files/0001-PATCH-libdrm-Update-drm-header-file-with-XV15-and-XV.patch new file mode 100644 index 00000000..5f7df974 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/files/0001-PATCH-libdrm-Update-drm-header-file-with-XV15-and-XV.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From 7edb14622061e87bb4810fb648017b43e767d4c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | ||
| 3 | Date: Mon, 1 Nov 2021 12:59:36 -0700 | ||
| 4 | Subject: [PATCH 1/5] [PATCH] libdrm: Update drm header file with XV15 and XV20 | ||
| 5 | |||
| 6 | This patch updates drm header file with YUV 420 and | ||
| 7 | YUV422 10 bit formats. | ||
| 8 | |||
| 9 | Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com> | ||
| 10 | Upstream-Status: Pending | ||
| 11 | Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | ||
| 12 | --- | ||
| 13 | include/drm/drm_fourcc.h | 8 ++++++++ | ||
| 14 | 1 file changed, 8 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h | ||
| 17 | index ed0258c..c5cdaed 100644 | ||
| 18 | --- a/include/drm/drm_fourcc.h | ||
| 19 | +++ b/include/drm/drm_fourcc.h | ||
| 20 | @@ -318,6 +318,14 @@ extern "C" { | ||
| 21 | #define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') | ||
| 22 | |||
| 23 | /* | ||
| 24 | + * 2 plane 10 bit per component YCbCr | ||
| 25 | + * index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian | ||
| 26 | + * index 1 = Cb:Cr plane, [63:0] x:Cb2:Cr2:Cb1:x:Cr1:Cb0:Cr0 2:10:10:10:2:10:10:10 little endian | ||
| 27 | + */ | ||
| 28 | +#define DRM_FORMAT_XV15 fourcc_code('X', 'V', '1', '5') /* 2x2 subsampled Cb:Cr plane 2:10:10:10 */ | ||
| 29 | +#define DRM_FORMAT_XV20 fourcc_code('X', 'V', '2', '0') /* 2x1 subsampled Cb:Cr plane 2:10:10:10 */ | ||
| 30 | + | ||
| 31 | +/* | ||
| 32 | * 3 plane YCbCr | ||
| 33 | * index 0: Y plane, [7:0] Y | ||
| 34 | * index 1: Cb plane, [7:0] Cb | ||
| 35 | -- | ||
| 36 | 2.7.4 | ||
| 37 | |||
diff --git a/meta-xilinx-core/recipes-graphics/drm/files/0001-headers-Sync-with-HDR-from-v5.15.patch b/meta-xilinx-core/recipes-graphics/drm/files/0001-headers-Sync-with-HDR-from-v5.15.patch new file mode 100644 index 00000000..02916658 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/files/0001-headers-Sync-with-HDR-from-v5.15.patch | |||
| @@ -0,0 +1,205 @@ | |||
| 1 | From d159e3f782d33988e52db462948e2e0eab2b9a03 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Rohit Visavalia <rohit.visavalia@xilinx.com> | ||
| 3 | Date: Thu, 17 Mar 2022 08:21:41 -0700 | ||
| 4 | Subject: [PATCH] headers: Sync with HDR from v5.15 | ||
| 5 | |||
| 6 | Sync drm_mode.h with linux-xlnx/include/uapi/drm/drm_mode.h for HDR | ||
| 7 | |||
| 8 | Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com> | ||
| 9 | --- | ||
| 10 | include/drm/drm_mode.h | 129 +++++++++++++++++++++++++++++++++++++++-- | ||
| 11 | 1 file changed, 125 insertions(+), 4 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h | ||
| 14 | index 9b6722d..bbce882 100644 | ||
| 15 | --- a/include/drm/drm_mode.h | ||
| 16 | +++ b/include/drm/drm_mode.h | ||
| 17 | @@ -312,16 +312,48 @@ struct drm_mode_set_plane { | ||
| 18 | __u32 src_w; | ||
| 19 | }; | ||
| 20 | |||
| 21 | +/** | ||
| 22 | + * struct drm_mode_get_plane - Get plane metadata. | ||
| 23 | + * | ||
| 24 | + * Userspace can perform a GETPLANE ioctl to retrieve information about a | ||
| 25 | + * plane. | ||
| 26 | + * | ||
| 27 | + * To retrieve the number of formats supported, set @count_format_types to zero | ||
| 28 | + * and call the ioctl. @count_format_types will be updated with the value. | ||
| 29 | + * | ||
| 30 | + * To retrieve these formats, allocate an array with the memory needed to store | ||
| 31 | + * @count_format_types formats. Point @format_type_ptr to this array and call | ||
| 32 | + * the ioctl again (with @count_format_types still set to the value returned in | ||
| 33 | + * the first ioctl call). | ||
| 34 | + */ | ||
| 35 | struct drm_mode_get_plane { | ||
| 36 | + /** | ||
| 37 | + * @plane_id: Object ID of the plane whose information should be | ||
| 38 | + * retrieved. Set by caller. | ||
| 39 | + */ | ||
| 40 | __u32 plane_id; | ||
| 41 | |||
| 42 | + /** @crtc_id: Object ID of the current CRTC. */ | ||
| 43 | __u32 crtc_id; | ||
| 44 | + /** @fb_id: Object ID of the current fb. */ | ||
| 45 | __u32 fb_id; | ||
| 46 | |||
| 47 | + /** | ||
| 48 | + * @possible_crtcs: Bitmask of CRTC's compatible with the plane. CRTC's | ||
| 49 | + * are created and they receive an index, which corresponds to their | ||
| 50 | + * position in the bitmask. Bit N corresponds to | ||
| 51 | + * :ref:`CRTC index<crtc_index>` N. | ||
| 52 | + */ | ||
| 53 | __u32 possible_crtcs; | ||
| 54 | + /** @gamma_size: Never used. */ | ||
| 55 | __u32 gamma_size; | ||
| 56 | |||
| 57 | + /** @count_format_types: Number of formats. */ | ||
| 58 | __u32 count_format_types; | ||
| 59 | + /** | ||
| 60 | + * @format_type_ptr: Pointer to ``__u32`` array of formats that are | ||
| 61 | + * supported by the plane. These formats do not require modifiers. | ||
| 62 | + */ | ||
| 63 | __u64 format_type_ptr; | ||
| 64 | }; | ||
| 65 | |||
| 66 | @@ -509,22 +541,74 @@ struct drm_mode_get_connector { | ||
| 67 | */ | ||
| 68 | #define DRM_MODE_PROP_ATOMIC 0x80000000 | ||
| 69 | |||
| 70 | +/** | ||
| 71 | + * struct drm_mode_property_enum - Description for an enum/bitfield entry. | ||
| 72 | + * @value: numeric value for this enum entry. | ||
| 73 | + * @name: symbolic name for this enum entry. | ||
| 74 | + * | ||
| 75 | + * See struct drm_property_enum for details. | ||
| 76 | + */ | ||
| 77 | struct drm_mode_property_enum { | ||
| 78 | __u64 value; | ||
| 79 | char name[DRM_PROP_NAME_LEN]; | ||
| 80 | }; | ||
| 81 | |||
| 82 | +/** | ||
| 83 | + * struct drm_mode_get_property - Get property metadata. | ||
| 84 | + * | ||
| 85 | + * User-space can perform a GETPROPERTY ioctl to retrieve information about a | ||
| 86 | + * property. The same property may be attached to multiple objects, see | ||
| 87 | + * "Modeset Base Object Abstraction". | ||
| 88 | + * | ||
| 89 | + * The meaning of the @values_ptr field changes depending on the property type. | ||
| 90 | + * See &drm_property.flags for more details. | ||
| 91 | + * | ||
| 92 | + * The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the | ||
| 93 | + * property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For | ||
| 94 | + * backwards compatibility, the kernel will always set @count_enum_blobs to | ||
| 95 | + * zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must | ||
| 96 | + * ignore these two fields if the property has a different type. | ||
| 97 | + * | ||
| 98 | + * User-space is expected to retrieve values and enums by performing this ioctl | ||
| 99 | + * at least twice: the first time to retrieve the number of elements, the | ||
| 100 | + * second time to retrieve the elements themselves. | ||
| 101 | + * | ||
| 102 | + * To retrieve the number of elements, set @count_values and @count_enum_blobs | ||
| 103 | + * to zero, then call the ioctl. @count_values will be updated with the number | ||
| 104 | + * of elements. If the property has the type &DRM_MODE_PROP_ENUM or | ||
| 105 | + * &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well. | ||
| 106 | + * | ||
| 107 | + * To retrieve the elements themselves, allocate an array for @values_ptr and | ||
| 108 | + * set @count_values to its capacity. If the property has the type | ||
| 109 | + * &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for | ||
| 110 | + * @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl | ||
| 111 | + * again will fill the arrays. | ||
| 112 | + */ | ||
| 113 | struct drm_mode_get_property { | ||
| 114 | - __u64 values_ptr; /* values and blob lengths */ | ||
| 115 | - __u64 enum_blob_ptr; /* enum and blob id ptrs */ | ||
| 116 | + /** @values_ptr: Pointer to a ``__u64`` array. */ | ||
| 117 | + __u64 values_ptr; | ||
| 118 | + /** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */ | ||
| 119 | + __u64 enum_blob_ptr; | ||
| 120 | |||
| 121 | + /** | ||
| 122 | + * @prop_id: Object ID of the property which should be retrieved. Set | ||
| 123 | + * by the caller. | ||
| 124 | + */ | ||
| 125 | __u32 prop_id; | ||
| 126 | + /** | ||
| 127 | + * @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for | ||
| 128 | + * a definition of the flags. | ||
| 129 | + */ | ||
| 130 | __u32 flags; | ||
| 131 | + /** | ||
| 132 | + * @name: Symbolic property name. User-space should use this field to | ||
| 133 | + * recognize properties. | ||
| 134 | + */ | ||
| 135 | char name[DRM_PROP_NAME_LEN]; | ||
| 136 | |||
| 137 | + /** @count_values: Number of elements in @values_ptr. */ | ||
| 138 | __u32 count_values; | ||
| 139 | - /* This is only used to count enum values, not blobs. The _blobs is | ||
| 140 | - * simply because of a historical reason, i.e. backwards compat. */ | ||
| 141 | + /** @count_enum_blobs: Number of elements in @enum_blob_ptr. */ | ||
| 142 | __u32 count_enum_blobs; | ||
| 143 | }; | ||
| 144 | |||
| 145 | @@ -578,6 +662,8 @@ struct drm_mode_fb_cmd { | ||
| 146 | |||
| 147 | #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */ | ||
| 148 | #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */ | ||
| 149 | +#define DRM_MODE_FB_ALTERNATE_TOP (1<<2) /* for alternate top field */ | ||
| 150 | +#define DRM_MODE_FB_ALTERNATE_BOTTOM (1<<3) /* for alternate bottom field */ | ||
| 151 | |||
| 152 | struct drm_mode_fb_cmd2 { | ||
| 153 | __u32 fb_id; | ||
| 154 | @@ -733,6 +819,20 @@ struct drm_color_lut { | ||
| 155 | __u16 reserved; | ||
| 156 | }; | ||
| 157 | |||
| 158 | +enum drm_hdr_type { | ||
| 159 | + /* | ||
| 160 | + * This is for the gen_hdr_output_metadata structure. | ||
| 161 | + * MSB differentiates static (0) or dynamic (1) metadata. | ||
| 162 | + * Other 15 bits represent specific HDR standards. | ||
| 163 | + */ | ||
| 164 | + | ||
| 165 | + /* static HDR */ | ||
| 166 | + DRM_HDR_TYPE_HDR10 = 0x0000, | ||
| 167 | + | ||
| 168 | + /* dynamic HDR */ | ||
| 169 | + DRM_HDR_TYPE_HDR10P = 1 << 15 | DRM_HDR_TYPE_HDR10, | ||
| 170 | +}; | ||
| 171 | + | ||
| 172 | /** | ||
| 173 | * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. | ||
| 174 | * | ||
| 175 | @@ -819,6 +919,27 @@ struct hdr_output_metadata { | ||
| 176 | }; | ||
| 177 | }; | ||
| 178 | |||
| 179 | +/** | ||
| 180 | + * struct gen_hdr_output_metadata - Generic HDR output metadata | ||
| 181 | + * | ||
| 182 | + * Generic HDR Metadata Information to be passed from userspace | ||
| 183 | + */ | ||
| 184 | +struct gen_hdr_output_metadata { | ||
| 185 | + /** | ||
| 186 | + * @metadata_type: HDR type. | ||
| 187 | + */ | ||
| 188 | + __u16 metadata_type; | ||
| 189 | + /** | ||
| 190 | + * @size: size of payload/metadata. | ||
| 191 | + */ | ||
| 192 | + __u16 size; | ||
| 193 | + /** | ||
| 194 | + * @payload: Actual metadata - HDR Metadata Infoframe. | ||
| 195 | + * Currently the largest extended HDR infoframe is 4000 bytes. | ||
| 196 | + */ | ||
| 197 | + __u8 payload[4000]; | ||
| 198 | +}; | ||
| 199 | + | ||
| 200 | #define DRM_MODE_PAGE_FLIP_EVENT 0x01 | ||
| 201 | #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 | ||
| 202 | #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 | ||
| 203 | -- | ||
| 204 | 2.17.1 | ||
| 205 | |||
diff --git a/meta-xilinx-core/recipes-graphics/drm/files/0001-modetest-Add-YUV444-and-X403-format-support-for-mode.patch b/meta-xilinx-core/recipes-graphics/drm/files/0001-modetest-Add-YUV444-and-X403-format-support-for-mode.patch new file mode 100644 index 00000000..6e546fb0 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/files/0001-modetest-Add-YUV444-and-X403-format-support-for-mode.patch | |||
| @@ -0,0 +1,433 @@ | |||
| 1 | From de3fffbf7af9d28b5f9d9e118de448a54e2628dd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Anil Kumar Mamidala <anil.mamidala@xilinx.com> | ||
| 3 | Date: Wed, 27 Oct 2021 16:04:47 +0530 | ||
| 4 | Subject: [PATCH] modetest: Add YUV444 and X403 format support for modetest | ||
| 5 | |||
| 6 | Add YUV44 8-bit and X403 10-bit formats support to modetest | ||
| 7 | for generating color bar pattern. | ||
| 8 | |||
| 9 | Signed-off-by: Anil Kumar Mamidala <anil.mamidala@xilinx.com> | ||
| 10 | --- | ||
| 11 | include/drm/drm_fourcc.h | 7 + | ||
| 12 | tests/modetest/buffers.c | 32 +++++ | ||
| 13 | tests/util/format.c | 4 + | ||
| 14 | tests/util/pattern.c | 270 +++++++++++++++++++++++++++++++++++++++ | ||
| 15 | 4 files changed, 313 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h | ||
| 18 | index 32966bd..b93778c 100644 | ||
| 19 | --- a/include/drm/drm_fourcc.h | ||
| 20 | +++ b/include/drm/drm_fourcc.h | ||
| 21 | @@ -352,6 +352,13 @@ extern "C" { | ||
| 22 | #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ | ||
| 23 | #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ | ||
| 24 | |||
| 25 | +/* 3 plane non-subsampled (444) YCbCr | ||
| 26 | + * 10 bits per component | ||
| 27 | + * index 0: Y plane, [31:0] x:Y2:Y1:Y0 [2:10:10:10] little endian | ||
| 28 | + * index 1: Cb plane, [31:0] x:Cb2:Cb1:Cb0 [2:10:10:10] little endian | ||
| 29 | + * index 2: Cr plane, [31:0] x:Cr2:Cr1:Cr0 [2:10:10:10] little endian | ||
| 30 | + */ | ||
| 31 | +#define DRM_FORMAT_X403 fourcc_code('X', '4', '0', '3') /* non-subsampled Cb:Cr plane, 10 bit per channel */ | ||
| 32 | |||
| 33 | /* | ||
| 34 | * Format Modifiers: | ||
| 35 | diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c | ||
| 36 | index 4c15ec8..0529978 100644 | ||
| 37 | --- a/tests/modetest/buffers.c | ||
| 38 | +++ b/tests/modetest/buffers.c | ||
| 39 | @@ -142,11 +142,13 @@ bo_create(int fd, unsigned int format, | ||
| 40 | case DRM_FORMAT_NV61: | ||
| 41 | case DRM_FORMAT_YUV420: | ||
| 42 | case DRM_FORMAT_YVU420: | ||
| 43 | + case DRM_FORMAT_YUV444: | ||
| 44 | bpp = 8; | ||
| 45 | break; | ||
| 46 | |||
| 47 | case DRM_FORMAT_XV15: | ||
| 48 | case DRM_FORMAT_XV20: | ||
| 49 | + case DRM_FORMAT_X403: | ||
| 50 | bpp = 10; | ||
| 51 | break; | ||
| 52 | |||
| 53 | @@ -230,12 +232,24 @@ bo_create(int fd, unsigned int format, | ||
| 54 | virtual_height = height * 2; | ||
| 55 | break; | ||
| 56 | |||
| 57 | + case DRM_FORMAT_X403: | ||
| 58 | + virtual_width = (width * 32) / 30; | ||
| 59 | + virtual_height = height * 3; | ||
| 60 | + break; | ||
| 61 | + | ||
| 62 | + | ||
| 63 | case DRM_FORMAT_NV16: | ||
| 64 | case DRM_FORMAT_NV61: | ||
| 65 | virtual_width = width; | ||
| 66 | virtual_height = height * 2; | ||
| 67 | break; | ||
| 68 | |||
| 69 | + case DRM_FORMAT_YUV444: | ||
| 70 | + virtual_width = width; | ||
| 71 | + virtual_height = height * 3; | ||
| 72 | + break; | ||
| 73 | + | ||
| 74 | + | ||
| 75 | default: | ||
| 76 | virtual_width = width; | ||
| 77 | virtual_height = height; | ||
| 78 | @@ -286,6 +300,24 @@ bo_create(int fd, unsigned int format, | ||
| 79 | planes[1] = virtual + offsets[1]; | ||
| 80 | break; | ||
| 81 | |||
| 82 | + case DRM_FORMAT_X403: | ||
| 83 | + case DRM_FORMAT_YUV444: | ||
| 84 | + offsets[0] = 0; | ||
| 85 | + handles[0] = bo->handle; | ||
| 86 | + pitches[0] = bo->pitch; | ||
| 87 | + pitches[1] = pitches[0]; | ||
| 88 | + offsets[1] = pitches[0] * height; | ||
| 89 | + handles[1] = bo->handle; | ||
| 90 | + pitches[2] = pitches[1]; | ||
| 91 | + offsets[2] = offsets[1] + pitches[1] * height; | ||
| 92 | + handles[2] = bo->handle; | ||
| 93 | + | ||
| 94 | + | ||
| 95 | + planes[0] = virtual; | ||
| 96 | + planes[1] = virtual + offsets[1]; | ||
| 97 | + planes[2] = virtual + offsets[2]; | ||
| 98 | + break; | ||
| 99 | + | ||
| 100 | case DRM_FORMAT_YUV420: | ||
| 101 | case DRM_FORMAT_YVU420: | ||
| 102 | offsets[0] = 0; | ||
| 103 | diff --git a/tests/util/format.c b/tests/util/format.c | ||
| 104 | index e4b612b..ba7267f 100644 | ||
| 105 | --- a/tests/util/format.c | ||
| 106 | +++ b/tests/util/format.c | ||
| 107 | @@ -57,6 +57,10 @@ static const struct util_format_info format_info[] = { | ||
| 108 | /* YUV planar */ | ||
| 109 | { DRM_FORMAT_YUV420, "YU12", MAKE_YUV_INFO(YUV_YCbCr, 2, 2, 1) }, | ||
| 110 | { DRM_FORMAT_YVU420, "YV12", MAKE_YUV_INFO(YUV_YCrCb, 2, 2, 1) }, | ||
| 111 | + { DRM_FORMAT_YUV444, "YU24", MAKE_YUV_INFO(YUV_YCbCr, 1, 1, 1) }, | ||
| 112 | + { DRM_FORMAT_YVU444, "YV24", MAKE_YUV_INFO(YUV_YCrCb, 1, 1, 1) }, | ||
| 113 | + { DRM_FORMAT_X403, "X403", MAKE_YUV_INFO(YUV_YCbCr, 1, 1, 1) }, | ||
| 114 | + | ||
| 115 | /* RGB16 */ | ||
| 116 | { DRM_FORMAT_ARGB4444, "AR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 4, 12) }, | ||
| 117 | { DRM_FORMAT_XRGB4444, "XR12", MAKE_RGB_INFO(4, 8, 4, 4, 4, 0, 0, 0) }, | ||
| 118 | diff --git a/tests/util/pattern.c b/tests/util/pattern.c | ||
| 119 | index 0fe2e5f..83049eb 100644 | ||
| 120 | --- a/tests/util/pattern.c | ||
| 121 | +++ b/tests/util/pattern.c | ||
| 122 | @@ -426,6 +426,175 @@ static void fill_smpte_yuv_semiplanar_10b( | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | +static void fill_smpte_yuv_planar_x403( | ||
| 127 | + const struct util_yuv_info *yuv, | ||
| 128 | + unsigned char *y_mem, unsigned char *u_mem, | ||
| 129 | + unsigned char *v_mem, | ||
| 130 | + unsigned int width, | ||
| 131 | + unsigned int height, unsigned int stride) | ||
| 132 | +{ | ||
| 133 | + const struct color_yuv colors_top[] = { | ||
| 134 | + MAKE_YUV_601(191, 192, 192), /* grey */ | ||
| 135 | + MAKE_YUV_601(192, 192, 0), /* yellow */ | ||
| 136 | + MAKE_YUV_601(0, 192, 192), /* cyan */ | ||
| 137 | + MAKE_YUV_601(0, 192, 0), /* green */ | ||
| 138 | + MAKE_YUV_601(192, 0, 192), /* magenta */ | ||
| 139 | + MAKE_YUV_601(192, 0, 0), /* red */ | ||
| 140 | + MAKE_YUV_601(0, 0, 192), /* blue */ | ||
| 141 | + }; | ||
| 142 | + const struct color_yuv colors_middle[] = { | ||
| 143 | + MAKE_YUV_601(0, 0, 192), /* blue */ | ||
| 144 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 145 | + MAKE_YUV_601(192, 0, 192), /* magenta */ | ||
| 146 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 147 | + MAKE_YUV_601(0, 192, 192), /* cyan */ | ||
| 148 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 149 | + MAKE_YUV_601(192, 192, 192), /* grey */ | ||
| 150 | + }; | ||
| 151 | + const struct color_yuv colors_bottom[] = { | ||
| 152 | + MAKE_YUV_601(0, 33, 76), /* in-phase */ | ||
| 153 | + MAKE_YUV_601(255, 255, 255), /* super white */ | ||
| 154 | + MAKE_YUV_601(50, 0, 106), /* quadrature */ | ||
| 155 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 156 | + MAKE_YUV_601(9, 9, 9), /* 3.5% */ | ||
| 157 | + MAKE_YUV_601(19, 19, 19), /* 7.5% */ | ||
| 158 | + MAKE_YUV_601(29, 29, 29), /* 11.5% */ | ||
| 159 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 160 | + }; | ||
| 161 | + unsigned int cs = yuv->chroma_stride; | ||
| 162 | + unsigned int xsub = yuv->xsub; | ||
| 163 | + unsigned int ysub = yuv->ysub; | ||
| 164 | + unsigned int x; | ||
| 165 | + unsigned int y; | ||
| 166 | + unsigned int cval = 0; | ||
| 167 | + | ||
| 168 | + for (y = 0; y < height * 6 / 9; ++y) { | ||
| 169 | + for (x = 0; x < width; x += 3) | ||
| 170 | + ((unsigned int *)y_mem)[x/3] = | ||
| 171 | + colors_top[x * 7 / width].y << 2 | | ||
| 172 | + colors_top[(x+1) * 7 / width].y << 12 | | ||
| 173 | + colors_top[(x+2) * 7 / width].y << 22; | ||
| 174 | + y_mem += stride; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + for (; y < height * 7 / 9; ++y) { | ||
| 178 | + for (x = 0; x < width; x += 3) | ||
| 179 | + ((unsigned int *)y_mem)[x/3] = | ||
| 180 | + colors_middle[x * 7 / width].y << 2 | | ||
| 181 | + colors_middle[(x+1) * 7 / width].y << 12 | | ||
| 182 | + colors_middle[(x+2) * 7 / width].y << 22; | ||
| 183 | + y_mem += stride; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + for (; y < height; ++y) { | ||
| 187 | + for (x = 0; x < width * 5 / 7; x += 3) | ||
| 188 | + ((unsigned int *)y_mem)[x/3] = | ||
| 189 | + colors_bottom[x * 4 / (width * 5 / 7)].y << 2 | | ||
| 190 | + colors_bottom[(x + 1) * 4 / (width * 5 / 7)] | ||
| 191 | + .y << 12 | colors_bottom[(x + 2) * 4 / | ||
| 192 | + (width * 5 / 7)].y << 22; | ||
| 193 | + | ||
| 194 | + for (; x < width * 6 / 7; x += 3) | ||
| 195 | + ((unsigned int *)y_mem)[x/3] = | ||
| 196 | + colors_bottom[(x - width * 5 / 7) * 3 / | ||
| 197 | + (width / 7) + 4].y << 2 | | ||
| 198 | + colors_bottom[((x + 1) - width * 5 / 7) * 3 / | ||
| 199 | + (width / 7) + 4].y << 12 | | ||
| 200 | + colors_bottom[((x + 2) - width * 5 / 7) * 3 / | ||
| 201 | + (width / 7) + 4].y << 22; | ||
| 202 | + | ||
| 203 | + for (; x < width; x += 3) | ||
| 204 | + ((unsigned int *)y_mem)[x/3] = colors_bottom[7].y << 2 | | ||
| 205 | + colors_bottom[7].y << 12 | | ||
| 206 | + colors_bottom[7].y << 22; | ||
| 207 | + y_mem += stride; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + /* Chroma */ | ||
| 211 | + unsigned int *cb_mem = (unsigned int *)u_mem; | ||
| 212 | + unsigned int *cr_mem = (unsigned int *)v_mem; | ||
| 213 | + | ||
| 214 | + for (y = 0; y < height / ysub * 6 / 9; ++y) { | ||
| 215 | + for (x = 0; x < width; x += 3) { | ||
| 216 | + cval = (colors_top[x * 7 / width].u << 2) | | ||
| 217 | + (colors_top[(x + 1) * 7 / width].u << 12) | | ||
| 218 | + (colors_top[(x + 2) * 7 / width].u << 22); | ||
| 219 | + cb_mem[x/3] = cval; | ||
| 220 | + cval = (colors_top[(x) * 7 / width].v << 2) | | ||
| 221 | + (colors_top[(x + 1) * 7 / width].v << 12) | | ||
| 222 | + (colors_top[(x + 2) * 7 / width].v << 22); | ||
| 223 | + cr_mem[x/3] = cval; | ||
| 224 | + } | ||
| 225 | + cb_mem += stride/4; | ||
| 226 | + cr_mem += stride/4; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + for (; y < height / ysub * 7 / 9; ++y) { | ||
| 230 | + for (x = 0; x < width; x += 3) { | ||
| 231 | + cval = (colors_middle[x * 7 / width].u << 2) | | ||
| 232 | + (colors_middle[(x + 1) * 7 / width].u << 12) | | ||
| 233 | + (colors_middle[(x + 2) * 7 / width].u << 22); | ||
| 234 | + cb_mem[x/3] = cval; | ||
| 235 | + cval = (colors_middle[x * 7 / width].v << 2) | | ||
| 236 | + (colors_middle[(x + 1) * 7 / width].v << 12) | | ||
| 237 | + (colors_middle[(x + 2) * 7 / width].v << 22); | ||
| 238 | + cr_mem[x/3] = cval; | ||
| 239 | + } | ||
| 240 | + cb_mem += stride/4; | ||
| 241 | + cr_mem += stride/4; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + for (; y < height / ysub; ++y) { | ||
| 245 | + for (x = 0; x < width * 5 / 7; x += 3) { | ||
| 246 | + cval = colors_bottom[x * 4 / | ||
| 247 | + (width * 5 / 7)].u << 2 | | ||
| 248 | + colors_bottom[(x + 2) * 4 / | ||
| 249 | + (width * 5 / 7)].u << 12 | | ||
| 250 | + colors_bottom[(x + 4) * 4 / | ||
| 251 | + (width * 5 / 7)]. u << 22; | ||
| 252 | + cb_mem[x/3] = cval; | ||
| 253 | + | ||
| 254 | + cval = colors_bottom[(x) * 4 / | ||
| 255 | + (width * 5 / 7)].v << 2 | | ||
| 256 | + colors_bottom[(x + 2) * 4 / | ||
| 257 | + (width * 5 / 7)].v << 12 | | ||
| 258 | + colors_bottom[(x + 4) * 4 / | ||
| 259 | + (width * 5 / 7)].v << 22; | ||
| 260 | + | ||
| 261 | + cr_mem[x/3] = cval; | ||
| 262 | + } | ||
| 263 | + for (; x < width * 6 / 7; x += 3) { | ||
| 264 | + cval = colors_bottom[(x - width * 5 / 7) * 3 / | ||
| 265 | + (width / 7) + 4].u << 2 | | ||
| 266 | + colors_bottom[((x + 2)- width * 5 / 7) * 3 / | ||
| 267 | + (width / 7) + 4].u << 12 | | ||
| 268 | + colors_bottom[((x + 4) - width * 5 / 7) * 3 / | ||
| 269 | + (width / 7) + 4].u << 22; | ||
| 270 | + cb_mem[x/3] = cval; | ||
| 271 | + | ||
| 272 | + cval = colors_bottom[((x) - width * 5 / 7) * 3 / | ||
| 273 | + (width / 7) + 4].v << 2 | | ||
| 274 | + colors_bottom[((x + 2) - width * 5 / 7) * 3 / | ||
| 275 | + (width / 7) + 4].v << 12 | | ||
| 276 | + colors_bottom[((x + 4) - width * 5 / 7) * 3 / | ||
| 277 | + (width / 7) + 4].v << 22; | ||
| 278 | + cr_mem[x/3] = cval; | ||
| 279 | + } | ||
| 280 | + for (; x < width; x += 3) { | ||
| 281 | + cval = colors_bottom[7].u << 2 | | ||
| 282 | + colors_bottom[7].u << 12 | | ||
| 283 | + colors_bottom[7].u << 22; | ||
| 284 | + cb_mem[x/3] = cval; | ||
| 285 | + cval = colors_bottom[7].v << 2 | | ||
| 286 | + colors_bottom[7].v << 12 | | ||
| 287 | + colors_bottom[7].v << 22; | ||
| 288 | + cr_mem[x/3] = cval; | ||
| 289 | + } | ||
| 290 | + cb_mem += stride/4; | ||
| 291 | + cr_mem += stride/4; | ||
| 292 | + } | ||
| 293 | +} | ||
| 294 | + | ||
| 295 | static void fill_smpte_yuv_planar_10b( | ||
| 296 | const struct util_yuv_info *yuv, | ||
| 297 | unsigned char *y_mem, unsigned char *u_mem, | ||
| 298 | @@ -686,6 +855,88 @@ static void fill_tiles_xv20( | ||
| 299 | } | ||
| 300 | } | ||
| 301 | |||
| 302 | +static void fill_tiles_x403( | ||
| 303 | + const struct util_format_info *info, | ||
| 304 | + unsigned char *y_mem, unsigned char *u_mem, | ||
| 305 | + unsigned char *v_mem, uint32_t width, | ||
| 306 | + uint32_t height, uint32_t stride) | ||
| 307 | +{ | ||
| 308 | + const struct util_yuv_info *yuv = &info->yuv; | ||
| 309 | + unsigned int cs = yuv->chroma_stride; | ||
| 310 | + unsigned int x; | ||
| 311 | + unsigned int y; | ||
| 312 | + uint32_t shifter = 0, LumVal = 0; | ||
| 313 | + uint32_t lumIndex = 0; | ||
| 314 | + uint32_t *Lum; | ||
| 315 | + uint32_t *uChrom; | ||
| 316 | + uint32_t *vChrom; | ||
| 317 | + uint32_t ChromVal = 0; | ||
| 318 | + uint32_t uchromIndex = 0; | ||
| 319 | + uint32_t vchromIndex = 0; | ||
| 320 | + | ||
| 321 | + /* preparing 10 bit Luma */ | ||
| 322 | + Lum = (uint32_t *)y_mem; | ||
| 323 | + for (y = 0; y < height; ++y) { | ||
| 324 | + for (x = 0; x < width; x++) { | ||
| 325 | + div_t d = div(x+y, width); | ||
| 326 | + uint32_t rgb32 = 0x00130502 * (d.quot >> 6) | ||
| 327 | + + 0x000a1120 * (d.rem >> 6); | ||
| 328 | + struct color_yuv color = | ||
| 329 | + MAKE_YUV_601((rgb32 >> 16) & 0xff, | ||
| 330 | + (rgb32 >> 8) & 0xff, rgb32 & 0xff); | ||
| 331 | + //Checking if we got 3 components to pack in 4 bytes | ||
| 332 | + if (shifter == 30) { | ||
| 333 | + Lum[lumIndex] = LumVal; | ||
| 334 | + lumIndex++; shifter = 0; LumVal = 0; | ||
| 335 | + } | ||
| 336 | + LumVal = (LumVal | ((color.y << 2) << shifter)); | ||
| 337 | + shifter += 10; //10 bit precision | ||
| 338 | + } | ||
| 339 | + lumIndex = 0; shifter = 0; LumVal = 0; | ||
| 340 | + y_mem += stride; | ||
| 341 | + Lum = (uint32_t *)y_mem; | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + /* Preparing 10 bit Chroma */ | ||
| 345 | + uChrom = (uint32_t *)u_mem; | ||
| 346 | + vChrom = (uint32_t *)v_mem; | ||
| 347 | + | ||
| 348 | + for (y = 0; y < height; ++y) { | ||
| 349 | + for (x = 0; x < width; x = x + 3) { | ||
| 350 | + div_t d = div(x+y, width); | ||
| 351 | + uint32_t rgb32 = 0x00130502 * (d.quot >> 6) | ||
| 352 | + + 0x000a1120 * (d.rem >> 6); | ||
| 353 | + struct color_yuv color = | ||
| 354 | + MAKE_YUV_601((rgb32 >> 16) & 0xff, | ||
| 355 | + (rgb32 >> 8) & 0xff, rgb32 & 0xff); | ||
| 356 | + uint32_t rgb32_2 = 0x00130502 * (d.quot >> 6) | ||
| 357 | + + 0x000a1120 * (d.rem >> 6); | ||
| 358 | + struct color_yuv color_2 = | ||
| 359 | + MAKE_YUV_601((rgb32_2 >> 16) & 0xff, | ||
| 360 | + (rgb32_2 >> 8) & 0xff, rgb32_2 & 0xff); | ||
| 361 | + uint32_t rgb32_3 = 0x00130502 * (d.quot >> 6) | ||
| 362 | + + 0x000a1120 * (d.rem >> 6); | ||
| 363 | + struct color_yuv color_3 = | ||
| 364 | + MAKE_YUV_601((rgb32_3 >> 16) & 0xff, | ||
| 365 | + (rgb32_3 >> 8) & 0xff, rgb32_3 & 0xff); | ||
| 366 | + | ||
| 367 | + ChromVal = ((color.u << 2) << 20) | ||
| 368 | + | ((color_2.u << 2) << 10) | (color_3.u << 2); | ||
| 369 | + uChrom[uchromIndex++] = ChromVal; | ||
| 370 | + | ||
| 371 | + ChromVal = ((color.v << 2) << 20) | ||
| 372 | + | ((color_2.v << 2) << 10) | (color_3.v << 2); | ||
| 373 | + vChrom[vchromIndex++] = ChromVal; | ||
| 374 | + } | ||
| 375 | + uchromIndex = 0; vchromIndex = 0; ChromVal = 0; | ||
| 376 | + u_mem += stride; | ||
| 377 | + v_mem += stride; | ||
| 378 | + uChrom = (uint32_t *)u_mem; | ||
| 379 | + vChrom = (uint32_t *)v_mem; | ||
| 380 | + } | ||
| 381 | +} | ||
| 382 | + | ||
| 383 | + | ||
| 384 | static void fill_smpte_yuv_packed(const struct util_yuv_info *yuv, void *mem, | ||
| 385 | unsigned int width, unsigned int height, | ||
| 386 | unsigned int stride) | ||
| 387 | @@ -1135,10 +1386,19 @@ static void fill_smpte(const struct util_format_info *info, | ||
| 388 | return fill_smpte_yuv_planar(&info->yuv, planes[0], u, v, | ||
| 389 | width, height, stride); | ||
| 390 | |||
| 391 | + case DRM_FORMAT_X403: | ||
| 392 | + return fill_smpte_yuv_planar_x403(&info->yuv, planes[0], planes[1], | ||
| 393 | + planes[2], width, height, stride); | ||
| 394 | + | ||
| 395 | + | ||
| 396 | case DRM_FORMAT_YUV420: | ||
| 397 | return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[1], | ||
| 398 | planes[2], width, height, stride); | ||
| 399 | |||
| 400 | + case DRM_FORMAT_YUV444: | ||
| 401 | + return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[1], | ||
| 402 | + planes[2], width, height, stride); | ||
| 403 | + | ||
| 404 | case DRM_FORMAT_YVU420: | ||
| 405 | return fill_smpte_yuv_planar(&info->yuv, planes[0], planes[2], | ||
| 406 | planes[1], width, height, stride); | ||
| 407 | @@ -1465,6 +1725,11 @@ static void fill_tiles(const struct util_format_info *info, | ||
| 408 | return fill_tiles_yuv_planar(info, planes[0], planes[1], | ||
| 409 | planes[2], width, height, stride); | ||
| 410 | |||
| 411 | + case DRM_FORMAT_YUV444: | ||
| 412 | + return fill_tiles_yuv_planar(info, planes[0], planes[1], | ||
| 413 | + planes[2], width, height, stride); | ||
| 414 | + | ||
| 415 | + | ||
| 416 | case DRM_FORMAT_YVU420: | ||
| 417 | return fill_tiles_yuv_planar(info, planes[0], planes[2], | ||
| 418 | planes[1], width, height, stride); | ||
| 419 | @@ -1473,6 +1738,11 @@ static void fill_tiles(const struct util_format_info *info, | ||
| 420 | return fill_tiles_xv20(info, planes[0], planes[1], | ||
| 421 | planes[1], width, height, stride); | ||
| 422 | |||
| 423 | + case DRM_FORMAT_X403: | ||
| 424 | + return fill_tiles_x403(info, planes[0], planes[1], | ||
| 425 | + planes[2], width, height, stride); | ||
| 426 | + | ||
| 427 | + | ||
| 428 | case DRM_FORMAT_XV15: | ||
| 429 | return fill_tiles_xv15(info, planes[0], planes[1], | ||
| 430 | planes[2], width, height, stride); | ||
| 431 | -- | ||
| 432 | 2.17.1 | ||
| 433 | |||
diff --git a/meta-xilinx-core/recipes-graphics/drm/files/0002-modetest-call-drmModeCrtcSetGamma-only-if-add_proper.patch b/meta-xilinx-core/recipes-graphics/drm/files/0002-modetest-call-drmModeCrtcSetGamma-only-if-add_proper.patch new file mode 100644 index 00000000..9d2eff7d --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/files/0002-modetest-call-drmModeCrtcSetGamma-only-if-add_proper.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From ab7aa7563e3b044f84f123f0ed59b370ff0af3f5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Rohit Visavalia <rohit.visavalia@xilinx.com> | ||
| 3 | Date: Mon, 24 Feb 2020 03:35:58 -0800 | ||
| 4 | Subject: [PATCH 2/5] modetest: call drmModeCrtcSetGamma() only if | ||
| 5 | add_property_optional returns true | ||
| 6 | |||
| 7 | gamma is a optional property then also it prints error message, so | ||
| 8 | set gamma only if add_property_optional() returns true. | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com> | ||
| 13 | --- | ||
| 14 | tests/modetest/modetest.c | 2 +- | ||
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c | ||
| 18 | index 2c83bd0..3e73505 100644 | ||
| 19 | --- a/tests/modetest/modetest.c | ||
| 20 | +++ b/tests/modetest/modetest.c | ||
| 21 | @@ -1142,7 +1142,7 @@ static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc) | ||
| 22 | |||
| 23 | add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0); | ||
| 24 | add_property_optional(dev, crtc_id, "CTM", 0); | ||
| 25 | - if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) { | ||
| 26 | + if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) { | ||
| 27 | uint16_t r[256], g[256], b[256]; | ||
| 28 | |||
| 29 | for (i = 0; i < 256; i++) { | ||
| 30 | -- | ||
| 31 | 2.7.4 | ||
| 32 | |||
diff --git a/meta-xilinx-core/recipes-graphics/drm/files/0003-modetest-Add-semiplanar-10bit-pattern-support-for-mo.patch b/meta-xilinx-core/recipes-graphics/drm/files/0003-modetest-Add-semiplanar-10bit-pattern-support-for-mo.patch new file mode 100644 index 00000000..815962e0 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/files/0003-modetest-Add-semiplanar-10bit-pattern-support-for-mo.patch | |||
| @@ -0,0 +1,596 @@ | |||
| 1 | From adc82a4820253ed3f42bf3af9003aa33636e6f89 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Anil Kumar M <amamidal@xilinx.com> | ||
| 3 | Date: Fri, 10 Apr 2020 21:35:47 +0530 | ||
| 4 | Subject: [PATCH 3/5] modetest: Add semiplanar 10bit pattern support for | ||
| 5 | modetest | ||
| 6 | |||
| 7 | Add XV15 and XV20 10 bit semiplanar formats support for | ||
| 8 | generating color bar pattern while running modetest command. | ||
| 9 | |||
| 10 | Signed-off-by: Anil Kumar M <amamidal@xilinx.com> | ||
| 11 | --- | ||
| 12 | tests/modetest/buffers.c | 24 ++- | ||
| 13 | tests/util/format.c | 3 + | ||
| 14 | tests/util/pattern.c | 455 ++++++++++++++++++++++++++++++++++++++++++++++- | ||
| 15 | 3 files changed, 473 insertions(+), 9 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c | ||
| 18 | index 8a8d9e0..4c15ec8 100644 | ||
| 19 | --- a/tests/modetest/buffers.c | ||
| 20 | +++ b/tests/modetest/buffers.c | ||
| 21 | @@ -127,7 +127,7 @@ bo_create(int fd, unsigned int format, | ||
| 22 | unsigned int handles[4], unsigned int pitches[4], | ||
| 23 | unsigned int offsets[4], enum util_fill_pattern pattern) | ||
| 24 | { | ||
| 25 | - unsigned int virtual_height; | ||
| 26 | + unsigned int virtual_height, virtual_width; | ||
| 27 | struct bo *bo; | ||
| 28 | unsigned int bpp; | ||
| 29 | void *planes[3] = { 0, }; | ||
| 30 | @@ -145,6 +145,11 @@ bo_create(int fd, unsigned int format, | ||
| 31 | bpp = 8; | ||
| 32 | break; | ||
| 33 | |||
| 34 | + case DRM_FORMAT_XV15: | ||
| 35 | + case DRM_FORMAT_XV20: | ||
| 36 | + bpp = 10; | ||
| 37 | + break; | ||
| 38 | + | ||
| 39 | case DRM_FORMAT_ARGB4444: | ||
| 40 | case DRM_FORMAT_XRGB4444: | ||
| 41 | case DRM_FORMAT_ABGR4444: | ||
| 42 | @@ -211,20 +216,33 @@ bo_create(int fd, unsigned int format, | ||
| 43 | case DRM_FORMAT_NV21: | ||
| 44 | case DRM_FORMAT_YUV420: | ||
| 45 | case DRM_FORMAT_YVU420: | ||
| 46 | + virtual_width = width; | ||
| 47 | + virtual_height = height * 3 / 2; | ||
| 48 | + break; | ||
| 49 | + | ||
| 50 | + case DRM_FORMAT_XV15: | ||
| 51 | + virtual_width = (width * 32) / 30; | ||
| 52 | virtual_height = height * 3 / 2; | ||
| 53 | break; | ||
| 54 | |||
| 55 | + case DRM_FORMAT_XV20: | ||
| 56 | + virtual_width = (width * 32) / 30; | ||
| 57 | + virtual_height = height * 2; | ||
| 58 | + break; | ||
| 59 | + | ||
| 60 | case DRM_FORMAT_NV16: | ||
| 61 | case DRM_FORMAT_NV61: | ||
| 62 | + virtual_width = width; | ||
| 63 | virtual_height = height * 2; | ||
| 64 | break; | ||
| 65 | |||
| 66 | default: | ||
| 67 | + virtual_width = width; | ||
| 68 | virtual_height = height; | ||
| 69 | break; | ||
| 70 | } | ||
| 71 | |||
| 72 | - bo = bo_create_dumb(fd, width, virtual_height, bpp); | ||
| 73 | + bo = bo_create_dumb(fd, virtual_width, virtual_height, bpp); | ||
| 74 | if (!bo) | ||
| 75 | return NULL; | ||
| 76 | |||
| 77 | @@ -255,6 +273,8 @@ bo_create(int fd, unsigned int format, | ||
| 78 | case DRM_FORMAT_NV21: | ||
| 79 | case DRM_FORMAT_NV16: | ||
| 80 | case DRM_FORMAT_NV61: | ||
| 81 | + case DRM_FORMAT_XV15: | ||
| 82 | + case DRM_FORMAT_XV20: | ||
| 83 | offsets[0] = 0; | ||
| 84 | handles[0] = bo->handle; | ||
| 85 | pitches[0] = bo->pitch; | ||
| 86 | diff --git a/tests/util/format.c b/tests/util/format.c | ||
| 87 | index 1ca1b82..e4b612b 100644 | ||
| 88 | --- a/tests/util/format.c | ||
| 89 | +++ b/tests/util/format.c | ||
| 90 | @@ -51,6 +51,9 @@ static const struct util_format_info format_info[] = { | ||
| 91 | { DRM_FORMAT_NV21, "NV21", MAKE_YUV_INFO(YUV_YCrCb, 2, 2, 2) }, | ||
| 92 | { DRM_FORMAT_NV16, "NV16", MAKE_YUV_INFO(YUV_YCbCr, 2, 1, 2) }, | ||
| 93 | { DRM_FORMAT_NV61, "NV61", MAKE_YUV_INFO(YUV_YCrCb, 2, 1, 2) }, | ||
| 94 | + { DRM_FORMAT_XV15, "XV15", MAKE_YUV_INFO(YUV_YCbCr, 2, 2, 2) }, | ||
| 95 | + { DRM_FORMAT_XV20, "XV20", MAKE_YUV_INFO(YUV_YCbCr, 2, 1, 2) }, | ||
| 96 | + | ||
| 97 | /* YUV planar */ | ||
| 98 | { DRM_FORMAT_YUV420, "YU12", MAKE_YUV_INFO(YUV_YCbCr, 2, 2, 1) }, | ||
| 99 | { DRM_FORMAT_YVU420, "YV12", MAKE_YUV_INFO(YUV_YCrCb, 2, 2, 1) }, | ||
| 100 | diff --git a/tests/util/pattern.c b/tests/util/pattern.c | ||
| 101 | index 158c0b1..e29d160 100644 | ||
| 102 | --- a/tests/util/pattern.c | ||
| 103 | +++ b/tests/util/pattern.c | ||
| 104 | @@ -260,6 +260,432 @@ static void fill_smpte_yuv_planar(const struct util_yuv_info *yuv, | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | +static void fill_smpte_yuv_semiplanar_10b( | ||
| 109 | + const struct util_yuv_info *yuv, | ||
| 110 | + unsigned char *y_mem, unsigned char *uv_mem, | ||
| 111 | + unsigned int width, | ||
| 112 | + unsigned int height, unsigned int stride) | ||
| 113 | +{ | ||
| 114 | + const struct color_yuv colors_top[] = { | ||
| 115 | + MAKE_YUV_601(191, 192, 192), /* grey */ | ||
| 116 | + MAKE_YUV_601(192, 192, 0), /* yellow */ | ||
| 117 | + MAKE_YUV_601(0, 192, 192), /* cyan */ | ||
| 118 | + MAKE_YUV_601(0, 192, 0), /* green */ | ||
| 119 | + MAKE_YUV_601(192, 0, 192), /* magenta */ | ||
| 120 | + MAKE_YUV_601(192, 0, 0), /* red */ | ||
| 121 | + MAKE_YUV_601(0, 0, 192), /* blue */ | ||
| 122 | + }; | ||
| 123 | + const struct color_yuv colors_middle[] = { | ||
| 124 | + MAKE_YUV_601(0, 0, 192), /* blue */ | ||
| 125 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 126 | + MAKE_YUV_601(192, 0, 192), /* magenta */ | ||
| 127 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 128 | + MAKE_YUV_601(0, 192, 192), /* cyan */ | ||
| 129 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 130 | + MAKE_YUV_601(192, 192, 192), /* grey */ | ||
| 131 | + }; | ||
| 132 | + const struct color_yuv colors_bottom[] = { | ||
| 133 | + MAKE_YUV_601(0, 33, 76), /* in-phase */ | ||
| 134 | + MAKE_YUV_601(255, 255, 255), /* super white */ | ||
| 135 | + MAKE_YUV_601(50, 0, 106), /* quadrature */ | ||
| 136 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 137 | + MAKE_YUV_601(9, 9, 9), /* 3.5% */ | ||
| 138 | + MAKE_YUV_601(19, 19, 19), /* 7.5% */ | ||
| 139 | + MAKE_YUV_601(29, 29, 29), /* 11.5% */ | ||
| 140 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 141 | + }; | ||
| 142 | + unsigned int cs = yuv->chroma_stride; | ||
| 143 | + unsigned int xsub = yuv->xsub; | ||
| 144 | + unsigned int ysub = yuv->ysub; | ||
| 145 | + unsigned int x; | ||
| 146 | + unsigned int y; | ||
| 147 | + unsigned int cval = 0; | ||
| 148 | + | ||
| 149 | + for (y = 0; y < height * 6 / 9; ++y) { | ||
| 150 | + for (x = 0; x < width; x += 3) | ||
| 151 | + ((unsigned int *)y_mem)[x/3] = | ||
| 152 | + colors_top[x * 7 / width].y << 2 | | ||
| 153 | + colors_top[(x+1) * 7 / width].y << 12 | | ||
| 154 | + colors_top[(x+2) * 7 / width].y << 22; | ||
| 155 | + y_mem += stride; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + for (; y < height * 7 / 9; ++y) { | ||
| 159 | + for (x = 0; x < width; x += 3) | ||
| 160 | + ((unsigned int *)y_mem)[x/3] = | ||
| 161 | + colors_middle[x * 7 / width].y << 2 | | ||
| 162 | + colors_middle[(x+1) * 7 / width].y << 12 | | ||
| 163 | + colors_middle[(x+2) * 7 / width].y << 22; | ||
| 164 | + y_mem += stride; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + for (; y < height; ++y) { | ||
| 168 | + for (x = 0; x < width * 5 / 7; x += 3) | ||
| 169 | + ((unsigned int *)y_mem)[x/3] = | ||
| 170 | + colors_bottom[x * 4 / (width * 5 / 7)].y << 2 | | ||
| 171 | + colors_bottom[(x + 1) * 4 / (width * 5 / 7)] | ||
| 172 | + .y << 12 | colors_bottom[(x + 2) * 4 / | ||
| 173 | + (width * 5 / 7)].y << 22; | ||
| 174 | + | ||
| 175 | + for (; x < width * 6 / 7; x += 3) | ||
| 176 | + ((unsigned int *)y_mem)[x/3] = | ||
| 177 | + colors_bottom[(x - width * 5 / 7) * 3 / | ||
| 178 | + (width / 7) + 4].y << 2 | | ||
| 179 | + colors_bottom[((x + 1) - width * 5 / 7) * 3 / | ||
| 180 | + (width / 7) + 4].y << 12 | | ||
| 181 | + colors_bottom[((x + 2) - width * 5 / 7) * 3 / | ||
| 182 | + (width / 7) + 4].y << 22; | ||
| 183 | + | ||
| 184 | + for (; x < width; x += 3) | ||
| 185 | + ((unsigned int *)y_mem)[x/3] = colors_bottom[7].y << 2 | | ||
| 186 | + colors_bottom[7].y << 12 | | ||
| 187 | + colors_bottom[7].y << 22; | ||
| 188 | + y_mem += stride; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + /* Chroma */ | ||
| 192 | + unsigned int *c_mem = (unsigned int *)uv_mem; | ||
| 193 | + | ||
| 194 | + for (y = 0; y < height / ysub * 6 / 9; ++y) { | ||
| 195 | + for (x = 0; x < width; x += 6) { | ||
| 196 | + cval = (colors_top[x * 7 / width].u << 2) | | ||
| 197 | + (colors_top[x * 7 / width].v << 12) | | ||
| 198 | + (colors_top[(x + 2) * 7 / width].u << 22); | ||
| 199 | + c_mem[x/3] = cval; | ||
| 200 | + cval = (colors_top[(x + 2) * 7 / width].v << 2) | | ||
| 201 | + (colors_top[(x + 4) * 7 / width].u << 12) | | ||
| 202 | + (colors_top[(x + 4) * 7 / width].v << 22); | ||
| 203 | + c_mem[x/3 + 1] = cval; | ||
| 204 | + } | ||
| 205 | + c_mem += (stride/4) * cs / xsub; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + for (; y < height / ysub * 7 / 9; ++y) { | ||
| 209 | + for (x = 0; x < width; x += 6) { | ||
| 210 | + cval = (colors_middle[x * 7 / width].u << 2) | | ||
| 211 | + (colors_middle[x * 7 / width].v << 12) | | ||
| 212 | + (colors_middle[(x + 2) * 7 / width].u << 22); | ||
| 213 | + c_mem[x/3] = cval; | ||
| 214 | + cval = (colors_middle[(x + 2) * 7 / width].v << 2) | | ||
| 215 | + (colors_middle[(x + 4) * 7 / width].u << 12) | | ||
| 216 | + (colors_middle[(x + 4) * 7 / width].v << 22); | ||
| 217 | + c_mem[x/3 + 1] = cval; | ||
| 218 | + } | ||
| 219 | + c_mem += (stride/4) * cs / xsub; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + for (; y < height / ysub; ++y) { | ||
| 223 | + for (x = 0; x < width * 5 / 7; x += 6) { | ||
| 224 | + cval = colors_bottom[x * 4 / | ||
| 225 | + (width * 5 / 7)].u << 2 | | ||
| 226 | + colors_bottom[x * 4 / | ||
| 227 | + (width * 5 / 7)].v << 12 | | ||
| 228 | + colors_bottom[(x + 2) * 4 / | ||
| 229 | + (width * 5 / 7)]. u << 22; | ||
| 230 | + | ||
| 231 | + c_mem[x/3] = cval; | ||
| 232 | + | ||
| 233 | + cval = colors_bottom[(x + 2) * 4 / | ||
| 234 | + (width * 5 / 7)].v << 2 | | ||
| 235 | + colors_bottom[(x + 4) * 4 / | ||
| 236 | + (width * 5 / 7)].u << 12 | | ||
| 237 | + colors_bottom[(x + 4) * 4 / | ||
| 238 | + (width * 5 / 7)].v << 22; | ||
| 239 | + | ||
| 240 | + c_mem[x/3 + 1] = cval; | ||
| 241 | + } | ||
| 242 | + for (; x < width * 6 / 7; x += 6) { | ||
| 243 | + cval = colors_bottom[(x - width * 5 / 7) * 3 / | ||
| 244 | + (width / 7) + 4].u << 2 | | ||
| 245 | + colors_bottom[(x - width * 5 / 7) * 3 / | ||
| 246 | + (width / 7) + 4].v << 12 | | ||
| 247 | + colors_bottom[((x + 2) - width * 5 / 7) * 3 / | ||
| 248 | + (width / 7) + 4].u << 22; | ||
| 249 | + | ||
| 250 | + c_mem[x/3] = cval; | ||
| 251 | + | ||
| 252 | + cval = colors_bottom[((x + 2) - width * 5 / 7) * 3 / | ||
| 253 | + (width / 7) + 4].v << 2 | | ||
| 254 | + colors_bottom[((x + 4) - width * 5 / 7) * 3 / | ||
| 255 | + (width / 7) + 4].u << 12 | | ||
| 256 | + colors_bottom[((x + 4) - width * 5 / 7) * 3 / | ||
| 257 | + (width / 7) + 4].v << 22; | ||
| 258 | + c_mem[x/3 + 1] = cval; | ||
| 259 | + } | ||
| 260 | + for (; x < width; x += 6) { | ||
| 261 | + cval = colors_bottom[7].u << 2 | | ||
| 262 | + colors_bottom[7].v << 12 | | ||
| 263 | + colors_bottom[7].u << 22; | ||
| 264 | + c_mem[x/3] = cval; | ||
| 265 | + cval = colors_bottom[7].v << 2 | | ||
| 266 | + colors_bottom[7].u << 12 | | ||
| 267 | + colors_bottom[7].v << 22; | ||
| 268 | + c_mem[x/3 + 1] = cval; | ||
| 269 | + } | ||
| 270 | + c_mem += (stride/4) * cs / xsub; | ||
| 271 | + } | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +static void fill_smpte_yuv_planar_10b( | ||
| 275 | + const struct util_yuv_info *yuv, | ||
| 276 | + unsigned char *y_mem, unsigned char *u_mem, | ||
| 277 | + unsigned char *v_mem, unsigned int width, | ||
| 278 | + unsigned int height, unsigned int stride) | ||
| 279 | +{ | ||
| 280 | + const struct color_yuv colors_top[] = { | ||
| 281 | + MAKE_YUV_601(191, 192, 192), /* grey */ | ||
| 282 | + MAKE_YUV_601(192, 192, 0), /* yellow */ | ||
| 283 | + MAKE_YUV_601(0, 192, 192), /* cyan */ | ||
| 284 | + MAKE_YUV_601(0, 192, 0), /* green */ | ||
| 285 | + MAKE_YUV_601(192, 0, 192), /* magenta */ | ||
| 286 | + MAKE_YUV_601(192, 0, 0), /* red */ | ||
| 287 | + MAKE_YUV_601(0, 0, 192), /* blue */ | ||
| 288 | + }; | ||
| 289 | + const struct color_yuv colors_middle[] = { | ||
| 290 | + MAKE_YUV_601(0, 0, 192), /* blue */ | ||
| 291 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 292 | + MAKE_YUV_601(192, 0, 192), /* magenta */ | ||
| 293 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 294 | + MAKE_YUV_601(0, 192, 192), /* cyan */ | ||
| 295 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 296 | + MAKE_YUV_601(192, 192, 192), /* grey */ | ||
| 297 | + }; | ||
| 298 | + const struct color_yuv colors_bottom[] = { | ||
| 299 | + MAKE_YUV_601(0, 33, 76), /* in-phase */ | ||
| 300 | + MAKE_YUV_601(255, 255, 255), /* super white */ | ||
| 301 | + MAKE_YUV_601(50, 0, 106), /* quadrature */ | ||
| 302 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 303 | + MAKE_YUV_601(9, 9, 9), /* 3.5% */ | ||
| 304 | + MAKE_YUV_601(19, 19, 19), /* 7.5% */ | ||
| 305 | + MAKE_YUV_601(29, 29, 29), /* 11.5% */ | ||
| 306 | + MAKE_YUV_601(19, 19, 19), /* black */ | ||
| 307 | + }; | ||
| 308 | + unsigned int cs = yuv->chroma_stride; | ||
| 309 | + unsigned int xsub = yuv->xsub; | ||
| 310 | + unsigned int ysub = yuv->ysub; | ||
| 311 | + unsigned int x; | ||
| 312 | + unsigned int y; | ||
| 313 | + | ||
| 314 | + /* Luma */ | ||
| 315 | + for (y = 0; y < height * 6 / 9; ++y) { | ||
| 316 | + for (x = 0; x < width; ++x) | ||
| 317 | + y_mem[x] = colors_top[x * 7 / width].y; | ||
| 318 | + y_mem += stride; | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + for (; y < height * 7 / 9; ++y) { | ||
| 322 | + for (x = 0; x < width; ++x) | ||
| 323 | + y_mem[x] = colors_middle[x * 7 / width].y; | ||
| 324 | + y_mem += stride; | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + for (; y < height; ++y) { | ||
| 328 | + for (x = 0; x < width * 5 / 7; ++x) | ||
| 329 | + y_mem[x] = colors_bottom[x * 4 / (width * 5 / 7)].y; | ||
| 330 | + for (; x < width * 6 / 7; ++x) | ||
| 331 | + y_mem[x] = colors_bottom[(x - width * 5 / 7) * 3 / | ||
| 332 | + (width / 7) + 4].y; | ||
| 333 | + for (; x < width; ++x) | ||
| 334 | + y_mem[x] = colors_bottom[7].y; | ||
| 335 | + y_mem += stride; | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + /* Chroma */ | ||
| 339 | + for (y = 0; y < height / ysub * 6 / 9; ++y) { | ||
| 340 | + for (x = 0; x < width; x += xsub) { | ||
| 341 | + u_mem[x*cs/xsub] = colors_top[x * 7 / width].u; | ||
| 342 | + v_mem[x*cs/xsub] = colors_top[x * 7 / width].v; | ||
| 343 | + } | ||
| 344 | + u_mem += stride * cs / xsub; | ||
| 345 | + v_mem += stride * cs / xsub; | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + for (; y < height / ysub * 7 / 9; ++y) { | ||
| 349 | + for (x = 0; x < width; x += xsub) { | ||
| 350 | + u_mem[x*cs/xsub] = colors_middle[x * 7 / width].u; | ||
| 351 | + v_mem[x*cs/xsub] = colors_middle[x * 7 / width].v; | ||
| 352 | + } | ||
| 353 | + u_mem += stride * cs / xsub; | ||
| 354 | + v_mem += stride * cs / xsub; | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + for (; y < height / ysub; ++y) { | ||
| 358 | + for (x = 0; x < width * 5 / 7; x += xsub) { | ||
| 359 | + u_mem[x*cs/xsub] = | ||
| 360 | + colors_bottom[x * 4 / (width * 5 / 7)].u; | ||
| 361 | + v_mem[x*cs/xsub] = | ||
| 362 | + colors_bottom[x * 4 / (width * 5 / 7)].v; | ||
| 363 | + } | ||
| 364 | + for (; x < width * 6 / 7; x += xsub) { | ||
| 365 | + u_mem[x*cs/xsub] = | ||
| 366 | + colors_bottom[(x - width * 5 / 7) * 3 / (width / 7) + 4].u; | ||
| 367 | + v_mem[x*cs/xsub] = | ||
| 368 | + colors_bottom[(x - width * 5 / 7) * 3 / (width / 7) + 4].v; | ||
| 369 | + } | ||
| 370 | + for (; x < width; x += xsub) { | ||
| 371 | + u_mem[x*cs/xsub] = colors_bottom[7].u; | ||
| 372 | + v_mem[x*cs/xsub] = colors_bottom[7].v; | ||
| 373 | + } | ||
| 374 | + u_mem += stride * cs / xsub; | ||
| 375 | + v_mem += stride * cs / xsub; | ||
| 376 | + } | ||
| 377 | +} | ||
| 378 | + | ||
| 379 | +static void fill_tiles_xv15( | ||
| 380 | + const struct util_format_info *info, | ||
| 381 | + unsigned char *y_mem, unsigned char *u_mem, | ||
| 382 | + unsigned char *v_mem, uint32_t width, | ||
| 383 | + uint32_t height, uint32_t stride) | ||
| 384 | +{ | ||
| 385 | + const struct util_yuv_info *yuv = &info->yuv; | ||
| 386 | + unsigned int cs = yuv->chroma_stride; | ||
| 387 | + unsigned int x; | ||
| 388 | + unsigned int y; | ||
| 389 | + uint32_t shifter = 0, LumVal = 0; | ||
| 390 | + uint32_t lumIndex = 0; | ||
| 391 | + uint32_t *Lum; | ||
| 392 | + uint32_t *Chrom; | ||
| 393 | + uint32_t ChromVal = 0; | ||
| 394 | + uint32_t chromIndex = 0; | ||
| 395 | + | ||
| 396 | + /* preparing 10 bit Luma */ | ||
| 397 | + Lum = (uint32_t *)y_mem; | ||
| 398 | + for (y = 0; y < height; ++y) { | ||
| 399 | + for (x = 0; x < width; x++) { | ||
| 400 | + div_t d = div(x+y, width); | ||
| 401 | + uint32_t rgb32 = 0x00130502 * (d.quot >> 6) | ||
| 402 | + + 0x000a1120 * (d.rem >> 6); | ||
| 403 | + struct color_yuv color = | ||
| 404 | + MAKE_YUV_601((rgb32 >> 16) & 0xff, | ||
| 405 | + (rgb32 >> 8) & 0xff, rgb32 & 0xff); | ||
| 406 | + //Checking if we got 3 components to pack in 4 bytes | ||
| 407 | + if (shifter == 30) { | ||
| 408 | + Lum[lumIndex] = LumVal; | ||
| 409 | + lumIndex++; shifter = 0; LumVal = 0; | ||
| 410 | + } | ||
| 411 | + LumVal = (LumVal | ((color.y << 2) << shifter)); | ||
| 412 | + shifter += 10; //10 bit precision | ||
| 413 | + } | ||
| 414 | + lumIndex = 0; shifter = 0; LumVal = 0; | ||
| 415 | + y_mem += stride; | ||
| 416 | + Lum = (uint32_t *)y_mem; | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + /* Preparing 10 bit Chroma */ | ||
| 420 | + Chrom = (uint32_t *)u_mem; | ||
| 421 | + for (y = 0; y < height / 2; ++y) { | ||
| 422 | + for (x = 0; x < width; x = x + 6) { | ||
| 423 | + div_t d = div(x+(2 * y), width); | ||
| 424 | + uint32_t rgb32 = 0x00130502 * (d.quot >> 6) | ||
| 425 | + + 0x000a1120 * (d.rem >> 6); | ||
| 426 | + struct color_yuv color = | ||
| 427 | + MAKE_YUV_601((rgb32 >> 16) & 0xff, | ||
| 428 | + (rgb32 >> 8) & 0xff, rgb32 & 0xff); | ||
| 429 | + div_t d2 = div(x + 2 + (2*y), width); | ||
| 430 | + uint32_t rgb32_2 = 0x00130502 * (d2.quot >> 6) | ||
| 431 | + + 0x000a1120 * (d2.rem >> 6); | ||
| 432 | + struct color_yuv color_2 = | ||
| 433 | + MAKE_YUV_601((rgb32_2 >> 16) & 0xff, | ||
| 434 | + (rgb32_2 >> 8) & 0xff, rgb32_2 & 0xff); | ||
| 435 | + | ||
| 436 | + div_t d3 = div(x + 4 + (2*y), width); | ||
| 437 | + uint32_t rgb32_3 = 0x00130502 * (d3.quot >> 6) | ||
| 438 | + + 0x000a1120 * (d3.rem >> 6); | ||
| 439 | + struct color_yuv color_3 = | ||
| 440 | + MAKE_YUV_601((rgb32_3 >> 16) & 0xff, | ||
| 441 | + (rgb32_3 >> 8) & 0xff, rgb32_3 & 0xff); | ||
| 442 | + | ||
| 443 | + ChromVal = ((color_2.u << 2) << 20) | ||
| 444 | + | ((color.v << 2) << 10) | (color.u << 2); | ||
| 445 | + Chrom[chromIndex++] = ChromVal; | ||
| 446 | + | ||
| 447 | + ChromVal = ((color_3.v << 2) << 20) | ||
| 448 | + | ((color_3.u << 2) << 10) | (color_2.v << 2); | ||
| 449 | + Chrom[chromIndex++] = ChromVal; | ||
| 450 | + } | ||
| 451 | + chromIndex = 0; ChromVal = 0; | ||
| 452 | + u_mem += stride; | ||
| 453 | + Chrom = (uint32_t *)u_mem; | ||
| 454 | + } | ||
| 455 | +} | ||
| 456 | + | ||
| 457 | +static void fill_tiles_xv20( | ||
| 458 | + const struct util_format_info *info, | ||
| 459 | + unsigned char *y_mem, unsigned char *u_mem, | ||
| 460 | + unsigned char *v_mem, uint32_t width, | ||
| 461 | + uint32_t height, uint32_t stride) | ||
| 462 | +{ | ||
| 463 | + const struct util_yuv_info *yuv = &info->yuv; | ||
| 464 | + unsigned int cs = yuv->chroma_stride; | ||
| 465 | + unsigned int x; | ||
| 466 | + unsigned int y; | ||
| 467 | + uint32_t shifter = 0, LumVal = 0; | ||
| 468 | + uint32_t lumIndex = 0; | ||
| 469 | + uint32_t *Lum; | ||
| 470 | + uint32_t *Chrom; | ||
| 471 | + uint32_t ChromVal = 0; | ||
| 472 | + uint32_t chromIndex = 0; | ||
| 473 | + | ||
| 474 | + /* preparing 10 bit Luma */ | ||
| 475 | + Lum = (uint32_t *)y_mem; | ||
| 476 | + for (y = 0; y < height; ++y) { | ||
| 477 | + for (x = 0; x < width; x++) { | ||
| 478 | + div_t d = div(x+y, width); | ||
| 479 | + uint32_t rgb32 = 0x00130502 * (d.quot >> 6) | ||
| 480 | + + 0x000a1120 * (d.rem >> 6); | ||
| 481 | + struct color_yuv color = | ||
| 482 | + MAKE_YUV_601((rgb32 >> 16) & 0xff, | ||
| 483 | + (rgb32 >> 8) & 0xff, rgb32 & 0xff); | ||
| 484 | + //Checking if we got 3 components to pack in 4 bytes | ||
| 485 | + if (shifter == 30) { | ||
| 486 | + Lum[lumIndex] = LumVal; | ||
| 487 | + lumIndex++; shifter = 0; LumVal = 0; | ||
| 488 | + } | ||
| 489 | + LumVal = (LumVal | ((color.y << 2) << shifter)); | ||
| 490 | + shifter += 10; //10 bit precision | ||
| 491 | + } | ||
| 492 | + lumIndex = 0; shifter = 0; LumVal = 0; | ||
| 493 | + y_mem += stride; | ||
| 494 | + Lum = (uint32_t *)y_mem; | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | + /* Preparing 10 bit Chroma */ | ||
| 498 | + Chrom = (uint32_t *)u_mem; | ||
| 499 | + for (y = 0; y < height; ++y) { | ||
| 500 | + for (x = 0; x < width; x = x + 6) { | ||
| 501 | + div_t d = div(x+y, width); | ||
| 502 | + uint32_t rgb32 = 0x00130502 * (d.quot >> 6) | ||
| 503 | + + 0x000a1120 * (d.rem >> 6); | ||
| 504 | + struct color_yuv color = | ||
| 505 | + MAKE_YUV_601((rgb32 >> 16) & 0xff, | ||
| 506 | + (rgb32 >> 8) & 0xff, rgb32 & 0xff); | ||
| 507 | + div_t d2 = div(x + 2 + y, width); | ||
| 508 | + uint32_t rgb32_2 = 0x00130502 * (d2.quot >> 6) | ||
| 509 | + + 0x000a1120 * (d2.rem >> 6); | ||
| 510 | + struct color_yuv color_2 = | ||
| 511 | + MAKE_YUV_601((rgb32_2 >> 16) & 0xff, | ||
| 512 | + (rgb32_2 >> 8) & 0xff, rgb32_2 & 0xff); | ||
| 513 | + div_t d3 = div(x + 4 + y, width); | ||
| 514 | + uint32_t rgb32_3 = 0x00130502 * (d3.quot >> 6) | ||
| 515 | + + 0x000a1120 * (d3.rem >> 6); | ||
| 516 | + struct color_yuv color_3 = | ||
| 517 | + MAKE_YUV_601((rgb32_3 >> 16) & 0xff, | ||
| 518 | + (rgb32_3 >> 8) & 0xff, rgb32_3 & 0xff); | ||
| 519 | + | ||
| 520 | + ChromVal = ((color_2.u << 2) << 20) | ||
| 521 | + | ((color.v << 2) << 10) | (color.u << 2); | ||
| 522 | + Chrom[chromIndex++] = ChromVal; | ||
| 523 | + | ||
| 524 | + ChromVal = ((color_3.v << 2) << 20) | ||
| 525 | + | ((color_3.u << 2) << 10) | (color_2.v << 2); | ||
| 526 | + Chrom[chromIndex++] = ChromVal; | ||
| 527 | + } | ||
| 528 | + chromIndex = 0; ChromVal = 0; | ||
| 529 | + u_mem += stride; | ||
| 530 | + Chrom = (uint32_t *)u_mem; | ||
| 531 | + } | ||
| 532 | +} | ||
| 533 | + | ||
| 534 | static void fill_smpte_yuv_packed(const struct util_yuv_info *yuv, void *mem, | ||
| 535 | unsigned int width, unsigned int height, | ||
| 536 | unsigned int stride) | ||
| 537 | @@ -678,9 +1104,10 @@ void util_smpte_c8_gamma(unsigned size, struct drm_color_lut *lut) | ||
| 538 | #undef FILL_COLOR | ||
| 539 | } | ||
| 540 | |||
| 541 | -static void fill_smpte(const struct util_format_info *info, void *planes[3], | ||
| 542 | - unsigned int width, unsigned int height, | ||
| 543 | - unsigned int stride) | ||
| 544 | +static void fill_smpte(const struct util_format_info *info, | ||
| 545 | + void *planes[3], | ||
| 546 | + unsigned int width, unsigned int height, | ||
| 547 | + unsigned int stride) | ||
| 548 | { | ||
| 549 | unsigned char *u, *v; | ||
| 550 | |||
| 551 | @@ -693,7 +1120,12 @@ static void fill_smpte(const struct util_format_info *info, void *planes[3], | ||
| 552 | case DRM_FORMAT_YVYU: | ||
| 553 | return fill_smpte_yuv_packed(&info->yuv, planes[0], width, | ||
| 554 | height, stride); | ||
| 555 | - | ||
| 556 | + case DRM_FORMAT_XV20: | ||
| 557 | + return fill_tiles_xv20(info, planes[0], planes[1], planes[1], | ||
| 558 | + width, height, stride); | ||
| 559 | + case DRM_FORMAT_XV15: | ||
| 560 | + return fill_tiles_xv15(info, planes[0], planes[1], planes[2], | ||
| 561 | + width, height, stride); | ||
| 562 | case DRM_FORMAT_NV12: | ||
| 563 | case DRM_FORMAT_NV21: | ||
| 564 | case DRM_FORMAT_NV16: | ||
| 565 | @@ -1005,9 +1437,10 @@ static void fill_tiles_rgb16fp(const struct util_format_info *info, void *mem, | ||
| 566 | } | ||
| 567 | } | ||
| 568 | |||
| 569 | -static void fill_tiles(const struct util_format_info *info, void *planes[3], | ||
| 570 | - unsigned int width, unsigned int height, | ||
| 571 | - unsigned int stride) | ||
| 572 | +static void fill_tiles(const struct util_format_info *info, | ||
| 573 | + void *planes[3], | ||
| 574 | + unsigned int width, unsigned int height, | ||
| 575 | + unsigned int stride) | ||
| 576 | { | ||
| 577 | unsigned char *u, *v; | ||
| 578 | |||
| 579 | @@ -1036,6 +1469,14 @@ static void fill_tiles(const struct util_format_info *info, void *planes[3], | ||
| 580 | return fill_tiles_yuv_planar(info, planes[0], planes[2], | ||
| 581 | planes[1], width, height, stride); | ||
| 582 | |||
| 583 | + case DRM_FORMAT_XV20: | ||
| 584 | + return fill_tiles_xv20(info, planes[0], planes[1], | ||
| 585 | + planes[1], width, height, stride); | ||
| 586 | + | ||
| 587 | + case DRM_FORMAT_XV15: | ||
| 588 | + return fill_tiles_xv15(info, planes[0], planes[1], | ||
| 589 | + planes[2], width, height, stride); | ||
| 590 | + | ||
| 591 | case DRM_FORMAT_ARGB4444: | ||
| 592 | case DRM_FORMAT_XRGB4444: | ||
| 593 | case DRM_FORMAT_ABGR4444: | ||
| 594 | -- | ||
| 595 | 2.7.4 | ||
| 596 | |||
diff --git a/meta-xilinx-core/recipes-graphics/drm/files/0004-modetest-fix-smpte-colour-pattern-issue-for-XV20-and.patch b/meta-xilinx-core/recipes-graphics/drm/files/0004-modetest-fix-smpte-colour-pattern-issue-for-XV20-and.patch new file mode 100644 index 00000000..3868c212 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/files/0004-modetest-fix-smpte-colour-pattern-issue-for-XV20-and.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From ede95ded932a8f722f339fa345c098c705f40f08 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Anil Kumar M <amamidal@xilinx.com> | ||
| 3 | Date: Wed, 16 Sep 2020 22:42:47 +0530 | ||
| 4 | Subject: [PATCH 4/5] modetest: fix smpte colour pattern issue for XV20 and | ||
| 5 | XV15 formats | ||
| 6 | |||
| 7 | Fix smpte colour issue for XV15 and XV20 formats. | ||
| 8 | |||
| 9 | Signed-off-by: Anil Kumar M <amamidal@xilinx.com> | ||
| 10 | --- | ||
| 11 | tests/util/pattern.c | 8 ++++---- | ||
| 12 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/tests/util/pattern.c b/tests/util/pattern.c | ||
| 15 | index e29d160..0fe2e5f 100644 | ||
| 16 | --- a/tests/util/pattern.c | ||
| 17 | +++ b/tests/util/pattern.c | ||
| 18 | @@ -1121,11 +1121,11 @@ static void fill_smpte(const struct util_format_info *info, | ||
| 19 | return fill_smpte_yuv_packed(&info->yuv, planes[0], width, | ||
| 20 | height, stride); | ||
| 21 | case DRM_FORMAT_XV20: | ||
| 22 | - return fill_tiles_xv20(info, planes[0], planes[1], planes[1], | ||
| 23 | - width, height, stride); | ||
| 24 | + return fill_smpte_yuv_semiplanar_10b(&info->yuv, planes[0], planes[1], | ||
| 25 | + width, height, stride); | ||
| 26 | case DRM_FORMAT_XV15: | ||
| 27 | - return fill_tiles_xv15(info, planes[0], planes[1], planes[2], | ||
| 28 | - width, height, stride); | ||
| 29 | + return fill_smpte_yuv_semiplanar_10b(&info->yuv, planes[0], planes[1], | ||
| 30 | + width, height, stride); | ||
| 31 | case DRM_FORMAT_NV12: | ||
| 32 | case DRM_FORMAT_NV21: | ||
| 33 | case DRM_FORMAT_NV16: | ||
| 34 | -- | ||
| 35 | 2.7.4 | ||
| 36 | |||
diff --git a/meta-xilinx-core/recipes-graphics/drm/libdrm_%.bbappend b/meta-xilinx-core/recipes-graphics/drm/libdrm_%.bbappend new file mode 100644 index 00000000..4dd49264 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/drm/libdrm_%.bbappend | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/files:" | ||
| 2 | |||
| 3 | |||
| 4 | SRC_URI:append = " \ | ||
| 5 | file://0001-PATCH-libdrm-Update-drm-header-file-with-XV15-and-XV.patch \ | ||
| 6 | file://0002-modetest-call-drmModeCrtcSetGamma-only-if-add_proper.patch \ | ||
| 7 | file://0003-modetest-Add-semiplanar-10bit-pattern-support-for-mo.patch \ | ||
| 8 | file://0004-modetest-fix-smpte-colour-pattern-issue-for-XV20-and.patch \ | ||
| 9 | file://0001-modetest-Add-YUV444-and-X403-format-support-for-mode.patch \ | ||
| 10 | file://0001-headers-Sync-with-HDR-from-v5.15.patch \ | ||
| 11 | " | ||
