From: Daniel Vetter <daniel@ffwll.ch> To: David Lechner <david@lechnology.com> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Vetter <daniel.vetter@intel.com> Subject: Re: [PATCH v3 2/2] drm/fb-helper: pass physical dimensions to fbdev Date: Fri, 4 Aug 2017 10:58:53 +0200 [thread overview] Message-ID: <20170804085853.wwdzv54z4dqslpem@phenom.ffwll.local> (raw) In-Reply-To: <1501777149-8310-3-git-send-email-david@lechnology.com> On Thu, Aug 03, 2017 at 11:19:09AM -0500, David Lechner wrote: > The fbdev subsystem has a place for physical dimensions (width and height > in mm) that is readable by userspace. Since DRM also knows these > dimensions, pass this information to the fbdev device. > > This has to be done in drm_setup_crtcs_fb() instead of drm_setup_crtcs() > because fb_helper->fbdev may be NULL in drm_setup_crtcs(). > > Signed-off-by: David Lechner <david@lechnology.com> > --- > drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 24a721a..a98bf86 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -1882,8 +1882,6 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe > info->var.xoffset = 0; > info->var.yoffset = 0; > info->var.activate = FB_ACTIVATE_NOW; > - info->var.height = -1; > - info->var.width = -1; > > switch (fb->format->depth) { > case 8: > @@ -2435,11 +2433,24 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper, > */ > static void drm_setup_crtcs_fb(struct drm_fb_helper *fb_helper) > { > + struct fb_info *info = fb_helper->fbdev; > int i; > > for (i = 0; i < fb_helper->crtc_count; i++) > if (fb_helper->crtc_info[i].mode_set.num_connectors) > fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; > + > + drm_fb_helper_for_each_connector(fb_helper, i) { > + struct drm_connector *connector = > + fb_helper->connector_info[i]->connector; > + > + /* use first connected connector for the physical dimensions */ > + if (connector->status == connector_status_connected) { > + info->var.height = connector->display_info.width_mm; > + info->var.width = connector->display_info.height_mm; > + break; > + } > + } Ok, small trapdoor I didn't highlight: Accessing the connector prope state (i.e. ->status and ->display_info) requires that you hold dev->mode_config.mutex. See how it's done in drm_setup_crtcs, just wrap it around this loop here. fbdev state itself is protected by fb_helper->lock, so that part is all good. I've applied patch 1 already, but can you pls respin that one with the locking fixed up? Thanks, Daniel > } > > /* Note: Drops fb_helper->lock before returning. */ > -- > 2.7.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch> To: David Lechner <david@lechnology.com> Cc: Daniel Vetter <daniel.vetter@intel.com>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v3 2/2] drm/fb-helper: pass physical dimensions to fbdev Date: Fri, 4 Aug 2017 10:58:53 +0200 [thread overview] Message-ID: <20170804085853.wwdzv54z4dqslpem@phenom.ffwll.local> (raw) In-Reply-To: <1501777149-8310-3-git-send-email-david@lechnology.com> On Thu, Aug 03, 2017 at 11:19:09AM -0500, David Lechner wrote: > The fbdev subsystem has a place for physical dimensions (width and height > in mm) that is readable by userspace. Since DRM also knows these > dimensions, pass this information to the fbdev device. > > This has to be done in drm_setup_crtcs_fb() instead of drm_setup_crtcs() > because fb_helper->fbdev may be NULL in drm_setup_crtcs(). > > Signed-off-by: David Lechner <david@lechnology.com> > --- > drivers/gpu/drm/drm_fb_helper.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 24a721a..a98bf86 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -1882,8 +1882,6 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe > info->var.xoffset = 0; > info->var.yoffset = 0; > info->var.activate = FB_ACTIVATE_NOW; > - info->var.height = -1; > - info->var.width = -1; > > switch (fb->format->depth) { > case 8: > @@ -2435,11 +2433,24 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper, > */ > static void drm_setup_crtcs_fb(struct drm_fb_helper *fb_helper) > { > + struct fb_info *info = fb_helper->fbdev; > int i; > > for (i = 0; i < fb_helper->crtc_count; i++) > if (fb_helper->crtc_info[i].mode_set.num_connectors) > fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; > + > + drm_fb_helper_for_each_connector(fb_helper, i) { > + struct drm_connector *connector = > + fb_helper->connector_info[i]->connector; > + > + /* use first connected connector for the physical dimensions */ > + if (connector->status == connector_status_connected) { > + info->var.height = connector->display_info.width_mm; > + info->var.width = connector->display_info.height_mm; > + break; > + } > + } Ok, small trapdoor I didn't highlight: Accessing the connector prope state (i.e. ->status and ->display_info) requires that you hold dev->mode_config.mutex. See how it's done in drm_setup_crtcs, just wrap it around this loop here. fbdev state itself is protected by fb_helper->lock, so that part is all good. I've applied patch 1 already, but can you pls respin that one with the locking fixed up? Thanks, Daniel > } > > /* Note: Drops fb_helper->lock before returning. */ > -- > 2.7.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-08-04 8:59 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-08-03 16:19 [PATCH v3 0/2] drm/fb-helper: pass physical dimensions to fbdev David Lechner 2017-08-03 16:19 ` [PATCH v3 1/2] drm/fb-helper: add new drm_setup_crtcs_fb() function David Lechner 2017-08-03 16:19 ` David Lechner 2017-08-03 16:19 ` [PATCH v3 2/2] drm/fb-helper: pass physical dimensions to fbdev David Lechner 2017-08-04 8:58 ` Daniel Vetter [this message] 2017-08-04 8:58 ` Daniel Vetter
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170804085853.wwdzv54z4dqslpem@phenom.ffwll.local \ --to=daniel@ffwll.ch \ --cc=daniel.vetter@intel.com \ --cc=david@lechnology.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.