1 // SPDX-License-Identifier: GPL-2.0 or MIT
3 * Copyright (C) 2016 Noralf Trønnes
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
11 #include <linux/module.h>
12 #include <linux/slab.h>
15 #include <drm/drm_device.h>
16 #include <drm/drm_format_helper.h>
17 #include <drm/drm_framebuffer.h>
18 #include <drm/drm_fourcc.h>
19 #include <drm/drm_print.h>
20 #include <drm/drm_rect.h>
22 static unsigned int clip_offset(const struct drm_rect *clip, unsigned int pitch, unsigned int cpp)
24 return clip->y1 * pitch + clip->x1 * cpp;
28 * drm_fb_clip_offset - Returns the clipping rectangles byte-offset in a framebuffer
29 * @pitch: Framebuffer line pitch in byte
30 * @format: Framebuffer format
31 * @clip: Clip rectangle
34 * The byte offset of the clip rectangle's top-left corner within the framebuffer.
36 unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info *format,
37 const struct drm_rect *clip)
39 return clip_offset(clip, pitch, format->cpp[0]);
41 EXPORT_SYMBOL(drm_fb_clip_offset);
43 /* TODO: Make this functon work with multi-plane formats. */
44 static int drm_fb_xfrm(void *dst, unsigned long dst_pitch, unsigned long dst_pixsize,
45 const void *vaddr, const struct drm_framebuffer *fb,
46 const struct drm_rect *clip, bool vaddr_cached_hint,
47 void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels))
49 unsigned long linepixels = drm_rect_width(clip);
50 unsigned long lines = drm_rect_height(clip);
51 size_t sbuf_len = linepixels * fb->format->cpp[0];
57 * Some source buffers, such as CMA memory, use write-combine
58 * caching, so reads are uncached. Speed up access by fetching
61 if (!vaddr_cached_hint) {
62 stmp = kmalloc(sbuf_len, GFP_KERNEL);
68 dst_pitch = drm_rect_width(clip) * dst_pixsize;
69 vaddr += clip_offset(clip, fb->pitches[0], fb->format->cpp[0]);
71 for (i = 0; i < lines; ++i) {
73 sbuf = memcpy(stmp, vaddr, sbuf_len);
76 xfrm_line(dst, sbuf, linepixels);
77 vaddr += fb->pitches[0];
86 /* TODO: Make this functon work with multi-plane formats. */
87 static int drm_fb_xfrm_toio(void __iomem *dst, unsigned long dst_pitch, unsigned long dst_pixsize,
88 const void *vaddr, const struct drm_framebuffer *fb,
89 const struct drm_rect *clip, bool vaddr_cached_hint,
90 void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels))
92 unsigned long linepixels = drm_rect_width(clip);
93 unsigned long lines = drm_rect_height(clip);
94 size_t dbuf_len = linepixels * dst_pixsize;
95 size_t stmp_off = round_up(dbuf_len, ARCH_KMALLOC_MINALIGN); /* for sbuf alignment */
96 size_t sbuf_len = linepixels * fb->format->cpp[0];
102 if (vaddr_cached_hint) {
103 dbuf = kmalloc(dbuf_len, GFP_KERNEL);
105 dbuf = kmalloc(stmp_off + sbuf_len, GFP_KERNEL);
106 stmp = dbuf + stmp_off;
112 dst_pitch = linepixels * dst_pixsize;
113 vaddr += clip_offset(clip, fb->pitches[0], fb->format->cpp[0]);
115 for (i = 0; i < lines; ++i) {
117 sbuf = memcpy(stmp, vaddr, sbuf_len);
120 xfrm_line(dbuf, sbuf, linepixels);
121 memcpy_toio(dst, dbuf, dbuf_len);
122 vaddr += fb->pitches[0];
132 * drm_fb_memcpy - Copy clip buffer
133 * @dst: Destination buffer
134 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
135 * @vaddr: Source buffer
136 * @fb: DRM framebuffer
137 * @clip: Clip rectangle area to copy
139 * This function does not apply clipping on dst, i.e. the destination
140 * is at the top-left corner.
142 void drm_fb_memcpy(void *dst, unsigned int dst_pitch, const void *vaddr,
143 const struct drm_framebuffer *fb, const struct drm_rect *clip)
145 unsigned int cpp = fb->format->cpp[0];
146 size_t len = (clip->x2 - clip->x1) * cpp;
147 unsigned int y, lines = clip->y2 - clip->y1;
152 vaddr += clip_offset(clip, fb->pitches[0], cpp);
153 for (y = 0; y < lines; y++) {
154 memcpy(dst, vaddr, len);
155 vaddr += fb->pitches[0];
159 EXPORT_SYMBOL(drm_fb_memcpy);
162 * drm_fb_memcpy_toio - Copy clip buffer
163 * @dst: Destination buffer (iomem)
164 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
165 * @vaddr: Source buffer
166 * @fb: DRM framebuffer
167 * @clip: Clip rectangle area to copy
169 * This function does not apply clipping on dst, i.e. the destination
170 * is at the top-left corner.
172 void drm_fb_memcpy_toio(void __iomem *dst, unsigned int dst_pitch, const void *vaddr,
173 const struct drm_framebuffer *fb, const struct drm_rect *clip)
175 unsigned int cpp = fb->format->cpp[0];
176 size_t len = (clip->x2 - clip->x1) * cpp;
177 unsigned int y, lines = clip->y2 - clip->y1;
182 vaddr += clip_offset(clip, fb->pitches[0], cpp);
183 for (y = 0; y < lines; y++) {
184 memcpy_toio(dst, vaddr, len);
185 vaddr += fb->pitches[0];
189 EXPORT_SYMBOL(drm_fb_memcpy_toio);
191 static void drm_fb_swab16_line(void *dbuf, const void *sbuf, unsigned int pixels)
194 const u16 *sbuf16 = sbuf;
195 const u16 *send16 = sbuf16 + pixels;
197 while (sbuf16 < send16)
198 *dbuf16++ = swab16(*sbuf16++);
201 static void drm_fb_swab32_line(void *dbuf, const void *sbuf, unsigned int pixels)
204 const u32 *sbuf32 = sbuf;
205 const u32 *send32 = sbuf32 + pixels;
207 while (sbuf32 < send32)
208 *dbuf32++ = swab32(*sbuf32++);
212 * drm_fb_swab - Swap bytes into clip buffer
213 * @dst: Destination buffer
214 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
215 * @src: Source buffer
216 * @fb: DRM framebuffer
217 * @clip: Clip rectangle area to copy
218 * @cached: Source buffer is mapped cached (eg. not write-combined)
220 * If @cached is false a temporary buffer is used to cache one pixel line at a
221 * time to speed up slow uncached reads.
223 * This function does not apply clipping on dst, i.e. the destination
224 * is at the top-left corner.
226 void drm_fb_swab(void *dst, unsigned int dst_pitch, const void *src,
227 const struct drm_framebuffer *fb, const struct drm_rect *clip,
230 u8 cpp = fb->format->cpp[0];
234 drm_fb_xfrm(dst, dst_pitch, cpp, src, fb, clip, cached, drm_fb_swab32_line);
237 drm_fb_xfrm(dst, dst_pitch, cpp, src, fb, clip, cached, drm_fb_swab16_line);
240 drm_warn_once(fb->dev, "Format %p4cc has unsupported pixel size.\n",
241 &fb->format->format);
245 EXPORT_SYMBOL(drm_fb_swab);
247 static void drm_fb_xrgb8888_to_rgb332_line(void *dbuf, const void *sbuf, unsigned int pixels)
250 const __le32 *sbuf32 = sbuf;
254 for (x = 0; x < pixels; x++) {
255 pix = le32_to_cpu(sbuf32[x]);
256 dbuf8[x] = ((pix & 0x00e00000) >> 16) |
257 ((pix & 0x0000e000) >> 11) |
258 ((pix & 0x000000c0) >> 6);
263 * drm_fb_xrgb8888_to_rgb332 - Convert XRGB8888 to RGB332 clip buffer
264 * @dst: RGB332 destination buffer
265 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
266 * @src: XRGB8888 source buffer
267 * @fb: DRM framebuffer
268 * @clip: Clip rectangle area to copy
270 * Drivers can use this function for RGB332 devices that don't natively support XRGB8888.
272 void drm_fb_xrgb8888_to_rgb332(void *dst, unsigned int dst_pitch, const void *src,
273 const struct drm_framebuffer *fb, const struct drm_rect *clip)
275 drm_fb_xfrm(dst, dst_pitch, 1, src, fb, clip, false, drm_fb_xrgb8888_to_rgb332_line);
277 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb332);
279 static void drm_fb_xrgb8888_to_rgb565_line(void *dbuf, const void *sbuf, unsigned int pixels)
282 const u32 *sbuf32 = sbuf;
286 for (x = 0; x < pixels; x++) {
287 val16 = ((sbuf32[x] & 0x00F80000) >> 8) |
288 ((sbuf32[x] & 0x0000FC00) >> 5) |
289 ((sbuf32[x] & 0x000000F8) >> 3);
294 static void drm_fb_xrgb8888_to_rgb565_swab_line(void *dbuf, const void *sbuf,
298 const u32 *sbuf32 = sbuf;
302 for (x = 0; x < pixels; x++) {
303 val16 = ((sbuf32[x] & 0x00F80000) >> 8) |
304 ((sbuf32[x] & 0x0000FC00) >> 5) |
305 ((sbuf32[x] & 0x000000F8) >> 3);
306 dbuf16[x] = swab16(val16);
311 * drm_fb_xrgb8888_to_rgb565 - Convert XRGB8888 to RGB565 clip buffer
312 * @dst: RGB565 destination buffer
313 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
314 * @vaddr: XRGB8888 source buffer
315 * @fb: DRM framebuffer
316 * @clip: Clip rectangle area to copy
319 * Drivers can use this function for RGB565 devices that don't natively
322 void drm_fb_xrgb8888_to_rgb565(void *dst, unsigned int dst_pitch, const void *vaddr,
323 const struct drm_framebuffer *fb, const struct drm_rect *clip,
327 drm_fb_xfrm(dst, dst_pitch, 2, vaddr, fb, clip, false,
328 drm_fb_xrgb8888_to_rgb565_swab_line);
330 drm_fb_xfrm(dst, dst_pitch, 2, vaddr, fb, clip, false,
331 drm_fb_xrgb8888_to_rgb565_line);
333 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565);
336 * drm_fb_xrgb8888_to_rgb565_toio - Convert XRGB8888 to RGB565 clip buffer
337 * @dst: RGB565 destination buffer (iomem)
338 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
339 * @vaddr: XRGB8888 source buffer
340 * @fb: DRM framebuffer
341 * @clip: Clip rectangle area to copy
344 * Drivers can use this function for RGB565 devices that don't natively
347 void drm_fb_xrgb8888_to_rgb565_toio(void __iomem *dst, unsigned int dst_pitch,
348 const void *vaddr, const struct drm_framebuffer *fb,
349 const struct drm_rect *clip, bool swab)
352 drm_fb_xfrm_toio(dst, dst_pitch, 2, vaddr, fb, clip, false,
353 drm_fb_xrgb8888_to_rgb565_swab_line);
355 drm_fb_xfrm_toio(dst, dst_pitch, 2, vaddr, fb, clip, false,
356 drm_fb_xrgb8888_to_rgb565_line);
358 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb565_toio);
360 static void drm_fb_xrgb8888_to_rgb888_line(void *dbuf, const void *sbuf, unsigned int pixels)
363 const u32 *sbuf32 = sbuf;
366 for (x = 0; x < pixels; x++) {
367 *dbuf8++ = (sbuf32[x] & 0x000000FF) >> 0;
368 *dbuf8++ = (sbuf32[x] & 0x0000FF00) >> 8;
369 *dbuf8++ = (sbuf32[x] & 0x00FF0000) >> 16;
374 * drm_fb_xrgb8888_to_rgb888 - Convert XRGB8888 to RGB888 clip buffer
375 * @dst: RGB888 destination buffer
376 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
377 * @src: XRGB8888 source buffer
378 * @fb: DRM framebuffer
379 * @clip: Clip rectangle area to copy
381 * Drivers can use this function for RGB888 devices that don't natively
384 void drm_fb_xrgb8888_to_rgb888(void *dst, unsigned int dst_pitch, const void *src,
385 const struct drm_framebuffer *fb, const struct drm_rect *clip)
387 drm_fb_xfrm(dst, dst_pitch, 3, src, fb, clip, false, drm_fb_xrgb8888_to_rgb888_line);
389 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb888);
392 * drm_fb_xrgb8888_to_rgb888_toio - Convert XRGB8888 to RGB888 clip buffer
393 * @dst: RGB565 destination buffer (iomem)
394 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
395 * @vaddr: XRGB8888 source buffer
396 * @fb: DRM framebuffer
397 * @clip: Clip rectangle area to copy
399 * Drivers can use this function for RGB888 devices that don't natively
402 void drm_fb_xrgb8888_to_rgb888_toio(void __iomem *dst, unsigned int dst_pitch,
403 const void *vaddr, const struct drm_framebuffer *fb,
404 const struct drm_rect *clip)
406 drm_fb_xfrm_toio(dst, dst_pitch, 3, vaddr, fb, clip, false,
407 drm_fb_xrgb8888_to_rgb888_line);
409 EXPORT_SYMBOL(drm_fb_xrgb8888_to_rgb888_toio);
411 static void drm_fb_rgb565_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
414 const u16 *sbuf16 = sbuf;
417 for (x = 0; x < pixels; x++, ++sbuf16, ++dbuf32) {
418 u32 val32 = ((*sbuf16 & 0xf800) << 8) |
419 ((*sbuf16 & 0x07e0) << 5) |
420 ((*sbuf16 & 0x001f) << 3);
421 *dbuf32 = 0xff000000 | val32 |
422 ((val32 >> 3) & 0x00070007) |
423 ((val32 >> 2) & 0x00000300);
427 static void drm_fb_rgb565_to_xrgb8888_toio(void __iomem *dst, unsigned int dst_pitch,
428 const void *vaddr, const struct drm_framebuffer *fb,
429 const struct drm_rect *clip)
431 drm_fb_xfrm_toio(dst, dst_pitch, 4, vaddr, fb, clip, false,
432 drm_fb_rgb565_to_xrgb8888_line);
435 static void drm_fb_rgb888_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
438 const u8 *sbuf8 = sbuf;
441 for (x = 0; x < pixels; x++) {
445 *dbuf32++ = 0xff000000 | (r << 16) | (g << 8) | b;
449 static void drm_fb_rgb888_to_xrgb8888_toio(void __iomem *dst, unsigned int dst_pitch,
450 const void *vaddr, const struct drm_framebuffer *fb,
451 const struct drm_rect *clip)
453 drm_fb_xfrm_toio(dst, dst_pitch, 4, vaddr, fb, clip, false,
454 drm_fb_rgb888_to_xrgb8888_line);
457 static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels)
460 const u32 *sbuf32 = sbuf;
464 for (x = 0; x < pixels; x++) {
465 val32 = ((sbuf32[x] & 0x000000FF) << 2) |
466 ((sbuf32[x] & 0x0000FF00) << 4) |
467 ((sbuf32[x] & 0x00FF0000) << 6);
468 *dbuf32++ = val32 | ((val32 >> 8) & 0x00300C03);
473 * drm_fb_xrgb8888_to_xrgb2101010_toio - Convert XRGB8888 to XRGB2101010 clip
475 * @dst: XRGB2101010 destination buffer (iomem)
476 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
477 * @vaddr: XRGB8888 source buffer
478 * @fb: DRM framebuffer
479 * @clip: Clip rectangle area to copy
481 * Drivers can use this function for XRGB2101010 devices that don't natively
484 void drm_fb_xrgb8888_to_xrgb2101010_toio(void __iomem *dst,
485 unsigned int dst_pitch, const void *vaddr,
486 const struct drm_framebuffer *fb,
487 const struct drm_rect *clip)
489 drm_fb_xfrm_toio(dst, dst_pitch, 4, vaddr, fb, clip, false,
490 drm_fb_xrgb8888_to_xrgb2101010_line);
492 EXPORT_SYMBOL(drm_fb_xrgb8888_to_xrgb2101010_toio);
494 static void drm_fb_xrgb8888_to_gray8_line(void *dbuf, const void *sbuf, unsigned int pixels)
497 const u32 *sbuf32 = sbuf;
500 for (x = 0; x < pixels; x++) {
501 u8 r = (*sbuf32 & 0x00ff0000) >> 16;
502 u8 g = (*sbuf32 & 0x0000ff00) >> 8;
503 u8 b = *sbuf32 & 0x000000ff;
505 /* ITU BT.601: Y = 0.299 R + 0.587 G + 0.114 B */
506 *dbuf8++ = (3 * r + 6 * g + b) / 10;
512 * drm_fb_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale
513 * @dst: 8-bit grayscale destination buffer
514 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
515 * @vaddr: XRGB8888 source buffer
516 * @fb: DRM framebuffer
517 * @clip: Clip rectangle area to copy
519 * Drm doesn't have native monochrome or grayscale support.
520 * Such drivers can announce the commonly supported XR24 format to userspace
521 * and use this function to convert to the native format.
523 * Monochrome drivers will use the most significant bit,
524 * where 1 means foreground color and 0 background color.
526 * ITU BT.601 is used for the RGB -> luma (brightness) conversion.
528 void drm_fb_xrgb8888_to_gray8(void *dst, unsigned int dst_pitch, const void *vaddr,
529 const struct drm_framebuffer *fb, const struct drm_rect *clip)
531 drm_fb_xfrm(dst, dst_pitch, 1, vaddr, fb, clip, false, drm_fb_xrgb8888_to_gray8_line);
533 EXPORT_SYMBOL(drm_fb_xrgb8888_to_gray8);
536 * drm_fb_blit_toio - Copy parts of a framebuffer to display memory
537 * @dst: The display memory to copy to
538 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
539 * @dst_format: FOURCC code of the display's color format
540 * @vmap: The framebuffer memory to copy from
541 * @fb: The framebuffer to copy from
542 * @clip: Clip rectangle area to copy
544 * This function copies parts of a framebuffer to display memory. If the
545 * formats of the display and the framebuffer mismatch, the blit function
546 * will attempt to convert between them.
550 * -EINVAL if the color-format conversion failed, or
551 * a negative error code otherwise.
553 int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_pitch, uint32_t dst_format,
554 const void *vmap, const struct drm_framebuffer *fb,
555 const struct drm_rect *clip)
557 uint32_t fb_format = fb->format->format;
559 /* treat alpha channel like filler bits */
560 if (fb_format == DRM_FORMAT_ARGB8888)
561 fb_format = DRM_FORMAT_XRGB8888;
562 if (dst_format == DRM_FORMAT_ARGB8888)
563 dst_format = DRM_FORMAT_XRGB8888;
564 if (fb_format == DRM_FORMAT_ARGB2101010)
565 fb_format = DRM_FORMAT_XRGB2101010;
566 if (dst_format == DRM_FORMAT_ARGB2101010)
567 dst_format = DRM_FORMAT_XRGB2101010;
569 if (dst_format == fb_format) {
570 drm_fb_memcpy_toio(dst, dst_pitch, vmap, fb, clip);
573 } else if (dst_format == DRM_FORMAT_RGB565) {
574 if (fb_format == DRM_FORMAT_XRGB8888) {
575 drm_fb_xrgb8888_to_rgb565_toio(dst, dst_pitch, vmap, fb, clip, false);
578 } else if (dst_format == DRM_FORMAT_RGB888) {
579 if (fb_format == DRM_FORMAT_XRGB8888) {
580 drm_fb_xrgb8888_to_rgb888_toio(dst, dst_pitch, vmap, fb, clip);
583 } else if (dst_format == DRM_FORMAT_XRGB8888) {
584 if (fb_format == DRM_FORMAT_RGB888) {
585 drm_fb_rgb888_to_xrgb8888_toio(dst, dst_pitch, vmap, fb, clip);
587 } else if (fb_format == DRM_FORMAT_RGB565) {
588 drm_fb_rgb565_to_xrgb8888_toio(dst, dst_pitch, vmap, fb, clip);
591 } else if (dst_format == DRM_FORMAT_XRGB2101010) {
592 if (fb_format == DRM_FORMAT_XRGB8888) {
593 drm_fb_xrgb8888_to_xrgb2101010_toio(dst, dst_pitch, vmap, fb, clip);
598 drm_warn_once(fb->dev, "No conversion helper from %p4cc to %p4cc found.\n",
599 &fb_format, &dst_format);
603 EXPORT_SYMBOL(drm_fb_blit_toio);
606 static void drm_fb_gray8_to_mono_line(void *dbuf, const void *sbuf, unsigned int pixels)
609 const u8 *sbuf8 = sbuf;
612 unsigned int i, bits = min(pixels, 8U);
615 for (i = 0; i < bits; i++, pixels--) {
624 * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome
625 * @dst: monochrome destination buffer (0=black, 1=white)
626 * @dst_pitch: Number of bytes between two consecutive scanlines within dst
627 * @vaddr: XRGB8888 source buffer
628 * @fb: DRM framebuffer
629 * @clip: Clip rectangle area to copy
631 * DRM doesn't have native monochrome support.
632 * Such drivers can announce the commonly supported XR24 format to userspace
633 * and use this function to convert to the native format.
635 * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale and
636 * then the result is converted from grayscale to monochrome.
638 * The first pixel (upper left corner of the clip rectangle) will be converted
639 * and copied to the first bit (LSB) in the first byte of the monochrome
640 * destination buffer.
641 * If the caller requires that the first pixel in a byte must be located at an
642 * x-coordinate that is a multiple of 8, then the caller must take care itself
643 * of supplying a suitable clip rectangle.
645 void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *vaddr,
646 const struct drm_framebuffer *fb, const struct drm_rect *clip)
648 unsigned int linepixels = drm_rect_width(clip);
649 unsigned int lines = drm_rect_height(clip);
650 unsigned int cpp = fb->format->cpp[0];
651 unsigned int len_src32 = linepixels * cpp;
652 struct drm_device *dev = fb->dev;
654 u8 *mono = dst, *gray8;
657 if (drm_WARN_ON(dev, fb->format->format != DRM_FORMAT_XRGB8888))
661 * The mono destination buffer contains 1 bit per pixel
664 dst_pitch = DIV_ROUND_UP(linepixels, 8);
667 * The cma memory is write-combined so reads are uncached.
668 * Speed up by fetching one line at a time.
670 * Also, format conversion from XR24 to monochrome are done
671 * line-by-line but are converted to 8-bit grayscale as an
674 * Allocate a buffer to be used for both copying from the cma
675 * memory and to store the intermediate grayscale line pixels.
677 src32 = kmalloc(len_src32 + linepixels, GFP_KERNEL);
681 gray8 = (u8 *)src32 + len_src32;
683 vaddr += clip_offset(clip, fb->pitches[0], cpp);
684 for (y = 0; y < lines; y++) {
685 src32 = memcpy(src32, vaddr, len_src32);
686 drm_fb_xrgb8888_to_gray8_line(gray8, src32, linepixels);
687 drm_fb_gray8_to_mono_line(mono, gray8, linepixels);
688 vaddr += fb->pitches[0];
694 EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono);