mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
drm: add support for 10bit yuv format
Change-Id: I16358258c574b296dafad85318f696134d4631cf Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
parent
e206a3aee7
commit
7c7b813de3
|
|
@ -323,7 +323,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
|
|||
int ret;
|
||||
|
||||
info = drm_format_info(format);
|
||||
fb_req.bpp = info->cpp[0] * 8;
|
||||
fb_req.bpp = info->bpp[0];
|
||||
fb_req.depth = info->depth;
|
||||
fb_req.width = width;
|
||||
fb_req.height = height;
|
||||
|
|
|
|||
|
|
@ -1702,14 +1702,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
|
|||
* Changes struct fb_var_screeninfo are currently not pushed back
|
||||
* to KMS, hence fail if different settings are requested.
|
||||
*/
|
||||
if (var->bits_per_pixel != fb->format->cpp[0] * 8 ||
|
||||
if (var->bits_per_pixel != fb->format->bpp[0] ||
|
||||
var->xres > fb->width || var->yres > fb->height ||
|
||||
var->xres_virtual > fb->width || var->yres_virtual > fb->height) {
|
||||
DRM_DEBUG("fb requested width/height/bpp can't fit in current fb "
|
||||
"request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n",
|
||||
var->xres, var->yres, var->bits_per_pixel,
|
||||
var->xres_virtual, var->yres_virtual,
|
||||
fb->width, fb->height, fb->format->cpp[0] * 8);
|
||||
fb->width, fb->height, fb->format->bpp[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -2032,7 +2032,7 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
|
|||
info->pseudo_palette = fb_helper->pseudo_palette;
|
||||
info->var.xres_virtual = fb->width;
|
||||
info->var.yres_virtual = fb->height;
|
||||
info->var.bits_per_pixel = fb->format->cpp[0] * 8;
|
||||
info->var.bits_per_pixel = fb->format->bpp[0];
|
||||
info->var.accel_flags = FB_ACCELF_TEXT;
|
||||
info->var.xoffset = 0;
|
||||
info->var.yoffset = 0;
|
||||
|
|
|
|||
|
|
@ -105,74 +105,80 @@ EXPORT_SYMBOL(drm_get_format_name);
|
|||
const struct drm_format_info *__drm_format_info(u32 format)
|
||||
{
|
||||
static const struct drm_format_info formats[] = {
|
||||
{ .format = DRM_FORMAT_C8, .depth = 8, .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGB332, .depth = 8, .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGR233, .depth = 8, .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XRGB4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_ARGB4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA4444, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XRGB1555, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR1555, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_ARGB1555, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR1555, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA5551, .depth = 15, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGB565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGR565, .depth = 16, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGB888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGR888, .depth = 24, .num_planes = 1, .cpp = { 3, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX8888, .depth = 24, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGB565_A8, .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGR565_A8, .depth = 24, .num_planes = 2, .cpp = { 2, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XRGB2101010, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR2101010, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX1010102, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX1010102, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_ARGB2101010, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR2101010, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA1010102, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA1010102, .depth = 30, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA8888, .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA8888, .depth = 32, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGB888_A8, .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGR888_A8, .depth = 32, .num_planes = 2, .cpp = { 3, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XRGB8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XBGR8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBX8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRX8888_A8, .depth = 32, .num_planes = 2, .cpp = { 4, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_YUV410, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU410, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 4, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV411, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU411, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 4, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV420, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU420, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV422, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU422, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV444, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU444, .depth = 0, .num_planes = 3, .cpp = { 1, 1, 1 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV12, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV21, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV16, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV61, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV24, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV42, .depth = 0, .num_planes = 2, .cpp = { 1, 2, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUYV, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVYU, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_C8, .depth = 8, .num_planes = 1, .bpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGB332, .depth = 8, .num_planes = 1, .bpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGR233, .depth = 8, .num_planes = 1, .bpp = { 8, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XRGB4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_ARGB4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA4444, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XRGB1555, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR1555, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX5551, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX5551, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_ARGB1555, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR1555, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA5551, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA5551, .depth = 15, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGB565, .depth = 16, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGR565, .depth = 16, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGB888, .depth = 24, .num_planes = 1, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGR888, .depth = 24, .num_planes = 1, .bpp = { 24, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX8888, .depth = 24, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX8888, .depth = 24, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGB565_A8, .depth = 24, .num_planes = 2, .bpp = { 16, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGR565_A8, .depth = 24, .num_planes = 2, .bpp = { 16, 1, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XRGB2101010, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_XBGR2101010, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_RGBX1010102, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_BGRX1010102, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1 },
|
||||
{ .format = DRM_FORMAT_ARGB2101010, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR2101010, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA1010102, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA1010102, .depth = 30, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBA8888, .depth = 32, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRA8888, .depth = 32, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGB888_A8, .depth = 32, .num_planes = 2, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGR888_A8, .depth = 32, .num_planes = 2, .bpp = { 24, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XRGB8888_A8, .depth = 32, .num_planes = 2, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_XBGR8888_A8, .depth = 32, .num_planes = 2, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_RGBX8888_A8, .depth = 32, .num_planes = 2, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_BGRX8888_A8, .depth = 32, .num_planes = 2, .bpp = { 32, 8, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true },
|
||||
{ .format = DRM_FORMAT_YUV410, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 4, .vsub = 4, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU410, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 4, .vsub = 4, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV411, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 4, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU411, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 4, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV420, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU420, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV422, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU422, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUV444, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVU444, .depth = 0, .num_planes = 3, .bpp = { 8, 8, 8 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV12, .depth = 0, .num_planes = 2, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV21, .depth = 0, .num_planes = 2, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV16, .depth = 0, .num_planes = 2, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV61, .depth = 0, .num_planes = 2, .bpp = { 8, 16, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV24, .depth = 0, .num_planes = 2, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV42, .depth = 0, .num_planes = 2, .bpp = { 8, 16, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV12_10, .depth = 0, .num_planes = 2, .bpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV21_10, .depth = 0, .num_planes = 2, .bpp = { 10, 20, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV16_10, .depth = 0, .num_planes = 2, .bpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV61_10, .depth = 0, .num_planes = 2, .bpp = { 10, 20, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV24_10, .depth = 0, .num_planes = 2, .bpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_NV42_10, .depth = 0, .num_planes = 2, .bpp = { 10, 20, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YUYV, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_YVYU, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .bpp = { 16, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
|
||||
{ .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .bpp = { 32, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, .is_yuv = true },
|
||||
};
|
||||
|
||||
unsigned int i;
|
||||
|
|
@ -263,7 +269,7 @@ int drm_format_plane_cpp(uint32_t format, int plane)
|
|||
if (!info || plane >= info->num_planes)
|
||||
return 0;
|
||||
|
||||
return info->cpp[plane];
|
||||
return info->bpp[plane] >> 3;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_format_plane_cpp);
|
||||
|
||||
|
|
|
|||
|
|
@ -190,20 +190,20 @@ static int framebuffer_check(struct drm_device *dev,
|
|||
for (i = 0; i < info->num_planes; i++) {
|
||||
unsigned int width = fb_plane_width(r->width, info, i);
|
||||
unsigned int height = fb_plane_height(r->height, info, i);
|
||||
unsigned int cpp = info->cpp[i];
|
||||
unsigned int bpp = info->bpp[i];
|
||||
|
||||
if (!r->handles[i]) {
|
||||
DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((uint64_t) width * cpp > UINT_MAX)
|
||||
if ((uint64_t) width * bpp / 8 > UINT_MAX)
|
||||
return -ERANGE;
|
||||
|
||||
if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX)
|
||||
return -ERANGE;
|
||||
|
||||
if (r->pitches[i] < width * cpp) {
|
||||
if (r->pitches[i] < roundup(width * bpp, 8) / 8) {
|
||||
DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -488,7 +488,7 @@ int drm_mode_getfb(struct drm_device *dev,
|
|||
r->height = fb->height;
|
||||
r->width = fb->width;
|
||||
r->depth = fb->format->depth;
|
||||
r->bpp = fb->format->cpp[0] * 8;
|
||||
r->bpp = fb->format->bpp[0];
|
||||
r->pitch = fb->pitches[0];
|
||||
|
||||
/* GET_FB() is an unprivileged ioctl so we must not return a
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
|
|||
}
|
||||
|
||||
min_size = (height - 1) * mode_cmd->pitches[i]
|
||||
+ width * info->cpp[i]
|
||||
+ width * info->bpp[i] / 8
|
||||
+ mode_cmd->offsets[i];
|
||||
|
||||
if (objs[i]->size < min_size) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct drm_mode_fb_cmd2;
|
|||
* valid for a subset of RGB formats only. This is a legacy field, do not
|
||||
* use in new code and set to 0 for new formats.
|
||||
* @num_planes: Number of color planes (1 to 3)
|
||||
* @cpp: Number of bytes per pixel (per plane)
|
||||
* @bpp: Number of bits per pixel (per plane)
|
||||
* @hsub: Horizontal chroma subsampling factor
|
||||
* @vsub: Vertical chroma subsampling factor
|
||||
* @has_alpha: Does the format embeds an alpha component?
|
||||
|
|
@ -45,7 +45,7 @@ struct drm_format_info {
|
|||
u32 format;
|
||||
u8 depth;
|
||||
u8 num_planes;
|
||||
u8 cpp[3];
|
||||
u8 bpp[3];
|
||||
u8 hsub;
|
||||
u8 vsub;
|
||||
bool has_alpha;
|
||||
|
|
|
|||
|
|
@ -141,6 +141,21 @@ extern "C" {
|
|||
#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */
|
||||
#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
|
||||
|
||||
/*
|
||||
* 2 plane YCbCr 10bit
|
||||
* index 0 = Y plane, [9:0] Y
|
||||
* index 1 = Cr:Cb plane, [19:0] Cr:Cb little endian
|
||||
* or
|
||||
* index 1 = Cb:Cr plane, [19:0] Cb:Cr little endian
|
||||
*/
|
||||
|
||||
#define DRM_FORMAT_NV12_10 fourcc_code('N', 'A', '1', '2') /* 2x2 subsampled Cr:Cb plane */
|
||||
#define DRM_FORMAT_NV21_10 fourcc_code('N', 'A', '2', '1') /* 2x2 subsampled Cb:Cr plane */
|
||||
#define DRM_FORMAT_NV16_10 fourcc_code('N', 'A', '1', '6') /* 2x1 subsampled Cr:Cb plane */
|
||||
#define DRM_FORMAT_NV61_10 fourcc_code('N', 'A', '6', '1') /* 2x1 subsampled Cb:Cr plane */
|
||||
#define DRM_FORMAT_NV24_10 fourcc_code('N', 'A', '2', '4') /* non-subsampled Cr:Cb plane */
|
||||
#define DRM_FORMAT_NV42_10 fourcc_code('N', 'A', '4', '2') /* non-subsampled Cb:Cr plane */
|
||||
|
||||
/*
|
||||
* 3 plane YCbCr
|
||||
* index 0: Y plane, [7:0] Y
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user