| @@ -594,8 +594,8 @@ int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_pitch, uint32_t dst_for · 593 unmodified lines |
| 594 | } | 594 | } |
| 595 | EXPORT_SYMBOL(drm_fb_blit_toio); | 595 | EXPORT_SYMBOL(drm_fb_blit_toio); |
| 596 | | 596 | |
| 597 | static void drm_fb_gray8_to_mono_reversed_line(u8 *dst, const u8 *src, unsigned int pixels, | 597 | static void drm_fb_gray8_to_mono_line(u8 *dst, const u8 *src, unsigned int pixels, |
| 598 | unsigned int start_offset, unsigned int end_len) | 598 | unsigned int start_offset, unsigned int end_len) |
| 599 | { | 599 | { |
| 600 | unsigned int xb, i; | 600 | unsigned int xb, i; |
| 601 | | 601 | |
| @@ -621,8 +621,8 @@ static void drm_fb_gray8_to_mono_reversed_line(u8 *dst, const u8 *src, unsigned · 19 unmodified lines |
| 621 | } | 621 | } |
| 622 | | 622 | |
| 623 | /** | 623 | /** |
| 624 | * drm_fb_xrgb8888_to_mono_reversed - Convert XRGB8888 to reversed monochrome | 624 | * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome |
| 625 | * @dst: reversed monochrome destination buffer | 625 | * @dst: monochrome destination buffer (0=black, 1=white) |
| 626 | * @dst_pitch: Number of bytes between two consecutive scanlines within dst | 626 | * @dst_pitch: Number of bytes between two consecutive scanlines within dst |
| 627 | * @src: XRGB8888 source buffer | 627 | * @src: XRGB8888 source buffer |
| 628 | * @fb: DRM framebuffer | 628 | * @fb: DRM framebuffer |
| @@ -633,10 +633,10 @@ static void drm_fb_gray8_to_mono_reversed_line(u8 *dst, const u8 *src, unsigned · 4 unmodified lines |
| 633 | * and use this function to convert to the native format. | 633 | * and use this function to convert to the native format. |
| 634 | * | 634 | * |
| 635 | * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale and | 635 | * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale and |
| 636 | * then the result is converted from grayscale to reversed monohrome. | 636 | * then the result is converted from grayscale to monochrome. |
| 637 | */ | 637 | */ |
| 638 | void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const void *vaddr, | 638 | void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *vaddr, |
| 639 | const struct drm_framebuffer *fb, const struct drm_rect *clip) | 639 | const struct drm_framebuffer *fb, const struct drm_rect *clip) |
| 640 | { | 640 | { |
| 641 | unsigned int linepixels = drm_rect_width(clip); | 641 | unsigned int linepixels = drm_rect_width(clip); |
| 642 | unsigned int lines = clip->y2 - clip->y1; | 642 | unsigned int lines = clip->y2 - clip->y1; |
| @@ -652,8 +652,8 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const v · 9 unmodified lines |
| 652 | return; | 652 | return; |
| 653 | | 653 | |
| 654 | /* | 654 | /* |
| 655 | * The reversed mono destination buffer contains 1 bit per pixel | 655 | * The mono destination buffer contains 1 bit per pixel and |
| 656 | * and destination scanlines have to be in multiple of 8 pixels. | 656 | * destination scanlines have to be in multiple of 8 pixels. |
| 657 | */ | 657 | */ |
| 658 | if (!dst_pitch) | 658 | if (!dst_pitch) |
| 659 | dst_pitch = DIV_ROUND_UP(linepixels, 8); | 659 | dst_pitch = DIV_ROUND_UP(linepixels, 8); |
| @@ -664,9 +664,9 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const v · 4 unmodified lines |
| 664 | * The cma memory is write-combined so reads are uncached. | 664 | * The cma memory is write-combined so reads are uncached. |
| 665 | * Speed up by fetching one line at a time. | 665 | * Speed up by fetching one line at a time. |
| 666 | * | 666 | * |
| 667 | * Also, format conversion from XR24 to reversed monochrome | 667 | * Also, format conversion from XR24 to monochrome are done |
| 668 | * are done line-by-line but are converted to 8-bit grayscale | 668 | * line-by-line but are converted to 8-bit grayscale as an |
| 669 | * as an intermediate step. | 669 | * intermediate step. |
| 670 | * | 670 | * |
| 671 | * Allocate a buffer to be used for both copying from the cma | 671 | * Allocate a buffer to be used for both copying from the cma |
| 672 | * memory and to store the intermediate grayscale line pixels. | 672 | * memory and to store the intermediate grayscale line pixels. |
| @@ -683,7 +683,7 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const v · 10 unmodified lines |
| 683 | * are not aligned to multiple of 8. | 683 | * are not aligned to multiple of 8. |
| 684 | * | 684 | * |
| 685 | * Calculate if the start and end pixels are not aligned and set the | 685 | * Calculate if the start and end pixels are not aligned and set the |
| 686 | * offsets for the reversed mono line conversion function to adjust. | 686 | * offsets for the mono line conversion function to adjust. |
| 687 | */ | 687 | */ |
| 688 | start_offset = clip->x1 % 8; | 688 | start_offset = clip->x1 % 8; |
| 689 | end_len = clip->x2 % 8; | 689 | end_len = clip->x2 % 8; |
| @@ -692,12 +692,11 @@ void drm_fb_xrgb8888_to_mono_reversed(void *dst, unsigned int dst_pitch, const v · 2 unmodified lines |
| 692 | for (y = 0; y < lines; y++) { | 692 | for (y = 0; y < lines; y++) { |
| 693 | src32 = memcpy(src32, vaddr, len_src32); | 693 | src32 = memcpy(src32, vaddr, len_src32); |
| 694 | drm_fb_xrgb8888_to_gray8_line(gray8, src32, linepixels); | 694 | drm_fb_xrgb8888_to_gray8_line(gray8, src32, linepixels); |
| 695 | drm_fb_gray8_to_mono_reversed_line(mono, gray8, dst_pitch, | 695 | drm_fb_gray8_to_mono_line(mono, gray8, dst_pitch, start_offset, end_len); |
| 696 | start_offset, end_len); | | |
| 697 | vaddr += fb->pitches[0]; | 696 | vaddr += fb->pitches[0]; |
| 698 | mono += dst_pitch; | 697 | mono += dst_pitch; |
| 699 | } | 698 | } |
| 700 | | 699 | |
| 701 | kfree(src32); | 700 | kfree(src32); |
| 702 | } | 701 | } |
| 703 | EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono_reversed); | 702 | EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono); |