kmssink: check scale-able need avoid exceeding the crtc size

setplane when check scale-able, need avoid exceeding the crtc size

upstream status: i.mx specific
diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
index 6086a06..871fd86 100644
--- a/sys/kms/gstkmssink.c
+++ b/sys/kms/gstkmssink.c
@@ -419,6 +419,7 @@
   gint result;
   guint32 fb_id;
   guint32 width, height;
+  guint32 crtc_w, crtc_h;
   GstKMSMemory *kmsmem = NULL;
 
   if (!self->can_scale)
@@ -437,9 +438,11 @@
 
   width = GST_VIDEO_INFO_WIDTH (&self->vinfo);
   height = GST_VIDEO_INFO_HEIGHT (&self->vinfo);
+  crtc_w = MIN (width / 2, self->hdisplay);
+  crtc_h = MIN (height / 2, self->vdisplay);
 
   result = drmModeSetPlane (self->ctrl_fd, self->plane_id, self->crtc_id, fb_id, 0,
-      0, 0, width/2, height/2,
+      0, 0, crtc_w, crtc_h,
       0, 0, width << 16, height << 16);
   if (result) {
     self->can_scale = FALSE;