Message ID | 1531494660-28668-3-git-send-email-alexandru-cosmin.gheorghe@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jul 13, 2018 at 04:11:00PM +0100, Alexandru Gheorghe wrote: > Set possible_clones field to report that the writeback connector and > the one driving the display could be enabled at the same time. > In future, please include a "Changes in vX" section so it's easier to tell what's changed. > Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> > --- > drivers/gpu/drm/arm/malidp_drv.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c > index 5b72605..08b5bb2 100644 > --- a/drivers/gpu/drm/arm/malidp_drv.c > +++ b/drivers/gpu/drm/arm/malidp_drv.c > @@ -616,6 +616,7 @@ static int malidp_bind(struct device *dev) > struct malidp_hw_device *hwdev; > struct platform_device *pdev = to_platform_device(dev); > struct of_device_id const *dev_id; > + struct drm_encoder *encoder; > /* number of lines for the R, G and B output */ > u8 output_width[MAX_OUTPUT_CHANNELS]; > int ret = 0, i; > @@ -737,6 +738,15 @@ static int malidp_bind(struct device *dev) > goto bind_fail; > } > > + /* We expect to have a maximum of two encoders one for the actual > + * display and a virtual one for the writeback connector > + */ > + WARN_ON(drm->mode_config.num_encoder > 2); > + list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { > + encoder->possible_clones = > + (1 << drm->mode_config.num_encoder) - 1; > + } This loop isn't necessary, you can just do the assignment once instead of num_encoder times :-) Sean > + > ret = malidp_irq_init(pdev); > if (ret < 0) > goto irq_init_fail; > -- > 2.7.4 >
On Fri, Jul 13, 2018 at 11:40:13AM -0400, Sean Paul wrote: > On Fri, Jul 13, 2018 at 04:11:00PM +0100, Alexandru Gheorghe wrote: > > Set possible_clones field to report that the writeback connector and > > the one driving the display could be enabled at the same time. > > > > In future, please include a "Changes in vX" section so it's easier to tell > what's changed. > > > Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> > > --- > > drivers/gpu/drm/arm/malidp_drv.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c > > index 5b72605..08b5bb2 100644 > > --- a/drivers/gpu/drm/arm/malidp_drv.c > > +++ b/drivers/gpu/drm/arm/malidp_drv.c > > @@ -616,6 +616,7 @@ static int malidp_bind(struct device *dev) > > struct malidp_hw_device *hwdev; > > struct platform_device *pdev = to_platform_device(dev); > > struct of_device_id const *dev_id; > > + struct drm_encoder *encoder; > > /* number of lines for the R, G and B output */ > > u8 output_width[MAX_OUTPUT_CHANNELS]; > > int ret = 0, i; > > @@ -737,6 +738,15 @@ static int malidp_bind(struct device *dev) > > goto bind_fail; > > } > > > > + /* We expect to have a maximum of two encoders one for the actual Also, while I'm here, drop the comment contents a line. ie: /* * We expect... */ Ref: https://www.kernel.org/doc/html/v4.10/process/coding-style.html#commenting Sean > > + * display and a virtual one for the writeback connector > > + */ > > + WARN_ON(drm->mode_config.num_encoder > 2); > > + list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { > > + encoder->possible_clones = > > + (1 << drm->mode_config.num_encoder) - 1; > > + } > > This loop isn't necessary, you can just do the assignment once instead of > num_encoder times :-) > > Sean > > > + > > ret = malidp_irq_init(pdev); > > if (ret < 0) > > goto irq_init_fail; > > -- > > 2.7.4 > > > > -- > Sean Paul, Software Engineer, Google / Chromium OS
On Fri, Jul 13, 2018 at 11:47:33AM -0400, Sean Paul wrote: > On Fri, Jul 13, 2018 at 11:40:13AM -0400, Sean Paul wrote: > > On Fri, Jul 13, 2018 at 04:11:00PM +0100, Alexandru Gheorghe wrote: > > > Set possible_clones field to report that the writeback connector and > > > the one driving the display could be enabled at the same time. > > > > > > > In future, please include a "Changes in vX" section so it's easier to tell > > what's changed. Yeah, sorry about that, the patch was so small that it never crossed my mind. > > > > > Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> > > > --- > > > drivers/gpu/drm/arm/malidp_drv.c | 10 ++++++++++ > > > 1 file changed, 10 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c > > > index 5b72605..08b5bb2 100644 > > > --- a/drivers/gpu/drm/arm/malidp_drv.c > > > +++ b/drivers/gpu/drm/arm/malidp_drv.c > > > @@ -616,6 +616,7 @@ static int malidp_bind(struct device *dev) > > > struct malidp_hw_device *hwdev; > > > struct platform_device *pdev = to_platform_device(dev); > > > struct of_device_id const *dev_id; > > > + struct drm_encoder *encoder; > > > /* number of lines for the R, G and B output */ > > > u8 output_width[MAX_OUTPUT_CHANNELS]; > > > int ret = 0, i; > > > @@ -737,6 +738,15 @@ static int malidp_bind(struct device *dev) > > > goto bind_fail; > > > } > > > > > > + /* We expect to have a maximum of two encoders one for the actual > > Also, while I'm here, drop the comment contents a line. ie: > > /* > * We expect... > */ > > Ref: https://www.kernel.org/doc/html/v4.10/process/coding-style.html#commenting I blame checkpatch, it should've complain about it. > > Sean > > > > + * display and a virtual one for the writeback connector > > > + */ > > > + WARN_ON(drm->mode_config.num_encoder > 2); > > > + list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { > > > + encoder->possible_clones = > > > + (1 << drm->mode_config.num_encoder) - 1; > > > + } > > > > This loop isn't necessary, you can just do the assignment once instead of > > num_encoder times :-) > > > > Sean > > Not sure I get what you are suggesting, there are two encoders, so at least two assignments and the loop does just that. > > > + > > > ret = malidp_irq_init(pdev); > > > if (ret < 0) > > > goto irq_init_fail; > > > -- > > > 2.7.4 > > > > > > > -- > > Sean Paul, Software Engineer, Google / Chromium OS > > -- > Sean Paul, Software Engineer, Google / Chromium OS
On Fri, Jul 13, 2018 at 04:55:41PM +0100, Alexandru-Cosmin Gheorghe wrote: > On Fri, Jul 13, 2018 at 11:47:33AM -0400, Sean Paul wrote: > > On Fri, Jul 13, 2018 at 11:40:13AM -0400, Sean Paul wrote: > > > On Fri, Jul 13, 2018 at 04:11:00PM +0100, Alexandru Gheorghe wrote: > > > > Set possible_clones field to report that the writeback connector and > > > > the one driving the display could be enabled at the same time. > > > > > > > > > > In future, please include a "Changes in vX" section so it's easier to tell > > > what's changed. > > Yeah, sorry about that, the patch was so small that it never crossed > my mind. > Anything you can do to help reviewers is most appreciated. > > > > > > > Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> > > > > --- > > > > drivers/gpu/drm/arm/malidp_drv.c | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c > > > > index 5b72605..08b5bb2 100644 > > > > --- a/drivers/gpu/drm/arm/malidp_drv.c > > > > +++ b/drivers/gpu/drm/arm/malidp_drv.c > > > > @@ -616,6 +616,7 @@ static int malidp_bind(struct device *dev) > > > > struct malidp_hw_device *hwdev; > > > > struct platform_device *pdev = to_platform_device(dev); > > > > struct of_device_id const *dev_id; > > > > + struct drm_encoder *encoder; > > > > /* number of lines for the R, G and B output */ > > > > u8 output_width[MAX_OUTPUT_CHANNELS]; > > > > int ret = 0, i; > > > > @@ -737,6 +738,15 @@ static int malidp_bind(struct device *dev) > > > > goto bind_fail; > > > > } > > > > > > > > + /* We expect to have a maximum of two encoders one for the actual > > > > Also, while I'm here, drop the comment contents a line. ie: > > > > /* > > * We expect... > > */ > > > > Ref: https://www.kernel.org/doc/html/v4.10/process/coding-style.html#commenting > > I blame checkpatch, it should've complain about it. > > > > > Sean > > > > > > + * display and a virtual one for the writeback connector > > > > + */ > > > > + WARN_ON(drm->mode_config.num_encoder > 2); > > > > + list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { > > > > + encoder->possible_clones = > > > > + (1 << drm->mode_config.num_encoder) - 1; > > > > + } > > > > > > This loop isn't necessary, you can just do the assignment once instead of > > > num_encoder times :-) > > > > > > Sean > > > > > Not sure I get what you are suggesting, there are two encoders, so at least > two assignments and the loop does just that. Yeah, temporarily (I hope) lapse on my part. You're right :-) Sean > > > > > + > > > > ret = malidp_irq_init(pdev); > > > > if (ret < 0) > > > > goto irq_init_fail; > > > > -- > > > > 2.7.4 > > > > > > > > > > -- > > > Sean Paul, Software Engineer, Google / Chromium OS > > > > -- > > Sean Paul, Software Engineer, Google / Chromium OS > > -- > Cheers, > Alex G
Drivers that subclass drm_plane need to copy the logic for linking the drm_plane with its state and to initialize core properties to their default values. E.g (alpha and rotation) Having a helper to reset the plane_state makes sense because of multiple reasons: 1. Eliminate code duplication. 2. Add a single place for initializing core properties to their default values, no need for driver to do it if what the helper sets makes sense for them. 3. No need to debug the driver when you enable a core property and observe it doesn't have a proper default value. Tested with mali-dp the other drivers are just built-tested. Alexandru Gheorghe (10): drm/atomic: Add __drm_atomic_helper_plane_reset drm/amd/display: Use __drm_atomic_helper_plane_reset instead of copying the logic drm: mali-dp: Use __drm_atomic_helper_plane_reset instead of copying the logic drm: atmel-hlcdc: Use __drm_atomic_helper_plane_reset instead of copying the logic drm/exynos: Use __drm_atomic_helper_plane_reset instead of copying the logic drm/imx: Use __drm_atomic_helper_plane_reset instead of copying the logic drm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying the logic drm/sun4i: Use __drm_atomic_helper_plane_reset instead of copying the logic drm/vc4: Use __drm_atomic_helper_plane_reset instead of copying the logic drm/vmwgfx: Use __drm_atomic_helper_plane_reset instead of copying the logic .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++-- drivers/gpu/drm/arm/malidp_planes.c | 7 ++-- .../gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +-- drivers/gpu/drm/drm_atomic_helper.c | 32 +++++++++++++------ drivers/gpu/drm/exynos/exynos_drm_plane.c | 3 +- drivers/gpu/drm/imx/ipuv3-plane.c | 8 ++--- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +-- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 4 +-- drivers/gpu/drm/sun4i/sun4i_layer.c | 4 +-- drivers/gpu/drm/vc4/vc4_plane.c | 4 +-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +-- include/drm/drm_atomic_helper.h | 2 ++ 12 files changed, 39 insertions(+), 45 deletions(-)
On 2018-07-20 05:14 PM, Alexandru Gheorghe wrote: > Drivers that subclass drm_plane need to copy the logic for linking the > drm_plane with its state and to initialize core properties to their > default values. E.g (alpha and rotation) > > Having a helper to reset the plane_state makes sense because of multiple > reasons: > 1. Eliminate code duplication. > 2. Add a single place for initializing core properties to their > default values, no need for driver to do it if what the helper sets > makes sense for them. > 3. No need to debug the driver when you enable a core property and > observe it doesn't have a proper default value. > > Tested with mali-dp the other drivers are just built-tested. > For some reason I lost 02/10 hence I'm replying to the cover letter. Patches 1 & 2 are Reviewed-by: Harry Wentland <harry.wentland@amd.com> Harry > > Alexandru Gheorghe (10): > drm/atomic: Add __drm_atomic_helper_plane_reset > drm/amd/display: Use __drm_atomic_helper_plane_reset instead of > copying the logic > drm: mali-dp: Use __drm_atomic_helper_plane_reset instead of copying > the logic > drm: atmel-hlcdc: Use __drm_atomic_helper_plane_reset instead of > copying the logic > drm/exynos: Use __drm_atomic_helper_plane_reset instead of copying the > logic > drm/imx: Use __drm_atomic_helper_plane_reset instead of copying the > logic > drm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying > the logic > drm/sun4i: Use __drm_atomic_helper_plane_reset instead of copying the > logic > drm/vc4: Use __drm_atomic_helper_plane_reset instead of copying the > logic > drm/vmwgfx: Use __drm_atomic_helper_plane_reset instead of copying the > logic > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++-- > drivers/gpu/drm/arm/malidp_planes.c | 7 ++-- > .../gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +-- > drivers/gpu/drm/drm_atomic_helper.c | 32 +++++++++++++------ > drivers/gpu/drm/exynos/exynos_drm_plane.c | 3 +- > drivers/gpu/drm/imx/ipuv3-plane.c | 8 ++--- > drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +-- > drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 4 +-- > drivers/gpu/drm/sun4i/sun4i_layer.c | 4 +-- > drivers/gpu/drm/vc4/vc4_plane.c | 4 +-- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +-- > include/drm/drm_atomic_helper.h | 2 ++ > 12 files changed, 39 insertions(+), 45 deletions(-) >
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 5b72605..08b5bb2 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -616,6 +616,7 @@ static int malidp_bind(struct device *dev) struct malidp_hw_device *hwdev; struct platform_device *pdev = to_platform_device(dev); struct of_device_id const *dev_id; + struct drm_encoder *encoder; /* number of lines for the R, G and B output */ u8 output_width[MAX_OUTPUT_CHANNELS]; int ret = 0, i; @@ -737,6 +738,15 @@ static int malidp_bind(struct device *dev) goto bind_fail; } + /* We expect to have a maximum of two encoders one for the actual + * display and a virtual one for the writeback connector + */ + WARN_ON(drm->mode_config.num_encoder > 2); + list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { + encoder->possible_clones = + (1 << drm->mode_config.num_encoder) - 1; + } + ret = malidp_irq_init(pdev); if (ret < 0) goto irq_init_fail;
Set possible_clones field to report that the writeback connector and the one driving the display could be enabled at the same time. Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com> --- drivers/gpu/drm/arm/malidp_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+)