Skip to contentSkip to conversation

drm: simple_kms_helper: add support for bridges

PATCH In review Andrea Merello 2 participants 7 messages Aug 23, 2016 – Aug 24, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 drm: simple_kms_helper: add support for bridges

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

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
drivers/gpu/drm/drm_simple_kms_helper.c +22 -0
index 3a48c7c..05ee61d 100644
@@ -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
include/drm/drm_simple_kms_helper.h +3 -0
index 2690397..1d73bcf 100644
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 9 lines · 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

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>

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

Quoted 50 lines
drivers/gpu/drm/drm_simple_kms_helper.c +22 -0
index 3a48c7c..05ee61d 100644
@@ -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
include/drm/drm_simple_kms_helper.h +3 -1
index 2690397..1d73bcf 100644
@@ -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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · 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

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Quoted 6 lines

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

Quoted 60 lines

-Daniel

Review

Quoted 2 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/drm_simple_kms_helper.c

drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs

Quoted 4 lines

index 3a48c7c..05ee61d 100644

drivers/gpu/drm/drm_simple_kms_helper.c +0 -0
@@ -133,6 +133,28 @@ static const struct drm_plane_funcs

drm_simple_kms_plane_funcs = {

drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs · line 136

Quoted 4 lines
drivers/gpu/drm/drm_simple_kms_helper.c +1 -0
 };
 
 /**
+ * drm_simple_display_pipe_attach_bridge - Attach a bridge to the

display pipe

drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs drm_simple_kms_plane_funcs = {

Quoted 4 lines
drivers/gpu/drm/drm_simple_kms_helper.c +4 -0
+ * @pipe: simple display pipe object
+ * @bridge: bridge to attach
+ *
+ * Makes it possible to still use the drm_simple_display_pipe helpers

when

drivers/gpu/drm/drm_simple_kms_helper.c static const struct drm_plane_funcs drm_simple_kms_plane_funcs = {

Quoted 8 lines
drivers/gpu/drm/drm_simple_kms_helper.c +8 -0
+ * 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,

Review

Quoted 13 lines
drivers/gpu/drm/drm_simple_kms_helper.c +9 -0
+                                     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
(quoted diff) +0 -0

b/include/drm/drm_simple_kms_helper.h

include/drm/drm_simple_kms_helper.h struct drm_simple_display_pipe { · line 88

Quoted 8 lines

index 2690397..1d73bcf 100644

include/drm/drm_simple_kms_helper.h +1 -0
@@ -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,

Quoted 7 lines
include/drm/drm_simple_kms_helper.h +2 -1
+                                     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

Quoted 5 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 20 lines · Andrea Merello
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · 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

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Quoted 6 lines

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?

Quoted 6 lines

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 26 lines · Daniel Vetter
Quoted 7 lines · Andrea Merello
Quoted 5 lines · Daniel Vetter
Quoted 4 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>

Threading of your patch series is somehow broken, usually that should

all

Quoted 3 lines
Quoted 3 lines

work nicely if you've set up git send-email.

One question: Should we ahve a drm_simple_display_pipe_detach_bridge

(for

Quoted 6 lines
Quoted 2 lines

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

Quoted 7 lines

the

Quoted 3 lines

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..

Quoted 6 lines

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

Quoted 6 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 43 lines · Andrea Merello
Quoted 26 lines · Daniel Vetter
Quoted 7 lines · Andrea Merello
Quoted 5 lines · Daniel Vetter
Quoted 4 lines · 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

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>

Threading of your patch series is somehow broken, usually that should

all

Quoted 3 lines
Quoted 3 lines

work nicely if you've set up git send-email.

One question: Should we ahve a drm_simple_display_pipe_detach_bridge

(for

Quoted 6 lines
Quoted 2 lines

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

Quoted 7 lines

the

Quoted 3 lines

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?

Quoted 5 lines

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
Quoted 54 lines · Daniel Vetter
Quoted 4 lines · Andrea Merello
Quoted 2 lines · Daniel Vetter
Quoted 1 line · Andrea Merello

On Tue, Aug 23, 2016 at 5:20 PM, Daniel Vetter <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · Andrea Merello
Quoted 4 lines

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

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>

Threading of your patch series is somehow broken, usually that

should

Quoted 4 lines
Quoted 4 lines

all

Quoted 3 lines
Quoted 3 lines

work nicely if you've set up git send-email.

One question: Should we ahve a drm_simple_display_pipe_

detach_bridge

Quoted 5 lines
Quoted 5 lines

(for

Quoted 4 lines
Quoted 2 lines

cleanup) too?

Unsure if it worths. May be nice to have a balanced pair, but it

would

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

probably end up in
a quite redundant one-line func, that only calls drm_bridge_detach

with

Quoted 9 lines
Quoted 7 lines

the

Quoted 3 lines

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.

Quoted 8 lines

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),

Quoted 2 lines

but I would say it just does something like drm_bridge_detach(pipe->encoder.bridge), so I don't really get your

Quoted 8 lines

point

Quoted 1 line

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.

Quoted 3 lines

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

Quoted 6 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel