Re: [Freedreno] [PATCH v2] drm/msm/dpu: add display port support in DPU

2018-12-04 Thread Jeykumar Sankaran

On 2018-12-03 06:47, Sean Paul wrote:

On Tue, Nov 27, 2018 at 02:28:30PM -0800, Jeykumar Sankaran wrote:

Add display port support in DPU by creating hooks
for DP encoder enumeration and encoder mode
initialization.

This change is based on the SDM845 Display port
driver changes[1].

changes in v2:
- rebase on [2] (Sean Paul)
- remove unwanted error checks and
  switch cases (Jordan Crouse)

[1] https://lwn.net/Articles/768265/
[2] https://lkml.org/lkml/2018/11/17/87

Signed-off-by: Jeykumar Sankaran 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  8 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 47

+

 2 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

index d3f4501..1f6b4b1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2015,7 +2015,7 @@ static int dpu_encoder_setup_display(struct

dpu_encoder_virt *dpu_enc,

 {
int ret = 0;
int i = 0;
-   enum dpu_intf_type intf_type;
+   enum dpu_intf_type intf_type = INTF_NONE;


dpu_intf_type seems unnecessary, you could just use the 
DRM_MODE_ENCODER_*

value
directly?

enum dpu_intf_type enumerates HW interface types the SOC has. Below 
switch

case maps the DRM_MODE_ENCODER_* to HW dpu_intf_type it should reserve.
Note that DRM_MODE_ENCODER_* and dpu_intf_type are not mapped 1-to-1.
e.g. DRM_MODE_ENCODER_TMDS can be mapped to HDMI or DisplayPort.

Thanks,
Jeykumar S.


struct dpu_enc_phys_init_params phys_params;

if (!dpu_enc || !dpu_kms) {
@@ -2038,9 +2038,9 @@ static int dpu_encoder_setup_display(struct

dpu_encoder_virt *dpu_enc,

case DRM_MODE_ENCODER_DSI:
intf_type = INTF_DSI;
break;
-   default:
-   DPU_ERROR_ENC(dpu_enc, "unsupported display interface

type\n");

-   return -EINVAL;
+   case DRM_MODE_ENCODER_TMDS:
+   intf_type = INTF_DP;
+   break;
}

WARN_ON(disp_info->num_of_h_tiles < 1);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

index 985c855..7d931ae 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -473,6 +473,32 @@ static void _dpu_kms_initialize_dsi(struct

drm_device *dev,

}
 }

+static void _dpu_kms_initialize_displayport(struct drm_device *dev,
+   struct msm_drm_private *priv,
+   struct dpu_kms *dpu_kms)
+{
+   struct drm_encoder *encoder = NULL;
+   int rc;
+
+   if (!priv->dp)
+   return;
+
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
+   if (IS_ERR(encoder)) {
+   DPU_ERROR("encoder init failed for dsi display\n");
+   return;
+   }
+
+   rc = msm_dp_modeset_init(priv->dp, dev, encoder);
+   if (rc) {
+   DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
+   drm_encoder_cleanup(encoder);
+   return;
+   }
+
+   priv->encoders[priv->num_encoders++] = encoder;


No need to keep track of drm resources at the driver level, the core 
will

do
this for you. So can you please add a patch preceding this one to 
remove

the
priv->encoders/crtc/planes/connectors arrays?


+}
+
 /**
  * _dpu_kms_setup_displays - create encoders, bridges and connectors
  *   for underlying displays
@@ -487,6 +513,8 @@ static void _dpu_kms_setup_displays(struct

drm_device *dev,

Why are these functions voids? Seems like there are plenty of places 
for

them to
fail :)

Let's add a patch to the beginning of this series to properly handle
failures in
setup_displays and initialize_dsi


 {
_dpu_kms_initialize_dsi(dev, priv, dpu_kms);

+   _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
+
/**
 * Extend this function to initialize other
 * types of displays
@@ -723,13 +751,20 @@ static void _dpu_kms_set_encoder_mode(struct

msm_kms *kms,

info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
MSM_DISPLAY_CAP_VID_MODE;

-   /* TODO: No support for DSI swap */
-   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-   if (priv->dsi[i]) {
-   info.h_tile_instance[info.num_of_h_tiles] = i;
-   info.num_of_h_tiles++;
+   switch (info.intf_type) {
+   case DRM_MODE_ENCODER_DSI:
+   /* TODO: No support for DSI swap */
+   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
+   if (priv->dsi[i]) {
+   info.h_tile_instance[info.num_of_h_tiles]

= i;

+   info.num_of_h_tiles++;
+   }
}
-   

Re: [Freedreno] [PATCH v2] drm/msm/dpu: add display port support in DPU

2018-12-04 Thread Sean Paul
On Mon, Dec 03, 2018 at 07:02:07PM -0800, Jeykumar Sankaran wrote:
> On 2018-12-03 06:47, Sean Paul wrote:
> > On Tue, Nov 27, 2018 at 02:28:30PM -0800, Jeykumar Sankaran wrote:
> > > Add display port support in DPU by creating hooks
> > > for DP encoder enumeration and encoder mode
> > > initialization.
> > > 
> > > This change is based on the SDM845 Display port
> > > driver changes[1].
> > > 
> > > changes in v2:
> > >   - rebase on [2] (Sean Paul)
> > >   - remove unwanted error checks and
> > > switch cases (Jordan Crouse)
> > > 
> > > [1] https://lwn.net/Articles/768265/
> > > [2] https://lkml.org/lkml/2018/11/17/87
> > > 
> > > Signed-off-by: Jeykumar Sankaran 
> > > ---
> > >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  8 ++---
> > >  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 47
> > +
> > >  2 files changed, 45 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > > index d3f4501..1f6b4b1 100644
> > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > > @@ -2015,7 +2015,7 @@ static int dpu_encoder_setup_display(struct
> > dpu_encoder_virt *dpu_enc,
> > >  {
> > >   int ret = 0;
> > >   int i = 0;
> > > - enum dpu_intf_type intf_type;
> > > + enum dpu_intf_type intf_type = INTF_NONE;
> > 
> > dpu_intf_type seems unnecessary, you could just use the
> > DRM_MODE_ENCODER_*
> > value
> > directly?
> > 
> > >   struct dpu_enc_phys_init_params phys_params;
> > > 
> > >   if (!dpu_enc || !dpu_kms) {
> > > @@ -2038,9 +2038,9 @@ static int dpu_encoder_setup_display(struct
> > dpu_encoder_virt *dpu_enc,
> > >   case DRM_MODE_ENCODER_DSI:
> > >   intf_type = INTF_DSI;
> > >   break;
> > > - default:
> > > - DPU_ERROR_ENC(dpu_enc, "unsupported display interface
> > type\n");
> > > - return -EINVAL;
> > > + case DRM_MODE_ENCODER_TMDS:
> > > + intf_type = INTF_DP;
> > > + break;
> > >   }
> > > 
> > >   WARN_ON(disp_info->num_of_h_tiles < 1);
> > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > > index 985c855..7d931ae 100644
> > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> > > @@ -473,6 +473,32 @@ static void _dpu_kms_initialize_dsi(struct
> > drm_device *dev,
> > >   }
> > >  }
> > > 
> > > +static void _dpu_kms_initialize_displayport(struct drm_device *dev,
> > > + struct msm_drm_private *priv,
> > > + struct dpu_kms *dpu_kms)
> > > +{
> > > + struct drm_encoder *encoder = NULL;
> > > + int rc;
> > > +
> > > + if (!priv->dp)
> > > + return;
> > > +
> > > + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
> > > + if (IS_ERR(encoder)) {
> > > + DPU_ERROR("encoder init failed for dsi display\n");
> > > + return;
> > > + }
> > > +
> > > + rc = msm_dp_modeset_init(priv->dp, dev, encoder);
> > > + if (rc) {
> > > + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> > > + drm_encoder_cleanup(encoder);
> > > + return;
> > > + }
> > > +
> > > + priv->encoders[priv->num_encoders++] = encoder;
> > 
> > No need to keep track of drm resources at the driver level, the core
> > will
> > do
> > this for you. So can you please add a patch preceding this one to remove
> > the
> > priv->encoders/crtc/planes/connectors arrays?
> > 
> priv arrays for tracking drm components and priv->num_** counters are
> introduced
> by mdp4/5. DPU just adapted the implementation.
> 
> De-coupling DPU from these arrays is much easier than fixing them in mdp4/5.
> I see
> mdp5 is using it to track the max resources and also in ./msm_fbdev.c.

Ok, I'll take a look at it

Sean

> 
> Thanks and Regards,
> Jeykumar S.
> > > +}
> > > +
> > >  /**
> > >   * _dpu_kms_setup_displays - create encoders, bridges and connectors
> > >   *   for underlying displays
> > > @@ -487,6 +513,8 @@ static void _dpu_kms_setup_displays(struct
> > drm_device *dev,
> > 
> > Why are these functions voids? Seems like there are plenty of places for
> > them to
> > fail :)
> > 
> > Let's add a patch to the beginning of this series to properly handle
> > failures in
> > setup_displays and initialize_dsi
> > 
> > >  {
> > >   _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> > > 
> > > + _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> > > +
> > >   /**
> > >* Extend this function to initialize other
> > >* types of displays
> > > @@ -723,13 +751,20 @@ static void _dpu_kms_set_encoder_mode(struct
> > msm_kms *kms,
> > >   info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
> > >   MSM_DISPLAY_CAP_VID_MODE;
> > > 
> > > - /* TODO: No support for DSI swap */
> > > - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> > > - if 

Re: [Freedreno] [PATCH v2] drm/msm/dpu: add display port support in DPU

2018-12-03 Thread Sean Paul
On Tue, Nov 27, 2018 at 02:28:30PM -0800, Jeykumar Sankaran wrote:
> Add display port support in DPU by creating hooks
> for DP encoder enumeration and encoder mode
> initialization.
> 
> This change is based on the SDM845 Display port
> driver changes[1].
> 
> changes in v2:
>   - rebase on [2] (Sean Paul)
>   - remove unwanted error checks and
> switch cases (Jordan Crouse)
> 
> [1] https://lwn.net/Articles/768265/
> [2] https://lkml.org/lkml/2018/11/17/87
> 
> Signed-off-by: Jeykumar Sankaran 
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  8 ++---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 47 
> +
>  2 files changed, 45 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index d3f4501..1f6b4b1 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2015,7 +2015,7 @@ static int dpu_encoder_setup_display(struct 
> dpu_encoder_virt *dpu_enc,
>  {
>   int ret = 0;
>   int i = 0;
> - enum dpu_intf_type intf_type;
> + enum dpu_intf_type intf_type = INTF_NONE;

dpu_intf_type seems unnecessary, you could just use the DRM_MODE_ENCODER_* value
directly?

>   struct dpu_enc_phys_init_params phys_params;
>  
>   if (!dpu_enc || !dpu_kms) {
> @@ -2038,9 +2038,9 @@ static int dpu_encoder_setup_display(struct 
> dpu_encoder_virt *dpu_enc,
>   case DRM_MODE_ENCODER_DSI:
>   intf_type = INTF_DSI;
>   break;
> - default:
> - DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
> - return -EINVAL;
> + case DRM_MODE_ENCODER_TMDS:
> + intf_type = INTF_DP;
> + break;
>   }
>  
>   WARN_ON(disp_info->num_of_h_tiles < 1);
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 985c855..7d931ae 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -473,6 +473,32 @@ static void _dpu_kms_initialize_dsi(struct drm_device 
> *dev,
>   }
>  }
>  
> +static void _dpu_kms_initialize_displayport(struct drm_device *dev,
> + struct msm_drm_private *priv,
> + struct dpu_kms *dpu_kms)
> +{
> + struct drm_encoder *encoder = NULL;
> + int rc;
> +
> + if (!priv->dp)
> + return;
> +
> + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
> + if (IS_ERR(encoder)) {
> + DPU_ERROR("encoder init failed for dsi display\n");
> + return;
> + }
> +
> + rc = msm_dp_modeset_init(priv->dp, dev, encoder);
> + if (rc) {
> + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> + drm_encoder_cleanup(encoder);
> + return;
> + }
> +
> + priv->encoders[priv->num_encoders++] = encoder;

No need to keep track of drm resources at the driver level, the core will do
this for you. So can you please add a patch preceding this one to remove the
priv->encoders/crtc/planes/connectors arrays?

> +}
> +
>  /**
>   * _dpu_kms_setup_displays - create encoders, bridges and connectors
>   *   for underlying displays
> @@ -487,6 +513,8 @@ static void _dpu_kms_setup_displays(struct drm_device 
> *dev,

Why are these functions voids? Seems like there are plenty of places for them to
fail :)

Let's add a patch to the beginning of this series to properly handle failures in
setup_displays and initialize_dsi

>  {
>   _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>  
> + _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> +
>   /**
>* Extend this function to initialize other
>* types of displays
> @@ -723,13 +751,20 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms 
> *kms,
>   info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
>   MSM_DISPLAY_CAP_VID_MODE;
>  
> - /* TODO: No support for DSI swap */
> - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> - if (priv->dsi[i]) {
> - info.h_tile_instance[info.num_of_h_tiles] = i;
> - info.num_of_h_tiles++;
> + switch (info.intf_type) {
> + case DRM_MODE_ENCODER_DSI:
> + /* TODO: No support for DSI swap */
> + for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> + if (priv->dsi[i]) {
> + info.h_tile_instance[info.num_of_h_tiles] = i;
> + info.num_of_h_tiles++;
> + }
>   }
> - }
> + break;
> + case DRM_MODE_ENCODER_TMDS:
> + info.num_of_h_tiles = 1;
> + break;
> + };
>  
>   rc = dpu_encoder_setup(encoder->dev, encoder, );
>   if (rc)
> -- 
> The Qualcomm Innovation 

Re: [Freedreno] [PATCH v2] drm/msm/dpu: add display port support in DPU

2018-11-30 Thread kbuild test robot
Hi Jeykumar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robclark/msm-next]
[also build test ERROR on v4.20-rc4 next-20181130]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Jeykumar-Sankaran/drm-msm-dpu-add-display-port-support-in-DPU/20181130-230021
base:   git://people.freedesktop.org/~robclark/linux msm-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c: In function 
'_dpu_kms_initialize_displayport':
>> drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c:483:13: error: 'struct 
>> msm_drm_private' has no member named 'dp'; did you mean 'edp'?
 if (!priv->dp)
^~
edp
>> drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c:492:7: error: implicit declaration 
>> of function 'msm_dp_modeset_init'; did you mean 'msm_edp_modeset_init'? 
>> [-Werror=implicit-function-declaration]
 rc = msm_dp_modeset_init(priv->dp, dev, encoder);
  ^~~
  msm_edp_modeset_init
   drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c:492:33: error: 'struct 
msm_drm_private' has no member named 'dp'; did you mean 'edp'?
 rc = msm_dp_modeset_init(priv->dp, dev, encoder);
^~
edp
   cc1: some warnings being treated as errors

vim +483 drivers/gpu//drm/msm/disp/dpu1/dpu_kms.c

   475  
   476  static void _dpu_kms_initialize_displayport(struct drm_device *dev,
   477  struct msm_drm_private 
*priv,
   478  struct dpu_kms *dpu_kms)
   479  {
   480  struct drm_encoder *encoder = NULL;
   481  int rc;
   482  
 > 483  if (!priv->dp)
   484  return;
   485  
   486  encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
   487  if (IS_ERR(encoder)) {
   488  DPU_ERROR("encoder init failed for dsi display\n");
   489  return;
   490  }
   491  
 > 492  rc = msm_dp_modeset_init(priv->dp, dev, encoder);
   493  if (rc) {
   494  DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
   495  drm_encoder_cleanup(encoder);
   496  return;
   497  }
   498  
   499  priv->encoders[priv->num_encoders++] = encoder;
   500  }
   501  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno