aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-08-19 23:38:04 -0400
committerDave Airlie <airlied@redhat.com>2009-08-19 23:38:04 -0400
commit51c8b4071d84d46cc100baa5931ad06b2a823c95 (patch)
tree098cf9d41ce1c548d922708a770a9efe35e434df /drivers/gpu/drm/drm_crtc.c
parenta987fcaa805fcb24ba885c2e29fd4fdb6816f08f (diff)
parent6c30c53fd5ae6a99a23ad78e90c428d2c8ffb07f (diff)
Merge Linus master to drm-next
linux-next conflict reported needed resolution. Conflicts: drivers/gpu/drm/drm_crtc.c drivers/gpu/drm/drm_edid.c drivers/gpu/drm/i915/intel_sdvo.c drivers/gpu/drm/radeon/radeon_ttm.c drivers/gpu/drm/ttm/ttm_bo.c
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 39a6bc69d223..c20fcdc65497 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -261,31 +261,6 @@ void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type)
261EXPORT_SYMBOL(drm_mode_object_find); 261EXPORT_SYMBOL(drm_mode_object_find);
262 262
263/** 263/**
264 * drm_crtc_from_fb - find the CRTC structure associated with an fb
265 * @dev: DRM device
266 * @fb: framebuffer in question
267 *
268 * LOCKING:
269 * Caller must hold mode_config lock.
270 *
271 * Find CRTC in the mode_config structure that matches @fb.
272 *
273 * RETURNS:
274 * Pointer to the CRTC or NULL if it wasn't found.
275 */
276struct drm_crtc *drm_crtc_from_fb(struct drm_device *dev,
277 struct drm_framebuffer *fb)
278{
279 struct drm_crtc *crtc;
280
281 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
282 if (crtc->fb == fb)
283 return crtc;
284 }
285 return NULL;
286}
287
288/**
289 * drm_framebuffer_init - initialize a framebuffer 264 * drm_framebuffer_init - initialize a framebuffer
290 * @dev: DRM device 265 * @dev: DRM device
291 * 266 *
@@ -331,11 +306,20 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
331{ 306{
332 struct drm_device *dev = fb->dev; 307 struct drm_device *dev = fb->dev;
333 struct drm_crtc *crtc; 308 struct drm_crtc *crtc;
309 struct drm_mode_set set;
310 int ret;
334 311
335 /* remove from any CRTC */ 312 /* remove from any CRTC */
336 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 313 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
337 if (crtc->fb == fb) 314 if (crtc->fb == fb) {
338 crtc->fb = NULL; 315 /* should turn off the crtc */
316 memset(&set, 0, sizeof(struct drm_mode_set));
317 set.crtc = crtc;
318 set.fb = NULL;
319 ret = crtc->funcs->set_config(&set);
320 if (ret)
321 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc);
322 }
339 } 323 }
340 324
341 drm_mode_object_put(dev, &fb->base); 325 drm_mode_object_put(dev, &fb->base);
@@ -1502,7 +1486,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1502 goto out; 1486 goto out;
1503 } 1487 }
1504 1488
1505 if (crtc_req->count_connectors > 0 && !mode && !fb) { 1489 if (crtc_req->count_connectors > 0 && (!mode || !fb)) {
1506 DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n", 1490 DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
1507 crtc_req->count_connectors); 1491 crtc_req->count_connectors);
1508 ret = -EINVAL; 1492 ret = -EINVAL;
@@ -1553,7 +1537,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1553 set.mode = mode; 1537 set.mode = mode;
1554 set.connectors = connector_set; 1538 set.connectors = connector_set;
1555 set.num_connectors = crtc_req->count_connectors; 1539 set.num_connectors = crtc_req->count_connectors;
1556 set.fb =fb; 1540 set.fb = fb;
1557 ret = crtc->funcs->set_config(&set); 1541 ret = crtc->funcs->set_config(&set);
1558 1542
1559out: 1543out: