diff options
Diffstat (limited to 'drivers/gpu/drm')
74 files changed, 683 insertions, 480 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 396e60ce8114..f8625e290728 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -140,7 +140,7 @@ int drm_gem_object_init(struct drm_device *dev, | |||
140 | obj->dev = dev; | 140 | obj->dev = dev; |
141 | obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE); | 141 | obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE); |
142 | if (IS_ERR(obj->filp)) | 142 | if (IS_ERR(obj->filp)) |
143 | return -ENOMEM; | 143 | return PTR_ERR(obj->filp); |
144 | 144 | ||
145 | kref_init(&obj->refcount); | 145 | kref_init(&obj->refcount); |
146 | atomic_set(&obj->handle_count, 0); | 146 | atomic_set(&obj->handle_count, 0); |
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index ddd70db45f76..637fcc3766c7 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -315,7 +315,8 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd, | |||
315 | if (err) | 315 | if (err) |
316 | return err; | 316 | return err; |
317 | 317 | ||
318 | if (__get_user(c32.auth, &client->auth) | 318 | if (__get_user(c32.idx, &client->idx) |
319 | || __get_user(c32.auth, &client->auth) | ||
319 | || __get_user(c32.pid, &client->pid) | 320 | || __get_user(c32.pid, &client->pid) |
320 | || __get_user(c32.uid, &client->uid) | 321 | || __get_user(c32.uid, &client->uid) |
321 | || __get_user(c32.magic, &client->magic) | 322 | || __get_user(c32.magic, &client->magic) |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index f9aaa56eae07..b9e5266c341b 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
@@ -13,7 +13,7 @@ config DRM_EXYNOS | |||
13 | 13 | ||
14 | config DRM_EXYNOS_FIMD | 14 | config DRM_EXYNOS_FIMD |
15 | tristate "Exynos DRM FIMD" | 15 | tristate "Exynos DRM FIMD" |
16 | depends on DRM_EXYNOS | 16 | depends on DRM_EXYNOS && !FB_S3C |
17 | default n | 17 | default n |
18 | help | 18 | help |
19 | Choose this option if you want to use Exynos FIMD for DRM. | 19 | Choose this option if you want to use Exynos FIMD for DRM. |
@@ -21,7 +21,7 @@ config DRM_EXYNOS_FIMD | |||
21 | 21 | ||
22 | config DRM_EXYNOS_HDMI | 22 | config DRM_EXYNOS_HDMI |
23 | tristate "Exynos DRM HDMI" | 23 | tristate "Exynos DRM HDMI" |
24 | depends on DRM_EXYNOS | 24 | depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_TV |
25 | help | 25 | help |
26 | Choose this option if you want to use Exynos HDMI for DRM. | 26 | Choose this option if you want to use Exynos HDMI for DRM. |
27 | If M is selected, the module will be called exynos_drm_hdmi | 27 | If M is selected, the module will be called exynos_drm_hdmi |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index d620b0784257..618bd4d87d28 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "drmP.h" | 28 | #include "drmP.h" |
29 | #include "drm_crtc_helper.h" | 29 | #include "drm_crtc_helper.h" |
30 | 30 | ||
31 | #include <drm/exynos_drm.h> | ||
31 | #include "exynos_drm_drv.h" | 32 | #include "exynos_drm_drv.h" |
32 | #include "exynos_drm_encoder.h" | 33 | #include "exynos_drm_encoder.h" |
33 | 34 | ||
@@ -44,8 +45,9 @@ struct exynos_drm_connector { | |||
44 | /* convert exynos_video_timings to drm_display_mode */ | 45 | /* convert exynos_video_timings to drm_display_mode */ |
45 | static inline void | 46 | static inline void |
46 | convert_to_display_mode(struct drm_display_mode *mode, | 47 | convert_to_display_mode(struct drm_display_mode *mode, |
47 | struct fb_videomode *timing) | 48 | struct exynos_drm_panel_info *panel) |
48 | { | 49 | { |
50 | struct fb_videomode *timing = &panel->timing; | ||
49 | DRM_DEBUG_KMS("%s\n", __FILE__); | 51 | DRM_DEBUG_KMS("%s\n", __FILE__); |
50 | 52 | ||
51 | mode->clock = timing->pixclock / 1000; | 53 | mode->clock = timing->pixclock / 1000; |
@@ -60,6 +62,8 @@ convert_to_display_mode(struct drm_display_mode *mode, | |||
60 | mode->vsync_start = mode->vdisplay + timing->upper_margin; | 62 | mode->vsync_start = mode->vdisplay + timing->upper_margin; |
61 | mode->vsync_end = mode->vsync_start + timing->vsync_len; | 63 | mode->vsync_end = mode->vsync_start + timing->vsync_len; |
62 | mode->vtotal = mode->vsync_end + timing->lower_margin; | 64 | mode->vtotal = mode->vsync_end + timing->lower_margin; |
65 | mode->width_mm = panel->width_mm; | ||
66 | mode->height_mm = panel->height_mm; | ||
63 | 67 | ||
64 | if (timing->vmode & FB_VMODE_INTERLACED) | 68 | if (timing->vmode & FB_VMODE_INTERLACED) |
65 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | 69 | mode->flags |= DRM_MODE_FLAG_INTERLACE; |
@@ -148,16 +152,18 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
148 | connector->display_info.raw_edid = edid; | 152 | connector->display_info.raw_edid = edid; |
149 | } else { | 153 | } else { |
150 | struct drm_display_mode *mode = drm_mode_create(connector->dev); | 154 | struct drm_display_mode *mode = drm_mode_create(connector->dev); |
151 | struct fb_videomode *timing; | 155 | struct exynos_drm_panel_info *panel; |
152 | 156 | ||
153 | if (display_ops->get_timing) | 157 | if (display_ops->get_panel) |
154 | timing = display_ops->get_timing(manager->dev); | 158 | panel = display_ops->get_panel(manager->dev); |
155 | else { | 159 | else { |
156 | drm_mode_destroy(connector->dev, mode); | 160 | drm_mode_destroy(connector->dev, mode); |
157 | return 0; | 161 | return 0; |
158 | } | 162 | } |
159 | 163 | ||
160 | convert_to_display_mode(mode, timing); | 164 | convert_to_display_mode(mode, panel); |
165 | connector->display_info.width_mm = mode->width_mm; | ||
166 | connector->display_info.height_mm = mode->height_mm; | ||
161 | 167 | ||
162 | mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; | 168 | mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; |
163 | drm_mode_set_name(mode); | 169 | drm_mode_set_name(mode); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 661a03571d0c..d08a55896d50 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -193,6 +193,9 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv) | |||
193 | return err; | 193 | return err; |
194 | } | 194 | } |
195 | 195 | ||
196 | /* setup possible_clones. */ | ||
197 | exynos_drm_encoder_setup(drm_dev); | ||
198 | |||
196 | /* | 199 | /* |
197 | * if any specific driver such as fimd or hdmi driver called | 200 | * if any specific driver such as fimd or hdmi driver called |
198 | * exynos_drm_subdrv_register() later than drm_load(), | 201 | * exynos_drm_subdrv_register() later than drm_load(), |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index e3861ac49295..de818831a511 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -307,9 +307,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, | |||
307 | */ | 307 | */ |
308 | event->pipe = exynos_crtc->pipe; | 308 | event->pipe = exynos_crtc->pipe; |
309 | 309 | ||
310 | list_add_tail(&event->base.link, | ||
311 | &dev_priv->pageflip_event_list); | ||
312 | |||
313 | ret = drm_vblank_get(dev, exynos_crtc->pipe); | 310 | ret = drm_vblank_get(dev, exynos_crtc->pipe); |
314 | if (ret) { | 311 | if (ret) { |
315 | DRM_DEBUG("failed to acquire vblank counter\n"); | 312 | DRM_DEBUG("failed to acquire vblank counter\n"); |
@@ -318,6 +315,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, | |||
318 | goto out; | 315 | goto out; |
319 | } | 316 | } |
320 | 317 | ||
318 | list_add_tail(&event->base.link, | ||
319 | &dev_priv->pageflip_event_list); | ||
320 | |||
321 | crtc->fb = fb; | 321 | crtc->fb = fb; |
322 | ret = exynos_drm_crtc_update(crtc); | 322 | ret = exynos_drm_crtc_update(crtc); |
323 | if (ret) { | 323 | if (ret) { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 35889ca255e9..58820ebd3558 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include "exynos_drm_drv.h" | 34 | #include "exynos_drm_drv.h" |
35 | #include "exynos_drm_crtc.h" | 35 | #include "exynos_drm_crtc.h" |
36 | #include "exynos_drm_encoder.h" | ||
36 | #include "exynos_drm_fbdev.h" | 37 | #include "exynos_drm_fbdev.h" |
37 | #include "exynos_drm_fb.h" | 38 | #include "exynos_drm_fb.h" |
38 | #include "exynos_drm_gem.h" | 39 | #include "exynos_drm_gem.h" |
@@ -99,6 +100,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
99 | if (ret) | 100 | if (ret) |
100 | goto err_vblank; | 101 | goto err_vblank; |
101 | 102 | ||
103 | /* setup possible_clones. */ | ||
104 | exynos_drm_encoder_setup(dev); | ||
105 | |||
102 | /* | 106 | /* |
103 | * create and configure fb helper and also exynos specific | 107 | * create and configure fb helper and also exynos specific |
104 | * fbdev object. | 108 | * fbdev object. |
@@ -141,16 +145,21 @@ static int exynos_drm_unload(struct drm_device *dev) | |||
141 | } | 145 | } |
142 | 146 | ||
143 | static void exynos_drm_preclose(struct drm_device *dev, | 147 | static void exynos_drm_preclose(struct drm_device *dev, |
144 | struct drm_file *file_priv) | 148 | struct drm_file *file) |
145 | { | 149 | { |
146 | struct exynos_drm_private *dev_priv = dev->dev_private; | 150 | DRM_DEBUG_DRIVER("%s\n", __FILE__); |
147 | 151 | ||
148 | /* | 152 | } |
149 | * drm framework frees all events at release time, | 153 | |
150 | * so private event list should be cleared. | 154 | static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) |
151 | */ | 155 | { |
152 | if (!list_empty(&dev_priv->pageflip_event_list)) | 156 | DRM_DEBUG_DRIVER("%s\n", __FILE__); |
153 | INIT_LIST_HEAD(&dev_priv->pageflip_event_list); | 157 | |
158 | if (!file->driver_priv) | ||
159 | return; | ||
160 | |||
161 | kfree(file->driver_priv); | ||
162 | file->driver_priv = NULL; | ||
154 | } | 163 | } |
155 | 164 | ||
156 | static void exynos_drm_lastclose(struct drm_device *dev) | 165 | static void exynos_drm_lastclose(struct drm_device *dev) |
@@ -195,6 +204,7 @@ static struct drm_driver exynos_drm_driver = { | |||
195 | .unload = exynos_drm_unload, | 204 | .unload = exynos_drm_unload, |
196 | .preclose = exynos_drm_preclose, | 205 | .preclose = exynos_drm_preclose, |
197 | .lastclose = exynos_drm_lastclose, | 206 | .lastclose = exynos_drm_lastclose, |
207 | .postclose = exynos_drm_postclose, | ||
198 | .get_vblank_counter = drm_vblank_count, | 208 | .get_vblank_counter = drm_vblank_count, |
199 | .enable_vblank = exynos_drm_crtc_enable_vblank, | 209 | .enable_vblank = exynos_drm_crtc_enable_vblank, |
200 | .disable_vblank = exynos_drm_crtc_disable_vblank, | 210 | .disable_vblank = exynos_drm_crtc_disable_vblank, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index e685e1e33055..13540de90bfc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -136,7 +136,7 @@ struct exynos_drm_overlay { | |||
136 | * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. | 136 | * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. |
137 | * @is_connected: check for that display is connected or not. | 137 | * @is_connected: check for that display is connected or not. |
138 | * @get_edid: get edid modes from display driver. | 138 | * @get_edid: get edid modes from display driver. |
139 | * @get_timing: get timing object from display driver. | 139 | * @get_panel: get panel object from display driver. |
140 | * @check_timing: check if timing is valid or not. | 140 | * @check_timing: check if timing is valid or not. |
141 | * @power_on: display device on or off. | 141 | * @power_on: display device on or off. |
142 | */ | 142 | */ |
@@ -145,7 +145,7 @@ struct exynos_drm_display_ops { | |||
145 | bool (*is_connected)(struct device *dev); | 145 | bool (*is_connected)(struct device *dev); |
146 | int (*get_edid)(struct device *dev, struct drm_connector *connector, | 146 | int (*get_edid)(struct device *dev, struct drm_connector *connector, |
147 | u8 *edid, int len); | 147 | u8 *edid, int len); |
148 | void *(*get_timing)(struct device *dev); | 148 | void *(*get_panel)(struct device *dev); |
149 | int (*check_timing)(struct device *dev, void *timing); | 149 | int (*check_timing)(struct device *dev, void *timing); |
150 | int (*power_on)(struct device *dev, int mode); | 150 | int (*power_on)(struct device *dev, int mode); |
151 | }; | 151 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 86b93dde219a..ef4754f1519b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
@@ -195,6 +195,40 @@ static struct drm_encoder_funcs exynos_encoder_funcs = { | |||
195 | .destroy = exynos_drm_encoder_destroy, | 195 | .destroy = exynos_drm_encoder_destroy, |
196 | }; | 196 | }; |
197 | 197 | ||
198 | static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder) | ||
199 | { | ||
200 | struct drm_encoder *clone; | ||
201 | struct drm_device *dev = encoder->dev; | ||
202 | struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); | ||
203 | struct exynos_drm_display_ops *display_ops = | ||
204 | exynos_encoder->manager->display_ops; | ||
205 | unsigned int clone_mask = 0; | ||
206 | int cnt = 0; | ||
207 | |||
208 | list_for_each_entry(clone, &dev->mode_config.encoder_list, head) { | ||
209 | switch (display_ops->type) { | ||
210 | case EXYNOS_DISPLAY_TYPE_LCD: | ||
211 | case EXYNOS_DISPLAY_TYPE_HDMI: | ||
212 | clone_mask |= (1 << (cnt++)); | ||
213 | break; | ||
214 | default: | ||
215 | continue; | ||
216 | } | ||
217 | } | ||
218 | |||
219 | return clone_mask; | ||
220 | } | ||
221 | |||
222 | void exynos_drm_encoder_setup(struct drm_device *dev) | ||
223 | { | ||
224 | struct drm_encoder *encoder; | ||
225 | |||
226 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
227 | |||
228 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) | ||
229 | encoder->possible_clones = exynos_drm_encoder_clones(encoder); | ||
230 | } | ||
231 | |||
198 | struct drm_encoder * | 232 | struct drm_encoder * |
199 | exynos_drm_encoder_create(struct drm_device *dev, | 233 | exynos_drm_encoder_create(struct drm_device *dev, |
200 | struct exynos_drm_manager *manager, | 234 | struct exynos_drm_manager *manager, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h index 97b087a51cb6..eb7d2316847e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | struct exynos_drm_manager; | 31 | struct exynos_drm_manager; |
32 | 32 | ||
33 | void exynos_drm_encoder_setup(struct drm_device *dev); | ||
33 | struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev, | 34 | struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev, |
34 | struct exynos_drm_manager *mgr, | 35 | struct exynos_drm_manager *mgr, |
35 | unsigned int possible_crtcs); | 36 | unsigned int possible_crtcs); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d7ae29d2f3d6..3508700e529b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
@@ -195,66 +195,6 @@ out: | |||
195 | return ret; | 195 | return ret; |
196 | } | 196 | } |
197 | 197 | ||
198 | static bool | ||
199 | exynos_drm_fbdev_is_samefb(struct drm_framebuffer *fb, | ||
200 | struct drm_fb_helper_surface_size *sizes) | ||
201 | { | ||
202 | if (fb->width != sizes->surface_width) | ||
203 | return false; | ||
204 | if (fb->height != sizes->surface_height) | ||
205 | return false; | ||
206 | if (fb->bits_per_pixel != sizes->surface_bpp) | ||
207 | return false; | ||
208 | if (fb->depth != sizes->surface_depth) | ||
209 | return false; | ||
210 | |||
211 | return true; | ||
212 | } | ||
213 | |||
214 | static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, | ||
215 | struct drm_fb_helper_surface_size *sizes) | ||
216 | { | ||
217 | struct drm_device *dev = helper->dev; | ||
218 | struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper); | ||
219 | struct exynos_drm_gem_obj *exynos_gem_obj; | ||
220 | struct drm_framebuffer *fb = helper->fb; | ||
221 | struct drm_mode_fb_cmd2 mode_cmd = { 0 }; | ||
222 | unsigned long size; | ||
223 | |||
224 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
225 | |||
226 | if (exynos_drm_fbdev_is_samefb(fb, sizes)) | ||
227 | return 0; | ||
228 | |||
229 | mode_cmd.width = sizes->surface_width; | ||
230 | mode_cmd.height = sizes->surface_height; | ||
231 | mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3); | ||
232 | mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, | ||
233 | sizes->surface_depth); | ||
234 | |||
235 | if (exynos_fbdev->exynos_gem_obj) | ||
236 | exynos_drm_gem_destroy(exynos_fbdev->exynos_gem_obj); | ||
237 | |||
238 | if (fb->funcs->destroy) | ||
239 | fb->funcs->destroy(fb); | ||
240 | |||
241 | size = mode_cmd.pitches[0] * mode_cmd.height; | ||
242 | exynos_gem_obj = exynos_drm_gem_create(dev, size); | ||
243 | if (IS_ERR(exynos_gem_obj)) | ||
244 | return PTR_ERR(exynos_gem_obj); | ||
245 | |||
246 | exynos_fbdev->exynos_gem_obj = exynos_gem_obj; | ||
247 | |||
248 | helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, | ||
249 | &exynos_gem_obj->base); | ||
250 | if (IS_ERR_OR_NULL(helper->fb)) { | ||
251 | DRM_ERROR("failed to create drm framebuffer.\n"); | ||
252 | return PTR_ERR(helper->fb); | ||
253 | } | ||
254 | |||
255 | return exynos_drm_fbdev_update(helper, helper->fb); | ||
256 | } | ||
257 | |||
258 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, | 198 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, |
259 | struct drm_fb_helper_surface_size *sizes) | 199 | struct drm_fb_helper_surface_size *sizes) |
260 | { | 200 | { |
@@ -262,6 +202,10 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, | |||
262 | 202 | ||
263 | DRM_DEBUG_KMS("%s\n", __FILE__); | 203 | DRM_DEBUG_KMS("%s\n", __FILE__); |
264 | 204 | ||
205 | /* | ||
206 | * with !helper->fb, it means that this funcion is called first time | ||
207 | * and after that, the helper->fb would be used as clone mode. | ||
208 | */ | ||
265 | if (!helper->fb) { | 209 | if (!helper->fb) { |
266 | ret = exynos_drm_fbdev_create(helper, sizes); | 210 | ret = exynos_drm_fbdev_create(helper, sizes); |
267 | if (ret < 0) { | 211 | if (ret < 0) { |
@@ -274,12 +218,6 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, | |||
274 | * because register_framebuffer() should be called. | 218 | * because register_framebuffer() should be called. |
275 | */ | 219 | */ |
276 | ret = 1; | 220 | ret = 1; |
277 | } else { | ||
278 | ret = exynos_drm_fbdev_recreate(helper, sizes); | ||
279 | if (ret < 0) { | ||
280 | DRM_ERROR("failed to reconfigure fbdev\n"); | ||
281 | return ret; | ||
282 | } | ||
283 | } | 221 | } |
284 | 222 | ||
285 | return ret; | 223 | return ret; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index ca83139cd309..360adf2bba04 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -89,7 +89,7 @@ struct fimd_context { | |||
89 | bool suspended; | 89 | bool suspended; |
90 | struct mutex lock; | 90 | struct mutex lock; |
91 | 91 | ||
92 | struct fb_videomode *timing; | 92 | struct exynos_drm_panel_info *panel; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static bool fimd_display_is_connected(struct device *dev) | 95 | static bool fimd_display_is_connected(struct device *dev) |
@@ -101,13 +101,13 @@ static bool fimd_display_is_connected(struct device *dev) | |||
101 | return true; | 101 | return true; |
102 | } | 102 | } |
103 | 103 | ||
104 | static void *fimd_get_timing(struct device *dev) | 104 | static void *fimd_get_panel(struct device *dev) |
105 | { | 105 | { |
106 | struct fimd_context *ctx = get_fimd_context(dev); | 106 | struct fimd_context *ctx = get_fimd_context(dev); |
107 | 107 | ||
108 | DRM_DEBUG_KMS("%s\n", __FILE__); | 108 | DRM_DEBUG_KMS("%s\n", __FILE__); |
109 | 109 | ||
110 | return ctx->timing; | 110 | return ctx->panel; |
111 | } | 111 | } |
112 | 112 | ||
113 | static int fimd_check_timing(struct device *dev, void *timing) | 113 | static int fimd_check_timing(struct device *dev, void *timing) |
@@ -131,7 +131,7 @@ static int fimd_display_power_on(struct device *dev, int mode) | |||
131 | static struct exynos_drm_display_ops fimd_display_ops = { | 131 | static struct exynos_drm_display_ops fimd_display_ops = { |
132 | .type = EXYNOS_DISPLAY_TYPE_LCD, | 132 | .type = EXYNOS_DISPLAY_TYPE_LCD, |
133 | .is_connected = fimd_display_is_connected, | 133 | .is_connected = fimd_display_is_connected, |
134 | .get_timing = fimd_get_timing, | 134 | .get_panel = fimd_get_panel, |
135 | .check_timing = fimd_check_timing, | 135 | .check_timing = fimd_check_timing, |
136 | .power_on = fimd_display_power_on, | 136 | .power_on = fimd_display_power_on, |
137 | }; | 137 | }; |
@@ -158,7 +158,8 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) | |||
158 | case DRM_MODE_DPMS_STANDBY: | 158 | case DRM_MODE_DPMS_STANDBY: |
159 | case DRM_MODE_DPMS_SUSPEND: | 159 | case DRM_MODE_DPMS_SUSPEND: |
160 | case DRM_MODE_DPMS_OFF: | 160 | case DRM_MODE_DPMS_OFF: |
161 | pm_runtime_put_sync(subdrv_dev); | 161 | if (!ctx->suspended) |
162 | pm_runtime_put_sync(subdrv_dev); | ||
162 | break; | 163 | break; |
163 | default: | 164 | default: |
164 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); | 165 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); |
@@ -192,7 +193,8 @@ static void fimd_apply(struct device *subdrv_dev) | |||
192 | static void fimd_commit(struct device *dev) | 193 | static void fimd_commit(struct device *dev) |
193 | { | 194 | { |
194 | struct fimd_context *ctx = get_fimd_context(dev); | 195 | struct fimd_context *ctx = get_fimd_context(dev); |
195 | struct fb_videomode *timing = ctx->timing; | 196 | struct exynos_drm_panel_info *panel = ctx->panel; |
197 | struct fb_videomode *timing = &panel->timing; | ||
196 | u32 val; | 198 | u32 val; |
197 | 199 | ||
198 | if (ctx->suspended) | 200 | if (ctx->suspended) |
@@ -603,7 +605,12 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) | |||
603 | } | 605 | } |
604 | 606 | ||
605 | if (is_checked) { | 607 | if (is_checked) { |
606 | drm_vblank_put(drm_dev, crtc); | 608 | /* |
609 | * call drm_vblank_put only in case that drm_vblank_get was | ||
610 | * called. | ||
611 | */ | ||
612 | if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) | ||
613 | drm_vblank_put(drm_dev, crtc); | ||
607 | 614 | ||
608 | /* | 615 | /* |
609 | * don't off vblank if vblank_disable_allowed is 1, | 616 | * don't off vblank if vblank_disable_allowed is 1, |
@@ -734,13 +741,53 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) | |||
734 | writel(val, ctx->regs + SHADOWCON); | 741 | writel(val, ctx->regs + SHADOWCON); |
735 | } | 742 | } |
736 | 743 | ||
744 | static int fimd_power_on(struct fimd_context *ctx, bool enable) | ||
745 | { | ||
746 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | ||
747 | struct device *dev = subdrv->manager.dev; | ||
748 | |||
749 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
750 | |||
751 | if (enable != false && enable != true) | ||
752 | return -EINVAL; | ||
753 | |||
754 | if (enable) { | ||
755 | int ret; | ||
756 | |||
757 | ret = clk_enable(ctx->bus_clk); | ||
758 | if (ret < 0) | ||
759 | return ret; | ||
760 | |||
761 | ret = clk_enable(ctx->lcd_clk); | ||
762 | if (ret < 0) { | ||
763 | clk_disable(ctx->bus_clk); | ||
764 | return ret; | ||
765 | } | ||
766 | |||
767 | ctx->suspended = false; | ||
768 | |||
769 | /* if vblank was enabled status, enable it again. */ | ||
770 | if (test_and_clear_bit(0, &ctx->irq_flags)) | ||
771 | fimd_enable_vblank(dev); | ||
772 | |||
773 | fimd_apply(dev); | ||
774 | } else { | ||
775 | clk_disable(ctx->lcd_clk); | ||
776 | clk_disable(ctx->bus_clk); | ||
777 | |||
778 | ctx->suspended = true; | ||
779 | } | ||
780 | |||
781 | return 0; | ||
782 | } | ||
783 | |||
737 | static int __devinit fimd_probe(struct platform_device *pdev) | 784 | static int __devinit fimd_probe(struct platform_device *pdev) |
738 | { | 785 | { |
739 | struct device *dev = &pdev->dev; | 786 | struct device *dev = &pdev->dev; |
740 | struct fimd_context *ctx; | 787 | struct fimd_context *ctx; |
741 | struct exynos_drm_subdrv *subdrv; | 788 | struct exynos_drm_subdrv *subdrv; |
742 | struct exynos_drm_fimd_pdata *pdata; | 789 | struct exynos_drm_fimd_pdata *pdata; |
743 | struct fb_videomode *timing; | 790 | struct exynos_drm_panel_info *panel; |
744 | struct resource *res; | 791 | struct resource *res; |
745 | int win; | 792 | int win; |
746 | int ret = -EINVAL; | 793 | int ret = -EINVAL; |
@@ -753,9 +800,9 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
753 | return -EINVAL; | 800 | return -EINVAL; |
754 | } | 801 | } |
755 | 802 | ||
756 | timing = &pdata->timing; | 803 | panel = &pdata->panel; |
757 | if (!timing) { | 804 | if (!panel) { |
758 | dev_err(dev, "timing is null.\n"); | 805 | dev_err(dev, "panel is null.\n"); |
759 | return -EINVAL; | 806 | return -EINVAL; |
760 | } | 807 | } |
761 | 808 | ||
@@ -817,16 +864,16 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
817 | goto err_req_irq; | 864 | goto err_req_irq; |
818 | } | 865 | } |
819 | 866 | ||
820 | ctx->clkdiv = fimd_calc_clkdiv(ctx, timing); | 867 | ctx->clkdiv = fimd_calc_clkdiv(ctx, &panel->timing); |
821 | ctx->vidcon0 = pdata->vidcon0; | 868 | ctx->vidcon0 = pdata->vidcon0; |
822 | ctx->vidcon1 = pdata->vidcon1; | 869 | ctx->vidcon1 = pdata->vidcon1; |
823 | ctx->default_win = pdata->default_win; | 870 | ctx->default_win = pdata->default_win; |
824 | ctx->timing = timing; | 871 | ctx->panel = panel; |
825 | 872 | ||
826 | timing->pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv; | 873 | panel->timing.pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv; |
827 | 874 | ||
828 | DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n", | 875 | DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n", |
829 | timing->pixclock, ctx->clkdiv); | 876 | panel->timing.pixclock, ctx->clkdiv); |
830 | 877 | ||
831 | subdrv = &ctx->subdrv; | 878 | subdrv = &ctx->subdrv; |
832 | 879 | ||
@@ -911,39 +958,30 @@ out: | |||
911 | #ifdef CONFIG_PM_SLEEP | 958 | #ifdef CONFIG_PM_SLEEP |
912 | static int fimd_suspend(struct device *dev) | 959 | static int fimd_suspend(struct device *dev) |
913 | { | 960 | { |
914 | int ret; | 961 | struct fimd_context *ctx = get_fimd_context(dev); |
915 | 962 | ||
916 | if (pm_runtime_suspended(dev)) | 963 | if (pm_runtime_suspended(dev)) |
917 | return 0; | 964 | return 0; |
918 | 965 | ||
919 | ret = pm_runtime_suspend(dev); | 966 | /* |
920 | if (ret < 0) | 967 | * do not use pm_runtime_suspend(). if pm_runtime_suspend() is |
921 | return ret; | 968 | * called here, an error would be returned by that interface |
922 | 969 | * because the usage_count of pm runtime is more than 1. | |
923 | return 0; | 970 | */ |
971 | return fimd_power_on(ctx, false); | ||
924 | } | 972 | } |
925 | 973 | ||
926 | static int fimd_resume(struct device *dev) | 974 | static int fimd_resume(struct device *dev) |
927 | { | 975 | { |
928 | int ret; | 976 | struct fimd_context *ctx = get_fimd_context(dev); |
929 | |||
930 | ret = pm_runtime_resume(dev); | ||
931 | if (ret < 0) { | ||
932 | DRM_ERROR("failed to resume runtime pm.\n"); | ||
933 | return ret; | ||
934 | } | ||
935 | |||
936 | pm_runtime_disable(dev); | ||
937 | |||
938 | ret = pm_runtime_set_active(dev); | ||
939 | if (ret < 0) { | ||
940 | DRM_ERROR("failed to active runtime pm.\n"); | ||
941 | pm_runtime_enable(dev); | ||
942 | pm_runtime_suspend(dev); | ||
943 | return ret; | ||
944 | } | ||
945 | 977 | ||
946 | pm_runtime_enable(dev); | 978 | /* |
979 | * if entered to sleep when lcd panel was on, the usage_count | ||
980 | * of pm runtime would still be 1 so in this case, fimd driver | ||
981 | * should be on directly not drawing on pm runtime interface. | ||
982 | */ | ||
983 | if (!pm_runtime_suspended(dev)) | ||
984 | return fimd_power_on(ctx, true); | ||
947 | 985 | ||
948 | return 0; | 986 | return 0; |
949 | } | 987 | } |
@@ -956,39 +994,16 @@ static int fimd_runtime_suspend(struct device *dev) | |||
956 | 994 | ||
957 | DRM_DEBUG_KMS("%s\n", __FILE__); | 995 | DRM_DEBUG_KMS("%s\n", __FILE__); |
958 | 996 | ||
959 | clk_disable(ctx->lcd_clk); | 997 | return fimd_power_on(ctx, false); |
960 | clk_disable(ctx->bus_clk); | ||
961 | |||
962 | ctx->suspended = true; | ||
963 | return 0; | ||
964 | } | 998 | } |
965 | 999 | ||
966 | static int fimd_runtime_resume(struct device *dev) | 1000 | static int fimd_runtime_resume(struct device *dev) |
967 | { | 1001 | { |
968 | struct fimd_context *ctx = get_fimd_context(dev); | 1002 | struct fimd_context *ctx = get_fimd_context(dev); |
969 | int ret; | ||
970 | 1003 | ||
971 | DRM_DEBUG_KMS("%s\n", __FILE__); | 1004 | DRM_DEBUG_KMS("%s\n", __FILE__); |
972 | 1005 | ||
973 | ret = clk_enable(ctx->bus_clk); | 1006 | return fimd_power_on(ctx, true); |
974 | if (ret < 0) | ||
975 | return ret; | ||
976 | |||
977 | ret = clk_enable(ctx->lcd_clk); | ||
978 | if (ret < 0) { | ||
979 | clk_disable(ctx->bus_clk); | ||
980 | return ret; | ||
981 | } | ||
982 | |||
983 | ctx->suspended = false; | ||
984 | |||
985 | /* if vblank was enabled status, enable it again. */ | ||
986 | if (test_and_clear_bit(0, &ctx->irq_flags)) | ||
987 | fimd_enable_vblank(dev); | ||
988 | |||
989 | fimd_apply(dev); | ||
990 | |||
991 | return 0; | ||
992 | } | 1007 | } |
993 | #endif | 1008 | #endif |
994 | 1009 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index f48f7ce92f5f..3429d3fd93f3 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -1116,8 +1116,8 @@ err_ddc: | |||
1116 | err_iomap: | 1116 | err_iomap: |
1117 | iounmap(hdata->regs); | 1117 | iounmap(hdata->regs); |
1118 | err_req_region: | 1118 | err_req_region: |
1119 | release_resource(hdata->regs_res); | 1119 | release_mem_region(hdata->regs_res->start, |
1120 | kfree(hdata->regs_res); | 1120 | resource_size(hdata->regs_res)); |
1121 | err_resource: | 1121 | err_resource: |
1122 | hdmi_resources_cleanup(hdata); | 1122 | hdmi_resources_cleanup(hdata); |
1123 | err_data: | 1123 | err_data: |
@@ -1145,8 +1145,8 @@ static int __devexit hdmi_remove(struct platform_device *pdev) | |||
1145 | 1145 | ||
1146 | iounmap(hdata->regs); | 1146 | iounmap(hdata->regs); |
1147 | 1147 | ||
1148 | release_resource(hdata->regs_res); | 1148 | release_mem_region(hdata->regs_res->start, |
1149 | kfree(hdata->regs_res); | 1149 | resource_size(hdata->regs_res)); |
1150 | 1150 | ||
1151 | /* hdmiphy i2c driver */ | 1151 | /* hdmiphy i2c driver */ |
1152 | i2c_del_driver(&hdmiphy_driver); | 1152 | i2c_del_driver(&hdmiphy_driver); |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index ac24cff39775..93846e810e38 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -712,7 +712,12 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | if (is_checked) | 714 | if (is_checked) |
715 | drm_vblank_put(drm_dev, crtc); | 715 | /* |
716 | * call drm_vblank_put only in case that drm_vblank_get was | ||
717 | * called. | ||
718 | */ | ||
719 | if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) | ||
720 | drm_vblank_put(drm_dev, crtc); | ||
716 | 721 | ||
717 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | 722 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); |
718 | } | 723 | } |
@@ -779,15 +784,15 @@ static void mixer_win_reset(struct mixer_context *ctx) | |||
779 | mixer_reg_writemask(res, MXR_STATUS, MXR_STATUS_16_BURST, | 784 | mixer_reg_writemask(res, MXR_STATUS, MXR_STATUS_16_BURST, |
780 | MXR_STATUS_BURST_MASK); | 785 | MXR_STATUS_BURST_MASK); |
781 | 786 | ||
782 | /* setting default layer priority: layer1 > video > layer0 | 787 | /* setting default layer priority: layer1 > layer0 > video |
783 | * because typical usage scenario would be | 788 | * because typical usage scenario would be |
789 | * layer1 - OSD | ||
784 | * layer0 - framebuffer | 790 | * layer0 - framebuffer |
785 | * video - video overlay | 791 | * video - video overlay |
786 | * layer1 - OSD | ||
787 | */ | 792 | */ |
788 | val = MXR_LAYER_CFG_GRP0_VAL(1); | 793 | val = MXR_LAYER_CFG_GRP1_VAL(3); |
789 | val |= MXR_LAYER_CFG_VP_VAL(2); | 794 | val |= MXR_LAYER_CFG_GRP0_VAL(2); |
790 | val |= MXR_LAYER_CFG_GRP1_VAL(3); | 795 | val |= MXR_LAYER_CFG_VP_VAL(1); |
791 | mixer_reg_write(res, MXR_LAYER_CFG, val); | 796 | mixer_reg_write(res, MXR_LAYER_CFG, val); |
792 | 797 | ||
793 | /* setting background color */ | 798 | /* setting background color */ |
@@ -1044,7 +1049,7 @@ static int mixer_remove(struct platform_device *pdev) | |||
1044 | platform_get_drvdata(pdev); | 1049 | platform_get_drvdata(pdev); |
1045 | struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; | 1050 | struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; |
1046 | 1051 | ||
1047 | dev_info(dev, "remove sucessful\n"); | 1052 | dev_info(dev, "remove successful\n"); |
1048 | 1053 | ||
1049 | mixer_resource_poweroff(ctx); | 1054 | mixer_resource_poweroff(ctx); |
1050 | mixer_resources_cleanup(ctx); | 1055 | mixer_resources_cleanup(ctx); |
diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c index 4a5b099c3bc5..53404af2e748 100644 --- a/drivers/gpu/drm/gma500/cdv_device.c +++ b/drivers/gpu/drm/gma500/cdv_device.c | |||
@@ -321,6 +321,8 @@ static int cdv_chip_setup(struct drm_device *dev) | |||
321 | cdv_get_core_freq(dev); | 321 | cdv_get_core_freq(dev); |
322 | gma_intel_opregion_init(dev); | 322 | gma_intel_opregion_init(dev); |
323 | psb_intel_init_bios(dev); | 323 | psb_intel_init_bios(dev); |
324 | REG_WRITE(PORT_HOTPLUG_EN, 0); | ||
325 | REG_WRITE(PORT_HOTPLUG_STAT, REG_READ(PORT_HOTPLUG_STAT)); | ||
324 | return 0; | 326 | return 0; |
325 | } | 327 | } |
326 | 328 | ||
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 791c0ef1a65b..be616735ec91 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c | |||
@@ -113,12 +113,12 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info) | |||
113 | 113 | ||
114 | void psbfb_suspend(struct drm_device *dev) | 114 | void psbfb_suspend(struct drm_device *dev) |
115 | { | 115 | { |
116 | struct drm_framebuffer *fb = 0; | 116 | struct drm_framebuffer *fb; |
117 | struct psb_framebuffer *psbfb = to_psb_fb(fb); | ||
118 | 117 | ||
119 | console_lock(); | 118 | console_lock(); |
120 | mutex_lock(&dev->mode_config.mutex); | 119 | mutex_lock(&dev->mode_config.mutex); |
121 | list_for_each_entry(fb, &dev->mode_config.fb_list, head) { | 120 | list_for_each_entry(fb, &dev->mode_config.fb_list, head) { |
121 | struct psb_framebuffer *psbfb = to_psb_fb(fb); | ||
122 | struct fb_info *info = psbfb->fbdev; | 122 | struct fb_info *info = psbfb->fbdev; |
123 | fb_set_suspend(info, 1); | 123 | fb_set_suspend(info, 1); |
124 | drm_fb_helper_blank(FB_BLANK_POWERDOWN, info); | 124 | drm_fb_helper_blank(FB_BLANK_POWERDOWN, info); |
@@ -129,12 +129,12 @@ void psbfb_suspend(struct drm_device *dev) | |||
129 | 129 | ||
130 | void psbfb_resume(struct drm_device *dev) | 130 | void psbfb_resume(struct drm_device *dev) |
131 | { | 131 | { |
132 | struct drm_framebuffer *fb = 0; | 132 | struct drm_framebuffer *fb; |
133 | struct psb_framebuffer *psbfb = to_psb_fb(fb); | ||
134 | 133 | ||
135 | console_lock(); | 134 | console_lock(); |
136 | mutex_lock(&dev->mode_config.mutex); | 135 | mutex_lock(&dev->mode_config.mutex); |
137 | list_for_each_entry(fb, &dev->mode_config.fb_list, head) { | 136 | list_for_each_entry(fb, &dev->mode_config.fb_list, head) { |
137 | struct psb_framebuffer *psbfb = to_psb_fb(fb); | ||
138 | struct fb_info *info = psbfb->fbdev; | 138 | struct fb_info *info = psbfb->fbdev; |
139 | fb_set_suspend(info, 0); | 139 | fb_set_suspend(info, 0); |
140 | drm_fb_helper_blank(FB_BLANK_UNBLANK, info); | 140 | drm_fb_helper_blank(FB_BLANK_UNBLANK, info); |
@@ -247,7 +247,6 @@ static struct fb_ops psbfb_roll_ops = { | |||
247 | .fb_imageblit = cfb_imageblit, | 247 | .fb_imageblit = cfb_imageblit, |
248 | .fb_pan_display = psbfb_pan, | 248 | .fb_pan_display = psbfb_pan, |
249 | .fb_mmap = psbfb_mmap, | 249 | .fb_mmap = psbfb_mmap, |
250 | .fb_sync = psbfb_sync, | ||
251 | .fb_ioctl = psbfb_ioctl, | 250 | .fb_ioctl = psbfb_ioctl, |
252 | }; | 251 | }; |
253 | 252 | ||
diff --git a/drivers/gpu/drm/gma500/gtt.c b/drivers/gpu/drm/gma500/gtt.c index 5d5330f667f1..aff194fbe9f3 100644 --- a/drivers/gpu/drm/gma500/gtt.c +++ b/drivers/gpu/drm/gma500/gtt.c | |||
@@ -446,10 +446,9 @@ int psb_gtt_init(struct drm_device *dev, int resume) | |||
446 | pg->gtt_start = pci_resource_start(dev->pdev, PSB_GTT_RESOURCE); | 446 | pg->gtt_start = pci_resource_start(dev->pdev, PSB_GTT_RESOURCE); |
447 | gtt_pages = pci_resource_len(dev->pdev, PSB_GTT_RESOURCE) | 447 | gtt_pages = pci_resource_len(dev->pdev, PSB_GTT_RESOURCE) |
448 | >> PAGE_SHIFT; | 448 | >> PAGE_SHIFT; |
449 | /* Some CDV firmware doesn't report this currently. In which case the | 449 | /* CDV doesn't report this. In which case the system has 64 gtt pages */ |
450 | system has 64 gtt pages */ | ||
451 | if (pg->gtt_start == 0 || gtt_pages == 0) { | 450 | if (pg->gtt_start == 0 || gtt_pages == 0) { |
452 | dev_err(dev->dev, "GTT PCI BAR not initialized.\n"); | 451 | dev_dbg(dev->dev, "GTT PCI BAR not initialized.\n"); |
453 | gtt_pages = 64; | 452 | gtt_pages = 64; |
454 | pg->gtt_start = dev_priv->pge_ctl; | 453 | pg->gtt_start = dev_priv->pge_ctl; |
455 | } | 454 | } |
@@ -461,10 +460,10 @@ int psb_gtt_init(struct drm_device *dev, int resume) | |||
461 | 460 | ||
462 | if (pg->gatt_pages == 0 || pg->gatt_start == 0) { | 461 | if (pg->gatt_pages == 0 || pg->gatt_start == 0) { |
463 | static struct resource fudge; /* Preferably peppermint */ | 462 | static struct resource fudge; /* Preferably peppermint */ |
464 | /* This can occur on CDV SDV systems. Fudge it in this case. | 463 | /* This can occur on CDV systems. Fudge it in this case. |
465 | We really don't care what imaginary space is being allocated | 464 | We really don't care what imaginary space is being allocated |
466 | at this point */ | 465 | at this point */ |
467 | dev_err(dev->dev, "GATT PCI BAR not initialized.\n"); | 466 | dev_dbg(dev->dev, "GATT PCI BAR not initialized.\n"); |
468 | pg->gatt_start = 0x40000000; | 467 | pg->gatt_start = 0x40000000; |
469 | pg->gatt_pages = (128 * 1024 * 1024) >> PAGE_SHIFT; | 468 | pg->gatt_pages = (128 * 1024 * 1024) >> PAGE_SHIFT; |
470 | /* This is a little confusing but in fact the GTT is providing | 469 | /* This is a little confusing but in fact the GTT is providing |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index f7c17b239833..7f4b4e10246e 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -886,7 +886,7 @@ static int i810_flush_queue(struct drm_device *dev) | |||
886 | } | 886 | } |
887 | 887 | ||
888 | /* Must be called with the lock held */ | 888 | /* Must be called with the lock held */ |
889 | void i810_driver_reclaim_buffers(struct drm_device *dev, | 889 | static void i810_reclaim_buffers(struct drm_device *dev, |
890 | struct drm_file *file_priv) | 890 | struct drm_file *file_priv) |
891 | { | 891 | { |
892 | struct drm_device_dma *dma = dev->dma; | 892 | struct drm_device_dma *dma = dev->dma; |
@@ -1223,17 +1223,12 @@ void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv) | |||
1223 | if (dev_priv->page_flipping) | 1223 | if (dev_priv->page_flipping) |
1224 | i810_do_cleanup_pageflip(dev); | 1224 | i810_do_cleanup_pageflip(dev); |
1225 | } | 1225 | } |
1226 | } | ||
1226 | 1227 | ||
1227 | if (file_priv->master && file_priv->master->lock.hw_lock) { | 1228 | void i810_driver_reclaim_buffers_locked(struct drm_device *dev, |
1228 | drm_idlelock_take(&file_priv->master->lock); | 1229 | struct drm_file *file_priv) |
1229 | i810_driver_reclaim_buffers(dev, file_priv); | 1230 | { |
1230 | drm_idlelock_release(&file_priv->master->lock); | 1231 | i810_reclaim_buffers(dev, file_priv); |
1231 | } else { | ||
1232 | /* master disappeared, clean up stuff anyway and hope nothing | ||
1233 | * goes wrong */ | ||
1234 | i810_driver_reclaim_buffers(dev, file_priv); | ||
1235 | } | ||
1236 | |||
1237 | } | 1232 | } |
1238 | 1233 | ||
1239 | int i810_driver_dma_quiescent(struct drm_device *dev) | 1234 | int i810_driver_dma_quiescent(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c index 053f1ee58393..ec12f7dc717a 100644 --- a/drivers/gpu/drm/i810/i810_drv.c +++ b/drivers/gpu/drm/i810/i810_drv.c | |||
@@ -63,6 +63,7 @@ static struct drm_driver driver = { | |||
63 | .lastclose = i810_driver_lastclose, | 63 | .lastclose = i810_driver_lastclose, |
64 | .preclose = i810_driver_preclose, | 64 | .preclose = i810_driver_preclose, |
65 | .device_is_agp = i810_driver_device_is_agp, | 65 | .device_is_agp = i810_driver_device_is_agp, |
66 | .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked, | ||
66 | .dma_quiescent = i810_driver_dma_quiescent, | 67 | .dma_quiescent = i810_driver_dma_quiescent, |
67 | .ioctls = i810_ioctls, | 68 | .ioctls = i810_ioctls, |
68 | .fops = &i810_driver_fops, | 69 | .fops = &i810_driver_fops, |
diff --git a/drivers/gpu/drm/i810/i810_drv.h b/drivers/gpu/drm/i810/i810_drv.h index 6e0acad9e0f5..c9339f481795 100644 --- a/drivers/gpu/drm/i810/i810_drv.h +++ b/drivers/gpu/drm/i810/i810_drv.h | |||
@@ -116,12 +116,14 @@ typedef struct drm_i810_private { | |||
116 | 116 | ||
117 | /* i810_dma.c */ | 117 | /* i810_dma.c */ |
118 | extern int i810_driver_dma_quiescent(struct drm_device *dev); | 118 | extern int i810_driver_dma_quiescent(struct drm_device *dev); |
119 | void i810_driver_reclaim_buffers(struct drm_device *dev, | 119 | extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, |
120 | struct drm_file *file_priv); | 120 | struct drm_file *file_priv); |
121 | extern int i810_driver_load(struct drm_device *, unsigned long flags); | 121 | extern int i810_driver_load(struct drm_device *, unsigned long flags); |
122 | extern void i810_driver_lastclose(struct drm_device *dev); | 122 | extern void i810_driver_lastclose(struct drm_device *dev); |
123 | extern void i810_driver_preclose(struct drm_device *dev, | 123 | extern void i810_driver_preclose(struct drm_device *dev, |
124 | struct drm_file *file_priv); | 124 | struct drm_file *file_priv); |
125 | extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev, | ||
126 | struct drm_file *file_priv); | ||
125 | extern int i810_driver_device_is_agp(struct drm_device *dev); | 127 | extern int i810_driver_device_is_agp(struct drm_device *dev); |
126 | 128 | ||
127 | extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 129 | extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 11807989f918..deaa657292b4 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -121,11 +121,11 @@ static const char *cache_level_str(int type) | |||
121 | static void | 121 | static void |
122 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | 122 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
123 | { | 123 | { |
124 | seq_printf(m, "%p: %s%s %8zd %04x %04x %d %d%s%s%s", | 124 | seq_printf(m, "%p: %s%s %8zdKiB %04x %04x %d %d%s%s%s", |
125 | &obj->base, | 125 | &obj->base, |
126 | get_pin_flag(obj), | 126 | get_pin_flag(obj), |
127 | get_tiling_flag(obj), | 127 | get_tiling_flag(obj), |
128 | obj->base.size, | 128 | obj->base.size / 1024, |
129 | obj->base.read_domains, | 129 | obj->base.read_domains, |
130 | obj->base.write_domain, | 130 | obj->base.write_domain, |
131 | obj->last_rendering_seqno, | 131 | obj->last_rendering_seqno, |
@@ -653,7 +653,7 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
653 | seq_printf(m, " Size : %08x\n", ring->size); | 653 | seq_printf(m, " Size : %08x\n", ring->size); |
654 | seq_printf(m, " Active : %08x\n", intel_ring_get_active_head(ring)); | 654 | seq_printf(m, " Active : %08x\n", intel_ring_get_active_head(ring)); |
655 | seq_printf(m, " NOPID : %08x\n", I915_READ_NOPID(ring)); | 655 | seq_printf(m, " NOPID : %08x\n", I915_READ_NOPID(ring)); |
656 | if (IS_GEN6(dev)) { | 656 | if (IS_GEN6(dev) || IS_GEN7(dev)) { |
657 | seq_printf(m, " Sync 0 : %08x\n", I915_READ_SYNC_0(ring)); | 657 | seq_printf(m, " Sync 0 : %08x\n", I915_READ_SYNC_0(ring)); |
658 | seq_printf(m, " Sync 1 : %08x\n", I915_READ_SYNC_1(ring)); | 658 | seq_printf(m, " Sync 1 : %08x\n", I915_READ_SYNC_1(ring)); |
659 | } | 659 | } |
@@ -1075,6 +1075,7 @@ static int gen6_drpc_info(struct seq_file *m) | |||
1075 | struct drm_device *dev = node->minor->dev; | 1075 | struct drm_device *dev = node->minor->dev; |
1076 | struct drm_i915_private *dev_priv = dev->dev_private; | 1076 | struct drm_i915_private *dev_priv = dev->dev_private; |
1077 | u32 rpmodectl1, gt_core_status, rcctl1; | 1077 | u32 rpmodectl1, gt_core_status, rcctl1; |
1078 | unsigned forcewake_count; | ||
1078 | int count=0, ret; | 1079 | int count=0, ret; |
1079 | 1080 | ||
1080 | 1081 | ||
@@ -1082,9 +1083,13 @@ static int gen6_drpc_info(struct seq_file *m) | |||
1082 | if (ret) | 1083 | if (ret) |
1083 | return ret; | 1084 | return ret; |
1084 | 1085 | ||
1085 | if (atomic_read(&dev_priv->forcewake_count)) { | 1086 | spin_lock_irq(&dev_priv->gt_lock); |
1086 | seq_printf(m, "RC information inaccurate because userspace " | 1087 | forcewake_count = dev_priv->forcewake_count; |
1087 | "holds a reference \n"); | 1088 | spin_unlock_irq(&dev_priv->gt_lock); |
1089 | |||
1090 | if (forcewake_count) { | ||
1091 | seq_printf(m, "RC information inaccurate because somebody " | ||
1092 | "holds a forcewake reference \n"); | ||
1088 | } else { | 1093 | } else { |
1089 | /* NB: we cannot use forcewake, else we read the wrong values */ | 1094 | /* NB: we cannot use forcewake, else we read the wrong values */ |
1090 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1)) | 1095 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1)) |
@@ -1106,7 +1111,7 @@ static int gen6_drpc_info(struct seq_file *m) | |||
1106 | seq_printf(m, "SW control enabled: %s\n", | 1111 | seq_printf(m, "SW control enabled: %s\n", |
1107 | yesno((rpmodectl1 & GEN6_RP_MEDIA_MODE_MASK) == | 1112 | yesno((rpmodectl1 & GEN6_RP_MEDIA_MODE_MASK) == |
1108 | GEN6_RP_MEDIA_SW_MODE)); | 1113 | GEN6_RP_MEDIA_SW_MODE)); |
1109 | seq_printf(m, "RC6 Enabled: %s\n", | 1114 | seq_printf(m, "RC1e Enabled: %s\n", |
1110 | yesno(rcctl1 & GEN6_RC_CTL_RC1e_ENABLE)); | 1115 | yesno(rcctl1 & GEN6_RC_CTL_RC1e_ENABLE)); |
1111 | seq_printf(m, "RC6 Enabled: %s\n", | 1116 | seq_printf(m, "RC6 Enabled: %s\n", |
1112 | yesno(rcctl1 & GEN6_RC_CTL_RC6_ENABLE)); | 1117 | yesno(rcctl1 & GEN6_RC_CTL_RC6_ENABLE)); |
@@ -1398,9 +1403,13 @@ static int i915_gen6_forcewake_count_info(struct seq_file *m, void *data) | |||
1398 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 1403 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
1399 | struct drm_device *dev = node->minor->dev; | 1404 | struct drm_device *dev = node->minor->dev; |
1400 | struct drm_i915_private *dev_priv = dev->dev_private; | 1405 | struct drm_i915_private *dev_priv = dev->dev_private; |
1406 | unsigned forcewake_count; | ||
1407 | |||
1408 | spin_lock_irq(&dev_priv->gt_lock); | ||
1409 | forcewake_count = dev_priv->forcewake_count; | ||
1410 | spin_unlock_irq(&dev_priv->gt_lock); | ||
1401 | 1411 | ||
1402 | seq_printf(m, "forcewake count = %d\n", | 1412 | seq_printf(m, "forcewake count = %u\n", forcewake_count); |
1403 | atomic_read(&dev_priv->forcewake_count)); | ||
1404 | 1413 | ||
1405 | return 0; | 1414 | return 0; |
1406 | } | 1415 | } |
@@ -1665,7 +1674,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file) | |||
1665 | struct drm_i915_private *dev_priv = dev->dev_private; | 1674 | struct drm_i915_private *dev_priv = dev->dev_private; |
1666 | int ret; | 1675 | int ret; |
1667 | 1676 | ||
1668 | if (!IS_GEN6(dev)) | 1677 | if (INTEL_INFO(dev)->gen < 6) |
1669 | return 0; | 1678 | return 0; |
1670 | 1679 | ||
1671 | ret = mutex_lock_interruptible(&dev->struct_mutex); | 1680 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
@@ -1682,7 +1691,7 @@ int i915_forcewake_release(struct inode *inode, struct file *file) | |||
1682 | struct drm_device *dev = inode->i_private; | 1691 | struct drm_device *dev = inode->i_private; |
1683 | struct drm_i915_private *dev_priv = dev->dev_private; | 1692 | struct drm_i915_private *dev_priv = dev->dev_private; |
1684 | 1693 | ||
1685 | if (!IS_GEN6(dev)) | 1694 | if (INTEL_INFO(dev)->gen < 6) |
1686 | return 0; | 1695 | return 0; |
1687 | 1696 | ||
1688 | /* | 1697 | /* |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 5f4d5893e983..ddfe3d902b2a 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -2045,6 +2045,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
2045 | if (!IS_I945G(dev) && !IS_I945GM(dev)) | 2045 | if (!IS_I945G(dev) && !IS_I945GM(dev)) |
2046 | pci_enable_msi(dev->pdev); | 2046 | pci_enable_msi(dev->pdev); |
2047 | 2047 | ||
2048 | spin_lock_init(&dev_priv->gt_lock); | ||
2048 | spin_lock_init(&dev_priv->irq_lock); | 2049 | spin_lock_init(&dev_priv->irq_lock); |
2049 | spin_lock_init(&dev_priv->error_lock); | 2050 | spin_lock_init(&dev_priv->error_lock); |
2050 | spin_lock_init(&dev_priv->rps_lock); | 2051 | spin_lock_init(&dev_priv->rps_lock); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 8f7187915b0d..308f81913562 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -368,11 +368,12 @@ void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) | |||
368 | */ | 368 | */ |
369 | void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | 369 | void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) |
370 | { | 370 | { |
371 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); | 371 | unsigned long irqflags; |
372 | 372 | ||
373 | /* Forcewake is atomic in case we get in here without the lock */ | 373 | spin_lock_irqsave(&dev_priv->gt_lock, irqflags); |
374 | if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) | 374 | if (dev_priv->forcewake_count++ == 0) |
375 | dev_priv->display.force_wake_get(dev_priv); | 375 | dev_priv->display.force_wake_get(dev_priv); |
376 | spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); | ||
376 | } | 377 | } |
377 | 378 | ||
378 | void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) | 379 | void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) |
@@ -392,10 +393,12 @@ void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) | |||
392 | */ | 393 | */ |
393 | void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) | 394 | void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) |
394 | { | 395 | { |
395 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); | 396 | unsigned long irqflags; |
396 | 397 | ||
397 | if (atomic_dec_and_test(&dev_priv->forcewake_count)) | 398 | spin_lock_irqsave(&dev_priv->gt_lock, irqflags); |
399 | if (--dev_priv->forcewake_count == 0) | ||
398 | dev_priv->display.force_wake_put(dev_priv); | 400 | dev_priv->display.force_wake_put(dev_priv); |
401 | spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); | ||
399 | } | 402 | } |
400 | 403 | ||
401 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) | 404 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) |
@@ -597,9 +600,36 @@ static int ironlake_do_reset(struct drm_device *dev, u8 flags) | |||
597 | static int gen6_do_reset(struct drm_device *dev, u8 flags) | 600 | static int gen6_do_reset(struct drm_device *dev, u8 flags) |
598 | { | 601 | { |
599 | struct drm_i915_private *dev_priv = dev->dev_private; | 602 | struct drm_i915_private *dev_priv = dev->dev_private; |
603 | int ret; | ||
604 | unsigned long irqflags; | ||
600 | 605 | ||
601 | I915_WRITE(GEN6_GDRST, GEN6_GRDOM_FULL); | 606 | /* Hold gt_lock across reset to prevent any register access |
602 | return wait_for((I915_READ(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, 500); | 607 | * with forcewake not set correctly |
608 | */ | ||
609 | spin_lock_irqsave(&dev_priv->gt_lock, irqflags); | ||
610 | |||
611 | /* Reset the chip */ | ||
612 | |||
613 | /* GEN6_GDRST is not in the gt power well, no need to check | ||
614 | * for fifo space for the write or forcewake the chip for | ||
615 | * the read | ||
616 | */ | ||
617 | I915_WRITE_NOTRACE(GEN6_GDRST, GEN6_GRDOM_FULL); | ||
618 | |||
619 | /* Spin waiting for the device to ack the reset request */ | ||
620 | ret = wait_for((I915_READ_NOTRACE(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, 500); | ||
621 | |||
622 | /* If reset with a user forcewake, try to restore, otherwise turn it off */ | ||
623 | if (dev_priv->forcewake_count) | ||
624 | dev_priv->display.force_wake_get(dev_priv); | ||
625 | else | ||
626 | dev_priv->display.force_wake_put(dev_priv); | ||
627 | |||
628 | /* Restore fifo count */ | ||
629 | dev_priv->gt_fifo_count = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); | ||
630 | |||
631 | spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); | ||
632 | return ret; | ||
603 | } | 633 | } |
604 | 634 | ||
605 | /** | 635 | /** |
@@ -643,9 +673,6 @@ int i915_reset(struct drm_device *dev, u8 flags) | |||
643 | case 7: | 673 | case 7: |
644 | case 6: | 674 | case 6: |
645 | ret = gen6_do_reset(dev, flags); | 675 | ret = gen6_do_reset(dev, flags); |
646 | /* If reset with a user forcewake, try to restore */ | ||
647 | if (atomic_read(&dev_priv->forcewake_count)) | ||
648 | __gen6_gt_force_wake_get(dev_priv); | ||
649 | break; | 676 | break; |
650 | case 5: | 677 | case 5: |
651 | ret = ironlake_do_reset(dev, flags); | 678 | ret = ironlake_do_reset(dev, flags); |
@@ -927,9 +954,14 @@ MODULE_LICENSE("GPL and additional rights"); | |||
927 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ | 954 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ |
928 | u##x val = 0; \ | 955 | u##x val = 0; \ |
929 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ | 956 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ |
930 | gen6_gt_force_wake_get(dev_priv); \ | 957 | unsigned long irqflags; \ |
958 | spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ | ||
959 | if (dev_priv->forcewake_count == 0) \ | ||
960 | dev_priv->display.force_wake_get(dev_priv); \ | ||
931 | val = read##y(dev_priv->regs + reg); \ | 961 | val = read##y(dev_priv->regs + reg); \ |
932 | gen6_gt_force_wake_put(dev_priv); \ | 962 | if (dev_priv->forcewake_count == 0) \ |
963 | dev_priv->display.force_wake_put(dev_priv); \ | ||
964 | spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ | ||
933 | } else { \ | 965 | } else { \ |
934 | val = read##y(dev_priv->regs + reg); \ | 966 | val = read##y(dev_priv->regs + reg); \ |
935 | } \ | 967 | } \ |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 602bc80baabb..9689ca38b2b3 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -288,7 +288,13 @@ typedef struct drm_i915_private { | |||
288 | int relative_constants_mode; | 288 | int relative_constants_mode; |
289 | 289 | ||
290 | void __iomem *regs; | 290 | void __iomem *regs; |
291 | u32 gt_fifo_count; | 291 | /** gt_fifo_count and the subsequent register write are synchronized |
292 | * with dev->struct_mutex. */ | ||
293 | unsigned gt_fifo_count; | ||
294 | /** forcewake_count is protected by gt_lock */ | ||
295 | unsigned forcewake_count; | ||
296 | /** gt_lock is also taken in irq contexts. */ | ||
297 | struct spinlock gt_lock; | ||
292 | 298 | ||
293 | struct intel_gmbus { | 299 | struct intel_gmbus { |
294 | struct i2c_adapter adapter; | 300 | struct i2c_adapter adapter; |
@@ -741,8 +747,6 @@ typedef struct drm_i915_private { | |||
741 | 747 | ||
742 | struct drm_property *broadcast_rgb_property; | 748 | struct drm_property *broadcast_rgb_property; |
743 | struct drm_property *force_audio_property; | 749 | struct drm_property *force_audio_property; |
744 | |||
745 | atomic_t forcewake_count; | ||
746 | } drm_i915_private_t; | 750 | } drm_i915_private_t; |
747 | 751 | ||
748 | enum i915_cache_level { | 752 | enum i915_cache_level { |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 5d433fc11ace..5bd4361ea84d 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1751,7 +1751,8 @@ static void ironlake_irq_preinstall(struct drm_device *dev) | |||
1751 | INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); | 1751 | INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); |
1752 | 1752 | ||
1753 | I915_WRITE(HWSTAM, 0xeffe); | 1753 | I915_WRITE(HWSTAM, 0xeffe); |
1754 | if (IS_GEN6(dev) || IS_GEN7(dev)) { | 1754 | |
1755 | if (IS_GEN6(dev)) { | ||
1755 | /* Workaround stalls observed on Sandy Bridge GPUs by | 1756 | /* Workaround stalls observed on Sandy Bridge GPUs by |
1756 | * making the blitter command streamer generate a | 1757 | * making the blitter command streamer generate a |
1757 | * write to the Hardware Status Page for | 1758 | * write to the Hardware Status Page for |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index c3afb783cb9d..03c53fcf8653 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3028,6 +3028,20 @@ | |||
3028 | #define DISP_TILE_SURFACE_SWIZZLING (1<<13) | 3028 | #define DISP_TILE_SURFACE_SWIZZLING (1<<13) |
3029 | #define DISP_FBC_WM_DIS (1<<15) | 3029 | #define DISP_FBC_WM_DIS (1<<15) |
3030 | 3030 | ||
3031 | /* GEN7 chicken */ | ||
3032 | #define GEN7_COMMON_SLICE_CHICKEN1 0x7010 | ||
3033 | # define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC ((1<<10) | (1<<26)) | ||
3034 | |||
3035 | #define GEN7_L3CNTLREG1 0xB01C | ||
3036 | #define GEN7_WA_FOR_GEN7_L3_CONTROL 0x3C4FFF8C | ||
3037 | |||
3038 | #define GEN7_L3_CHICKEN_MODE_REGISTER 0xB030 | ||
3039 | #define GEN7_WA_L3_CHICKEN_MODE 0x20000000 | ||
3040 | |||
3041 | /* WaCatErrorRejectionIssue */ | ||
3042 | #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030 | ||
3043 | #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) | ||
3044 | |||
3031 | /* PCH */ | 3045 | /* PCH */ |
3032 | 3046 | ||
3033 | /* south display engine interrupt */ | 3047 | /* south display engine interrupt */ |
@@ -3618,6 +3632,7 @@ | |||
3618 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3632 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
3619 | 3633 | ||
3620 | #define GEN6_UCGCTL2 0x9404 | 3634 | #define GEN6_UCGCTL2 0x9404 |
3635 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) | ||
3621 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) | 3636 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) |
3622 | # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11) | 3637 | # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11) |
3623 | 3638 | ||
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 7886e4fb60e3..2b5eb229ff2c 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -28,14 +28,19 @@ | |||
28 | #include "drm.h" | 28 | #include "drm.h" |
29 | #include "i915_drm.h" | 29 | #include "i915_drm.h" |
30 | #include "intel_drv.h" | 30 | #include "intel_drv.h" |
31 | #include "i915_reg.h" | ||
31 | 32 | ||
32 | static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe) | 33 | static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe) |
33 | { | 34 | { |
34 | struct drm_i915_private *dev_priv = dev->dev_private; | 35 | struct drm_i915_private *dev_priv = dev->dev_private; |
35 | u32 dpll_reg; | 36 | u32 dpll_reg; |
36 | 37 | ||
38 | /* On IVB, 3rd pipe shares PLL with another one */ | ||
39 | if (pipe > 1) | ||
40 | return false; | ||
41 | |||
37 | if (HAS_PCH_SPLIT(dev)) | 42 | if (HAS_PCH_SPLIT(dev)) |
38 | dpll_reg = (pipe == PIPE_A) ? _PCH_DPLL_A : _PCH_DPLL_B; | 43 | dpll_reg = PCH_DPLL(pipe); |
39 | else | 44 | else |
40 | dpll_reg = (pipe == PIPE_A) ? _DPLL_A : _DPLL_B; | 45 | dpll_reg = (pipe == PIPE_A) ? _DPLL_A : _DPLL_B; |
41 | 46 | ||
@@ -822,7 +827,7 @@ int i915_save_state(struct drm_device *dev) | |||
822 | 827 | ||
823 | if (IS_IRONLAKE_M(dev)) | 828 | if (IS_IRONLAKE_M(dev)) |
824 | ironlake_disable_drps(dev); | 829 | ironlake_disable_drps(dev); |
825 | if (IS_GEN6(dev)) | 830 | if (INTEL_INFO(dev)->gen >= 6) |
826 | gen6_disable_rps(dev); | 831 | gen6_disable_rps(dev); |
827 | 832 | ||
828 | /* Cache mode state */ | 833 | /* Cache mode state */ |
@@ -881,7 +886,7 @@ int i915_restore_state(struct drm_device *dev) | |||
881 | intel_init_emon(dev); | 886 | intel_init_emon(dev); |
882 | } | 887 | } |
883 | 888 | ||
884 | if (IS_GEN6(dev)) { | 889 | if (INTEL_INFO(dev)->gen >= 6) { |
885 | gen6_enable_rps(dev_priv); | 890 | gen6_enable_rps(dev_priv); |
886 | gen6_update_ring_freq(dev_priv); | 891 | gen6_update_ring_freq(dev_priv); |
887 | } | 892 | } |
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h index 8af3735e27c6..dbda6e3bdf07 100644 --- a/drivers/gpu/drm/i915/intel_bios.h +++ b/drivers/gpu/drm/i915/intel_bios.h | |||
@@ -467,8 +467,12 @@ struct edp_link_params { | |||
467 | struct bdb_edp { | 467 | struct bdb_edp { |
468 | struct edp_power_seq power_seqs[16]; | 468 | struct edp_power_seq power_seqs[16]; |
469 | u32 color_depth; | 469 | u32 color_depth; |
470 | u32 sdrrs_msa_timing_delay; | ||
471 | struct edp_link_params link_params[16]; | 470 | struct edp_link_params link_params[16]; |
471 | u32 sdrrs_msa_timing_delay; | ||
472 | |||
473 | /* ith bit indicates enabled/disabled for (i+1)th panel */ | ||
474 | u16 edp_s3d_feature; | ||
475 | u16 edp_t3_optimization; | ||
472 | } __attribute__ ((packed)); | 476 | } __attribute__ ((packed)); |
473 | 477 | ||
474 | void intel_setup_bios(struct drm_device *dev); | 478 | void intel_setup_bios(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index fee0ad02c6d0..dd729d46a61f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * Eric Anholt <eric@anholt.net> | 24 | * Eric Anholt <eric@anholt.net> |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/dmi.h> | ||
27 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include "drmP.h" | 30 | #include "drmP.h" |
@@ -540,6 +541,24 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { | |||
540 | .destroy = intel_encoder_destroy, | 541 | .destroy = intel_encoder_destroy, |
541 | }; | 542 | }; |
542 | 543 | ||
544 | static int __init intel_no_crt_dmi_callback(const struct dmi_system_id *id) | ||
545 | { | ||
546 | DRM_DEBUG_KMS("Skipping CRT initialization for %s\n", id->ident); | ||
547 | return 1; | ||
548 | } | ||
549 | |||
550 | static const struct dmi_system_id intel_no_crt[] = { | ||
551 | { | ||
552 | .callback = intel_no_crt_dmi_callback, | ||
553 | .ident = "ACER ZGB", | ||
554 | .matches = { | ||
555 | DMI_MATCH(DMI_SYS_VENDOR, "ACER"), | ||
556 | DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"), | ||
557 | }, | ||
558 | }, | ||
559 | { } | ||
560 | }; | ||
561 | |||
543 | void intel_crt_init(struct drm_device *dev) | 562 | void intel_crt_init(struct drm_device *dev) |
544 | { | 563 | { |
545 | struct drm_connector *connector; | 564 | struct drm_connector *connector; |
@@ -547,6 +566,10 @@ void intel_crt_init(struct drm_device *dev) | |||
547 | struct intel_connector *intel_connector; | 566 | struct intel_connector *intel_connector; |
548 | struct drm_i915_private *dev_priv = dev->dev_private; | 567 | struct drm_i915_private *dev_priv = dev->dev_private; |
549 | 568 | ||
569 | /* Skip machines without VGA that falsely report hotplug events */ | ||
570 | if (dmi_check_system(intel_no_crt)) | ||
571 | return; | ||
572 | |||
550 | crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL); | 573 | crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL); |
551 | if (!crt) | 574 | if (!crt) |
552 | return; | 575 | return; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2a3f707caab8..f851db7be2cc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1872,7 +1872,7 @@ static void intel_update_fbc(struct drm_device *dev) | |||
1872 | if (enable_fbc < 0) { | 1872 | if (enable_fbc < 0) { |
1873 | DRM_DEBUG_KMS("fbc set to per-chip default\n"); | 1873 | DRM_DEBUG_KMS("fbc set to per-chip default\n"); |
1874 | enable_fbc = 1; | 1874 | enable_fbc = 1; |
1875 | if (INTEL_INFO(dev)->gen <= 5) | 1875 | if (INTEL_INFO(dev)->gen <= 6) |
1876 | enable_fbc = 0; | 1876 | enable_fbc = 0; |
1877 | } | 1877 | } |
1878 | if (!enable_fbc) { | 1878 | if (!enable_fbc) { |
@@ -4680,8 +4680,17 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane, | |||
4680 | 4680 | ||
4681 | crtc = intel_get_crtc_for_plane(dev, plane); | 4681 | crtc = intel_get_crtc_for_plane(dev, plane); |
4682 | clock = crtc->mode.clock; | 4682 | clock = crtc->mode.clock; |
4683 | if (!clock) { | ||
4684 | *sprite_wm = 0; | ||
4685 | return false; | ||
4686 | } | ||
4683 | 4687 | ||
4684 | line_time_us = (sprite_width * 1000) / clock; | 4688 | line_time_us = (sprite_width * 1000) / clock; |
4689 | if (!line_time_us) { | ||
4690 | *sprite_wm = 0; | ||
4691 | return false; | ||
4692 | } | ||
4693 | |||
4685 | line_count = (latency_ns / line_time_us + 1000) / 1000; | 4694 | line_count = (latency_ns / line_time_us + 1000) / 1000; |
4686 | line_size = sprite_width * pixel_size; | 4695 | line_size = sprite_width * pixel_size; |
4687 | 4696 | ||
@@ -5307,6 +5316,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
5307 | } | 5316 | } |
5308 | } | 5317 | } |
5309 | 5318 | ||
5319 | pipeconf &= ~PIPECONF_INTERLACE_MASK; | ||
5310 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { | 5320 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { |
5311 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; | 5321 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; |
5312 | /* the chip adds 2 halflines automatically */ | 5322 | /* the chip adds 2 halflines automatically */ |
@@ -5317,7 +5327,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
5317 | adjusted_mode->crtc_vsync_end -= 1; | 5327 | adjusted_mode->crtc_vsync_end -= 1; |
5318 | adjusted_mode->crtc_vsync_start -= 1; | 5328 | adjusted_mode->crtc_vsync_start -= 1; |
5319 | } else | 5329 | } else |
5320 | pipeconf &= ~PIPECONF_INTERLACE_MASK; /* progressive */ | 5330 | pipeconf |= PIPECONF_PROGRESSIVE; |
5321 | 5331 | ||
5322 | I915_WRITE(HTOTAL(pipe), | 5332 | I915_WRITE(HTOTAL(pipe), |
5323 | (adjusted_mode->crtc_hdisplay - 1) | | 5333 | (adjusted_mode->crtc_hdisplay - 1) | |
@@ -5808,12 +5818,15 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5808 | if (is_lvds) { | 5818 | if (is_lvds) { |
5809 | temp = I915_READ(PCH_LVDS); | 5819 | temp = I915_READ(PCH_LVDS); |
5810 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; | 5820 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; |
5811 | if (HAS_PCH_CPT(dev)) | 5821 | if (HAS_PCH_CPT(dev)) { |
5822 | temp &= ~PORT_TRANS_SEL_MASK; | ||
5812 | temp |= PORT_TRANS_SEL_CPT(pipe); | 5823 | temp |= PORT_TRANS_SEL_CPT(pipe); |
5813 | else if (pipe == 1) | 5824 | } else { |
5814 | temp |= LVDS_PIPEB_SELECT; | 5825 | if (pipe == 1) |
5815 | else | 5826 | temp |= LVDS_PIPEB_SELECT; |
5816 | temp &= ~LVDS_PIPEB_SELECT; | 5827 | else |
5828 | temp &= ~LVDS_PIPEB_SELECT; | ||
5829 | } | ||
5817 | 5830 | ||
5818 | /* set the corresponsding LVDS_BORDER bit */ | 5831 | /* set the corresponsding LVDS_BORDER bit */ |
5819 | temp |= dev_priv->lvds_border_bits; | 5832 | temp |= dev_priv->lvds_border_bits; |
@@ -5899,6 +5912,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5899 | } | 5912 | } |
5900 | } | 5913 | } |
5901 | 5914 | ||
5915 | pipeconf &= ~PIPECONF_INTERLACE_MASK; | ||
5902 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { | 5916 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { |
5903 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; | 5917 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; |
5904 | /* the chip adds 2 halflines automatically */ | 5918 | /* the chip adds 2 halflines automatically */ |
@@ -5909,7 +5923,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5909 | adjusted_mode->crtc_vsync_end -= 1; | 5923 | adjusted_mode->crtc_vsync_end -= 1; |
5910 | adjusted_mode->crtc_vsync_start -= 1; | 5924 | adjusted_mode->crtc_vsync_start -= 1; |
5911 | } else | 5925 | } else |
5912 | pipeconf &= ~PIPECONF_INTERLACE_W_FIELD_INDICATION; /* progressive */ | 5926 | pipeconf |= PIPECONF_PROGRESSIVE; |
5913 | 5927 | ||
5914 | I915_WRITE(HTOTAL(pipe), | 5928 | I915_WRITE(HTOTAL(pipe), |
5915 | (adjusted_mode->crtc_hdisplay - 1) | | 5929 | (adjusted_mode->crtc_hdisplay - 1) | |
@@ -6170,7 +6184,7 @@ void intel_crtc_load_lut(struct drm_crtc *crtc) | |||
6170 | int i; | 6184 | int i; |
6171 | 6185 | ||
6172 | /* The clocks have to be on to load the palette. */ | 6186 | /* The clocks have to be on to load the palette. */ |
6173 | if (!crtc->enabled) | 6187 | if (!crtc->enabled || !intel_crtc->active) |
6174 | return; | 6188 | return; |
6175 | 6189 | ||
6176 | /* use legacy palette for Ironlake */ | 6190 | /* use legacy palette for Ironlake */ |
@@ -6556,7 +6570,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, | |||
6556 | mode_cmd.height = mode->vdisplay; | 6570 | mode_cmd.height = mode->vdisplay; |
6557 | mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width, | 6571 | mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width, |
6558 | bpp); | 6572 | bpp); |
6559 | mode_cmd.pixel_format = 0; | 6573 | mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth); |
6560 | 6574 | ||
6561 | return intel_framebuffer_create(dev, &mode_cmd, obj); | 6575 | return intel_framebuffer_create(dev, &mode_cmd, obj); |
6562 | } | 6576 | } |
@@ -8179,8 +8193,8 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
8179 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ | 8193 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
8180 | 8194 | ||
8181 | if (intel_enable_rc6(dev_priv->dev)) | 8195 | if (intel_enable_rc6(dev_priv->dev)) |
8182 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | | 8196 | rc6_mask = GEN6_RC_CTL_RC6_ENABLE | |
8183 | GEN6_RC_CTL_RC6_ENABLE; | 8197 | ((IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0); |
8184 | 8198 | ||
8185 | I915_WRITE(GEN6_RC_CONTROL, | 8199 | I915_WRITE(GEN6_RC_CONTROL, |
8186 | rc6_mask | | 8200 | rc6_mask | |
@@ -8458,12 +8472,32 @@ static void ivybridge_init_clock_gating(struct drm_device *dev) | |||
8458 | I915_WRITE(WM2_LP_ILK, 0); | 8472 | I915_WRITE(WM2_LP_ILK, 0); |
8459 | I915_WRITE(WM1_LP_ILK, 0); | 8473 | I915_WRITE(WM1_LP_ILK, 0); |
8460 | 8474 | ||
8475 | /* According to the spec, bit 13 (RCZUNIT) must be set on IVB. | ||
8476 | * This implements the WaDisableRCZUnitClockGating workaround. | ||
8477 | */ | ||
8478 | I915_WRITE(GEN6_UCGCTL2, GEN6_RCZUNIT_CLOCK_GATE_DISABLE); | ||
8479 | |||
8461 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); | 8480 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); |
8462 | 8481 | ||
8463 | I915_WRITE(IVB_CHICKEN3, | 8482 | I915_WRITE(IVB_CHICKEN3, |
8464 | CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | | 8483 | CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
8465 | CHICKEN3_DGMG_DONE_FIX_DISABLE); | 8484 | CHICKEN3_DGMG_DONE_FIX_DISABLE); |
8466 | 8485 | ||
8486 | /* Apply the WaDisableRHWOOptimizationForRenderHang workaround. */ | ||
8487 | I915_WRITE(GEN7_COMMON_SLICE_CHICKEN1, | ||
8488 | GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC); | ||
8489 | |||
8490 | /* WaApplyL3ControlAndL3ChickenMode requires those two on Ivy Bridge */ | ||
8491 | I915_WRITE(GEN7_L3CNTLREG1, | ||
8492 | GEN7_WA_FOR_GEN7_L3_CONTROL); | ||
8493 | I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, | ||
8494 | GEN7_WA_L3_CHICKEN_MODE); | ||
8495 | |||
8496 | /* This is required by WaCatErrorRejectionIssue */ | ||
8497 | I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, | ||
8498 | I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | | ||
8499 | GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); | ||
8500 | |||
8467 | for_each_pipe(pipe) { | 8501 | for_each_pipe(pipe) { |
8468 | I915_WRITE(DSPCNTR(pipe), | 8502 | I915_WRITE(DSPCNTR(pipe), |
8469 | I915_READ(DSPCNTR(pipe)) | | 8503 | I915_READ(DSPCNTR(pipe)) | |
@@ -9025,12 +9059,9 @@ void intel_modeset_init(struct drm_device *dev) | |||
9025 | 9059 | ||
9026 | for (i = 0; i < dev_priv->num_pipe; i++) { | 9060 | for (i = 0; i < dev_priv->num_pipe; i++) { |
9027 | intel_crtc_init(dev, i); | 9061 | intel_crtc_init(dev, i); |
9028 | if (HAS_PCH_SPLIT(dev)) { | 9062 | ret = intel_plane_init(dev, i); |
9029 | ret = intel_plane_init(dev, i); | 9063 | if (ret) |
9030 | if (ret) | 9064 | DRM_DEBUG_KMS("plane %d init failed: %d\n", i, ret); |
9031 | DRM_ERROR("plane %d init failed: %d\n", | ||
9032 | i, ret); | ||
9033 | } | ||
9034 | } | 9065 | } |
9035 | 9066 | ||
9036 | /* Just disable it once at startup */ | 9067 | /* Just disable it once at startup */ |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index db3b461ad412..94f860cce3f7 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -208,17 +208,8 @@ intel_dp_link_clock(uint8_t link_bw) | |||
208 | */ | 208 | */ |
209 | 209 | ||
210 | static int | 210 | static int |
211 | intel_dp_link_required(struct intel_dp *intel_dp, int pixel_clock, int check_bpp) | 211 | intel_dp_link_required(int pixel_clock, int bpp) |
212 | { | 212 | { |
213 | struct drm_crtc *crtc = intel_dp->base.base.crtc; | ||
214 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
215 | int bpp = 24; | ||
216 | |||
217 | if (check_bpp) | ||
218 | bpp = check_bpp; | ||
219 | else if (intel_crtc) | ||
220 | bpp = intel_crtc->bpp; | ||
221 | |||
222 | return (pixel_clock * bpp + 9) / 10; | 213 | return (pixel_clock * bpp + 9) / 10; |
223 | } | 214 | } |
224 | 215 | ||
@@ -245,12 +236,11 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
245 | return MODE_PANEL; | 236 | return MODE_PANEL; |
246 | } | 237 | } |
247 | 238 | ||
248 | mode_rate = intel_dp_link_required(intel_dp, mode->clock, 0); | 239 | mode_rate = intel_dp_link_required(mode->clock, 24); |
249 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | 240 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); |
250 | 241 | ||
251 | if (mode_rate > max_rate) { | 242 | if (mode_rate > max_rate) { |
252 | mode_rate = intel_dp_link_required(intel_dp, | 243 | mode_rate = intel_dp_link_required(mode->clock, 18); |
253 | mode->clock, 18); | ||
254 | if (mode_rate > max_rate) | 244 | if (mode_rate > max_rate) |
255 | return MODE_CLOCK_HIGH; | 245 | return MODE_CLOCK_HIGH; |
256 | else | 246 | else |
@@ -683,7 +673,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
683 | int lane_count, clock; | 673 | int lane_count, clock; |
684 | int max_lane_count = intel_dp_max_lane_count(intel_dp); | 674 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
685 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 675 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
686 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 0; | 676 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; |
687 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 677 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
688 | 678 | ||
689 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 679 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
@@ -701,7 +691,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
701 | for (clock = 0; clock <= max_clock; clock++) { | 691 | for (clock = 0; clock <= max_clock; clock++) { |
702 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 692 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
703 | 693 | ||
704 | if (intel_dp_link_required(intel_dp, mode->clock, bpp) | 694 | if (intel_dp_link_required(mode->clock, bpp) |
705 | <= link_avail) { | 695 | <= link_avail) { |
706 | intel_dp->link_bw = bws[clock]; | 696 | intel_dp->link_bw = bws[clock]; |
707 | intel_dp->lane_count = lane_count; | 697 | intel_dp->lane_count = lane_count; |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index e44191132ac4..aa84832b0e1a 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -694,6 +694,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
694 | }, | 694 | }, |
695 | { | 695 | { |
696 | .callback = intel_no_lvds_dmi_callback, | 696 | .callback = intel_no_lvds_dmi_callback, |
697 | .ident = "AOpen i45GMx-I", | ||
698 | .matches = { | ||
699 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | ||
700 | DMI_MATCH(DMI_BOARD_NAME, "i45GMx-I"), | ||
701 | }, | ||
702 | }, | ||
703 | { | ||
704 | .callback = intel_no_lvds_dmi_callback, | ||
697 | .ident = "Aopen i945GTt-VFA", | 705 | .ident = "Aopen i945GTt-VFA", |
698 | .matches = { | 706 | .matches = { |
699 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), | 707 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), |
@@ -708,6 +716,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
708 | }, | 716 | }, |
709 | }, | 717 | }, |
710 | { | 718 | { |
719 | .callback = intel_no_lvds_dmi_callback, | ||
720 | .ident = "Clientron E830", | ||
721 | .matches = { | ||
722 | DMI_MATCH(DMI_SYS_VENDOR, "Clientron"), | ||
723 | DMI_MATCH(DMI_PRODUCT_NAME, "E830"), | ||
724 | }, | ||
725 | }, | ||
726 | { | ||
711 | .callback = intel_no_lvds_dmi_callback, | 727 | .callback = intel_no_lvds_dmi_callback, |
712 | .ident = "Asus EeeBox PC EB1007", | 728 | .ident = "Asus EeeBox PC EB1007", |
713 | .matches = { | 729 | .matches = { |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 77e729d4e4f0..536191540b03 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -301,7 +301,7 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
301 | 301 | ||
302 | I915_WRITE_CTL(ring, | 302 | I915_WRITE_CTL(ring, |
303 | ((ring->size - PAGE_SIZE) & RING_NR_PAGES) | 303 | ((ring->size - PAGE_SIZE) & RING_NR_PAGES) |
304 | | RING_REPORT_64K | RING_VALID); | 304 | | RING_VALID); |
305 | 305 | ||
306 | /* If the head is still not zero, the ring is dead */ | 306 | /* If the head is still not zero, the ring is dead */ |
307 | if ((I915_READ_CTL(ring) & RING_VALID) == 0 || | 307 | if ((I915_READ_CTL(ring) & RING_VALID) == 0 || |
@@ -636,6 +636,19 @@ render_ring_add_request(struct intel_ring_buffer *ring, | |||
636 | } | 636 | } |
637 | 637 | ||
638 | static u32 | 638 | static u32 |
639 | gen6_ring_get_seqno(struct intel_ring_buffer *ring) | ||
640 | { | ||
641 | struct drm_device *dev = ring->dev; | ||
642 | |||
643 | /* Workaround to force correct ordering between irq and seqno writes on | ||
644 | * ivb (and maybe also on snb) by reading from a CS register (like | ||
645 | * ACTHD) before reading the status page. */ | ||
646 | if (IS_GEN7(dev)) | ||
647 | intel_ring_get_active_head(ring); | ||
648 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); | ||
649 | } | ||
650 | |||
651 | static u32 | ||
639 | ring_get_seqno(struct intel_ring_buffer *ring) | 652 | ring_get_seqno(struct intel_ring_buffer *ring) |
640 | { | 653 | { |
641 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); | 654 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); |
@@ -792,17 +805,6 @@ ring_add_request(struct intel_ring_buffer *ring, | |||
792 | } | 805 | } |
793 | 806 | ||
794 | static bool | 807 | static bool |
795 | gen7_blt_ring_get_irq(struct intel_ring_buffer *ring) | ||
796 | { | ||
797 | /* The BLT ring on IVB appears to have broken synchronization | ||
798 | * between the seqno write and the interrupt, so that the | ||
799 | * interrupt appears first. Returning false here makes | ||
800 | * i915_wait_request() do a polling loop, instead. | ||
801 | */ | ||
802 | return false; | ||
803 | } | ||
804 | |||
805 | static bool | ||
806 | gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | 808 | gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) |
807 | { | 809 | { |
808 | struct drm_device *dev = ring->dev; | 810 | struct drm_device *dev = ring->dev; |
@@ -811,6 +813,12 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | |||
811 | if (!dev->irq_enabled) | 813 | if (!dev->irq_enabled) |
812 | return false; | 814 | return false; |
813 | 815 | ||
816 | /* It looks like we need to prevent the gt from suspending while waiting | ||
817 | * for an notifiy irq, otherwise irqs seem to get lost on at least the | ||
818 | * blt/bsd rings on ivb. */ | ||
819 | if (IS_GEN7(dev)) | ||
820 | gen6_gt_force_wake_get(dev_priv); | ||
821 | |||
814 | spin_lock(&ring->irq_lock); | 822 | spin_lock(&ring->irq_lock); |
815 | if (ring->irq_refcount++ == 0) { | 823 | if (ring->irq_refcount++ == 0) { |
816 | ring->irq_mask &= ~rflag; | 824 | ring->irq_mask &= ~rflag; |
@@ -835,6 +843,9 @@ gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | |||
835 | ironlake_disable_irq(dev_priv, gflag); | 843 | ironlake_disable_irq(dev_priv, gflag); |
836 | } | 844 | } |
837 | spin_unlock(&ring->irq_lock); | 845 | spin_unlock(&ring->irq_lock); |
846 | |||
847 | if (IS_GEN7(dev)) | ||
848 | gen6_gt_force_wake_put(dev_priv); | ||
838 | } | 849 | } |
839 | 850 | ||
840 | static bool | 851 | static bool |
@@ -1121,18 +1132,6 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) | |||
1121 | struct drm_device *dev = ring->dev; | 1132 | struct drm_device *dev = ring->dev; |
1122 | struct drm_i915_private *dev_priv = dev->dev_private; | 1133 | struct drm_i915_private *dev_priv = dev->dev_private; |
1123 | unsigned long end; | 1134 | unsigned long end; |
1124 | u32 head; | ||
1125 | |||
1126 | /* If the reported head position has wrapped or hasn't advanced, | ||
1127 | * fallback to the slow and accurate path. | ||
1128 | */ | ||
1129 | head = intel_read_status_page(ring, 4); | ||
1130 | if (head > ring->head) { | ||
1131 | ring->head = head; | ||
1132 | ring->space = ring_space(ring); | ||
1133 | if (ring->space >= n) | ||
1134 | return 0; | ||
1135 | } | ||
1136 | 1135 | ||
1137 | trace_i915_ring_wait_begin(ring); | 1136 | trace_i915_ring_wait_begin(ring); |
1138 | if (drm_core_check_feature(dev, DRIVER_GEM)) | 1137 | if (drm_core_check_feature(dev, DRIVER_GEM)) |
@@ -1341,7 +1340,7 @@ static const struct intel_ring_buffer gen6_bsd_ring = { | |||
1341 | .write_tail = gen6_bsd_ring_write_tail, | 1340 | .write_tail = gen6_bsd_ring_write_tail, |
1342 | .flush = gen6_ring_flush, | 1341 | .flush = gen6_ring_flush, |
1343 | .add_request = gen6_add_request, | 1342 | .add_request = gen6_add_request, |
1344 | .get_seqno = ring_get_seqno, | 1343 | .get_seqno = gen6_ring_get_seqno, |
1345 | .irq_get = gen6_bsd_ring_get_irq, | 1344 | .irq_get = gen6_bsd_ring_get_irq, |
1346 | .irq_put = gen6_bsd_ring_put_irq, | 1345 | .irq_put = gen6_bsd_ring_put_irq, |
1347 | .dispatch_execbuffer = gen6_ring_dispatch_execbuffer, | 1346 | .dispatch_execbuffer = gen6_ring_dispatch_execbuffer, |
@@ -1476,7 +1475,7 @@ static const struct intel_ring_buffer gen6_blt_ring = { | |||
1476 | .write_tail = ring_write_tail, | 1475 | .write_tail = ring_write_tail, |
1477 | .flush = blt_ring_flush, | 1476 | .flush = blt_ring_flush, |
1478 | .add_request = gen6_add_request, | 1477 | .add_request = gen6_add_request, |
1479 | .get_seqno = ring_get_seqno, | 1478 | .get_seqno = gen6_ring_get_seqno, |
1480 | .irq_get = blt_ring_get_irq, | 1479 | .irq_get = blt_ring_get_irq, |
1481 | .irq_put = blt_ring_put_irq, | 1480 | .irq_put = blt_ring_put_irq, |
1482 | .dispatch_execbuffer = gen6_ring_dispatch_execbuffer, | 1481 | .dispatch_execbuffer = gen6_ring_dispatch_execbuffer, |
@@ -1499,6 +1498,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) | |||
1499 | ring->flush = gen6_render_ring_flush; | 1498 | ring->flush = gen6_render_ring_flush; |
1500 | ring->irq_get = gen6_render_ring_get_irq; | 1499 | ring->irq_get = gen6_render_ring_get_irq; |
1501 | ring->irq_put = gen6_render_ring_put_irq; | 1500 | ring->irq_put = gen6_render_ring_put_irq; |
1501 | ring->get_seqno = gen6_ring_get_seqno; | ||
1502 | } else if (IS_GEN5(dev)) { | 1502 | } else if (IS_GEN5(dev)) { |
1503 | ring->add_request = pc_render_add_request; | 1503 | ring->add_request = pc_render_add_request; |
1504 | ring->get_seqno = pc_render_get_seqno; | 1504 | ring->get_seqno = pc_render_get_seqno; |
@@ -1577,8 +1577,5 @@ int intel_init_blt_ring_buffer(struct drm_device *dev) | |||
1577 | 1577 | ||
1578 | *ring = gen6_blt_ring; | 1578 | *ring = gen6_blt_ring; |
1579 | 1579 | ||
1580 | if (IS_GEN7(dev)) | ||
1581 | ring->irq_get = gen7_blt_ring_get_irq; | ||
1582 | |||
1583 | return intel_init_ring_buffer(dev, ring); | 1580 | return intel_init_ring_buffer(dev, ring); |
1584 | } | 1581 | } |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index f7b9268df266..e334ec33a47d 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1066,15 +1066,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1066 | 1066 | ||
1067 | /* Set the SDVO control regs. */ | 1067 | /* Set the SDVO control regs. */ |
1068 | if (INTEL_INFO(dev)->gen >= 4) { | 1068 | if (INTEL_INFO(dev)->gen >= 4) { |
1069 | sdvox = 0; | 1069 | /* The real mode polarity is set by the SDVO commands, using |
1070 | * struct intel_sdvo_dtd. */ | ||
1071 | sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; | ||
1070 | if (intel_sdvo->is_hdmi) | 1072 | if (intel_sdvo->is_hdmi) |
1071 | sdvox |= intel_sdvo->color_range; | 1073 | sdvox |= intel_sdvo->color_range; |
1072 | if (INTEL_INFO(dev)->gen < 5) | 1074 | if (INTEL_INFO(dev)->gen < 5) |
1073 | sdvox |= SDVO_BORDER_ENABLE; | 1075 | sdvox |= SDVO_BORDER_ENABLE; |
1074 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | ||
1075 | sdvox |= SDVO_VSYNC_ACTIVE_HIGH; | ||
1076 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | ||
1077 | sdvox |= SDVO_HSYNC_ACTIVE_HIGH; | ||
1078 | } else { | 1076 | } else { |
1079 | sdvox = I915_READ(intel_sdvo->sdvo_reg); | 1077 | sdvox = I915_READ(intel_sdvo->sdvo_reg); |
1080 | switch (intel_sdvo->sdvo_reg) { | 1078 | switch (intel_sdvo->sdvo_reg) { |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index d13989fda501..2288abf88cce 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -466,10 +466,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
466 | mutex_lock(&dev->struct_mutex); | 466 | mutex_lock(&dev->struct_mutex); |
467 | 467 | ||
468 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); | 468 | ret = intel_pin_and_fence_fb_obj(dev, obj, NULL); |
469 | if (ret) { | 469 | if (ret) |
470 | DRM_ERROR("failed to pin object\n"); | ||
471 | goto out_unlock; | 470 | goto out_unlock; |
472 | } | ||
473 | 471 | ||
474 | intel_plane->obj = obj; | 472 | intel_plane->obj = obj; |
475 | 473 | ||
@@ -632,10 +630,8 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) | |||
632 | unsigned long possible_crtcs; | 630 | unsigned long possible_crtcs; |
633 | int ret; | 631 | int ret; |
634 | 632 | ||
635 | if (!(IS_GEN6(dev) || IS_GEN7(dev))) { | 633 | if (!(IS_GEN6(dev) || IS_GEN7(dev))) |
636 | DRM_ERROR("new plane code only for SNB+\n"); | ||
637 | return -ENODEV; | 634 | return -ENODEV; |
638 | } | ||
639 | 635 | ||
640 | intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL); | 636 | intel_plane = kzalloc(sizeof(struct intel_plane), GFP_KERNEL); |
641 | if (!intel_plane) | 637 | if (!intel_plane) |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index f3c6a9a8b081..1571be37ce3e 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -417,7 +417,7 @@ static const struct tv_mode tv_modes[] = { | |||
417 | { | 417 | { |
418 | .name = "NTSC-M", | 418 | .name = "NTSC-M", |
419 | .clock = 108000, | 419 | .clock = 108000, |
420 | .refresh = 29970, | 420 | .refresh = 59940, |
421 | .oversample = TV_OVERSAMPLE_8X, | 421 | .oversample = TV_OVERSAMPLE_8X, |
422 | .component_only = 0, | 422 | .component_only = 0, |
423 | /* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */ | 423 | /* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */ |
@@ -460,7 +460,7 @@ static const struct tv_mode tv_modes[] = { | |||
460 | { | 460 | { |
461 | .name = "NTSC-443", | 461 | .name = "NTSC-443", |
462 | .clock = 108000, | 462 | .clock = 108000, |
463 | .refresh = 29970, | 463 | .refresh = 59940, |
464 | .oversample = TV_OVERSAMPLE_8X, | 464 | .oversample = TV_OVERSAMPLE_8X, |
465 | .component_only = 0, | 465 | .component_only = 0, |
466 | /* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 4.43MHz */ | 466 | /* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 4.43MHz */ |
@@ -502,7 +502,7 @@ static const struct tv_mode tv_modes[] = { | |||
502 | { | 502 | { |
503 | .name = "NTSC-J", | 503 | .name = "NTSC-J", |
504 | .clock = 108000, | 504 | .clock = 108000, |
505 | .refresh = 29970, | 505 | .refresh = 59940, |
506 | .oversample = TV_OVERSAMPLE_8X, | 506 | .oversample = TV_OVERSAMPLE_8X, |
507 | .component_only = 0, | 507 | .component_only = 0, |
508 | 508 | ||
@@ -545,7 +545,7 @@ static const struct tv_mode tv_modes[] = { | |||
545 | { | 545 | { |
546 | .name = "PAL-M", | 546 | .name = "PAL-M", |
547 | .clock = 108000, | 547 | .clock = 108000, |
548 | .refresh = 29970, | 548 | .refresh = 59940, |
549 | .oversample = TV_OVERSAMPLE_8X, | 549 | .oversample = TV_OVERSAMPLE_8X, |
550 | .component_only = 0, | 550 | .component_only = 0, |
551 | 551 | ||
@@ -589,7 +589,7 @@ static const struct tv_mode tv_modes[] = { | |||
589 | /* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */ | 589 | /* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */ |
590 | .name = "PAL-N", | 590 | .name = "PAL-N", |
591 | .clock = 108000, | 591 | .clock = 108000, |
592 | .refresh = 25000, | 592 | .refresh = 50000, |
593 | .oversample = TV_OVERSAMPLE_8X, | 593 | .oversample = TV_OVERSAMPLE_8X, |
594 | .component_only = 0, | 594 | .component_only = 0, |
595 | 595 | ||
@@ -634,7 +634,7 @@ static const struct tv_mode tv_modes[] = { | |||
634 | /* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */ | 634 | /* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */ |
635 | .name = "PAL", | 635 | .name = "PAL", |
636 | .clock = 108000, | 636 | .clock = 108000, |
637 | .refresh = 25000, | 637 | .refresh = 50000, |
638 | .oversample = TV_OVERSAMPLE_8X, | 638 | .oversample = TV_OVERSAMPLE_8X, |
639 | .component_only = 0, | 639 | .component_only = 0, |
640 | 640 | ||
@@ -674,78 +674,6 @@ static const struct tv_mode tv_modes[] = { | |||
674 | .filter_table = filter_table, | 674 | .filter_table = filter_table, |
675 | }, | 675 | }, |
676 | { | 676 | { |
677 | .name = "480p@59.94Hz", | ||
678 | .clock = 107520, | ||
679 | .refresh = 59940, | ||
680 | .oversample = TV_OVERSAMPLE_4X, | ||
681 | .component_only = 1, | ||
682 | |||
683 | .hsync_end = 64, .hblank_end = 122, | ||
684 | .hblank_start = 842, .htotal = 857, | ||
685 | |||
686 | .progressive = true, .trilevel_sync = false, | ||
687 | |||
688 | .vsync_start_f1 = 12, .vsync_start_f2 = 12, | ||
689 | .vsync_len = 12, | ||
690 | |||
691 | .veq_ena = false, | ||
692 | |||
693 | .vi_end_f1 = 44, .vi_end_f2 = 44, | ||
694 | .nbr_end = 479, | ||
695 | |||
696 | .burst_ena = false, | ||
697 | |||
698 | .filter_table = filter_table, | ||
699 | }, | ||
700 | { | ||
701 | .name = "480p@60Hz", | ||
702 | .clock = 107520, | ||
703 | .refresh = 60000, | ||
704 | .oversample = TV_OVERSAMPLE_4X, | ||
705 | .component_only = 1, | ||
706 | |||
707 | .hsync_end = 64, .hblank_end = 122, | ||
708 | .hblank_start = 842, .htotal = 856, | ||
709 | |||
710 | .progressive = true, .trilevel_sync = false, | ||
711 | |||
712 | .vsync_start_f1 = 12, .vsync_start_f2 = 12, | ||
713 | .vsync_len = 12, | ||
714 | |||
715 | .veq_ena = false, | ||
716 | |||
717 | .vi_end_f1 = 44, .vi_end_f2 = 44, | ||
718 | .nbr_end = 479, | ||
719 | |||
720 | .burst_ena = false, | ||
721 | |||
722 | .filter_table = filter_table, | ||
723 | }, | ||
724 | { | ||
725 | .name = "576p", | ||
726 | .clock = 107520, | ||
727 | .refresh = 50000, | ||
728 | .oversample = TV_OVERSAMPLE_4X, | ||
729 | .component_only = 1, | ||
730 | |||
731 | .hsync_end = 64, .hblank_end = 139, | ||
732 | .hblank_start = 859, .htotal = 863, | ||
733 | |||
734 | .progressive = true, .trilevel_sync = false, | ||
735 | |||
736 | .vsync_start_f1 = 10, .vsync_start_f2 = 10, | ||
737 | .vsync_len = 10, | ||
738 | |||
739 | .veq_ena = false, | ||
740 | |||
741 | .vi_end_f1 = 48, .vi_end_f2 = 48, | ||
742 | .nbr_end = 575, | ||
743 | |||
744 | .burst_ena = false, | ||
745 | |||
746 | .filter_table = filter_table, | ||
747 | }, | ||
748 | { | ||
749 | .name = "720p@60Hz", | 677 | .name = "720p@60Hz", |
750 | .clock = 148800, | 678 | .clock = 148800, |
751 | .refresh = 60000, | 679 | .refresh = 60000, |
@@ -770,30 +698,6 @@ static const struct tv_mode tv_modes[] = { | |||
770 | .filter_table = filter_table, | 698 | .filter_table = filter_table, |
771 | }, | 699 | }, |
772 | { | 700 | { |
773 | .name = "720p@59.94Hz", | ||
774 | .clock = 148800, | ||
775 | .refresh = 59940, | ||
776 | .oversample = TV_OVERSAMPLE_2X, | ||
777 | .component_only = 1, | ||
778 | |||
779 | .hsync_end = 80, .hblank_end = 300, | ||
780 | .hblank_start = 1580, .htotal = 1651, | ||
781 | |||
782 | .progressive = true, .trilevel_sync = true, | ||
783 | |||
784 | .vsync_start_f1 = 10, .vsync_start_f2 = 10, | ||
785 | .vsync_len = 10, | ||
786 | |||
787 | .veq_ena = false, | ||
788 | |||
789 | .vi_end_f1 = 29, .vi_end_f2 = 29, | ||
790 | .nbr_end = 719, | ||
791 | |||
792 | .burst_ena = false, | ||
793 | |||
794 | .filter_table = filter_table, | ||
795 | }, | ||
796 | { | ||
797 | .name = "720p@50Hz", | 701 | .name = "720p@50Hz", |
798 | .clock = 148800, | 702 | .clock = 148800, |
799 | .refresh = 50000, | 703 | .refresh = 50000, |
@@ -821,7 +725,7 @@ static const struct tv_mode tv_modes[] = { | |||
821 | { | 725 | { |
822 | .name = "1080i@50Hz", | 726 | .name = "1080i@50Hz", |
823 | .clock = 148800, | 727 | .clock = 148800, |
824 | .refresh = 25000, | 728 | .refresh = 50000, |
825 | .oversample = TV_OVERSAMPLE_2X, | 729 | .oversample = TV_OVERSAMPLE_2X, |
826 | .component_only = 1, | 730 | .component_only = 1, |
827 | 731 | ||
@@ -847,7 +751,7 @@ static const struct tv_mode tv_modes[] = { | |||
847 | { | 751 | { |
848 | .name = "1080i@60Hz", | 752 | .name = "1080i@60Hz", |
849 | .clock = 148800, | 753 | .clock = 148800, |
850 | .refresh = 30000, | 754 | .refresh = 60000, |
851 | .oversample = TV_OVERSAMPLE_2X, | 755 | .oversample = TV_OVERSAMPLE_2X, |
852 | .component_only = 1, | 756 | .component_only = 1, |
853 | 757 | ||
@@ -870,32 +774,6 @@ static const struct tv_mode tv_modes[] = { | |||
870 | 774 | ||
871 | .filter_table = filter_table, | 775 | .filter_table = filter_table, |
872 | }, | 776 | }, |
873 | { | ||
874 | .name = "1080i@59.94Hz", | ||
875 | .clock = 148800, | ||
876 | .refresh = 29970, | ||
877 | .oversample = TV_OVERSAMPLE_2X, | ||
878 | .component_only = 1, | ||
879 | |||
880 | .hsync_end = 88, .hblank_end = 235, | ||
881 | .hblank_start = 2155, .htotal = 2201, | ||
882 | |||
883 | .progressive = false, .trilevel_sync = true, | ||
884 | |||
885 | .vsync_start_f1 = 4, .vsync_start_f2 = 5, | ||
886 | .vsync_len = 10, | ||
887 | |||
888 | .veq_ena = true, .veq_start_f1 = 4, | ||
889 | .veq_start_f2 = 4, .veq_len = 10, | ||
890 | |||
891 | |||
892 | .vi_end_f1 = 21, .vi_end_f2 = 22, | ||
893 | .nbr_end = 539, | ||
894 | |||
895 | .burst_ena = false, | ||
896 | |||
897 | .filter_table = filter_table, | ||
898 | }, | ||
899 | }; | 777 | }; |
900 | 778 | ||
901 | static struct intel_tv *enc_to_intel_tv(struct drm_encoder *encoder) | 779 | static struct intel_tv *enc_to_intel_tv(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index 1e382ad5a2b8..a37c31e358aa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
@@ -54,9 +54,10 @@ struct bit_entry { | |||
54 | int bit_table(struct drm_device *, u8 id, struct bit_entry *); | 54 | int bit_table(struct drm_device *, u8 id, struct bit_entry *); |
55 | 55 | ||
56 | enum dcb_gpio_tag { | 56 | enum dcb_gpio_tag { |
57 | DCB_GPIO_TVDAC0 = 0xc, | 57 | DCB_GPIO_PANEL_POWER = 0x01, |
58 | DCB_GPIO_TVDAC0 = 0x0c, | ||
58 | DCB_GPIO_TVDAC1 = 0x2d, | 59 | DCB_GPIO_TVDAC1 = 0x2d, |
59 | DCB_GPIO_PWM_FAN = 0x9, | 60 | DCB_GPIO_PWM_FAN = 0x09, |
60 | DCB_GPIO_FAN_SENSE = 0x3d, | 61 | DCB_GPIO_FAN_SENSE = 0x3d, |
61 | DCB_GPIO_UNUSED = 0xff | 62 | DCB_GPIO_UNUSED = 0xff |
62 | }; | 63 | }; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 3cb52bc52b21..795a9e3c990a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -219,6 +219,16 @@ nouveau_display_init(struct drm_device *dev) | |||
219 | if (ret) | 219 | if (ret) |
220 | return ret; | 220 | return ret; |
221 | 221 | ||
222 | /* power on internal panel if it's not already. the init tables of | ||
223 | * some vbios default this to off for some reason, causing the | ||
224 | * panel to not work after resume | ||
225 | */ | ||
226 | if (nouveau_gpio_func_get(dev, DCB_GPIO_PANEL_POWER) == 0) { | ||
227 | nouveau_gpio_func_set(dev, DCB_GPIO_PANEL_POWER, true); | ||
228 | msleep(300); | ||
229 | } | ||
230 | |||
231 | /* enable polling for external displays */ | ||
222 | drm_kms_helper_poll_enable(dev); | 232 | drm_kms_helper_poll_enable(dev); |
223 | 233 | ||
224 | /* enable hotplug interrupts */ | 234 | /* enable hotplug interrupts */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index e4a7cfe7898d..81d7962e7252 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(ctxfw, "Use external HUB/GPC ucode (fermi)\n"); | |||
124 | int nouveau_ctxfw; | 124 | int nouveau_ctxfw; |
125 | module_param_named(ctxfw, nouveau_ctxfw, int, 0400); | 125 | module_param_named(ctxfw, nouveau_ctxfw, int, 0400); |
126 | 126 | ||
127 | MODULE_PARM_DESC(ctxfw, "Santise DCB table according to MXM-SIS\n"); | 127 | MODULE_PARM_DESC(mxmdcb, "Santise DCB table according to MXM-SIS\n"); |
128 | int nouveau_mxmdcb = 1; | 128 | int nouveau_mxmdcb = 1; |
129 | module_param_named(mxmdcb, nouveau_mxmdcb, int, 0400); | 129 | module_param_named(mxmdcb, nouveau_mxmdcb, int, 0400); |
130 | 130 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 5f0bc57fdaab..7ce3fde40743 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -380,6 +380,25 @@ retry: | |||
380 | } | 380 | } |
381 | 381 | ||
382 | static int | 382 | static int |
383 | validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo) | ||
384 | { | ||
385 | struct nouveau_fence *fence = NULL; | ||
386 | int ret = 0; | ||
387 | |||
388 | spin_lock(&nvbo->bo.bdev->fence_lock); | ||
389 | if (nvbo->bo.sync_obj) | ||
390 | fence = nouveau_fence_ref(nvbo->bo.sync_obj); | ||
391 | spin_unlock(&nvbo->bo.bdev->fence_lock); | ||
392 | |||
393 | if (fence) { | ||
394 | ret = nouveau_fence_sync(fence, chan); | ||
395 | nouveau_fence_unref(&fence); | ||
396 | } | ||
397 | |||
398 | return ret; | ||
399 | } | ||
400 | |||
401 | static int | ||
383 | validate_list(struct nouveau_channel *chan, struct list_head *list, | 402 | validate_list(struct nouveau_channel *chan, struct list_head *list, |
384 | struct drm_nouveau_gem_pushbuf_bo *pbbo, uint64_t user_pbbo_ptr) | 403 | struct drm_nouveau_gem_pushbuf_bo *pbbo, uint64_t user_pbbo_ptr) |
385 | { | 404 | { |
@@ -393,7 +412,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list, | |||
393 | list_for_each_entry(nvbo, list, entry) { | 412 | list_for_each_entry(nvbo, list, entry) { |
394 | struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; | 413 | struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; |
395 | 414 | ||
396 | ret = nouveau_fence_sync(nvbo->bo.sync_obj, chan); | 415 | ret = validate_sync(chan, nvbo); |
397 | if (unlikely(ret)) { | 416 | if (unlikely(ret)) { |
398 | NV_ERROR(dev, "fail pre-validate sync\n"); | 417 | NV_ERROR(dev, "fail pre-validate sync\n"); |
399 | return ret; | 418 | return ret; |
@@ -416,7 +435,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list, | |||
416 | return ret; | 435 | return ret; |
417 | } | 436 | } |
418 | 437 | ||
419 | ret = nouveau_fence_sync(nvbo->bo.sync_obj, chan); | 438 | ret = validate_sync(chan, nvbo); |
420 | if (unlikely(ret)) { | 439 | if (unlikely(ret)) { |
421 | NV_ERROR(dev, "fail post-validate sync\n"); | 440 | NV_ERROR(dev, "fail post-validate sync\n"); |
422 | return ret; | 441 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mxm.c b/drivers/gpu/drm/nouveau/nouveau_mxm.c index 8bccddf4eff0..e5a64f0f4cb7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mxm.c +++ b/drivers/gpu/drm/nouveau/nouveau_mxm.c | |||
@@ -656,7 +656,16 @@ nouveau_mxm_init(struct drm_device *dev) | |||
656 | 656 | ||
657 | if (mxm_shadow(dev, mxm[0])) { | 657 | if (mxm_shadow(dev, mxm[0])) { |
658 | MXM_MSG(dev, "failed to locate valid SIS\n"); | 658 | MXM_MSG(dev, "failed to locate valid SIS\n"); |
659 | #if 0 | ||
660 | /* we should, perhaps, fall back to some kind of limited | ||
661 | * mode here if the x86 vbios hasn't already done the | ||
662 | * work for us (so we prevent loading with completely | ||
663 | * whacked vbios tables). | ||
664 | */ | ||
659 | return -EINVAL; | 665 | return -EINVAL; |
666 | #else | ||
667 | return 0; | ||
668 | #endif | ||
660 | } | 669 | } |
661 | 670 | ||
662 | MXM_MSG(dev, "MXMS Version %d.%d\n", | 671 | MXM_MSG(dev, "MXMS Version %d.%d\n", |
diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c index 03937212e9d8..ec5481dfcd82 100644 --- a/drivers/gpu/drm/nouveau/nv50_pm.c +++ b/drivers/gpu/drm/nouveau/nv50_pm.c | |||
@@ -495,9 +495,9 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl) | |||
495 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 495 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
496 | struct nv50_pm_state *info; | 496 | struct nv50_pm_state *info; |
497 | struct pll_lims pll; | 497 | struct pll_lims pll; |
498 | int ret = -EINVAL; | 498 | int clk, ret = -EINVAL; |
499 | int N, M, P1, P2; | 499 | int N, M, P1, P2; |
500 | u32 clk, out; | 500 | u32 out; |
501 | 501 | ||
502 | if (dev_priv->chipset == 0xaa || | 502 | if (dev_priv->chipset == 0xaa || |
503 | dev_priv->chipset == 0xac) | 503 | dev_priv->chipset == 0xac) |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 891935271d34..742f17f009a9 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1184,7 +1184,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1184 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); | 1184 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); |
1185 | 1185 | ||
1186 | WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, | 1186 | WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, |
1187 | crtc->mode.vdisplay); | 1187 | target_fb->height); |
1188 | x &= ~3; | 1188 | x &= ~3; |
1189 | y &= ~1; | 1189 | y &= ~1; |
1190 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, | 1190 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, |
@@ -1353,7 +1353,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1353 | WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); | 1353 | WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); |
1354 | 1354 | ||
1355 | WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, | 1355 | WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, |
1356 | crtc->mode.vdisplay); | 1356 | target_fb->height); |
1357 | x &= ~3; | 1357 | x &= ~3; |
1358 | y &= ~1; | 1358 | y &= ~1; |
1359 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, | 1359 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index a71557ce01dc..552b436451fd 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -564,9 +564,21 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder, | |||
564 | ENCODER_OBJECT_ID_NUTMEG) | 564 | ENCODER_OBJECT_ID_NUTMEG) |
565 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; | 565 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; |
566 | else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == | 566 | else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == |
567 | ENCODER_OBJECT_ID_TRAVIS) | 567 | ENCODER_OBJECT_ID_TRAVIS) { |
568 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 568 | u8 id[6]; |
569 | else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 569 | int i; |
570 | for (i = 0; i < 6; i++) | ||
571 | id[i] = radeon_read_dpcd_reg(radeon_connector, 0x503 + i); | ||
572 | if (id[0] == 0x73 && | ||
573 | id[1] == 0x69 && | ||
574 | id[2] == 0x76 && | ||
575 | id[3] == 0x61 && | ||
576 | id[4] == 0x72 && | ||
577 | id[5] == 0x54) | ||
578 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; | ||
579 | else | ||
580 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | ||
581 | } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
570 | u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); | 582 | u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); |
571 | if (tmp & 1) | 583 | if (tmp & 1) |
572 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 584 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index ae09fe82afbc..f58254a3fb01 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -3191,6 +3191,7 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
3191 | if (r) { | 3191 | if (r) { |
3192 | DRM_ERROR("radeon: failed testing IB (%d).\n", r); | 3192 | DRM_ERROR("radeon: failed testing IB (%d).\n", r); |
3193 | rdev->accel_working = false; | 3193 | rdev->accel_working = false; |
3194 | return r; | ||
3194 | } | 3195 | } |
3195 | 3196 | ||
3196 | r = r600_audio_init(rdev); | 3197 | r = r600_audio_init(rdev); |
@@ -3222,6 +3223,7 @@ int evergreen_resume(struct radeon_device *rdev) | |||
3222 | r = evergreen_startup(rdev); | 3223 | r = evergreen_startup(rdev); |
3223 | if (r) { | 3224 | if (r) { |
3224 | DRM_ERROR("evergreen startup failed on resume\n"); | 3225 | DRM_ERROR("evergreen startup failed on resume\n"); |
3226 | rdev->accel_working = false; | ||
3225 | return r; | 3227 | return r; |
3226 | } | 3228 | } |
3227 | 3229 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index db09065e68fd..2509c505acb8 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1547,6 +1547,7 @@ int cayman_resume(struct radeon_device *rdev) | |||
1547 | r = cayman_startup(rdev); | 1547 | r = cayman_startup(rdev); |
1548 | if (r) { | 1548 | if (r) { |
1549 | DRM_ERROR("cayman startup failed on resume\n"); | 1549 | DRM_ERROR("cayman startup failed on resume\n"); |
1550 | rdev->accel_working = false; | ||
1550 | return r; | 1551 | return r; |
1551 | } | 1552 | } |
1552 | return r; | 1553 | return r; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index bfd36ab643a6..333cde9d4e7b 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -789,9 +789,7 @@ int r100_irq_process(struct radeon_device *rdev) | |||
789 | WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM); | 789 | WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM); |
790 | break; | 790 | break; |
791 | default: | 791 | default: |
792 | msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; | 792 | WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN); |
793 | WREG32(RADEON_MSI_REARM_EN, msi_rearm); | ||
794 | WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN); | ||
795 | break; | 793 | break; |
796 | } | 794 | } |
797 | } | 795 | } |
@@ -3930,6 +3928,8 @@ static int r100_startup(struct radeon_device *rdev) | |||
3930 | 3928 | ||
3931 | int r100_resume(struct radeon_device *rdev) | 3929 | int r100_resume(struct radeon_device *rdev) |
3932 | { | 3930 | { |
3931 | int r; | ||
3932 | |||
3933 | /* Make sur GART are not working */ | 3933 | /* Make sur GART are not working */ |
3934 | if (rdev->flags & RADEON_IS_PCI) | 3934 | if (rdev->flags & RADEON_IS_PCI) |
3935 | r100_pci_gart_disable(rdev); | 3935 | r100_pci_gart_disable(rdev); |
@@ -3949,7 +3949,11 @@ int r100_resume(struct radeon_device *rdev) | |||
3949 | radeon_surface_init(rdev); | 3949 | radeon_surface_init(rdev); |
3950 | 3950 | ||
3951 | rdev->accel_working = true; | 3951 | rdev->accel_working = true; |
3952 | return r100_startup(rdev); | 3952 | r = r100_startup(rdev); |
3953 | if (r) { | ||
3954 | rdev->accel_working = false; | ||
3955 | } | ||
3956 | return r; | ||
3953 | } | 3957 | } |
3954 | 3958 | ||
3955 | int r100_suspend(struct radeon_device *rdev) | 3959 | int r100_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 3fc0d29a5f39..6829638cca40 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -1431,6 +1431,8 @@ static int r300_startup(struct radeon_device *rdev) | |||
1431 | 1431 | ||
1432 | int r300_resume(struct radeon_device *rdev) | 1432 | int r300_resume(struct radeon_device *rdev) |
1433 | { | 1433 | { |
1434 | int r; | ||
1435 | |||
1434 | /* Make sur GART are not working */ | 1436 | /* Make sur GART are not working */ |
1435 | if (rdev->flags & RADEON_IS_PCIE) | 1437 | if (rdev->flags & RADEON_IS_PCIE) |
1436 | rv370_pcie_gart_disable(rdev); | 1438 | rv370_pcie_gart_disable(rdev); |
@@ -1452,7 +1454,11 @@ int r300_resume(struct radeon_device *rdev) | |||
1452 | radeon_surface_init(rdev); | 1454 | radeon_surface_init(rdev); |
1453 | 1455 | ||
1454 | rdev->accel_working = true; | 1456 | rdev->accel_working = true; |
1455 | return r300_startup(rdev); | 1457 | r = r300_startup(rdev); |
1458 | if (r) { | ||
1459 | rdev->accel_working = false; | ||
1460 | } | ||
1461 | return r; | ||
1456 | } | 1462 | } |
1457 | 1463 | ||
1458 | int r300_suspend(struct radeon_device *rdev) | 1464 | int r300_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 666e28fe509c..b14323053bad 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -291,6 +291,8 @@ static int r420_startup(struct radeon_device *rdev) | |||
291 | 291 | ||
292 | int r420_resume(struct radeon_device *rdev) | 292 | int r420_resume(struct radeon_device *rdev) |
293 | { | 293 | { |
294 | int r; | ||
295 | |||
294 | /* Make sur GART are not working */ | 296 | /* Make sur GART are not working */ |
295 | if (rdev->flags & RADEON_IS_PCIE) | 297 | if (rdev->flags & RADEON_IS_PCIE) |
296 | rv370_pcie_gart_disable(rdev); | 298 | rv370_pcie_gart_disable(rdev); |
@@ -316,7 +318,11 @@ int r420_resume(struct radeon_device *rdev) | |||
316 | radeon_surface_init(rdev); | 318 | radeon_surface_init(rdev); |
317 | 319 | ||
318 | rdev->accel_working = true; | 320 | rdev->accel_working = true; |
319 | return r420_startup(rdev); | 321 | r = r420_startup(rdev); |
322 | if (r) { | ||
323 | rdev->accel_working = false; | ||
324 | } | ||
325 | return r; | ||
320 | } | 326 | } |
321 | 327 | ||
322 | int r420_suspend(struct radeon_device *rdev) | 328 | int r420_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 4ae1615e752f..25084e824dbc 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -218,6 +218,8 @@ static int r520_startup(struct radeon_device *rdev) | |||
218 | 218 | ||
219 | int r520_resume(struct radeon_device *rdev) | 219 | int r520_resume(struct radeon_device *rdev) |
220 | { | 220 | { |
221 | int r; | ||
222 | |||
221 | /* Make sur GART are not working */ | 223 | /* Make sur GART are not working */ |
222 | if (rdev->flags & RADEON_IS_PCIE) | 224 | if (rdev->flags & RADEON_IS_PCIE) |
223 | rv370_pcie_gart_disable(rdev); | 225 | rv370_pcie_gart_disable(rdev); |
@@ -237,7 +239,11 @@ int r520_resume(struct radeon_device *rdev) | |||
237 | radeon_surface_init(rdev); | 239 | radeon_surface_init(rdev); |
238 | 240 | ||
239 | rdev->accel_working = true; | 241 | rdev->accel_working = true; |
240 | return r520_startup(rdev); | 242 | r = r520_startup(rdev); |
243 | if (r) { | ||
244 | rdev->accel_working = false; | ||
245 | } | ||
246 | return r; | ||
241 | } | 247 | } |
242 | 248 | ||
243 | int r520_init(struct radeon_device *rdev) | 249 | int r520_init(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 4f08e5e6ee9d..17ca72ce3027 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2362,6 +2362,9 @@ void r600_semaphore_ring_emit(struct radeon_device *rdev, | |||
2362 | uint64_t addr = semaphore->gpu_addr; | 2362 | uint64_t addr = semaphore->gpu_addr; |
2363 | unsigned sel = emit_wait ? PACKET3_SEM_SEL_WAIT : PACKET3_SEM_SEL_SIGNAL; | 2363 | unsigned sel = emit_wait ? PACKET3_SEM_SEL_WAIT : PACKET3_SEM_SEL_SIGNAL; |
2364 | 2364 | ||
2365 | if (rdev->family < CHIP_CAYMAN) | ||
2366 | sel |= PACKET3_SEM_WAIT_ON_SIGNAL; | ||
2367 | |||
2365 | radeon_ring_write(ring, PACKET3(PACKET3_MEM_SEMAPHORE, 1)); | 2368 | radeon_ring_write(ring, PACKET3(PACKET3_MEM_SEMAPHORE, 1)); |
2366 | radeon_ring_write(ring, addr & 0xffffffff); | 2369 | radeon_ring_write(ring, addr & 0xffffffff); |
2367 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); | 2370 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); |
@@ -2529,6 +2532,7 @@ int r600_resume(struct radeon_device *rdev) | |||
2529 | r = r600_startup(rdev); | 2532 | r = r600_startup(rdev); |
2530 | if (r) { | 2533 | if (r) { |
2531 | DRM_ERROR("r600 startup failed on resume\n"); | 2534 | DRM_ERROR("r600 startup failed on resume\n"); |
2535 | rdev->accel_working = false; | ||
2532 | return r; | 2536 | return r; |
2533 | } | 2537 | } |
2534 | 2538 | ||
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index d996f4381130..accc032c103f 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev) | |||
468 | radeon_ring_write(ring, sq_stack_resource_mgmt_2); | 468 | radeon_ring_write(ring, sq_stack_resource_mgmt_2); |
469 | } | 469 | } |
470 | 470 | ||
471 | #define I2F_MAX_BITS 15 | ||
472 | #define I2F_MAX_INPUT ((1 << I2F_MAX_BITS) - 1) | ||
473 | #define I2F_SHIFT (24 - I2F_MAX_BITS) | ||
474 | |||
475 | /* | ||
476 | * Converts unsigned integer into 32-bit IEEE floating point representation. | ||
477 | * Conversion is not universal and only works for the range from 0 | ||
478 | * to 2^I2F_MAX_BITS-1. Currently we only use it with inputs between | ||
479 | * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough. If necessary, | ||
480 | * I2F_MAX_BITS can be increased, but that will add to the loop iterations | ||
481 | * and slow us down. Conversion is done by shifting the input and counting | ||
482 | * down until the first 1 reaches bit position 23. The resulting counter | ||
483 | * and the shifted input are, respectively, the exponent and the fraction. | ||
484 | * The sign is always zero. | ||
485 | */ | ||
471 | static uint32_t i2f(uint32_t input) | 486 | static uint32_t i2f(uint32_t input) |
472 | { | 487 | { |
473 | u32 result, i, exponent, fraction; | 488 | u32 result, i, exponent, fraction; |
474 | 489 | ||
475 | if ((input & 0x3fff) == 0) | 490 | WARN_ON_ONCE(input > I2F_MAX_INPUT); |
476 | result = 0; /* 0 is a special case */ | 491 | |
492 | if ((input & I2F_MAX_INPUT) == 0) | ||
493 | result = 0; | ||
477 | else { | 494 | else { |
478 | exponent = 140; /* exponent biased by 127; */ | 495 | exponent = 126 + I2F_MAX_BITS; |
479 | fraction = (input & 0x3fff) << 10; /* cheat and only | 496 | fraction = (input & I2F_MAX_INPUT) << I2F_SHIFT; |
480 | handle numbers below 2^^15 */ | 497 | |
481 | for (i = 0; i < 14; i++) { | 498 | for (i = 0; i < I2F_MAX_BITS; i++) { |
482 | if (fraction & 0x800000) | 499 | if (fraction & 0x800000) |
483 | break; | 500 | break; |
484 | else { | 501 | else { |
485 | fraction = fraction << 1; /* keep | 502 | fraction = fraction << 1; |
486 | shifting left until top bit = 1 */ | ||
487 | exponent = exponent - 1; | 503 | exponent = exponent - 1; |
488 | } | 504 | } |
489 | } | 505 | } |
490 | result = exponent << 23 | (fraction & 0x7fffff); /* mask | 506 | result = exponent << 23 | (fraction & 0x7fffff); |
491 | off top bit; assumed 1 */ | ||
492 | } | 507 | } |
493 | return result; | 508 | return result; |
494 | } | 509 | } |
diff --git a/drivers/gpu/drm/radeon/r600_blit_shaders.c b/drivers/gpu/drm/radeon/r600_blit_shaders.c index 2d1f6c5ee2a7..73e2c7c6edbc 100644 --- a/drivers/gpu/drm/radeon/r600_blit_shaders.c +++ b/drivers/gpu/drm/radeon/r600_blit_shaders.c | |||
@@ -314,6 +314,10 @@ const u32 r6xx_default_state[] = | |||
314 | 0x00000000, /* VGT_VTX_CNT_EN */ | 314 | 0x00000000, /* VGT_VTX_CNT_EN */ |
315 | 315 | ||
316 | 0xc0016900, | 316 | 0xc0016900, |
317 | 0x000000d4, | ||
318 | 0x00000000, /* SX_MISC */ | ||
319 | |||
320 | 0xc0016900, | ||
317 | 0x000002c8, | 321 | 0x000002c8, |
318 | 0x00000000, /* VGT_STRMOUT_BUFFER_EN */ | 322 | 0x00000000, /* VGT_STRMOUT_BUFFER_EN */ |
319 | 323 | ||
@@ -626,6 +630,10 @@ const u32 r7xx_default_state[] = | |||
626 | 0x00000000, /* VGT_VTX_CNT_EN */ | 630 | 0x00000000, /* VGT_VTX_CNT_EN */ |
627 | 631 | ||
628 | 0xc0016900, | 632 | 0xc0016900, |
633 | 0x000000d4, | ||
634 | 0x00000000, /* SX_MISC */ | ||
635 | |||
636 | 0xc0016900, | ||
629 | 0x000002c8, | 637 | 0x000002c8, |
630 | 0x00000000, /* VGT_STRMOUT_BUFFER_EN */ | 638 | 0x00000000, /* VGT_STRMOUT_BUFFER_EN */ |
631 | 639 | ||
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 38ce5d0427e3..387fcc9f03ef 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, | |||
1304 | h0 = G_038004_TEX_HEIGHT(word1) + 1; | 1304 | h0 = G_038004_TEX_HEIGHT(word1) + 1; |
1305 | d0 = G_038004_TEX_DEPTH(word1); | 1305 | d0 = G_038004_TEX_DEPTH(word1); |
1306 | nfaces = 1; | 1306 | nfaces = 1; |
1307 | array = 0; | ||
1307 | switch (G_038000_DIM(word0)) { | 1308 | switch (G_038000_DIM(word0)) { |
1308 | case V_038000_SQ_TEX_DIM_1D: | 1309 | case V_038000_SQ_TEX_DIM_1D: |
1309 | case V_038000_SQ_TEX_DIM_2D: | 1310 | case V_038000_SQ_TEX_DIM_2D: |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 3ee1fd7ef394..9b23670716f1 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -831,6 +831,7 @@ | |||
831 | #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34 | 831 | #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34 |
832 | #define PACKET3_INDIRECT_BUFFER_MP 0x38 | 832 | #define PACKET3_INDIRECT_BUFFER_MP 0x38 |
833 | #define PACKET3_MEM_SEMAPHORE 0x39 | 833 | #define PACKET3_MEM_SEMAPHORE 0x39 |
834 | # define PACKET3_SEM_WAIT_ON_SIGNAL (0x1 << 12) | ||
834 | # define PACKET3_SEM_SEL_SIGNAL (0x6 << 29) | 835 | # define PACKET3_SEM_SEL_SIGNAL (0x6 << 29) |
835 | # define PACKET3_SEM_SEL_WAIT (0x7 << 29) | 836 | # define PACKET3_SEM_SEL_WAIT (0x7 << 29) |
836 | #define PACKET3_MPEG_INDEX 0x3A | 837 | #define PACKET3_MPEG_INDEX 0x3A |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 5082d17d14dc..1f53ae74ada1 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -2931,6 +2931,20 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector, | |||
2931 | bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5; | 2931 | bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5; |
2932 | } | 2932 | } |
2933 | } | 2933 | } |
2934 | if ((radeon_encoder->devices & ATOM_DEVICE_DFP6_SUPPORT) && | ||
2935 | (radeon_connector->devices & ATOM_DEVICE_DFP6_SUPPORT)) { | ||
2936 | if (connected) { | ||
2937 | DRM_DEBUG_KMS("DFP6 connected\n"); | ||
2938 | bios_0_scratch |= ATOM_S0_DFP6; | ||
2939 | bios_3_scratch |= ATOM_S3_DFP6_ACTIVE; | ||
2940 | bios_6_scratch |= ATOM_S6_ACC_REQ_DFP6; | ||
2941 | } else { | ||
2942 | DRM_DEBUG_KMS("DFP6 disconnected\n"); | ||
2943 | bios_0_scratch &= ~ATOM_S0_DFP6; | ||
2944 | bios_3_scratch &= ~ATOM_S3_DFP6_ACTIVE; | ||
2945 | bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP6; | ||
2946 | } | ||
2947 | } | ||
2934 | 2948 | ||
2935 | if (rdev->family >= CHIP_R600) { | 2949 | if (rdev->family >= CHIP_R600) { |
2936 | WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch); | 2950 | WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch); |
@@ -2951,6 +2965,9 @@ radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc) | |||
2951 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 2965 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
2952 | uint32_t bios_3_scratch; | 2966 | uint32_t bios_3_scratch; |
2953 | 2967 | ||
2968 | if (ASIC_IS_DCE4(rdev)) | ||
2969 | return; | ||
2970 | |||
2954 | if (rdev->family >= CHIP_R600) | 2971 | if (rdev->family >= CHIP_R600) |
2955 | bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH); | 2972 | bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH); |
2956 | else | 2973 | else |
@@ -3003,6 +3020,9 @@ radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on) | |||
3003 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 3020 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
3004 | uint32_t bios_2_scratch; | 3021 | uint32_t bios_2_scratch; |
3005 | 3022 | ||
3023 | if (ASIC_IS_DCE4(rdev)) | ||
3024 | return; | ||
3025 | |||
3006 | if (rdev->family >= CHIP_R600) | 3026 | if (rdev->family >= CHIP_R600) |
3007 | bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH); | 3027 | bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH); |
3008 | else | 3028 | else |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 13ac63ba6075..98724fcb0088 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -59,8 +59,9 @@ static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, | |||
59 | 59 | ||
60 | obj = (union acpi_object *)buffer.pointer; | 60 | obj = (union acpi_object *)buffer.pointer; |
61 | memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); | 61 | memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); |
62 | len = obj->buffer.length; | ||
62 | kfree(buffer.pointer); | 63 | kfree(buffer.pointer); |
63 | return obj->buffer.length; | 64 | return len; |
64 | } | 65 | } |
65 | 66 | ||
66 | bool radeon_atrm_supported(struct pci_dev *pdev) | 67 | bool radeon_atrm_supported(struct pci_dev *pdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index e7cb3ab09243..8c9a8115b632 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1057,7 +1057,7 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector, | |||
1057 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) | 1057 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) |
1058 | return MODE_OK; | 1058 | return MODE_OK; |
1059 | else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) { | 1059 | else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) { |
1060 | if (ASIC_IS_DCE3(rdev)) { | 1060 | if (0) { |
1061 | /* HDMI 1.3+ supports max clock of 340 Mhz */ | 1061 | /* HDMI 1.3+ supports max clock of 340 Mhz */ |
1062 | if (mode->clock > 340000) | 1062 | if (mode->clock > 340000) |
1063 | return MODE_CLOCK_HIGH; | 1063 | return MODE_CLOCK_HIGH; |
@@ -1117,13 +1117,23 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1117 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { | 1117 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { |
1118 | struct drm_display_mode *mode; | 1118 | struct drm_display_mode *mode; |
1119 | 1119 | ||
1120 | if (!radeon_dig_connector->edp_on) | 1120 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
1121 | atombios_set_edp_panel_power(connector, | 1121 | if (!radeon_dig_connector->edp_on) |
1122 | ATOM_TRANSMITTER_ACTION_POWER_ON); | 1122 | atombios_set_edp_panel_power(connector, |
1123 | ret = radeon_ddc_get_modes(radeon_connector); | 1123 | ATOM_TRANSMITTER_ACTION_POWER_ON); |
1124 | if (!radeon_dig_connector->edp_on) | 1124 | ret = radeon_ddc_get_modes(radeon_connector); |
1125 | atombios_set_edp_panel_power(connector, | 1125 | if (!radeon_dig_connector->edp_on) |
1126 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | 1126 | atombios_set_edp_panel_power(connector, |
1127 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
1128 | } else { | ||
1129 | /* need to setup ddc on the bridge */ | ||
1130 | if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) != | ||
1131 | ENCODER_OBJECT_ID_NONE) { | ||
1132 | if (encoder) | ||
1133 | radeon_atom_ext_encoder_setup_ddc(encoder); | ||
1134 | } | ||
1135 | ret = radeon_ddc_get_modes(radeon_connector); | ||
1136 | } | ||
1127 | 1137 | ||
1128 | if (ret > 0) { | 1138 | if (ret > 0) { |
1129 | if (encoder) { | 1139 | if (encoder) { |
@@ -1134,7 +1144,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1134 | return ret; | 1144 | return ret; |
1135 | } | 1145 | } |
1136 | 1146 | ||
1137 | encoder = radeon_best_single_encoder(connector); | ||
1138 | if (!encoder) | 1147 | if (!encoder) |
1139 | return 0; | 1148 | return 0; |
1140 | 1149 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 435a3d970ab8..e64bec488ed8 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -453,6 +453,10 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
453 | int r; | 453 | int r; |
454 | 454 | ||
455 | radeon_mutex_lock(&rdev->cs_mutex); | 455 | radeon_mutex_lock(&rdev->cs_mutex); |
456 | if (!rdev->accel_working) { | ||
457 | radeon_mutex_unlock(&rdev->cs_mutex); | ||
458 | return -EBUSY; | ||
459 | } | ||
456 | /* initialize parser */ | 460 | /* initialize parser */ |
457 | memset(&parser, 0, sizeof(struct radeon_cs_parser)); | 461 | memset(&parser, 0, sizeof(struct radeon_cs_parser)); |
458 | parser.filp = filp; | 462 | parser.filp = filp; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index cec51a5b69dd..49f7cb7e226b 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -883,6 +883,8 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
883 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 883 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
884 | return 0; | 884 | return 0; |
885 | 885 | ||
886 | drm_kms_helper_poll_disable(dev); | ||
887 | |||
886 | /* turn off display hw */ | 888 | /* turn off display hw */ |
887 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 889 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
888 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); | 890 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
@@ -972,6 +974,8 @@ int radeon_resume_kms(struct drm_device *dev) | |||
972 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 974 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
973 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); | 975 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
974 | } | 976 | } |
977 | |||
978 | drm_kms_helper_poll_enable(dev); | ||
975 | return 0; | 979 | return 0; |
976 | } | 980 | } |
977 | 981 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8c49fef1ce78..3d314338d843 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -1078,15 +1078,21 @@ static const struct drm_framebuffer_funcs radeon_fb_funcs = { | |||
1078 | .create_handle = radeon_user_framebuffer_create_handle, | 1078 | .create_handle = radeon_user_framebuffer_create_handle, |
1079 | }; | 1079 | }; |
1080 | 1080 | ||
1081 | void | 1081 | int |
1082 | radeon_framebuffer_init(struct drm_device *dev, | 1082 | radeon_framebuffer_init(struct drm_device *dev, |
1083 | struct radeon_framebuffer *rfb, | 1083 | struct radeon_framebuffer *rfb, |
1084 | struct drm_mode_fb_cmd2 *mode_cmd, | 1084 | struct drm_mode_fb_cmd2 *mode_cmd, |
1085 | struct drm_gem_object *obj) | 1085 | struct drm_gem_object *obj) |
1086 | { | 1086 | { |
1087 | int ret; | ||
1087 | rfb->obj = obj; | 1088 | rfb->obj = obj; |
1088 | drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs); | 1089 | ret = drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs); |
1090 | if (ret) { | ||
1091 | rfb->obj = NULL; | ||
1092 | return ret; | ||
1093 | } | ||
1089 | drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); | 1094 | drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); |
1095 | return 0; | ||
1090 | } | 1096 | } |
1091 | 1097 | ||
1092 | static struct drm_framebuffer * | 1098 | static struct drm_framebuffer * |
@@ -1096,6 +1102,7 @@ radeon_user_framebuffer_create(struct drm_device *dev, | |||
1096 | { | 1102 | { |
1097 | struct drm_gem_object *obj; | 1103 | struct drm_gem_object *obj; |
1098 | struct radeon_framebuffer *radeon_fb; | 1104 | struct radeon_framebuffer *radeon_fb; |
1105 | int ret; | ||
1099 | 1106 | ||
1100 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); | 1107 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); |
1101 | if (obj == NULL) { | 1108 | if (obj == NULL) { |
@@ -1108,7 +1115,12 @@ radeon_user_framebuffer_create(struct drm_device *dev, | |||
1108 | if (radeon_fb == NULL) | 1115 | if (radeon_fb == NULL) |
1109 | return ERR_PTR(-ENOMEM); | 1116 | return ERR_PTR(-ENOMEM); |
1110 | 1117 | ||
1111 | radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); | 1118 | ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); |
1119 | if (ret) { | ||
1120 | kfree(radeon_fb); | ||
1121 | drm_gem_object_unreference_unlocked(obj); | ||
1122 | return NULL; | ||
1123 | } | ||
1112 | 1124 | ||
1113 | return &radeon_fb->base; | 1125 | return &radeon_fb->base; |
1114 | } | 1126 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 9419c51bcf50..26e92708d114 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -307,8 +307,6 @@ void radeon_panel_mode_fixup(struct drm_encoder *encoder, | |||
307 | bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder, | 307 | bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder, |
308 | u32 pixel_clock) | 308 | u32 pixel_clock) |
309 | { | 309 | { |
310 | struct drm_device *dev = encoder->dev; | ||
311 | struct radeon_device *rdev = dev->dev_private; | ||
312 | struct drm_connector *connector; | 310 | struct drm_connector *connector; |
313 | struct radeon_connector *radeon_connector; | 311 | struct radeon_connector *radeon_connector; |
314 | struct radeon_connector_atom_dig *dig_connector; | 312 | struct radeon_connector_atom_dig *dig_connector; |
@@ -326,7 +324,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder, | |||
326 | case DRM_MODE_CONNECTOR_HDMIB: | 324 | case DRM_MODE_CONNECTOR_HDMIB: |
327 | if (radeon_connector->use_digital) { | 325 | if (radeon_connector->use_digital) { |
328 | /* HDMI 1.3 supports up to 340 Mhz over single link */ | 326 | /* HDMI 1.3 supports up to 340 Mhz over single link */ |
329 | if (ASIC_IS_DCE3(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { | 327 | if (0 && drm_detect_hdmi_monitor(radeon_connector->edid)) { |
330 | if (pixel_clock > 340000) | 328 | if (pixel_clock > 340000) |
331 | return true; | 329 | return true; |
332 | else | 330 | else |
@@ -348,7 +346,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder, | |||
348 | return false; | 346 | return false; |
349 | else { | 347 | else { |
350 | /* HDMI 1.3 supports up to 340 Mhz over single link */ | 348 | /* HDMI 1.3 supports up to 340 Mhz over single link */ |
351 | if (ASIC_IS_DCE3(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { | 349 | if (0 && drm_detect_hdmi_monitor(radeon_connector->edid)) { |
352 | if (pixel_clock > 340000) | 350 | if (pixel_clock > 340000) |
353 | return true; | 351 | return true; |
354 | else | 352 | else |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index cf2bf35b56b8..195471cf65d3 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -209,6 +209,11 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev, | |||
209 | sizes->surface_depth); | 209 | sizes->surface_depth); |
210 | 210 | ||
211 | ret = radeonfb_create_pinned_object(rfbdev, &mode_cmd, &gobj); | 211 | ret = radeonfb_create_pinned_object(rfbdev, &mode_cmd, &gobj); |
212 | if (ret) { | ||
213 | DRM_ERROR("failed to create fbcon object %d\n", ret); | ||
214 | return ret; | ||
215 | } | ||
216 | |||
212 | rbo = gem_to_radeon_bo(gobj); | 217 | rbo = gem_to_radeon_bo(gobj); |
213 | 218 | ||
214 | /* okay we have an object now allocate the framebuffer */ | 219 | /* okay we have an object now allocate the framebuffer */ |
@@ -220,7 +225,11 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev, | |||
220 | 225 | ||
221 | info->par = rfbdev; | 226 | info->par = rfbdev; |
222 | 227 | ||
223 | radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); | 228 | ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); |
229 | if (ret) { | ||
230 | DRM_ERROR("failed to initalise framebuffer %d\n", ret); | ||
231 | goto out_unref; | ||
232 | } | ||
224 | 233 | ||
225 | fb = &rfbdev->rfb.base; | 234 | fb = &rfbdev->rfb.base; |
226 | 235 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 64ea3dd9e6ff..4bd36a354fbe 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -364,8 +364,10 @@ int radeon_fence_count_emitted(struct radeon_device *rdev, int ring) | |||
364 | int not_processed = 0; | 364 | int not_processed = 0; |
365 | 365 | ||
366 | read_lock_irqsave(&rdev->fence_lock, irq_flags); | 366 | read_lock_irqsave(&rdev->fence_lock, irq_flags); |
367 | if (!rdev->fence_drv[ring].initialized) | 367 | if (!rdev->fence_drv[ring].initialized) { |
368 | read_unlock_irqrestore(&rdev->fence_lock, irq_flags); | ||
368 | return 0; | 369 | return 0; |
370 | } | ||
369 | 371 | ||
370 | if (!list_empty(&rdev->fence_drv[ring].emitted)) { | 372 | if (!list_empty(&rdev->fence_drv[ring].emitted)) { |
371 | struct list_head *ptr; | 373 | struct list_head *ptr; |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 010dad8b66ae..c58a036233fb 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -597,13 +597,13 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
597 | if (bo_va == NULL) | 597 | if (bo_va == NULL) |
598 | return 0; | 598 | return 0; |
599 | 599 | ||
600 | list_del(&bo_va->bo_list); | ||
601 | mutex_lock(&vm->mutex); | 600 | mutex_lock(&vm->mutex); |
602 | radeon_mutex_lock(&rdev->cs_mutex); | 601 | radeon_mutex_lock(&rdev->cs_mutex); |
603 | radeon_vm_bo_update_pte(rdev, vm, bo, NULL); | 602 | radeon_vm_bo_update_pte(rdev, vm, bo, NULL); |
604 | radeon_mutex_unlock(&rdev->cs_mutex); | 603 | radeon_mutex_unlock(&rdev->cs_mutex); |
605 | list_del(&bo_va->vm_list); | 604 | list_del(&bo_va->vm_list); |
606 | mutex_unlock(&vm->mutex); | 605 | mutex_unlock(&vm->mutex); |
606 | list_del(&bo_va->bo_list); | ||
607 | 607 | ||
608 | kfree(bo_va); | 608 | kfree(bo_va); |
609 | return 0; | 609 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 7bb1b079f480..98a8ad680109 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -897,6 +897,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
897 | i2c->rec = *rec; | 897 | i2c->rec = *rec; |
898 | i2c->adapter.owner = THIS_MODULE; | 898 | i2c->adapter.owner = THIS_MODULE; |
899 | i2c->adapter.class = I2C_CLASS_DDC; | 899 | i2c->adapter.class = I2C_CLASS_DDC; |
900 | i2c->adapter.dev.parent = &dev->pdev->dev; | ||
900 | i2c->dev = dev; | 901 | i2c->dev = dev; |
901 | i2c_set_adapdata(&i2c->adapter, i2c); | 902 | i2c_set_adapdata(&i2c->adapter, i2c); |
902 | if (rec->mm_i2c || | 903 | if (rec->mm_i2c || |
@@ -957,6 +958,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | |||
957 | i2c->rec = *rec; | 958 | i2c->rec = *rec; |
958 | i2c->adapter.owner = THIS_MODULE; | 959 | i2c->adapter.owner = THIS_MODULE; |
959 | i2c->adapter.class = I2C_CLASS_DDC; | 960 | i2c->adapter.class = I2C_CLASS_DDC; |
961 | i2c->adapter.dev.parent = &dev->pdev->dev; | ||
960 | i2c->dev = dev; | 962 | i2c->dev = dev; |
961 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), | 963 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
962 | "Radeon aux bus %s", name); | 964 | "Radeon aux bus %s", name); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 4330e3253573..8a85598fb242 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -649,7 +649,7 @@ extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, | |||
649 | u16 blue, int regno); | 649 | u16 blue, int regno); |
650 | extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | 650 | extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, |
651 | u16 *blue, int regno); | 651 | u16 *blue, int regno); |
652 | void radeon_framebuffer_init(struct drm_device *dev, | 652 | int radeon_framebuffer_init(struct drm_device *dev, |
653 | struct radeon_framebuffer *rfb, | 653 | struct radeon_framebuffer *rfb, |
654 | struct drm_mode_fb_cmd2 *mode_cmd, | 654 | struct drm_mode_fb_cmd2 *mode_cmd, |
655 | struct drm_gem_object *obj); | 655 | struct drm_gem_object *obj); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 30a4c5014c8b..92c9ea4751fb 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -500,8 +500,11 @@ static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32]; | |||
500 | int radeon_debugfs_ring_init(struct radeon_device *rdev) | 500 | int radeon_debugfs_ring_init(struct radeon_device *rdev) |
501 | { | 501 | { |
502 | #if defined(CONFIG_DEBUG_FS) | 502 | #if defined(CONFIG_DEBUG_FS) |
503 | return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, | 503 | if (rdev->family >= CHIP_CAYMAN) |
504 | ARRAY_SIZE(radeon_debugfs_ring_info_list)); | 504 | return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, |
505 | ARRAY_SIZE(radeon_debugfs_ring_info_list)); | ||
506 | else | ||
507 | return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, 1); | ||
505 | #else | 508 | #else |
506 | return 0; | 509 | return 0; |
507 | #endif | 510 | #endif |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index b0ce84a20a68..866a05be75f2 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -442,6 +442,8 @@ static int rs400_startup(struct radeon_device *rdev) | |||
442 | 442 | ||
443 | int rs400_resume(struct radeon_device *rdev) | 443 | int rs400_resume(struct radeon_device *rdev) |
444 | { | 444 | { |
445 | int r; | ||
446 | |||
445 | /* Make sur GART are not working */ | 447 | /* Make sur GART are not working */ |
446 | rs400_gart_disable(rdev); | 448 | rs400_gart_disable(rdev); |
447 | /* Resume clock before doing reset */ | 449 | /* Resume clock before doing reset */ |
@@ -462,7 +464,11 @@ int rs400_resume(struct radeon_device *rdev) | |||
462 | radeon_surface_init(rdev); | 464 | radeon_surface_init(rdev); |
463 | 465 | ||
464 | rdev->accel_working = true; | 466 | rdev->accel_working = true; |
465 | return rs400_startup(rdev); | 467 | r = rs400_startup(rdev); |
468 | if (r) { | ||
469 | rdev->accel_working = false; | ||
470 | } | ||
471 | return r; | ||
466 | } | 472 | } |
467 | 473 | ||
468 | int rs400_suspend(struct radeon_device *rdev) | 474 | int rs400_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index ec46eb45e34c..4fc700684dcd 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -684,9 +684,7 @@ int rs600_irq_process(struct radeon_device *rdev) | |||
684 | WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM); | 684 | WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM); |
685 | break; | 685 | break; |
686 | default: | 686 | default: |
687 | msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; | 687 | WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN); |
688 | WREG32(RADEON_MSI_REARM_EN, msi_rearm); | ||
689 | WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN); | ||
690 | break; | 688 | break; |
691 | } | 689 | } |
692 | } | 690 | } |
@@ -878,6 +876,8 @@ static int rs600_startup(struct radeon_device *rdev) | |||
878 | 876 | ||
879 | int rs600_resume(struct radeon_device *rdev) | 877 | int rs600_resume(struct radeon_device *rdev) |
880 | { | 878 | { |
879 | int r; | ||
880 | |||
881 | /* Make sur GART are not working */ | 881 | /* Make sur GART are not working */ |
882 | rs600_gart_disable(rdev); | 882 | rs600_gart_disable(rdev); |
883 | /* Resume clock before doing reset */ | 883 | /* Resume clock before doing reset */ |
@@ -896,7 +896,11 @@ int rs600_resume(struct radeon_device *rdev) | |||
896 | radeon_surface_init(rdev); | 896 | radeon_surface_init(rdev); |
897 | 897 | ||
898 | rdev->accel_working = true; | 898 | rdev->accel_working = true; |
899 | return rs600_startup(rdev); | 899 | r = rs600_startup(rdev); |
900 | if (r) { | ||
901 | rdev->accel_working = false; | ||
902 | } | ||
903 | return r; | ||
900 | } | 904 | } |
901 | 905 | ||
902 | int rs600_suspend(struct radeon_device *rdev) | 906 | int rs600_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 4f24a0fa8c82..f68dff2fadcb 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -659,6 +659,8 @@ static int rs690_startup(struct radeon_device *rdev) | |||
659 | 659 | ||
660 | int rs690_resume(struct radeon_device *rdev) | 660 | int rs690_resume(struct radeon_device *rdev) |
661 | { | 661 | { |
662 | int r; | ||
663 | |||
662 | /* Make sur GART are not working */ | 664 | /* Make sur GART are not working */ |
663 | rs400_gart_disable(rdev); | 665 | rs400_gart_disable(rdev); |
664 | /* Resume clock before doing reset */ | 666 | /* Resume clock before doing reset */ |
@@ -677,7 +679,11 @@ int rs690_resume(struct radeon_device *rdev) | |||
677 | radeon_surface_init(rdev); | 679 | radeon_surface_init(rdev); |
678 | 680 | ||
679 | rdev->accel_working = true; | 681 | rdev->accel_working = true; |
680 | return rs690_startup(rdev); | 682 | r = rs690_startup(rdev); |
683 | if (r) { | ||
684 | rdev->accel_working = false; | ||
685 | } | ||
686 | return r; | ||
681 | } | 687 | } |
682 | 688 | ||
683 | int rs690_suspend(struct radeon_device *rdev) | 689 | int rs690_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 880637fd1946..959bf4483bea 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -424,6 +424,8 @@ static int rv515_startup(struct radeon_device *rdev) | |||
424 | 424 | ||
425 | int rv515_resume(struct radeon_device *rdev) | 425 | int rv515_resume(struct radeon_device *rdev) |
426 | { | 426 | { |
427 | int r; | ||
428 | |||
427 | /* Make sur GART are not working */ | 429 | /* Make sur GART are not working */ |
428 | if (rdev->flags & RADEON_IS_PCIE) | 430 | if (rdev->flags & RADEON_IS_PCIE) |
429 | rv370_pcie_gart_disable(rdev); | 431 | rv370_pcie_gart_disable(rdev); |
@@ -443,7 +445,11 @@ int rv515_resume(struct radeon_device *rdev) | |||
443 | radeon_surface_init(rdev); | 445 | radeon_surface_init(rdev); |
444 | 446 | ||
445 | rdev->accel_working = true; | 447 | rdev->accel_working = true; |
446 | return rv515_startup(rdev); | 448 | r = rv515_startup(rdev); |
449 | if (r) { | ||
450 | rdev->accel_working = false; | ||
451 | } | ||
452 | return r; | ||
447 | } | 453 | } |
448 | 454 | ||
449 | int rv515_suspend(struct radeon_device *rdev) | 455 | int rv515_suspend(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index a1668b659ddd..c049c0c51841 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1139,6 +1139,7 @@ int rv770_resume(struct radeon_device *rdev) | |||
1139 | r = rv770_startup(rdev); | 1139 | r = rv770_startup(rdev); |
1140 | if (r) { | 1140 | if (r) { |
1141 | DRM_ERROR("r600 startup failed on resume\n"); | 1141 | DRM_ERROR("r600 startup failed on resume\n"); |
1142 | rdev->accel_working = false; | ||
1142 | return r; | 1143 | return r; |
1143 | } | 1144 | } |
1144 | 1145 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 0af6ebdf205d..b66ef0e3cde1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -378,7 +378,7 @@ int vmw_framebuffer_create_handle(struct drm_framebuffer *fb, | |||
378 | unsigned int *handle) | 378 | unsigned int *handle) |
379 | { | 379 | { |
380 | if (handle) | 380 | if (handle) |
381 | handle = 0; | 381 | *handle = 0; |
382 | 382 | ||
383 | return 0; | 383 | return 0; |
384 | } | 384 | } |