* [PATCH 2/2] drm: simple_kms_helper: add support for bridges @ 2016-08-23 14:08 Andrea Merello 2016-08-23 15:20 ` Daniel Vetter 0 siblings, 1 reply; 7+ messages in thread From: Andrea Merello @ 2016-08-23 14:08 UTC (permalink / raw) To: dri-devel; +Cc: Andrea Merello Introduce drm_simple_display_pipe_attach_bridge() in order to make it possible to use drm encoders with the simple display pipes managed by simple_kms_helpers Suggested-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Cc: Noralf Trønnes <noralf@tronnes.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 3a48c7c..05ee61d 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -133,6 +133,28 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { }; /** + * drm_simple_display_pipe_attach_bridge - Attach a bridge to the display pipe + * @pipe: simple display pipe object + * @bridge: bridge to attach + * + * Makes it possible to still use the drm_simple_display_pipe helpers when + * a DRM bridge has to be used. + * Note that you probably want to initialize the pipe by passing a NULL + * connector to drm_simple_display_pipe_init() + * + * Returns: + * Zero on success, negative error code on failure. + */ +int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe, + struct drm_bridge *bridge) +{ + bridge->encoder = &pipe->encoder; + pipe->encoder.bridge = bridge; + return drm_bridge_attach(pipe->encoder.dev, bridge); +} +EXPORT_SYMBOL(drm_simple_display_pipe_attach_bridge); + +/** * drm_simple_display_pipe_init - Initialize a simple display pipeline * @dev: DRM device * @pipe: simple display pipe object to initialize diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index 2690397..1d73bcf 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -85,6 +85,9 @@ struct drm_simple_display_pipe { const struct drm_simple_display_pipe_funcs *funcs; }; +int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe, + struct drm_bridge *bridge); + int drm_simple_display_pipe_init(struct drm_device *dev, struct drm_simple_display_pipe *pipe, const struct drm_simple_display_pipe_funcs *funcs, -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm: simple_kms_helper: add support for bridges 2016-08-23 14:08 [PATCH 2/2] drm: simple_kms_helper: add support for bridges Andrea Merello @ 2016-08-23 15:20 ` Daniel Vetter 2016-08-23 15:39 ` Andrea Merello 0 siblings, 1 reply; 7+ messages in thread From: Daniel Vetter @ 2016-08-23 15:20 UTC (permalink / raw) To: Andrea Merello; +Cc: dri-devel On Tue, Aug 23, 2016 at 04:08:04PM +0200, Andrea Merello wrote: > Introduce drm_simple_display_pipe_attach_bridge() in order > to make it possible to use drm encoders with the simple display > pipes managed by simple_kms_helpers > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > Signed-off-by: Andrea Merello <andrea.merello@gmail.com> > Cc: Noralf Trønnes <noralf@tronnes.org> > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: David Airlie <airlied@linux.ie> Threading of your patch series is somehow broken, usually that should all work nicely if you've set up git send-email. One question: Should we ahve a drm_simple_display_pipe_detach_bridge (for cleanup) too? -Daniel > > diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c > index 3a48c7c..05ee61d 100644 > --- a/drivers/gpu/drm/drm_simple_kms_helper.c > +++ b/drivers/gpu/drm/drm_simple_kms_helper.c > @@ -133,6 +133,28 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { > }; > > /** > + * drm_simple_display_pipe_attach_bridge - Attach a bridge to the display pipe > + * @pipe: simple display pipe object > + * @bridge: bridge to attach > + * > + * Makes it possible to still use the drm_simple_display_pipe helpers when > + * a DRM bridge has to be used. > + * Note that you probably want to initialize the pipe by passing a NULL > + * connector to drm_simple_display_pipe_init() > + * > + * Returns: > + * Zero on success, negative error code on failure. > + */ > +int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe, > + struct drm_bridge *bridge) > +{ > + bridge->encoder = &pipe->encoder; > + pipe->encoder.bridge = bridge; > + return drm_bridge_attach(pipe->encoder.dev, bridge); > +} > +EXPORT_SYMBOL(drm_simple_display_pipe_attach_bridge); > + > +/** > * drm_simple_display_pipe_init - Initialize a simple display pipeline > * @dev: DRM device > * @pipe: simple display pipe object to initialize > diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h > index 2690397..1d73bcf 100644 > --- a/include/drm/drm_simple_kms_helper.h > +++ b/include/drm/drm_simple_kms_helper.h > @@ -85,6 +85,9 @@ struct drm_simple_display_pipe { > const struct drm_simple_display_pipe_funcs *funcs; > }; > > +int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe, > + struct drm_bridge *bridge); > + > int drm_simple_display_pipe_init(struct drm_device *dev, > struct drm_simple_display_pipe *pipe, > const struct drm_simple_display_pipe_funcs *funcs, > -- > 2.7.4 -- 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm: simple_kms_helper: add support for bridges 2016-08-23 15:20 ` Daniel Vetter @ 2016-08-23 15:39 ` Andrea Merello 2016-08-23 15:54 ` Daniel Vetter 0 siblings, 1 reply; 7+ messages in thread From: Andrea Merello @ 2016-08-23 15:39 UTC (permalink / raw) To: Daniel Vetter; +Cc: dri-devel [-- Attachment #1.1: Type: text/plain, Size: 3390 bytes --] On Tue, Aug 23, 2016 at 5:20 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > On Tue, Aug 23, 2016 at 04:08:04PM +0200, Andrea Merello wrote: > > Introduce drm_simple_display_pipe_attach_bridge() in order > > to make it possible to use drm encoders with the simple display > > pipes managed by simple_kms_helpers > > > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > > Signed-off-by: Andrea Merello <andrea.merello@gmail.com> > > Cc: Noralf Trønnes <noralf@tronnes.org> > > Cc: Daniel Vetter <daniel@ffwll.ch> > > Cc: David Airlie <airlied@linux.ie> > > Threading of your patch series is somehow broken, usually that should all > work nicely if you've set up git send-email. > > One question: Should we ahve a drm_simple_display_pipe_detach_bridge (for > cleanup) too? > Unsure if it worths. May be nice to have a balanced pair, but it would probably end up in a quite redundant one-line func, that only calls drm_bridge_detach with the very same argument. ..But of course if you want I can add it in v2 series. (ACK for all other things) Andrea > -Daniel > > > > > diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c > b/drivers/gpu/drm/drm_simple_kms_helper.c > > index 3a48c7c..05ee61d 100644 > > --- a/drivers/gpu/drm/drm_simple_kms_helper.c > > +++ b/drivers/gpu/drm/drm_simple_kms_helper.c > > @@ -133,6 +133,28 @@ static const struct drm_plane_funcs > drm_simple_kms_plane_funcs = { > > }; > > > > /** > > + * drm_simple_display_pipe_attach_bridge - Attach a bridge to the > display pipe > > + * @pipe: simple display pipe object > > + * @bridge: bridge to attach > > + * > > + * Makes it possible to still use the drm_simple_display_pipe helpers > when > > + * a DRM bridge has to be used. > > + * Note that you probably want to initialize the pipe by passing a NULL > > + * connector to drm_simple_display_pipe_init() > > + * > > + * Returns: > > + * Zero on success, negative error code on failure. > > + */ > > +int drm_simple_display_pipe_attach_bridge(struct > drm_simple_display_pipe *pipe, > > + struct drm_bridge *bridge) > > +{ > > + bridge->encoder = &pipe->encoder; > > + pipe->encoder.bridge = bridge; > > + return drm_bridge_attach(pipe->encoder.dev, bridge); > > +} > > +EXPORT_SYMBOL(drm_simple_display_pipe_attach_bridge); > > + > > +/** > > * drm_simple_display_pipe_init - Initialize a simple display pipeline > > * @dev: DRM device > > * @pipe: simple display pipe object to initialize > > diff --git a/include/drm/drm_simple_kms_helper.h > b/include/drm/drm_simple_kms_helper.h > > index 2690397..1d73bcf 100644 > > --- a/include/drm/drm_simple_kms_helper.h > > +++ b/include/drm/drm_simple_kms_helper.h > > @@ -85,6 +85,9 @@ struct drm_simple_display_pipe { > > const struct drm_simple_display_pipe_funcs *funcs; > > }; > > > > +int drm_simple_display_pipe_attach_bridge(struct > drm_simple_display_pipe *pipe, > > + struct drm_bridge *bridge); > > + > > int drm_simple_display_pipe_init(struct drm_device *dev, > > struct drm_simple_display_pipe *pipe, > > const struct drm_simple_display_pipe_funcs *funcs, > > -- > > 2.7.4 > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch > [-- Attachment #1.2: Type: text/html, Size: 4813 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm: simple_kms_helper: add support for bridges 2016-08-23 15:39 ` Andrea Merello @ 2016-08-23 15:54 ` Daniel Vetter 2016-08-23 16:44 ` Andrea Merello 0 siblings, 1 reply; 7+ messages in thread From: Daniel Vetter @ 2016-08-23 15:54 UTC (permalink / raw) To: Andrea Merello; +Cc: dri-devel On Tue, Aug 23, 2016 at 05:39:36PM +0200, Andrea Merello wrote: > On Tue, Aug 23, 2016 at 5:20 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > > > On Tue, Aug 23, 2016 at 04:08:04PM +0200, Andrea Merello wrote: > > > Introduce drm_simple_display_pipe_attach_bridge() in order > > > to make it possible to use drm encoders with the simple display > > > pipes managed by simple_kms_helpers > > > > > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > > > Signed-off-by: Andrea Merello <andrea.merello@gmail.com> > > > Cc: Noralf Trønnes <noralf@tronnes.org> > > > Cc: Daniel Vetter <daniel@ffwll.ch> > > > Cc: David Airlie <airlied@linux.ie> > > > > Threading of your patch series is somehow broken, usually that should all > > work nicely if you've set up git send-email. > > > > One question: Should we ahve a drm_simple_display_pipe_detach_bridge (for > > cleanup) too? > > > > Unsure if it worths. May be nice to have a balanced pair, but it would > probably end up in > a quite redundant one-line func, that only calls drm_bridge_detach with the > very same argument. > > ..But of course if you want I can add it in v2 series. Yes it's just going to be a one-line, but it'll do a typecast and so better encapsulate the internals of the simple pipe helper. I think that's worth it - we have piles&piles of functions and #defines just to make little one-line bits of code a notch more readable. And yes the symmetry is nice too ;-) -Daniel -- 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm: simple_kms_helper: add support for bridges 2016-08-23 15:54 ` Daniel Vetter @ 2016-08-23 16:44 ` Andrea Merello 2016-08-23 20:01 ` Daniel Vetter 0 siblings, 1 reply; 7+ messages in thread From: Andrea Merello @ 2016-08-23 16:44 UTC (permalink / raw) To: Daniel Vetter; +Cc: dri-devel [-- Attachment #1.1: Type: text/plain, Size: 2294 bytes --] On Tue, Aug 23, 2016 at 5:54 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > On Tue, Aug 23, 2016 at 05:39:36PM +0200, Andrea Merello wrote: > > On Tue, Aug 23, 2016 at 5:20 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > > > > > On Tue, Aug 23, 2016 at 04:08:04PM +0200, Andrea Merello wrote: > > > > Introduce drm_simple_display_pipe_attach_bridge() in order > > > > to make it possible to use drm encoders with the simple display > > > > pipes managed by simple_kms_helpers > > > > > > > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > > > > Signed-off-by: Andrea Merello <andrea.merello@gmail.com> > > > > Cc: Noralf Trønnes <noralf@tronnes.org> > > > > Cc: Daniel Vetter <daniel@ffwll.ch> > > > > Cc: David Airlie <airlied@linux.ie> > > > > > > Threading of your patch series is somehow broken, usually that should > all > > > work nicely if you've set up git send-email. > > > > > > One question: Should we ahve a drm_simple_display_pipe_detach_bridge > (for > > > cleanup) too? > > > > > > > Unsure if it worths. May be nice to have a balanced pair, but it would > > probably end up in > > a quite redundant one-line func, that only calls drm_bridge_detach with > the > > very same argument. > > > > ..But of course if you want I can add it in v2 series. > > Yes it's just going to be a one-line, but it'll do a typecast and so > better encapsulate the internals of the simple pipe helper. I'm unsure about what do you mean here. Why a typecast? Wouldn't it be simply drm_simple_display_pipe_detach_bridge(struct drm_bridge *bridge) calling in turn drm_detach_bridge(struct drm_bridge *bridge) with the very same argument? Or if you want to stay behind the pipe, then it could be drm_simple_display_pipe_detach_bridge(struct drm_simple_display_pipe *pipe), but I would say it just does something like drm_bridge_detach(pipe->encoder.bridge), so I don't really get your point about the cast, sorry.. > I think that's > worth it - we have piles&piles of functions and #defines just to make > little one-line bits of code a notch more readable. > > And yes the symmetry is nice too ;-) > OK, then I'll add it :) Andrea > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch > [-- Attachment #1.2: Type: text/html, Size: 3746 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm: simple_kms_helper: add support for bridges 2016-08-23 16:44 ` Andrea Merello @ 2016-08-23 20:01 ` Daniel Vetter 2016-08-24 6:21 ` Andrea Merello 0 siblings, 1 reply; 7+ messages in thread From: Daniel Vetter @ 2016-08-23 20:01 UTC (permalink / raw) To: Andrea Merello; +Cc: dri-devel On Tue, Aug 23, 2016 at 06:44:18PM +0200, Andrea Merello wrote: > On Tue, Aug 23, 2016 at 5:54 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > > > On Tue, Aug 23, 2016 at 05:39:36PM +0200, Andrea Merello wrote: > > > On Tue, Aug 23, 2016 at 5:20 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > > > > > > > On Tue, Aug 23, 2016 at 04:08:04PM +0200, Andrea Merello wrote: > > > > > Introduce drm_simple_display_pipe_attach_bridge() in order > > > > > to make it possible to use drm encoders with the simple display > > > > > pipes managed by simple_kms_helpers > > > > > > > > > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > > > > > Signed-off-by: Andrea Merello <andrea.merello@gmail.com> > > > > > Cc: Noralf Trønnes <noralf@tronnes.org> > > > > > Cc: Daniel Vetter <daniel@ffwll.ch> > > > > > Cc: David Airlie <airlied@linux.ie> > > > > > > > > Threading of your patch series is somehow broken, usually that should > > all > > > > work nicely if you've set up git send-email. > > > > > > > > One question: Should we ahve a drm_simple_display_pipe_detach_bridge > > (for > > > > cleanup) too? > > > > > > > > > > Unsure if it worths. May be nice to have a balanced pair, but it would > > > probably end up in > > > a quite redundant one-line func, that only calls drm_bridge_detach with > > the > > > very same argument. > > > > > > ..But of course if you want I can add it in v2 series. > > > > Yes it's just going to be a one-line, but it'll do a typecast and so > > better encapsulate the internals of the simple pipe helper. > > > I'm unsure about what do you mean here. Why a typecast? > > Wouldn't it be simply drm_simple_display_pipe_detach_bridge(struct > drm_bridge *bridge) calling in turn drm_detach_bridge(struct drm_bridge > *bridge) with the very same argument? > > Or if you want to stay behind the pipe, then it could be > drm_simple_display_pipe_detach_bridge(struct drm_simple_display_pipe *pipe), > but I would say it just does something like > drm_bridge_detach(pipe->encoder.bridge), so I don't really get your point > about the cast, sorry.. Yeah, the latter is what I mean. That way drivers don't have to dig around in the details of pipe. And it wouldn't be entirely just a wrapper, I think it'd be good to also clear pipe->encoder.bridge to NULL. Or do you think this is entirely pointless? Sometimes I do go overboard with curating pretty little functions ;-) -Daniel -- 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] drm: simple_kms_helper: add support for bridges 2016-08-23 20:01 ` Daniel Vetter @ 2016-08-24 6:21 ` Andrea Merello 0 siblings, 0 replies; 7+ messages in thread From: Andrea Merello @ 2016-08-24 6:21 UTC (permalink / raw) To: Daniel Vetter; +Cc: dri-devel [-- Attachment #1.1: Type: text/plain, Size: 2945 bytes --] On Tue, Aug 23, 2016 at 10:01 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > On Tue, Aug 23, 2016 at 06:44:18PM +0200, Andrea Merello wrote: > > On Tue, Aug 23, 2016 at 5:54 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > > > > > On Tue, Aug 23, 2016 at 05:39:36PM +0200, Andrea Merello wrote: > > > > On Tue, Aug 23, 2016 at 5:20 PM, Daniel Vetter <daniel@ffwll.ch> > wrote: > > > > > > > > > On Tue, Aug 23, 2016 at 04:08:04PM +0200, Andrea Merello wrote: > > > > > > Introduce drm_simple_display_pipe_attach_bridge() in order > > > > > > to make it possible to use drm encoders with the simple display > > > > > > pipes managed by simple_kms_helpers > > > > > > > > > > > > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > > > > > > Signed-off-by: Andrea Merello <andrea.merello@gmail.com> > > > > > > Cc: Noralf Trønnes <noralf@tronnes.org> > > > > > > Cc: Daniel Vetter <daniel@ffwll.ch> > > > > > > Cc: David Airlie <airlied@linux.ie> > > > > > > > > > > Threading of your patch series is somehow broken, usually that > should > > > all > > > > > work nicely if you've set up git send-email. > > > > > > > > > > One question: Should we ahve a drm_simple_display_pipe_ > detach_bridge > > > (for > > > > > cleanup) too? > > > > > > > > > > > > > Unsure if it worths. May be nice to have a balanced pair, but it > would > > > > probably end up in > > > > a quite redundant one-line func, that only calls drm_bridge_detach > with > > > the > > > > very same argument. > > > > > > > > ..But of course if you want I can add it in v2 series. > > > > > > Yes it's just going to be a one-line, but it'll do a typecast and so > > > better encapsulate the internals of the simple pipe helper. > > > > > > I'm unsure about what do you mean here. Why a typecast? > > > > Wouldn't it be simply drm_simple_display_pipe_detach_bridge(struct > > drm_bridge *bridge) calling in turn drm_detach_bridge(struct drm_bridge > > *bridge) with the very same argument? > > > > Or if you want to stay behind the pipe, then it could be > > drm_simple_display_pipe_detach_bridge(struct drm_simple_display_pipe > *pipe), > > but I would say it just does something like > > drm_bridge_detach(pipe->encoder.bridge), so I don't really get your > point > > about the cast, sorry.. > > Yeah, the latter is what I mean. That way drivers don't have to dig around > in the details of pipe. And it wouldn't be entirely just a wrapper, I > think it'd be good to also clear pipe->encoder.bridge to NULL. > > Yes, since I'm assigning it in drm_simple_display_pipe_attach_bridge, it seems good to clear it in drm_simple_display_pipe_detach. > Or do you think this is entirely pointless? Sometimes I do go overboard > with curating pretty little functions ;-) > I guess it shouldn't hurt anyway :) Andrea > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch > [-- Attachment #1.2: Type: text/html, Size: 4558 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-08-24 6:22 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-08-23 14:08 [PATCH 2/2] drm: simple_kms_helper: add support for bridges Andrea Merello 2016-08-23 15:20 ` Daniel Vetter 2016-08-23 15:39 ` Andrea Merello 2016-08-23 15:54 ` Daniel Vetter 2016-08-23 16:44 ` Andrea Merello 2016-08-23 20:01 ` Daniel Vetter 2016-08-24 6:21 ` Andrea Merello
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.