1ae4df11aSLaurent Pinchart /* 2ae4df11aSLaurent Pinchart * Copyright (c) 2016 Laurent Pinchart <laurent.pinchart@ideasonboard.com> 3ae4df11aSLaurent Pinchart * 4ae4df11aSLaurent Pinchart * Permission to use, copy, modify, distribute, and sell this software and its 5ae4df11aSLaurent Pinchart * documentation for any purpose is hereby granted without fee, provided that 6ae4df11aSLaurent Pinchart * the above copyright notice appear in all copies and that both that copyright 7ae4df11aSLaurent Pinchart * notice and this permission notice appear in supporting documentation, and 8ae4df11aSLaurent Pinchart * that the name of the copyright holders not be used in advertising or 9ae4df11aSLaurent Pinchart * publicity pertaining to distribution of the software without specific, 10ae4df11aSLaurent Pinchart * written prior permission. The copyright holders make no representations 11ae4df11aSLaurent Pinchart * about the suitability of this software for any purpose. It is provided "as 12ae4df11aSLaurent Pinchart * is" without express or implied warranty. 13ae4df11aSLaurent Pinchart * 14ae4df11aSLaurent Pinchart * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15ae4df11aSLaurent Pinchart * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16ae4df11aSLaurent Pinchart * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17ae4df11aSLaurent Pinchart * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18ae4df11aSLaurent Pinchart * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19ae4df11aSLaurent Pinchart * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20ae4df11aSLaurent Pinchart * OF THIS SOFTWARE. 21ae4df11aSLaurent Pinchart */ 22ae4df11aSLaurent Pinchart #ifndef __DRM_FOURCC_H__ 23ae4df11aSLaurent Pinchart #define __DRM_FOURCC_H__ 24ae4df11aSLaurent Pinchart 25ae4df11aSLaurent Pinchart #include <linux/types.h> 26ae4df11aSLaurent Pinchart #include <uapi/drm/drm_fourcc.h> 27ae4df11aSLaurent Pinchart 2884770cc2SLaurent Pinchart /** 2984770cc2SLaurent Pinchart * struct drm_format_info - information about a DRM format 3084770cc2SLaurent Pinchart * @format: 4CC format identifier (DRM_FORMAT_*) 3184770cc2SLaurent Pinchart * @depth: Color depth (number of bits per pixel excluding padding bits), 3284770cc2SLaurent Pinchart * valid for a subset of RGB formats only. This is a legacy field, do not 3384770cc2SLaurent Pinchart * use in new code and set to 0 for new formats. 3484770cc2SLaurent Pinchart * @num_planes: Number of color planes (1 to 3) 3584770cc2SLaurent Pinchart * @cpp: Number of bytes per pixel (per plane) 3684770cc2SLaurent Pinchart * @hsub: Horizontal chroma subsampling factor 3784770cc2SLaurent Pinchart * @vsub: Vertical chroma subsampling factor 3884770cc2SLaurent Pinchart */ 3984770cc2SLaurent Pinchart struct drm_format_info { 4084770cc2SLaurent Pinchart u32 format; 4184770cc2SLaurent Pinchart u8 depth; 4284770cc2SLaurent Pinchart u8 num_planes; 4384770cc2SLaurent Pinchart u8 cpp[3]; 4484770cc2SLaurent Pinchart u8 hsub; 4584770cc2SLaurent Pinchart u8 vsub; 4684770cc2SLaurent Pinchart }; 4784770cc2SLaurent Pinchart 4884770cc2SLaurent Pinchart const struct drm_format_info *drm_format_info(u32 format); 49ec5e3047SDaniel Vetter uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); 50ae4df11aSLaurent Pinchart void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp); 51ae4df11aSLaurent Pinchart int drm_format_num_planes(uint32_t format); 52ae4df11aSLaurent Pinchart int drm_format_plane_cpp(uint32_t format, int plane); 53ae4df11aSLaurent Pinchart int drm_format_horz_chroma_subsampling(uint32_t format); 54ae4df11aSLaurent Pinchart int drm_format_vert_chroma_subsampling(uint32_t format); 55ae4df11aSLaurent Pinchart int drm_format_plane_width(int width, uint32_t format, int plane); 56ae4df11aSLaurent Pinchart int drm_format_plane_height(int height, uint32_t format, int plane); 57d3828147SEric Engestrom char *drm_get_format_name(uint32_t format) __malloc; 58ae4df11aSLaurent Pinchart 59ae4df11aSLaurent Pinchart #endif /* __DRM_FOURCC_H__ */ 60