[Intel-gfx] [PATCH 7/8] drm/i915: Remove mostly duplicated video DIP handling from PSR code

2017-08-18 Thread ville . syrjala
From: Ville Syrjälä 

Now that the infoframe hooks are part of the intel_dig_port, we can use
the normal .write_infoframe() hook to update the VSC SDP. We do need to
deal with the size difference between the VSC DIP and the others though.

Another minor snag is that the compiler will complain to use if we keep
using enum hdmi_infoframe_type type and passing in the DP define instead,
so et's just change to unsigned int all over for the inforframe type.

Reviewed-by: Rodrigo Vivi 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/intel_drv.h  |  2 +-
 drivers/gpu/drm/i915/intel_hdmi.c | 26 --
 drivers/gpu/drm/i915/intel_psr.c  | 39 ++-
 3 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4cfd3b7fc784..9b72fc01bce8 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1062,7 +1062,7 @@ struct intel_digital_port {
 
void (*write_infoframe)(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len);
void (*set_infoframes)(struct drm_encoder *encoder,
   bool enable,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 65083876294d..176b6ac3158c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -70,7 +70,7 @@ static struct intel_hdmi *intel_attached_hdmi(struct 
drm_connector *connector)
return enc_to_intel_hdmi(_attached_encoder(connector)->base);
 }
 
-static u32 g4x_infoframe_index(enum hdmi_infoframe_type type)
+static u32 g4x_infoframe_index(unsigned int type)
 {
switch (type) {
case HDMI_INFOFRAME_TYPE_AVI:
@@ -85,7 +85,7 @@ static u32 g4x_infoframe_index(enum hdmi_infoframe_type type)
}
 }
 
-static u32 g4x_infoframe_enable(enum hdmi_infoframe_type type)
+static u32 g4x_infoframe_enable(unsigned int type)
 {
switch (type) {
case HDMI_INFOFRAME_TYPE_AVI:
@@ -100,9 +100,11 @@ static u32 g4x_infoframe_enable(enum hdmi_infoframe_type 
type)
}
 }
 
-static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type)
+static u32 hsw_infoframe_enable(unsigned int type)
 {
switch (type) {
+   case DP_SDP_VSC:
+   return VIDEO_DIP_ENABLE_VSC_HSW;
case HDMI_INFOFRAME_TYPE_AVI:
return VIDEO_DIP_ENABLE_AVI_HSW;
case HDMI_INFOFRAME_TYPE_SPD:
@@ -118,10 +120,12 @@ static u32 hsw_infoframe_enable(enum hdmi_infoframe_type 
type)
 static i915_reg_t
 hsw_dip_data_reg(struct drm_i915_private *dev_priv,
 enum transcoder cpu_transcoder,
-enum hdmi_infoframe_type type,
+unsigned int type,
 int i)
 {
switch (type) {
+   case DP_SDP_VSC:
+   return HSW_TVIDEO_DIP_VSC_DATA(cpu_transcoder, i);
case HDMI_INFOFRAME_TYPE_AVI:
return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder, i);
case HDMI_INFOFRAME_TYPE_SPD:
@@ -136,7 +140,7 @@ hsw_dip_data_reg(struct drm_i915_private *dev_priv,
 
 static void g4x_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len)
 {
const uint32_t *data = frame;
@@ -191,7 +195,7 @@ static bool g4x_infoframe_enabled(struct drm_encoder 
*encoder,
 
 static void ibx_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len)
 {
const uint32_t *data = frame;
@@ -251,7 +255,7 @@ static bool ibx_infoframe_enabled(struct drm_encoder 
*encoder,
 
 static void cpt_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len)
 {
const uint32_t *data = frame;
@@ -309,7 +313,7 @@ static bool cpt_infoframe_enabled(struct drm_encoder 
*encoder,
 
 static void vlv_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+  

Re: [Intel-gfx] [PATCH 7/8] drm/i915: Remove mostly duplicated video DIP handling from PSR code

2017-08-17 Thread Rodrigo Vivi
On Fri, May 19, 2017 at 04:17:24PM +0300, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Now that the infoframe hooks are part of the intel_dig_port, we can use
> the normal .write_infoframe() hook to update the VSC SDP. We do need to
> deal with the size difference between the VSC DIP and the others though.
> 
> Another minor snag is that the compiler will complain to use if we keep
> using enum hdmi_infoframe_type type and passing in the DP define instead,
> so et's just change to unsigned int all over for the inforframe type.
> 
> Signed-off-by: Ville Syrjälä 

how didn't we have this before?! :)

Reviewed-by: Rodrigo Vivi 

> ---
>  drivers/gpu/drm/i915/intel_drv.h  |  2 +-
>  drivers/gpu/drm/i915/intel_hdmi.c | 26 --
>  drivers/gpu/drm/i915/intel_psr.c  | 39 
> ++-
>  3 files changed, 23 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h 
> b/drivers/gpu/drm/i915/intel_drv.h
> index a3d66ccafa5e..534a5bfb273e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1067,7 +1067,7 @@ struct intel_digital_port {
>  
>   void (*write_infoframe)(struct drm_encoder *encoder,
>   const struct intel_crtc_state *crtc_state,
> - enum hdmi_infoframe_type type,
> + unsigned int type,
>   const void *frame, ssize_t len);
>   void (*set_infoframes)(struct drm_encoder *encoder,
>  bool enable,
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
> b/drivers/gpu/drm/i915/intel_hdmi.c
> index 6b1c3f998a63..47a9f7f98a62 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -70,7 +70,7 @@ static struct intel_hdmi *intel_attached_hdmi(struct 
> drm_connector *connector)
>   return enc_to_intel_hdmi(_attached_encoder(connector)->base);
>  }
>  
> -static u32 g4x_infoframe_index(enum hdmi_infoframe_type type)
> +static u32 g4x_infoframe_index(unsigned int type)
>  {
>   switch (type) {
>   case HDMI_INFOFRAME_TYPE_AVI:
> @@ -85,7 +85,7 @@ static u32 g4x_infoframe_index(enum hdmi_infoframe_type 
> type)
>   }
>  }
>  
> -static u32 g4x_infoframe_enable(enum hdmi_infoframe_type type)
> +static u32 g4x_infoframe_enable(unsigned int type)
>  {
>   switch (type) {
>   case HDMI_INFOFRAME_TYPE_AVI:
> @@ -100,9 +100,11 @@ static u32 g4x_infoframe_enable(enum hdmi_infoframe_type 
> type)
>   }
>  }
>  
> -static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type)
> +static u32 hsw_infoframe_enable(unsigned int type)
>  {
>   switch (type) {
> + case DP_SDP_VSC:
> + return VIDEO_DIP_ENABLE_VSC_HSW;
>   case HDMI_INFOFRAME_TYPE_AVI:
>   return VIDEO_DIP_ENABLE_AVI_HSW;
>   case HDMI_INFOFRAME_TYPE_SPD:
> @@ -118,10 +120,12 @@ static u32 hsw_infoframe_enable(enum 
> hdmi_infoframe_type type)
>  static i915_reg_t
>  hsw_dip_data_reg(struct drm_i915_private *dev_priv,
>enum transcoder cpu_transcoder,
> -  enum hdmi_infoframe_type type,
> +  unsigned int type,
>int i)
>  {
>   switch (type) {
> + case DP_SDP_VSC:
> + return HSW_TVIDEO_DIP_VSC_DATA(cpu_transcoder, i);
>   case HDMI_INFOFRAME_TYPE_AVI:
>   return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder, i);
>   case HDMI_INFOFRAME_TYPE_SPD:
> @@ -136,7 +140,7 @@ hsw_dip_data_reg(struct drm_i915_private *dev_priv,
>  
>  static void g4x_write_infoframe(struct drm_encoder *encoder,
>   const struct intel_crtc_state *crtc_state,
> - enum hdmi_infoframe_type type,
> + unsigned int type,
>   const void *frame, ssize_t len)
>  {
>   const uint32_t *data = frame;
> @@ -191,7 +195,7 @@ static bool g4x_infoframe_enabled(struct drm_encoder 
> *encoder,
>  
>  static void ibx_write_infoframe(struct drm_encoder *encoder,
>   const struct intel_crtc_state *crtc_state,
> - enum hdmi_infoframe_type type,
> + unsigned int type,
>   const void *frame, ssize_t len)
>  {
>   const uint32_t *data = frame;
> @@ -251,7 +255,7 @@ static bool ibx_infoframe_enabled(struct drm_encoder 
> *encoder,
>  
>  static void cpt_write_infoframe(struct drm_encoder *encoder,
>   const struct intel_crtc_state *crtc_state,
> - enum hdmi_infoframe_type type,
> + unsigned int type,
>   const void *frame, ssize_t len)
>  {
>   const uint32_t *data = frame;
> @@ -309,7 +313,7 @@ static bool 

[Intel-gfx] [PATCH 7/8] drm/i915: Remove mostly duplicated video DIP handling from PSR code

2017-05-19 Thread ville . syrjala
From: Ville Syrjälä 

Now that the infoframe hooks are part of the intel_dig_port, we can use
the normal .write_infoframe() hook to update the VSC SDP. We do need to
deal with the size difference between the VSC DIP and the others though.

Another minor snag is that the compiler will complain to use if we keep
using enum hdmi_infoframe_type type and passing in the DP define instead,
so et's just change to unsigned int all over for the inforframe type.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/intel_drv.h  |  2 +-
 drivers/gpu/drm/i915/intel_hdmi.c | 26 --
 drivers/gpu/drm/i915/intel_psr.c  | 39 ++-
 3 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a3d66ccafa5e..534a5bfb273e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1067,7 +1067,7 @@ struct intel_digital_port {
 
void (*write_infoframe)(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len);
void (*set_infoframes)(struct drm_encoder *encoder,
   bool enable,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index 6b1c3f998a63..47a9f7f98a62 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -70,7 +70,7 @@ static struct intel_hdmi *intel_attached_hdmi(struct 
drm_connector *connector)
return enc_to_intel_hdmi(_attached_encoder(connector)->base);
 }
 
-static u32 g4x_infoframe_index(enum hdmi_infoframe_type type)
+static u32 g4x_infoframe_index(unsigned int type)
 {
switch (type) {
case HDMI_INFOFRAME_TYPE_AVI:
@@ -85,7 +85,7 @@ static u32 g4x_infoframe_index(enum hdmi_infoframe_type type)
}
 }
 
-static u32 g4x_infoframe_enable(enum hdmi_infoframe_type type)
+static u32 g4x_infoframe_enable(unsigned int type)
 {
switch (type) {
case HDMI_INFOFRAME_TYPE_AVI:
@@ -100,9 +100,11 @@ static u32 g4x_infoframe_enable(enum hdmi_infoframe_type 
type)
}
 }
 
-static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type)
+static u32 hsw_infoframe_enable(unsigned int type)
 {
switch (type) {
+   case DP_SDP_VSC:
+   return VIDEO_DIP_ENABLE_VSC_HSW;
case HDMI_INFOFRAME_TYPE_AVI:
return VIDEO_DIP_ENABLE_AVI_HSW;
case HDMI_INFOFRAME_TYPE_SPD:
@@ -118,10 +120,12 @@ static u32 hsw_infoframe_enable(enum hdmi_infoframe_type 
type)
 static i915_reg_t
 hsw_dip_data_reg(struct drm_i915_private *dev_priv,
 enum transcoder cpu_transcoder,
-enum hdmi_infoframe_type type,
+unsigned int type,
 int i)
 {
switch (type) {
+   case DP_SDP_VSC:
+   return HSW_TVIDEO_DIP_VSC_DATA(cpu_transcoder, i);
case HDMI_INFOFRAME_TYPE_AVI:
return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder, i);
case HDMI_INFOFRAME_TYPE_SPD:
@@ -136,7 +140,7 @@ hsw_dip_data_reg(struct drm_i915_private *dev_priv,
 
 static void g4x_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len)
 {
const uint32_t *data = frame;
@@ -191,7 +195,7 @@ static bool g4x_infoframe_enabled(struct drm_encoder 
*encoder,
 
 static void ibx_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len)
 {
const uint32_t *data = frame;
@@ -251,7 +255,7 @@ static bool ibx_infoframe_enabled(struct drm_encoder 
*encoder,
 
 static void cpt_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,
const void *frame, ssize_t len)
 {
const uint32_t *data = frame;
@@ -309,7 +313,7 @@ static bool cpt_infoframe_enabled(struct drm_encoder 
*encoder,
 
 static void vlv_write_infoframe(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state,
-   enum hdmi_infoframe_type type,
+   unsigned int type,