Skip to content

Commit 037e5d9

Browse files
committed
Another attempt at fixing 1014 for 6.8
1 parent 2611e10 commit 037e5d9

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

1014-drm-format-helper-add-helper-for-BGR888-to-XRGB8888-.patch

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ Add XRGB8888 emulation helper for devices that only support BGR888.
88

99
Signed-off-by: Kerem Karabay <[email protected]>
1010
---
11-
drivers/gpu/drm/drm_format_helper.c | 53 ++++++++++++++
12-
.../gpu/drm/tests/drm_format_helper_test.c | 69 +++++++++++++++++++
11+
drivers/gpu/drm/drm_format_helper.c | 54 +++++++++++++
12+
.../gpu/drm/tests/drm_format_helper_test.c | 81 +++++++++++++++++++
1313
include/drm/drm_format_helper.h | 3 +
14-
3 files changed, 125 insertions(+)
14+
3 files changed, 138 insertions(+)
1515

1616
diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
17-
index b1be458ed4dda5..24836384554a47 100644
17+
index b1be458ed..28c0e76a1 100644
1818
--- a/drivers/gpu/drm/drm_format_helper.c
1919
+++ b/drivers/gpu/drm/drm_format_helper.c
20-
@@ -702,6 +702,58 @@ void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pi
20+
@@ -702,6 +702,57 @@ void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pi
2121
}
2222
EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb888);
2323

@@ -61,22 +61,21 @@ index b1be458ed4dda5..24836384554a47 100644
6161
+ */
6262
+void drm_fb_xrgb8888_to_bgr888(struct iosys_map *dst, const unsigned int *dst_pitch,
6363
+ const struct iosys_map *src, const struct drm_framebuffer *fb,
64-
+ const struct drm_rect *clip,
65-
+ struct drm_format_conv_state *state)
64+
+ const struct drm_rect *clip, struct drm_format_conv_state *state)
6665
+{
6766
+ static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = {
6867
+ 3,
6968
+ };
7069
+
71-
+ drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false,
72-
+ state, drm_fb_xrgb8888_to_bgr888_line);
70+
+ drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false, state,
71+
+ drm_fb_xrgb8888_to_bgr888_line);
7372
+}
7473
+EXPORT_SYMBOL(drm_fb_xrgb8888_to_bgr888);
7574
+
7675
static void drm_fb_xrgb8888_to_argb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
7776
{
7877
__le32 *dbuf32 = dbuf;
79-
@@ -1035,6 +1087,9 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
78+
@@ -1035,6 +1086,9 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
8079
} else if (dst_format == DRM_FORMAT_RGB888) {
8180
drm_fb_xrgb8888_to_rgb888(dst, dst_pitch, src, fb, clip, state);
8281
return 0;
@@ -87,10 +86,10 @@ index b1be458ed4dda5..24836384554a47 100644
8786
drm_fb_xrgb8888_to_argb8888(dst, dst_pitch, src, fb, clip, state);
8887
return 0;
8988
diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c
90-
index 474bb7a1c..dff7fabd9 100644
89+
index 08992636e..e54f0f6e7 100644
9190
--- a/drivers/gpu/drm/tests/drm_format_helper_test.c
9291
+++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
93-
@@ -52,6 +52,11 @@ struct convert_to_rgb888_result {
92+
@@ -60,6 +60,11 @@ struct convert_to_rgb888_result {
9493
const u8 expected[TEST_BUF_SIZE];
9594
};
9695

@@ -102,15 +101,15 @@ index 474bb7a1c..dff7fabd9 100644
102101
struct convert_to_argb8888_result {
103102
unsigned int dst_pitch;
104103
const u32 expected[TEST_BUF_SIZE];
105-
@@ -84,6 +89,7 @@ struct convert_xrgb8888_case {
104+
@@ -107,6 +112,7 @@ struct convert_xrgb8888_case {
106105
struct convert_to_argb1555_result argb1555_result;
107106
struct convert_to_rgba5551_result rgba5551_result;
108107
struct convert_to_rgb888_result rgb888_result;
109108
+ struct convert_to_bgr888_result bgr888_result;
110109
struct convert_to_argb8888_result argb8888_result;
111110
struct convert_to_xrgb2101010_result xrgb2101010_result;
112111
struct convert_to_argb2101010_result argb2101010_result;
113-
@@ -125,6 +131,10 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
112+
@@ -151,6 +157,10 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
114113
.dst_pitch = TEST_USE_DEFAULT_PITCH,
115114
.expected = { 0x00, 0x00, 0xFF },
116115
},
@@ -121,7 +120,7 @@ index 474bb7a1c..dff7fabd9 100644
121120
.argb8888_result = {
122121
.dst_pitch = TEST_USE_DEFAULT_PITCH,
123122
.expected = { 0xFFFF0000 },
124-
@@ -179,6 +189,10 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
123+
@@ -217,6 +227,10 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
125124
.dst_pitch = TEST_USE_DEFAULT_PITCH,
126125
.expected = { 0x00, 0x00, 0xFF },
127126
},
@@ -132,7 +131,7 @@ index 474bb7a1c..dff7fabd9 100644
132131
.argb8888_result = {
133132
.dst_pitch = TEST_USE_DEFAULT_PITCH,
134133
.expected = { 0xFFFF0000 },
135-
@@ -280,6 +294,15 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
134+
@@ -330,6 +344,15 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
136135
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
137136
},
138137
},
@@ -148,7 +147,7 @@ index 474bb7a1c..dff7fabd9 100644
148147
.argb8888_result = {
149148
.dst_pitch = TEST_USE_DEFAULT_PITCH,
150149
.expected = {
151-
@@ -391,6 +414,17 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
150+
@@ -468,6 +491,17 @@ static struct convert_xrgb8888_case convert_xrgb8888_cases[] = {
152151
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
153152
},
154153
},
@@ -166,7 +165,7 @@ index 474bb7a1c..dff7fabd9 100644
166165
.argb8888_result = {
167166
.dst_pitch = 20,
168167
.expected = {
169-
@@ -727,6 +761,40 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
168+
@@ -914,6 +948,52 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)
170169
KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
171170
}
172171

@@ -200,14 +199,26 @@ index 474bb7a1c..dff7fabd9 100644
200199
+ * BGR888 expected results are already in little-endian
201200
+ * order, so there's no need to convert the test output.
202201
+ */
203-
+ drm_fb_xrgb8888_to_bgr888(&dst, &result->dst_pitch, &src, &fb, &params->clip);
202+
+ drm_fb_xrgb8888_to_bgr888(&dst, &result->dst_pitch, &src, &fb, &params->clip,
203+
+ &fmtcnv_state, true);
204+
+ KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
205+
+
206+
+ buf = dst.vaddr; /* restore original value of buf */
207+
+ memset(buf, 0, dst_size);
208+
+
209+
+ int blit_result = 0;
210+
+
211+
+ blit_result = drm_fb_blit(&dst, dst_pitch, DRM_FORMAT_BGR888, &src, &fb, &params->clip,
212+
+ &fmtcnv_state);
213+
+
214+
+ KUNIT_EXPECT_FALSE(test, blit_result);
204215
+ KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
205216
+}
206217
+
207218
static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)
208219
{
209220
const struct convert_xrgb8888_case *params = test->param_value;
210-
@@ -858,6 +926,7 @@ static struct kunit_case drm_format_helper_test_cases[] = {
221+
@@ -1851,6 +1931,7 @@ static struct kunit_case drm_format_helper_test_cases[] = {
211222
KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_argb1555, convert_xrgb8888_gen_params),
212223
KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_rgba5551, convert_xrgb8888_gen_params),
213224
KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_rgb888, convert_xrgb8888_gen_params),
@@ -216,10 +227,10 @@ index 474bb7a1c..dff7fabd9 100644
216227
KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_xrgb2101010, convert_xrgb8888_gen_params),
217228
KUNIT_CASE_PARAM(drm_test_fb_xrgb8888_to_argb2101010, convert_xrgb8888_gen_params),
218229
diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h
219-
index 291deb094..7fc553318 100644
230+
index f13b34e0b..b53cf85ca 100644
220231
--- a/include/drm/drm_format_helper.h
221232
+++ b/include/drm/drm_format_helper.h
222-
@@ -42,6 +42,9 @@ void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_
233+
@@ -95,6 +95,9 @@ void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_
223234
void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pitch,
224235
const struct iosys_map *src, const struct drm_framebuffer *fb,
225236
const struct drm_rect *clip, struct drm_format_conv_state *state);
@@ -230,5 +241,5 @@ index 291deb094..7fc553318 100644
230241
const struct iosys_map *src, const struct drm_framebuffer *fb,
231242
const struct drm_rect *clip, struct drm_format_conv_state *state);
232243
--
233-
2.42.0
244+
2.34.1
234245

0 commit comments

Comments
 (0)