[PATCH] drm: Remove unused fields from drm_display_mode

Adam Jackson ajax at redhat.com
Wed Jun 6 11:10:57 PDT 2012


% size drivers/gpu/drm/drm.o*
   text	   data	    bss	    dec	    hex	filename
 187371	   8299	    336	 196006	  2fda6	drivers/gpu/drm/drm.o
 191251	   8299	    336	 199886	  30cce	drivers/gpu/drm/drm.o.orig

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 drivers/gpu/drm/drm_crtc.c                    |    3 +--
 drivers/gpu/drm/drm_crtc_helper.c             |    2 --
 drivers/gpu/drm/drm_edid.c                    |    2 +-
 drivers/gpu/drm/drm_fb_helper.c               |    2 +-
 drivers/gpu/drm/drm_modes.c                   |   16 +++-------------
 drivers/gpu/drm/exynos/exynos_drm_connector.c |    1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c      |    2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c          |    4 ++--
 drivers/gpu/drm/gma500/psb_drv.c              |    1 -
 drivers/gpu/drm/i2c/ch7006_mode.c             |    1 -
 drivers/gpu/drm/nouveau/nouveau_connector.c   |    5 ++---
 drivers/gpu/drm/nouveau/nv04_crtc.c           |    3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c           |    2 --
 include/drm/drm_crtc.h                        |   10 +---------
 14 files changed, 15 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 08a7aa7..f367dc9 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1080,7 +1080,7 @@ static void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,
 	out->vsync_end = in->vsync_end;
 	out->vtotal = in->vtotal;
 	out->vscan = in->vscan;
-	out->vrefresh = in->vrefresh;
+	out->vrefresh = drm_mode_vrefresh(in);
 	out->flags = in->flags;
 	out->type = in->type;
 	strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
@@ -1118,7 +1118,6 @@ static int drm_crtc_convert_umode(struct drm_display_mode *out,
 	out->vsync_end = in->vsync_end;
 	out->vtotal = in->vtotal;
 	out->vscan = in->vscan;
-	out->vrefresh = in->vrefresh;
 	out->flags = in->flags;
 	out->type = in->type;
 	strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3252e70..089a838 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -159,8 +159,6 @@ prune:
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
 			drm_get_connector_name(connector));
 	list_for_each_entry(mode, &connector->modes, head) {
-		mode->vrefresh = drm_mode_vrefresh(mode);
-
 		drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 		drm_mode_debug_printmodeline(mode);
 	}
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5ab377f..0858757 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -450,7 +450,7 @@ static u32 edid_get_quirks(struct edid *edid)
 }
 
 #define MODE_SIZE(m) ((m)->hdisplay * (m)->vdisplay)
-#define MODE_REFRESH_DIFF(m,r) (abs((m)->vrefresh - target_refresh))
+#define MODE_REFRESH_DIFF(m,r) (abs(drm_mode_vrefresh((m)) - target_refresh))
 
 /**
  * edid_fixup_preferred - set preferred modes based on quirk list
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 5683b7f..4bee062 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -980,7 +980,7 @@ static struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_conne
 			continue;
 
 		if (cmdline_mode->refresh_specified) {
-			if (mode->vrefresh != cmdline_mode->refresh)
+			if (drm_mode_vrefresh(mode) != cmdline_mode->refresh)
 				continue;
 		}
 
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 8df4ec8..f076062 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -49,9 +49,9 @@
  */
 void drm_mode_debug_printmodeline(struct drm_display_mode *mode)
 {
-	DRM_DEBUG_KMS("Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d %d "
+	DRM_DEBUG_KMS("Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d "
 			"0x%x 0x%x\n",
-		mode->base.id, mode->name, mode->vrefresh, mode->clock,
+		mode->base.id, mode->name, mode->clock,
 		mode->hdisplay, mode->hsync_start,
 		mode->hsync_end, mode->htotal,
 		mode->vdisplay, mode->vsync_start,
@@ -598,9 +598,6 @@ int drm_mode_hsync(const struct drm_display_mode *mode)
 {
 	unsigned int calc_val;
 
-	if (mode->hsync)
-		return mode->hsync;
-
 	if (mode->htotal < 0)
 		return 0;
 
@@ -621,8 +618,6 @@ EXPORT_SYMBOL(drm_mode_hsync);
  *
  * Return @mode's vrefresh rate in Hz or calculate it if necessary.
  *
- * FIXME: why is this needed?  shouldn't vrefresh be set already?
- *
  * RETURNS:
  * Vertical refresh rate. It will be the result of actual value plus 0.5.
  * If it is 70.288, it will return 70Hz.
@@ -633,9 +628,7 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
 	int refresh = 0;
 	unsigned int calc_val;
 
-	if (mode->vrefresh > 0)
-		refresh = mode->vrefresh;
-	else if (mode->htotal > 0 && mode->vtotal > 0) {
+	if (mode->htotal > 0 && mode->vtotal > 0) {
 		int vtotal;
 		vtotal = mode->vtotal;
 		/* work out vrefresh the value will be x1000 */
@@ -706,9 +699,6 @@ void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags)
 	p->crtc_vblank_end = max(p->crtc_vsync_end, p->crtc_vtotal);
 	p->crtc_hblank_start = min(p->crtc_hsync_start, p->crtc_hdisplay);
 	p->crtc_hblank_end = max(p->crtc_hsync_end, p->crtc_htotal);
-
-	p->crtc_hadjusted = false;
-	p->crtc_vadjusted = false;
 }
 EXPORT_SYMBOL(drm_mode_set_crtcinfo);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index bf791fa..e841087 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -51,7 +51,6 @@ convert_to_display_mode(struct drm_display_mode *mode,
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
 	mode->clock = timing->pixclock / 1000;
-	mode->vrefresh = timing->refresh;
 
 	mode->hdisplay = timing->xres;
 	mode->hsync_start = mode->hdisplay + timing->right_margin;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 4afb625..7289cf7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -120,7 +120,7 @@ int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay,
 	/* set drm mode data. */
 	overlay->mode_width = mode->hdisplay;
 	overlay->mode_height = mode->vdisplay;
-	overlay->refresh = mode->vrefresh;
+	overlay->refresh = drm_mode_vrefresh(mode);
 	overlay->scan_flag = mode->flags;
 
 	DRM_DEBUG_KMS("overlay : offset_x/y(%d,%d), width/height(%d,%d)",
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index a137e9e..293c37d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1223,7 +1223,7 @@ static int hdmi_v13_conf_index(struct drm_display_mode *mode)
 	for (i = 0; i < ARRAY_SIZE(hdmi_v13_confs); ++i)
 		if (hdmi_v13_confs[i].width == mode->hdisplay &&
 				hdmi_v13_confs[i].height == mode->vdisplay &&
-				hdmi_v13_confs[i].vrefresh == mode->vrefresh &&
+				hdmi_v13_confs[i].vrefresh == drm_mode_vrefresh(mode) &&
 				hdmi_v13_confs[i].interlace ==
 				((mode->flags & DRM_MODE_FLAG_INTERLACE) ?
 				 true : false))
@@ -1239,7 +1239,7 @@ static int hdmi_v14_conf_index(struct drm_display_mode *mode)
 	for (i = 0; i < ARRAY_SIZE(hdmi_confs); ++i)
 		if (hdmi_confs[i].width == mode->hdisplay &&
 				hdmi_confs[i].height == mode->vdisplay &&
-				hdmi_confs[i].vrefresh == mode->vrefresh &&
+				hdmi_confs[i].vrefresh == drm_mode_vrefresh(mode) &&
 				hdmi_confs[i].interlace ==
 				((mode->flags & DRM_MODE_FLAG_INTERLACE) ?
 				 true : false))
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index caba6e0..f2cbcef 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -505,7 +505,6 @@ static int psb_mode_operation_ioctl(struct drm_device *dev, void *data,
 			mode->vsync_end = umode->vsync_end;
 			mode->vtotal = umode->vtotal;
 			mode->vscan = umode->vscan;
-			mode->vrefresh = umode->vrefresh;
 			mode->flags = umode->flags;
 			mode->type = umode->type;
 			strncpy(mode->name, umode->name, DRM_DISPLAY_MODE_LEN);
diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c
index c860f24..48f8ede 100644
--- a/drivers/gpu/drm/i2c/ch7006_mode.c
+++ b/drivers/gpu/drm/i2c/ch7006_mode.c
@@ -121,7 +121,6 @@ struct ch7006_tv_norm_info ch7006_tv_norms[] = {
 			.vscan = 0,					\
 			.flags = DRM_MODE_FLAG_##hsynp##HSYNC |		\
 				DRM_MODE_FLAG_##vsynp##VSYNC,		\
-			.vrefresh = 0,					\
 		},							\
 		.enc_hdisp = e_hd,					\
 		.enc_vdisp = e_vd,					\
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 7b11edb..d6f99dd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -549,7 +549,6 @@ nouveau_connector_native_mode(struct drm_connector *connector)
 	int high_w = 0, high_h = 0, high_v = 0;
 
 	list_for_each_entry(mode, &nv_connector->base.probed_modes, head) {
-		mode->vrefresh = drm_mode_vrefresh(mode);
 		if (helper->mode_valid(connector, mode) != MODE_OK ||
 		    (mode->flags & DRM_MODE_FLAG_INTERLACE))
 			continue;
@@ -570,12 +569,12 @@ nouveau_connector_native_mode(struct drm_connector *connector)
 			continue;
 
 		if (mode->hdisplay == high_w && mode->vdisplay == high_h &&
-		    mode->vrefresh < high_v)
+		    drm_mode_vrefresh(mode) < high_v)
 			continue;
 
 		high_w = mode->hdisplay;
 		high_h = mode->vdisplay;
-		high_v = mode->vrefresh;
+		high_v = drm_mode_vrefresh(mode);
 		largest = mode;
 	}
 
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c
index 4c31c63..387efb6 100644
--- a/drivers/gpu/drm/nouveau/nv04_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv04_crtc.c
@@ -315,7 +315,10 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode)
 			regp->MiscOutReg = 0x23;	/* +hsync +vsync */
 	}
 
+#if 0
+	/* XXX ->clock_index doesn't exist anymore, was always 0 anyway */
 	regp->MiscOutReg |= (mode->clock_index & 0x03) << 2;
+#endif
 
 	/*
 	 * Time Sequencer
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 6b0078f..be63692 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1893,7 +1893,6 @@ static void vmw_guess_mode_timing(struct drm_display_mode *mode)
 	mode->vtotal = mode->vsync_end + 50;
 
 	mode->clock = (u32)mode->htotal * (u32)mode->vtotal / 100 * 6;
-	mode->vrefresh = drm_mode_vrefresh(mode);
 }
 
 
@@ -1951,7 +1950,6 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
 		mode = drm_mode_duplicate(dev, bmode);
 		if (!mode)
 			return 0;
-		mode->vrefresh = drm_mode_vrefresh(mode);
 
 		drm_mode_probed_add(connector, mode);
 	}
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index d672cf4..d5cf54d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -118,7 +118,7 @@ enum drm_mode_status {
 	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
 	.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
 	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
-	.vscan = (vs), .flags = (f), .vrefresh = 0
+	.vscan = (vs), .flags = (f)
 
 #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
 
@@ -151,8 +151,6 @@ struct drm_display_mode {
 	int height_mm;
 
 	/* Actual mode we give to hw */
-	int clock_index;
-	int synth_clock;
 	int crtc_hdisplay;
 	int crtc_hblank_start;
 	int crtc_hblank_end;
@@ -166,16 +164,10 @@ struct drm_display_mode {
 	int crtc_vsync_start;
 	int crtc_vsync_end;
 	int crtc_vtotal;
-	int crtc_hadjusted;
-	int crtc_vadjusted;
 
 	/* Driver private mode info */
-	int private_size;
 	int *private;
 	int private_flags;
-
-	int vrefresh;		/* in Hz */
-	int hsync;		/* in kHz */
 };
 
 enum drm_connector_status {
-- 
1.7.7.6



More information about the dri-devel mailing list