From: Daniel Vetter Subject: Re: [PATCH 1/2] drm/fb-helper: Don't clobber the display palette when fbdev isn't bound Date: Mon, 27 May 2013 17:50:05 +0200 Message-ID: <20130527155005.GQ15743@phenom.ffwll.local> References: <1369669497-18854-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f46.google.com (mail-ee0-f46.google.com [74.125.83.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CB9AE5F90 for ; Mon, 27 May 2013 08:50:10 -0700 (PDT) Received: by mail-ee0-f46.google.com with SMTP id e49so3961886eek.19 for ; Mon, 27 May 2013 08:50:09 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1369669497-18854-1-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Mon, May 27, 2013 at 06:44:56PM +0300, ville.syrjala@linux.intel.com wro= te: > From: Ville Syrj=E4l=E4 > = > Perform the drm_fb_helper_is_bound() check to avoid clobbering the > display palette of some other KMS client. > = > Signed-off-by: Ville Syrj=E4l=E4 You might want to mention that you're also fixing up the locking a bit ;-) The lack of that would be much more obvious if the fbdev helper would use the real kms gamma interface instead of it's own driver backdoor. But that's a different patch to write. Reviewed-by: Daniel Vetter > --- > 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_hel= per.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 =3D info->par; > + struct drm_device *dev =3D fb_helper->dev; > struct drm_crtc_helper_funcs *crtc_funcs; > u16 *red, *green, *blue, *transp; > struct drm_crtc *crtc; > int i, j, rc =3D 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 =3D 0; i < fb_helper->crtc_count; i++) { > crtc =3D fb_helper->crtc_info[i].mode_set.crtc; > crtc_funcs =3D crtc->helper_private; > @@ -654,10 +661,12 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, str= uct fb_info *info) > = > rc =3D 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 -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch