drm/i915: Use macros to switch between equivalent pipe registers

The purpose is to make the code much easier to read and therefore reduce
the possibility for bugs.

A side effect is that it also makes it much easier for the compiler,
reducing the object size by 4k -- from just a few functions!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2010-09-11 13:48:45 +01:00
parent 4ed765f966
commit 5eddb70ba2
5 changed files with 508 additions and 547 deletions

View File

@ -255,7 +255,7 @@ i830_activate_pipe_a(struct drm_device *dev)
return 0;
/* most i8xx have pipe a forced on, so don't trust dpms mode */
if (I915_READ(PIPEACONF) & PIPEACONF_ENABLE)
if (I915_READ(PIPEACONF) & PIPECONF_ENABLE)
return 0;
crtc_funcs = crtc->base.helper_private;
@ -876,15 +876,14 @@ static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
{
drm_i915_private_t *dev_priv = overlay->dev->dev_private;
u32 pipeconf;
int pipeconf_reg = (crtc->pipe == 0) ? PIPEACONF : PIPEBCONF;
if (!crtc->base.enabled || crtc->dpms_mode != DRM_MODE_DPMS_ON)
return -EINVAL;
pipeconf = I915_READ(pipeconf_reg);
pipeconf = I915_READ(PIPECONF(crtc->pipe));
/* can't use the overlay with double wide pipe */
if (!IS_I965G(overlay->dev) && pipeconf & PIPEACONF_DOUBLE_WIDE)
if (!IS_I965G(overlay->dev) && pipeconf & PIPECONF_DOUBLE_WIDE)
return -EINVAL;
return 0;