diff mbox

[RFC,07/37] drm: sti: Use crtc->hwmode for adjusted mode

Message ID 1426739616-10635-7-git-send-email-daniels@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Stone March 19, 2015, 4:33 a.m. UTC
crtc->hwmode contains the adjusted_mode from mode_set; no reason to
overwrite crtc->mode (the user-specified mode) with this anymore. This
mode can also be const, since we don't modify it anywhere.

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 drivers/gpu/drm/sti/sti_cursor.c    |  4 ++--
 drivers/gpu/drm/sti/sti_drm_crtc.c  | 11 +++--------
 drivers/gpu/drm/sti/sti_drm_plane.c |  2 +-
 drivers/gpu/drm/sti/sti_gdp.c       |  2 +-
 drivers/gpu/drm/sti/sti_layer.c     |  2 +-
 drivers/gpu/drm/sti/sti_layer.h     |  4 ++--
 drivers/gpu/drm/sti/sti_mixer.c     |  4 ++--
 drivers/gpu/drm/sti/sti_mixer.h     |  2 +-
 drivers/gpu/drm/sti/sti_vid.c       |  2 +-
 9 files changed, 14 insertions(+), 19 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 010eaee..998b13c 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -99,7 +99,7 @@  static void sti_cursor_argb8888_to_clut8(struct sti_layer *layer)
 static int sti_cursor_prepare_layer(struct sti_layer *layer, bool first_prepare)
 {
 	struct sti_cursor *cursor = to_sti_cursor(layer);
-	struct drm_display_mode *mode = layer->mode;
+	const struct drm_display_mode *mode = layer->mode;
 	u32 y, x;
 	u32 val;
 
@@ -166,7 +166,7 @@  static int sti_cursor_prepare_layer(struct sti_layer *layer, bool first_prepare)
 static int sti_cursor_commit_layer(struct sti_layer *layer)
 {
 	struct sti_cursor *cursor = to_sti_cursor(layer);
-	struct drm_display_mode *mode = layer->mode;
+	const struct drm_display_mode *mode = layer->mode;
 	u32 ydo, xdo;
 
 	dev_dbg(layer->dev, "%s %s\n", __func__, sti_layer_to_str(layer));
diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c b/drivers/gpu/drm/sti/sti_drm_crtc.c
index e6f6ef7..4721e91 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.c
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.c
@@ -129,17 +129,12 @@  sti_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 		return -EINVAL;
 	}
 
-	/* copy the mode data adjusted by mode_fixup() into crtc->mode
-	 * so that hardware can be set to proper mode
-	 */
-	memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
-
 	res = sti_mixer_set_layer_depth(mixer, layer);
 	if (res) {
 		DRM_ERROR("Can not set layer depth\n");
 		return -EINVAL;
 	}
-	res = sti_mixer_active_video_area(mixer, &crtc->mode);
+	res = sti_mixer_active_video_area(mixer, adjusted_mode);
 	if (res) {
 		DRM_ERROR("Can not set active video area\n");
 		return -EINVAL;
@@ -149,7 +144,7 @@  sti_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	h = crtc->primary->fb->height - y;
 
 	return sti_layer_prepare(layer, crtc,
-			crtc->primary->fb, &crtc->mode,
+			crtc->primary->fb, adjusted_mode,
 			mixer->id, 0, 0, w, h, x, y, w, h);
 }
 
@@ -177,7 +172,7 @@  static int sti_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
 	h = crtc->primary->fb->height - crtc->y;
 
 	ret = sti_layer_prepare(layer, crtc,
-				crtc->primary->fb, &crtc->mode,
+				crtc->primary->fb, &crtc->hwmode,
 				mixer->id, 0, 0, w, h,
 				crtc->x, crtc->y, w, h);
 	if (ret) {
diff --git a/drivers/gpu/drm/sti/sti_drm_plane.c b/drivers/gpu/drm/sti/sti_drm_plane.c
index bb6a293..42edba3 100644
--- a/drivers/gpu/drm/sti/sti_drm_plane.c
+++ b/drivers/gpu/drm/sti/sti_drm_plane.c
@@ -46,7 +46,7 @@  sti_drm_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	/* src_x are in 16.16 format. */
 	res = sti_layer_prepare(layer, crtc, fb,
-			&crtc->mode, mixer->id,
+			&crtc->hwmode, mixer->id,
 			crtc_x, crtc_y, crtc_w, crtc_h,
 			src_x >> 16, src_y >> 16,
 			src_w >> 16, src_h >> 16);
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 087906f..af81e8a 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -251,7 +251,7 @@  static int sti_gdp_prepare_layer(struct sti_layer *layer, bool first_prepare)
 {
 	struct sti_gdp_node_list *list;
 	struct sti_gdp_node *top_field, *btm_field;
-	struct drm_display_mode *mode = layer->mode;
+	const struct drm_display_mode *mode = layer->mode;
 	struct device *dev = layer->dev;
 	struct sti_gdp *gdp = to_sti_gdp(layer);
 	struct sti_compositor *compo = dev_get_drvdata(dev);
diff --git a/drivers/gpu/drm/sti/sti_layer.c b/drivers/gpu/drm/sti/sti_layer.c
index 899104f..f514989 100644
--- a/drivers/gpu/drm/sti/sti_layer.c
+++ b/drivers/gpu/drm/sti/sti_layer.c
@@ -83,7 +83,7 @@  EXPORT_SYMBOL(sti_layer_create);
 int sti_layer_prepare(struct sti_layer *layer,
 		      struct drm_crtc *crtc,
 		      struct drm_framebuffer *fb,
-		      struct drm_display_mode *mode, int mixer_id,
+		      const struct drm_display_mode *mode, int mixer_id,
 		      int dest_x, int dest_y, int dest_w, int dest_h,
 		      int src_x, int src_y, int src_w, int src_h)
 {
diff --git a/drivers/gpu/drm/sti/sti_layer.h b/drivers/gpu/drm/sti/sti_layer.h
index ceff497..50dd638 100644
--- a/drivers/gpu/drm/sti/sti_layer.h
+++ b/drivers/gpu/drm/sti/sti_layer.h
@@ -92,7 +92,7 @@  struct sti_layer {
 	struct drm_plane plane;
 	struct drm_framebuffer *fb;
 	struct drm_crtc *crtc;
-	struct drm_display_mode *mode;
+	const struct drm_display_mode *mode;
 	enum sti_layer_desc desc;
 	struct device *dev;
 	void __iomem *regs;
@@ -116,7 +116,7 @@  struct sti_layer *sti_layer_create(struct device *dev, int desc,
 int sti_layer_prepare(struct sti_layer *layer,
 			struct drm_crtc *crtc,
 			struct drm_framebuffer *fb,
-			struct drm_display_mode *mode,
+			const struct drm_display_mode *mode,
 			int mixer_id,
 			int dest_x, int dest_y,
 			int dest_w, int dest_h,
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 13a4b84..45aa842 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -88,7 +88,7 @@  static void sti_mixer_set_background_color(struct sti_mixer *mixer,
 }
 
 static void sti_mixer_set_background_area(struct sti_mixer *mixer,
-					  struct drm_display_mode *mode)
+					  const struct drm_display_mode *mode)
 {
 	u32 ydo, xdo, yds, xds;
 
@@ -155,7 +155,7 @@  int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer)
 }
 
 int sti_mixer_active_video_area(struct sti_mixer *mixer,
-				struct drm_display_mode *mode)
+				const struct drm_display_mode *mode)
 {
 	u32 ydo, xdo, yds, xds;
 
diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
index b972821..239f2a4 100644
--- a/drivers/gpu/drm/sti/sti_mixer.h
+++ b/drivers/gpu/drm/sti/sti_mixer.h
@@ -44,7 +44,7 @@  int sti_mixer_set_layer_status(struct sti_mixer *mixer,
 void sti_mixer_clear_all_layers(struct sti_mixer *mixer);
 int sti_mixer_set_layer_depth(struct sti_mixer *mixer, struct sti_layer *layer);
 int sti_mixer_active_video_area(struct sti_mixer *mixer,
-		struct drm_display_mode *mode);
+		const struct drm_display_mode *mode);
 
 void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
 
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 10ced6a..5add4a7 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -57,7 +57,7 @@  static int sti_vid_prepare_layer(struct sti_layer *vid, bool first_prepare)
 
 static int sti_vid_commit_layer(struct sti_layer *vid)
 {
-	struct drm_display_mode *mode = vid->mode;
+	const struct drm_display_mode *mode = vid->mode;
 	u32 ydo, xdo, yds, xds;
 
 	ydo = sti_vtg_get_line_number(*mode, vid->dst_y);