return !!(rotation & supported_rotation);
}
+static bool dcss_plane_is_source_size_allowed(u16 src_w, u16 src_h, u32 pix_fmt)
+{
+ if (src_w < 64 &&
+ (pix_fmt == DRM_FORMAT_NV12 || pix_fmt == DRM_FORMAT_NV21 ||
+ pix_fmt == DRM_FORMAT_P010))
+ return false;
+ else if (src_w < 32 &&
+ (pix_fmt == DRM_FORMAT_UYVY || pix_fmt == DRM_FORMAT_VYUY ||
+ pix_fmt == DRM_FORMAT_YUYV || pix_fmt == DRM_FORMAT_YVYU))
+ return false;
+
+ return src_w >= 16 && src_h >= 8;
+}
+
static int dcss_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
disp_rect.x2 = hdisplay;
disp_rect.y2 = vdisplay;
+ if (!dcss_plane_is_source_size_allowed(state->src_w >> 16,
+ state->src_h >> 16,
+ fb->format->format)) {
+ DRM_DEBUG_KMS("Source plane size is not allowed!\n");
+ return -EINVAL;
+ }
+
/* make sure the crtc is visible */
if (!drm_rect_intersect(&crtc_rect, &disp_rect)) {
state->visible = false;