kmssink: add force-hantrotile property

This property can enable and disable hantro VPU tile output

upstream status: i.Mx specific
diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
index 231c9b2..b5c82a5 100644
--- a/sys/kms/gstkmssink.c
+++ b/sys/kms/gstkmssink.c
@@ -97,6 +97,7 @@
   PROP_DISPLAY_WIDTH,
   PROP_DISPLAY_HEIGHT,
   PROP_GLOBAL_ALPHA,
+  PROP_FORCE_HANTROTILE,
   PROP_N
 };
 
@@ -1246,20 +1247,22 @@
   drm_modifier = DRM_FORMAT_MOD_AMPHION_TILED;
   gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
 
-  props = drmModeObjectGetProperties (self->fd, self->plane_id, DRM_MODE_OBJECT_PLANE);
-  for (i = 0; i < props->count_props; ++i) {
-    prop = drmModeGetProperty(self->fd, props->props[i]);
-    if (!strcmp(prop->name, "dtrc_table_ofs")) {
-      GST_DEBUG ("has dtrc_table_ofs property, can support VSI tile format");
-      drm_modifier = DRM_FORMAT_MOD_VSI_G1_TILED;
-      gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
-      drm_modifier = DRM_FORMAT_MOD_VSI_G2_TILED;
-      gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
-      drm_modifier = DRM_FORMAT_MOD_VSI_G2_TILED_COMPRESSED;
-      gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
+  if (self->hantro_tile_enabled) {
+    props = drmModeObjectGetProperties (self->fd, self->plane_id, DRM_MODE_OBJECT_PLANE);
+    for (i = 0; i < props->count_props; ++i) {
+      prop = drmModeGetProperty(self->fd, props->props[i]);
+      if (!strcmp(prop->name, "dtrc_table_ofs")) {
+        GST_DEBUG ("has dtrc_table_ofs property, can support VSI tile format");
+        drm_modifier = DRM_FORMAT_MOD_VSI_G1_TILED;
+        gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
+        drm_modifier = DRM_FORMAT_MOD_VSI_G2_TILED;
+        gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
+        drm_modifier = DRM_FORMAT_MOD_VSI_G2_TILED_COMPRESSED;
+        gst_query_add_allocation_dmabuf_meta (query, drm_modifier);
+      }
+      drmModeFreeProperty (prop);
+      prop = NULL;
     }
-    drmModeFreeProperty (prop);
-    prop = NULL;
   }
 
   return TRUE;
@@ -2017,6 +2020,9 @@
     case PROP_GLOBAL_ALPHA:
       sink->global_alpha = g_value_get_int (value);
       break;
+    case PROP_FORCE_HANTROTILE:
+      sink->hantro_tile_enabled = g_value_get_boolean (value);
+      break;
     default:
       if (!gst_video_overlay_set_property (object, PROP_N, prop_id, value))
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2064,6 +2070,9 @@
     case PROP_GLOBAL_ALPHA:
       g_value_set_int (value, sink->global_alpha);
       break;
+    case PROP_FORCE_HANTROTILE:
+      g_value_set_boolean (value, sink->hantro_tile_enabled);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -2093,6 +2102,7 @@
   sink->scale_checked = FALSE;
   sink->upscale_ratio = 1;
   sink->downscale_ratio = 1;
+  sink->hantro_tile_enabled = FALSE;
   gst_poll_fd_init (&sink->pollfd);
   sink->poll = gst_poll_new (TRUE);
   gst_video_info_init (&sink->vinfo);
@@ -2192,6 +2202,16 @@
       g_param_spec_boolean ("force-modesetting", "Force modesetting",
       "When enabled, the sink try to configure the display mode", FALSE,
       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
+  
+  /**
+   * kmssink:force-hantrotile:
+   *
+   * If enable, the sink propose hantro tile modifier to VPU.
+   */
+  g_properties[PROP_FORCE_HANTROTILE] =
+      g_param_spec_boolean ("force-hantrotile", "Force to use hantro tile",
+      "When enabled, the sink propose hantro tile modifier to VPU", FALSE,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT);
 
   /**
    * kmssink:can-scale:
diff --git a/sys/kms/gstkmssink.h b/sys/kms/gstkmssink.h
index 15f6fc1..25c6ee0 100644
--- a/sys/kms/gstkmssink.h
+++ b/sys/kms/gstkmssink.h
@@ -80,6 +80,7 @@
 
   gboolean modesetting_enabled;
   gboolean display_connected;
+  gboolean hantro_tile_enabled;
 
   GstVideoInfo vinfo;
   GstCaps *allowed_caps;