From: Hsiao Chien Sung <shawn.sung@mediatek.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Chun-Kuang Hu <chunkuang.hu@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Rob Herring <robh+dt@kernel.org>,
Chen-Yu Tsai <wenst@chromium.org>, Sean Paul <sean@poorly.run>,
<dri-devel@lists.freedesktop.org>,
<linux-mediatek@lists.infradead.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Singo Chang <singo.chang@mediatek.com>,
Nancy Lin <nancy.lin@mediatek.com>,
Jason-JH Lin <jason-jh.lin@mediatek.com>,
Hsiao Chien Sung <shawn.sung@mediatek.com>
Subject: [PATCH v3 05/11] drm/mediatek: Set DRM mode configs accordingly
Date: Tue, 17 Oct 2023 14:47:11 +0800 [thread overview]
Message-ID: <20231017064717.21616-6-shawn.sung@mediatek.com> (raw)
In-Reply-To: <20231017064717.21616-1-shawn.sung@mediatek.com>
Set DRM mode configs limitation accroding to the
hardware capabilities.
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 28 ++++++++++++++++++--------
drivers/gpu/drm/mediatek/mtk_drm_drv.h | 17 ++++++++++++++++
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 5d551bff6b3f..a4b740420ebb 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -304,6 +304,7 @@ static const struct mtk_mmsys_driver_data mt8188_vdosys0_driver_data = {
.conn_routes = mt8188_mtk_ddp_main_routes,
.conn_routes_num = ARRAY_SIZE(mt8188_mtk_ddp_main_routes),
.mmsys_dev_num = 2,
+ .max_pitch = GENMASK(15, 0),
};
static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = {
@@ -318,6 +319,7 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = {
.main_path = mt8195_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt8195_mtk_ddp_main),
.mmsys_dev_num = 2,
+ .max_pitch = GENMASK(15, 0),
};
static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = {
@@ -325,6 +327,7 @@ static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = {
.ext_len = ARRAY_SIZE(mt8195_mtk_ddp_ext),
.mmsys_id = 1,
.mmsys_dev_num = 2,
+ .max_pitch = GENMASK(15, 0),
};
static const struct of_device_id mtk_drm_of_ids[] = {
@@ -463,16 +466,16 @@ static int mtk_drm_kms_init(struct drm_device *drm)
if (ret)
goto put_mutex_dev;
- drm->mode_config.min_width = 64;
- drm->mode_config.min_height = 64;
-
/*
- * set max width and height as default value(4096x4096).
- * this value would be used to check framebuffer size limitation
- * at drm_mode_addfb().
+ * Set default values for drm mode config
+ * these values will be referenced by drm_mode_addfb() as
+ * frame buffer size limitation.
*/
- drm->mode_config.max_width = 4096;
- drm->mode_config.max_height = 4096;
+ drm->mode_config.min_width = 1;
+ drm->mode_config.min_height = 1;
+ drm->mode_config.cursor_width = 512;
+ drm->mode_config.cursor_height = 512;
+
drm->mode_config.funcs = &mtk_drm_mode_config_funcs;
drm->mode_config.helper_private = &mtk_drm_mode_config_helpers;
@@ -502,6 +505,15 @@ static int mtk_drm_kms_init(struct drm_device *drm)
for (j = 0; j < private->data->mmsys_dev_num; j++) {
priv_n = private->all_drm_private[j];
+ if (priv_n->data->max_pitch) {
+ /* Save 4 bytes for the color depth (pitch = width x bpp) */
+ drm->mode_config.max_width = priv_n->data->max_pitch >> 2;
+ drm->mode_config.max_height = priv_n->data->max_pitch >> 2;
+ } else {
+ drm->mode_config.max_width = 4096;
+ drm->mode_config.max_height = 4096;
+ }
+
if (i == 0 && priv_n->data->main_len) {
ret = mtk_drm_crtc_create(drm, priv_n->data->main_path,
priv_n->data->main_len, j,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
index d2efd715699f..833ecee855bb 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
@@ -28,6 +28,21 @@ struct mtk_drm_route {
const unsigned int *route_ddp;
};
+/**
+ * struct mtk_mmsys_driver_data - capabilities for the mmsys
+ * @main_path: path of the main display
+ * @main_len: length of the main display path
+ * @ext_path: path of the external display
+ * @ext_len: length of the external display path
+ * @third_path: path of the third display
+ * @third_len: length of the third display path
+ * @conn_routes: routing table of all the possible connectors
+ * @conn_routes_num: number of the routing table for the connectors
+ * @shadow_register: whether or not shadow register is enabled
+ * @mmsys_id: multi-media system ID
+ * @mmsys_dev_num: number of devices for in the mmsys as a whole
+ * @max_pitch: maximum pitch in bytes that the mmsys supports
+ */
struct mtk_mmsys_driver_data {
const unsigned int *main_path;
unsigned int main_len;
@@ -41,6 +56,8 @@ struct mtk_mmsys_driver_data {
bool shadow_register;
unsigned int mmsys_id;
unsigned int mmsys_dev_num;
+
+ u32 max_pitch;
};
struct mtk_drm_private {
--
2.18.0
next prev parent reply other threads:[~2023-10-17 6:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 6:47 [PATCH v3 00/11] Support IGT in display driver Hsiao Chien Sung
2023-10-17 6:47 ` [PATCH v3 01/11] soc: mediatek: Add register definitions for GCE Hsiao Chien Sung
2023-10-17 6:47 ` [PATCH v3 02/11] soc: mediatek: Disable 9-bit alpha in ETHDR Hsiao Chien Sung
2023-10-17 6:47 ` [PATCH v3 03/11] dt-bindings: display: mediatek: ovl: Modify rules for MT8195/MT8188 Hsiao Chien Sung
2023-10-17 20:19 ` Rob Herring
2023-10-17 6:47 ` [PATCH v3 04/11] drm/mediatek: Add OVL compatible name for MT8195 Hsiao Chien Sung
2023-10-17 6:47 ` Hsiao Chien Sung [this message]
2023-11-22 5:50 ` [PATCH v3 05/11] drm/mediatek: Set DRM mode configs accordingly CK Hu (胡俊光)
2023-10-17 6:47 ` [PATCH v3 06/11] drm/mediatek: Support alpha blending in display driver Hsiao Chien Sung
2023-10-17 6:47 ` [PATCH v3 07/11] drm/mediatek: Support alpha blending in VDOSYS0 Hsiao Chien Sung
2023-11-23 9:22 ` CK Hu (胡俊光)
2023-11-29 9:45 ` Shawn Sung (宋孝謙)
2023-10-17 6:47 ` [PATCH v3 08/11] drm/mediatek: Support alpha blending in VDOSYS1 Hsiao Chien Sung
2023-11-24 6:04 ` CK Hu (胡俊光)
2023-10-17 6:47 ` [PATCH v3 09/11] drm/mediatek: Support CRC in display driver Hsiao Chien Sung
2023-10-17 6:47 ` [PATCH v3 10/11] drm/mediatek: Support CRC in VDOSYS0 Hsiao Chien Sung
2023-11-30 1:19 ` CK Hu (胡俊光)
2023-10-17 6:47 ` [PATCH v3 11/11] drm/mediatek: Support CRC in VDOSYS1 Hsiao Chien Sung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231017064717.21616-6-shawn.sung@mediatek.com \
--to=shawn.sung@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jason-jh.lin@mediatek.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nancy.lin@mediatek.com \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=sean@poorly.run \
--cc=singo.chang@mediatek.com \
--cc=wenst@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®