mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	drm/format-helper: Rework RGB565-to-XRGB8888 conversion
Update RGB565-to-XRGB8888 conversion to support struct iosys_map and convert all users. Although these are single-plane color formats, the new interface supports multi-plane formats for consistency with drm_fb_blit(). v2: * add TODO on vaddr location (Sam) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20220808125406.20752-9-tzimmermann@suse.de
This commit is contained in:
		
							parent
							
								
									c4863ce0f4
								
							
						
					
					
						commit
						cb7fffbd26
					
				
					 1 changed files with 19 additions and 7 deletions
				
			
		| 
						 | 
					@ -478,12 +478,25 @@ static void drm_fb_rgb565_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigne
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void drm_fb_rgb565_to_xrgb8888_toio(void __iomem *dst, unsigned int dst_pitch,
 | 
					static void drm_fb_rgb565_to_xrgb8888(struct iosys_map *dst, const unsigned int *dst_pitch,
 | 
				
			||||||
					   const void *vaddr, const struct drm_framebuffer *fb,
 | 
									      const struct iosys_map *vmap,
 | 
				
			||||||
 | 
									      const struct drm_framebuffer *fb,
 | 
				
			||||||
				      const struct drm_rect *clip)
 | 
									      const struct drm_rect *clip)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	drm_fb_xfrm_toio(dst, dst_pitch, 4, vaddr, fb, clip, false,
 | 
						static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES] = {
 | 
				
			||||||
			 drm_fb_rgb565_to_xrgb8888_line);
 | 
							0, 0, 0, 0
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!dst_pitch)
 | 
				
			||||||
 | 
							dst_pitch = default_dst_pitch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* TODO: handle vmap in I/O memory here */
 | 
				
			||||||
 | 
						if (dst[0].is_iomem)
 | 
				
			||||||
 | 
							drm_fb_xfrm_toio(dst[0].vaddr_iomem, dst_pitch[0], 4, vmap[0].vaddr, fb,
 | 
				
			||||||
 | 
									 clip, false, drm_fb_rgb565_to_xrgb8888_line);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							drm_fb_xfrm(dst[0].vaddr, dst_pitch[0], 4, vmap[0].vaddr, fb,
 | 
				
			||||||
 | 
								    clip, false, drm_fb_rgb565_to_xrgb8888_line);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void drm_fb_rgb888_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
 | 
					static void drm_fb_rgb888_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
 | 
				
			||||||
| 
						 | 
					@ -651,8 +664,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
 | 
				
			||||||
						       vmap[0].vaddr, fb, clip);
 | 
											       vmap[0].vaddr, fb, clip);
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
		} else if (fb_format == DRM_FORMAT_RGB565) {
 | 
							} else if (fb_format == DRM_FORMAT_RGB565) {
 | 
				
			||||||
			drm_fb_rgb565_to_xrgb8888_toio(dst[0].vaddr_iomem, dst_pitch[0],
 | 
								drm_fb_rgb565_to_xrgb8888(dst, dst_pitch, vmap, fb, clip);
 | 
				
			||||||
						       vmap[0].vaddr, fb, clip);
 | 
					 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (dst_format == DRM_FORMAT_XRGB2101010) {
 | 
						} else if (dst_format == DRM_FORMAT_XRGB2101010) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue