aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-11 07:47:23 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-20 09:57:58 -0500
commit2d13b6796e420ed00389b7399a5d5ac7b1fed436 (patch)
tree8889af1340e267331fd7969d7f949ac9d6661019 /drivers/gpu/drm
parentaf26ef3b3978349cfbd864163a6ebb4906b733b5 (diff)
drm: encapsulate crtc->set_config calls
With refcounting we need to adjust framebuffer refcounts at each callsite - much easier to do if they all call the same little helper function. Reviewed-by: Rob Clark <rob@ti.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_crtc.c19
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c6
-rw-r--r--drivers/gpu/drm/i2c/ch7006_drv.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv04_display.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv17_tv.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c2
6 files changed, 24 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index a9abf49bb3ef..7ca2f28348e6 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -381,7 +381,7 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
381 memset(&set, 0, sizeof(struct drm_mode_set)); 381 memset(&set, 0, sizeof(struct drm_mode_set));
382 set.crtc = crtc; 382 set.crtc = crtc;
383 set.fb = NULL; 383 set.fb = NULL;
384 ret = crtc->funcs->set_config(&set); 384 ret = drm_mode_set_config_internal(&set);
385 if (ret) 385 if (ret)
386 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); 386 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc);
387 } 387 }
@@ -1801,6 +1801,21 @@ out:
1801} 1801}
1802 1802
1803/** 1803/**
1804 * drm_mode_set_config_internal - helper to call ->set_config
1805 * @set: modeset config to set
1806 *
1807 * This is a little helper to wrap internal calls to the ->set_config driver
1808 * interface. The only thing it adds is correct refcounting dance.
1809 */
1810int drm_mode_set_config_internal(struct drm_mode_set *set)
1811{
1812 struct drm_crtc *crtc = set->crtc;
1813
1814 return crtc->funcs->set_config(set);
1815}
1816EXPORT_SYMBOL(drm_mode_set_config_internal);
1817
1818/**
1804 * drm_mode_setcrtc - set CRTC configuration 1819 * drm_mode_setcrtc - set CRTC configuration
1805 * @dev: drm device for the ioctl 1820 * @dev: drm device for the ioctl
1806 * @data: data pointer for the ioctl 1821 * @data: data pointer for the ioctl
@@ -1963,7 +1978,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1963 set.connectors = connector_set; 1978 set.connectors = connector_set;
1964 set.num_connectors = crtc_req->count_connectors; 1979 set.num_connectors = crtc_req->count_connectors;
1965 set.fb = fb; 1980 set.fb = fb;
1966 ret = crtc->funcs->set_config(&set); 1981 ret = drm_mode_set_config_internal(&set);
1967 1982
1968out: 1983out:
1969 kfree(connector_set); 1984 kfree(connector_set);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 954d175bd7fa..82c3a9ff80a5 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -245,7 +245,7 @@ bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
245 int i, ret; 245 int i, ret;
246 for (i = 0; i < fb_helper->crtc_count; i++) { 246 for (i = 0; i < fb_helper->crtc_count; i++) {
247 struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set; 247 struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
248 ret = mode_set->crtc->funcs->set_config(mode_set); 248 ret = drm_mode_set_config_internal(mode_set);
249 if (ret) 249 if (ret)
250 error = true; 250 error = true;
251 } 251 }
@@ -675,7 +675,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
675 mutex_lock(&dev->mode_config.mutex); 675 mutex_lock(&dev->mode_config.mutex);
676 for (i = 0; i < fb_helper->crtc_count; i++) { 676 for (i = 0; i < fb_helper->crtc_count; i++) {
677 crtc = fb_helper->crtc_info[i].mode_set.crtc; 677 crtc = fb_helper->crtc_info[i].mode_set.crtc;
678 ret = crtc->funcs->set_config(&fb_helper->crtc_info[i].mode_set); 678 ret = drm_mode_set_config_internal(&fb_helper->crtc_info[i].mode_set);
679 if (ret) { 679 if (ret) {
680 mutex_unlock(&dev->mode_config.mutex); 680 mutex_unlock(&dev->mode_config.mutex);
681 return ret; 681 return ret;
@@ -711,7 +711,7 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
711 modeset->y = var->yoffset; 711 modeset->y = var->yoffset;
712 712
713 if (modeset->num_connectors) { 713 if (modeset->num_connectors) {
714 ret = crtc->funcs->set_config(modeset); 714 ret = drm_mode_set_config_internal(modeset);
715 if (!ret) { 715 if (!ret) {
716 info->var.xoffset = var->xoffset; 716 info->var.xoffset = var->xoffset;
717 info->var.yoffset = var->yoffset; 717 info->var.yoffset = var->yoffset;
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index b865d0728e28..51fa32392029 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -364,7 +364,7 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder,
364 .crtc = crtc, 364 .crtc = crtc,
365 }; 365 };
366 366
367 crtc->funcs->set_config(&modeset); 367 drm_mode_set_config_internal(&modeset);
368 } 368 }
369 } 369 }
370 370
diff --git a/drivers/gpu/drm/nouveau/nv04_display.c b/drivers/gpu/drm/nouveau/nv04_display.c
index 2cd6fb8c548e..4c6e9f83fe82 100644
--- a/drivers/gpu/drm/nouveau/nv04_display.c
+++ b/drivers/gpu/drm/nouveau/nv04_display.c
@@ -140,7 +140,7 @@ nv04_display_destroy(struct drm_device *dev)
140 .crtc = crtc, 140 .crtc = crtc,
141 }; 141 };
142 142
143 crtc->funcs->set_config(&modeset); 143 drm_mode_set_config_internal(&modeset);
144 } 144 }
145 145
146 /* Restore state */ 146 /* Restore state */
diff --git a/drivers/gpu/drm/nouveau/nv17_tv.c b/drivers/gpu/drm/nouveau/nv17_tv.c
index 2ca276ada507..977e42be2050 100644
--- a/drivers/gpu/drm/nouveau/nv17_tv.c
+++ b/drivers/gpu/drm/nouveau/nv17_tv.c
@@ -768,7 +768,7 @@ static int nv17_tv_set_property(struct drm_encoder *encoder,
768 .crtc = crtc, 768 .crtc = crtc,
769 }; 769 };
770 770
771 crtc->funcs->set_config(&modeset); 771 drm_mode_set_config_internal(&modeset);
772 } 772 }
773 } 773 }
774 774
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 161f8b2549aa..07dfd823cc30 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -829,7 +829,7 @@ static void vmw_lastclose(struct drm_device *dev)
829 829
830 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 830 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
831 set.crtc = crtc; 831 set.crtc = crtc;
832 ret = crtc->funcs->set_config(&set); 832 ret = drm_mode_set_config_internal(&set);
833 WARN_ON(ret != 0); 833 WARN_ON(ret != 0);
834 } 834 }
835 835