All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/fb-helper: Don't clobber the display palette when fbdev isn't bound
@ 2013-05-27 15:44 ville.syrjala
  2013-05-27 15:44 ` [PATCH 2/2] drm/fb-helper: Don't load the display palette if the CRTC is disabled ville.syrjala
  2013-05-27 15:50 ` [PATCH 1/2] drm/fb-helper: Don't clobber the display palette when fbdev isn't bound Daniel Vetter
  0 siblings, 2 replies; 5+ messages in thread
From: ville.syrjala @ 2013-05-27 15:44 UTC (permalink / raw)
  To: dri-devel

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Perform the drm_fb_helper_is_bound() check to avoid clobbering the
display palette of some other KMS client.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b78cbe7..1b6ca23 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -626,12 +626,19 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
 {
 	struct drm_fb_helper *fb_helper = info->par;
+	struct drm_device *dev = fb_helper->dev;
 	struct drm_crtc_helper_funcs *crtc_funcs;
 	u16 *red, *green, *blue, *transp;
 	struct drm_crtc *crtc;
 	int i, j, rc = 0;
 	int start;
 
+	drm_modeset_lock_all(dev);
+	if (!drm_fb_helper_is_bound(fb_helper)) {
+		drm_modeset_unlock_all(dev);
+		return -EBUSY;
+	}
+
 	for (i = 0; i < fb_helper->crtc_count; i++) {
 		crtc = fb_helper->crtc_info[i].mode_set.crtc;
 		crtc_funcs = crtc->helper_private;
@@ -654,10 +661,12 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
 
 			rc = setcolreg(crtc, hred, hgreen, hblue, start++, info);
 			if (rc)
-				return rc;
+				goto out;
 		}
 		crtc_funcs->load_lut(crtc);
 	}
+ out:
+	drm_modeset_unlock_all(dev);
 	return rc;
 }
 EXPORT_SYMBOL(drm_fb_helper_setcmap);
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-27 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-27 15:44 [PATCH 1/2] drm/fb-helper: Don't clobber the display palette when fbdev isn't bound ville.syrjala
2013-05-27 15:44 ` [PATCH 2/2] drm/fb-helper: Don't load the display palette if the CRTC is disabled ville.syrjala
2013-05-27 15:51   ` Ville Syrjälä
2013-05-27 15:54   ` Daniel Vetter
2013-05-27 15:50 ` [PATCH 1/2] drm/fb-helper: Don't clobber the display palette when fbdev isn't bound Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.