drm/msm: add capability property for crtc
Add capability property for crtc to update
all system wide capabilities like hardware rev,
ubwc support, source split, qseed rev support, etc.
Change-Id: Iecc6f4ec7376f7f5de884042aa7a3b0a5387d6d6
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 4505d93..e5adb11 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -103,6 +103,8 @@
};
enum msm_mdp_crtc_property {
+ CRTC_PROP_INFO,
+
/* # of blob properties */
CRTC_PROP_BLOBCOUNT,
diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c
index 30ed9f1..4ee953b 100644
--- a/drivers/gpu/drm/msm/sde/sde_crtc.c
+++ b/drivers/gpu/drm/msm/sde/sde_crtc.c
@@ -56,6 +56,9 @@
if (!crtc)
return;
+ if (sde_crtc->blob_info)
+ drm_property_unreference_blob(sde_crtc->blob_info);
+
msm_property_destroy(&sde_crtc->property_info);
sde_cp_crtc_destroy_properties(crtc);
debugfs_remove_recursive(sde_crtc->debugfs_root);
@@ -935,21 +938,29 @@
* sde_crtc_install_properties - install all drm properties for crtc
* @crtc: Pointer to drm crtc structure
*/
-static void sde_crtc_install_properties(struct drm_crtc *crtc)
+static void sde_crtc_install_properties(struct drm_crtc *crtc,
+ struct sde_mdss_cfg *catalog)
{
struct sde_crtc *sde_crtc;
struct drm_device *dev;
+ struct sde_kms_info *info;
SDE_DEBUG("\n");
- if (!crtc) {
- SDE_ERROR("invalid crtc\n");
+ if (!crtc || !catalog) {
+ SDE_ERROR("invalid crtc or catalog\n");
return;
}
sde_crtc = to_sde_crtc(crtc);
dev = crtc->dev;
+ info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
+ if (!info) {
+ SDE_ERROR("failed to allocate info memory\n");
+ return;
+ }
+
/* range properties */
msm_property_install_range(&sde_crtc->property_info,
"input_fence_timeout", 0x0, 0, SDE_CRTC_MAX_INPUT_FENCE_TIMEOUT,
@@ -961,6 +972,25 @@
msm_property_install_range(&sde_crtc->property_info,
"output_fence_offset", 0x0, 0, 1, 0,
CRTC_PROP_OUTPUT_FENCE_OFFSET);
+
+ msm_property_install_blob(&sde_crtc->property_info, "capabilities",
+ DRM_MODE_PROP_IMMUTABLE, CRTC_PROP_INFO);
+ sde_kms_info_reset(info);
+
+ sde_kms_info_add_keyint(info, "hw_version", catalog->hwversion);
+ sde_kms_info_add_keyint(info, "max_linewidth",
+ catalog->max_mixer_width);
+ sde_kms_info_add_keyint(info, "max_blendstages",
+ catalog->max_mixer_blendstages);
+ if (catalog->qseed_type == SDE_SSPP_SCALER_QSEED2)
+ sde_kms_info_add_keystr(info, "qseed_type", "qseed2");
+ if (catalog->qseed_type == SDE_SSPP_SCALER_QSEED3)
+ sde_kms_info_add_keystr(info, "qseed_type", "qseed3");
+ sde_kms_info_add_keyint(info, "has_src_split", catalog->has_src_split);
+ msm_property_set_blob(&sde_crtc->property_info, &sde_crtc->blob_info,
+ info->data, info->len, CRTC_PROP_INFO);
+
+ kfree(info);
}
/**
@@ -1201,7 +1231,7 @@
CRTC_PROP_COUNT, CRTC_PROP_BLOBCOUNT,
sizeof(struct sde_crtc_state));
- sde_crtc_install_properties(crtc);
+ sde_crtc_install_properties(crtc, kms->catalog);
sde_cp_crtc_init(crtc);
SDE_DEBUG("%s: successfully initialized crtc\n", sde_crtc->name);
diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.h b/drivers/gpu/drm/msm/sde/sde_crtc.h
index 39b7b18..ffe2376 100644
--- a/drivers/gpu/drm/msm/sde/sde_crtc.h
+++ b/drivers/gpu/drm/msm/sde/sde_crtc.h
@@ -72,6 +72,7 @@
struct msm_property_info property_info;
struct msm_property_data property_data[CRTC_PROP_COUNT];
+ struct drm_property_blob *blob_info;
/* output fence support */
struct sde_fence output_fence;
diff --git a/drivers/gpu/drm/msm/sde/sde_kms.c b/drivers/gpu/drm/msm/sde/sde_kms.c
index bcdf4d3..534bdb4 100644
--- a/drivers/gpu/drm/msm/sde/sde_kms.c
+++ b/drivers/gpu/drm/msm/sde/sde_kms.c
@@ -687,8 +687,7 @@
* max crtc width is equal to the max mixer width * 2 and max height is
* is 4K
*/
- dev->mode_config.max_width =
- sde_kms->catalog->mixer[0].sblk->maxwidth * 2;
+ dev->mode_config.max_width = sde_kms->catalog->max_mixer_width * 2;
dev->mode_config.max_height = 4096;
/*