Re: [PATCH 4/4] drm/panel: otm8009a: use new backlight api

2018-05-14 Thread Vincent ABRIOU
Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> Use the new backlight api.
> 
> Signed-off-by: Philippe Cornu <philippe.co...@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 26 
> 
>   1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
> b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 4c638b7b9943..c2a71bd17e08 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel)
>   if (!ctx->enabled)
>   return 0; /* This is not an issue so we return 0 here */
>   
> - /* Power off the backlight. Note: end-user still controls brightness */
> - ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
> - ret = backlight_update_status(ctx->bl_dev);
> - if (ret)
> - return ret;
> + backlight_disable(ctx->bl_dev);
>   
>   ret = mipi_dsi_dcs_set_display_off(dsi);
>   if (ret)
> @@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel)
>   if (ctx->enabled)
>   return 0;
>   
> - /*
> -  * Power on the backlight. Note: end-user still controls brightness
> -  * Note: ctx->prepared must be true before updating the backlight.
> -  */
> - ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
> - backlight_update_status(ctx->bl_dev);
> + backlight_enable(ctx->bl_dev);
>   
>   ctx->enabled = true;
>   
> @@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
>   ctx->panel.dev = dev;
>   ctx->panel.funcs = _drm_funcs;
>   
> - ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
> - _backlight_ops, NULL);
> + ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev),
> +  dsi->host->dev, ctx,
> +  _backlight_ops,
> +  NULL);
>   if (IS_ERR(ctx->bl_dev)) {
> - dev_err(dev, "failed to register backlight device\n");
> - return PTR_ERR(ctx->bl_dev);
> + ret = PTR_ERR(ctx->bl_dev);
> + dev_err(dev, "failed to register backlight %d\n", ret);
> + return ret;
>   }
>   
>   ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX;
> @@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi)
>   mipi_dsi_detach(dsi);
>   drm_panel_remove(>panel);
>   
> - backlight_device_unregister(ctx->bl_dev);
> -
>   return 0;
>   }
>   
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/4] drm/panel: otm8009a: no message if probe success

2018-05-14 Thread Vincent ABRIOU
Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> Remove the message in case of probe success. This comes from
> a suggestion followed in the recent integration of the
> raydium rm68200 panel.
> 
> Signed-off-by: Philippe Cornu <philippe.co...@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 11 ++-
>   1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
> b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index de4a16d5275c..4c638b7b9943 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -14,8 +14,6 @@
>   #include 
>   #include 
>   
> -#define DRV_NAME "orisetech_otm8009a"
> -
>   #define OTM8009A_BACKLIGHT_DEFAULT  240
>   #define OTM8009A_BACKLIGHT_MAX  255
>   
> @@ -461,7 +459,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
>   ctx->panel.dev = dev;
>   ctx->panel.funcs = _drm_funcs;
>   
> - ctx->bl_dev = backlight_device_register(DRV_NAME "_backlight", dev, ctx,
> + ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
>   _backlight_ops, NULL);
>   if (IS_ERR(ctx->bl_dev)) {
>   dev_err(dev, "failed to register backlight device\n");
> @@ -483,11 +481,6 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
>   return ret;
>   }
>   
> - DRM_INFO(DRV_NAME "_panel %ux%u@%u %ubpp dsi %udl - ready\n",
> -  default_mode.hdisplay, default_mode.vdisplay,
> -  default_mode.vrefresh,
> -  mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);
> -
>   return 0;
>   }
>   
> @@ -513,7 +506,7 @@ static struct mipi_dsi_driver orisetech_otm8009a_driver = 
> {
>   .probe  = otm8009a_probe,
>   .remove = otm8009a_remove,
>   .driver = {
> - .name = DRV_NAME "_panel",
> + .name = "panel-orisetech-otm8009a",
>   .of_match_table = orisetech_otm8009a_of_match,
>   },
>   };
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable()

2018-05-14 Thread Vincent ABRIOU
Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> The backlight 1st update was in the otm8009a_prepare() function
> for a bad reason: backlight was not working in video mode and the
> otm8009a_prepare() is in command mode for the init sequence. As the
> backlight is now fixed (no lpm), it is good to put it back in the
> otm8009a_enable() function, avoiding also image glitches visible
> on some "slow" devices.
> 
> Signed-off-by: Philippe Cornu <philippe.co...@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 17 ++---
>   1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
> b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 0fd2e0144d2b..de4a16d5275c 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -330,13 +330,6 @@ static int otm8009a_prepare(struct drm_panel *panel)
>   
>   ctx->prepared = true;
>   
> - /*
> -  * Power on the backlight. Note: end-user still controls brightness
> -  * Note: ctx->prepared must be true before updating the backlight.
> -  */
> - ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
> - backlight_update_status(ctx->bl_dev);
> -
>   return 0;
>   }
>   
> @@ -344,6 +337,16 @@ static int otm8009a_enable(struct drm_panel *panel)
>   {
>   struct otm8009a *ctx = panel_to_otm8009a(panel);
>   
> + if (ctx->enabled)
> + return 0;
> +
> + /*
> +  * Power on the backlight. Note: end-user still controls brightness
> +  * Note: ctx->prepared must be true before updating the backlight.
> +  */
> + ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
> + backlight_update_status(ctx->bl_dev);
> +
>   ctx->enabled = true;
>   
>   return 0;
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/4] drm/panel: otm8009a: fix backlight updates

2018-05-14 Thread Vincent ABRIOU
Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> Backlight updates was not working anymore since the good
> implementation of the dsi lpm mode in the dsi host driver.
> After a longer analysis, the backlight updates in dsi video
> mode require the dsi hs mode.
> Note: it is important to keep the dsi lpm mode for the rest
> of the driver as init sequence, sleep in/out... dsi commands
> work in lp mode.
> 
> Signed-off-by: Philippe Cornu <philippe.co...@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 18 --
>   1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
> b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 90f1ae4af93c..0fd2e0144d2b 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -98,6 +98,20 @@ static void otm8009a_dcs_write_buf(struct otm8009a *ctx, 
> const void *data,
>   DRM_WARN("mipi dsi dcs write buffer failed\n");
>   }
>   
> +static void otm8009a_dcs_write_buf_hs(struct otm8009a *ctx, const void *data,
> +   size_t len)
> +{
> + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> +
> + /* data will be sent in dsi hs mode (ie. no lpm) */
> + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +
> + otm8009a_dcs_write_buf(ctx, data, len);
> +
> + /* restore back the dsi lpm mode */
> + dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> +}
> +
>   #define dcs_write_seq(ctx, seq...)  \
>   ({  \
>   static const u8 d[] = { seq };  \
> @@ -387,7 +401,7 @@ static int otm8009a_backlight_update_status(struct 
> backlight_device *bd)
>*/
>   data[0] = MIPI_DCS_SET_DISPLAY_BRIGHTNESS;
>   data[1] = bd->props.brightness;
> - otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
> + otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
>   
>   /* set Brightness Control & Backlight on */
>   data[1] = 0x24;
> @@ -399,7 +413,7 @@ static int otm8009a_backlight_update_status(struct 
> backlight_device *bd)
>   
>   /* Update Brightness Control & Backlight */
>   data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
> - otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
> + otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
>   
>   return 0;
>   }
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/stm: ltdc: add user update info in plane print state

2018-04-16 Thread Vincent ABRIOU
Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abr...@st.com>

On 04/07/2018 11:35 PM, Philippe Cornu wrote:
> This patch adds the user update information in
> frames-per-second into the drm debugfs plane state.
> 
> Signed-off-by: Philippe Cornu <philippe.co...@st.com>
> ---
>   drivers/gpu/drm/stm/ltdc.c | 22 ++
>   drivers/gpu/drm/stm/ltdc.h |  8 
>   2 files changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 2b745cfc9000..061d2b6e5157 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -729,6 +729,8 @@ static void ltdc_plane_atomic_update(struct drm_plane 
> *plane,
>   reg_update_bits(ldev->regs, LTDC_L1CR + lofs,
>   LXCR_LEN | LXCR_CLUTEN, val);
>   
> + ldev->plane_fpsi[plane->index].counter++;
> +
>   mutex_lock(>err_lock);
>   if (ldev->error_status & ISR_FUIF) {
>   DRM_DEBUG_DRIVER("Fifo underrun\n");
> @@ -754,6 +756,25 @@ static void ltdc_plane_atomic_disable(struct drm_plane 
> *plane,
>oldstate->crtc->base.id, plane->base.id);
>   }
>   
> +static void ltdc_plane_atomic_print_state(struct drm_printer *p,
> +   const struct drm_plane_state *state)
> +{
> + struct drm_plane *plane = state->plane;
> + struct ltdc_device *ldev = plane_to_ltdc(plane);
> + struct fps_info *fpsi = >plane_fpsi[plane->index];
> + int ms_since_last;
> + ktime_t now;
> +
> + now = ktime_get();
> + ms_since_last = ktime_to_ms(ktime_sub(now, fpsi->last_timestamp));
> +
> + drm_printf(p, "\tuser_updates=%dfps\n",
> +DIV_ROUND_CLOSEST(fpsi->counter * 1000, ms_since_last));
> +
> + fpsi->last_timestamp = now;
> + fpsi->counter = 0;
> +}
> +
>   static const struct drm_plane_funcs ltdc_plane_funcs = {
>   .update_plane = drm_atomic_helper_update_plane,
>   .disable_plane = drm_atomic_helper_disable_plane,
> @@ -761,6 +782,7 @@ static const struct drm_plane_funcs ltdc_plane_funcs = {
>   .reset = drm_atomic_helper_plane_reset,
>   .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>   .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> + .atomic_print_state = ltdc_plane_atomic_print_state,
>   };
>   
>   static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = {
> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> index 61a80d00bc3b..1e16d6afb0d2 100644
> --- a/drivers/gpu/drm/stm/ltdc.h
> +++ b/drivers/gpu/drm/stm/ltdc.h
> @@ -20,6 +20,13 @@ struct ltdc_caps {
>   bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */
>   };
>   
> +#define LTDC_MAX_LAYER   4
> +
> +struct fps_info {
> + unsigned int counter;
> + ktime_t last_timestamp;
> +};
> +
>   struct ltdc_device {
>   void __iomem *regs;
>   struct clk *pixel_clk;  /* lcd pixel clock */
> @@ -27,6 +34,7 @@ struct ltdc_device {
>   struct ltdc_caps caps;
>   u32 error_status;
>   u32 irq_status;
> + struct fps_info plane_fpsi[LTDC_MAX_LAYER];
>   };
>   
>   int ltdc_load(struct drm_device *ddev);
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/stm: move enable/disable_vblank to crtc

2018-04-16 Thread Vincent ABRIOU
Hi Philippe,

Patch looks good to me.

Reviewed-by: Vincent Abriou <vincent.abr...@st.com>

On 04/07/2018 11:29 PM, Philippe Cornu wrote:
> enable/disable_vblank() functions at drm_driver level
> are deprecated. Move them to the ltdc drm_crtc_funcs
> structure.
> 
> Signed-off-by: Philippe Cornu <philippe.co...@st.com>
> ---
>   drivers/gpu/drm/stm/drv.c  |  2 --
>   drivers/gpu/drm/stm/ltdc.c | 10 ++
>   drivers/gpu/drm/stm/ltdc.h |  2 --
>   3 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 9ab00a87f7cc..8698e08313e1 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -72,8 +72,6 @@ static struct drm_driver drv_driver = {
>   .gem_prime_vmap = drm_gem_cma_prime_vmap,
>   .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
>   .gem_prime_mmap = drm_gem_cma_prime_mmap,
> - .enable_vblank = ltdc_crtc_enable_vblank,
> - .disable_vblank = ltdc_crtc_disable_vblank,
>   };
>   
>   static int drv_load(struct drm_device *ddev)
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 1a3277e483d5..2b745cfc9000 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -569,9 +569,9 @@ static const struct drm_crtc_helper_funcs 
> ltdc_crtc_helper_funcs = {
>   .atomic_disable = ltdc_crtc_atomic_disable,
>   };
>   
> -int ltdc_crtc_enable_vblank(struct drm_device *ddev, unsigned int pipe)
> +static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
>   {
> - struct ltdc_device *ldev = ddev->dev_private;
> + struct ltdc_device *ldev = crtc_to_ltdc(crtc);
>   
>   DRM_DEBUG_DRIVER("\n");
>   reg_set(ldev->regs, LTDC_IER, IER_LIE);
> @@ -579,9 +579,9 @@ int ltdc_crtc_enable_vblank(struct drm_device *ddev, 
> unsigned int pipe)
>   return 0;
>   }
>   
> -void ltdc_crtc_disable_vblank(struct drm_device *ddev, unsigned int pipe)
> +static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc)
>   {
> - struct ltdc_device *ldev = ddev->dev_private;
> + struct ltdc_device *ldev = crtc_to_ltdc(crtc);
>   
>   DRM_DEBUG_DRIVER("\n");
>   reg_clear(ldev->regs, LTDC_IER, IER_LIE);
> @@ -594,6 +594,8 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
>   .reset = drm_atomic_helper_crtc_reset,
>   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> + .enable_vblank = ltdc_crtc_enable_vblank,
> + .disable_vblank = ltdc_crtc_disable_vblank,
>   .gamma_set = drm_atomic_helper_legacy_gamma_set,
>   };
>   
> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> index edb268129c54..61a80d00bc3b 100644
> --- a/drivers/gpu/drm/stm/ltdc.h
> +++ b/drivers/gpu/drm/stm/ltdc.h
> @@ -29,8 +29,6 @@ struct ltdc_device {
>   u32 irq_status;
>   };
>   
> -int ltdc_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void ltdc_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>   int ltdc_load(struct drm_device *ddev);
>   void ltdc_unload(struct drm_device *ddev);
>   
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] gpu: drm: sti: Adopt SPDX identifiers

2017-12-06 Thread Vincent ABRIOU
Benjamin,

The patch is fine for me:

Acked-by: Vincent Abriou <vincent.abr...@st.com>

Vincent

On 12/06/2017 12:29 PM, Benjamin Gaignard wrote:
> Add SPDX identifiers to files under sti directory
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaign...@st.com>
> ---
>   drivers/gpu/drm/sti/sti_awg_utils.c| 2 +-
>   drivers/gpu/drm/sti/sti_awg_utils.h| 2 +-
>   drivers/gpu/drm/sti/sti_compositor.c   | 2 +-
>   drivers/gpu/drm/sti/sti_compositor.h   | 2 +-
>   drivers/gpu/drm/sti/sti_crtc.c | 2 +-
>   drivers/gpu/drm/sti/sti_crtc.h | 2 +-
>   drivers/gpu/drm/sti/sti_cursor.c   | 2 +-
>   drivers/gpu/drm/sti/sti_cursor.h   | 2 +-
>   drivers/gpu/drm/sti/sti_drv.c  | 2 +-
>   drivers/gpu/drm/sti/sti_drv.h  | 2 +-
>   drivers/gpu/drm/sti/sti_dvo.c  | 2 +-
>   drivers/gpu/drm/sti/sti_gdp.c  | 2 +-
>   drivers/gpu/drm/sti/sti_gdp.h  | 2 +-
>   drivers/gpu/drm/sti/sti_hda.c  | 2 +-
>   drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
>   drivers/gpu/drm/sti/sti_hdmi.h | 2 +-
>   drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.c | 2 +-
>   drivers/gpu/drm/sti/sti_hdmi_tx3g4c28phy.h | 2 +-
>   drivers/gpu/drm/sti/sti_hqvdp.c| 2 +-
>   drivers/gpu/drm/sti/sti_hqvdp_lut.h| 2 +-
>   drivers/gpu/drm/sti/sti_mixer.c| 2 +-
>   drivers/gpu/drm/sti/sti_mixer.h| 2 +-
>   drivers/gpu/drm/sti/sti_plane.c| 2 +-
>   drivers/gpu/drm/sti/sti_plane.h| 2 +-
>   drivers/gpu/drm/sti/sti_tvout.c| 2 +-
>   drivers/gpu/drm/sti/sti_vid.c  | 2 +-
>   drivers/gpu/drm/sti/sti_vid.h  | 2 +-
>   drivers/gpu/drm/sti/sti_vtg.c  | 2 +-
>   drivers/gpu/drm/sti/sti_vtg.h  | 2 +-
>   29 files changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sti/sti_awg_utils.c 
> b/drivers/gpu/drm/sti/sti_awg_utils.c
> index 2da7d6866d5d..7c5a7830b6e8 100644
> --- a/drivers/gpu/drm/sti/sti_awg_utils.c
> +++ b/drivers/gpu/drm/sti/sti_awg_utils.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>* Copyright (C) STMicroelectronics SA 2014
>* Author: Vincent Abriou <vincent.abr...@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #include "sti_awg_utils.h"
> diff --git a/drivers/gpu/drm/sti/sti_awg_utils.h 
> b/drivers/gpu/drm/sti/sti_awg_utils.h
> index 45d599bd570a..258a568f050b 100644
> --- a/drivers/gpu/drm/sti/sti_awg_utils.h
> +++ b/drivers/gpu/drm/sti/sti_awg_utils.h
> @@ -1,7 +1,7 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>* Copyright (C) STMicroelectronics SA 2014
>* Author: Vincent Abriou <vincent.abr...@st.com> for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #ifndef _STI_AWG_UTILS_H_
> diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
> b/drivers/gpu/drm/sti/sti_compositor.c
> index 6e4bf68262db..021b8fcaa0b9 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.c
> +++ b/drivers/gpu/drm/sti/sti_compositor.c
> @@ -1,9 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>* Copyright (C) STMicroelectronics SA 2014
>* Authors: Benjamin Gaignard <benjamin.gaign...@st.com>
>*  Fabien Dessenne <fabien.desse...@st.com>
>*  for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #include 
> diff --git a/drivers/gpu/drm/sti/sti_compositor.h 
> b/drivers/gpu/drm/sti/sti_compositor.h
> index 2952a2d25a52..ac4bb3834810 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.h
> +++ b/drivers/gpu/drm/sti/sti_compositor.h
> @@ -1,9 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>* Copyright (C) STMicroelectronics SA 2014
>* Authors: Benjamin Gaignard <benjamin.gaign...@st.com>
>*  Fabien Dessenne <fabien.desse...@st.com>
>*  for STMicroelectronics.
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #ifndef _STI_COMPOSITOR_H_
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index e8a4d48e985a..21e50d7b1f86 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -1,9 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>* Copyright (C) STMicroelectronics SA 2014
>* Authors: Benjamin Gaignard <benjamin.gaign...@st.com>
>*  Fabien Dessenne <fabien.desse...@st.com>
>*  for STMicroele

Re: [PATCH] gpu: drm: stm: Adopt SPDX identifiers

2017-12-06 Thread Vincent ABRIOU
Benjamin,

The patch is fine for me:

Acked-by: Vincent Abriou <vincent.abr...@st.com>

Vincent

On 12/06/2017 12:29 PM, Benjamin Gaignard wrote:
> Add SPDX identifiers to files under stm directory
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaign...@st.com>
> ---
>   drivers/gpu/drm/stm/drv.c | 3 +--
>   drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 3 +--
>   drivers/gpu/drm/stm/ltdc.c| 3 +--
>   drivers/gpu/drm/stm/ltdc.h| 3 +--
>   4 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index c857663eafc2..2d6e9ca0450b 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>* Copyright (C) STMicroelectronics SA 2017
>*
> @@ -5,8 +6,6 @@
>*  Yannick Fertre <yannick.fer...@st.com>
>*  Fabien Dessenne <fabien.desse...@st.com>
>*  Mickael Reulier <mickael.reul...@st.com>
> - *
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #include 
> diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c 
> b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> index e5b6310240fe..2e53410189f8 100644
> --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> @@ -1,10 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>* Copyright (C) STMicroelectronics SA 2017
>*
>* Authors: Philippe Cornu <philippe.co...@st.com>
>*  Yannick Fertre <yannick.fer...@st.com>
> - *
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #include 
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 735c9081202a..34b91d049481 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>* Copyright (C) STMicroelectronics SA 2017
>*
> @@ -5,8 +6,6 @@
>*  Yannick Fertre <yannick.fer...@st.com>
>*  Fabien Dessenne <fabien.desse...@st.com>
>*  Mickael Reulier <mickael.reul...@st.com>
> - *
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #include 
> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> index ae437557d715..d5da74d24995 100644
> --- a/drivers/gpu/drm/stm/ltdc.h
> +++ b/drivers/gpu/drm/stm/ltdc.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>   /*
>* Copyright (C) STMicroelectronics SA 2017
>*
> @@ -5,8 +6,6 @@
>*  Yannick Fertre <yannick.fer...@st.com>
>*  Fabien Dessenne <fabien.desse...@st.com>
>*  Mickael Reulier <mickael.reul...@st.com>
> - *
> - * License terms:  GNU General Public License (GPL), version 2
>*/
>   
>   #ifndef _LTDC_H_
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 16/22] drm/sti: Use drm_gem_fb_create()

2017-08-21 Thread Vincent ABRIOU
Hi Noralf,

On 08/13/2017 03:31 PM, Noralf Trønnes wrote:
> drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
> so use the function directly.
> 
> Cc: Benjamin Gaignard <benjamin.gaign...@linaro.org>
> Cc: Vincent Abriou <vincent.abr...@st.com>
> Signed-off-by: Noralf Trønnes <nor...@tronnes.org>

Acked-by: Vincent Abriou <vincent.abr...@st.com>

> ---
>   drivers/gpu/drm/sti/sti_drv.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 1700c54..9e93431 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -16,6 +16,7 @@
>   #include 
>   #include 
>   #include 
> +#include 
>   #include 
>   #include 
>   
> @@ -145,7 +146,7 @@ static void sti_output_poll_changed(struct drm_device 
> *ddev)
>   }
>   
>   static const struct drm_mode_config_funcs sti_mode_config_funcs = {
> - .fb_create = drm_fb_cma_create,
> + .fb_create = drm_gem_fb_create,
>   .output_poll_changed = sti_output_poll_changed,
>   .atomic_check = sti_atomic_check,
>   .atomic_commit = drm_atomic_helper_commit,
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 7/8] drm: Nuke drm_atomic_helper_connector_dpms

2017-08-08 Thread Vincent ABRIOU


On 07/25/2017 10:01 AM, Daniel Vetter wrote:
> It's dead code, the core handles all this directly now.
> 
> The only special case is nouveau and tda988x which used one function
> for both legacy modeset code and -nv50 atomic world instead of 2
> vtables. But amounts to exactly the same.
> 
> v2: Rebase over the panel/brideg refactorings in stm/ltdc.
> 
> Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>

[...]

>   drivers/gpu/drm/sti/sti_dvo.c  |  1 -
>   drivers/gpu/drm/sti/sti_hda.c  |  1 -
>   drivers/gpu/drm/sti/sti_hdmi.c     |  1 -

Acked-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 5/8] drm: Nuke drm_atomic_helper_plane_set_property

2017-08-08 Thread Vincent ABRIOU


On 07/25/2017 10:01 AM, Daniel Vetter wrote:
> It's dead code, the core handles all this directly now. This also
> allows us to unexport drm_atomic_helper_plane_set_property.
> 
> Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>

[...]

>   drivers/gpu/drm/sti/sti_cursor.c|  1 -
>   drivers/gpu/drm/sti/sti_gdp.c   |  1 -
>   drivers/gpu/drm/sti/sti_hqvdp.c     |  1 -

Acked-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 6/8] drm: Nuke drm_atomic_helper_connector_set_property

2017-08-08 Thread Vincent ABRIOU


On 07/25/2017 10:01 AM, Daniel Vetter wrote:
> It's dead code, the core handles all this directly now. This also
> allows us to unexport drm_atomic_helper_connector_set_property.
> 
> The only special case is nouveau which used one function for both
> pre-nv50 legacy modeset code and post-nv50 atomic world instead of 2
> vtables. But amounts to exactly the same.
> 
> What is rather strange here is how few drivers set this up, I suspect
> the earlier patch to handle properties in the core did end up fixing a
> pile of possible issues.
> 
> Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>

[...]

>   drivers/gpu/drm/sti/sti_hdmi.c  |  1 -

Acked-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 04/19] drm/sti: Use .dumb_map_offset and .dumb_destroy defaults

2017-08-07 Thread Vincent ABRIOU
Hi Noralf,

Thanks for the patch.
Acked-by: Vincent Abriou <vincent.abr...@st.com>

On 08/06/2017 05:40 PM, Noralf Trønnes wrote:
> This driver can use the drm_driver.dumb_destroy and
> drm_driver.dumb_map_offset defaults, so no need to set them.
> 
> Cc: Benjamin Gaignard <benjamin.gaign...@linaro.org>
> Cc: Vincent Abriou <vincent.abr...@st.com>
> Signed-off-by: Noralf Trønnes <nor...@tronnes.org>
> ---
>   drivers/gpu/drm/sti/sti_drv.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 06ef1e38..1700c54 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -175,8 +175,6 @@ static struct drm_driver sti_driver = {
>   .gem_free_object_unlocked = drm_gem_cma_free_object,
>   .gem_vm_ops = _gem_cma_vm_ops,
>   .dumb_create = drm_gem_cma_dumb_create,
> - .dumb_map_offset = drm_gem_cma_dumb_map_offset,
> - .dumb_destroy = drm_gem_dumb_destroy,
>   .fops = _driver_fops,
>   
>   .enable_vblank = sti_crtc_enable_vblank,
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 7/8] drm: Add old state pointer to CRTC .enable() helper function

2017-06-29 Thread Vincent ABRIOU


On 06/27/2017 11:16 PM, Laurent Pinchart wrote:
> The old state is useful for drivers that need to perform operations at
> enable time that depend on the transition between the old and new
> states.
> 
> While at it, rename the operation to .atomic_enable() to be consistent
> with .atomic_disable(), as the .enable() operation is used by atomic
> helpers only.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com>
> ---
>   drivers/gpu/drm/arc/arcpgu_crtc.c   |  5 ++--
>   drivers/gpu/drm/arm/hdlcd_crtc.c|  5 ++--
>   drivers/gpu/drm/arm/malidp_crtc.c   |  5 ++--
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c  |  5 ++--
>   drivers/gpu/drm/drm_atomic_helper.c |  7 +++--
>   drivers/gpu/drm/drm_simple_kms_helper.c |  5 ++--
>   drivers/gpu/drm/exynos/exynos_drm_crtc.c|  5 ++--
>   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  |  5 ++--
>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  |  5 ++--
>   drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c |  5 ++--
>   drivers/gpu/drm/imx/ipuv3-crtc.c|  5 ++--
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  5 ++--
>   drivers/gpu/drm/meson/meson_crtc.c  |  5 ++--
>   drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c|  5 ++--
>   drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c|  5 ++--
>   drivers/gpu/drm/omapdrm/omap_crtc.c |  5 ++--
>   drivers/gpu/drm/qxl/qxl_display.c   |  5 ++--
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.c  |  5 ++--
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  5 ++--
>   drivers/gpu/drm/sti/sti_crtc.c  |  5 ++--

For sti:

Acked-by: Vincent Abriou <vincent.abr...@st.com>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 8/8] drm: Convert atomic drivers from CRTC .disable() to .atomic_disable()

2017-06-29 Thread Vincent ABRIOU


On 06/27/2017 11:16 PM, Laurent Pinchart wrote:
> The CRTC .disable() helper operation is deprecated for atomic drivers,
> the new .atomic_disable() helper operation being preferred. Convert all
> atomic drivers to .atomic_disable() to avoid cargo-cult use of
> .disable() in new drivers.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com>
> ---
>   drivers/gpu/drm/arc/arcpgu_crtc.c   | 5 +++--
>   drivers/gpu/drm/arm/hdlcd_crtc.c| 5 +++--
>   drivers/gpu/drm/arm/malidp_crtc.c   | 5 +++--
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c  | 5 +++--
>   drivers/gpu/drm/drm_simple_kms_helper.c | 5 +++--
>   drivers/gpu/drm/exynos/exynos_drm_crtc.c| 5 +++--
>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c  | 5 +++--
>   drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 5 +++--
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 5 +++--
>   drivers/gpu/drm/meson/meson_crtc.c  | 5 +++--
>   drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c| 5 +++--
>   drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c| 5 +++--
>   drivers/gpu/drm/omapdrm/omap_crtc.c | 5 +++--
>   drivers/gpu/drm/qxl/qxl_display.c   | 5 +++--
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 5 +++--
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 5 +++--
>   drivers/gpu/drm/sti/sti_crtc.c  | 5 +++--

For sti:

Acked-by: Vincent Abriou <vincent.abr...@st.com>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 30/37] drm/sti: Drop drm_vblank_cleanup

2017-06-01 Thread Vincent ABRIOU


On 05/24/2017 04:52 PM, Daniel Vetter wrote:
> Seems entirely cargo-culted.
> 
> Cc: Benjamin Gaignard <benjamin.gaign...@linaro.org>
> Cc: Vincent Abriou <vincent.abr...@st.com>
> Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>
> ---
>   drivers/gpu/drm/sti/sti_drv.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a4b574283269..06ef1e3886cf 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -237,7 +237,6 @@ static void sti_cleanup(struct drm_device *ddev)
>   }
>   
>   drm_kms_helper_poll_fini(ddev);
> - drm_vblank_cleanup(ddev);
>   component_unbind_all(ddev->dev, ddev);
>   kfree(private);
>   ddev->dev_private = NULL;
> 

Acked-by: Vincent Abriou <vincent.abr...@st.com>

BR
Vincent
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] MAINTAINERS: update drm/stm maintainers list

2017-05-23 Thread Vincent Abriou
Add Benjamin Gaignard and Vincent Abriou as STM maintainers:
Benjamin Gaignard <benjamin.gaign...@linaro.org>
Vincent Abriou <vincent.abr...@st.com>

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 81cdd03..757d487 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4502,6 +4502,8 @@ F:
Documentation/devicetree/bindings/display/st,stih4xx.txt
 DRM DRIVERS FOR STM
 M: Yannick Fertre <yannick.fer...@st.com>
 M: Philippe Cornu <philippe.co...@st.com>
+M: Benjamin Gaignard <benjamin.gaign...@linaro.org>
+M: Vincent Abriou <vincent.abr...@st.com>
 L: dri-devel@lists.freedesktop.org
 T: git git://anongit.freedesktop.org/drm/drm-misc
 S: Maintained
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: Document code of conduct

2017-04-11 Thread Vincent ABRIOU


On 04/11/2017 08:48 AM, Daniel Vetter wrote:
> freedesktop.org has adopted a formal code of conduct:
>
> https://www.fooishbar.org/blog/fdo-contributor-covenant/
> https://www.freedesktop.org/wiki/CodeOfConduct/
>
> Besides formalizing things a bit more I don't think this changes
> anything for us, we've already peer-enforced respectful and
> constructive interactions since a long time. But it's good to document
> things properly.
>
> Note: As Daniel Stone mentioned in the announcement fd.o admins
> started chatting with the communities their hosting, which includs the
> X.org foundation board, to figure out how to fan out enforcement and
> allow projects to run things on their own (with fd.o still as the
> fallback).  So the details of enforcement (and appealing decisions)
> might still change, but since this involves the board and lots more
> people it'll take a while to get there. For now this is good enough I
> think.
>
> For the text itself I went with the same blurb as the Wayland project,
> didn't feel creative yet this early in the morning:
>
> https://cgit.freedesktop.org/wayland/wayland/commit/?id=0eefe99fe0683ae409b665a8b18cc7eb648c6c0c
>
> Cc: Daniel Stone <dani...@collabora.com>
> Cc: Keith Packard <kei...@keithp.com>
> Cc: tfh...@err.no
> Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>
> ---
>  Documentation/gpu/introduction.rst | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/gpu/introduction.rst 
> b/Documentation/gpu/introduction.rst
> index 05a82bdfbca4..0f5173e29bdc 100644
> --- a/Documentation/gpu/introduction.rst
> +++ b/Documentation/gpu/introduction.rst
> @@ -85,3 +85,14 @@ This means that there's a blackout-period of about one 
> month where feature work
>  can't be merged. The recommended way to deal with that is having a -next tree
>  that's always open, but making sure to not feed it into linux-next during the
>  blackout period. As an example, drm-misc works like that.
> +
> +Code of Conduct
> +---
> +
> +As a freedesktop.org project, dri-devel and the DRM community follows the
> +Contributor Covenant, found at: 
> https://www.freedesktop.org/wiki/CodeOfConduct
> +
> +Please conduct yourself in a respectful and civilised manner when
> +interacting with community members on mailing lists, IRC, or bug
> +trackers. The community represents the project as a whole, and abusive
> +or bullying behaviour is not tolerated by the project.
>

Acked-by: Vincent Abriou <vincent.abr...@st.com>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] MAINTAINERS: add drm/sti driver into drm-misc

2017-04-10 Thread Vincent Abriou
drm/sti driver is now part of drm-misc as a small driver.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4ea82b2..66b424a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4417,7 +4417,7 @@ DRM DRIVERS FOR STI
 M: Benjamin Gaignard <benjamin.gaign...@linaro.org>
 M: Vincent Abriou <vincent.abr...@st.com>
 L: dri-devel@lists.freedesktop.org
-T: git http://git.linaro.org/people/benjamin.gaignard/kernel.git
+T: git git://anongit.freedesktop.org/drm/drm-misc
 S: Maintained
 F: drivers/gpu/drm/sti
 F: Documentation/devicetree/bindings/display/st,stih4xx.txt
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/sti: fix GDP size to support up to UHD resolution

2017-03-23 Thread Vincent Abriou
On stih407-410 chip family the GDP layers are able to support up to UHD
resolution (3840 x 2160).

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_gdp.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 86279f5..88f16cd 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -66,7 +66,9 @@ static struct gdp_format_to_str {
 #define GAM_GDP_ALPHARANGE_255  BIT(5)
 #define GAM_GDP_AGC_FULL_RANGE  0x00808080
 #define GAM_GDP_PPT_IGNORE  (BIT(1) | BIT(0))
-#define GAM_GDP_SIZE_MAX0x7FF
+
+#define GAM_GDP_SIZE_MAX_WIDTH  3840
+#define GAM_GDP_SIZE_MAX_HEIGHT 2160
 
 #define GDP_NODE_NB_BANK2
 #define GDP_NODE_PER_FIELD  2
@@ -632,8 +634,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
/* src_x are in 16.16 format */
src_x = state->src_x >> 16;
src_y = state->src_y >> 16;
-   src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX);
-   src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX);
+   src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX_WIDTH);
+   src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX_HEIGHT);
 
format = sti_gdp_fourcc2format(fb->format->format);
if (format == -1) {
@@ -741,8 +743,8 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,
/* src_x are in 16.16 format */
src_x = state->src_x >> 16;
src_y = state->src_y >> 16;
-   src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX);
-   src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX);
+   src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX_WIDTH);
+   src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX_HEIGHT);
 
list = sti_gdp_get_free_nodes(gdp);
top_field = list->top_field;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/1] drm/sti: fix build warnings in sti_drv.c and sti_vtg.c files

2017-02-20 Thread Vincent Abriou
Fix compilation warning introduced by:
commit 0c7ff84f7f9d ("drm/sti: remove deprecated legacy vtg slave")
commit 5e60f595d6ca ("drm/sti: use atomic_helper for commit")

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_drv.c | 9 -
 drivers/gpu/drm/sti/sti_vtg.c | 1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index e6c1646..20fc0fbf 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -117,15 +117,6 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
return ret;
 }
 
-static void sti_drm_dbg_cleanup(struct drm_minor *minor)
-{
-   drm_debugfs_remove_files(sti_drm_dbg_list,
-ARRAY_SIZE(sti_drm_dbg_list), minor);
-
-   drm_debugfs_remove_files((struct drm_info_list *)_drm_fps_fops,
-1, minor);
-}
-
 static int sti_atomic_check(struct drm_device *dev,
struct drm_atomic_state *state)
 {
diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 943bce5..2dcba1d 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -389,7 +389,6 @@ static irqreturn_t vtg_irq(int irq, void *arg)
 static int vtg_probe(struct platform_device *pdev)
 {
struct device *dev = >dev;
-   struct device_node *np;
struct sti_vtg *vtg;
struct resource *res;
int ret;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PULL] sti-drm-next-2017-02-10

2017-02-10 Thread Vincent Abriou
Hi Dave,

Here is an update of the STI drm driver containing;
- remove deprecated stih416 chip functionnalities
- fix issues met around gdp panes
- fix STI driver unbind procedure
- DVI/HDMI mode is automatically detected
- allow fps statisitics resetting

Regard,
Vincent


The following changes since commit 13f62f54d174d3417c3caaafedf5e22a0a03e442:

  Merge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux 
into drm-next (2017-02-10 10:13:30 +1000)

are available in the git repository at:

  https://github.com/vinceab/linux.git tags/sti-drm-next-2017-02-10

for you to fetch changes up to c462c2f5f5ee5ed77a790c361e6aae807ef923ce:

  drm/sti: debug fps reset (2017-02-10 09:34:39 +0100)


- remove deprecated stih416 chip functionnalities
- fix issues met around gdp panes
- fix STI driver unbind procedure
- DVI/HDMI mode is automatically detected
- allow fps statisitics resetting


Fabien DESSENNE (3):
  drm/sti: use atomic_helper for commit
  drm/sti: Fix up crtc_state->event handling
  drm/sti: do not check hw scaling if mode is not set

Vincent Abriou (8):
  drm/sti: remove deprecated sink_term config
  drm/sti: remove deprecated legacy vtg slave
  drm/sti: enable gdp pixel clock in atomic_update
  drm/sti: do not set gdp pixel clock rate if mode is not set
  drm/sti: do not post GDP command if no update
  drm/sti: unbind all components while driver cleanup
  drm/sti: hdmi: automatically check DVI/HDMI mode
  drm/sti: debug fps reset

 drivers/gpu/drm/sti/sti_crtc.c  | 46 +++---
 drivers/gpu/drm/sti/sti_drv.c   | 87 +
 drivers/gpu/drm/sti/sti_drv.h   |  6 ---
 drivers/gpu/drm/sti/sti_gdp.c   | 85 ++--
 drivers/gpu/drm/sti/sti_hdmi.c  | 38 +++---
 drivers/gpu/drm/sti/sti_hdmi.h  | 17 +---
 drivers/gpu/drm/sti/sti_hqvdp.c |  6 +--
 drivers/gpu/drm/sti/sti_mixer.h |  2 -
 drivers/gpu/drm/sti/sti_vtg.c   | 58 +++
 9 files changed, 95 insertions(+), 250 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/sti: debug fps reset

2017-02-03 Thread Vincent Abriou
From: Fabien Dessenne 

Reset the fps debug information when 'fps_show' is updated.

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 60a41cc..2b8cf59 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -58,7 +58,9 @@ static int sti_drm_fps_set(void *data, u64 val)
list_for_each_entry(p, _dev->mode_config.plane_list, head) {
struct sti_plane *plane = to_sti_plane(p);
 
+   memset(>fps_info, 0, sizeof(plane->fps_info));
plane->fps_info.output = (val >> i) & 1;
+
i++;
}
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/sti: hdmi: automatically check DVI/HDMI mode

2017-02-03 Thread Vincent Abriou
Remove the hdmi_mode_property and use drm_detect_hdmi_monitor function
to check whether the connected monitor is HDMI capable or DVI only.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_hdmi.c | 31 ++-
 drivers/gpu/drm/sti/sti_hdmi.h | 17 ++---
 2 files changed, 8 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 6862d59..ce2dcba 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -158,7 +158,6 @@ struct sti_hdmi_connector {
struct drm_encoder *encoder;
struct sti_hdmi *hdmi;
struct drm_property *colorspace_property;
-   struct drm_property *hdmi_mode_property;
 };
 
 #define to_sti_hdmi_connector(x) \
@@ -265,7 +264,7 @@ static void hdmi_config(struct sti_hdmi *hdmi)
 
/* Select encryption type and the framing mode */
conf |= HDMI_CFG_ESS_NOT_OESS;
-   if (hdmi->hdmi_mode == HDMI_MODE_HDMI)
+   if (hdmi->hdmi_monitor)
conf |= HDMI_CFG_HDMI_NOT_DVI;
 
/* Set Hsync polarity */
@@ -970,6 +969,11 @@ static int sti_hdmi_connector_get_modes(struct 
drm_connector *connector)
if (!edid)
goto fail;
 
+   hdmi->hdmi_monitor = drm_detect_hdmi_monitor(edid);
+   DRM_DEBUG_KMS("%s : %dx%d cm\n",
+ (hdmi->hdmi_monitor ? "hdmi monitor" : "dvi monitor"),
+ edid->width_cm, edid->height_cm);
+
count = drm_add_edid_modes(connector, edid);
drm_mode_connector_update_edid_property(connector, edid);
drm_edid_to_eld(connector, edid);
@@ -1053,19 +1057,6 @@ static void sti_hdmi_connector_init_property(struct 
drm_device *drm_dev,
}
hdmi_connector->colorspace_property = prop;
drm_object_attach_property(>base, prop, hdmi->colorspace);
-
-   /* hdmi_mode property */
-   hdmi->hdmi_mode = DEFAULT_HDMI_MODE;
-   prop = drm_property_create_enum(drm_dev, 0, "hdmi_mode",
-   hdmi_mode_names,
-   ARRAY_SIZE(hdmi_mode_names));
-   if (!prop) {
-   DRM_ERROR("fails to create colorspace property\n");
-   return;
-   }
-   hdmi_connector->hdmi_mode_property = prop;
-   drm_object_attach_property(>base, prop, hdmi->hdmi_mode);
-
 }
 
 static int
@@ -1083,11 +1074,6 @@ sti_hdmi_connector_set_property(struct drm_connector 
*connector,
return 0;
}
 
-   if (property == hdmi_connector->hdmi_mode_property) {
-   hdmi->hdmi_mode = val;
-   return 0;
-   }
-
DRM_ERROR("failed to set hdmi connector property\n");
return -EINVAL;
 }
@@ -1107,11 +1093,6 @@ sti_hdmi_connector_get_property(struct drm_connector 
*connector,
return 0;
}
 
-   if (property == hdmi_connector->hdmi_mode_property) {
-   *val = hdmi->hdmi_mode;
-   return 0;
-   }
-
DRM_ERROR("failed to get hdmi connector property\n");
return -EINVAL;
 }
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index 119bc35..4070123 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -30,19 +30,6 @@ struct hdmi_audio_params {
struct hdmi_audio_infoframe cea;
 };
 
-/* values for the framing mode property */
-enum sti_hdmi_modes {
-   HDMI_MODE_HDMI,
-   HDMI_MODE_DVI,
-};
-
-static const struct drm_prop_enum_list hdmi_mode_names[] = {
-   { HDMI_MODE_HDMI, "hdmi" },
-   { HDMI_MODE_DVI, "dvi" },
-};
-
-#define DEFAULT_HDMI_MODE HDMI_MODE_HDMI
-
 static const struct drm_prop_enum_list colorspace_mode_names[] = {
{ HDMI_COLORSPACE_RGB, "rgb" },
{ HDMI_COLORSPACE_YUV422, "yuv422" },
@@ -73,7 +60,7 @@ static const struct drm_prop_enum_list 
colorspace_mode_names[] = {
  * @reset: reset control of the hdmi phy
  * @ddc_adapt: i2c ddc adapter
  * @colorspace: current colorspace selected
- * @hdmi_mode: select framing for HDMI or DVI
+ * @hdmi_monitor: true if HDMI monitor detected else DVI monitor assumed
  * @audio_pdev: ASoC hdmi-codec platform device
  * @audio: hdmi audio parameters.
  * @drm_connector: hdmi connector
@@ -98,7 +85,7 @@ struct sti_hdmi {
struct reset_control *reset;
struct i2c_adapter *ddc_adapt;
enum hdmi_colorspace colorspace;
-   enum sti_hdmi_modes hdmi_mode;
+   bool hdmi_monitor;
struct platform_device *audio_pdev;
struct hdmi_audio_params audio;
struct drm_connector *drm_connector;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/sti: unbind all components while driver cleanup

2017-02-03 Thread Vincent Abriou
Unbind all the components when the STI driver is unregistered.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index e433853..60a41cc 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -255,6 +255,7 @@ static void sti_cleanup(struct drm_device *ddev)
 
drm_kms_helper_poll_fini(ddev);
drm_vblank_cleanup(ddev);
+   component_unbind_all(ddev->dev, ddev);
kfree(private);
ddev->dev_private = NULL;
 }
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/3] drm/sti: do not post GDP command if no update

2017-02-03 Thread Vincent Abriou
Do not process update requests with unmodified parameters.

This typically happens when the driver is called with legacy
(non-atomic) IOCTL : in that case atomic_update() is called multiple
times with the same parameters.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_gdp.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 7f6d079..86279f5 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -708,6 +708,21 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,
if (!crtc || !fb)
return;
 
+   if ((oldstate->fb == state->fb) &&
+   (oldstate->crtc_x == state->crtc_x) &&
+   (oldstate->crtc_y == state->crtc_y) &&
+   (oldstate->crtc_w == state->crtc_w) &&
+   (oldstate->crtc_h == state->crtc_h) &&
+   (oldstate->src_x == state->src_x) &&
+   (oldstate->src_y == state->src_y) &&
+   (oldstate->src_w == state->src_w) &&
+   (oldstate->src_h == state->src_h)) {
+   /* No change since last update, do not post cmd */
+   DRM_DEBUG_DRIVER("No change, not posting cmd\n");
+   plane->status = STI_PLANE_UPDATED;
+   return;
+   }
+
if (!gdp->vtg) {
struct sti_compositor *compo = dev_get_drvdata(gdp->dev);
struct sti_mixer *mixer = to_sti_mixer(crtc);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/3] drm/sti: do not set gdp pixel clock rate if mode is not set

2017-02-03 Thread Vincent Abriou
Fix a division by 0 case : in some cases, when the GDP plane is being
disabled atomic_check() is called with "mode->clock = 0".
In that case, do not set parent and pixel clock rate.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_gdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 7255234..7f6d079 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -648,7 +648,7 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
}
 
/* Set gdp clock */
-   if (gdp->clk_pix) {
+   if (mode->clock && gdp->clk_pix) {
struct clk *clkp;
int rate = mode->clock * 1000;
int res;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/3] drm/sti: enable gdp pixel clock in atomic_update

2017-02-03 Thread Vincent Abriou
Set gdp pix clock rate and parent in atomic_check function and enable
it in the atomic_update only the first time.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_gdp.c | 70 ---
 1 file changed, 32 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 877d053..7255234 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -610,7 +610,6 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_gdp *gdp = to_sti_gdp(plane);
struct drm_crtc *crtc = state->crtc;
-   struct sti_compositor *compo = dev_get_drvdata(gdp->dev);
struct drm_framebuffer *fb =  state->fb;
struct drm_crtc_state *crtc_state;
struct sti_mixer *mixer;
@@ -648,45 +647,30 @@ static int sti_gdp_atomic_check(struct drm_plane 
*drm_plane,
return -EINVAL;
}
 
-   if (!gdp->vtg) {
-   /* Register gdp callback */
-   gdp->vtg = compo->vtg[mixer->id];
-   if (sti_vtg_register_client(gdp->vtg,
-   >vtg_field_nb, crtc)) {
-   DRM_ERROR("Cannot register VTG notifier\n");
+   /* Set gdp clock */
+   if (gdp->clk_pix) {
+   struct clk *clkp;
+   int rate = mode->clock * 1000;
+   int res;
+
+   /*
+* According to the mixer used, the gdp pixel clock
+* should have a different parent clock.
+*/
+   if (mixer->id == STI_MIXER_MAIN)
+   clkp = gdp->clk_main_parent;
+   else
+   clkp = gdp->clk_aux_parent;
+
+   if (clkp)
+   clk_set_parent(gdp->clk_pix, clkp);
+
+   res = clk_set_rate(gdp->clk_pix, rate);
+   if (res < 0) {
+   DRM_ERROR("Cannot set rate (%dHz) for gdp\n",
+ rate);
return -EINVAL;
}
-
-   /* Set and enable gdp clock */
-   if (gdp->clk_pix) {
-   struct clk *clkp;
-   int rate = mode->clock * 1000;
-   int res;
-
-   /*
-* According to the mixer used, the gdp pixel clock
-* should have a different parent clock.
-*/
-   if (mixer->id == STI_MIXER_MAIN)
-   clkp = gdp->clk_main_parent;
-   else
-   clkp = gdp->clk_aux_parent;
-
-   if (clkp)
-   clk_set_parent(gdp->clk_pix, clkp);
-
-   res = clk_set_rate(gdp->clk_pix, rate);
-   if (res < 0) {
-   DRM_ERROR("Cannot set rate (%dHz) for gdp\n",
- rate);
-   return -EINVAL;
-   }
-
-   if (clk_prepare_enable(gdp->clk_pix)) {
-   DRM_ERROR("Failed to prepare/enable gdp\n");
-   return -EINVAL;
-   }
-   }
}
 
DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
@@ -724,6 +708,16 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,
if (!crtc || !fb)
return;
 
+   if (!gdp->vtg) {
+   struct sti_compositor *compo = dev_get_drvdata(gdp->dev);
+   struct sti_mixer *mixer = to_sti_mixer(crtc);
+
+   /* Register gdp callback */
+   gdp->vtg = compo->vtg[mixer->id];
+   sti_vtg_register_client(gdp->vtg, >vtg_field_nb, crtc);
+   clk_prepare_enable(gdp->clk_pix);
+   }
+
mode = >mode;
dst_x = state->crtc_x;
dst_y = state->crtc_y;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/3] drm/sti: gdp pixel clock and plane update fixes

2017-02-03 Thread Vincent Abriou
This patch series fix issues met around gpd plane:
 - fix gdp clock selection and enabling
 - fix div by zero when GDP plane is being disabled
 - do not process gdp update requests with unmodified parameters

Vincent Abriou (3):
  drm/sti: enable gdp pixel clock in atomic_update
  drm/sti: do not set gdp pixel clock rate if mode is not set
  drm/sti: do not post GDP command if no update

 drivers/gpu/drm/sti/sti_gdp.c | 85 ---
 1 file changed, 47 insertions(+), 38 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/sti: remove deprecated sink_term config

2017-02-03 Thread Vincent Abriou
stih416 chip family is no more supported in Linux v4.9.
Then sink_term config becomes useless. The field of the
register it was referring to is tag as reserved for stih410
chip family.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_hdmi.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index c915184..6862d59 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -95,7 +95,6 @@
 #define HDMI_CFG_HDCP_ENBIT(2)
 #define HDMI_CFG_ESS_NOT_OESS   BIT(3)
 #define HDMI_CFG_H_SYNC_POL_NEG BIT(4)
-#define HDMI_CFG_SINK_TERM_DET_EN   BIT(5)
 #define HDMI_CFG_V_SYNC_POL_NEG BIT(6)
 #define HDMI_CFG_422_EN BIT(8)
 #define HDMI_CFG_FIFO_OVERRUN_CLR   BIT(12)
@@ -269,9 +268,6 @@ static void hdmi_config(struct sti_hdmi *hdmi)
if (hdmi->hdmi_mode == HDMI_MODE_HDMI)
conf |= HDMI_CFG_HDMI_NOT_DVI;
 
-   /* Enable sink term detection */
-   conf |= HDMI_CFG_SINK_TERM_DET_EN;
-
/* Set Hsync polarity */
if (hdmi->mode.flags & DRM_MODE_FLAG_NHSYNC) {
DRM_DEBUG_DRIVER("H Sync Negative\n");
@@ -607,9 +603,6 @@ static void hdmi_dbg_cfg(struct seq_file *s, int val)
tmp = val & HDMI_CFG_ESS_NOT_OESS;
DBGFS_PRINT_STR("HDCP mode:", tmp ? "ESS enable" : "OESS enable");
seq_puts(s, "\t\t\t\t\t");
-   tmp = val & HDMI_CFG_SINK_TERM_DET_EN;
-   DBGFS_PRINT_STR("Sink term detection:", tmp ? "enable" : "disable");
-   seq_puts(s, "\t\t\t\t\t");
tmp = val & HDMI_CFG_H_SYNC_POL_NEG;
DBGFS_PRINT_STR("Hsync polarity:", tmp ? "inverted" : "normal");
seq_puts(s, "\t\t\t\t\t");
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/2] drm/sti cleanup: remove deprecated register and functionnalities

2017-02-03 Thread Vincent Abriou
Remove stih416 chip deprecated register and functionnalities since stih416
chip is no more supported from Linux v4.9.

Vincent Abriou (2):
  drm/sti: remove deprecated sink_term config
  drm/sti: remove deprecated legacy vtg slave

 drivers/gpu/drm/sti/sti_hdmi.c |  7 -
 drivers/gpu/drm/sti/sti_vtg.c  | 58 ++
 2 files changed, 14 insertions(+), 51 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/sti: remove deprecated legacy vtg slave

2017-02-03 Thread Vincent Abriou
stih416 chip family is no more supported in Linux v4.9.
It is then useless to keep vtg slave field since it not used at all for
the stih407/10 chip family supported by sti driver.

Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
---
 drivers/gpu/drm/sti/sti_vtg.c | 58 +++
 1 file changed, 14 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index c3d9c8a..943bce5 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -17,7 +17,6 @@
 #include "sti_vtg.h"
 
 #define VTG_MODE_MASTER 0
-#define VTG_MODE_SLAVE_BY_EXT0  1
 
 /* registers offset */
 #define VTG_MODE0x
@@ -132,7 +131,6 @@ struct sti_vtg_sync_params {
  * @irq_status: store the IRQ status value
  * @notifier_list: notifier callback
  * @crtc: the CRTC for vblank event
- * @slave: slave vtg
  * @link: List node to link the structure in lookup list
  */
 struct sti_vtg {
@@ -144,7 +142,6 @@ struct sti_vtg {
u32 irq_status;
struct raw_notifier_head notifier_list;
struct drm_crtc *crtc;
-   struct sti_vtg *slave;
struct list_head link;
 };
 
@@ -166,10 +163,6 @@ struct sti_vtg *of_vtg_find(struct device_node *np)
 
 static void vtg_reset(struct sti_vtg *vtg)
 {
-   /* reset slave and then master */
-   if (vtg->slave)
-   vtg_reset(vtg->slave);
-
writel(1, vtg->regs + VTG_DRST_AUTOC);
 }
 
@@ -259,10 +252,6 @@ static void vtg_set_mode(struct sti_vtg *vtg,
 {
unsigned int i;
 
-   if (vtg->slave)
-   vtg_set_mode(vtg->slave, VTG_MODE_SLAVE_BY_EXT0,
-vtg->sync_params, mode);
-
/* Set the number of clock cycles per line */
writel(mode->htotal, vtg->regs + VTG_CLKLN);
 
@@ -318,11 +307,7 @@ void sti_vtg_set_config(struct sti_vtg *vtg,
 
vtg_reset(vtg);
 
-   /* enable irq for the vtg vblank synchro */
-   if (vtg->slave)
-   vtg_enable_irq(vtg->slave);
-   else
-   vtg_enable_irq(vtg);
+   vtg_enable_irq(vtg);
 }
 
 /**
@@ -365,18 +350,12 @@ u32 sti_vtg_get_pixel_number(struct drm_display_mode 
mode, int x)
 int sti_vtg_register_client(struct sti_vtg *vtg, struct notifier_block *nb,
struct drm_crtc *crtc)
 {
-   if (vtg->slave)
-   return sti_vtg_register_client(vtg->slave, nb, crtc);
-
vtg->crtc = crtc;
return raw_notifier_chain_register(>notifier_list, nb);
 }
 
 int sti_vtg_unregister_client(struct sti_vtg *vtg, struct notifier_block *nb)
 {
-   if (vtg->slave)
-   return sti_vtg_unregister_client(vtg->slave, nb);
-
return raw_notifier_chain_unregister(>notifier_list, nb);
 }
 
@@ -434,29 +413,20 @@ static int vtg_probe(struct platform_device *pdev)
return -ENOMEM;
}
 
-   np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
-   if (np) {
-   vtg->slave = of_vtg_find(np);
-   of_node_put(np);
+   vtg->irq = platform_get_irq(pdev, 0);
+   if (vtg->irq < 0) {
+   DRM_ERROR("Failed to get VTG interrupt\n");
+   return vtg->irq;
+   }
 
-   if (!vtg->slave)
-   return -EPROBE_DEFER;
-   } else {
-   vtg->irq = platform_get_irq(pdev, 0);
-   if (vtg->irq < 0) {
-   DRM_ERROR("Failed to get VTG interrupt\n");
-   return vtg->irq;
-   }
-
-   RAW_INIT_NOTIFIER_HEAD(>notifier_list);
-
-   ret = devm_request_threaded_irq(dev, vtg->irq, vtg_irq,
-   vtg_irq_thread, IRQF_ONESHOT,
-   dev_name(dev), vtg);
-   if (ret < 0) {
-   DRM_ERROR("Failed to register VTG interrupt\n");
-   return ret;
-   }
+   RAW_INIT_NOTIFIER_HEAD(>notifier_list);
+
+   ret = devm_request_threaded_irq(dev, vtg->irq, vtg_irq,
+   vtg_irq_thread, IRQF_ONESHOT,
+   dev_name(dev), vtg);
+   if (ret < 0) {
+   DRM_ERROR("Failed to register VTG interrupt\n");
+   return ret;
}
 
vtg_register(vtg);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/3] drm/sti: do not check hw scaling if mode is not set

2017-02-01 Thread Vincent ABRIOU
Acked-by: Vincent Abriou <vincent.abr...@st.com>

On 01/12/2017 05:27 PM, Fabien Dessenne wrote:
> Fix a division by 0 case : in some cases, when the HQVDP plane is being
> disabled atomic_check() is called with "mode->clock = 0".
> In that case, do not check for scaling capabilities.
>
> Signed-off-by: Fabien Dessenne <fabien.desse...@st.com>
> ---
>  drivers/gpu/drm/sti/sti_hqvdp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index f88130f..723ac30 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1035,9 +1035,9 @@ static int sti_hqvdp_atomic_check(struct drm_plane 
> *drm_plane,
>   src_w = state->src_w >> 16;
>   src_h = state->src_h >> 16;
>
> - if (!sti_hqvdp_check_hw_scaling(hqvdp, mode,
> - src_w, src_h,
> - dst_w, dst_h)) {
> + if (mode->clock && !sti_hqvdp_check_hw_scaling(hqvdp, mode,
> +src_w, src_h,
> +dst_w, dst_h)) {
>   DRM_ERROR("Scaling beyond HW capabilities\n");
>   return -EINVAL;
>   }
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/sti: Fix up crtc_state->event handling

2017-02-01 Thread Vincent ABRIOU
Acked-by: Vincent Abriou <vincent.abr...@st.com>

On 01/12/2017 05:27 PM, Fabien Dessenne wrote:
> Use drm-core to handle event.
> This is required to be able to use the nonblocking helpers.
>
> Signed-off-by: Fabien Dessenne <fabien.desse...@st.com>
> ---
>  drivers/gpu/drm/sti/sti_crtc.c  | 46 
> +
>  drivers/gpu/drm/sti/sti_mixer.h |  2 --
>  2 files changed, 14 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index e992bed..d45a433 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -134,21 +134,6 @@ sti_crtc_mode_set_nofb(struct drm_crtc *crtc)
>   sti_crtc_mode_set(crtc, >state->adjusted_mode);
>  }
>
> -static void sti_crtc_atomic_begin(struct drm_crtc *crtc,
> -   struct drm_crtc_state *old_crtc_state)
> -{
> - struct sti_mixer *mixer = to_sti_mixer(crtc);
> -
> - if (crtc->state->event) {
> - crtc->state->event->pipe = drm_crtc_index(crtc);
> -
> - WARN_ON(drm_crtc_vblank_get(crtc) != 0);
> -
> - mixer->pending_event = crtc->state->event;
> - crtc->state->event = NULL;
> - }
> -}
> -
>  static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
> struct drm_crtc_state *old_crtc_state)
>  {
> @@ -156,6 +141,8 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
>   struct sti_mixer *mixer = to_sti_mixer(crtc);
>   struct sti_compositor *compo = dev_get_drvdata(mixer->dev);
>   struct drm_plane *p;
> + struct drm_pending_vblank_event *event;
> + unsigned long flags;
>
>   DRM_DEBUG_DRIVER("\n");
>
> @@ -220,13 +207,24 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
>   break;
>   }
>   }
> +
> + event = crtc->state->event;
> + if (event) {
> + crtc->state->event = NULL;
> +
> + spin_lock_irqsave(>dev->event_lock, flags);
> + if (drm_crtc_vblank_get(crtc) == 0)
> + drm_crtc_arm_vblank_event(crtc, event);
> + else
> + drm_crtc_send_vblank_event(crtc, event);
> + spin_unlock_irqrestore(>dev->event_lock, flags);
> + }
>  }
>
>  static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
>   .enable = sti_crtc_enable,
>   .disable = sti_crtc_disabling,
>   .mode_set_nofb = sti_crtc_mode_set_nofb,
> - .atomic_begin = sti_crtc_atomic_begin,
>   .atomic_flush = sti_crtc_atomic_flush,
>  };
>
> @@ -250,7 +248,6 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>   struct sti_compositor *compo;
>   struct drm_crtc *crtc = data;
>   struct sti_mixer *mixer;
> - unsigned long flags;
>   struct sti_private *priv;
>   unsigned int pipe;
>
> @@ -267,14 +264,6 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>
>   drm_crtc_handle_vblank(crtc);
>
> - spin_lock_irqsave(>dev->event_lock, flags);
> - if (mixer->pending_event) {
> - drm_crtc_send_vblank_event(crtc, mixer->pending_event);
> - drm_crtc_vblank_put(crtc);
> - mixer->pending_event = NULL;
> - }
> - spin_unlock_irqrestore(>dev->event_lock, flags);
> -
>   if (mixer->status == STI_MIXER_DISABLING) {
>   struct drm_plane *p;
>
> @@ -317,19 +306,12 @@ void sti_crtc_disable_vblank(struct drm_device 
> *drm_dev, unsigned int pipe)
>   struct sti_private *priv = drm_dev->dev_private;
>   struct sti_compositor *compo = priv->compo;
>   struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
> - struct drm_crtc *crtc = >mixer[pipe]->drm_crtc;
>   struct sti_vtg *vtg = compo->vtg[pipe];
>
>   DRM_DEBUG_DRIVER("\n");
>
>   if (sti_vtg_unregister_client(vtg, vtg_vblank_nb))
>   DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
> -
> - /* free the resources of the pending requests */
> - if (compo->mixer[pipe]->pending_event) {
> - drm_crtc_vblank_put(crtc);
> - compo->mixer[pipe]->pending_event = NULL;
> - }
>  }
>
>  static int sti_crtc_late_register(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
> index 830a3c4..e64a00e 100644
> --- a/drivers/gpu/drm/sti/sti_mixer.h
> +++ b/drivers/g

Re: [PATCH 1/3] drm/sti: use atomic_helper for commit

2017-02-01 Thread Vincent ABRIOU
Acked-by: Vincent Abriou <vincent.abr...@st.com>

On 01/12/2017 05:27 PM, Fabien Dessenne wrote:
> Since nonblocking atomic commits are now supported, the driver can
> now use drm_atomic_helper_commit().
>
> Signed-off-by: Fabien Dessenne <fabien.desse...@st.com>
> ---
>  drivers/gpu/drm/sti/sti_drv.c | 83 
> +--
>  drivers/gpu/drm/sti/sti_drv.h |  6 
>  2 files changed, 1 insertion(+), 88 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index ff71e25..9a9b9a2 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -150,52 +150,6 @@ static void sti_drm_dbg_cleanup(struct drm_minor *minor)
>1, minor);
>  }
>
> -static void sti_atomic_schedule(struct sti_private *private,
> - struct drm_atomic_state *state)
> -{
> - private->commit.state = state;
> - schedule_work(>commit.work);
> -}
> -
> -static void sti_atomic_complete(struct sti_private *private,
> - struct drm_atomic_state *state)
> -{
> - struct drm_device *drm = private->drm_dev;
> -
> - /*
> -  * Everything below can be run asynchronously without the need to grab
> -  * any modeset locks at all under one condition: It must be guaranteed
> -  * that the asynchronous work has either been cancelled (if the driver
> -  * supports it, which at least requires that the framebuffers get
> -  * cleaned up with drm_atomic_helper_cleanup_planes()) or completed
> -  * before the new state gets committed on the software side with
> -  * drm_atomic_helper_swap_state().
> -  *
> -  * This scheme allows new atomic state updates to be prepared and
> -  * checked in parallel to the asynchronous completion of the previous
> -  * update. Which is important since compositors need to figure out the
> -  * composition of the next frame right after having submitted the
> -  * current layout.
> -  */
> -
> - drm_atomic_helper_commit_modeset_disables(drm, state);
> - drm_atomic_helper_commit_planes(drm, state, 0);
> - drm_atomic_helper_commit_modeset_enables(drm, state);
> -
> - drm_atomic_helper_wait_for_vblanks(drm, state);
> -
> - drm_atomic_helper_cleanup_planes(drm, state);
> - drm_atomic_state_put(state);
> -}
> -
> -static void sti_atomic_work(struct work_struct *work)
> -{
> - struct sti_private *private = container_of(work,
> - struct sti_private, commit.work);
> -
> - sti_atomic_complete(private, private->commit.state);
> -}
> -
>  static int sti_atomic_check(struct drm_device *dev,
>   struct drm_atomic_state *state)
>  {
> @@ -216,38 +170,6 @@ static int sti_atomic_check(struct drm_device *dev,
>   return ret;
>  }
>
> -static int sti_atomic_commit(struct drm_device *drm,
> -  struct drm_atomic_state *state, bool nonblock)
> -{
> - struct sti_private *private = drm->dev_private;
> - int err;
> -
> - err = drm_atomic_helper_prepare_planes(drm, state);
> - if (err)
> - return err;
> -
> - /* serialize outstanding nonblocking commits */
> - mutex_lock(>commit.lock);
> - flush_work(>commit.work);
> -
> - /*
> -  * This is the point of no return - everything below never fails except
> -  * when the hw goes bonghits. Which means we can commit the new state on
> -  * the software side now.
> -  */
> -
> - drm_atomic_helper_swap_state(state, true);
> -
> - drm_atomic_state_get(state);
> - if (nonblock)
> - sti_atomic_schedule(private, state);
> - else
> - sti_atomic_complete(private, state);
> -
> - mutex_unlock(>commit.lock);
> - return 0;
> -}
> -
>  static void sti_output_poll_changed(struct drm_device *ddev)
>  {
>   struct sti_private *private = ddev->dev_private;
> @@ -271,7 +193,7 @@ static const struct drm_mode_config_funcs 
> sti_mode_config_funcs = {
>   .fb_create = drm_fb_cma_create,
>   .output_poll_changed = sti_output_poll_changed,
>   .atomic_check = sti_atomic_check,
> - .atomic_commit = sti_atomic_commit,
> + .atomic_commit = drm_atomic_helper_commit,
>  };
>
>  static void sti_mode_config_init(struct drm_device *dev)
> @@ -352,9 +274,6 @@ static int sti_init(struct drm_device *ddev)
>   dev_set_drvdata(ddev->dev, ddev);
>   private->drm_dev = ddev;
>
> - mutex_init(>commit.lock);
> - INIT_WORK(>commit.work, sti_atom

Re: [PATCH 13/19] drm/sti: Remove drm_debugfs_remove_files() calls

2017-01-27 Thread Vincent ABRIOU
Thank for this patch.
It is working fine with sti driver.

Acked-by: Vincent Abriou <vincent.abr...@st.com>
Tested-by: Vincent Abriou <vincent.abr...@st.com>

Vincent

On 01/26/2017 11:56 PM, Noralf Trønnes wrote:
> drm_debugfs_cleanup() now removes all minor->debugfs_list entries
> automatically, so it's not necessary to call
> drm_debugfs_remove_files(). Additionally it uses
> debugfs_remove_recursive() to clean up the debugfs files, so no need
> for adding fake drm_info_node entries.
>
> Cc: benjamin.gaign...@linaro.org
> Cc: vincent.abr...@st.com
> Signed-off-by: Noralf Trønnes <nor...@tronnes.org>
> ---
>  drivers/gpu/drm/sti/sti_drv.c   | 48 
> ++---
>  drivers/gpu/drm/sti/sti_dvo.c   | 10 -
>  drivers/gpu/drm/sti/sti_hda.c   | 11 --
>  drivers/gpu/drm/sti/sti_hdmi.c  | 11 --
>  drivers/gpu/drm/sti/sti_tvout.c |  8 ---
>  5 files changed, 6 insertions(+), 82 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index ff71e25..d3db224 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -89,38 +89,9 @@ static struct drm_info_list sti_drm_dbg_list[] = {
>   {"fps_get", sti_drm_fps_dbg_show, 0},
>  };
>
> -static int sti_drm_debugfs_create(struct dentry *root,
> -   struct drm_minor *minor,
> -   const char *name,
> -   const struct file_operations *fops)
> -{
> - struct drm_device *dev = minor->dev;
> - struct drm_info_node *node;
> - struct dentry *ent;
> -
> - ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops);
> - if (IS_ERR(ent))
> - return PTR_ERR(ent);
> -
> - node = kmalloc(sizeof(*node), GFP_KERNEL);
> - if (!node) {
> - debugfs_remove(ent);
> - return -ENOMEM;
> - }
> -
> - node->minor = minor;
> - node->dent = ent;
> - node->info_ent = (void *)fops;
> -
> - mutex_lock(>debugfs_lock);
> - list_add(>list, >debugfs_list);
> - mutex_unlock(>debugfs_lock);
> -
> - return 0;
> -}
> -
>  static int sti_drm_dbg_init(struct drm_minor *minor)
>  {
> + struct dentry *dentry;
>   int ret;
>
>   ret = drm_debugfs_create_files(sti_drm_dbg_list,
> @@ -129,10 +100,13 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
>   if (ret)
>   goto err;
>
> - ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show",
> + dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
> +  minor->debugfs_root, minor->dev,
>_drm_fps_fops);
> - if (ret)
> + if (!dentry) {
> + ret = -ENOMEM;
>   goto err;
> + }
>
>   DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
>   return 0;
> @@ -141,15 +115,6 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
>   return ret;
>  }
>
> -static void sti_drm_dbg_cleanup(struct drm_minor *minor)
> -{
> - drm_debugfs_remove_files(sti_drm_dbg_list,
> -  ARRAY_SIZE(sti_drm_dbg_list), minor);
> -
> - drm_debugfs_remove_files((struct drm_info_list *)_drm_fps_fops,
> -  1, minor);
> -}
> -
>  static void sti_atomic_schedule(struct sti_private *private,
>   struct drm_atomic_state *state)
>  {
> @@ -326,7 +291,6 @@ static struct drm_driver sti_driver = {
>   .gem_prime_mmap = drm_gem_cma_prime_mmap,
>
>   .debugfs_init = sti_drm_dbg_init,
> - .debugfs_cleanup = sti_drm_dbg_cleanup,
>
>   .name = DRIVER_NAME,
>   .desc = DRIVER_DESC,
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 411dc6e..bb23318 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -195,13 +195,6 @@ static struct drm_info_list dvo_debugfs_files[] = {
>   { "dvo", dvo_dbg_show, 0, NULL },
>  };
>
> -static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor)
> -{
> - drm_debugfs_remove_files(dvo_debugfs_files,
> -  ARRAY_SIZE(dvo_debugfs_files),
> -  minor);
> -}
> -
>  static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
>  {
>   unsigned int i;
> @@ -514,9 +507,6 @@ static void sti_dvo_unbind(struct device *dev,
>  struct device *master, void *data)
> 

Re: [PATCH] drm/sti: Fix compilation failure for drm_framebuffer.pixel_format

2017-01-25 Thread Vincent ABRIOU
Hi Chris,

Thank for the patch.
Acked-by: Vincent Abriou <vincent.abr...@st.com>

Vincent

On 01/25/2017 11:10 AM, Chris Wilson wrote:
> drivers/gpu/drm/sti/sti_plane.c:76:33: error: ‘struct drm_framebuffer’
> has no member named ‘pixel_format’; did you mean ‘format’?
>
> I didn't look to hard at the casting to a char * and just did a
> mechanical transformation of s/pixel_format/format->format/ as given in
> commit 438b74a5497c ("drm: Nuke fb->pixel_format").
>
> Fixes: 438b74a5497c ("drm: Nuke fb->pixel_format")
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrj...@linux.intel.com>
> Cc: Benjamin Gaignard <benjamin.gaign...@linaro.org>
> Cc: Vincent Abriou <vincent.abr...@st.com>
> ---
>  drivers/gpu/drm/sti/sti_plane.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c
> index 699094c559b4..427d8f58c6b1 100644
> --- a/drivers/gpu/drm/sti/sti_plane.c
> +++ b/drivers/gpu/drm/sti/sti_plane.c
> @@ -73,7 +73,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
>plane->drm_plane.name,
>plane->drm_plane.fb->width,
>plane->drm_plane.fb->height,
> -  (char *)>drm_plane.fb->pixel_format,
> +  (char *)>drm_plane.fb->format->format,
>fpks / 1000, fpks % 1000,
>sti_plane_to_str(plane));
>   }
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm: get fbdev size from cmdline mode if it exists

2017-01-11 Thread Vincent ABRIOU


On 01/11/2017 08:48 AM, Daniel Vetter wrote:
> On Tue, Jan 10, 2017 at 10:06:44PM +0200, Laurent Pinchart wrote:
>> Hi Vincent,
>>
>> On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
>>> On 01/10/2017 12:39 PM, Daniel Vetter wrote:
>>>> On Tue, Jan 10, 2017 at 12:21:09PM +0100, Vincent Abriou wrote:
>>>>> In case no connector is found while creating the fbdev, gives the
>>>>> possibility to specify the default fbdev size by firstly checking if the
>>>>> command line is defining a preferred mode. Else go into fallback and set
>>>>> 1024x768 fbdev size as it was already done.
>>>>>
>>>>> Cc: Tomi Valkeinen 
>>>>> Signed-off-by: Vincent Abriou 
>>>>
>>>> btw on all this there's also the possible solution to delay setup of the
>>>> fbdev until the first connector switches to connected, and then only
>>>> allocting the fb and doing the setup. Tegra has that, and Thierry did some
>>>> patches to move that logic into the fb helpers. But there's some locking
>>>> issues that need to be fixed first, hence why those patches haven't landed
>>>> yet.
>>>>
>>>> But if you never probe the right mode, this here sounds like a good idea
>>>> too.
>>>
>>> The early creation of fbdev is useful for userland system. If fbdev
>>> creation is delayed until first connector is connected, userland systems
>>> startup could fails (like Android that check fbdev availability at startup).
>>>
>>> Today if no connector is connected, a default 1024x768 fbdev is created
>>> but it does not necessarily match the targeted CRTC size. When the
>>> connector is connected, fbdev is not reconfigured with the targeted CRTC
>>> size and it is anyway too late for the userland to take into account new
>>> fbdev size. Reading the cmdline is an easy way to solve this.
>>
>> Isn't it another case of working around userspace issue in the kernel ?
>> Shouldn't the offending userspace code be fixed ? And while at it, moved from
>> fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to 
>> use
>> DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly
>> anymore, but I can share it if you're interested.

Android is one example and it still give the possibility to start with 
fbdev.
I'm not trying to fixe userspace issue (there is so many userspaces :)). 
The default case to set fbdev to 1024x768 already exist in the drm fb 
helpers. I just add a way to be flexible.

Vincent

>
> So android still doesn't boot without fbdev? I thought that's been fixed
> ...
> -Daniel
>


Re: [PATCH v2] drm: get fbdev size from cmdline mode if it exists

2017-01-11 Thread Vincent ABRIOU


On 01/11/2017 12:11 PM, Laurent Pinchart wrote:
> Hi Vincent,
>
> On Wednesday 11 Jan 2017 09:03:07 Vincent ABRIOU wrote:
>> On 01/11/2017 08:48 AM, Daniel Vetter wrote:
>>> On Tue, Jan 10, 2017 at 10:06:44PM +0200, Laurent Pinchart wrote:
>>>> On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
>>>>> On 01/10/2017 12:39 PM, Daniel Vetter wrote:
>>>>>> On Tue, Jan 10, 2017 at 12:21:09PM +0100, Vincent Abriou wrote:
>>>>>>> In case no connector is found while creating the fbdev, gives the
>>>>>>> possibility to specify the default fbdev size by firstly checking if
>>>>>>> the command line is defining a preferred mode. Else go into fallback
>>>>>>> and set 1024x768 fbdev size as it was already done.
>>>>>>>
>>>>>>> Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
>>>>>>> Signed-off-by: Vincent Abriou <vincent.abr...@st.com>
>>>>>>
>>>>>> btw on all this there's also the possible solution to delay setup of
>>>>>> the fbdev until the first connector switches to connected, and then
>>>>>> only allocting the fb and doing the setup. Tegra has that, and Thierry
>>>>>> did some patches to move that logic into the fb helpers. But there's
>>>>>> some locking issues that need to be fixed first, hence why those
>>>>>> patches haven't landed yet.
>>>>>>
>>>>>> But if you never probe the right mode, this here sounds like a good
>>>>>> idea too.
>>>>>
>>>>> The early creation of fbdev is useful for userland system. If fbdev
>>>>> creation is delayed until first connector is connected, userland systems
>>>>> startup could fails (like Android that check fbdev availability at
>>>>> startup).
>>>>>
>>>>> Today if no connector is connected, a default 1024x768 fbdev is created
>>>>> but it does not necessarily match the targeted CRTC size. When the
>>>>> connector is connected, fbdev is not reconfigured with the targeted CRTC
>>>>> size and it is anyway too late for the userland to take into account new
>>>>> fbdev size. Reading the cmdline is an easy way to solve this.
>>>>
>>>> Isn't it another case of working around userspace issue in the kernel ?
>>>> Shouldn't the offending userspace code be fixed ? And while at it, moved
>>>> from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years
>>>> ago to use DRM/KMS in the Android init process. I'm sure it doesn't
>>>> apply cleanly anymore, but I can share it if you're interested.
>>
>> Android is one example and it still give the possibility to start with
>> fbdev. I'm not trying to fixe userspace issue (there is so many userspaces
>> :)). The default case to set fbdev to 1024x768 already exist in the drm fb
>> helpers. I just add a way to be flexible.
>
> Sure, I understand that. My point is that, instead of making life easy for
> userspace that hasn't switched to DRM/KMS yet, wouldn't it be time to push
> them a bit more ?
>
>>> So android still doesn't boot without fbdev? I thought that's been fixed
>

Android support fbdev and drm/kms.

> I haven't checked the latest version to be honest.
>

The last Android version still support fbdev.

Vincent
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm: get fbdev size from cmdline mode if it exists

2017-01-10 Thread Vincent ABRIOU


On 01/10/2017 12:39 PM, Daniel Vetter wrote:
> On Tue, Jan 10, 2017 at 12:21:09PM +0100, Vincent Abriou wrote:
>> In case no connector is found while creating the fbdev, gives the
>> possibility to specify the default fbdev size by firstly checking if the
>> command line is defining a preferred mode. Else go into fallback and set
>> 1024x768 fbdev size as it was already done.
>>
>> Cc: Tomi Valkeinen 
>> Signed-off-by: Vincent Abriou 
>
> btw on all this there's also the possible solution to delay setup of the
> fbdev until the first connector switches to connected, and then only
> allocting the fb and doing the setup. Tegra has that, and Thierry did some
> patches to move that logic into the fb helpers. But there's some locking
> issues that need to be fixed first, hence why those patches haven't landed
> yet.
>
> But if you never probe the right mode, this here sounds like a good idea
> too.
> -Daniel

The early creation of fbdev is useful for userland system. If fbdev 
creation is delayed until first connector is connected, userland systems 
startup could fails (like Android that check fbdev availability at startup).

Today if no connector is connected, a default 1024x768 fbdev is created 
but it does not necessarily match the targeted CRTC size. When the 
connector is connected, fbdev is not reconfigured with the targeted CRTC 
size and it is anyway too late for the userland to take into account new 
fbdev size.
Reading the cmdline is an easy way to solve this.

Regards,
Vincent

>> ---
>> Patch v2:
>>  add a break in the connector for loop when a first cmdline mode is found
>>
>>  drivers/gpu/drm/drm_fb_helper.c | 34 +-
>>  1 file changed, 29 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c 
>> b/drivers/gpu/drm/drm_fb_helper.c
>> index 0ab6aaa..b38285f 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -1526,6 +1526,7 @@ static int drm_fb_helper_single_fb_probe(struct 
>> drm_fb_helper *fb_helper,
>>  }
>>
>>  crtc_count = 0;
>> +
>>  for (i = 0; i < fb_helper->crtc_count; i++) {
>>  struct drm_display_mode *desired_mode;
>>  struct drm_mode_set *mode_set;
>> @@ -1570,11 +1571,34 @@ static int drm_fb_helper_single_fb_probe(struct 
>> drm_fb_helper *fb_helper,
>>  }
>>
>>  if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) {
>> -/* hmm everyone went away - assume VGA cable just fell out
>> -   and will come back later. */
>> -DRM_INFO("Cannot find any crtc or sizes - going 1024x768\n");
>> -sizes.fb_width = sizes.surface_width = 1024;
>> -sizes.fb_height = sizes.surface_height = 768;
>> +struct drm_display_mode *mode = NULL;
>> +/* hmm everyone went away - assume cable just fell out and will
>> + * come back later.
>> + * Get fb size from command line mode (if existing) else fb size
>> + * is set to 1024x768
>> + */
>> +for (i = 0; i < fb_helper->connector_count; i++) {
>> +struct drm_fb_helper_connector *fb_helper_conn;
>> +
>> +fb_helper_conn = fb_helper->connector_info[i];
>> +mode = drm_pick_cmdline_mode(fb_helper_conn);
>> +if (mode)
>> +break;
>> +}
>> +
>> +if (mode) {
>> +sizes.fb_width = mode->hdisplay;
>> +sizes.fb_height = mode->vdisplay;
>> +DRM_INFO("Cannot find any crtc or sizes - use cmdline 
>> %dx%d\n",
>> + sizes.fb_width, sizes.fb_height);
>> +} else {
>> +sizes.fb_width = 1024;
>> +sizes.fb_height = 768;
>> +DRM_INFO("Cannot find any crtc or sizes - going 
>> 1024x768\n");
>> +}
>> +
>> +sizes.surface_width = sizes.fb_width;
>> +sizes.surface_height = sizes.fb_height;
>>  }
>>
>>  /* push down into drivers */
>> --
>> 2.7.4
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>


[PATCH v2] drm: get fbdev size from cmdline mode if it exists

2017-01-10 Thread Vincent Abriou
In case no connector is found while creating the fbdev, gives the
possibility to specify the default fbdev size by firstly checking if the
command line is defining a preferred mode. Else go into fallback and set
1024x768 fbdev size as it was already done.

Cc: Tomi Valkeinen 
Signed-off-by: Vincent Abriou 
---
Patch v2:
 add a break in the connector for loop when a first cmdline mode is found

 drivers/gpu/drm/drm_fb_helper.c | 34 +-
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 0ab6aaa..b38285f 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1526,6 +1526,7 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper,
}

crtc_count = 0;
+
for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_display_mode *desired_mode;
struct drm_mode_set *mode_set;
@@ -1570,11 +1571,34 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper,
}

if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) {
-   /* hmm everyone went away - assume VGA cable just fell out
-  and will come back later. */
-   DRM_INFO("Cannot find any crtc or sizes - going 1024x768\n");
-   sizes.fb_width = sizes.surface_width = 1024;
-   sizes.fb_height = sizes.surface_height = 768;
+   struct drm_display_mode *mode = NULL;
+   /* hmm everyone went away - assume cable just fell out and will
+* come back later.
+* Get fb size from command line mode (if existing) else fb size
+* is set to 1024x768
+*/
+   for (i = 0; i < fb_helper->connector_count; i++) {
+   struct drm_fb_helper_connector *fb_helper_conn;
+
+   fb_helper_conn = fb_helper->connector_info[i];
+   mode = drm_pick_cmdline_mode(fb_helper_conn);
+   if (mode)
+   break;
+   }
+
+   if (mode) {
+   sizes.fb_width = mode->hdisplay;
+   sizes.fb_height = mode->vdisplay;
+   DRM_INFO("Cannot find any crtc or sizes - use cmdline 
%dx%d\n",
+sizes.fb_width, sizes.fb_height);
+   } else {
+   sizes.fb_width = 1024;
+   sizes.fb_height = 768;
+   DRM_INFO("Cannot find any crtc or sizes - going 
1024x768\n");
+   }
+
+   sizes.surface_width = sizes.fb_width;
+   sizes.surface_height = sizes.fb_height;
}

/* push down into drivers */
-- 
2.7.4



[PULL v2] sti-drm-next-2017-01-06

2017-01-10 Thread Vincent Abriou
Hi Dave,

Here is an update of the STI drm driver.
It contains stih410 cleanup, create fbdev at binding, HQVDP fixes.

Tag is available but not yet signed for the moment. I'm working on it.

Regards,
Vincent

The following changes since commit 2cf026ae85c42f253feb9f420d1b4bc99bd5503d:

  Merge branch 'linux-4.10' of git://github.com/skeggsb/linux into drm-next 
(2016-12-13 14:29:05 +1000)

are available in the git repository at:

  https://github.com/vinceab/linux.git tags/sti-drm-next-2017-01-06

for you to fetch changes up to 1ae0d5af347df224a6e76334683f13a96d915a44:

  drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache 
(2017-01-06 15:12:03 +0100)


stih410 cleanup, create fbdev at binding, HQVDP fixes.


Arnaud Pouliquen (1):
  drm/sti: allow audio playback on HDMI even if disabled.

Arvind Yadav (1):
  drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache

Fabien DESSENNE (2):
  drm/sti: load XP70 firmware only once
  drm/sti: do not post HQVDP command if no update

Vincent Abriou (3):
  drm/sti: update fps debugfs entries
  drm/sti: create fbdev at binding
  drm/sti: remove deprecated sti_vtac.c file

 drivers/gpu/drm/sti/Makefile|   1 -
 drivers/gpu/drm/sti/sti_drv.c   |  28 ++---
 drivers/gpu/drm/sti/sti_drv.h   |   1 -
 drivers/gpu/drm/sti/sti_hdmi.c  | 205 ++--
 drivers/gpu/drm/sti/sti_hqvdp.c |  23 -
 drivers/gpu/drm/sti/sti_plane.c |  17 ++-
 drivers/gpu/drm/sti/sti_plane.h |   2 +-
 drivers/gpu/drm/sti/sti_vtac.c  | 223 
 drivers/gpu/drm/sti/sti_vtg.c   |   4 +
 9 files changed, 154 insertions(+), 350 deletions(-)
 delete mode 100644 drivers/gpu/drm/sti/sti_vtac.c


[PATCH 2/2] drm: get fbdev size from cmdline if no connector found

2017-01-06 Thread Vincent Abriou
In case no connector is found while creating the fbdev, gives the
possibility to specify the default fbdev size by firstly checking if the
command line is defining a preferred mode. Else go into fallback and set
1024x768 fbdev size as it was already done.

Cc: Tomi Valkeinen 
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/drm_fb_helper.c | 32 +++-
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 77d9ac6..115c265 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1522,6 +1522,7 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper,
}

crtc_count = 0;
+
for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_display_mode *desired_mode;
struct drm_mode_set *mode_set;
@@ -1566,11 +1567,32 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper,
}

if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) {
-   /* hmm everyone went away - assume VGA cable just fell out
-  and will come back later. */
-   DRM_INFO("Cannot find any crtc or sizes - going 1024x768\n");
-   sizes.fb_width = sizes.surface_width = 1024;
-   sizes.fb_height = sizes.surface_height = 768;
+   struct drm_display_mode *mode = NULL;
+   /* hmm everyone went away - assume cable just fell out and will
+* come back later.
+* Get fb size from command line mode (if existing) else fb size
+* is set to 1024x768
+*/
+   for (i = 0; i < fb_helper->connector_count; i++) {
+   struct drm_fb_helper_connector *fb_helper_conn;
+
+   fb_helper_conn = fb_helper->connector_info[i];
+   mode = drm_pick_cmdline_mode(fb_helper_conn);
+   }
+
+   if (mode) {
+   sizes.fb_width = mode->hdisplay;
+   sizes.fb_height = mode->vdisplay;
+   DRM_INFO("Cannot find any crtc or sizes - use cmdline 
%dx%d\n",
+sizes.fb_width, sizes.fb_height);
+   } else {
+   sizes.fb_width = 1024;
+   sizes.fb_height = 768;
+   DRM_INFO("Cannot find any crtc or sizes - going 
1024x768\n");
+   }
+
+   sizes.surface_width = sizes.fb_width;
+   sizes.surface_height = sizes.fb_height;
}

/* push down into drivers */
-- 
2.7.4



[PATCH 1/2] drm: remove useless parameters from drm_pick_cmdline_mode function

2017-01-06 Thread Vincent Abriou
drm_pick_cmdline_mode width and height parameters are useless.
Just remove them.

Cc: Daniel Vetter 
Cc: Jani Nikula 
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/drm_fb_helper.c| 7 +++
 drivers/gpu/drm/i915/intel_fbdev.c | 2 +-
 include/drm/drm_fb_helper.h| 3 +--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index e934b54..77d9ac6 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1748,8 +1748,7 @@ static bool drm_has_cmdline_mode(struct 
drm_fb_helper_connector *fb_connector)
return fb_connector->connector->cmdline_mode.specified;
 }

-struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_connector 
*fb_helper_conn,
- int width, int height)
+struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_connector 
*fb_helper_conn)
 {
struct drm_cmdline_mode *cmdline_mode;
struct drm_display_mode *mode;
@@ -1867,7 +1866,7 @@ static bool drm_target_cloned(struct drm_fb_helper 
*fb_helper,
if (!enabled[i])
continue;
fb_helper_conn = fb_helper->connector_info[i];
-   modes[i] = drm_pick_cmdline_mode(fb_helper_conn, width, height);
+   modes[i] = drm_pick_cmdline_mode(fb_helper_conn);
if (!modes[i]) {
can_clone = false;
break;
@@ -1989,7 +1988,7 @@ static bool drm_target_preferred(struct drm_fb_helper 
*fb_helper,
  fb_helper_conn->connector->base.id);

/* got for command line mode first */
-   modes[i] = drm_pick_cmdline_mode(fb_helper_conn, width, height);
+   modes[i] = drm_pick_cmdline_mode(fb_helper_conn);
if (!modes[i]) {
DRM_DEBUG_KMS("looking for preferred mode on connector 
%d %d\n",
  fb_helper_conn->connector->base.id, 
fb_helper_conn->connector->tile_group ? 
fb_helper_conn->connector->tile_group->id : 0);
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
b/drivers/gpu/drm/i915/intel_fbdev.c
index beb0898..4b302f8 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -447,7 +447,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper 
*fb_helper,
  connector->name);

/* go for command line mode first */
-   modes[i] = drm_pick_cmdline_mode(fb_conn, width, height);
+   modes[i] = drm_pick_cmdline_mode(fb_conn);

/* try for preferred next */
if (!modes[i]) {
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 975deed..48e09e8 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -295,8 +295,7 @@ struct drm_display_mode *
 drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector,
int width, int height);
 struct drm_display_mode *
-drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
- int width, int height);
+drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn);

 int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct 
drm_connector *connector);
 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
-- 
2.7.4



[PATCH 0/2] get fbdev size from cmdline if no connector found

2017-01-06 Thread Vincent Abriou
In case no connector is found while creating the fbdev, gives the
possibility to specify the default fbdev size by firstly checking if the
command line is defining a preferred mode. Else go into fallback and set
1024x768 fbdev size as it was already done.

It is usefull in case you forgot to plug your connector cable but you want
your fbdev to have the size you have defined in the command line.
Then when you plug your connector cable, the fbdev will match your display
size.

In case no command line is specified, the 1024x768 fbdev resolution is keept
as default fbdev resolution.

Vincent Abriou (2):
  drm: remove useless parameters from drm_pick_cmdline_mode function
  drm: get fbdev size from cmdline mode if it exists.

 drivers/gpu/drm/drm_fb_helper.c| 39 +-
 drivers/gpu/drm/i915/intel_fbdev.c |  2 +-
 include/drm/drm_fb_helper.h|  3 +--
 3 files changed, 32 insertions(+), 12 deletions(-)

-- 
2.7.4



[PULL] sti-drm-next-2017-01-06

2017-01-06 Thread Vincent Abriou
Hi Dave,

Here is an update of the STI drm driver.
It contains file cleanup and various fixes.

Regard,
Vincent

The following changes since commit 2cf026ae85c42f253feb9f420d1b4bc99bd5503d:

  Merge branch 'linux-4.10' of git://github.com/skeggsb/linux into drm-next 
(2016-12-13 14:29:05 +1000)

are available in the git repository at:

  https://github.com/vinceab/linux.git 1ae0d5af347df224a6e76334683f13a96d915a44

for you to fetch changes up to 1ae0d5af347df224a6e76334683f13a96d915a44:

  drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache 
(2017-01-06 15:12:03 +0100)


Arnaud Pouliquen (1):
  drm/sti: allow audio playback on HDMI even if disabled.

Arvind Yadav (1):
  drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache

Fabien DESSENNE (2):
  drm/sti: load XP70 firmware only once
  drm/sti: do not post HQVDP command if no update

Vincent Abriou (3):
  drm/sti: update fps debugfs entries
  drm/sti: create fbdev at binding
  drm/sti: remove deprecated sti_vtac.c file

 drivers/gpu/drm/sti/Makefile|   1 -
 drivers/gpu/drm/sti/sti_drv.c   |  28 ++---
 drivers/gpu/drm/sti/sti_drv.h   |   1 -
 drivers/gpu/drm/sti/sti_hdmi.c  | 205 ++--
 drivers/gpu/drm/sti/sti_hqvdp.c |  23 -
 drivers/gpu/drm/sti/sti_plane.c |  17 ++-
 drivers/gpu/drm/sti/sti_plane.h |   2 +-
 drivers/gpu/drm/sti/sti_vtac.c  | 223 
 drivers/gpu/drm/sti/sti_vtg.c   |   4 +
 9 files changed, 154 insertions(+), 350 deletions(-)
 delete mode 100644 drivers/gpu/drm/sti/sti_vtac.c


[PATCH] drm: sti: allow audio playback on HDMI even if disabled.

2017-01-04 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 

On 09/30/2016 05:17 PM, Arnaud Pouliquen wrote:
> This fix allows to play audio while HDMI is disconnected.
> When HDMI is disable, audio configuration is stored and samples
> are dropped (by HDMI IP).
> When HDMI is enabled, audio HDMI configuration is applied and samples
> are outputted on HDMI wire.
>
> Signed-off-by: Arnaud Pouliquen 
> ---
>  drivers/gpu/drm/sti/sti_hdmi.c | 205 
> -
>  1 file changed, 101 insertions(+), 104 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 376b076..9c0025e 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -788,6 +788,95 @@ static void sti_hdmi_disable(struct drm_bridge *bridge)
>   hdmi->enabled = false;
>  }
>
> +/**
> + * sti_hdmi_audio_get_non_coherent_n() - get N parameter for non-coherent
> + * clocks. None-coherent clocks means that audio and TMDS clocks have not the
> + * same source (drifts between clocks). In this case assumption is that CTS 
> is
> + * automatically calculated by hardware.
> + *
> + * @audio_fs: audio frame clock frequency in Hz
> + *
> + * Values computed are based on table described in HDMI specification 1.4b
> + *
> + * Returns n value.
> + */
> +static int sti_hdmi_audio_get_non_coherent_n(unsigned int audio_fs)
> +{
> + unsigned int n;
> +
> + switch (audio_fs) {
> + case 32000:
> + n = 4096;
> + break;
> + case 44100:
> + n = 6272;
> + break;
> + case 48000:
> + n = 6144;
> + break;
> + case 88200:
> + n = 6272 * 2;
> + break;
> + case 96000:
> + n = 6144 * 2;
> + break;
> + case 176400:
> + n = 6272 * 4;
> + break;
> + case 192000:
> + n = 6144 * 4;
> + break;
> + default:
> + /* Not pre-defined, recommended value: 128 * fs / 1000 */
> + n = (audio_fs * 128) / 1000;
> + }
> +
> + return n;
> +}
> +
> +static int hdmi_audio_configure(struct sti_hdmi *hdmi)
> +{
> + int audio_cfg, n;
> + struct hdmi_audio_params *params = >audio;
> + struct hdmi_audio_infoframe *info = >cea;
> +
> + DRM_DEBUG_DRIVER("\n");
> +
> + if (!hdmi->enabled)
> + return 0;
> +
> + /* update N parameter */
> + n = sti_hdmi_audio_get_non_coherent_n(params->sample_rate);
> +
> + DRM_DEBUG_DRIVER("Audio rate = %d Hz, TMDS clock = %d Hz, n = %d\n",
> +  params->sample_rate, hdmi->mode.clock * 1000, n);
> + hdmi_write(hdmi, n, HDMI_AUDN);
> +
> + /* update HDMI registers according to configuration */
> + audio_cfg = HDMI_AUD_CFG_SPDIF_DIV_2 | HDMI_AUD_CFG_DTS_INVALID |
> + HDMI_AUD_CFG_ONE_BIT_INVALID;
> +
> + switch (info->channels) {
> + case 8:
> + audio_cfg |= HDMI_AUD_CFG_CH78_VALID;
> + case 6:
> + audio_cfg |= HDMI_AUD_CFG_CH56_VALID;
> + case 4:
> + audio_cfg |= HDMI_AUD_CFG_CH34_VALID | HDMI_AUD_CFG_8CH;
> + case 2:
> + audio_cfg |= HDMI_AUD_CFG_CH12_VALID;
> + break;
> + default:
> + DRM_ERROR("ERROR: Unsupported number of channels (%d)!\n",
> +   info->channels);
> + return -EINVAL;
> + }
> +
> + hdmi_write(hdmi, audio_cfg, HDMI_AUDIO_CFG);
> +
> + return hdmi_audio_infoframe_config(hdmi);
> +}
> +
>  static void sti_hdmi_pre_enable(struct drm_bridge *bridge)
>  {
>   struct sti_hdmi *hdmi = bridge->driver_private;
> @@ -826,9 +915,12 @@ static void sti_hdmi_pre_enable(struct drm_bridge 
> *bridge)
>   if (hdmi_avi_infoframe_config(hdmi))
>   DRM_ERROR("Unable to configure AVI infoframe\n");
>
> - /* Program AUDIO infoframe */
> - if (hdmi_audio_infoframe_config(hdmi))
> - DRM_ERROR("Unable to configure AUDIO infoframe\n");
> + if (hdmi->audio.enabled) {
> + if (hdmi_audio_configure(hdmi))
> + DRM_ERROR("Unable to configure audio\n");
> + } else {
> + hdmi_audio_infoframe_config(hdmi);
> + }
>
>   /* Program VS infoframe */
>   if (hdmi_vendor_infoframe_config(hdmi))
> @@ -1078,97 +1170,6 @@ static struct drm_encoder 
> *sti_hdmi_find_encoder(struct drm_device *dev)
>   return NULL;
>  }
>
> -/**
> - * sti_hdmi_audio_get_non_

[PATCH] drm/sti: create fbdev at binding

2017-01-04 Thread Vincent Abriou
Do not wait for a hot plug event to create fbdev.

Cc: Tomi Valkeinen 
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_drv.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index ff71e25..c584d4d 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -252,19 +252,7 @@ static void sti_output_poll_changed(struct drm_device 
*ddev)
 {
struct sti_private *private = ddev->dev_private;

-   if (!ddev->mode_config.num_connector)
-   return;
-
-   if (private->fbdev) {
-   drm_fbdev_cma_hotplug_event(private->fbdev);
-   return;
-   }
-
-   private->fbdev = drm_fbdev_cma_init(ddev, 32,
-   ddev->mode_config.num_crtc,
-   ddev->mode_config.num_connector);
-   if (IS_ERR(private->fbdev))
-   private->fbdev = NULL;
+   drm_fbdev_cma_hotplug_event(private->fbdev);
 }

 static const struct drm_mode_config_funcs sti_mode_config_funcs = {
@@ -382,6 +370,8 @@ static void sti_cleanup(struct drm_device *ddev)
 static int sti_bind(struct device *dev)
 {
struct drm_device *ddev;
+   struct sti_private *private;
+   struct drm_fbdev_cma *fbdev;
int ret;

ddev = drm_dev_alloc(_driver, dev);
@@ -404,6 +394,17 @@ static int sti_bind(struct device *dev)

drm_mode_config_reset(ddev);

+   private = ddev->dev_private;
+   if (ddev->mode_config.num_connector) {
+   fbdev = drm_fbdev_cma_init(ddev, 32, ddev->mode_config.num_crtc,
+  ddev->mode_config.num_connector);
+   if (IS_ERR(fbdev)) {
+   DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
+   fbdev = NULL;
+   }
+   private->fbdev = fbdev;
+   }
+
return 0;

 err_register:
-- 
2.7.4



[PATCH v2] drm/sti: remove deprecated sti_vtac.c file

2017-01-04 Thread Vincent Abriou
stih416 chip family is no more supported in Linux v4.9.
It is then useless to keep sti_vtac.c file since it not used at all for
the stih407/10 chip family supported by sti driver.

Signed-off-by: Vincent Abriou 
---
v2:
 Take into account Daniel's comment => add a more explicit commit message

 drivers/gpu/drm/sti/Makefile   |   1 -
 drivers/gpu/drm/sti/sti_drv.c  |   1 -
 drivers/gpu/drm/sti/sti_drv.h  |   1 -
 drivers/gpu/drm/sti/sti_vtac.c | 223 -
 4 files changed, 226 deletions(-)
 delete mode 100644 drivers/gpu/drm/sti/sti_vtac.c

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index d20f7c0..c35db12 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -13,7 +13,6 @@ sti-drm-y := \
sti_dvo.o \
sti_awg_utils.o \
sti_vtg.o \
-   sti_vtac.o \
sti_hda.o \
sti_tvout.o \
sti_hqvdp.o \
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index c584d4d..278a63f 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -477,7 +477,6 @@ static struct platform_driver sti_platform_driver = {

 static struct platform_driver * const drivers[] = {
_tvout_driver,
-   _vtac_driver,
_hqvdp_driver,
_hdmi_driver,
_hda_driver,
diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
index 78ebe5e..4c75845 100644
--- a/drivers/gpu/drm/sti/sti_drv.h
+++ b/drivers/gpu/drm/sti/sti_drv.h
@@ -34,7 +34,6 @@ struct sti_private {
 };

 extern struct platform_driver sti_tvout_driver;
-extern struct platform_driver sti_vtac_driver;
 extern struct platform_driver sti_hqvdp_driver;
 extern struct platform_driver sti_hdmi_driver;
 extern struct platform_driver sti_hda_driver;
diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c
deleted file mode 100644
index cf7fe8a..000
--- a/drivers/gpu/drm/sti/sti_vtac.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) STMicroelectronics SA 2014
- * Author: Benjamin Gaignard  for 
STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "sti_drv.h"
-
-/* registers offset */
-#define VTAC_CONFIG 0x00
-#define VTAC_RX_FIFO_CONFIG 0x04
-#define VTAC_FIFO_CONFIG_VAL0x04
-
-#define VTAC_SYS_CFG85210x824
-#define VTAC_SYS_CFG85220x828
-
-/* Number of phyts per pixel */
-#define VTAC_2_5_PPP0x0005
-#define VTAC_3_PPP  0x0006
-#define VTAC_4_PPP  0x0008
-#define VTAC_5_PPP  0x000A
-#define VTAC_6_PPP  0x000C
-#define VTAC_13_PPP 0x001A
-#define VTAC_14_PPP 0x001C
-#define VTAC_15_PPP 0x001E
-#define VTAC_16_PPP 0x0020
-#define VTAC_17_PPP 0x0022
-#define VTAC_18_PPP 0x0024
-
-/* enable bits */
-#define VTAC_ENABLE 0x3003
-
-#define VTAC_TX_PHY_ENABLE_CLK_PHY  BIT(0)
-#define VTAC_TX_PHY_ENABLE_CLK_DLL  BIT(1)
-#define VTAC_TX_PHY_PLL_NOT_OSC_MODEBIT(3)
-#define VTAC_TX_PHY_RST_N_DLL_SWITCHBIT(4)
-#define VTAC_TX_PHY_PROG_N3 BIT(9)
-
-
-/**
- * VTAC mode structure
- *
- * @vid_in_width: Video Data Resolution
- * @phyts_width: Width of phyt buses(phyt low and phyt high).
- * @phyts_per_pixel: Number of phyts sent per pixel
- */
-struct sti_vtac_mode {
-   u32 vid_in_width;
-   u32 phyts_width;
-   u32 phyts_per_pixel;
-};
-
-static const struct sti_vtac_mode vtac_mode_main = {
-   .vid_in_width = 0x2,
-   .phyts_width = 0x2,
-   .phyts_per_pixel = VTAC_5_PPP,
-};
-static const struct sti_vtac_mode vtac_mode_aux = {
-   .vid_in_width = 0x1,
-   .phyts_width = 0x0,
-   .phyts_per_pixel = VTAC_17_PPP,
-};
-
-/**
- * VTAC structure
- *
- * @dev: pointer to device structure
- * @regs: ioremapped registers for RX and TX devices
- * @phy_regs: phy registers for TX device
- * @clk: clock
- * @mode: main or auxillary configuration mode
- */
-struct sti_vtac {
-   struct device *dev;
-   void __iomem *regs;
-   void __iomem *phy_regs;
-   struct clk *clk;
-   const struct sti_vtac_mode *mode;
-};
-
-static void sti_vtac_rx_set_config(struct sti_vtac *vtac)
-{
-   u32 config;
-
-   /* Enable VTAC clock */
-   if (clk_prepare_enable(vtac->clk))
-   DRM_ERROR("Failed to prepare/enable vtac_rx clock.\n");
-
-   writel(VTAC_FIFO_CONFIG_VAL, vtac->regs + VTAC_RX_FIFO_CONFIG);
-
-   config = VTAC_ENABLE;
-   config |= vtac->mode->vid_in_width << 4;
-   config |= vtac->mode->phyts_width << 16;
-   config |= vtac->mode->phyts_per_pixel << 2

[PATCH] drm/sti: remove deprecated sti_vtac.c file

2017-01-04 Thread Vincent Abriou
sti_vtac.c file is deprecated since stih416 chip family is not
supported anymore.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/Makefile   |   1 -
 drivers/gpu/drm/sti/sti_drv.c  |   1 -
 drivers/gpu/drm/sti/sti_drv.h  |   1 -
 drivers/gpu/drm/sti/sti_vtac.c | 223 -
 4 files changed, 226 deletions(-)
 delete mode 100644 drivers/gpu/drm/sti/sti_vtac.c

diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index d20f7c0..c35db12 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -13,7 +13,6 @@ sti-drm-y := \
sti_dvo.o \
sti_awg_utils.o \
sti_vtg.o \
-   sti_vtac.o \
sti_hda.o \
sti_tvout.o \
sti_hqvdp.o \
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index c584d4d..278a63f 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -477,7 +477,6 @@ static struct platform_driver sti_platform_driver = {

 static struct platform_driver * const drivers[] = {
_tvout_driver,
-   _vtac_driver,
_hqvdp_driver,
_hdmi_driver,
_hda_driver,
diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
index 78ebe5e..4c75845 100644
--- a/drivers/gpu/drm/sti/sti_drv.h
+++ b/drivers/gpu/drm/sti/sti_drv.h
@@ -34,7 +34,6 @@ struct sti_private {
 };

 extern struct platform_driver sti_tvout_driver;
-extern struct platform_driver sti_vtac_driver;
 extern struct platform_driver sti_hqvdp_driver;
 extern struct platform_driver sti_hdmi_driver;
 extern struct platform_driver sti_hda_driver;
diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c
deleted file mode 100644
index cf7fe8a..000
--- a/drivers/gpu/drm/sti/sti_vtac.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) STMicroelectronics SA 2014
- * Author: Benjamin Gaignard  for 
STMicroelectronics.
- * License terms:  GNU General Public License (GPL), version 2
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "sti_drv.h"
-
-/* registers offset */
-#define VTAC_CONFIG 0x00
-#define VTAC_RX_FIFO_CONFIG 0x04
-#define VTAC_FIFO_CONFIG_VAL0x04
-
-#define VTAC_SYS_CFG85210x824
-#define VTAC_SYS_CFG85220x828
-
-/* Number of phyts per pixel */
-#define VTAC_2_5_PPP0x0005
-#define VTAC_3_PPP  0x0006
-#define VTAC_4_PPP  0x0008
-#define VTAC_5_PPP  0x000A
-#define VTAC_6_PPP  0x000C
-#define VTAC_13_PPP 0x001A
-#define VTAC_14_PPP 0x001C
-#define VTAC_15_PPP 0x001E
-#define VTAC_16_PPP 0x0020
-#define VTAC_17_PPP 0x0022
-#define VTAC_18_PPP 0x0024
-
-/* enable bits */
-#define VTAC_ENABLE 0x3003
-
-#define VTAC_TX_PHY_ENABLE_CLK_PHY  BIT(0)
-#define VTAC_TX_PHY_ENABLE_CLK_DLL  BIT(1)
-#define VTAC_TX_PHY_PLL_NOT_OSC_MODEBIT(3)
-#define VTAC_TX_PHY_RST_N_DLL_SWITCHBIT(4)
-#define VTAC_TX_PHY_PROG_N3 BIT(9)
-
-
-/**
- * VTAC mode structure
- *
- * @vid_in_width: Video Data Resolution
- * @phyts_width: Width of phyt buses(phyt low and phyt high).
- * @phyts_per_pixel: Number of phyts sent per pixel
- */
-struct sti_vtac_mode {
-   u32 vid_in_width;
-   u32 phyts_width;
-   u32 phyts_per_pixel;
-};
-
-static const struct sti_vtac_mode vtac_mode_main = {
-   .vid_in_width = 0x2,
-   .phyts_width = 0x2,
-   .phyts_per_pixel = VTAC_5_PPP,
-};
-static const struct sti_vtac_mode vtac_mode_aux = {
-   .vid_in_width = 0x1,
-   .phyts_width = 0x0,
-   .phyts_per_pixel = VTAC_17_PPP,
-};
-
-/**
- * VTAC structure
- *
- * @dev: pointer to device structure
- * @regs: ioremapped registers for RX and TX devices
- * @phy_regs: phy registers for TX device
- * @clk: clock
- * @mode: main or auxillary configuration mode
- */
-struct sti_vtac {
-   struct device *dev;
-   void __iomem *regs;
-   void __iomem *phy_regs;
-   struct clk *clk;
-   const struct sti_vtac_mode *mode;
-};
-
-static void sti_vtac_rx_set_config(struct sti_vtac *vtac)
-{
-   u32 config;
-
-   /* Enable VTAC clock */
-   if (clk_prepare_enable(vtac->clk))
-   DRM_ERROR("Failed to prepare/enable vtac_rx clock.\n");
-
-   writel(VTAC_FIFO_CONFIG_VAL, vtac->regs + VTAC_RX_FIFO_CONFIG);
-
-   config = VTAC_ENABLE;
-   config |= vtac->mode->vid_in_width << 4;
-   config |= vtac->mode->phyts_width << 16;
-   config |= vtac->mode->phyts_per_pixel << 23;
-   writel(config, vtac->regs + VTAC_CONFIG);
-}
-
-static void sti_vtac_tx_set_config(struct sti_vtac *vtac)
-{
-   u32 phy_config;
-   u32 config;
-
-  

[PATCH 2/2] drm/sti: create fbdev at binding

2017-01-04 Thread Vincent Abriou
Do not wait for a hot plug event to create fbdev.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_drv.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index ff71e25..c584d4d 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -252,19 +252,7 @@ static void sti_output_poll_changed(struct drm_device 
*ddev)
 {
struct sti_private *private = ddev->dev_private;

-   if (!ddev->mode_config.num_connector)
-   return;
-
-   if (private->fbdev) {
-   drm_fbdev_cma_hotplug_event(private->fbdev);
-   return;
-   }
-
-   private->fbdev = drm_fbdev_cma_init(ddev, 32,
-   ddev->mode_config.num_crtc,
-   ddev->mode_config.num_connector);
-   if (IS_ERR(private->fbdev))
-   private->fbdev = NULL;
+   drm_fbdev_cma_hotplug_event(private->fbdev);
 }

 static const struct drm_mode_config_funcs sti_mode_config_funcs = {
@@ -382,6 +370,8 @@ static void sti_cleanup(struct drm_device *ddev)
 static int sti_bind(struct device *dev)
 {
struct drm_device *ddev;
+   struct sti_private *private;
+   struct drm_fbdev_cma *fbdev;
int ret;

ddev = drm_dev_alloc(_driver, dev);
@@ -404,6 +394,17 @@ static int sti_bind(struct device *dev)

drm_mode_config_reset(ddev);

+   private = ddev->dev_private;
+   if (ddev->mode_config.num_connector) {
+   fbdev = drm_fbdev_cma_init(ddev, 32, ddev->mode_config.num_crtc,
+  ddev->mode_config.num_connector);
+   if (IS_ERR(fbdev)) {
+   DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
+   fbdev = NULL;
+   }
+   private->fbdev = fbdev;
+   }
+
return 0;

 err_register:
-- 
2.7.4



[PATCH 1/2] drm/sti: set initial connectors status at binding

2017-01-04 Thread Vincent Abriou
This avoid to have an "unknown" connector status after the sti driver is
registered.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
 drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index e8c1ed0..0e73541 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -498,6 +498,9 @@ static int sti_dvo_bind(struct device *dev, struct device 
*master, void *data)
drm_connector_helper_add(drm_connector,
 _dvo_connector_helper_funcs);

+   /* set initial status */
+   drm_connector->status = sti_dvo_connector_detect(drm_connector, false);
+
err = drm_mode_connector_attach_encoder(drm_connector, encoder);
if (err) {
DRM_ERROR("Failed to attach a connector to a encoder\n");
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 9c0025e..2c949bc 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1322,6 +1322,9 @@ static int sti_hdmi_bind(struct device *dev, struct 
device *master, void *data)
/* initialise property */
sti_hdmi_connector_init_property(drm_dev, drm_connector);

+   /* set initial status */
+   drm_connector->status = sti_hdmi_connector_detect(drm_connector, false);
+
hdmi->drm_connector = drm_connector;

err = drm_mode_connector_attach_encoder(drm_connector, encoder);
-- 
2.7.4



[PATCH 0/2] drm/sti: set connector status and create fbdev at binding

2017-01-04 Thread Vincent Abriou
While binding the sti drm driver the initial connectors status are set and the
fbdev is created.

Vincent Abriou (2):
  drm/sti: set initial connectors status at binding
  drm/sti: create fbdev at binding

 drivers/gpu/drm/sti/sti_drv.c  | 27 ++-
 drivers/gpu/drm/sti/sti_dvo.c  |  3 +++
 drivers/gpu/drm/sti/sti_hdmi.c |  3 +++
 3 files changed, 20 insertions(+), 13 deletions(-)

-- 
2.7.4



[PATCH 1/2] drm/sti: set initial connectors status at binding

2017-01-04 Thread Vincent ABRIOU


On 01/04/2017 10:39 AM, Daniel Vetter wrote:
> On Wed, Jan 04, 2017 at 10:15:45AM +0100, Vincent Abriou wrote:
>> This avoid to have an "unknown" connector status after the sti driver is
>> registered.
>>
>> Signed-off-by: Vincent Abriou 
>
> Why is this needed? The fb helpers will probe on their on, your driver
> should never need to do this. It also slows down initial boot when you
> don't need fbdev ...
> -Daniel
>

Hi Daniel,

This patch is indeed useless.
I will skip it from my pull request.

Thanks
Vincent

>> ---
>>  drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
>>  drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
>> index e8c1ed0..0e73541 100644
>> --- a/drivers/gpu/drm/sti/sti_dvo.c
>> +++ b/drivers/gpu/drm/sti/sti_dvo.c
>> @@ -498,6 +498,9 @@ static int sti_dvo_bind(struct device *dev, struct 
>> device *master, void *data)
>>  drm_connector_helper_add(drm_connector,
>>   _dvo_connector_helper_funcs);
>>
>> +/* set initial status */
>> +drm_connector->status = sti_dvo_connector_detect(drm_connector, false);
>> +
>>  err = drm_mode_connector_attach_encoder(drm_connector, encoder);
>>  if (err) {
>>  DRM_ERROR("Failed to attach a connector to a encoder\n");
>> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
>> index 9c0025e..2c949bc 100644
>> --- a/drivers/gpu/drm/sti/sti_hdmi.c
>> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
>> @@ -1322,6 +1322,9 @@ static int sti_hdmi_bind(struct device *dev, struct 
>> device *master, void *data)
>>  /* initialise property */
>>  sti_hdmi_connector_init_property(drm_dev, drm_connector);
>>
>> +/* set initial status */
>> +drm_connector->status = sti_hdmi_connector_detect(drm_connector, false);
>> +
>>  hdmi->drm_connector = drm_connector;
>>
>>  err = drm_mode_connector_attach_encoder(drm_connector, encoder);
>> --
>> 2.7.4
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>


[PATCH] drm/sti: update fps debugfs entries

2017-01-04 Thread Vincent Abriou
This update allows to have a clearer fps log trace by adding information
about plane size and plane pixel format.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_plane.c | 17 +
 drivers/gpu/drm/sti/sti_plane.h |  2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c
index ca4b371..699094c 100644
--- a/drivers/gpu/drm/sti/sti_plane.c
+++ b/drivers/gpu/drm/sti/sti_plane.c
@@ -65,9 +65,18 @@ void sti_plane_update_fps(struct sti_plane *plane,

fps->last_timestamp = now;
fps->last_frame_counter = fps->curr_frame_counter;
-   fpks = (num_frames * 100) / ms_since_last;
-   snprintf(plane->fps_info.fps_str, FPS_LENGTH, "%-6s @ %d.%.3d fps",
-sti_plane_to_str(plane), fpks / 1000, fpks % 1000);
+
+   if (plane->drm_plane.fb) {
+   fpks = (num_frames * 100) / ms_since_last;
+   snprintf(plane->fps_info.fps_str, FPS_LENGTH,
+"%-8s %4dx%-4d %.4s @ %3d.%-3.3d fps (%s)",
+plane->drm_plane.name,
+plane->drm_plane.fb->width,
+plane->drm_plane.fb->height,
+(char *)>drm_plane.fb->pixel_format,
+fpks / 1000, fpks % 1000,
+sti_plane_to_str(plane));
+   }

if (fps->curr_field_counter) {
/* Compute number of field updates */
@@ -75,7 +84,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
fps->last_field_counter = fps->curr_field_counter;
fipks = (num_fields * 100) / ms_since_last;
snprintf(plane->fps_info.fips_str,
-FPS_LENGTH, " - %d.%.3d field/sec",
+FPS_LENGTH, " - %3d.%-3.3d field/sec",
 fipks / 1000, fipks % 1000);
} else {
plane->fps_info.fips_str[0] = '\0';
diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h
index ce3e8d6..c36c13f 100644
--- a/drivers/gpu/drm/sti/sti_plane.h
+++ b/drivers/gpu/drm/sti/sti_plane.h
@@ -48,7 +48,7 @@ enum sti_plane_status {
STI_PLANE_DISABLED,
 };

-#define FPS_LENGTH 64
+#define FPS_LENGTH 128
 struct sti_fps_info {
bool output;
unsigned int curr_frame_counter;
-- 
2.7.4



[PATCH] drm/sti: remove deprecated sti_vtac.c file

2017-01-04 Thread Vincent ABRIOU


On 01/04/2017 10:40 AM, Daniel Vetter wrote:
> On Wed, Jan 04, 2017 at 10:26:46AM +0100, Vincent Abriou wrote:
>> sti_vtac.c file is deprecated since stih416 chip family is not
>> supported anymore.
>>
>> Signed-off-by: Vincent Abriou 
>
> Ehrm, removing existing support is Not Cool. This either needs more
> explanation, or it can't be merged.
> -Daniel
>

Hi Daniel,

stih416 chip family is no more supported in linux v4.9.
It is useless to keep this file since it not used at all for the 
stih407/10 chip family supported by our sti driver.

Vincent

>> ---
>>  drivers/gpu/drm/sti/Makefile   |   1 -
>>  drivers/gpu/drm/sti/sti_drv.c  |   1 -
>>  drivers/gpu/drm/sti/sti_drv.h  |   1 -
>>  drivers/gpu/drm/sti/sti_vtac.c | 223 
>> -
>>  4 files changed, 226 deletions(-)
>>  delete mode 100644 drivers/gpu/drm/sti/sti_vtac.c
>>
>> diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
>> index d20f7c0..c35db12 100644
>> --- a/drivers/gpu/drm/sti/Makefile
>> +++ b/drivers/gpu/drm/sti/Makefile
>> @@ -13,7 +13,6 @@ sti-drm-y := \
>>  sti_dvo.o \
>>  sti_awg_utils.o \
>>  sti_vtg.o \
>> -sti_vtac.o \
>>  sti_hda.o \
>>  sti_tvout.o \
>>  sti_hqvdp.o \
>> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
>> index c584d4d..278a63f 100644
>> --- a/drivers/gpu/drm/sti/sti_drv.c
>> +++ b/drivers/gpu/drm/sti/sti_drv.c
>> @@ -477,7 +477,6 @@ static struct platform_driver sti_platform_driver = {
>>
>>  static struct platform_driver * const drivers[] = {
>>  _tvout_driver,
>> -_vtac_driver,
>>  _hqvdp_driver,
>>  _hdmi_driver,
>>  _hda_driver,
>> diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h
>> index 78ebe5e..4c75845 100644
>> --- a/drivers/gpu/drm/sti/sti_drv.h
>> +++ b/drivers/gpu/drm/sti/sti_drv.h
>> @@ -34,7 +34,6 @@ struct sti_private {
>>  };
>>
>>  extern struct platform_driver sti_tvout_driver;
>> -extern struct platform_driver sti_vtac_driver;
>>  extern struct platform_driver sti_hqvdp_driver;
>>  extern struct platform_driver sti_hdmi_driver;
>>  extern struct platform_driver sti_hda_driver;
>> diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c
>> deleted file mode 100644
>> index cf7fe8a..000
>> --- a/drivers/gpu/drm/sti/sti_vtac.c
>> +++ /dev/null
>> @@ -1,223 +0,0 @@
>> -/*
>> - * Copyright (C) STMicroelectronics SA 2014
>> - * Author: Benjamin Gaignard  for 
>> STMicroelectronics.
>> - * License terms:  GNU General Public License (GPL), version 2
>> - */
>> -
>> -#include 
>> -#include 
>> -#include 
>> -#include 
>> -#include 
>> -
>> -#include 
>> -
>> -#include "sti_drv.h"
>> -
>> -/* registers offset */
>> -#define VTAC_CONFIG 0x00
>> -#define VTAC_RX_FIFO_CONFIG 0x04
>> -#define VTAC_FIFO_CONFIG_VAL0x04
>> -
>> -#define VTAC_SYS_CFG85210x824
>> -#define VTAC_SYS_CFG85220x828
>> -
>> -/* Number of phyts per pixel */
>> -#define VTAC_2_5_PPP0x0005
>> -#define VTAC_3_PPP  0x0006
>> -#define VTAC_4_PPP  0x0008
>> -#define VTAC_5_PPP  0x000A
>> -#define VTAC_6_PPP  0x000C
>> -#define VTAC_13_PPP 0x001A
>> -#define VTAC_14_PPP 0x001C
>> -#define VTAC_15_PPP 0x001E
>> -#define VTAC_16_PPP 0x0020
>> -#define VTAC_17_PPP 0x0022
>> -#define VTAC_18_PPP 0x0024
>> -
>> -/* enable bits */
>> -#define VTAC_ENABLE 0x3003
>> -
>> -#define VTAC_TX_PHY_ENABLE_CLK_PHY  BIT(0)
>> -#define VTAC_TX_PHY_ENABLE_CLK_DLL  BIT(1)
>> -#define VTAC_TX_PHY_PLL_NOT_OSC_MODEBIT(3)
>> -#define VTAC_TX_PHY_RST_N_DLL_SWITCHBIT(4)
>> -#define VTAC_TX_PHY_PROG_N3 BIT(9)
>> -
>> -
>> -/**
>> - * VTAC mode structure
>> - *
>> - * @vid_in_width: Video Data Resolution
>> - * @phyts_width: Width of phyt buses(phyt low and phyt high).
>> - * @phyts_per_pixel: Number of phyts sent per pixel
>> - */
>> -struct sti_vtac_mode {
>> -u32 vid_in_width;
>> -u32 phyts_width;
>> -u32 phyts_per_pixel;
>> -};
>

[v1] gpu: drm: sti: sti_vtac:- Handle return NULL error from devm_ioremap_nocache

2017-01-04 Thread Vincent ABRIOU
Hi Arvind,

Thank for this patch.
Since sti_vtac.c file is deprecated, I rather suppress the sti_vtac.c file.
I just push a new patch to suppress it.

Thank for pointing this out.
Br
Vincent

On 12/21/2016 06:22 AM, Arvind Yadav wrote:
> Here, If devm_ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference. This error check
> will avoid NULL pointer dereference.
>
> Signed-off-by: Arvind Yadav 
> ---
>  drivers/gpu/drm/sti/sti_vtac.c |4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/sti/sti_vtac.c b/drivers/gpu/drm/sti/sti_vtac.c
> index cf7fe8a..dd749e9 100644
> --- a/drivers/gpu/drm/sti/sti_vtac.c
> +++ b/drivers/gpu/drm/sti/sti_vtac.c
> @@ -191,6 +191,10 @@ static int sti_vtac_probe(struct platform_device *pdev)
>   if (res) {
>   vtac->phy_regs = devm_ioremap_nocache(dev, res->start,
>resource_size(res));
> + if (!vtac->phy_regs) {
> + DRM_ERROR("failed to remap I/O memory\n");
> + return -ENOMEM;
> + }
>   sti_vtac_tx_set_config(vtac);
>   } else {
>
>


[v1] gpu: drm: sti: sti_vtg:- Handle return NULL error from devm_ioremap_nocache

2017-01-04 Thread Vincent ABRIOU
Thanks for the patch.

Acked-by: Vincent Abriou 

I will take it for pull request that should be issued by the end of the 
week.

Vincent

On 12/21/2016 06:30 AM, Arvind Yadav wrote:
> Here, If devm_ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference. This error check
> will avoid NULL pointer dereference.
>
> Signed-off-by: Arvind Yadav 
> ---
>  drivers/gpu/drm/sti/sti_vtg.c |4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
> index a8882bd..c3d9c8a 100644
> --- a/drivers/gpu/drm/sti/sti_vtg.c
> +++ b/drivers/gpu/drm/sti/sti_vtg.c
> @@ -429,6 +429,10 @@ static int vtg_probe(struct platform_device *pdev)
>   return -ENOMEM;
>   }
>   vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> + if (!vtg->regs) {
> + DRM_ERROR("failed to remap I/O memory\n");
> + return -ENOMEM;
> + }
>
>   np = of_parse_phandle(pdev->dev.of_node, "st,slave", 0);
>   if (np) {
>


[PATCH] drm: Remove the struct drm_device platformdev field

2017-01-03 Thread Vincent ABRIOU
Hi Laurent,

Ok for the sti driver.
Acked-by: Vincent Abriou 

On 12/17/2016 11:39 PM, Laurent Pinchart wrote:
> The field contains a pointer to the parent platform device of the DRM
> device. As struct drm_device also contains a dev pointer to the struct
> device embedded in the platform_device structure, the platformdev field
> is redundant. Remove it and use the dev pointer directly.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> ---
>  drivers/gpu/drm/armada/armada_drv.c | 3 +--
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 5 ++---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 --
>  drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 +-
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c | 2 +-
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_mdss.c| 2 +-
>  drivers/gpu/drm/msm/msm_drv.c   | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c   | 3 +--
>  drivers/gpu/drm/sti/sti_drv.c   | 2 --
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 -
>  include/drm/drmP.h  | 1 -
>  11 files changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_drv.c 
> b/drivers/gpu/drm/armada/armada_drv.c
> index 07086b427c22..f6442ed23bcd 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -154,10 +154,9 @@ static int armada_drm_bind(struct device *dev)
>   return ret;
>   }
>
> - priv->drm.platformdev = to_platform_device(dev);
>   priv->drm.dev_private = priv;
>
> - platform_set_drvdata(priv->drm.platformdev, >drm);
> + dev_set_drvdata(dev, >drm);
>
>   INIT_WORK(>fb_unref_work, armada_drm_unref_work);
>   INIT_KFIFO(priv->fb_unref);
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index afc2b5d2d5f0..ec1c70d1b682 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -975,7 +975,7 @@ static int ade_dts_parse(struct platform_device *pdev, 
> struct ade_hw_ctx *ctx)
>
>  static int ade_drm_init(struct drm_device *dev)
>  {
> - struct platform_device *pdev = dev->platformdev;
> + struct platform_device *pdev = to_platform_device(dev->dev);
>   struct ade_data *ade;
>   struct ade_hw_ctx *ctx;
>   struct ade_crtc *acrtc;
> @@ -1036,8 +1036,7 @@ static int ade_drm_init(struct drm_device *dev)
>
>  static void ade_drm_cleanup(struct drm_device *dev)
>  {
> - struct platform_device *pdev = dev->platformdev;
> - struct ade_data *ade = platform_get_drvdata(pdev);
> + struct ade_data *ade = dev_get_drvdata(dev->dev);
>   struct drm_crtc *crtc = >acrtc.base;
>
>   drm_crtc_cleanup(crtc);
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index ebd5f4fe4c23..842f70251691 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -209,8 +209,6 @@ static int kirin_drm_bind(struct device *dev)
>   if (IS_ERR(drm_dev))
>   return PTR_ERR(drm_dev);
>
> - drm_dev->platformdev = to_platform_device(dev);
> -
>   ret = kirin_drm_kms_init(drm_dev);
>   if (ret)
>   goto err_drm_dev_unref;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c 
> b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> index b782efd4b95f..e8e14a502d21 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
> @@ -438,7 +438,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms)
>
>  struct msm_kms *mdp4_kms_init(struct drm_device *dev)
>  {
> - struct platform_device *pdev = dev->platformdev;
> + struct platform_device *pdev = to_platform_device(dev->dev);
>   struct mdp4_platform_config *config = mdp4_get_config(pdev);
>   struct mdp4_kms *mdp4_kms;
>   struct msm_kms *kms = NULL;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c 
> b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
> index 618b2ffed9b4..70eae85cf1de 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
> @@ -495,7 +495,7 @@ struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms 
> *mdp5_kms,
>   uint32_t major, uint32_t minor)
>  {
>   struct drm_device *dev = mdp5_kms->dev;
> - struct platform_device *pdev = dev->platformdev;
> + struct platform_device *pdev = to_platform_device(dev->dev);
>   stru

[PATCH v3 03/13] drm: bridge: Link encoder and bridge in core code

2016-11-30 Thread Vincent ABRIOU


On 11/29/2016 10:04 AM, Laurent Pinchart wrote:
> Instead of linking encoders and bridges in every driver (and getting it
> wrong half of the time, as many drivers forget to set the drm_bridge
> encoder pointer), do so in core code. The drm_bridge_attach() function
> needs the encoder and optional previous bridge to perform that task,
> update all the callers.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c   |  4 +-
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  4 +-
>  drivers/gpu/drm/bridge/dw-hdmi.c   |  3 +-
>  drivers/gpu/drm/drm_bridge.c   | 46 
> --
>  drivers/gpu/drm/drm_simple_kms_helper.c|  4 +-
>  drivers/gpu/drm/exynos/exynos_dp.c |  5 +--
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c|  6 +--
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c  |  5 +--
>  drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c   |  5 +--
>  drivers/gpu/drm/imx/imx-ldb.c  |  6 +--
>  drivers/gpu/drm/imx/parallel-display.c |  4 +-
>  drivers/gpu/drm/mediatek/mtk_dpi.c |  8 ++--
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 24 ++-
>  drivers/gpu/drm/mediatek/mtk_hdmi.c| 11 +++---
>  drivers/gpu/drm/msm/dsi/dsi_manager.c  | 17 +---
>  drivers/gpu/drm/msm/edp/edp_bridge.c   |  2 +-
>  drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c  |  5 +--
>  drivers/gpu/drm/sti/sti_dvo.c  |  3 +-
>  drivers/gpu/drm/sti/sti_hda.c  |  3 +-
>  drivers/gpu/drm/sti/sti_hdmi.c |  3 +-

Hi Laurent,

For sti dvo, hda and hdmi:
Acked-by: Vincent Abriou 

Vincent

>  drivers/gpu/drm/sun4i/sun4i_rgb.c  | 13 +++---
>  include/drm/drm_bridge.h   |  3 +-
>  23 files changed, 83 insertions(+), 103 deletions(-)
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c 
> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
> index 6119b5085501..e7799b6ee829 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
> @@ -230,9 +230,7 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device 
> *dev,
> of_node_put(np);
>
> if (bridge) {
> -   output->encoder.bridge = bridge;
> -   bridge->encoder = >encoder;
> -   ret = drm_bridge_attach(dev, bridge);
> +   ret = drm_bridge_attach(>encoder, bridge, NULL);
> if (!ret)
> return 0;
> }
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
> b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 6e0447f329a2..1835f1fdad19 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1227,12 +1227,10 @@ static int analogix_dp_create_bridge(struct 
> drm_device *drm_dev,
>
> dp->bridge = bridge;
>
> -   dp->encoder->bridge = bridge;
> bridge->driver_private = dp;
> -   bridge->encoder = dp->encoder;
> bridge->funcs = _dp_bridge_funcs;
>
> -   ret = drm_bridge_attach(drm_dev, bridge);
> +   ret = drm_bridge_attach(dp->encoder, bridge, NULL);
> if (ret) {
> DRM_ERROR("failed to attach drm bridge\n");
> return -EINVAL;
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c 
> b/drivers/gpu/drm/bridge/dw-hdmi.c
> index b71088dab268..432e0e3fff72 100644
> --- a/drivers/gpu/drm/bridge/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw-hdmi.c
> @@ -1841,13 +1841,12 @@ static int dw_hdmi_register(struct drm_device *drm, 
> struct dw_hdmi *hdmi)
> hdmi->bridge = bridge;
> bridge->driver_private = hdmi;
> bridge->funcs = _hdmi_bridge_funcs;
> -   ret = drm_bridge_attach(drm, bridge);
> +   ret = drm_bridge_attach(encoder, bridge, NULL);
> if (ret) {
> DRM_ERROR("Failed to initialize bridge with drm\n");
> return -EINVAL;
> }
>
> -   encoder->bridge = bridge;
> hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
>
> drm_connector_helper_add(>connector,
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 0ee052b7c21a..850bd6509ef1 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -26,6 +26,7 @@

[PATCH v3 11/13] drm: Set on-chip bridges' encoder type

2016-11-30 Thread Vincent ABRIOU


On 11/29/2016 10:04 AM, Laurent Pinchart wrote:
> Initialize the new drm_bridge::encoder_type field to the right value for
> all bridges that model on-SoC IP cores.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_mic.c | 2 ++
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 ++
>  drivers/gpu/drm/sti/sti_dvo.c   | 2 ++
>  3 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c 
> b/drivers/gpu/drm/exynos/exynos_drm_mic.c
> index a0def0be6d65..7175ecda36e8 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
> @@ -390,6 +390,8 @@ static int exynos_mic_bind(struct device *dev, struct 
> device *master,
>   mic->bridge.funcs = _bridge_funcs;
>   mic->bridge.of_node = dev->of_node;
>   mic->bridge.driver_private = mic;
> + mic->bridge.encoder_type = DRM_MODE_ENCODER_DSI;
> +
>   ret = drm_bridge_add(>bridge);
>   if (ret)
>   DRM_ERROR("mic: Failed to add MIC to the global bridge list\n");
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c 
> b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index 5ca1b0fbf937..bb5cf594c721 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1712,6 +1712,8 @@ static int mtk_drm_hdmi_probe(struct platform_device 
> *pdev)
>
>   hdmi->bridge.funcs = _hdmi_bridge_funcs;
>   hdmi->bridge.of_node = pdev->dev.of_node;
> + hdmi->bridge.encoder_type = DRM_MODE_ENCODER_TMDS;
> +
>   ret = drm_bridge_add(>bridge);
>   if (ret) {
>   dev_err(dev, "failed to add bridge, ret = %d\n", ret);
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 411dc6ec976e..8912c932078f 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -472,6 +472,8 @@ static int sti_dvo_bind(struct device *dev, struct device 
> *master, void *data)
>   bridge->driver_private = dvo;
>   bridge->funcs = _dvo_bridge_funcs;
>   bridge->of_node = dvo->dev.of_node;
> + bridge->encoder_type = DRM_MODE_ENCODER_LVDS;
> +
>   err = drm_bridge_add(bridge);
>   if (err) {
>   DRM_ERROR("Failed to add bridge\n");

For the sti dvo part:
Acked-by: Vincent Abriou 

Vincent
>


[PATCH] drm: Make the connector .detect() callback optional

2016-11-30 Thread Vincent ABRIOU
Hi Laurent,

For the sti driver:
Acked-by: Vincent Abriou 

Vincent

On 11/29/2016 09:56 PM, Laurent Pinchart wrote:
> Many drivers (21 to be exact) create connectors that are always
> connected (for instance to an LVDS or DSI panel). Instead of forcing
> them to implement a dummy .detect() handler, make the callback optional
> and consider the connector as always connected in that case.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  7 ---
>  drivers/gpu/drm/arc/arcpgu_sim.c |  7 ---
>  drivers/gpu/drm/ast/ast_mode.c   |  7 ---
>  drivers/gpu/drm/bochs/bochs_kms.c|  7 ---
>  drivers/gpu/drm/bridge/nxp-ptn3460.c |  7 ---
>  drivers/gpu/drm/bridge/parade-ps8622.c   |  7 ---
>  drivers/gpu/drm/bridge/tc358767.c|  7 ---
>  drivers/gpu/drm/cirrus/cirrus_mode.c |  7 ---
>  drivers/gpu/drm/drm_probe_helper.c   | 14 +++---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c|  7 ---
>  drivers/gpu/drm/gma500/cdv_intel_lvds.c  | 14 --
>  drivers/gpu/drm/gma500/psb_intel_lvds.c  | 14 --
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c |  7 ---
>  drivers/gpu/drm/i915/intel_dsi.c |  7 ---
>  drivers/gpu/drm/imx/imx-ldb.c|  7 ---
>  drivers/gpu/drm/imx/imx-tve.c|  7 ---
>  drivers/gpu/drm/imx/parallel-display.c   |  7 ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c   |  7 ---
>  drivers/gpu/drm/mgag200/mgag200_mode.c   |  7 ---
>  drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c|  7 ---
>  drivers/gpu/drm/rockchip/dw-mipi-dsi.c   |  7 ---
>  drivers/gpu/drm/shmobile/shmob_drm_crtc.c|  7 ---
>  drivers/gpu/drm/sti/sti_hda.c|  7 ---
>  drivers/gpu/drm/sun4i/sun4i_rgb.c|  7 ---
>  drivers/gpu/drm/sun4i/sun4i_tv.c |  7 ---
>  drivers/gpu/drm/tilcdc/tilcdc_panel.c|  8 
>  include/drm/drm_connector.h  |  3 +++
>  27 files changed, 14 insertions(+), 193 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 81cbf0b05dff..1d93e123532d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -429,12 +429,6 @@ dce_virtual_dpms(struct drm_connector *connector, int 
> mode)
> return 0;
>  }
>
> -static enum drm_connector_status
> -dce_virtual_detect(struct drm_connector *connector, bool force)
> -{
> -   return connector_status_connected;
> -}
> -
>  static int
>  dce_virtual_set_property(struct drm_connector *connector,
>  struct drm_property *property,
> @@ -463,7 +457,6 @@ static const struct drm_connector_helper_funcs 
> dce_virtual_connector_helper_func
>
>  static const struct drm_connector_funcs dce_virtual_connector_funcs = {
> .dpms = dce_virtual_dpms,
> -   .detect = dce_virtual_detect,
> .fill_modes = drm_helper_probe_single_connector_modes,
> .set_property = dce_virtual_set_property,
> .destroy = dce_virtual_destroy,
> diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c 
> b/drivers/gpu/drm/arc/arcpgu_sim.c
> index 2bf06d71556a..bca3a678c955 100644
> --- a/drivers/gpu/drm/arc/arcpgu_sim.c
> +++ b/drivers/gpu/drm/arc/arcpgu_sim.c
> @@ -41,12 +41,6 @@ static int arcpgu_drm_connector_get_modes(struct 
> drm_connector *connector)
> return count;
>  }
>
> -static enum drm_connector_status
> -arcpgu_drm_connector_detect(struct drm_connector *connector, bool force)
> -{
> -   return connector_status_connected;
> -}
> -
>  static void arcpgu_drm_connector_destroy(struct drm_connector *connector)
>  {
> drm_connector_unregister(connector);
> @@ -61,7 +55,6 @@ arcpgu_drm_connector_helper_funcs = {
>  static const struct drm_connector_funcs arcpgu_drm_connector_funcs = {
> .dpms = drm_helper_connector_dpms,
> .reset = drm_atomic_helper_connector_reset,
> -   .detect = arcpgu_drm_connector_detect,
> .fill_modes = drm_helper_probe_single_connector_modes,
> .destroy = arcpgu_drm_connector_destroy,
> .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 5957c3e659fe..e26c98f51eb4 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -8

[PATCH] drm/sti: mark symbols static where possible

2016-09-28 Thread Vincent ABRIOU
Yes true, patch from Ville
https://lists.freedesktop.org/archives/dri-devel/2016-September/118631.html;
already fix patches sent by Baoyou.

Vincent

On 09/27/2016 09:07 PM, Benjamin Gaignard wrote:
> I think that create conflicts with what is already in Vincent pull
> request where we have fix the problem reported by coccicheck and
> sparse.
>
> https://lists.freedesktop.org/archives/dri-devel/2016-September/118892.html
>
> Benjamin
>
> 2016-09-27 18:35 GMT+02:00 Sean Paul :
>> On Sun, Sep 25, 2016 at 3:57 AM, Baoyou Xie  wrote:
>>> We get 6 warnings when building kernel with W=1:
>>> drivers/gpu/drm/sti/sti_mixer.c:361:6: warning: no previous prototype for 
>>> 'sti_mixer_set_matrix' [-Wmissing-prototypes]
>>> drivers/gpu/drm/sti/sti_dvo.c:109:5: warning: no previous prototype for 
>>> 'dvo_awg_generate_code' [-Wmissing-prototypes]
>>> drivers/gpu/drm/sti/sti_gdp.c:476:5: warning: no previous prototype for 
>>> 'sti_gdp_field_cb' [-Wmissing-prototypes]
>>> drivers/gpu/drm/sti/sti_hqvdp.c:786:5: warning: no previous prototype for 
>>> 'sti_hqvdp_vtg_cb' [-Wmissing-prototypes]
>>> drivers/gpu/drm/sti/sti_hqvdp.c:1292:5: warning: no previous prototype for 
>>> 'sti_hqvdp_bind' [-Wmissing-prototypes]
>>> drivers/gpu/drm/sti/sti_drv.c:143:6: warning: no previous prototype for 
>>> 'sti_drm_dbg_cleanup' [-Wmissing-prototypes]
>>>
>>> In fact, these functions are only used in the file in which they are
>>> declared and don't need a declaration, but can be made static.
>>> So this patch marks these functions with 'static'.
>>>
>>> Signed-off-by: Baoyou Xie 
>>
>> Applied to -misc, thanks.
>>
>> Sean
>>
>>> ---
>>>  drivers/gpu/drm/sti/sti_drv.c   | 2 +-
>>>  drivers/gpu/drm/sti/sti_dvo.c   | 3 ++-
>>>  drivers/gpu/drm/sti/sti_gdp.c   | 2 +-
>>>  drivers/gpu/drm/sti/sti_hqvdp.c | 5 +++--
>>>  drivers/gpu/drm/sti/sti_mixer.c | 2 +-
>>>  5 files changed, 8 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
>>> index 7cd3804..e6f0706 100644
>>> --- a/drivers/gpu/drm/sti/sti_drv.c
>>> +++ b/drivers/gpu/drm/sti/sti_drv.c
>>> @@ -140,7 +140,7 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
>>> return ret;
>>>  }
>>>
>>> -void sti_drm_dbg_cleanup(struct drm_minor *minor)
>>> +static void sti_drm_dbg_cleanup(struct drm_minor *minor)
>>>  {
>>> drm_debugfs_remove_files(sti_drm_dbg_list,
>>>  ARRAY_SIZE(sti_drm_dbg_list), minor);
>>> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
>>> index 00881eb..4545ad0 100644
>>> --- a/drivers/gpu/drm/sti/sti_dvo.c
>>> +++ b/drivers/gpu/drm/sti/sti_dvo.c
>>> @@ -106,7 +106,8 @@ struct sti_dvo_connector {
>>> container_of(x, struct sti_dvo_connector, drm_connector)
>>>
>>>  #define BLANKING_LEVEL 16
>>> -int dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code)
>>> +static int
>>> +dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code)
>>>  {
>>> struct drm_display_mode *mode = >mode;
>>> struct dvo_config *config = dvo->config;
>>> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
>>> index b8d942c..4648d1b 100644
>>> --- a/drivers/gpu/drm/sti/sti_gdp.c
>>> +++ b/drivers/gpu/drm/sti/sti_gdp.c
>>> @@ -473,7 +473,7 @@ static void sti_gdp_disable(struct sti_gdp *gdp)
>>>   * RETURNS:
>>>   * 0 on success.
>>>   */
>>> -int sti_gdp_field_cb(struct notifier_block *nb,
>>> +static int sti_gdp_field_cb(struct notifier_block *nb,
>>> unsigned long event, void *data)
>>>  {
>>> struct sti_gdp *gdp = container_of(nb, struct sti_gdp, 
>>> vtg_field_nb);
>>> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c 
>>> b/drivers/gpu/drm/sti/sti_hqvdp.c
>>> index b5ee783..7f0dea8 100644
>>> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
>>> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
>>> @@ -783,7 +783,8 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
>>>   * RETURNS:
>>>   * 0 on success.
>>>   */
>>> -int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void 
>>> *data)
>>> +static int
>>> +sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
>>>  {
>>> struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, 
>>> vtg_nb);
>>> int btm_cmd_offset, top_cmd_offest;
>>> @@ -1289,7 +1290,7 @@ static struct drm_plane *sti_hqvdp_create(struct 
>>> drm_device *drm_dev,
>>> return >plane.drm_plane;
>>>  }
>>>
>>> -int sti_hqvdp_bind(struct device *dev, struct device *master, void *data)
>>> +static int sti_hqvdp_bind(struct device *dev, struct device *master, void 
>>> *data)
>>>  {
>>> struct sti_hqvdp *hqvdp = dev_get_drvdata(dev);
>>> struct drm_device *drm_dev = data;
>>> diff --git a/drivers/gpu/drm/sti/sti_mixer.c 
>>> b/drivers/gpu/drm/sti/sti_mixer.c
>>> index 7d9aea8..b78cec5 100644
>>> --- a/drivers/gpu/drm/sti/sti_mixer.c
>>> +++ b/drivers/gpu/drm/sti/sti_mixer.c
>>> @@ -358,7 

[PULL] sti-drm-next-2016-09-20

2016-09-20 Thread Vincent ABRIOU
Hi Dave,

Here are some patches for drm-next.
It contains:
- minor fixes for typo and warning.
- sparse and coccicheck warning fixes
- bunch of patches fixing issues found while testing drm/sti with an 
atomic version of weston
- the removal of the support of stih415-416 sti platform

Regards,
Vincent

The following changes since commit d27cd40addc06d34236bf818abcbe76f3527a69d:

   drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() 
(2016-09-20 11:32:04 +0200)

are available in the git repository at:

   https://github.com/vinceab/linux.git sti-drm-next-2016-09-20

for you to fetch changes up to b4bba92dfbe23ccc4f1f6c93db88c39c10aa075a:

   drm/sti: remove stih415-416 platform support (2016-09-20 15:03:33 +0200)


Benjamin Gaignard (1):
   drm: sti: fix coccicheck warnings

Fabien Dessenne (8):
   drm/sti: fix debug logs
   drm/sti: run hqvdp init sequence only once
   drm/sti: run gdp init sequence only once
   drm/sti: fix atomic_disable check
   drm/sti: use different notifier_block for each pipe
   drm/sti: use vtg array instead of vtg_main/aux
   drm/sti: in crtc_atomic_flush, enable only planes of this crtc
   drm/sti: use valid video mode

Ville Syrjälä (1):
   drm/sti: Fix sparse warnings

Vincent Abriou (3):
   drm/sti: dpms function missing for HDMI connector
   drm/sti: fix compositor debugfs creation
   drm/sti: remove stih415-416 platform support

  drivers/gpu/drm/sti/Kconfig|   6 +-
  drivers/gpu/drm/sti/Makefile   |   1 -
  drivers/gpu/drm/sti/sti_compositor.c   |  51 ++---
  drivers/gpu/drm/sti/sti_compositor.h   |  14 +-
  drivers/gpu/drm/sti/sti_crtc.c |  26 +--
  drivers/gpu/drm/sti/sti_cursor.c   |   8 +-
  drivers/gpu/drm/sti/sti_drv.c  |   2 +-
  drivers/gpu/drm/sti/sti_dvo.c  |   3 +-
  drivers/gpu/drm/sti/sti_gdp.c  |  29 ++-
  drivers/gpu/drm/sti/sti_hda.c  |  39 +---
  drivers/gpu/drm/sti/sti_hdmi.c |  31 +--
  drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c | 336 
-
  drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h |  14 --
  drivers/gpu/drm/sti/sti_hqvdp.c|  25 +--
  drivers/gpu/drm/sti/sti_mixer.c|  19 --
  drivers/gpu/drm/sti/sti_tvout.c|  41 +---
  drivers/gpu/drm/sti/sti_vid.c  |   4 +-
  drivers/gpu/drm/sti/sti_vtac.c |   2 +
  drivers/gpu/drm/sti/sti_vtg.c  |   3 +-
  19 files changed, 96 insertions(+), 558 deletions(-)
  delete mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
  delete mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h


[PATCH v2] drm/sti: remove stih415-416 platform support

2016-09-20 Thread Vincent Abriou
stih415 and stih416 platform are obsolete and no more supported.
Only stih407 and stih410 platform are maintained.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/Kconfig|   6 +-
 drivers/gpu/drm/sti/Makefile   |   1 -
 drivers/gpu/drm/sti/sti_compositor.c   |  19 --
 drivers/gpu/drm/sti/sti_hda.c  |  39 +---
 drivers/gpu/drm/sti/sti_hdmi.c |  20 --
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c | 336 -
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h |  14 --
 drivers/gpu/drm/sti/sti_mixer.c|  19 --
 drivers/gpu/drm/sti/sti_tvout.c|  40 +---
 9 files changed, 14 insertions(+), 480 deletions(-)
 delete mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
 delete mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index 494ab25..acd7286 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,6 +1,6 @@
 config DRM_STI
-   tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
-   depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+   tristate "DRM Support for STMicroelectronics SoC stiH4xx Series"
+   depends on DRM && (ARCH_STI || ARCH_MULTIPLATFORM)
select RESET_CONTROLLER
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
@@ -9,4 +9,4 @@ config DRM_STI
select FW_LOADER
select SND_SOC_HDMI_CODEC if SND_SOC
help
- Choose this option to enable DRM on STM stiH41x chipset
+ Choose this option to enable DRM on STM stiH4xx chipset
diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index b805762..d20f7c0 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -9,7 +9,6 @@ sti-drm-y := \
sti_crtc.o \
sti_plane.o \
sti_hdmi.o \
-   sti_hdmi_tx3g0c55phy.o \
sti_hdmi_tx3g4c28phy.o \
sti_dvo.o \
sti_awg_utils.o \
diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index a6f391b..f62041f 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -39,22 +39,6 @@ static const struct sti_compositor_data 
stih407_compositor_data = {
},
 };

-/*
- * stiH416 compositor properties
- * Note:
- * on stih416 MIXER_AUX has a different base address from MIXER_MAIN
- * Moreover, GDPx is different for Main and Aux Mixer. So this subdev map does
- * not fit for stiH416 if we want to enable the MIXER_AUX.
- */
-static const struct sti_compositor_data stih416_compositor_data = {
-   .nb_subdev = 3,
-   .subdev_desc = {
-   {STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
-   {STI_GPD_SUBDEV, (int)STI_GDP_1, 0x200},
-   {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0xC00}
-   },
-};
-
 int sti_compositor_debugfs_init(struct sti_compositor *compo,
struct drm_minor *minor)
 {
@@ -179,9 +163,6 @@ static const struct component_ops sti_compositor_ops = {

 static const struct of_device_id compositor_of_match[] = {
{
-   .compatible = "st,stih416-compositor",
-   .data = _compositor_data,
-   }, {
.compatible = "st,stih407-compositor",
.data = _compositor_data,
}, {
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index a225c4d..e7c243f 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -62,14 +62,8 @@
 #define SCALE_CTRL_CR_DFLT  0x00DB0249

 /* Video DACs control */
-#define VIDEO_DACS_CONTROL_MASK 0x0FFF
-#define VIDEO_DACS_CONTROL_SYSCFG2535   0x085C /* for stih416 */
-#define DAC_CFG_HD_OFF_SHIFT5
-#define DAC_CFG_HD_OFF_MASK (0x7 << DAC_CFG_HD_OFF_SHIFT)
-#define VIDEO_DACS_CONTROL_SYSCFG5072   0x0120 /* for stih407 */
 #define DAC_CFG_HD_HZUVW_OFF_MASK   BIT(1)

-
 /* Upsampler values for the alternative 2X Filter */
 #define SAMPLER_COEF_NB 8
 #define HDA_ANA_SRC_Y_CFG_ALT_2X0x0113
@@ -300,28 +294,14 @@ static bool hda_get_mode_idx(struct drm_display_mode 
mode, int *idx)
  */
 static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
 {
-   u32 mask;
-
if (hda->video_dacs_ctrl) {
u32 val;

-   switch ((u32)hda->video_dacs_ctrl & VIDEO_DACS_CONTROL_MASK) {
-   case VIDEO_DACS_CONTROL_SYSCFG2535:
-   mask = DAC_CFG_HD_OFF_MASK;
-   break;
-   case VIDEO_DACS_CONTROL_SYSCFG5072:
-   mask = DAC_CFG_HD_HZUVW_OFF_MASK;
-   break;
-   default:
-   DRM_INFO("Video DACS control register not supported

[PATCH] drm/sti: remove stih415-416 platform support

2016-09-20 Thread Vincent Abriou
stih415 and stih416 platform are obsolete and no more supported.
Only stih407 and stih410 platform are maintained.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/Kconfig|   6 +-
 drivers/gpu/drm/sti/sti_compositor.c   |  19 --
 drivers/gpu/drm/sti/sti_hda.c  |  39 +---
 drivers/gpu/drm/sti/sti_hdmi.c |  20 --
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c | 336 -
 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h |  14 --
 drivers/gpu/drm/sti/sti_mixer.c|  19 --
 drivers/gpu/drm/sti/sti_tvout.c|  40 +---
 8 files changed, 14 insertions(+), 479 deletions(-)
 delete mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
 delete mode 100644 drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index 494ab25..acd7286 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,6 +1,6 @@
 config DRM_STI
-   tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
-   depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
+   tristate "DRM Support for STMicroelectronics SoC stiH4xx Series"
+   depends on DRM && (ARCH_STI || ARCH_MULTIPLATFORM)
select RESET_CONTROLLER
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
@@ -9,4 +9,4 @@ config DRM_STI
select FW_LOADER
select SND_SOC_HDMI_CODEC if SND_SOC
help
- Choose this option to enable DRM on STM stiH41x chipset
+ Choose this option to enable DRM on STM stiH4xx chipset
diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index a6f391b..f62041f 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -39,22 +39,6 @@ static const struct sti_compositor_data 
stih407_compositor_data = {
},
 };

-/*
- * stiH416 compositor properties
- * Note:
- * on stih416 MIXER_AUX has a different base address from MIXER_MAIN
- * Moreover, GDPx is different for Main and Aux Mixer. So this subdev map does
- * not fit for stiH416 if we want to enable the MIXER_AUX.
- */
-static const struct sti_compositor_data stih416_compositor_data = {
-   .nb_subdev = 3,
-   .subdev_desc = {
-   {STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
-   {STI_GPD_SUBDEV, (int)STI_GDP_1, 0x200},
-   {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0xC00}
-   },
-};
-
 int sti_compositor_debugfs_init(struct sti_compositor *compo,
struct drm_minor *minor)
 {
@@ -179,9 +163,6 @@ static const struct component_ops sti_compositor_ops = {

 static const struct of_device_id compositor_of_match[] = {
{
-   .compatible = "st,stih416-compositor",
-   .data = _compositor_data,
-   }, {
.compatible = "st,stih407-compositor",
.data = _compositor_data,
}, {
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index a225c4d..e7c243f 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -62,14 +62,8 @@
 #define SCALE_CTRL_CR_DFLT  0x00DB0249

 /* Video DACs control */
-#define VIDEO_DACS_CONTROL_MASK 0x0FFF
-#define VIDEO_DACS_CONTROL_SYSCFG2535   0x085C /* for stih416 */
-#define DAC_CFG_HD_OFF_SHIFT5
-#define DAC_CFG_HD_OFF_MASK (0x7 << DAC_CFG_HD_OFF_SHIFT)
-#define VIDEO_DACS_CONTROL_SYSCFG5072   0x0120 /* for stih407 */
 #define DAC_CFG_HD_HZUVW_OFF_MASK   BIT(1)

-
 /* Upsampler values for the alternative 2X Filter */
 #define SAMPLER_COEF_NB 8
 #define HDA_ANA_SRC_Y_CFG_ALT_2X0x0113
@@ -300,28 +294,14 @@ static bool hda_get_mode_idx(struct drm_display_mode 
mode, int *idx)
  */
 static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
 {
-   u32 mask;
-
if (hda->video_dacs_ctrl) {
u32 val;

-   switch ((u32)hda->video_dacs_ctrl & VIDEO_DACS_CONTROL_MASK) {
-   case VIDEO_DACS_CONTROL_SYSCFG2535:
-   mask = DAC_CFG_HD_OFF_MASK;
-   break;
-   case VIDEO_DACS_CONTROL_SYSCFG5072:
-   mask = DAC_CFG_HD_HZUVW_OFF_MASK;
-   break;
-   default:
-   DRM_INFO("Video DACS control register not supported\n");
-   return;
-   }
-
val = readl(hda->video_dacs_ctrl);
if (enable)
-   val &= ~mask;
+   val &= ~DAC_CFG_HD_HZUVW_OFF_MASK;
else
-   val |= mask;
+   val |= DAC_CFG_HD_HZUVW_OFF_MASK;

writel(val, hda->video_dacs_ctrl);
}
@@ -352

[PATCH 12/14] drm/sti: Fix sparse warnings

2016-09-19 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 

On 09/19/2016 03:33 PM, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä 
>
> drm/sti/sti_mixer.c:361:6: warning: symbol 'sti_mixer_set_matrix' was not 
> declared. Should it be static?
> drm/sti/sti_gdp.c:476:5: warning: symbol 'sti_gdp_field_cb' was not declared. 
> Should it be static?
> drm/sti/sti_gdp.c:885:24: warning: symbol 'sti_gdp_plane_helpers_funcs' was 
> not declared. Should it be static?
> drm/sti/sti_cursor.c:348:24: warning: symbol 'sti_cursor_plane_helpers_funcs' 
> was not declared. Should it be static?
> drm/sti/sti_compositor.c:28:28: warning: symbol 'stih407_compositor_data' was 
> not declared. Should it be static?
> drm/sti/sti_compositor.c:49:28: warning: symbol 'stih416_compositor_data' was 
> not declared. Should it be static?
> drm/sti/sti_vtg.c:75:1: warning: symbol 'vtg_lookup' was not declared. Should 
> it be static?
> drm/sti/sti_vtg.c:476:24: warning: symbol 'sti_vtg_driver' was not declared. 
> Should it be static?
> drm/sti/sti_dvo.c:109:5: warning: symbol 'dvo_awg_generate_code' was not 
> declared. Should it be static?
> drm/sti/sti_dvo.c:602:24: warning: symbol 'sti_dvo_driver' was not declared. 
> Should it be static?
> drm/sti/sti_vtac.c:209:24: warning: symbol 'sti_vtac_driver' was not 
> declared. Should it be static?
> drm/sti/sti_tvout.c:914:24: warning: symbol 'sti_tvout_driver' was not 
> declared. Should it be static?
> drm/sti/sti_hqvdp.c:786:5: warning: symbol 'sti_hqvdp_vtg_cb' was not 
> declared. Should it be static?
> drm/sti/sti_hqvdp.c:1253:24: warning: symbol 'sti_hqvdp_plane_helpers_funcs' 
> was not declared. Should it be static?
> drm/sti/sti_hqvdp.c:1292:5: warning: symbol 'sti_hqvdp_bind' was not 
> declared. Should it be static?
> drm/sti/sti_hqvdp.c:1385:24: warning: symbol 'sti_hqvdp_driver' was not 
> declared. Should it be static?
> drm/sti/sti_drv.c:143:6: warning: symbol 'sti_drm_dbg_cleanup' was not 
> declared. Should it be static?
>
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/sti/sti_compositor.c | 4 ++--
>  drivers/gpu/drm/sti/sti_cursor.c | 2 +-
>  drivers/gpu/drm/sti/sti_drv.c| 2 +-
>  drivers/gpu/drm/sti/sti_dvo.c| 3 ++-
>  drivers/gpu/drm/sti/sti_gdp.c| 6 +++---
>  drivers/gpu/drm/sti/sti_hqvdp.c  | 7 ---
>  drivers/gpu/drm/sti/sti_mixer.c  | 2 +-
>  drivers/gpu/drm/sti/sti_tvout.c  | 1 +
>  drivers/gpu/drm/sti/sti_vtac.c   | 2 ++
>  drivers/gpu/drm/sti/sti_vtg.c| 3 ++-
>  10 files changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
> b/drivers/gpu/drm/sti/sti_compositor.c
> index 134201ecc6fd..a8441ae2623a 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.c
> +++ b/drivers/gpu/drm/sti/sti_compositor.c
> @@ -25,7 +25,7 @@
>  /*
>   * stiH407 compositor properties
>   */
> -struct sti_compositor_data stih407_compositor_data = {
> +static const struct sti_compositor_data stih407_compositor_data = {
>   .nb_subdev = 8,
>   .subdev_desc = {
>   {STI_CURSOR_SUBDEV, (int)STI_CURSOR, 0x000},
> @@ -46,7 +46,7 @@ struct sti_compositor_data stih407_compositor_data = {
>   * Moreover, GDPx is different for Main and Aux Mixer. So this subdev map 
> does
>   * not fit for stiH416 if we want to enable the MIXER_AUX.
>   */
> -struct sti_compositor_data stih416_compositor_data = {
> +static const struct sti_compositor_data stih416_compositor_data = {
>   .nb_subdev = 3,
>   .subdev_desc = {
>   {STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
> diff --git a/drivers/gpu/drm/sti/sti_cursor.c 
> b/drivers/gpu/drm/sti/sti_cursor.c
> index 3b53f7f2e3fc..651f231c4615 100644
> --- a/drivers/gpu/drm/sti/sti_cursor.c
> +++ b/drivers/gpu/drm/sti/sti_cursor.c
> @@ -345,7 +345,7 @@ static int sti_cursor_late_register(struct drm_plane 
> *drm_plane)
>   return cursor_debugfs_init(cursor, drm_plane->dev->primary);
>  }
>
> -struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
> +static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
>   .update_plane = drm_atomic_helper_update_plane,
>   .disable_plane = drm_atomic_helper_disable_plane,
>   .destroy = sti_cursor_destroy,
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 7cd3804c6dee..e6f0706bc6c7 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -140,7 +140,7 @@ err:
>   return ret;
>  }
>
> -void sti_drm_dbg_cleanup(struct drm_minor *minor)
> +static void sti_drm_dbg_cleanup(struct drm_minor *minor)
>  {
>   drm_debugfs_remove_fil

[PATCH] drm/sti: forbid plane on several mixer

2016-09-16 Thread Vincent ABRIOU


On 09/15/2016 05:57 PM, Ville Syrjälä wrote:
> On Thu, Sep 15, 2016 at 04:59:55PM +0200, Vincent ABRIOU wrote:
>>
>>
>> On 09/15/2016 04:27 PM, Ville Syrjälä wrote:
>>> On Wed, Sep 14, 2016 at 01:40:02PM +0200, Vincent Abriou wrote:
>>>> When a plane is going to be enabled we re-evaluate the possible crtcs
>>>> for the associated drm plane. Only the crtc on which the plane should be
>>>> displayed is considered possible until the plane is disabled.
>>>> Indeed STI hardware does not allow to dynamically change
>>>> the plane's crtc/mixer assignment when the plane is in use (gdp is
>>>> running).
>>>>
>>>> Signed-off-by: Vincent Abriou 
>>>> ---
>>>>  drivers/gpu/drm/sti/sti_gdp.c   | 15 +++
>>>>  drivers/gpu/drm/sti/sti_plane.h |  2 ++
>>>>  2 files changed, 17 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
>>>> index 3fc62c1..f7cd671 100644
>>>> --- a/drivers/gpu/drm/sti/sti_gdp.c
>>>> +++ b/drivers/gpu/drm/sti/sti_gdp.c
>>>> @@ -71,6 +71,9 @@ static struct gdp_format_to_str {
>>>>  #define GDP_NODE_NB_BANK2
>>>>  #define GDP_NODE_PER_FIELD  2
>>>>
>>>> +#define MAIN_CRTC_MASK  BIT(0)
>>>> +#define AUX_CRTC_MASK   BIT(1)
>>>> +
>>>>  struct sti_gdp_node {
>>>>u32 gam_gdp_ctl;
>>>>u32 gam_gdp_agc;
>>>> @@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane 
>>>> *drm_plane,
>>>>}
>>>>}
>>>>
>>>> +  /* re-evaluate the possible crtcs */
>>>> +  if (mixer->id == STI_MIXER_MAIN)
>>>> +  drm_plane->possible_crtcs = MAIN_CRTC_MASK;
>>>> +  else
>>>> +  drm_plane->possible_crtcs = AUX_CRTC_MASK;
>>>
>>> This stuff isn't meant to be changed dynamically. There's no event for
>>> telling userspace to re-examine this sort of information.
>>
>> Yes sure. But by doing this, I let the userspace the ability to fix plan
>> assignment by it self by re-evaluating the possible CRTC. Before new
>> plane assignment.
>
> Only if it would re-fetch all planes/crtcs/etc. resources between every
> operation. Doing that would suck big time. And with atomic that's not
> even a theoretical option since everything would be configured with a
> single ioctl.
>

I test with weston-1.11.0 and the behavior changed.
It is now forbidden to set a plane on 2 differents CRTC.
I will not going further on this patch.

BR
Vincent

>> The kernel driver is then flexible enough to avoid Kernel crash.
>
> If the kernel crashes due to an an unsupported plane configuration,
> then the kernel has to be fixed.
>
>>
>> BR
>> Vincent
>>
>>>
>>>> +
>>>>DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
>>>>  crtc->base.id, sti_mixer_to_str(mixer),
>>>>  drm_plane->base.id, sti_plane_to_str(plane));
>>>> @@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane 
>>>> *drm_plane,
>>>>  {
>>>>struct sti_plane *plane = to_sti_plane(drm_plane);
>>>>
>>>> +  /* restore possible crtcs value with the initial value */
>>>> +  drm_plane->possible_crtcs = plane->init_possible_crtcs;
>>>> +
>>>>if (!drm_plane->crtc) {
>>>>DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>>>> drm_plane->base.id);
>>>> @@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device 
>>>> *drm_dev,
>>>>
>>>>sti_gdp_init(gdp);
>>>>
>>>> +  /* store the initial value of possible crtcs */
>>>> +  gdp->plane.init_possible_crtcs = possible_crtcs;
>>>> +
>>>>res = drm_universal_plane_init(drm_dev, >plane.drm_plane,
>>>>   possible_crtcs,
>>>>   _gdp_plane_helpers_funcs,
>>>> diff --git a/drivers/gpu/drm/sti/sti_plane.h 
>>>> b/drivers/gpu/drm/sti/sti_plane.h
>>>> index ce3e8d6..70c5312 100644
>>>> --- a/drivers/gpu/drm/sti/sti_plane.h
>>>> +++ b/drivers/gpu/drm/sti/sti_plane.h
>>>> @@ -66,12 +66,14 @@ struct sti_fps_info {
>>>>   * @plane:  drm plane it is bound to (if any)
>>>>   * @desc:   plane type & id
>>>>   * @status: to know the status of the plane
>>>> + * @init_possile_crtcs: store the initial possible crtc value
>>>>   * @fps_info:   frame per second info
>>>>   */
>>>>  struct sti_plane {
>>>>struct drm_plane drm_plane;
>>>>enum sti_plane_desc desc;
>>>>enum sti_plane_status status;
>>>> +  u32 init_possible_crtcs;
>>>>struct sti_fps_info fps_info;
>>>>  };
>>>>
>>>> --
>>>> 1.9.1
>>>>
>>>> ___
>>>> dri-devel mailing list
>>>> dri-devel at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
>


[PATCH 8/8] drm/sti: use valid video mode

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> In atomic mode the crtc_xxx (eg crtc_hdisplay) members of the mode
> structure may be unset before calling atomic_check/commit for planes.
> Instead of, use xxx members which are actually set.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_gdp.c   | 8 
>  drivers/gpu/drm/sti/sti_hqvdp.c | 8 
>  drivers/gpu/drm/sti/sti_vid.c   | 4 ++--
>  3 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 824020f..3297f3b 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -631,8 +631,8 @@ static int sti_gdp_atomic_check(struct drm_plane 
> *drm_plane,
>   mode = _state->mode;
>   dst_x = state->crtc_x;
>   dst_y = state->crtc_y;
> - dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> - dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> + dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> + dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>   /* src_x are in 16.16 format */
>   src_x = state->src_x >> 16;
>   src_y = state->src_y >> 16;
> @@ -736,8 +736,8 @@ static void sti_gdp_atomic_update(struct drm_plane 
> *drm_plane,
>   mode = >mode;
>   dst_x = state->crtc_x;
>   dst_y = state->crtc_y;
> - dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> - dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> + dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> + dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>   /* src_x are in 16.16 format */
>   src_x = state->src_x >> 16;
>   src_y = state->src_y >> 16;
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 9dd13fd..31fa7ae 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1026,8 +1026,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane 
> *drm_plane,
>   mode = _state->mode;
>   dst_x = state->crtc_x;
>   dst_y = state->crtc_y;
> - dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> - dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> + dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> + dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>   /* src_x are in 16.16 format */
>   src_x = state->src_x >> 16;
>   src_y = state->src_y >> 16;
> @@ -1115,8 +1115,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane 
> *drm_plane,
>   mode = >mode;
>   dst_x = state->crtc_x;
>   dst_y = state->crtc_y;
> - dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> - dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> + dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> + dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>   /* src_x are in 16.16 format */
>   src_x = state->src_x >> 16;
>   src_y = state->src_y >> 16;
> diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
> index 47634a0..2ad5989 100644
> --- a/drivers/gpu/drm/sti/sti_vid.c
> +++ b/drivers/gpu/drm/sti/sti_vid.c
> @@ -142,8 +142,8 @@ void sti_vid_commit(struct sti_vid *vid,
>   struct drm_display_mode *mode = >mode;
>   int dst_x = state->crtc_x;
>   int dst_y = state->crtc_y;
> - int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> - int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> + int dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> + int dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>   int src_h = state->src_h >> 16;
>   u32 val, ydo, xdo, yds, xds;
>
>


[PATCH 7/8] drm/sti: in crtc_atomic_flush, enable only planes of this crtc

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> crtc_atomic_flush performs some additional processing, like plane
> enable at mixer level.
> Enable only the planes attached to the CRTC.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index 96afe68..bc1b186 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -165,6 +165,10 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
>
>   switch (plane->status) {
>   case STI_PLANE_UPDATED:
> + /* ignore update for other CRTC */
> + if (p->state->crtc != crtc)
> + continue;
> +
>   /* update planes tag as updated */
>   DRM_DEBUG_DRIVER("update plane %s\n",
>sti_plane_to_str(plane));
>


[PATCH 6/8] drm/sti: use vtg array instead of vtg_main/aux

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> This is more generic and more consistent with the other members of the
> sti_compositor struct.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_compositor.c |  4 ++--
>  drivers/gpu/drm/sti/sti_compositor.h |  6 ++
>  drivers/gpu/drm/sti/sti_crtc.c   | 12 +---
>  drivers/gpu/drm/sti/sti_gdp.c|  3 +--
>  4 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
> b/drivers/gpu/drm/sti/sti_compositor.c
> index f61c16d..f0c6f0a 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.c
> +++ b/drivers/gpu/drm/sti/sti_compositor.c
> @@ -268,12 +268,12 @@ static int sti_compositor_probe(struct platform_device 
> *pdev)
>
>   vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
>   if (vtg_np)
> - compo->vtg_main = of_vtg_find(vtg_np);
> + compo->vtg[STI_MIXER_MAIN] = of_vtg_find(vtg_np);
>   of_node_put(vtg_np);
>
>   vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 1);
>   if (vtg_np)
> - compo->vtg_aux = of_vtg_find(vtg_np);
> + compo->vtg[STI_MIXER_AUX] = of_vtg_find(vtg_np);
>   of_node_put(vtg_np);
>
>   platform_set_drvdata(pdev, compo);
> diff --git a/drivers/gpu/drm/sti/sti_compositor.h 
> b/drivers/gpu/drm/sti/sti_compositor.h
> index 177c57b..c9e7e3b 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.h
> +++ b/drivers/gpu/drm/sti/sti_compositor.h
> @@ -60,8 +60,7 @@ struct sti_compositor_data {
>   * @rst_aux: reset control of the aux path
>   * @mixer: array of mixers
>   * @vid: array of vids
> - * @vtg_main: vtg for main data path
> - * @vtg_aux: vtg for auxillary data path
> + * @vtg: array of vtgs
>   * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
>   */
>  struct sti_compositor {
> @@ -76,8 +75,7 @@ struct sti_compositor {
>   struct reset_control *rst_aux;
>   struct sti_mixer *mixer[STI_MAX_MIXER];
>   struct sti_vid *vid[STI_MAX_VID];
> - struct sti_vtg *vtg_main;
> - struct sti_vtg *vtg_aux;
> + struct sti_vtg *vtg[STI_MAX_MIXER];
>   struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
>  };
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index 2f41cbe..96afe68 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -86,8 +86,7 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct 
> drm_display_mode *mode)
>   goto pix_error;
>   }
>
> - sti_vtg_set_config(mixer->id == STI_MIXER_MAIN ?
> - compo->vtg_main : compo->vtg_aux, >mode);
> + sti_vtg_set_config(compo->vtg[mixer->id], >mode);
>
>   if (sti_mixer_active_video_area(mixer, >mode)) {
>   DRM_ERROR("Can't set active video area\n");
> @@ -297,12 +296,11 @@ int sti_crtc_enable_vblank(struct drm_device *dev, 
> unsigned int pipe)
>   struct sti_compositor *compo = dev_priv->compo;
>   struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
>   struct drm_crtc *crtc = >mixer[pipe]->drm_crtc;
> + struct sti_vtg *vtg = compo->vtg[pipe];
>
>   DRM_DEBUG_DRIVER("\n");
>
> - if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ?
> - compo->vtg_main : compo->vtg_aux,
> - vtg_vblank_nb, crtc)) {
> + if (sti_vtg_register_client(vtg, vtg_vblank_nb, crtc)) {
>   DRM_ERROR("Cannot register VTG notifier\n");
>   return -EINVAL;
>   }
> @@ -316,11 +314,11 @@ void sti_crtc_disable_vblank(struct drm_device 
> *drm_dev, unsigned int pipe)
>   struct sti_compositor *compo = priv->compo;
>   struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
>   struct drm_crtc *crtc = >mixer[pipe]->drm_crtc;
> + struct sti_vtg *vtg = compo->vtg[pipe];
>
>   DRM_DEBUG_DRIVER("\n");
>
> - if (sti_vtg_unregister_client(pipe == STI_MIXER_MAIN ?
> - compo->vtg_main : compo->vtg_aux, vtg_vblank_nb))
> + if (sti_vtg_unregister_client(vtg, vtg_vblank_nb))
>   DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
>
>   /* free the resources of the pending requests */
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index d5f7b18..824020f 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -653,8 +653,7 @@ static int sti_gdp_atomic_check(struct drm_plane 
> *drm_plane,
>
>   if (!gdp->vtg) {
>   /* Register gdp callback */
> - gdp->vtg = mixer->id == STI_MIXER_MAIN ?
> - compo->vtg_main : compo->vtg_aux;
> + gdp->vtg = compo->vtg[mixer->id];
>   if (sti_vtg_register_client(gdp->vtg,
>   >vtg_field_nb, crtc)) {
>   DRM_ERROR("Cannot register VTG notifier\n");
>


[PATCH 5/8] drm/sti: use different notifier_block for each pipe

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> Each pipe shall have its own notifier block to manage the vblank event.
> This fixes issues where a client registered on given pipe is later
> abusively notified of events on the other pipe.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_compositor.c | 4 +++-
>  drivers/gpu/drm/sti/sti_compositor.h | 4 ++--
>  drivers/gpu/drm/sti/sti_crtc.c   | 8 
>  3 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
> b/drivers/gpu/drm/sti/sti_compositor.c
> index 134201e..f61c16d 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.c
> +++ b/drivers/gpu/drm/sti/sti_compositor.c
> @@ -201,6 +201,7 @@ static int sti_compositor_probe(struct platform_device 
> *pdev)
>   struct device_node *vtg_np;
>   struct sti_compositor *compo;
>   struct resource *res;
> + unsigned int i;
>
>   compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
>   if (!compo) {
> @@ -208,7 +209,8 @@ static int sti_compositor_probe(struct platform_device 
> *pdev)
>   return -ENOMEM;
>   }
>   compo->dev = dev;
> - compo->vtg_vblank_nb.notifier_call = sti_crtc_vblank_cb;
> + for (i = 0; i < STI_MAX_MIXER; i++)
> + compo->vtg_vblank_nb[i].notifier_call = sti_crtc_vblank_cb;
>
>   /* populate data structure depending on compatibility */
>   BUG_ON(!of_match_node(compositor_of_match, np)->data);
> diff --git a/drivers/gpu/drm/sti/sti_compositor.h 
> b/drivers/gpu/drm/sti/sti_compositor.h
> index 2ef..177c57b 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.h
> +++ b/drivers/gpu/drm/sti/sti_compositor.h
> @@ -62,7 +62,7 @@ struct sti_compositor_data {
>   * @vid: array of vids
>   * @vtg_main: vtg for main data path
>   * @vtg_aux: vtg for auxillary data path
> - * @vtg_vblank_nb: callback for VTG VSYNC notification
> + * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
>   */
>  struct sti_compositor {
>   struct device *dev;
> @@ -78,7 +78,7 @@ struct sti_compositor {
>   struct sti_vid *vid[STI_MAX_VID];
>   struct sti_vtg *vtg_main;
>   struct sti_vtg *vtg_aux;
> - struct notifier_block vtg_vblank_nb;
> + struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
>  };
>
>  int sti_compositor_debufs_init(struct sti_compositor *compo,
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index c7d734d..2f41cbe 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -244,8 +244,7 @@ static int sti_crtc_set_property(struct drm_crtc *crtc,
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>  unsigned long event, void *data)
>  {
> - struct sti_compositor *compo =
> - container_of(nb, struct sti_compositor, vtg_vblank_nb);
> + struct sti_compositor *compo;
>   struct drm_crtc *crtc = data;
>   struct sti_mixer *mixer;
>   unsigned long flags;
> @@ -254,6 +253,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
>
>   priv = crtc->dev->dev_private;
>   pipe = drm_crtc_index(crtc);
> + compo = container_of(nb, struct sti_compositor, vtg_vblank_nb[pipe]);
>   mixer = compo->mixer[pipe];
>
>   if ((event != VTG_TOP_FIELD_EVENT) &&
> @@ -295,7 +295,7 @@ int sti_crtc_enable_vblank(struct drm_device *dev, 
> unsigned int pipe)
>  {
>   struct sti_private *dev_priv = dev->dev_private;
>   struct sti_compositor *compo = dev_priv->compo;
> - struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb;
> + struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
>   struct drm_crtc *crtc = >mixer[pipe]->drm_crtc;
>
>   DRM_DEBUG_DRIVER("\n");
> @@ -314,7 +314,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, 
> unsigned int pipe)
>  {
>   struct sti_private *priv = drm_dev->dev_private;
>   struct sti_compositor *compo = priv->compo;
> - struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb;
> + struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
>   struct drm_crtc *crtc = >mixer[pipe]->drm_crtc;
>
>   DRM_DEBUG_DRIVER("\n");
>


[PATCH 4/8] drm/sti: fix atomic_disable check

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> When a drm_plane is being disabled, its ->crtc member is set to NULL
> before the .atomic_disable() func is called.
> To get the crtc of the plane, read old_state->crtc instead of
> drm_plane->crtc
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_cursor.c | 6 +++---
>  drivers/gpu/drm/sti/sti_gdp.c| 6 +++---
>  drivers/gpu/drm/sti/sti_hqvdp.c  | 6 +++---
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_cursor.c 
> b/drivers/gpu/drm/sti/sti_cursor.c
> index 3b53f7f..3a8b656 100644
> --- a/drivers/gpu/drm/sti/sti_cursor.c
> +++ b/drivers/gpu/drm/sti/sti_cursor.c
> @@ -309,15 +309,15 @@ static void sti_cursor_atomic_disable(struct drm_plane 
> *drm_plane,
>  {
>   struct sti_plane *plane = to_sti_plane(drm_plane);
>
> - if (!drm_plane->crtc) {
> + if (!oldstate->crtc) {
>   DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>drm_plane->base.id);
>   return;
>   }
>
>   DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
> -  drm_plane->crtc->base.id,
> -  sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
> +  oldstate->crtc->base.id,
> +  sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
>drm_plane->base.id, sti_plane_to_str(plane));
>
>   plane->status = STI_PLANE_DISABLING;
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 19052c4..d5f7b18 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -858,15 +858,15 @@ static void sti_gdp_atomic_disable(struct drm_plane 
> *drm_plane,
>   /* restore possible crtcs value with the initial value */
>   drm_plane->possible_crtcs = plane->init_possible_crtcs;
>
> - if (!drm_plane->crtc) {
> + if (!oldstate->crtc) {
>   DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>drm_plane->base.id);
>   return;
>   }
>
>   DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
> -  drm_plane->crtc->base.id,
> -  sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
> +  oldstate->crtc->base.id,
> +  sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
>drm_plane->base.id, sti_plane_to_str(plane));
>
>   plane->status = STI_PLANE_DISABLING;
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index a222b2e..9dd13fd 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1214,15 +1214,15 @@ static void sti_hqvdp_atomic_disable(struct drm_plane 
> *drm_plane,
>  {
>   struct sti_plane *plane = to_sti_plane(drm_plane);
>
> - if (!drm_plane->crtc) {
> + if (!oldstate->crtc) {
>   DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>drm_plane->base.id);
>   return;
>   }
>
>   DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
> -  drm_plane->crtc->base.id,
> -  sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
> +  oldstate->crtc->base.id,
> +  sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
>drm_plane->base.id, sti_plane_to_str(plane));
>
>   plane->status = STI_PLANE_DISABLING;
>


[PATCH 3/8] drm/sti: run gdp init sequence only once

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> Do not rely on plane->status to define whether this is the first update
> but rather check for gdp->vtg.
> This avoids multiple and unwanted calls to sti_vtg_register_client()
> which breaks the kernel scheduler.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_gdp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 3d48e5e..19052c4 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -463,6 +463,7 @@ static void sti_gdp_disable(struct sti_gdp *gdp)
>   clk_disable_unprepare(gdp->clk_pix);
>
>   gdp->plane.status = STI_PLANE_DISABLED;
> + gdp->vtg = NULL;
>  }
>
>  /**
> @@ -614,7 +615,6 @@ static int sti_gdp_atomic_check(struct drm_plane 
> *drm_plane,
>   struct drm_crtc *crtc = state->crtc;
>   struct sti_compositor *compo = dev_get_drvdata(gdp->dev);
>   struct drm_framebuffer *fb =  state->fb;
> - bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
>   struct drm_crtc_state *crtc_state;
>   struct sti_mixer *mixer;
>   struct drm_display_mode *mode;
> @@ -651,7 +651,7 @@ static int sti_gdp_atomic_check(struct drm_plane 
> *drm_plane,
>   return -EINVAL;
>   }
>
> - if (first_prepare) {
> + if (!gdp->vtg) {
>   /* Register gdp callback */
>   gdp->vtg = mixer->id == STI_MIXER_MAIN ?
>   compo->vtg_main : compo->vtg_aux;
>


[PATCH 2/8] drm/sti: run hqvdp init sequence only once

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> Do not rely on plane->status to define whether this is the first update
> but rather check for hqvdp->xp70_initialized bit status.
> This avoids multiple and unwanted calls to sti_vtg_register_client()
> which breaks the kernel scheduler.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index b5ee783..a222b2e 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -770,6 +770,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
>   DRM_ERROR("XP70 could not revert to idle\n");
>
>   hqvdp->plane.status = STI_PLANE_DISABLED;
> + hqvdp->xp70_initialized = false;
>  }
>
>  /**
> @@ -1012,7 +1013,6 @@ static int sti_hqvdp_atomic_check(struct drm_plane 
> *drm_plane,
>   struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
>   struct drm_crtc *crtc = state->crtc;
>   struct drm_framebuffer *fb = state->fb;
> - bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
>   struct drm_crtc_state *crtc_state;
>   struct drm_display_mode *mode;
>   int dst_x, dst_y, dst_w, dst_h;
> @@ -1063,7 +1063,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane 
> *drm_plane,
>   return -EINVAL;
>   }
>
> - if (first_prepare) {
> + if (!hqvdp->xp70_initialized) {
>   /* Start HQVDP XP70 coprocessor */
>   sti_hqvdp_start_xp70(hqvdp);
>
>


[PATCH 1/8] drm/sti: fix debug logs

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 

On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> Add some missing \n in logs.
>
> Signed-off-by: Fabien Dessenne 
> ---
>  drivers/gpu/drm/sti/sti_gdp.c  | 2 +-
>  drivers/gpu/drm/sti/sti_hda.c  | 4 ++--
>  drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index f7cd671..3d48e5e 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -819,7 +819,7 @@ static void sti_gdp_atomic_update(struct drm_plane 
> *drm_plane,
>   if (!curr_list) {
>   /* First update or invalid node should directly write in the
>* hw register */
> - DRM_DEBUG_DRIVER("%s first update (or invalid node)",
> + DRM_DEBUG_DRIVER("%s first update (or invalid node)\n",
>sti_plane_to_str(plane));
>
>   writel(gdp->is_curr_top ?
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index 8505569..a225c4d 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -313,7 +313,7 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool 
> enable)
>   mask = DAC_CFG_HD_HZUVW_OFF_MASK;
>   break;
>   default:
> - DRM_INFO("Video DACS control register not supported!");
> + DRM_INFO("Video DACS control register not supported\n");
>   return;
>   }
>
> @@ -362,7 +362,7 @@ static void hda_dbg_video_dacs_ctrl(struct seq_file *s, 
> void __iomem *reg)
>   mask = DAC_CFG_HD_HZUVW_OFF_MASK;
>   break;
>   default:
> - DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported!");
> + DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported\n");
>   return;
>   }
>
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index d850dda..1f9e7b4 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -203,7 +203,7 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg)
>
>   /* Audio FIFO underrun IRQ */
>   if (hdmi->irq_status & HDMI_INT_AUDIO_FIFO_XRUN)
> - DRM_INFO("Warning: audio FIFO underrun occurs!");
> + DRM_INFO("Warning: audio FIFO underrun occurs!\n");
>
>   return IRQ_HANDLED;
>  }
>


[PATCH] drm/sti: mark symbols static where possible

2016-09-15 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 

On 09/15/2016 01:39 PM, Baoyou Xie wrote:
> We get 4 warnings when building kernel with W=1:
> drivers/gpu/drm/sti/sti_gdp.c:476:5: warning: no previous prototype for 
> 'sti_gdp_field_cb' [-Wmissing-prototypes]
> drivers/gpu/drm/sti/sti_hqvdp.c:786:5: warning: no previous prototype for 
> 'sti_hqvdp_vtg_cb' [-Wmissing-prototypes]
> drivers/gpu/drm/sti/sti_hqvdp.c:1292:5: warning: no previous prototype for 
> 'sti_hqvdp_bind' [-Wmissing-prototypes]
> drivers/gpu/drm/sti/sti_drv.c:143:6: warning: no previous prototype for 
> 'sti_drm_dbg_cleanup' [-Wmissing-prototypes]
>
> In fact, these functions are only used in the file in which they are
> declared and don't need a declaration, but can be made static.
> So this patch marks these functions with 'static'.
>
> Signed-off-by: Baoyou Xie 
> ---
>  drivers/gpu/drm/sti/sti_drv.c   | 2 +-
>  drivers/gpu/drm/sti/sti_gdp.c   | 2 +-
>  drivers/gpu/drm/sti/sti_hqvdp.c | 5 +++--
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 7cd3804..e6f0706 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -140,7 +140,7 @@ err:
>   return ret;
>  }
>
> -void sti_drm_dbg_cleanup(struct drm_minor *minor)
> +static void sti_drm_dbg_cleanup(struct drm_minor *minor)
>  {
>   drm_debugfs_remove_files(sti_drm_dbg_list,
>ARRAY_SIZE(sti_drm_dbg_list), minor);
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index b8d942c..4648d1b 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -473,7 +473,7 @@ static void sti_gdp_disable(struct sti_gdp *gdp)
>   * RETURNS:
>   * 0 on success.
>   */
> -int sti_gdp_field_cb(struct notifier_block *nb,
> +static int sti_gdp_field_cb(struct notifier_block *nb,
>   unsigned long event, void *data)
>  {
>   struct sti_gdp *gdp = container_of(nb, struct sti_gdp, vtg_field_nb);
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index b5ee783..7f0dea8 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -783,7 +783,8 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
>   * RETURNS:
>   * 0 on success.
>   */
> -int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void 
> *data)
> +static int
> +sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
>  {
>   struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, vtg_nb);
>   int btm_cmd_offset, top_cmd_offest;
> @@ -1289,7 +1290,7 @@ static struct drm_plane *sti_hqvdp_create(struct 
> drm_device *drm_dev,
>   return >plane.drm_plane;
>  }
>
> -int sti_hqvdp_bind(struct device *dev, struct device *master, void *data)
> +static int sti_hqvdp_bind(struct device *dev, struct device *master, void 
> *data)
>  {
>   struct sti_hqvdp *hqvdp = dev_get_drvdata(dev);
>   struct drm_device *drm_dev = data;
>


[PATCH v2] drm/sti: fix compositor debugfs creation

2016-09-15 Thread Vincent Abriou
Fix typo and issue while creating the vid and mixer debugfs entries.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_compositor.c | 22 +-
 drivers/gpu/drm/sti/sti_compositor.h |  4 ++--
 drivers/gpu/drm/sti/sti_crtc.c   |  2 +-
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index f0c6f0a..89471b3 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -55,22 +55,18 @@ struct sti_compositor_data stih416_compositor_data = {
},
 };

-int sti_compositor_debufs_init(struct sti_compositor *compo,
-  struct drm_minor *minor)
+int sti_compositor_debugfs_init(struct sti_compositor *compo,
+   struct drm_minor *minor)
 {
-   int ret = 0, i;
+   unsigned int i;

-   for (i = 0; compo->vid[i]; i++) {
-   ret = vid_debugfs_init(compo->vid[i], minor);
-   if (ret)
-   return ret;
-   }
+   for (i = 0; i < STI_MAX_VID; i++)
+   if (compo->vid[i])
+   vid_debugfs_init(compo->vid[i], minor);

-   for (i = 0; compo->mixer[i]; i++) {
-   ret = sti_mixer_debugfs_init(compo->mixer[i], minor);
-   if (ret)
-   return ret;
-   }
+   for (i = 0; i < STI_MAX_MIXER; i++)
+   if (compo->mixer[i])
+   sti_mixer_debugfs_init(compo->mixer[i], minor);

return 0;
 }
diff --git a/drivers/gpu/drm/sti/sti_compositor.h 
b/drivers/gpu/drm/sti/sti_compositor.h
index c9e7e3b..2952a2d 100644
--- a/drivers/gpu/drm/sti/sti_compositor.h
+++ b/drivers/gpu/drm/sti/sti_compositor.h
@@ -79,7 +79,7 @@ struct sti_compositor {
struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
 };

-int sti_compositor_debufs_init(struct sti_compositor *compo,
-  struct drm_minor *minor);
+int sti_compositor_debugfs_init(struct sti_compositor *compo,
+   struct drm_minor *minor);

 #endif
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index bc1b186..e992bed 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -338,7 +338,7 @@ static int sti_crtc_late_register(struct drm_crtc *crtc)
struct sti_compositor *compo = dev_get_drvdata(mixer->dev);

if (drm_crtc_index(crtc) == 0)
-   return sti_compositor_debufs_init(compo, crtc->dev->primary);
+   return sti_compositor_debugfs_init(compo, crtc->dev->primary);

return 0;
 }
-- 
1.9.1



[PATCH] drm/sti: forbid plane on several mixer

2016-09-15 Thread Vincent ABRIOU


On 09/15/2016 04:27 PM, Ville Syrjälä wrote:
> On Wed, Sep 14, 2016 at 01:40:02PM +0200, Vincent Abriou wrote:
>> When a plane is going to be enabled we re-evaluate the possible crtcs
>> for the associated drm plane. Only the crtc on which the plane should be
>> displayed is considered possible until the plane is disabled.
>> Indeed STI hardware does not allow to dynamically change
>> the plane's crtc/mixer assignment when the plane is in use (gdp is
>> running).
>>
>> Signed-off-by: Vincent Abriou 
>> ---
>>  drivers/gpu/drm/sti/sti_gdp.c   | 15 +++
>>  drivers/gpu/drm/sti/sti_plane.h |  2 ++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
>> index 3fc62c1..f7cd671 100644
>> --- a/drivers/gpu/drm/sti/sti_gdp.c
>> +++ b/drivers/gpu/drm/sti/sti_gdp.c
>> @@ -71,6 +71,9 @@ static struct gdp_format_to_str {
>>  #define GDP_NODE_NB_BANK2
>>  #define GDP_NODE_PER_FIELD  2
>>
>> +#define MAIN_CRTC_MASK  BIT(0)
>> +#define AUX_CRTC_MASK   BIT(1)
>> +
>>  struct sti_gdp_node {
>>  u32 gam_gdp_ctl;
>>  u32 gam_gdp_agc;
>> @@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane 
>> *drm_plane,
>>  }
>>  }
>>
>> +/* re-evaluate the possible crtcs */
>> +if (mixer->id == STI_MIXER_MAIN)
>> +drm_plane->possible_crtcs = MAIN_CRTC_MASK;
>> +else
>> +drm_plane->possible_crtcs = AUX_CRTC_MASK;
>
> This stuff isn't meant to be changed dynamically. There's no event for
> telling userspace to re-examine this sort of information.

Yes sure. But by doing this, I let the userspace the ability to fix plan 
assignment by it self by re-evaluating the possible CRTC. Before new 
plane assignment.
The kernel driver is then flexible enough to avoid Kernel crash.

BR
Vincent

>
>> +
>>  DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
>>crtc->base.id, sti_mixer_to_str(mixer),
>>drm_plane->base.id, sti_plane_to_str(plane));
>> @@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane 
>> *drm_plane,
>>  {
>>  struct sti_plane *plane = to_sti_plane(drm_plane);
>>
>> +/* restore possible crtcs value with the initial value */
>> +drm_plane->possible_crtcs = plane->init_possible_crtcs;
>> +
>>  if (!drm_plane->crtc) {
>>  DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>>   drm_plane->base.id);
>> @@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device 
>> *drm_dev,
>>
>>  sti_gdp_init(gdp);
>>
>> +/* store the initial value of possible crtcs */
>> +gdp->plane.init_possible_crtcs = possible_crtcs;
>> +
>>  res = drm_universal_plane_init(drm_dev, >plane.drm_plane,
>> possible_crtcs,
>> _gdp_plane_helpers_funcs,
>> diff --git a/drivers/gpu/drm/sti/sti_plane.h 
>> b/drivers/gpu/drm/sti/sti_plane.h
>> index ce3e8d6..70c5312 100644
>> --- a/drivers/gpu/drm/sti/sti_plane.h
>> +++ b/drivers/gpu/drm/sti/sti_plane.h
>> @@ -66,12 +66,14 @@ struct sti_fps_info {
>>   * @plane:  drm plane it is bound to (if any)
>>   * @desc:   plane type & id
>>   * @status: to know the status of the plane
>> + * @init_possile_crtcs: store the initial possible crtc value
>>   * @fps_info:   frame per second info
>>   */
>>  struct sti_plane {
>>  struct drm_plane drm_plane;
>>  enum sti_plane_desc desc;
>>  enum sti_plane_status status;
>> +u32 init_possible_crtcs;
>>  struct sti_fps_info fps_info;
>>  };
>>
>> --
>> 1.9.1
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>


[PATCH] drm/sti: fix compositor debugfs creation

2016-09-15 Thread Vincent Abriou
Fix typo and issue while creating the vid and mixer debugfs entries.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_compositor.c | 8 ++--
 drivers/gpu/drm/sti/sti_compositor.h | 4 ++--
 drivers/gpu/drm/sti/sti_crtc.c   | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index f0c6f0a..b077f88 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -55,8 +55,8 @@ struct sti_compositor_data stih416_compositor_data = {
},
 };

-int sti_compositor_debufs_init(struct sti_compositor *compo,
-  struct drm_minor *minor)
+int sti_compositor_debugfs_init(struct sti_compositor *compo,
+   struct drm_minor *minor)
 {
int ret = 0, i;

@@ -64,12 +64,16 @@ int sti_compositor_debufs_init(struct sti_compositor *compo,
ret = vid_debugfs_init(compo->vid[i], minor);
if (ret)
return ret;
+   if (i == (STI_MAX_VID - 1))
+   break;
}

for (i = 0; compo->mixer[i]; i++) {
ret = sti_mixer_debugfs_init(compo->mixer[i], minor);
if (ret)
return ret;
+   if (i == (STI_MAX_MIXER - 1))
+   break;
}

return 0;
diff --git a/drivers/gpu/drm/sti/sti_compositor.h 
b/drivers/gpu/drm/sti/sti_compositor.h
index c9e7e3b..2952a2d 100644
--- a/drivers/gpu/drm/sti/sti_compositor.h
+++ b/drivers/gpu/drm/sti/sti_compositor.h
@@ -79,7 +79,7 @@ struct sti_compositor {
struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
 };

-int sti_compositor_debufs_init(struct sti_compositor *compo,
-  struct drm_minor *minor);
+int sti_compositor_debugfs_init(struct sti_compositor *compo,
+   struct drm_minor *minor);

 #endif
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index bc1b186..e992bed 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -338,7 +338,7 @@ static int sti_crtc_late_register(struct drm_crtc *crtc)
struct sti_compositor *compo = dev_get_drvdata(mixer->dev);

if (drm_crtc_index(crtc) == 0)
-   return sti_compositor_debufs_init(compo, crtc->dev->primary);
+   return sti_compositor_debugfs_init(compo, crtc->dev->primary);

return 0;
 }
-- 
1.9.1



[PATCH] drm/sti: forbid plane on several mixer

2016-09-14 Thread Vincent Abriou
When a plane is going to be enabled we re-evaluate the possible crtcs
for the associated drm plane. Only the crtc on which the plane should be
displayed is considered possible until the plane is disabled.
Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is
running).

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_gdp.c   | 15 +++
 drivers/gpu/drm/sti/sti_plane.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 3fc62c1..f7cd671 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -71,6 +71,9 @@ static struct gdp_format_to_str {
 #define GDP_NODE_NB_BANK2
 #define GDP_NODE_PER_FIELD  2

+#define MAIN_CRTC_MASK  BIT(0)
+#define AUX_CRTC_MASK   BIT(1)
+
 struct sti_gdp_node {
u32 gam_gdp_ctl;
u32 gam_gdp_agc;
@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane 
*drm_plane,
}
}

+   /* re-evaluate the possible crtcs */
+   if (mixer->id == STI_MIXER_MAIN)
+   drm_plane->possible_crtcs = MAIN_CRTC_MASK;
+   else
+   drm_plane->possible_crtcs = AUX_CRTC_MASK;
+
DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
  crtc->base.id, sti_mixer_to_str(mixer),
  drm_plane->base.id, sti_plane_to_str(plane));
@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane 
*drm_plane,
 {
struct sti_plane *plane = to_sti_plane(drm_plane);

+   /* restore possible crtcs value with the initial value */
+   drm_plane->possible_crtcs = plane->init_possible_crtcs;
+
if (!drm_plane->crtc) {
DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 drm_plane->base.id);
@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,

sti_gdp_init(gdp);

+   /* store the initial value of possible crtcs */
+   gdp->plane.init_possible_crtcs = possible_crtcs;
+
res = drm_universal_plane_init(drm_dev, >plane.drm_plane,
   possible_crtcs,
   _gdp_plane_helpers_funcs,
diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h
index ce3e8d6..70c5312 100644
--- a/drivers/gpu/drm/sti/sti_plane.h
+++ b/drivers/gpu/drm/sti/sti_plane.h
@@ -66,12 +66,14 @@ struct sti_fps_info {
  * @plane:  drm plane it is bound to (if any)
  * @desc:   plane type & id
  * @status: to know the status of the plane
+ * @init_possile_crtcs: store the initial possible crtc value
  * @fps_info:   frame per second info
  */
 struct sti_plane {
struct drm_plane drm_plane;
enum sti_plane_desc desc;
enum sti_plane_status status;
+   u32 init_possible_crtcs;
struct sti_fps_info fps_info;
 };

-- 
1.9.1



[PATCH] drm/sti: dpms function missing for HDMI connector

2016-09-14 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index c6aa291..d850dda 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1054,6 +1054,7 @@ static int sti_hdmi_late_register(struct drm_connector 
*connector)
 }

 static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_hdmi_connector_detect,
.destroy = drm_connector_cleanup,
-- 
1.9.1



[PATCH v4 05/14] drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

2016-09-09 Thread Vincent ABRIOU
Hi Laurent,

I plan to take this patch in my pull request that will be done next week.

BR
Vincent

On 09/08/2016 04:44 PM, Laurent Pinchart wrote:
> The driver needs the number of bytes per pixel, not the bpp and depth
> info meant for fbdev compatibility. Use the right API.
>
> Signed-off-by: Laurent Pinchart 
> Acked-by: Vincent Abriou 
> ---
>  drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index b8d942ca45e8..3fc62c1ea9c2 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -719,7 +719,7 @@ static void sti_gdp_atomic_update(struct drm_plane 
> *drm_plane,
>   u32 dma_updated_top;
>   u32 dma_updated_btm;
>   int format;
> - unsigned int depth, bpp;
> + unsigned int bpp;
>   u32 ydo, xdo, yds, xds;
>
>   if (!crtc || !fb)
> @@ -758,9 +758,9 @@ static void sti_gdp_atomic_update(struct drm_plane 
> *drm_plane,
>(unsigned long)cma_obj->paddr);
>
>   /* pixel memory location */
> - drm_fb_get_bpp_depth(fb->pixel_format, , );
> + bpp = drm_format_plane_cpp(fb->pixel_format, 0);
>   top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
> - top_field->gam_gdp_pml += src_x * (bpp >> 3);
> + top_field->gam_gdp_pml += src_x * bpp;
>   top_field->gam_gdp_pml += src_y * fb->pitches[0];
>
>   /* output parameters (clamped / cropped) */
>


[PATCH v2] drm: drop DRIVER_HAVE_IRQ flag for some drivers

2016-08-18 Thread Vincent ABRIOU
Acked-by: Vincent Abriou 

On 08/16/2016 09:06 AM, Shawn Guo wrote:
> Since commit 4984979b9b90 ("drm/irq: simplify irq checks in
> drm_wait_vblank"), the drm driver feature flag DRIVER_HAVE_IRQ is only
> required for drivers that have an IRQ handler managed by the DRM core.
> Some drivers, armada, etnaviv, kirin and sti, set this flag without
> .irq_handler setup in drm_driver.  These drivers manage IRQ handler
> by themselves and the flag DRIVER_HAVE_IRQ makes no sense there.
>
> Drop the flag for these drivers to avoid confusion.
>
> Signed-off-by: Shawn Guo 
> Cc: Vincent Abriou 
> Cc: Xinliang Liu 
> Acked-by: Russell King <rmk+kernel at armlinux.org.uk> (for armada and 
> etnaviv)
> ---
> Changes for v2:
>  - Improve commit log per Russell's suggestion
>  - Add Russell's ACK tag
>
>  drivers/gpu/drm/armada/armada_drv.c | 2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c   | 3 +--
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 +-
>  drivers/gpu/drm/sti/sti_drv.c   | 2 +-
>  4 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_drv.c 
> b/drivers/gpu/drm/armada/armada_drv.c
> index f5ebdd681445..1e0e68f608e4 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -211,7 +211,7 @@ static struct drm_driver armada_drm_driver = {
>   .desc   = "Armada SoC DRM",
>   .date   = "20120730",
>   .driver_features= DRIVER_GEM | DRIVER_MODESET |
> -   DRIVER_HAVE_IRQ | DRIVER_PRIME,
> +   DRIVER_PRIME,
>   .ioctls = armada_ioctls,
>   .fops   = _drm_fops,
>  };
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index ffd1b32caa8d..fd0ed61565f3 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -488,8 +488,7 @@ static const struct file_operations fops = {
>  };
>
>  static struct drm_driver etnaviv_drm_driver = {
> - .driver_features= DRIVER_HAVE_IRQ |
> - DRIVER_GEM |
> + .driver_features= DRIVER_GEM |
>   DRIVER_PRIME |
>   DRIVER_RENDER,
>   .open   = etnaviv_open,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 1edd9bc80294..1fc2f502d20d 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -169,7 +169,7 @@ static int kirin_gem_cma_dumb_create(struct drm_file 
> *file,
>
>  static struct drm_driver kirin_drm_driver = {
>   .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
> -   DRIVER_ATOMIC | DRIVER_HAVE_IRQ,
> +   DRIVER_ATOMIC,
>   .fops   = _drm_fops,
>
>   .gem_free_object_unlocked = drm_gem_cma_free_object,
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 96bd3d08b2d4..f8311b2bc84e 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -282,7 +282,7 @@ static const struct file_operations sti_driver_fops = {
>  };
>
>  static struct drm_driver sti_driver = {
> - .driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET |
> + .driver_features = DRIVER_MODESET |
>   DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC,
>   .gem_free_object_unlocked = drm_gem_cma_free_object,
>   .gem_vm_ops = _gem_cma_vm_ops,
>


[PATCH v3 07/15] drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

2016-06-09 Thread Vincent ABRIOU
Hi Laurent,

On 06/09/2016 11:17 AM, Laurent Pinchart wrote:
> Hi Vincent,
>
> On Thursday 09 Jun 2016 09:52:05 Vincent ABRIOU wrote:
>> On 06/09/2016 01:32 AM, Laurent Pinchart wrote:
>>> The driver needs the number of bytes per pixel, not the bpp and depth
>>> info meant for fbdev compatibility. Use the right API.
>>>
>>> Signed-off-by: Laurent Pinchart 
>>> ---
>>>
>>>drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
>>>1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> Cc: Benjamin Gaignard 
>>> Cc: Vincent Abriou 
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
>>> index ff33c38da197..be7e80535083 100644
>>> --- a/drivers/gpu/drm/sti/sti_gdp.c
>>> +++ b/drivers/gpu/drm/sti/sti_gdp.c
>>> @@ -733,7 +733,7 @@ static void sti_gdp_atomic_update(struct drm_plane
>>> *drm_plane,>
>>> u32 dma_updated_top;
>>> u32 dma_updated_btm;
>>> int format;
>>> -   unsigned int depth, bpp;
>>> +   unsigned int bpp;
>>> u32 ydo, xdo, yds, xds;
>>> 
>>> if (!crtc || !fb)
>>> @@ -772,9 +772,9 @@ static void sti_gdp_atomic_update(struct drm_plane
>>> *drm_plane,
>>>  (unsigned long)cma_obj->paddr);
>>> 
>>> /* pixel memory location */
>>> -   drm_fb_get_bpp_depth(fb->pixel_format, , );
>>> +   bpp = drm_format_plane_cpp(fb->pixel_format, 0);
>>
>> Hi Laurent,
>>
>> The patch is fine for me but what does "cpp" means in drm_format_plane_cpp?
>
> As far as I know it stands for character per pixel. It's really unfortunate
> that bit and byte both start with the same letter.
>

Thanks

Acked-by: Vincent Abriou 

>>> top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
>>> -   top_field->gam_gdp_pml += src_x * (bpp >> 3);
>>> +   top_field->gam_gdp_pml += src_x * bpp;
>>> top_field->gam_gdp_pml += src_y * fb->pitches[0];
>>> 
>>> /* output parameters (clamped / cropped) */
>


[PATCH v3 07/15] drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

2016-06-09 Thread Vincent ABRIOU

On 06/09/2016 01:32 AM, Laurent Pinchart wrote:
> The driver needs the number of bytes per pixel, not the bpp and depth
> info meant for fbdev compatibility. Use the right API.
>
> Signed-off-by: Laurent Pinchart 
> ---
>   drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index ff33c38da197..be7e80535083 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -733,7 +733,7 @@ static void sti_gdp_atomic_update(struct drm_plane 
> *drm_plane,
>   u32 dma_updated_top;
>   u32 dma_updated_btm;
>   int format;
> - unsigned int depth, bpp;
> + unsigned int bpp;
>   u32 ydo, xdo, yds, xds;
>
>   if (!crtc || !fb)
> @@ -772,9 +772,9 @@ static void sti_gdp_atomic_update(struct drm_plane 
> *drm_plane,
>(unsigned long)cma_obj->paddr);
>
>   /* pixel memory location */
> - drm_fb_get_bpp_depth(fb->pixel_format, , );
> + bpp = drm_format_plane_cpp(fb->pixel_format, 0);

Hi Laurent,

The patch is fine for me but what does "cpp" means in drm_format_plane_cpp?

Vincent

>   top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
> - top_field->gam_gdp_pml += src_x * (bpp >> 3);
> + top_field->gam_gdp_pml += src_x * bpp;
>   top_field->gam_gdp_pml += src_y * fb->pitches[0];
>
>   /* output parameters (clamped / cropped) */
>


[PATCH v2 11/20] drm: sti: Rely on the default ->best_encoder() behavior

2016-06-08 Thread Vincent ABRIOU
Hi Boris,

Thanks for the patch.

Acked-by: Vincent Abriou 

Vincent

On 06/07/2016 01:48 PM, Boris Brezillon wrote:
> All outputs have a 1:1 relationship between connectors and encoders
> and the driver is relying on the atomic helpers: we can drop the custom
> ->best_encoder() implementations and let the core call
> drm_atomic_helper_best_encoder() for us.
>
> Signed-off-by: Boris Brezillon 
> ---
>   drivers/gpu/drm/sti/sti_dvo.c  | 10 --
>   drivers/gpu/drm/sti/sti_hda.c  | 10 --
>   drivers/gpu/drm/sti/sti_hdmi.c | 10 --
>   3 files changed, 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 25f7663..d5627d1 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -384,20 +384,10 @@ static int sti_dvo_connector_mode_valid(struct 
> drm_connector *connector,
>   return MODE_OK;
>   }
>
> -struct drm_encoder *sti_dvo_best_encoder(struct drm_connector *connector)
> -{
> - struct sti_dvo_connector *dvo_connector
> - = to_sti_dvo_connector(connector);
> -
> - /* Best encoder is the one associated during connector creation */
> - return dvo_connector->encoder;
> -}
> -
>   static const
>   struct drm_connector_helper_funcs sti_dvo_connector_helper_funcs = {
>   .get_modes = sti_dvo_connector_get_modes,
>   .mode_valid = sti_dvo_connector_mode_valid,
> - .best_encoder = sti_dvo_best_encoder,
>   };
>
>   static enum drm_connector_status
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index f7d3464..c4649f5 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -676,20 +676,10 @@ static int sti_hda_connector_mode_valid(struct 
> drm_connector *connector,
>   return MODE_OK;
>   }
>
> -struct drm_encoder *sti_hda_best_encoder(struct drm_connector *connector)
> -{
> - struct sti_hda_connector *hda_connector
> - = to_sti_hda_connector(connector);
> -
> - /* Best encoder is the one associated during connector creation */
> - return hda_connector->encoder;
> -}
> -
>   static const
>   struct drm_connector_helper_funcs sti_hda_connector_helper_funcs = {
>   .get_modes = sti_hda_connector_get_modes,
>   .mode_valid = sti_hda_connector_mode_valid,
> - .best_encoder = sti_hda_best_encoder,
>   };
>
>   static enum drm_connector_status
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 6ef0715..dc9ab6e 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -897,20 +897,10 @@ static int sti_hdmi_connector_mode_valid(struct 
> drm_connector *connector,
>   return MODE_OK;
>   }
>
> -struct drm_encoder *sti_hdmi_best_encoder(struct drm_connector *connector)
> -{
> - struct sti_hdmi_connector *hdmi_connector
> - = to_sti_hdmi_connector(connector);
> -
> - /* Best encoder is the one associated during connector creation */
> - return hdmi_connector->encoder;
> -}
> -
>   static const
>   struct drm_connector_helper_funcs sti_hdmi_connector_helper_funcs = {
>   .get_modes = sti_hdmi_connector_get_modes,
>   .mode_valid = sti_hdmi_connector_mode_valid,
> - .best_encoder = sti_hdmi_best_encoder,
>   };
>
>   /* get detection status of display device */
>


[PATCH v2 2/3] drm: convert DT component matching to component_match_add_release()

2016-06-07 Thread Vincent ABRIOU


On 06/03/2016 04:21 PM, Russell King wrote:
> Convert DT component matching to use component_match_add_release().
>
> Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
> ---
>   drivers/gpu/drm/arm/hdlcd_drv.c |  9 +++--
>   drivers/gpu/drm/armada/armada_drv.c |  8 ++--
>   drivers/gpu/drm/drm_of.c|  6 --
>   drivers/gpu/drm/etnaviv/etnaviv_drv.c   | 11 ++-
>   drivers/gpu/drm/msm/msm_drv.c   |  8 ++--
>   drivers/gpu/drm/msm/msm_drv.h   |  1 +
>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 12 +++-
>   drivers/gpu/drm/sti/sti_drv.c   |  9 ++---
>   drivers/gpu/drm/tilcdc/tilcdc_external.c|  8 ++--
>   9 files changed, 21 insertions(+), 51 deletions(-)
>
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 872495e72294..aeb2787c9bd4 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -10,6 +10,7 @@
>   #include 
>   #include 
>   #include 
> +#include 
>   #include 
>
>   #include 
> @@ -341,11 +342,6 @@ static struct drm_driver sti_driver = {
>   .minor = DRIVER_MINOR,
>   };
>
> -static int compare_of(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
>   static int sti_bind(struct device *dev)
>   {
>   return drm_platform_init(_driver, to_platform_device(dev));
> @@ -375,8 +371,7 @@ static int sti_platform_probe(struct platform_device 
> *pdev)
>   child_np = of_get_next_available_child(node, NULL);
>
>   while (child_np) {
> - component_match_add(dev, , compare_of, child_np);
> - of_node_put(child_np);
> + component_match_add_of(dev, , child_np);
>   child_np = of_get_next_available_child(node, child_np);
>   }
>

Hi Russel,

Ok for the sti driver.

Acked-by: Vincent Abriou 


[PATCH 08/12] drm/sti: Rename async to nonblock.

2016-04-27 Thread Vincent ABRIOU
Hi Maarten,

Thanks for the patch.
Acked-by: Vincent Abriou 

On 04/26/2016 04:11 PM, Maarten Lankhorst wrote:
> The async name is deprecated and should be changed to nonblocking.
>
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
> Signed-off-by: Maarten Lankhorst 
> ---
>   drivers/gpu/drm/sti/sti_drv.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 6bd6abaa5a70..872495e72294 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -202,7 +202,7 @@ static void sti_atomic_work(struct work_struct *work)
>   }
>
>   static int sti_atomic_commit(struct drm_device *drm,
> -  struct drm_atomic_state *state, bool async)
> +  struct drm_atomic_state *state, bool nonblock)
>   {
>   struct sti_private *private = drm->dev_private;
>   int err;
> @@ -211,7 +211,7 @@ static int sti_atomic_commit(struct drm_device *drm,
>   if (err)
>   return err;
>
> - /* serialize outstanding asynchronous commits */
> + /* serialize outstanding nonblocking commits */
>   mutex_lock(>commit.lock);
>   flush_work(>commit.work);
>
> @@ -223,7 +223,7 @@ static int sti_atomic_commit(struct drm_device *drm,
>
>   drm_atomic_helper_swap_state(drm, state);
>
> - if (async)
> + if (nonblock)
>   sti_atomic_schedule(private, state);
>   else
>   sti_atomic_complete(private, state);
>


[Y2038] [PATCH] drm/sti: Use 64-bit timestamps

2016-04-18 Thread Vincent ABRIOU
On 04/17/2016 01:39 AM, Arnd Bergmann wrote:
> On Wednesday 13 April 2016 02:28:02 Tina Ruchandani wrote:
>> 'struct timespec' uses a 32-bit field for seconds, which
>> will overflow in year 2038 and beyond. This patch is part
>> of a larger attempt to remove instances of timeval, timespec
>> and time_t, all of which suffer from the y2038 issue, from the
>> kernel.
>>
>> Signed-off-by: Tina Ruchandani 
>
> Looks good in principle. Two small points:
>
>>   void sti_plane_update_fps(struct sti_plane *plane,
>>bool new_frame,
>>bool new_field)
>>   {
>> -struct timespec now;
>> +ktime_t now;
>>  struct sti_fps_info *fps;
>>  int fpks, fipks, ms_since_last, num_frames, num_fields;
>>
>> -getrawmonotonic();
>> +now = ktime_get();
>
> It's unclear why the driver was using getrawmonotonic() here rather
> than ktime_get_ts(). The code is fairly new, so Vincent can
> probably explain this.
>
> If it was intentional, we should use ktime_get_raw() instead of
> ktime_get().
>

getrawmonotonic comes from a legacy code so the use is not intentional.
Honestly, it is not clear to me the difference between monotonic and 
rawmonotonic. But in the debug context in which it is used, ktime_get 
and ktime_get_raw will deliver the same level of information we need. So 
implementation done by Tina is fine for me.

Vincent

>> @@ -76,7 +66,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
>>  return;
>>
>>  fps->curr_frame_counter++;
>> -ms_since_last = sti_plane_timespec_ms_diff(now, fps->last_timestamp);
>> +ms_since_last = ktime_to_ms(ktime_sub(now, fps->last_timestamp));
>>  num_frames = fps->curr_frame_counter - fps->last_frame_counter;
>
> This could be expressed in a more compact way using ktime_ms_delta().
>
>   Arnd
>


[PATCH] drm/sti: restore mode_fixup callback

2016-03-17 Thread Vincent ABRIOU
Thank you Arnd for highlighting this.

Acked-by: Vincent ABRIOU 

On 03/17/2016 10:02 AM, Arnd Bergmann wrote:
> Commit 8a2fa38fddd3 removed the mode_fixup because it was empty,
> but 652353e6e561 modified it to call drm_mode_set_crtcinfo()
> instead.
>
> Both commits are correct, but the merge of the two kept the nonempty
> version without the reference to it, as shown by the gcc warning:
>
>   drm/sti/sti_crtc.c:54:13: error: 'sti_crtc_mode_fixup' defined but not used
>
> This restores the callback pointer to fix the merge.
>
> Signed-off-by: Arnd Bergmann 
> Reverts: 8a2fa38fddd3 ("drm/sti: removed optional dummy crtc mode_fixup 
> function.")
> Fixes: 652353e6e561 ("drm/sti: set CRTC modesetting parameters")
> Fixes: cf481068cdd4 ("Merge branch '2016-02-26-st-drm-next' of 
> http://git.linaro.org/people/benjamin.gaignard/kernel into drm-next")
> ---
>   drivers/gpu/drm/sti/sti_crtc.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index fa47f63b5316..505620c7c2c8 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -230,6 +230,7 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
>   static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
>   .enable = sti_crtc_enable,
>   .disable = sti_crtc_disabling,
> + .mode_fixup = sti_crtc_mode_fixup,
>   .mode_set = drm_helper_crtc_mode_set,
>   .mode_set_nofb = sti_crtc_mode_set_nofb,
>   .mode_set_base = drm_helper_crtc_mode_set_base,
>


[git pull] drm/sti: drm-next 2016-02-26

2016-03-03 Thread Vincent ABRIOU
Hello Dave,

Here are sti patches for drm-next.
It brings:
  - The support of the atomic_check for the planes and minor fixes for 
planes
  - The support of the vendor specific infoframe for HDMI and the 
support of 2 HDMI properties related to the connector
  - The support of the DVO solving panel detection issue and timing issue.
  - The support of debugfs for connectors, encoders, crtcs and planes.

The following changes since commit 44ab4042178bd596275927ea050980aa4257581b:

   Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu 
into drm-next (2016-02-26 13:02:57 +1000)

are available in the git repository at:

   http://git.linaro.org/people/benjamin.gaignard/kernel.git 
2016-02-26-st-drm-next

for you to fetch changes up to 52807ae90e76b69fd01688d6031190271536d29f:

   drm/sti: use u32 to store DMA addresses (2016-03-03 09:17:17 +0100)

Regards,
Vincent


Arnd Bergmann (1):
   drm/sti: use u32 to store DMA addresses

Benjamin Gaignard (1):
   drm: sti: remove sti_gem_prime_export hack

Bich Hemon (6):
   drm/sti: awg_utils code cleanup
   drm/sti: GDP planes only support RGB formats
   drm/sti: fallback for GDP scaling
   drm/sti: adapt YUV colorspace in display pipeline
   drm/sti: adjust delay for DVO
   drm/sti: fix dvo data_enable signal

Fabien Dessenne (2):
   drm/sti: clarify the skip frame/field message
   drm/sti: force cursor CLUT fetch

Vincent Abriou (22):
   drm/sti: update VTG timing programming
   drm/sti: GDP cropping fails when we remove 2 pixels horizontally
   drm/sti: implement atomic_check for the planes
   drm/sti: do not clip RGB/YUV component value at connector side
   drm/sti: fix panel detection for DVO connector
   drm/sti: add missing encoder cleanup for DVO connector
   drm/sti: reset HD DACS when HDA connector is created
   drm/sti: HDMI infoframe transmission mode not take into account
   drm/sti: reset infoframe transmission when HDMI is stopped
   drm/sti: add HDMI vendor specific infoframe
   drm/sti: add colorspace property to the HDMI connector
   drm/sti: add hdmi_mode property for HDMI connector
   drm/sti: add debugfs entries for HDMI connector
   drm/sti: add debugfs entries for DVO connector
   drm/sti: add debugfs entries for HDA connector
   drm/sti: add debugfs entries for CURSOR plane
   drm/sti: add debugfs entries for GDP planes
   drm/sti: add debugfs entries for HQVDP plane
   drm/sti: add debugfs entries for VID plane
   drm/sti: add debugfs entries for MIXER crtc
   drm/sti: add debugfs entries for TVOUT encoders
   drm/sti: add debugfs fps_show/fps_get mechanism for planes

benjamin.gaignard at linaro.org (4):
   drm/sti: fix potential crash in gdp
   drm/sti: set CRTC modesetting parameters
   drm/sti: fix cursor coordinates
   drm/sti: set DRIVER_ATOMIC for sti

  drivers/gpu/drm/sti/sti_awg_utils.c  |  78 +++---
  drivers/gpu/drm/sti/sti_compositor.c |   4 +-
  drivers/gpu/drm/sti/sti_crtc.c   |   1 +
  drivers/gpu/drm/sti/sti_cursor.c | 184 +++---
  drivers/gpu/drm/sti/sti_drv.c| 141 ++-
  drivers/gpu/drm/sti/sti_dvo.c|  78 +-
  drivers/gpu/drm/sti/sti_gdp.c| 476 
---
  drivers/gpu/drm/sti/sti_hda.c| 108 +++-
  drivers/gpu/drm/sti/sti_hdmi.c   | 400 +++--
  drivers/gpu/drm/sti/sti_hdmi.h   |  31 ++-
  drivers/gpu/drm/sti/sti_hqvdp.c  | 447 
++--
  drivers/gpu/drm/sti/sti_mixer.c  | 146 ++-
  drivers/gpu/drm/sti/sti_mixer.h  |   4 +-
  drivers/gpu/drm/sti/sti_plane.c  |  63 +
  drivers/gpu/drm/sti/sti_plane.h  |  17 ++
  drivers/gpu/drm/sti/sti_tvout.c  | 295 +-
  drivers/gpu/drm/sti/sti_vid.c| 125 -
  drivers/gpu/drm/sti/sti_vid.h|   4 +-
  drivers/gpu/drm/sti/sti_vtg.c| 200 ++-
  drivers/gpu/drm/sti/sti_vtg.h|   5 +
  20 files changed, 2391 insertions(+), 416 deletions(-)


[PATCH 1/2] drm: Add DRM_MODE_FB_BFF flag definition

2016-02-29 Thread Vincent ABRIOU


On 02/29/2016 04:32 PM, Daniel Vetter wrote:
> On Fri, Feb 26, 2016 at 11:33:08AM +0100, Vincent ABRIOU wrote:
>> Hi,
>>
>> Have you any comment for this proposal?
>
> I guess since we don't really have userspace that uses interlaced modes,
> much less actually bothers to get the fields correct I think just have
> some (open-source) userspace somewhere (does gstreamer care enough about
> this?) which needs this and it's good.
>

Hi Daniel,

At Gstreamer side, an interlaced GstBuffer could be tagged with flags:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoFrameFlags

GST_VIDEO_FRAME_FLAG_TFF is one of them and it is used to warn that the 
buffer is interlaced with Top Field First (TFF).

At kernel side, we preferred to tag the interlaced buffer with Bottom 
Field First (BFF) because most of the interlaced buffer are TFF and that 
BFF are the exception.

Further, we made tests with weston to validate the full path and it is 
working fine.

BR
Vincent

> Without userspace this is a hard sell.
>
> Thanks, Daniel
>
>>
>> BR
>> Vincent
>>
>> On 02/12/2016 10:26 AM, Vincent Abriou wrote:
>>> From: Fabien Dessenne 
>>>
>>> If a buffer is interlaced, this "Bottom Field First" flag specifies
>>> which of the top or the bottom field shall be displayed first.
>>> When set, the bottom field shall be displayed first.
>>> When unset the top field shall be displayed first.
>>>
>>> Signed-off-by: Fabien Dessenne 
>>> ---
>>>drivers/gpu/drm/drm_crtc.c  | 3 ++-
>>>include/uapi/drm/drm_mode.h | 1 +
>>>2 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>>> index d40bab2..64b4fdac 100644
>>> --- a/drivers/gpu/drm/drm_crtc.c
>>> +++ b/drivers/gpu/drm/drm_crtc.c
>>> @@ -3315,7 +3315,8 @@ internal_framebuffer_create(struct drm_device *dev,
>>> struct drm_framebuffer *fb;
>>> int ret;
>>>
>>> -   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
>>> +   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS
>>> +   | DRM_MODE_FB_BFF)) {
>>> DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
>>> return ERR_PTR(-EINVAL);
>>> }
>>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>>> index 50adb46..f7c9111 100644
>>> --- a/include/uapi/drm/drm_mode.h
>>> +++ b/include/uapi/drm/drm_mode.h
>>> @@ -354,6 +354,7 @@ struct drm_mode_fb_cmd {
>>>
>>>#define DRM_MODE_FB_INTERLACED   (1<<0) /* for interlaced framebuffers */
>>>#define DRM_MODE_FB_MODIFIERS(1<<1) /* enables ->modifer[] */
>>> +#define DRM_MODE_FB_BFF(1<<2) /* if interlaced, bottom field 
>>> first */
>>>
>>>struct drm_mode_fb_cmd2 {
>>> __u32 fb_id;
>>>
>


[PATCH 1/2] drm: Add DRM_MODE_FB_BFF flag definition

2016-02-26 Thread Vincent ABRIOU
Hi,

Have you any comment for this proposal?

BR
Vincent

On 02/12/2016 10:26 AM, Vincent Abriou wrote:
> From: Fabien Dessenne 
>
> If a buffer is interlaced, this "Bottom Field First" flag specifies
> which of the top or the bottom field shall be displayed first.
> When set, the bottom field shall be displayed first.
> When unset the top field shall be displayed first.
>
> Signed-off-by: Fabien Dessenne 
> ---
>   drivers/gpu/drm/drm_crtc.c  | 3 ++-
>   include/uapi/drm/drm_mode.h | 1 +
>   2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index d40bab2..64b4fdac 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -3315,7 +3315,8 @@ internal_framebuffer_create(struct drm_device *dev,
>   struct drm_framebuffer *fb;
>   int ret;
>
> - if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
> + if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS
> + | DRM_MODE_FB_BFF)) {
>   DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
>   return ERR_PTR(-EINVAL);
>   }
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 50adb46..f7c9111 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -354,6 +354,7 @@ struct drm_mode_fb_cmd {
>
>   #define DRM_MODE_FB_INTERLACED  (1<<0) /* for interlaced framebuffers */
>   #define DRM_MODE_FB_MODIFIERS   (1<<1) /* enables ->modifer[] */
> +#define DRM_MODE_FB_BFF  (1<<2) /* if interlaced, bottom field 
> first */
>
>   struct drm_mode_fb_cmd2 {
>   __u32 fb_id;
>


[PATCH, RESEND] drm/sti: use u32 to store DMA addresses

2016-02-26 Thread Vincent ABRIOU
Hi Arnd,


Your patch will be part of the next pull request for the STI driver that 
will be done by the end of next week.

Reviewed-by: Vincent Abriou 

On 02/25/2016 10:11 PM, Arnd Bergmann wrote:
> The STi drm driver correctly warns about invalid format strings
> when built with 64-bit dma_addr_t:
>
> sti_hqvdp.c: In function 'sti_hqvdp_vtg_cb':
> sti_hqvdp.c:605:119: warning: format '%x' expects argument of type 'unsigned 
> int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' 
> [-Wformat=]
> sti_hqvdp.c: In function 'sti_hqvdp_atomic_update':
> sti_hqvdp.c:931:118: warning: format '%x' expects argument of type 'unsigned 
> int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' 
> [-Wformat=]
>
> This could be changed to using the %pad format string, but that
> does not work when printing an rvalue, so instead I'm changing
> the type in the sti_hqvdp structure to u32, which is what gets
> written into the registers anyway.
>
> Signed-off-by: Arnd Bergmann 
> ---
>   drivers/gpu/drm/sti/sti_hqvdp.c | 14 --
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> I originally submitted this on Tue, 08 Dec 2015, but got no reply,
> so resending the same patch now.
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 1d3c3d029603..7818d47bea43 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -349,7 +349,7 @@ struct sti_hqvdp {
>   unsigned int curr_field_count;
>   unsigned int last_field_count;
>   void *hqvdp_cmd;
> - dma_addr_t hqvdp_cmd_paddr;
> + u32 hqvdp_cmd_paddr;
>   struct sti_vtg *vtg;
>   bool xp70_initialized;
>   };
> @@ -372,8 +372,8 @@ static const uint32_t hqvdp_supported_formats[] = {
>*/
>   static int sti_hqvdp_get_free_cmd(struct sti_hqvdp *hqvdp)
>   {
> - int curr_cmd, next_cmd;
> - dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr;
> + u32 curr_cmd, next_cmd;
> + u32 cmd = hqvdp->hqvdp_cmd_paddr;
>   int i;
>
>   curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD);
> @@ -400,8 +400,8 @@ static int sti_hqvdp_get_free_cmd(struct sti_hqvdp *hqvdp)
>*/
>   static int sti_hqvdp_get_curr_cmd(struct sti_hqvdp *hqvdp)
>   {
> - int curr_cmd;
> - dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr;
> + u32 curr_cmd;
> + u32 cmd = hqvdp->hqvdp_cmd_paddr;
>   unsigned int i;
>
>   curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD);
> @@ -612,19 +612,21 @@ int sti_hqvdp_vtg_cb(struct notifier_block *nb, 
> unsigned long evt, void *data)
>   static void sti_hqvdp_init(struct sti_hqvdp *hqvdp)
>   {
>   int size;
> + dma_addr_t dma_addr;
>
>   hqvdp->vtg_nb.notifier_call = sti_hqvdp_vtg_cb;
>
>   /* Allocate memory for the VDP commands */
>   size = NB_VDP_CMD * sizeof(struct sti_hqvdp_cmd);
>   hqvdp->hqvdp_cmd = dma_alloc_wc(hqvdp->dev, size,
> - >hqvdp_cmd_paddr,
> + _addr,
>   GFP_KERNEL | GFP_DMA);
>   if (!hqvdp->hqvdp_cmd) {
>   DRM_ERROR("Failed to allocate memory for VDP cmd\n");
>   return;
>   }
>
> + hqvdp->hqvdp_cmd_paddr = (u32)dma_addr;
>   memset(hqvdp->hqvdp_cmd, 0, size);
>   }
>
>


[PATCH v2 16/17] drm/sti: removed optional dummy encoder mode_fixup function.

2016-02-15 Thread Vincent ABRIOU


On 02/15/2016 02:01 PM, Carlos Palminha wrote:
> mode_fixup function for encoder drivers became optional with patch
> http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha
>  at synopsys.com
>
> This patch set nukes all the dummy mode_fixup implementations.
>
> (made on top of Daniel topic/drm-misc branch)
>
> Signed-off-by: Carlos Palminha 
> ---
>   drivers/gpu/drm/sti/sti_tvout.c | 10 --
>   1 file changed, 10 deletions(-)
>

Acked-by: Vincent Abriou 

BR
Vincent


[PATCH 2/2] drm/sti: support interlaced top / bottom field first

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

Support top field first and bottom field first interlaced buffers

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 72 +
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index e9c33fb..e024c13 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -325,7 +325,7 @@ struct sti_hqvdp_cmd {
  * @clk_pix_main:  pix main clock
  * @reset: reset control
  * @vtg_nb:notifier to handle VTG Vsync
- * @btm_field_pending: is there any bottom field (interlaced frame) to display
+ * @nxt_field_pending: is there any other field (interlaced frame) to display
  * @hqvdp_cmd: buffer of commands
  * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
  * @vtg:   vtg for main data path
@@ -340,7 +340,7 @@ struct sti_hqvdp {
struct clk *clk_pix_main;
struct reset_control *reset;
struct notifier_block vtg_nb;
-   bool btm_field_pending;
+   bool nxt_field_pending;
void *hqvdp_cmd;
dma_addr_t hqvdp_cmd_paddr;
struct sti_vtg *vtg;
@@ -784,7 +784,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
  * @evt: event message
  * @data: private data
  *
- * Handle VTG Vsync event, display pending bottom field
+ * Handle VTG Vsync event, display next field
  *
  * RETURNS:
  * 0 on success.
@@ -792,8 +792,8 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
 {
struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, vtg_nb);
-   int btm_cmd_offset, top_cmd_offest;
-   struct sti_hqvdp_cmd *btm_cmd, *top_cmd;
+   int next_cmd_offset, curr_cmd_offest;
+   struct sti_hqvdp_cmd *next_cmd, *curr_cmd;

if ((evt != VTG_TOP_FIELD_EVENT) && (evt != VTG_BOTTOM_FIELD_EVENT)) {
DRM_DEBUG_DRIVER("Unknown event\n");
@@ -808,31 +808,41 @@ int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned 
long evt, void *data)
sti_hqvdp_disable(hqvdp);
}

-   if (hqvdp->btm_field_pending) {
-   /* Create the btm field command from the current one */
-   btm_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
-   top_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
-   if ((btm_cmd_offset == -1) || (top_cmd_offest == -1)) {
+   if (hqvdp->nxt_field_pending) {
+   /* Create the next field command from the current one */
+   next_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
+   curr_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
+   if ((next_cmd_offset == -1) || (curr_cmd_offest == -1)) {
DRM_DEBUG_DRIVER("Warning: no cmd, will skip field\n");
return -EBUSY;
}

-   btm_cmd = hqvdp->hqvdp_cmd + btm_cmd_offset;
-   top_cmd = hqvdp->hqvdp_cmd + top_cmd_offest;
-
-   memcpy(btm_cmd, top_cmd, sizeof(*btm_cmd));
-
-   btm_cmd->top.config = TOP_CONFIG_INTER_BTM;
-   btm_cmd->top.current_luma +=
-   btm_cmd->top.luma_src_pitch / 2;
-   btm_cmd->top.current_chroma +=
-   btm_cmd->top.chroma_src_pitch / 2;
+   next_cmd = hqvdp->hqvdp_cmd + next_cmd_offset;
+   curr_cmd = hqvdp->hqvdp_cmd + curr_cmd_offest;
+
+   memcpy(next_cmd, curr_cmd, sizeof(*next_cmd));
+
+   if (curr_cmd->top.config == TOP_CONFIG_INTER_TOP) {
+   /* Display the bottom field now */
+   next_cmd->top.config = TOP_CONFIG_INTER_BTM;
+   next_cmd->top.current_luma +=
+   next_cmd->top.luma_src_pitch / 2;
+   next_cmd->top.current_chroma +=
+   next_cmd->top.chroma_src_pitch / 2;
+   } else {
+   /* Display the top field now */
+   next_cmd->top.config = TOP_CONFIG_INTER_TOP;
+   next_cmd->top.current_luma -=
+   next_cmd->top.luma_src_pitch / 2;
+   next_cmd->top.current_chroma -=
+   next_cmd->top.chroma_src_pitch / 2;
+   }

/* Post the command to mailbox */
-   writel(hqvdp->hqvdp_cmd_paddr + btm_cmd_offset,
-   hqvdp->regs + HQVDP_MBX_NEXT_CMD);
+   writel(hqvdp->hqvdp_cmd_paddr + next_cmd_offset,
+  hqvdp->regs + HQVDP_MBX_NEXT_CMD);

-   hqvdp->btm_field_pending = false;
+   hqvdp->nxt_field_pending = false;

dev_dbg(hqvdp->dev, "%s Posted 

[PATCH 1/2] drm: Add DRM_MODE_FB_BFF flag definition

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

If a buffer is interlaced, this "Bottom Field First" flag specifies
which of the top or the bottom field shall be displayed first.
When set, the bottom field shall be displayed first.
When unset the top field shall be displayed first.

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/drm_crtc.c  | 3 ++-
 include/uapi/drm/drm_mode.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d40bab2..64b4fdac 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3315,7 +3315,8 @@ internal_framebuffer_create(struct drm_device *dev,
struct drm_framebuffer *fb;
int ret;

-   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
+   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS
+   | DRM_MODE_FB_BFF)) {
DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
return ERR_PTR(-EINVAL);
}
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 50adb46..f7c9111 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -354,6 +354,7 @@ struct drm_mode_fb_cmd {

 #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
 #define DRM_MODE_FB_MODIFIERS  (1<<1) /* enables ->modifer[] */
+#define DRM_MODE_FB_BFF(1<<2) /* if interlaced, bottom field 
first */

 struct drm_mode_fb_cmd2 {
__u32 fb_id;
-- 
1.9.1



[PATCH 0/2] drm/sti: support of interlaced content with Bottom Field

2016-02-12 Thread Vincent Abriou
Interlaced video can have different scan order:
Top Field First or Bottom Field First

In case of video with interlaced content, this information should be
propagated from the userland to the DRM kernel driver that will process the
deinterlacing starting with the top or the bottom field first.
That's why we introduce this new flag definition DRM_MODE_FB_BFF (Bottom Field
First) that should be used jointly with the already existing
DRM_MODE_FB_INTERLACED flag incase of interlaced video with Bottom Field First
scan order should be processed.

Fabien Dessenne (2):
  drm: Add DRM_MODE_FB_BFF flag definition
  drm/sti: support interlaced top / bottom field first

 drivers/gpu/drm/drm_crtc.c  |  3 +-
 drivers/gpu/drm/sti/sti_hqvdp.c | 72 +
 include/uapi/drm/drm_mode.h |  1 +
 3 files changed, 47 insertions(+), 29 deletions(-)

-- 
1.9.1



[PATCH 10/10] drm/sti: add debugfs fps_show/fps_get mechanism for planes

2016-02-12 Thread Vincent Abriou
Display fps on demand for each used plane:
cat /sys/kernel/debug/dri/0/fps_get
Display fps in live in the console for each used plane:
echo 255 > /sys/kernel/debug/dri/0/fps_show

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_cursor.c |   2 +
 drivers/gpu/drm/sti/sti_drv.c| 128 +++
 drivers/gpu/drm/sti/sti_gdp.c|   2 +
 drivers/gpu/drm/sti/sti_hqvdp.c  |  11 ++--
 drivers/gpu/drm/sti/sti_plane.c  |  63 +++
 drivers/gpu/drm/sti/sti_plane.h  |  17 ++
 6 files changed, 216 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 9eac1b9..82b5711 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -306,6 +306,8 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
writel(cursor->clut_paddr, cursor->regs + CUR_CML);
writel(CUR_CTL_CLUT_UPDATE, cursor->regs + CUR_CTL);

+   sti_plane_update_fps(plane, true, false);
+
plane->status = STI_PLANE_UPDATED;
 }

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index bcb1861..e5ef6b6 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -20,6 +20,7 @@

 #include "sti_crtc.h"
 #include "sti_drv.h"
+#include "sti_plane.h"

 #define DRIVER_NAME"sti"
 #define DRIVER_DESC"STMicroelectronics SoC DRM"
@@ -30,6 +31,130 @@
 #define STI_MAX_FB_HEIGHT  4096
 #define STI_MAX_FB_WIDTH   4096

+static int sti_drm_fps_get(void *data, u64 *val)
+{
+   struct drm_device *drm_dev = data;
+   struct drm_plane *p;
+   unsigned int i = 0;
+
+   *val = 0;
+   list_for_each_entry(p, _dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   *val |= plane->fps_info.output << i;
+   i++;
+   }
+
+   return 0;
+}
+
+static int sti_drm_fps_set(void *data, u64 val)
+{
+   struct drm_device *drm_dev = data;
+   struct drm_plane *p;
+   unsigned int i = 0;
+
+   list_for_each_entry(p, _dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   plane->fps_info.output = (val >> i) & 1;
+   i++;
+   }
+
+   return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(sti_drm_fps_fops,
+   sti_drm_fps_get, sti_drm_fps_set, "%llu\n");
+
+static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_plane *p;
+   int ret;
+
+   ret = mutex_lock_interruptible(>struct_mutex);
+   if (ret)
+   return ret;
+
+   list_for_each_entry(p, >mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   seq_printf(s, "%s%s\n",
+  plane->fps_info.fps_str,
+  plane->fps_info.fips_str);
+   }
+
+   mutex_unlock(>struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list sti_drm_dbg_list[] = {
+   {"fps_get", sti_drm_fps_dbg_show, 0},
+};
+
+static int sti_drm_debugfs_create(struct dentry *root,
+ struct drm_minor *minor,
+ const char *name,
+ const struct file_operations *fops)
+{
+   struct drm_device *dev = minor->dev;
+   struct drm_info_node *node;
+   struct dentry *ent;
+
+   ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops);
+   if (IS_ERR(ent))
+   return PTR_ERR(ent);
+
+   node = kmalloc(sizeof(*node), GFP_KERNEL);
+   if (!node) {
+   debugfs_remove(ent);
+   return -ENOMEM;
+   }
+
+   node->minor = minor;
+   node->dent = ent;
+   node->info_ent = (void *)fops;
+
+   mutex_lock(>debugfs_lock);
+   list_add(>list, >debugfs_list);
+   mutex_unlock(>debugfs_lock);
+
+   return 0;
+}
+
+static int sti_drm_dbg_init(struct drm_minor *minor)
+{
+   int ret;
+
+   ret = drm_debugfs_create_files(sti_drm_dbg_list,
+  ARRAY_SIZE(sti_drm_dbg_list),
+  minor->debugfs_root, minor);
+   if (ret)
+   goto err;
+
+   ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show",
+_drm_fps_fops);
+   if (ret)
+   goto err;
+
+   DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
+   return 0;
+err:
+   DRM_ERROR("%s: cannot install debugfs\n", DRIVER_NAME);
+   return ret;
+}
+
+void sti_drm_dbg_cleanup

  1   2   >