diff options
author | Patrik Jakobsson <patrik.r.jakobsson@gmail.com> | 2013-07-10 12:37:03 -0400 |
---|---|---|
committer | Patrik Jakobsson <patrik.r.jakobsson@gmail.com> | 2013-07-23 19:47:23 -0400 |
commit | 00b1fe7445d8a3cd81ba564fba5d15dcbe26f23b (patch) | |
tree | bd7fd0c3324bdd90d9c6ccda98b44c0470f74392 | |
parent | a1f4efe4416dbd8d58486e60752f3a8145aa84c9 (diff) |
drm/gma500/psb: Convert to gma_pipe_set_base()
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
-rw-r--r-- | drivers/gpu/drm/gma500/psb_intel_display.c | 73 |
1 files changed, 1 insertions, 72 deletions
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c index 0642e7d37fa8..ca041c6aba4a 100644 --- a/drivers/gpu/drm/gma500/psb_intel_display.c +++ b/drivers/gpu/drm/gma500/psb_intel_display.c | |||
@@ -82,77 +82,6 @@ static void psb_intel_clock(int refclk, struct gma_clock_t *clock) | |||
82 | clock->dot = clock->vco / clock->p; | 82 | clock->dot = clock->vco / clock->p; |
83 | } | 83 | } |
84 | 84 | ||
85 | static int psb_intel_pipe_set_base(struct drm_crtc *crtc, | ||
86 | int x, int y, struct drm_framebuffer *old_fb) | ||
87 | { | ||
88 | struct drm_device *dev = crtc->dev; | ||
89 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
90 | struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); | ||
91 | struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); | ||
92 | int pipe = psb_intel_crtc->pipe; | ||
93 | const struct psb_offset *map = &dev_priv->regmap[pipe]; | ||
94 | unsigned long start, offset; | ||
95 | u32 dspcntr; | ||
96 | int ret = 0; | ||
97 | |||
98 | if (!gma_power_begin(dev, true)) | ||
99 | return 0; | ||
100 | |||
101 | /* no fb bound */ | ||
102 | if (!crtc->fb) { | ||
103 | dev_dbg(dev->dev, "No FB bound\n"); | ||
104 | goto psb_intel_pipe_cleaner; | ||
105 | } | ||
106 | |||
107 | /* We are displaying this buffer, make sure it is actually loaded | ||
108 | into the GTT */ | ||
109 | ret = psb_gtt_pin(psbfb->gtt); | ||
110 | if (ret < 0) | ||
111 | goto psb_intel_pipe_set_base_exit; | ||
112 | start = psbfb->gtt->offset; | ||
113 | |||
114 | offset = y * crtc->fb->pitches[0] + x * (crtc->fb->bits_per_pixel / 8); | ||
115 | |||
116 | REG_WRITE(map->stride, crtc->fb->pitches[0]); | ||
117 | |||
118 | dspcntr = REG_READ(map->cntr); | ||
119 | dspcntr &= ~DISPPLANE_PIXFORMAT_MASK; | ||
120 | |||
121 | switch (crtc->fb->bits_per_pixel) { | ||
122 | case 8: | ||
123 | dspcntr |= DISPPLANE_8BPP; | ||
124 | break; | ||
125 | case 16: | ||
126 | if (crtc->fb->depth == 15) | ||
127 | dspcntr |= DISPPLANE_15_16BPP; | ||
128 | else | ||
129 | dspcntr |= DISPPLANE_16BPP; | ||
130 | break; | ||
131 | case 24: | ||
132 | case 32: | ||
133 | dspcntr |= DISPPLANE_32BPP_NO_ALPHA; | ||
134 | break; | ||
135 | default: | ||
136 | dev_err(dev->dev, "Unknown color depth\n"); | ||
137 | ret = -EINVAL; | ||
138 | psb_gtt_unpin(psbfb->gtt); | ||
139 | goto psb_intel_pipe_set_base_exit; | ||
140 | } | ||
141 | REG_WRITE(map->cntr, dspcntr); | ||
142 | |||
143 | REG_WRITE(map->base, start + offset); | ||
144 | REG_READ(map->base); | ||
145 | |||
146 | psb_intel_pipe_cleaner: | ||
147 | /* If there was a previous display we can now unpin it */ | ||
148 | if (old_fb) | ||
149 | psb_gtt_unpin(to_psb_fb(old_fb)->gtt); | ||
150 | |||
151 | psb_intel_pipe_set_base_exit: | ||
152 | gma_power_end(dev); | ||
153 | return ret; | ||
154 | } | ||
155 | |||
156 | /** | 85 | /** |
157 | * Sets the power management mode of the pipe and plane. | 86 | * Sets the power management mode of the pipe and plane. |
158 | * | 87 | * |
@@ -990,7 +919,7 @@ const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { | |||
990 | .dpms = psb_intel_crtc_dpms, | 919 | .dpms = psb_intel_crtc_dpms, |
991 | .mode_fixup = gma_crtc_mode_fixup, | 920 | .mode_fixup = gma_crtc_mode_fixup, |
992 | .mode_set = psb_intel_crtc_mode_set, | 921 | .mode_set = psb_intel_crtc_mode_set, |
993 | .mode_set_base = psb_intel_pipe_set_base, | 922 | .mode_set_base = gma_pipe_set_base, |
994 | .prepare = gma_crtc_prepare, | 923 | .prepare = gma_crtc_prepare, |
995 | .commit = gma_crtc_commit, | 924 | .commit = gma_crtc_commit, |
996 | .disable = gma_crtc_disable, | 925 | .disable = gma_crtc_disable, |