* [PATCH] drm/vblank: Simplify drm_dev_has_vblank() @ 2023-04-03 16:07 ` Rob Clark 0 siblings, 0 replies; 11+ messages in thread From: Rob Clark @ 2023-04-03 16:07 UTC (permalink / raw) To: dri-devel; +Cc: Rob Clark, Thomas Zimmermann, open list From: Rob Clark <robdclark@chromium.org> What does vblank have to do with num_crtcs? Well, this was technically correct, but you'd have to go look at where num_crtcs is initialized to understand why. Lets just replace it with the simpler and more obvious check. Signed-off-by: Rob Clark <robdclark@chromium.org> --- drivers/gpu/drm/drm_vblank.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 877e2067534f..ad34c235d853 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); */ bool drm_dev_has_vblank(const struct drm_device *dev) { - return dev->num_crtcs != 0; + return !!dev->vblank; } EXPORT_SYMBOL(drm_dev_has_vblank); -- 2.39.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] drm/vblank: Simplify drm_dev_has_vblank() @ 2023-04-03 16:07 ` Rob Clark 0 siblings, 0 replies; 11+ messages in thread From: Rob Clark @ 2023-04-03 16:07 UTC (permalink / raw) To: dri-devel Cc: Rob Clark, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, open list From: Rob Clark <robdclark@chromium.org> What does vblank have to do with num_crtcs? Well, this was technically correct, but you'd have to go look at where num_crtcs is initialized to understand why. Lets just replace it with the simpler and more obvious check. Signed-off-by: Rob Clark <robdclark@chromium.org> --- drivers/gpu/drm/drm_vblank.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 877e2067534f..ad34c235d853 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); */ bool drm_dev_has_vblank(const struct drm_device *dev) { - return dev->num_crtcs != 0; + return !!dev->vblank; } EXPORT_SYMBOL(drm_dev_has_vblank); -- 2.39.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() 2023-04-03 16:07 ` Rob Clark @ 2023-04-03 16:23 ` Ville Syrjälä -1 siblings, 0 replies; 11+ messages in thread From: Ville Syrjälä @ 2023-04-03 16:23 UTC (permalink / raw) To: Rob Clark; +Cc: Rob Clark, Thomas Zimmermann, dri-devel, open list On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > From: Rob Clark <robdclark@chromium.org> > > What does vblank have to do with num_crtcs? Well, this was technically > correct, but you'd have to go look at where num_crtcs is initialized to > understand why. Lets just replace it with the simpler and more obvious > check. > > Signed-off-by: Rob Clark <robdclark@chromium.org> > --- > drivers/gpu/drm/drm_vblank.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 877e2067534f..ad34c235d853 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); > */ > bool drm_dev_has_vblank(const struct drm_device *dev) > { > - return dev->num_crtcs != 0; > + return !!dev->vblank; The compiler knows how to turn things into a boolean. Or I guess if we want to be a bit more explicit we could write this as return dev->vblank != NULL; but IIRC that will make checkpatch complain because of someone's personal taste. > } > EXPORT_SYMBOL(drm_dev_has_vblank); > > -- > 2.39.2 -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() @ 2023-04-03 16:23 ` Ville Syrjälä 0 siblings, 0 replies; 11+ messages in thread From: Ville Syrjälä @ 2023-04-03 16:23 UTC (permalink / raw) To: Rob Clark; +Cc: dri-devel, Rob Clark, Thomas Zimmermann, open list On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > From: Rob Clark <robdclark@chromium.org> > > What does vblank have to do with num_crtcs? Well, this was technically > correct, but you'd have to go look at where num_crtcs is initialized to > understand why. Lets just replace it with the simpler and more obvious > check. > > Signed-off-by: Rob Clark <robdclark@chromium.org> > --- > drivers/gpu/drm/drm_vblank.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 877e2067534f..ad34c235d853 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); > */ > bool drm_dev_has_vblank(const struct drm_device *dev) > { > - return dev->num_crtcs != 0; > + return !!dev->vblank; The compiler knows how to turn things into a boolean. Or I guess if we want to be a bit more explicit we could write this as return dev->vblank != NULL; but IIRC that will make checkpatch complain because of someone's personal taste. > } > EXPORT_SYMBOL(drm_dev_has_vblank); > > -- > 2.39.2 -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() 2023-04-03 16:23 ` Ville Syrjälä @ 2023-04-03 16:28 ` Randy Dunlap -1 siblings, 0 replies; 11+ messages in thread From: Randy Dunlap @ 2023-04-03 16:28 UTC (permalink / raw) To: Ville Syrjälä, Rob Clark Cc: Rob Clark, Thomas Zimmermann, dri-devel, open list On 4/3/23 09:23, Ville Syrjälä wrote: > On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: >> From: Rob Clark <robdclark@chromium.org> >> >> What does vblank have to do with num_crtcs? Well, this was technically >> correct, but you'd have to go look at where num_crtcs is initialized to >> understand why. Lets just replace it with the simpler and more obvious >> check. >> >> Signed-off-by: Rob Clark <robdclark@chromium.org> >> --- >> drivers/gpu/drm/drm_vblank.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c >> index 877e2067534f..ad34c235d853 100644 >> --- a/drivers/gpu/drm/drm_vblank.c >> +++ b/drivers/gpu/drm/drm_vblank.c >> @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); >> */ >> bool drm_dev_has_vblank(const struct drm_device *dev) >> { >> - return dev->num_crtcs != 0; >> + return !!dev->vblank; > > The compiler knows how to turn things into a boolean. >> Or I guess if we want to be a bit more explicit we could > write this as > return dev->vblank != NULL; > but IIRC that will make checkpatch complain because of > someone's personal taste. checkpatch isn't an absolute thing. :) -- ~Randy ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() @ 2023-04-03 16:28 ` Randy Dunlap 0 siblings, 0 replies; 11+ messages in thread From: Randy Dunlap @ 2023-04-03 16:28 UTC (permalink / raw) To: Ville Syrjälä, Rob Clark Cc: dri-devel, Rob Clark, Thomas Zimmermann, open list On 4/3/23 09:23, Ville Syrjälä wrote: > On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: >> From: Rob Clark <robdclark@chromium.org> >> >> What does vblank have to do with num_crtcs? Well, this was technically >> correct, but you'd have to go look at where num_crtcs is initialized to >> understand why. Lets just replace it with the simpler and more obvious >> check. >> >> Signed-off-by: Rob Clark <robdclark@chromium.org> >> --- >> drivers/gpu/drm/drm_vblank.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c >> index 877e2067534f..ad34c235d853 100644 >> --- a/drivers/gpu/drm/drm_vblank.c >> +++ b/drivers/gpu/drm/drm_vblank.c >> @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); >> */ >> bool drm_dev_has_vblank(const struct drm_device *dev) >> { >> - return dev->num_crtcs != 0; >> + return !!dev->vblank; > > The compiler knows how to turn things into a boolean. >> Or I guess if we want to be a bit more explicit we could > write this as > return dev->vblank != NULL; > but IIRC that will make checkpatch complain because of > someone's personal taste. checkpatch isn't an absolute thing. :) -- ~Randy ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() 2023-04-03 16:07 ` Rob Clark @ 2023-04-04 20:46 ` Daniel Vetter -1 siblings, 0 replies; 11+ messages in thread From: Daniel Vetter @ 2023-04-04 20:46 UTC (permalink / raw) To: Rob Clark; +Cc: Rob Clark, open list, dri-devel, Thomas Zimmermann On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > From: Rob Clark <robdclark@chromium.org> > > What does vblank have to do with num_crtcs? Well, this was technically > correct, but you'd have to go look at where num_crtcs is initialized to > understand why. Lets just replace it with the simpler and more obvious > check. If you want to fix this, then I think the right fix is to rename num_crtcs to be something like num_vblank_crtcs. It's a historical accident back when vblanks without kms was a thing. Plan B is someone gets really busy and fixes up the entire vblank mess and moves it into drm_crtc struct. Now that the dri1 drivers are gone we could indeed do that. Or maybe instead a patch to improve the kerneldoc for drm_dev->num_crtc? -Daniel > Signed-off-by: Rob Clark <robdclark@chromium.org> > --- > drivers/gpu/drm/drm_vblank.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 877e2067534f..ad34c235d853 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); > */ > bool drm_dev_has_vblank(const struct drm_device *dev) > { > - return dev->num_crtcs != 0; > + return !!dev->vblank; > } > EXPORT_SYMBOL(drm_dev_has_vblank); > > -- > 2.39.2 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() @ 2023-04-04 20:46 ` Daniel Vetter 0 siblings, 0 replies; 11+ messages in thread From: Daniel Vetter @ 2023-04-04 20:46 UTC (permalink / raw) To: Rob Clark Cc: dri-devel, Rob Clark, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, open list On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > From: Rob Clark <robdclark@chromium.org> > > What does vblank have to do with num_crtcs? Well, this was technically > correct, but you'd have to go look at where num_crtcs is initialized to > understand why. Lets just replace it with the simpler and more obvious > check. If you want to fix this, then I think the right fix is to rename num_crtcs to be something like num_vblank_crtcs. It's a historical accident back when vblanks without kms was a thing. Plan B is someone gets really busy and fixes up the entire vblank mess and moves it into drm_crtc struct. Now that the dri1 drivers are gone we could indeed do that. Or maybe instead a patch to improve the kerneldoc for drm_dev->num_crtc? -Daniel > Signed-off-by: Rob Clark <robdclark@chromium.org> > --- > drivers/gpu/drm/drm_vblank.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 877e2067534f..ad34c235d853 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -575,7 +575,7 @@ EXPORT_SYMBOL(drm_vblank_init); > */ > bool drm_dev_has_vblank(const struct drm_device *dev) > { > - return dev->num_crtcs != 0; > + return !!dev->vblank; > } > EXPORT_SYMBOL(drm_dev_has_vblank); > > -- > 2.39.2 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() 2023-04-04 20:46 ` Daniel Vetter (?) @ 2023-04-04 21:00 ` Ville Syrjälä 2023-04-05 8:10 ` Daniel Vetter -1 siblings, 1 reply; 11+ messages in thread From: Ville Syrjälä @ 2023-04-04 21:00 UTC (permalink / raw) To: Rob Clark, dri-devel, Rob Clark, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, open list On Tue, Apr 04, 2023 at 10:46:00PM +0200, Daniel Vetter wrote: > On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > > From: Rob Clark <robdclark@chromium.org> > > > > What does vblank have to do with num_crtcs? Well, this was technically > > correct, but you'd have to go look at where num_crtcs is initialized to > > understand why. Lets just replace it with the simpler and more obvious > > check. > > If you want to fix this, then I think the right fix is to rename num_crtcs > to be something like num_vblank_crtcs. It's a historical accident back > when vblanks without kms was a thing. > > Plan B is someone gets really busy and fixes up the entire vblank mess and > moves it into drm_crtc struct. Now that the dri1 drivers are gone we could > indeed do that. And easy first step could to simply wrap all the naked &dev->vblank[drm_crtc_index()] things into a function call with some cocci/etc. That way most of the vblank code doesn't need to care where that thing actually lives. -- Ville Syrjälä Intel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() 2023-04-04 21:00 ` Ville Syrjälä @ 2023-04-05 8:10 ` Daniel Vetter 0 siblings, 0 replies; 11+ messages in thread From: Daniel Vetter @ 2023-04-05 8:10 UTC (permalink / raw) To: Ville Syrjälä Cc: Rob Clark, open list, dri-devel, Thomas Zimmermann On Wed, Apr 05, 2023 at 12:00:23AM +0300, Ville Syrjälä wrote: > On Tue, Apr 04, 2023 at 10:46:00PM +0200, Daniel Vetter wrote: > > On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > > > From: Rob Clark <robdclark@chromium.org> > > > > > > What does vblank have to do with num_crtcs? Well, this was technically > > > correct, but you'd have to go look at where num_crtcs is initialized to > > > understand why. Lets just replace it with the simpler and more obvious > > > check. > > > > If you want to fix this, then I think the right fix is to rename num_crtcs > > to be something like num_vblank_crtcs. It's a historical accident back > > when vblanks without kms was a thing. > > > > Plan B is someone gets really busy and fixes up the entire vblank mess and > > moves it into drm_crtc struct. Now that the dri1 drivers are gone we could > > indeed do that. > > And easy first step could to simply wrap all the naked > &dev->vblank[drm_crtc_index()] things into a function > call with some cocci/etc. That way most of the vblank > code doesn't need to care where that thing actually lives. Yeah I think that might work out. Roughly: - Wrap all the drm_vblank_crtc lookups - Emebed it into drm_crtc, delete the drm_device->vblank array - rename drm_device->num_crtc to something more meaningful maybe and move into drm_modeset_config The big holdup always was step 2 because we still had to care about legacy drivers without drm_crtc, which meant you'd have to have two paths, which was kinda really annoying. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/vblank: Simplify drm_dev_has_vblank() @ 2023-04-05 8:10 ` Daniel Vetter 0 siblings, 0 replies; 11+ messages in thread From: Daniel Vetter @ 2023-04-05 8:10 UTC (permalink / raw) To: Ville Syrjälä Cc: Rob Clark, dri-devel, Rob Clark, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, open list On Wed, Apr 05, 2023 at 12:00:23AM +0300, Ville Syrjälä wrote: > On Tue, Apr 04, 2023 at 10:46:00PM +0200, Daniel Vetter wrote: > > On Mon, Apr 03, 2023 at 09:07:35AM -0700, Rob Clark wrote: > > > From: Rob Clark <robdclark@chromium.org> > > > > > > What does vblank have to do with num_crtcs? Well, this was technically > > > correct, but you'd have to go look at where num_crtcs is initialized to > > > understand why. Lets just replace it with the simpler and more obvious > > > check. > > > > If you want to fix this, then I think the right fix is to rename num_crtcs > > to be something like num_vblank_crtcs. It's a historical accident back > > when vblanks without kms was a thing. > > > > Plan B is someone gets really busy and fixes up the entire vblank mess and > > moves it into drm_crtc struct. Now that the dri1 drivers are gone we could > > indeed do that. > > And easy first step could to simply wrap all the naked > &dev->vblank[drm_crtc_index()] things into a function > call with some cocci/etc. That way most of the vblank > code doesn't need to care where that thing actually lives. Yeah I think that might work out. Roughly: - Wrap all the drm_vblank_crtc lookups - Emebed it into drm_crtc, delete the drm_device->vblank array - rename drm_device->num_crtc to something more meaningful maybe and move into drm_modeset_config The big holdup always was step 2 because we still had to care about legacy drivers without drm_crtc, which meant you'd have to have two paths, which was kinda really annoying. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-04-05 8:10 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-04-03 16:07 [PATCH] drm/vblank: Simplify drm_dev_has_vblank() Rob Clark 2023-04-03 16:07 ` Rob Clark 2023-04-03 16:23 ` Ville Syrjälä 2023-04-03 16:23 ` Ville Syrjälä 2023-04-03 16:28 ` Randy Dunlap 2023-04-03 16:28 ` Randy Dunlap 2023-04-04 20:46 ` Daniel Vetter 2023-04-04 20:46 ` Daniel Vetter 2023-04-04 21:00 ` Ville Syrjälä 2023-04-05 8:10 ` Daniel Vetter 2023-04-05 8:10 ` 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.