All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v3 32/35] drm: omapdrm: Move PCD, LINEWIDTH and DOWNSCALE features to dispc driver
Date: Sat,  5 Aug 2017 01:44:16 +0300	[thread overview]
Message-ID: <20170804224419.30758-33-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20170804224419.30758-1-laurent.pinchart@ideasonboard.com>

The FEAT_PARAM_DSS_PCD, FEAT_PARAM_LINEWIDTH and FEAT_PARAM_DOWNSCALE
features are specific to the DISPC, move them from the omap_dss_features
structure to the dispc driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c        | 53 ++++++++++++++++++++++--------
 drivers/gpu/drm/omapdrm/dss/dss_features.c | 19 -----------
 drivers/gpu/drm/omapdrm/dss/dss_features.h |  3 --
 3 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 23f887ce4936..49c9c46428f9 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -105,6 +105,9 @@ struct dispc_features {
 	u16 mgr_height_max;
 	unsigned long max_lcd_pclk;
 	unsigned long max_tv_pclk;
+	unsigned int max_downscale;
+	unsigned int max_line_width;
+	unsigned int min_pcd;
 	int (*calc_scaling) (unsigned long pclk, unsigned long lclk,
 		const struct videomode *vm,
 		u16 width, u16 height, u16 out_width, u16 out_height,
@@ -2207,8 +2210,7 @@ static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk,
 	int error;
 	u16 in_width, in_height;
 	int min_factor = min(*decim_x, *decim_y);
-	const int maxsinglelinewidth =
-			dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
+	const int maxsinglelinewidth = dispc.feat->max_line_width;
 
 	*five_taps = false;
 
@@ -2252,8 +2254,7 @@ static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
 {
 	int error;
 	u16 in_width, in_height;
-	const int maxsinglelinewidth =
-			dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
+	const int maxsinglelinewidth = dispc.feat->max_line_width;
 
 	do {
 		in_height = height / *decim_y;
@@ -2338,9 +2339,8 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
 	u16 in_width, in_width_max;
 	int decim_x_min = *decim_x;
 	u16 in_height = height / *decim_y;
-	const int maxsinglelinewidth =
-				dss_feat_get_param_max(FEAT_PARAM_LINEWIDTH);
-	const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE);
+	const int maxsinglelinewidth = dispc.feat->max_line_width;
+	const int maxdownscale = dispc.feat->max_downscale;
 
 	if (mem_to_mem) {
 		in_width_max = out_width * maxdownscale;
@@ -2400,7 +2400,7 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,
 		int *x_predecim, int *y_predecim, u16 pos_x,
 		enum omap_dss_rotation_type rotation_type, bool mem_to_mem)
 {
-	const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE);
+	const int maxdownscale = dispc.feat->max_downscale;
 	const int max_decim_limit = 16;
 	unsigned long core_clk = 0;
 	int decim_x, decim_y, ret;
@@ -3481,7 +3481,7 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
 	return 0;
 }
 
-bool dispc_div_calc(unsigned long dispc,
+bool dispc_div_calc(unsigned long dispc_freq,
 		unsigned long pck_min, unsigned long pck_max,
 		dispc_div_calc_func func, void *data)
 {
@@ -3499,19 +3499,19 @@ bool dispc_div_calc(unsigned long dispc,
 	min_fck_per_pck = 0;
 #endif
 
-	pckd_hw_min = dss_feat_get_param_min(FEAT_PARAM_DSS_PCD);
-	pckd_hw_max = dss_feat_get_param_max(FEAT_PARAM_DSS_PCD);
+	pckd_hw_min = dispc.feat->min_pcd;
+	pckd_hw_max = 255;
 
 	lck_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
 
 	pck_min = pck_min ? pck_min : 1;
 	pck_max = pck_max ? pck_max : ULONG_MAX;
 
-	lckd_start = max(DIV_ROUND_UP(dispc, lck_max), 1ul);
-	lckd_stop = min(dispc / pck_min, 255ul);
+	lckd_start = max(DIV_ROUND_UP(dispc_freq, lck_max), 1ul);
+	lckd_stop = min(dispc_freq / pck_min, 255ul);
 
 	for (lckd = lckd_start; lckd <= lckd_stop; ++lckd) {
-		lck = dispc / lckd;
+		lck = dispc_freq / lckd;
 
 		pckd_start = max(DIV_ROUND_UP(lck, pck_max), pckd_hw_min);
 		pckd_stop = min(lck / pck_min, pckd_hw_max);
@@ -4047,6 +4047,13 @@ static const struct dispc_features omap24xx_dispc_feats = {
 	.mgr_width_max		=	2048,
 	.mgr_height_max		=	2048,
 	.max_lcd_pclk		=	66500000,
+	.max_downscale		=	2,
+	/*
+	 * Assume the line width buffer to be 768 pixels as OMAP2 DISPC scaler
+	 * cannot scale an image width larger than 768.
+	 */
+	.max_line_width		=	768,
+	.min_pcd		=	2,
 	.calc_scaling		=	dispc_ovl_calc_scaling_24xx,
 	.calc_core_clk		=	calc_core_clk_24xx,
 	.num_fifos		=	3,
@@ -4078,6 +4085,9 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats = {
 	.mgr_height_max		=	2048,
 	.max_lcd_pclk		=	173000000,
 	.max_tv_pclk		=	59000000,
+	.max_downscale		=	4,
+	.max_line_width		=	1024,
+	.min_pcd		=	1,
 	.calc_scaling		=	dispc_ovl_calc_scaling_34xx,
 	.calc_core_clk		=	calc_core_clk_34xx,
 	.num_fifos		=	3,
@@ -4109,6 +4119,9 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats = {
 	.mgr_height_max		=	2048,
 	.max_lcd_pclk		=	173000000,
 	.max_tv_pclk		=	59000000,
+	.max_downscale		=	4,
+	.max_line_width		=	1024,
+	.min_pcd		=	1,
 	.calc_scaling		=	dispc_ovl_calc_scaling_34xx,
 	.calc_core_clk		=	calc_core_clk_34xx,
 	.num_fifos		=	3,
@@ -4140,6 +4153,9 @@ static const struct dispc_features omap36xx_dispc_feats = {
 	.mgr_height_max		=	2048,
 	.max_lcd_pclk		=	173000000,
 	.max_tv_pclk		=	59000000,
+	.max_downscale		=	4,
+	.max_line_width		=	1024,
+	.min_pcd		=	1,
 	.calc_scaling		=	dispc_ovl_calc_scaling_34xx,
 	.calc_core_clk		=	calc_core_clk_34xx,
 	.num_fifos		=	3,
@@ -4171,6 +4187,9 @@ static const struct dispc_features am43xx_dispc_feats = {
 	.mgr_height_max		=	2048,
 	.max_lcd_pclk		=	173000000,
 	.max_tv_pclk		=	59000000,
+	.max_downscale		=	4,
+	.max_line_width		=	1024,
+	.min_pcd		=	1,
 	.calc_scaling		=	dispc_ovl_calc_scaling_34xx,
 	.calc_core_clk		=	calc_core_clk_34xx,
 	.num_fifos		=	3,
@@ -4202,6 +4221,9 @@ static const struct dispc_features omap44xx_dispc_feats = {
 	.mgr_height_max		=	2048,
 	.max_lcd_pclk		=	170000000,
 	.max_tv_pclk		=	185625000,
+	.max_downscale		=	4,
+	.max_line_width		=	2048,
+	.min_pcd		=	1,
 	.calc_scaling		=	dispc_ovl_calc_scaling_44xx,
 	.calc_core_clk		=	calc_core_clk_44xx,
 	.num_fifos		=	5,
@@ -4238,6 +4260,9 @@ static const struct dispc_features omap54xx_dispc_feats = {
 	.mgr_height_max		=	4096,
 	.max_lcd_pclk		=	170000000,
 	.max_tv_pclk		=	186000000,
+	.max_downscale		=	4,
+	.max_line_width		=	2048,
+	.min_pcd		=	1,
 	.calc_scaling		=	dispc_ovl_calc_scaling_44xx,
 	.calc_core_clk		=	calc_core_clk_44xx,
 	.num_fifos		=	5,
diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.c b/drivers/gpu/drm/omapdrm/dss/dss_features.c
index 1d35cc80b363..c904d80a5920 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss_features.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss_features.c
@@ -102,41 +102,22 @@ static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
 
 static const struct dss_param_range omap2_dss_param_range[] = {
 	[FEAT_PARAM_DSS_FCK]			= { 0, 133000000 },
-	[FEAT_PARAM_DSS_PCD]			= { 2, 255 },
-	[FEAT_PARAM_DOWNSCALE]			= { 1, 2 },
-	/*
-	 * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
-	 * scaler cannot scale a image with width more than 768.
-	 */
-	[FEAT_PARAM_LINEWIDTH]			= { 1, 768 },
 };
 
 static const struct dss_param_range omap3_dss_param_range[] = {
 	[FEAT_PARAM_DSS_FCK]			= { 0, 173000000 },
-	[FEAT_PARAM_DSS_PCD]			= { 1, 255 },
-	[FEAT_PARAM_DOWNSCALE]			= { 1, 4 },
-	[FEAT_PARAM_LINEWIDTH]			= { 1, 1024 },
 };
 
 static const struct dss_param_range am43xx_dss_param_range[] = {
 	[FEAT_PARAM_DSS_FCK]			= { 0, 200000000 },
-	[FEAT_PARAM_DSS_PCD]			= { 1, 255 },
-	[FEAT_PARAM_DOWNSCALE]			= { 1, 4 },
-	[FEAT_PARAM_LINEWIDTH]			= { 1, 1024 },
 };
 
 static const struct dss_param_range omap4_dss_param_range[] = {
 	[FEAT_PARAM_DSS_FCK]			= { 0, 186000000 },
-	[FEAT_PARAM_DSS_PCD]			= { 1, 255 },
-	[FEAT_PARAM_DOWNSCALE]			= { 1, 4 },
-	[FEAT_PARAM_LINEWIDTH]			= { 1, 2048 },
 };
 
 static const struct dss_param_range omap5_dss_param_range[] = {
 	[FEAT_PARAM_DSS_FCK]			= { 0, 209250000 },
-	[FEAT_PARAM_DSS_PCD]			= { 1, 255 },
-	[FEAT_PARAM_DOWNSCALE]			= { 1, 4 },
-	[FEAT_PARAM_LINEWIDTH]			= { 1, 2048 },
 };
 
 /* OMAP2 DSS Features */
diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.h b/drivers/gpu/drm/omapdrm/dss/dss_features.h
index 289c5dc1ef09..b1179fb25866 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss_features.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss_features.h
@@ -27,9 +27,6 @@
 
 enum dss_range_param {
 	FEAT_PARAM_DSS_FCK,
-	FEAT_PARAM_DSS_PCD,
-	FEAT_PARAM_DOWNSCALE,
-	FEAT_PARAM_LINEWIDTH,
 };
 
 /* DSS Feature Functions */
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-08-04 22:44 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 22:43 [PATCH v3 00/35] omapdrm: Deconstruct DSS features Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 01/35] ARM: OMAP2+: Register SoC device attributes from machine .init() Laurent Pinchart
2017-08-09 12:56   ` Tomi Valkeinen
2017-08-09 21:49     ` Tony Lindgren
2017-08-04 22:43 ` [PATCH v3 02/35] drm: omapdrm: acx565akm: Remove unneeded check for OF node Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 03/35] drm: omapdrm: connector-analog-tv: " Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 04/35] drm: omapdrm: panel-dpi: " Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 05/35] drm: omapdrm: dpi: Remove unneeded regulator check Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 06/35] drm: omapdrm: venc: Don't export omap_dss_pal_vm and omap_dss_ntsc_vm Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 07/35] drm: omapdrm: hdmi: Store PHY features in PHY data structure Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 08/35] drm: omapdrm: dss: Split operations out of dss_features structure Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 09/35] drm: omapdrm: dsi: Handle pin muxing internally Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 10/35] drm: omapdrm: Don't forward set_min_bus_tput() to no-op platform code Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 11/35] drm: omapdrm: dispc: Select features based on compatible string Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 12/35] drm: omapdrm: dpi: Replace OMAP SoC model checks with DSS model Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 13/35] drm: omapdrm: dsi: Store DSI model and PLL hardware data in OF data Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 14/35] drm: omapdrm: dss: Select features based on compatible string Laurent Pinchart
2017-08-04 22:43 ` [PATCH v3 15/35] drm: omapdrm: dss: Use supported outputs instead of display types Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 16/35] drm: omapdrm: dss: Initialize DSS internal features at probe time Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 17/35] drm: omapdrm: Move all debugfs code from core to dss Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 18/35] drm: omapdrm: Move shutdown() handler " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 19/35] drm: omapdrm: Move size unit features to dispc_features structure Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 20/35] drm: omapdrm: Move color modes feature " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 21/35] drm: omapdrm: Move overlay caps features " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 22/35] drm: omapdrm: Move num_ovls and num_mgrs " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 23/35] drm: omapdrm: Move DISPC_CLK_SWITCH reg feature to struct dss_features Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 24/35] drm: omapdrm: Move reg_fields to dispc_features structure Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 25/35] drm: omapdrm: Move FEAT_VENC_REQUIRES_TV_DAC_CLK to venc driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 26/35] drm: omapdrm: Move FEAT_DSI_* features to dsi driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 27/35] drm: omapdrm: Move FEAT_HDMI_* features to hdmi4 driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 28/35] drm: omapdrm: Move FEAT_DPI_USES_VDDS_DSI feature to dpi code Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 29/35] drm: omapdrm: Move FEAT_LCD_CLK_SRC feature to dss_features structure Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 30/35] drm: omapdrm: Move FEAT_* features to dispc driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 31/35] drm: omapdrm: Move FEAT_PARAM_DSI* features to dsi driver Laurent Pinchart
2017-08-04 22:44 ` Laurent Pinchart [this message]
2017-08-04 22:44 ` [PATCH v3 33/35] drm: omapdrm: Move DSS_FCK feature to dss driver Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 34/35] drm: omapdrm: Move supported outputs " Laurent Pinchart
2017-08-04 22:44 ` [PATCH v3 35/35] drm: omapdrm: Remove dss_features.h Laurent Pinchart
2017-08-04 22:49 ` [PATCH v3 00/35] omapdrm: Deconstruct DSS features Laurent Pinchart
2017-08-08 12:56 ` Tomi Valkeinen
2017-08-08 13:02   ` Laurent Pinchart
2017-08-08 13:04     ` Tomi Valkeinen
2017-08-08 13:15       ` Laurent Pinchart

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=20170804224419.30758-33-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.