Lines Matching +full:top +full:- +full:speed

1 // SPDX-License-Identifier: GPL-2.0 or MIT
12 #include <linux/iosys-map.h>
24 * drm_format_conv_state_init - Initialize format-conversion state
32 state->tmp.mem = NULL; in drm_format_conv_state_init()
33 state->tmp.size = 0; in drm_format_conv_state_init()
34 state->tmp.preallocated = false; in drm_format_conv_state_init()
39 * drm_format_conv_state_copy - Copy format-conversion state
43 * Copies format-conversion state from @old_state to @state; except for
53 state->tmp.mem = NULL; in drm_format_conv_state_copy()
54 state->tmp.size = 0; in drm_format_conv_state_copy()
55 state->tmp.preallocated = false; in drm_format_conv_state_copy()
60 * drm_format_conv_state_reserve - Allocates storage for format conversion
61 * @state: The format-conversion state
78 if (new_size <= state->tmp.size) in drm_format_conv_state_reserve()
80 else if (state->tmp.preallocated) in drm_format_conv_state_reserve()
83 mem = krealloc(state->tmp.mem, new_size, flags); in drm_format_conv_state_reserve()
87 state->tmp.mem = mem; in drm_format_conv_state_reserve()
88 state->tmp.size = new_size; in drm_format_conv_state_reserve()
91 return state->tmp.mem; in drm_format_conv_state_reserve()
96 * drm_format_conv_state_release - Releases an format-conversion storage
97 * @state: The format-conversion state
99 * Releases the memory range references by the format-conversion state.
105 if (state->tmp.preallocated) in drm_format_conv_state_release()
108 kfree(state->tmp.mem); in drm_format_conv_state_release()
109 state->tmp.mem = NULL; in drm_format_conv_state_release()
110 state->tmp.size = 0; in drm_format_conv_state_release()
116 return clip->y1 * pitch + clip->x1 * cpp; in clip_offset()
120 * drm_fb_clip_offset - Returns the clipping rectangles byte-offset in a framebuffer
126 * The byte offset of the clip rectangle's top-left corner within the framebuffer.
131 return clip_offset(clip, pitch, format->cpp[0]); in drm_fb_clip_offset()
135 /* TODO: Make this function work with multi-plane formats. */
144 size_t sbuf_len = linepixels * fb->format->cpp[0]; in __drm_fb_xfrm()
150 * Some source buffers, such as DMA memory, use write-combine in __drm_fb_xfrm()
151 * caching, so reads are uncached. Speed up access by fetching in __drm_fb_xfrm()
157 return -ENOMEM; in __drm_fb_xfrm()
162 vaddr += clip_offset(clip, fb->pitches[0], fb->format->cpp[0]); in __drm_fb_xfrm()
170 vaddr += fb->pitches[0]; in __drm_fb_xfrm()
177 /* TODO: Make this function work with multi-plane formats. */
188 size_t sbuf_len = linepixels * fb->format->cpp[0]; in __drm_fb_xfrm_toio()
201 return -ENOMEM; in __drm_fb_xfrm_toio()
205 vaddr += clip_offset(clip, fb->pitches[0], fb->format->cpp[0]); in __drm_fb_xfrm_toio()
214 vaddr += fb->pitches[0]; in __drm_fb_xfrm_toio()
221 /* TODO: Make this function work with multi-plane formats. */
248 * drm_fb_memcpy - Copy clip buffer
263 * top-left corner).
273 const struct drm_format_info *format = fb->format; in drm_fb_memcpy()
279 for (i = 0; i < format->num_planes; ++i) { in drm_fb_memcpy()
290 iosys_map_incr(&src_i, clip_offset(clip, fb->pitches[i], cpp_i)); in drm_fb_memcpy()
294 iosys_map_incr(&src_i, fb->pitches[i]); in drm_fb_memcpy()
322 * drm_fb_swab - Swap bytes into clip buffer
329 * @cached: Source buffer is mapped cached (eg. not write-combined)
332 * This function copies parts of a framebuffer to display memory and swaps per-pixel
337 * false a temporary buffer is used to cache one pixel line at a time to speed up
341 * top-left corner).
348 const struct drm_format_info *format = fb->format; in drm_fb_swab()
360 drm_warn_once(fb->dev, "Format %p4cc has unsupported pixel size.\n", in drm_fb_swab()
361 &format->format); in drm_fb_swab()
385 * drm_fb_xrgb8888_to_rgb332 - Convert XRGB8888 to RGB332 clip buffer
401 * top-left corner).
455 * drm_fb_xrgb8888_to_rgb565 - Convert XRGB8888 to RGB565 clip buffer
472 * top-left corner).
514 * drm_fb_xrgb8888_to_xrgb1555 - Convert XRGB8888 to XRGB1555 clip buffer
530 * top-left corner).
567 * drm_fb_xrgb8888_to_argb1555 - Convert XRGB8888 to ARGB1555 clip buffer
583 * top-left corner).
620 * drm_fb_xrgb8888_to_rgba5551 - Convert XRGB8888 to RGBA5551 clip buffer
636 * top-left corner).
663 /* write blue-green-red to output in little endianness */ in drm_fb_xrgb8888_to_rgb888_line()
671 * drm_fb_xrgb8888_to_rgb888 - Convert XRGB8888 to RGB888 clip buffer
687 * top-left corner).
720 * drm_fb_xrgb8888_to_argb8888 - Convert XRGB8888 to ARGB8888 clip buffer
736 * top-left corner).
835 * drm_fb_xrgb8888_to_xrgb2101010 - Convert XRGB8888 to XRGB2101010 clip buffer
851 * top-left corner).
890 * drm_fb_xrgb8888_to_argb2101010 - Convert XRGB8888 to ARGB2101010 clip buffer
906 * top-left corner).
943 * drm_fb_xrgb8888_to_gray8 - Convert XRGB8888 to grayscale
944 * @dst: Array of 8-bit grayscale destination buffers
959 * top-left corner).
966 * ITU BT.601 is being used for the RGB -> luma (brightness) conversion.
982 * drm_fb_blit - Copy parts of a framebuffer to display memory
983 * @dst: Array of display-memory addresses to copy to
1000 * top-left corner).
1004 * -EINVAL if the color-format conversion failed, or
1011 uint32_t fb_format = fb->format->format; in drm_fb_blit()
1059 drm_warn_once(fb->dev, "No conversion helper from %p4cc to %p4cc found.\n", in drm_fb_blit()
1062 return -EINVAL; in drm_fb_blit()
1075 for (i = 0; i < bits; i++, pixels--) { in drm_fb_gray8_to_mono_line()
1084 * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome
1100 * top-left corner). The first pixel (upper left corner of the clip rectangle) will
1103 * be located at an x-coordinate that is a multiple of 8, then the caller must take
1123 unsigned int cpp = fb->format->cpp[0]; in drm_fb_xrgb8888_to_mono()
1125 struct drm_device *dev = fb->dev; in drm_fb_xrgb8888_to_mono()
1132 if (drm_WARN_ON(dev, fb->format->format != DRM_FORMAT_XRGB8888)) in drm_fb_xrgb8888_to_mono()
1146 * The dma memory is write-combined so reads are uncached. in drm_fb_xrgb8888_to_mono()
1147 * Speed up by fetching one line at a time. in drm_fb_xrgb8888_to_mono()
1150 * line-by-line but are converted to 8-bit grayscale as an in drm_fb_xrgb8888_to_mono()
1162 vaddr += clip_offset(clip, fb->pitches[0], cpp); in drm_fb_xrgb8888_to_mono()
1167 vaddr += fb->pitches[0]; in drm_fb_xrgb8888_to_mono()
1219 * drm_fb_build_fourcc_list - Filters a list of supported color formats against
1241 * The number of color-formats 4CC codes returned in @fourccs_out.
1269 * alpha formats that are non-alpha formats instead. So in drm_fb_build_fourcc_list()
1270 * replace alpha formats by non-alpha formats. in drm_fb_build_fourcc_list()
1274 if (is_listed_fourcc(fourccs_out, fourccs - fourccs_out, fourcc)) { in drm_fb_build_fourcc_list()
1294 if (is_listed_fourcc(fourccs_out, fourccs - fourccs_out, fourcc)) { in drm_fb_build_fourcc_list()
1307 return fourccs - fourccs_out; in drm_fb_build_fourcc_list()