unsigned int width = mode_cmd->width / (i ? hsub : 1);
unsigned int height = mode_cmd->height / (i ? vsub : 1);
unsigned int min_size;
+ unsigned int bpp =
+ drm_format_plane_bpp(mode_cmd->pixel_format, i);
obj = drm_gem_object_lookup(dev, file_priv,
mode_cmd->handles[i]);
}
min_size = (height - 1) * mode_cmd->pitches[i] +
- mode_cmd->offsets[i] +
- width * drm_format_plane_cpp(mode_cmd->pixel_format, i);
-
+ mode_cmd->offsets[i] + roundup(width * bpp, 8) / 8;
if (obj->size < min_size) {
drm_gem_object_unreference_unlocked(obj);
ret = -EINVAL;
case DRM_FORMAT_BGR565:
return VOP_FMT_RGB565;
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV12_10:
return VOP_FMT_YUV420SP;
case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV16_10:
return VOP_FMT_YUV422SP;
case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV24_10:
return VOP_FMT_YUV444SP;
default:
DRM_ERROR("unsupport format[%08x]\n", format);
{
switch (format) {
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV12_10:
case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV16_10:
case DRM_FORMAT_NV24:
+ case DRM_FORMAT_NV24_10:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool is_yuv_10bit(uint32_t format)
+{
+ switch (format) {
+ case DRM_FORMAT_NV12_10:
+ case DRM_FORMAT_NV16_10:
+ case DRM_FORMAT_NV24_10:
return true;
default:
return false;
if (is_yuv_support(fb->pixel_format) && ((src->x1 >> 16) % 2))
return -EINVAL;
- offset = (src->x1 >> 16) * drm_format_plane_cpp(fb->pixel_format, 0);
+ offset = (src->x1 >> 16) * drm_format_plane_bpp(fb->pixel_format, 0) / 8;
if (state->rotation & BIT(DRM_REFLECT_Y))
offset += ((src->y2 >> 16) - 1) * fb->pitches[0];
else
if (is_yuv_support(fb->pixel_format)) {
int hsub = drm_format_horz_chroma_subsampling(fb->pixel_format);
int vsub = drm_format_vert_chroma_subsampling(fb->pixel_format);
- int bpp = drm_format_plane_cpp(fb->pixel_format, 1);
+ int bpp = drm_format_plane_bpp(fb->pixel_format, 1);
- offset = (src->x1 >> 16) * bpp / hsub;
+ offset = (src->x1 >> 16) * bpp / hsub / 8;
offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
dma_addr = rockchip_fb_get_dma_addr(fb, 1);
VOP_WIN_SET(vop, win, uv_vir, fb->pitches[1] >> 2);
VOP_WIN_SET(vop, win, uv_mst, vop_plane_state->uv_mst);
}
+ VOP_WIN_SET(vop, win, fmt_10, is_yuv_10bit(fb->pixel_format));
scl_vop_cal_scl_fac(vop, win, actual_w, actual_h,
drm_rect_width(dest), drm_rect_height(dest),
DRM_FORMAT_NV12,
DRM_FORMAT_NV16,
DRM_FORMAT_NV24,
+ DRM_FORMAT_NV12_10,
+ DRM_FORMAT_NV16_10,
+ DRM_FORMAT_NV24_10,
};
static const uint32_t formats_win_lite[] = {
.nformats = ARRAY_SIZE(formats_win_full),
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 4),
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
.xmirror = VOP_REG_VER(RK3368_WIN0_CTRL0, 0x1, 21, 3, 2, -1),
.ymirror = VOP_REG_VER(RK3368_WIN0_CTRL0, 0x1, 22, 3, 2, -1),