aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-09 10:44:14 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-09 12:00:36 -0400
commitf875c15a4fbf37534dda30771d8bde8604fbbf09 (patch)
tree6c90c65af1198bf1c9a2120e4480837b59a115be /drivers/gpu
parent4ef69c7a64b78d477d1666eba258ca049e8bac91 (diff)
drm/i915: Use the direct mapping of pipe->crtc
Why iterate all the crtcs to find the pipe, when we already know which crtc is attached to which pipe? Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c12
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h8
-rw-r--r--drivers/gpu/drm/i915/intel_dvo.c2
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c2
4 files changed, 9 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 24c7b0e4fdf..7e67bf534f8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5226,18 +5226,6 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
5226 return 0; 5226 return 0;
5227} 5227}
5228 5228
5229struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe)
5230{
5231 struct drm_crtc *crtc = NULL;
5232
5233 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
5234 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5235 if (intel_crtc->pipe == pipe)
5236 break;
5237 }
5238 return crtc;
5239}
5240
5241static int intel_encoder_clones(struct drm_device *dev, int type_mask) 5229static int intel_encoder_clones(struct drm_device *dev, int type_mask)
5242{ 5230{
5243 struct intel_encoder *encoder; 5231 struct intel_encoder *encoder;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 454bcf3933c..ba94944e4eb 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -177,6 +177,13 @@ struct intel_crtc {
177#define to_intel_encoder(x) container_of(x, struct intel_encoder, base) 177#define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
178#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) 178#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
179 179
180static inline struct drm_crtc *
181intel_get_crtc_for_pipe(struct drm_device *dev, int pipe)
182{
183 struct drm_i915_private *dev_priv = dev->dev_private;
184 return dev_priv->pipe_to_crtc_mapping[pipe];
185}
186
180struct intel_unpin_work { 187struct intel_unpin_work {
181 struct work_struct work; 188 struct work_struct work;
182 struct drm_device *dev; 189 struct drm_device *dev;
@@ -235,7 +242,6 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
235 struct drm_file *file_priv); 242 struct drm_file *file_priv);
236extern void intel_wait_for_vblank_off(struct drm_device *dev, int pipe); 243extern void intel_wait_for_vblank_off(struct drm_device *dev, int pipe);
237extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); 244extern void intel_wait_for_vblank(struct drm_device *dev, int pipe);
238extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
239extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, 245extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
240 struct drm_connector *connector, 246 struct drm_connector *connector,
241 struct drm_display_mode *mode, 247 struct drm_display_mode *mode,
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 7bf7311deb2..b15c9da215d 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -322,7 +322,7 @@ intel_dvo_get_current_mode(struct drm_connector *connector)
322 struct drm_crtc *crtc; 322 struct drm_crtc *crtc;
323 int pipe = (dvo_val & DVO_PIPE_B_SELECT) ? 1 : 0; 323 int pipe = (dvo_val & DVO_PIPE_B_SELECT) ? 1 : 0;
324 324
325 crtc = intel_get_crtc_from_pipe(dev, pipe); 325 crtc = intel_get_crtc_for_pipe(dev, pipe);
326 if (crtc) { 326 if (crtc) {
327 mode = intel_crtc_mode_get(dev, crtc); 327 mode = intel_crtc_mode_get(dev, crtc);
328 if (mode) { 328 if (mode) {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index ed1c8763681..987973f4ff7 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -932,7 +932,7 @@ void intel_lvds_init(struct drm_device *dev)
932 932
933 lvds = I915_READ(LVDS); 933 lvds = I915_READ(LVDS);
934 pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0; 934 pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
935 crtc = intel_get_crtc_from_pipe(dev, pipe); 935 crtc = intel_get_crtc_for_pipe(dev, pipe);
936 936
937 if (crtc && (lvds & LVDS_PORT_EN)) { 937 if (crtc && (lvds & LVDS_PORT_EN)) {
938 dev_priv->panel_fixed_mode = intel_crtc_mode_get(dev, crtc); 938 dev_priv->panel_fixed_mode = intel_crtc_mode_get(dev, crtc);