[PATCH] drm/radeon/radeon_device: remove unused function

2016-09-15 Thread Baoyou Xie
We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/radeon/radeon_device.c:1961:5: warning: no previous prototype 
for 'radeon_debugfs_init' [-Wmissing-prototypes]
drivers/gpu/drm/radeon/radeon_device.c:1966:6: warning: no previous prototype 
for 'radeon_debugfs_cleanup' [-Wmissing-prototypes]

In fact, these functions are dummy, but can be removed,
so this patch removes them.

Signed-off-by: Baoyou Xie 
---
 drivers/gpu/drm/radeon/radeon_device.c | 11 ---
 drivers/gpu/drm/radeon/radeon_drv.c|  9 -
 2 files changed, 20 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
b/drivers/gpu/drm/radeon/radeon_device.c
index a00dd2f..63447f1 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1956,14 +1956,3 @@ static void radeon_debugfs_remove_files(struct 
radeon_device *rdev)
}
 #endif
 }
-
-#if defined(CONFIG_DEBUG_FS)
-int radeon_debugfs_init(struct drm_minor *minor)
-{
-   return 0;
-}
-
-void radeon_debugfs_cleanup(struct drm_minor *minor)
-{
-}
-#endif
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 07e4493..86bab2e 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -156,11 +156,6 @@ void radeon_gem_prime_vunmap(struct drm_gem_object *obj, 
void *vaddr);
 extern long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg);

-#if defined(CONFIG_DEBUG_FS)
-int radeon_debugfs_init(struct drm_minor *minor);
-void radeon_debugfs_cleanup(struct drm_minor *minor);
-#endif
-
 /* atpx handler */
 #if defined(CONFIG_VGA_SWITCHEROO)
 void radeon_register_atpx_handler(void);
@@ -531,10 +526,6 @@ static struct drm_driver kms_driver = {
.disable_vblank = radeon_disable_vblank_kms,
.get_vblank_timestamp = radeon_get_vblank_timestamp_kms,
.get_scanout_position = radeon_get_crtc_scanoutpos,
-#if defined(CONFIG_DEBUG_FS)
-   .debugfs_init = radeon_debugfs_init,
-   .debugfs_cleanup = radeon_debugfs_cleanup,
-#endif
.irq_preinstall = radeon_driver_irq_preinstall_kms,
.irq_postinstall = radeon_driver_irq_postinstall_kms,
.irq_uninstall = radeon_driver_irq_uninstall_kms,
-- 
2.7.4



[PATCH v9 00/19] Add support for FDMA DMA controller and slim core rproc found on STi chipsets

2016-09-15 Thread Vinod Koul
On Wed, Sep 14, 2016 at 06:37:40PM +0530, Vinod Koul wrote:
> On Tue, Sep 13, 2016 at 11:06:16AM -0700, Bjorn Andersson wrote:
> > > I hate to send a ping,
> > 
> > Sorry about that.
> > 
> > > but do you think we can merge this fdma series? It has gone
> > > through quite a few review rounds now.
> > > 
> > 
> > I think the remoteproc part looks good.
> 
> yeah I was waiting for ack on other patches. But looks like at least
> remoteproc ones have it
> 
> 
> > Vinod, I don't have any changes queued in remoteproc that should cause
> > merge issues. If you want to you could take the remoteproc patch
> > through your tree.
> 
> I rechecked the dma part, they look good to me, so I should be able to apply
> these. I will wait a day for ack/nacks. It is the time to speak up :)

And I have applied thru 9th patch. Others are applied by Patrice.

Btw you should send drm ones to drm folks separately and not in this
series..

Thanks
-- 
~Vinod


[drm-intel:for-linux-next 12/12] drivers/gpu/drm/drm_dp_helper.c:551:2: error: implicit declaration of function 'seq_printf'

2016-09-15 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel for-linux-next
head:   80209e5f2c42c491ec5f4a63705b4377b407587c
commit: 80209e5f2c42c491ec5f4a63705b4377b407587c [12/12] drm: Add DP branch 
device info on debugfs
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 80209e5f2c42c491ec5f4a63705b4377b407587c
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_downstream_debug':
>> drivers/gpu/drm/drm_dp_helper.c:551:2: error: implicit declaration of 
>> function 'seq_printf' [-Werror=implicit-function-declaration]
 seq_printf(m, "\tDP branch device present: %s\n",
 ^
>> drivers/gpu/drm/drm_dp_helper.c:559:3: error: implicit declaration of 
>> function 'seq_puts' [-Werror=implicit-function-declaration]
  seq_puts(m, "\t\tType: DisplayPort\n");
  ^
   cc1: some warnings being treated as errors

vim +/seq_printf +551 drivers/gpu/drm/drm_dp_helper.c

   545  int len;
   546  uint8_t rev[2];
   547  int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
   548  bool branch_device = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
   549   DP_DWN_STRM_PORT_PRESENT;
   550  
 > 551  seq_printf(m, "\tDP branch device present: %s\n",
   552 branch_device ? "yes" : "no");
   553  
   554  if (!branch_device)
   555  return;
   556  
   557  switch (type) {
   558  case DP_DS_PORT_TYPE_DP:
 > 559  seq_puts(m, "\t\tType: DisplayPort\n");
   560  break;
   561  case DP_DS_PORT_TYPE_VGA:
   562  seq_puts(m, "\t\tType: VGA\n");

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
-- next part --
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 17838 bytes
Desc: not available
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/66f05fc9/attachment.obj>


[PATCH] drm/amdgpu: clean function declarations in amdgpu_ttm.c up

2016-09-15 Thread Baoyou Xie
We get 2 warnings when building kernel with W=1:

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:985:5: warning: no previous prototype 
for 'amdgpu_ttm_init' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:1092:6: warning: no previous prototype 
for 'amdgpu_ttm_fini' [-Wmissing-prototypes]

In fact, both functions are declared in
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c, but should be declared in
a header file, thus can be recognized in other file.

So this patch moves the declarations into
drivers/gpu/drm/amd/amdgpu/amdgpu.h.

Signed-off-by: Baoyou Xie 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h| 2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index a7bb862..3208608 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2402,6 +2402,8 @@ void amdgpu_gtt_location(struct amdgpu_device *adev, 
struct amdgpu_mc *mc);
 void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size);
 u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev);
 int amdgpu_ttm_global_init(struct amdgpu_device *adev);
+int amdgpu_ttm_init(struct amdgpu_device *adev);
+void amdgpu_ttm_fini(struct amdgpu_device *adev);
 void amdgpu_program_register_sequence(struct amdgpu_device *adev,
 const u32 *registers,
 const u32 array_size);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index b17734e..30f05d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -38,8 +38,6 @@
 #include "amdgpu_trace.h"


-int amdgpu_ttm_init(struct amdgpu_device *adev);
-void amdgpu_ttm_fini(struct amdgpu_device *adev);

 static u64 amdgpu_get_vis_part_size(struct amdgpu_device *adev,
struct ttm_mem_reg *mem)
-- 
2.7.4



[PATCH v10 3/3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-09-15 Thread Vinay Simha
 enable-gpio %d\n", ret);
> +   return ret;
> +   }
> +
> +   jdi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> +   if (IS_ERR(jdi->reset_gpio)) {
> +   ret = PTR_ERR(jdi->reset_gpio);
> +   dev_err(dev, "cannot get reset-gpios %d\n", ret);
> +   return ret;
> +   }
> +
> +   jdi->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
> +   if (IS_ERR(jdi->dcdc_en_gpio)) {
> +   ret = PTR_ERR(jdi->dcdc_en_gpio);
> +   dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
> +   return ret;
> +   }
> +
> +   jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi);
> +   if (IS_ERR(jdi->backlight)) {
> +   ret = PTR_ERR(jdi->backlight);
> +   dev_err(dev, "failed to register backlight %d\n", ret);
> +   return ret;
> +   }
> +
> +   drm_panel_init(>base);
> +   jdi->base.funcs = _panel_funcs;
> +   jdi->base.dev = >dsi->dev;
> +
> +   ret = drm_panel_add(>base);
> +
> +   return ret;
> +}
> +
> +static void jdi_panel_del(struct jdi_panel *jdi)
> +{
> +   if (jdi->base.dev)
> +   drm_panel_remove(>base);
> +}
> +
> +static int jdi_panel_probe(struct mipi_dsi_device *dsi)
> +{
> +   struct jdi_panel *jdi;
> +   int ret;
> +
> +   dsi->lanes = 4;
> +   dsi->format = MIPI_DSI_FMT_RGB888;
> +   dsi->mode_flags =  MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
> +  MIPI_DSI_CLOCK_NON_CONTINUOUS;
> +
> +   jdi = devm_kzalloc(>dev, sizeof(*jdi), GFP_KERNEL);
> +   if (!jdi)
> +   return -ENOMEM;
> +
> +   mipi_dsi_set_drvdata(dsi, jdi);
> +
> +   jdi->dsi = dsi;
> +
> +   ret = jdi_panel_add(jdi);
> +   if (ret < 0)
> +   return ret;
> +
> +   return mipi_dsi_attach(dsi);
> +}
> +
> +static int jdi_panel_remove(struct mipi_dsi_device *dsi)
> +{
> +   struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi);
> +   int ret;
> +
> +   ret = jdi_panel_disable(>base);
> +   if (ret < 0)
> +   dev_err(>dev, "failed to disable panel: %d\n", ret);
> +
> +   ret = mipi_dsi_detach(dsi);
> +   if (ret < 0)
> +   dev_err(>dev, "failed to detach from DSI host: %d\n",
> +   ret);
> +
> +   drm_panel_detach(>base);
> +   jdi_panel_del(jdi);
> +
> +   return 0;
> +}
> +
> +static void jdi_panel_shutdown(struct mipi_dsi_device *dsi)
> +{
> +   struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi);
> +
> +   jdi_panel_disable(>base);
> +}
> +
> +static struct mipi_dsi_driver jdi_panel_driver = {
> +   .driver = {
> +   .name = "panel-jdi-lt070me05000",
> +   .of_match_table = jdi_of_match,
> +   },
> +   .probe = jdi_panel_probe,
> +   .remove = jdi_panel_remove,
> +   .shutdown = jdi_panel_shutdown,
> +};
> +module_mipi_dsi_driver(jdi_panel_driver);
> +
> +MODULE_AUTHOR("Sumit Semwal ");
> +MODULE_AUTHOR("Vinay Simha BN ");
> +MODULE_DESCRIPTION("JDI LT070ME05000 WUXGA");
> +MODULE_LICENSE("GPL v2");
> --
> 2.1.2
>
>


-- 
regards,
vinaysimha
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/3b199c9c/attachment-0001.html>


[PATCH v4] dt-bindings: Add jdi lt070me05000 panel bindings

2016-09-15 Thread Vinay Simha
Hi Tierry,

Could you please review the patch and integrate?

On Thu, Sep 8, 2016 at 10:44 AM, Vinay Simha BN  wrote:

> Add documentation for lt070me05000 panel
>
> Cc: Archit Taneja 
> Cc: John Stultz 
> Cc: Thierry Reding 
> Cc: Sumit Semwal 
> Signed-off-by: Vinay Simha BN 
> Acked-by: Rob Herring 
>
> ---
> v2:
>  * incorporated rob herring and thierry reviews
>gpio to gpios, gpio to regulator using fixed regulators
>and pwm backlight is removed, since it is controlled by
>dcs commands
>
> v3:
>  * incorporated thierry reviews
>- Added gpio polarity details for reset-gpios
>- proper naming conventions and sequence wrt panel datasheet
>  (vddp-supply, iovcc-supply,
>   enable-gpios, reset-gpios, dcdc-en-gpios)
> v4:
>  * pinctrl-names, pinctrl-0 removed, not required for
>reset-gpios
> ---
>  .../bindings/display/panel/jdi,lt070me05000.txt| 31
> ++
>  1 file changed, 31 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/display/panel/jdi,
> lt070me05000.txt
>
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> new file mode 100644
> index 000..4989c91d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/jdi,lt070me05000.txt
> @@ -0,0 +1,31 @@
> +JDI model LT070ME05000 1200x1920 7" DSI Panel
> +
> +Required properties:
> +- compatible: should be "jdi,lt070me05000"
> +- vddp-supply: phandle of the regulator that provides the supply voltage
> +  Power IC supply (3-5V)
> +- iovcc-supply: phandle of the regulator that provides the supply voltage
> +  IOVCC , power supply for LCM (1.8V)
> +- enable-gpios: phandle of gpio for enable line
> +  LED_EN, LED backlight enable, High active
> +- reset-gpios: phandle of gpio for reset line
> +  This should be 8mA, gpio can be configured using mux, pinctrl,
> pinctrl-names
> +  XRES, Reset, Low active
> +- dcdc-en-gpios: phandle of the gpio for power ic line
> +  Power IC supply enable, High active
> +
> +Example:
> +
> +   dsi0: qcom,mdss_dsi at 470 {
> +   panel at 0 {
> +   compatible = "jdi,lt070me05000";
> +   reg = <0>;
> +
> +   vddp-supply = <_l17>;
> +   iovcc-supply = <_lvs7>;
> +
> +   enable-gpios = <_gpio 36 GPIO_ACTIVE_HIGH>;
> +   reset-gpios = <_pinmux 54 GPIO_ACTIVE_LOW>;
> +   dcdc-en-gpios = <_gpio 23 GPIO_ACTIVE_HIGH>;
> +   };
> +   };
> --
> 2.1.2
>
>


-- 
regards,
vinaysimha
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/0e99f30a/attachment-0001.html>


[PATCH] drm/radeon/radeon_device: remove unused function

2016-09-15 Thread Christian König
Am 15.09.2016 um 16:13 schrieb Baoyou Xie:
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/radeon/radeon_device.c:1961:5: warning: no previous prototype 
> for 'radeon_debugfs_init' [-Wmissing-prototypes]
> drivers/gpu/drm/radeon/radeon_device.c:1966:6: warning: no previous prototype 
> for 'radeon_debugfs_cleanup' [-Wmissing-prototypes]
>
> In fact, these functions are dummy, but can be removed,
> so this patch removes them.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König .

> ---
>   drivers/gpu/drm/radeon/radeon_device.c | 11 ---
>   drivers/gpu/drm/radeon/radeon_drv.c|  9 -
>   2 files changed, 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
> b/drivers/gpu/drm/radeon/radeon_device.c
> index a00dd2f..63447f1 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1956,14 +1956,3 @@ static void radeon_debugfs_remove_files(struct 
> radeon_device *rdev)
>   }
>   #endif
>   }
> -
> -#if defined(CONFIG_DEBUG_FS)
> -int radeon_debugfs_init(struct drm_minor *minor)
> -{
> - return 0;
> -}
> -
> -void radeon_debugfs_cleanup(struct drm_minor *minor)
> -{
> -}
> -#endif
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index 07e4493..86bab2e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -156,11 +156,6 @@ void radeon_gem_prime_vunmap(struct drm_gem_object *obj, 
> void *vaddr);
>   extern long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd,
>   unsigned long arg);
>   
> -#if defined(CONFIG_DEBUG_FS)
> -int radeon_debugfs_init(struct drm_minor *minor);
> -void radeon_debugfs_cleanup(struct drm_minor *minor);
> -#endif
> -
>   /* atpx handler */
>   #if defined(CONFIG_VGA_SWITCHEROO)
>   void radeon_register_atpx_handler(void);
> @@ -531,10 +526,6 @@ static struct drm_driver kms_driver = {
>   .disable_vblank = radeon_disable_vblank_kms,
>   .get_vblank_timestamp = radeon_get_vblank_timestamp_kms,
>   .get_scanout_position = radeon_get_crtc_scanoutpos,
> -#if defined(CONFIG_DEBUG_FS)
> - .debugfs_init = radeon_debugfs_init,
> - .debugfs_cleanup = radeon_debugfs_cleanup,
> -#endif
>   .irq_preinstall = radeon_driver_irq_preinstall_kms,
>   .irq_postinstall = radeon_driver_irq_postinstall_kms,
>   .irq_uninstall = radeon_driver_irq_uninstall_kms,




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

2016-09-15 Thread Baoyou Xie
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;
-- 
2.7.4



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

2016-09-15 Thread Ville Syrjälä
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.

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

-- 
Ville Syrjälä
Intel OTC


[PATCH v2 5/5] drm/i915: use i915_gem_open() directly instead of i915_driver_open()

2016-09-15 Thread Masahiro Yamada
2016-09-15 18:46 GMT+09:00 Jani Nikula :
> On Wed, 14 Sep 2016, Masahiro Yamada  wrote:
>> i915_driver_open() is equivalent to i915_gem_open().  Replace the
>> i915_driver_open with the direct use of i915_gem_open().
>
> Sorry I know I asked for this, but there was opposition to doing
> this. Please just do the return i915_gem_open(dev, file) version like
> you had originally.

Sure.

(I was also wondering if it is the right thing to do.)

I will send v3.





-- 
Best Regards
Masahiro Yamada


[Bug 91667] Tonga Oopses with uvd + agd5f drm-next-4.3-wip

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=91667

Andy Furniss  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #3 from Andy Furniss  ---
Not reproducible with current kernels.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/3659dfbf/attachment.html>


4.8-rc1: it is now common that machine needs re-run of xrandr after resume

2016-09-15 Thread Martin Steigerwald
Am Mittwoch, 14. September 2016, 14:14:35 CEST schrieb Jani Nikula:
> On Wed, 14 Sep 2016, Jani Nikula  wrote:
> > On Wed, 14 Sep 2016, Pavel Machek  wrote:
> >> For the "sometimes need xrandr after resume": I don't think I can
> >> bisect that. It only happens sometimes :-(. But there's something
> >> helpful in the logs:
> >> 
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] i915 :00:02.0: HDMI-A-1: EDID block 0 invalid.
> > 
> > Pavel, Martin, do you always see this when the display fails to resume?
> > Is it HDMI/DVI for both of you?
> 
> Please try this patch, backported from our next.

Was busy up to now, and weekend also quite full already.

Thing is: I didn´t see this blank screen thing with 4.8-rc6 so far. And I did 
not have above EDID stuff in my log either. So I first wait whether I see 
blank screen again and if so, then know that a test would make sense. Maybe I 
see it before I complete a rc7 or rc8 (if there will be one), then I would 
include the patch of course.

-- 
Martin


[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] drm/sti: forbid plane on several mixer

2016-09-15 Thread Ville Syrjälä
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.

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

-- 
Ville Syrjälä
Intel OTC


[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;
>  }
>


[Bug 97796] Parts of screen do not update

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97796

--- Comment #7 from Paul Menzel  ---
(In reply to Uli Schlachter from comment #6)

[…]

> Paul, do you know if --no-argb works around these problems for you?

Indeed, starting awesome with the switch `--no-argb` fixes the issue here.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/40a05f83/attachment.html>


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

2016-09-15 Thread Benjamin Gaignard
Acked-by: Benjamin Gaignard 

2016-09-15 17:12 GMT+02:00 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
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog


[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 v4 01/14] drm: Centralize format information

2016-09-15 Thread Eric Engestrom
On Thu, Sep 15, 2016 at 09:22:54AM +0300, Tomi Valkeinen wrote:
> On 15/09/16 01:22, Laurent Pinchart wrote:
> > No, the depth value is the number of colour bits, excluding the alpha bits. 
> > This is used to implement the fbdev compatibility code, as fbdev (unlike 
> > kms) 
> > makes use of that information.
> > 
> > The total number of bits per pixel is not stored in the table as it can be 
> > computed by cpp[0]*8 + (cpp[1]+cpp[2])*8/hsub/vsub. For RGB formats, which 
> > are 
> > the only formats supported by the existing drm_fb_get_bpp_depth() function, 
> > this simplifies to just cpp[0] * 8.
> 
> Ok. Then the ARGB & co. formats have depth wrong. I presumed those
> were right as they're the "normal" ones =).

Good catch, these should be 24 not 32.
I must admit I kinda skipped over that table the first time, and only
checked a few random values.
I just checked the whole table, and all the C and RGB formats are all
good (with the 4 /[ARGB]{4}/ formats set to .depth=24), and all the
YUV formats I know (~3/4) are good, but I don't know them all :)

> 
> I'm not sure if it's worth the hassle, but if the depth is only for
> fbdev compat code, maybe a separate format->depth table in fbdev code
> (for the formats fbdev supports) would make this cleaner and avoid any
> future mistakes with new drm drivers.

I agree actually, having it here will encourage anyone to use it. If you
don't want to split it out, at least add a comment along the lines of
your reply:

> > This is used to implement the fbdev compatibility code, as fbdev (unlike 
> > kms)
> > makes use of that information.

Cheers,
  Eric


[Bug 91278] Tonga GPU lock/reset fail with Unigine Valley

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=91278

Andy Furniss  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #49 from Andy Furniss  ---
I can't speak for everyone on the cc with different h/w, but on Tonga valley
has been stable for a long time, so closing.

If it's still an issue for anyone you can reopen.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/e41e1b74/attachment.html>


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


[Bug 92544] Tonga fails second resume from mem sleep.

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=92544

Andy Furniss  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Andy Furniss  ---
Current wip doesn't have this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/f87a0fe2/attachment.html>


[Bug 95399] Tonga agd5f drm-next-4.8-wip-dal Oops on startx

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95399

Andy Furniss  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Andy Furniss  ---
dal branches no longer updated, staging works OK.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/fe54920e/attachment.html>


[Bug 95306] Random Blank(black) screens on "Carrizo"

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95306

--- Comment #17 from Tom  ---
I did some more testing with AMDGPU-PRO driver (from AUR). It seems to work
without those issues but I get only a mesh up of previous session screen after
reboot or pink and white lines after cold boot.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/98f9bd42/attachment.html>


[GIT PULL] etnaviv-next for 4.9

2016-09-15 Thread Lucas Stach
Hi Dave,

this is the etnaviv feature pull-request for Linux 4.9.

Notable changes:

- Cleanups from Fabio to some error paths and proper error propagation.

- Lots of refactoring and new code to support the new MMU version 2,
still relatively unoptimized and doesn't yet provide better process
isolation than MMUv1, but enough to get newer cores up and running.

- New hardware support: GC3000, as found on the NXP i.MX6 QuadPlus SoC.

Regards,
Lucas

The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:

  Linux 4.8-rc1 (2016-08-07 18:18:00 -0700)

are available in the git repository at:

  git://git.pengutronix.de/git/lst/linux.git drm-etnaviv-next

for you to fetch changes up to 1b94a9b7d2dc26ddfd66b0d9c4533040a78cc394:

  drm/etnaviv: mark whole context as lost in recover worker (2016-09-15 
15:29:46 +0200)


Fabio Estevam (3):
  drm/etnaviv: check for errors when enabling clocks
  drm/etnaviv: remove unneeded 'fail' label
  drm/etnaviv: remove unneeded variable initialization

Lucas Stach (22):
  drm/etnaviv: take GPU lock later in the submit process
  drm/etnaviv: fold various clock enable/disable functions into top ones
  drm/etnaviv: only try to use the linear window on MMUv1
  drm/etnaviv: only check if the cmdbuf is inside the linear window on MMUv1
  drm/etnaviv: rename etnaviv_iommu_domain_restore to 
etnaviv_iommuv1_restore
  drm/etnaviv: move linear window setup into etnaviv_iommuv1_restore
  drm/etnaviv: indirect IOMMU restore through etnaviv MMU
  drm/etnaviv: move IOMMU domain allocation into etnaviv MMU
  drm/etnaviv: remove unused iommu_v2 header
  drm/etnaviv: move gpu_va() to etnaviv mmu
  drm/etnaviv: split out wait for gpu idle
  drm/etnaviv: split out FE start
  drm/etnaviv: split out iova search and MMU reaping logic
  drm/etnaviv: map cmdbuf through MMU on version 2
  drm/etnaviv: add function to construct MMUv2 init buffer
  drm/etnaviv: add flushing logic for MMUv2
  drm/etnaviv: handle MMU exception in IRQ handler
  drm/etnaviv: implement IOMMUv2 translation
  drm/etnaviv: fix up model and revision for GC2000+
  drm/etnaviv: space out IOVA layout for cmdbufs on MMUv2
  drm/etnaviv: record correct cmdbuf IOVA in dump
  drm/etnaviv: mark whole context as lost in recover worker

 drivers/gpu/drm/etnaviv/etnaviv_buffer.c   |  81 
+
 drivers/gpu/drm/etnaviv/etnaviv_drv.h  |   1 +
 drivers/gpu/drm/etnaviv/etnaviv_dump.c |   6 ++-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c  | 243 
++-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h  |   4 ++
 drivers/gpu/drm/etnaviv/etnaviv_iommu.c|  15 +--
 drivers/gpu/drm/etnaviv/etnaviv_iommu.h|  10 ++---
 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c | 261 
+--
 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.h |  25 ---
 drivers/gpu/drm/etnaviv/etnaviv_mmu.c  | 149 
-
 drivers/gpu/drm/etnaviv/etnaviv_mmu.h  |   9 +++-
 drivers/gpu/drm/etnaviv/state_hi.xml.h |   9 ++--
 12 files changed, 587 insertions(+), 226 deletions(-)
 delete mode 100644 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.h




[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



[Bug 97796] Parts of screen do not update

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97796

--- Comment #6 from Uli Schlachter  ---
By default awesome uses a visual with depth=32 for all of its windows. AFAIK
(someone who can reproduce this, please test), starting awesome with the
--no-argb argument (= use the root window's visual) makes these problems go
away. Also, AFAIK all kinds of screenshots show the correct data.

Oh and once upon a time (but couldn't reproduce) I saw Xephyr having this
problem, but moving the mouse pointer across the affected area of the tasklist
made the expected/real content visible (at least for the part that the mouse
pointer touched). I have no clue about the server, but this sounds like
software cursor "fixing" things?

Also, I could be mixing several different bugs which just have similar results.
At least the depth=32 might be a useful hint.
Paul, do you know if --no-argb works around these problems for you?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/d3a99a63/attachment.html>


[PATCH] drm/gma500: Fix possible null pointer dereference on sender

2016-09-15 Thread Colin King
From: Colin Ian King 

There is a null pointer sanity check on sender after sender is earlier
dereferenced on the intialization of drm_device dev. Move this
dereference to after sender is sanity checked to avoid the null
pointer dereference.  Issue found with static analysis using CoverityScan.

Signed-off-by: Colin Ian King 
---
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c 
b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
index 1616af2..37b1030 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
@@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender 
*sender, u8 data_type,
u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs)
 {
unsigned long flags;
-   struct drm_device *dev = sender->dev;
+   struct drm_device *dev;
int i;
u32 gen_data_reg;
int retry = MDFLD_DSI_READ_MAX_COUNT;
@@ -538,6 +538,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender 
*sender, u8 data_type,
 */
spin_lock_irqsave(>lock, flags);

+   dev = sender->dev;
REG_WRITE(sender->mipi_intr_stat_reg, BIT(29));

if ((REG_READ(sender->mipi_intr_stat_reg) & BIT(29)))
-- 
2.9.3



[PATCH] drm/amdgpu: clean function declarations in amdgpu_ttm.c up

2016-09-15 Thread Christian König
Am 15.09.2016 um 15:43 schrieb Baoyou Xie:
> We get 2 warnings when building kernel with W=1:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:985:5: warning: no previous prototype 
> for 'amdgpu_ttm_init' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:1092:6: warning: no previous 
> prototype for 'amdgpu_ttm_fini' [-Wmissing-prototypes]
>
> In fact, both functions are declared in
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c, but should be declared in
> a header file, thus can be recognized in other file.
>
> So this patch moves the declarations into
> drivers/gpu/drm/amd/amdgpu/amdgpu.h.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König .

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h| 2 ++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 --
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index a7bb862..3208608 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -2402,6 +2402,8 @@ void amdgpu_gtt_location(struct amdgpu_device *adev, 
> struct amdgpu_mc *mc);
>   void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size);
>   u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev);
>   int amdgpu_ttm_global_init(struct amdgpu_device *adev);
> +int amdgpu_ttm_init(struct amdgpu_device *adev);
> +void amdgpu_ttm_fini(struct amdgpu_device *adev);
>   void amdgpu_program_register_sequence(struct amdgpu_device *adev,
>const u32 *registers,
>const u32 array_size);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index b17734e..30f05d8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -38,8 +38,6 @@
>   #include "amdgpu_trace.h"
>   
>   
> -int amdgpu_ttm_init(struct amdgpu_device *adev);
> -void amdgpu_ttm_fini(struct amdgpu_device *adev);
>   
>   static u64 amdgpu_get_vis_part_size(struct amdgpu_device *adev,
>   struct ttm_mem_reg *mem)




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

2016-09-15 Thread Fabien Dessenne
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;

-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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));
-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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");
-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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");
-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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;
-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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;
-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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);

-- 
1.9.1



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

2016-09-15 Thread Fabien Dessenne
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;
 }
-- 
1.9.1



[PATCH 0/8] drm/sti: atomic bug fixes

2016-09-15 Thread Fabien Dessenne
This serie provides with bug fixes found while testing drm/sti with an atomic 
version of weston

[PATCH 1/8] drm/sti: fix debug logs
[PATCH 2/8] drm/sti: run hqvdp init sequence only once
[PATCH 3/8] drm/sti: run gdp init sequence only once
[PATCH 4/8] drm/sti: fix atomic_disable check
[PATCH 5/8] drm/sti: use different notifier_block for each pipe
[PATCH 6/8] drm/sti: use vtg array instead of vtg_main/aux
[PATCH 7/8] drm/sti: in crtc_atomic_flush, enable only planes of this
[PATCH 8/8] drm/sti: use valid video mode


[PATCH] DRM: i915: Fix random GPU hang, Bug 156851

2016-09-15 Thread Cheng Cao
Signed-off-by: Cheng Cao 
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |  6 
 drivers/gpu/drm/i915/i915_gem_stolen.c  | 61 -
 drivers/gpu/drm/i915/i915_reg.h |  6 
 drivers/gpu/drm/i915/intel_ringbuffer.c | 20 ++-
 4 files changed, 60 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 7a30af7..0b05dd9 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2907,6 +2907,12 @@ static unsigned int gen8_get_total_gtt_size(u16 
bdw_gmch_ctl)
if (bdw_gmch_ctl > 4)
bdw_gmch_ctl = 4;
 #endif
+#ifdef CONFIG_X86_64
+   /* Limit 64b platforms to a 4GB GGTT */
+   /* DMA 4GB protection */
+   if (bdw_gmch_ctl > 8)
+   bdw_gmch_ctl = 8;
+#endif

return bdw_gmch_ctl << 20;
 }
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 66be299a1..da272ae 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -352,47 +352,44 @@ static void gen8_get_stolen_reserved(struct 
drm_i915_private *dev_priv,
 unsigned long *base, unsigned long *size)
 {
uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
+   unsigned long stolen_top;
+   struct i915_ggtt *ggtt = _priv->ggtt;

*base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;

switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
case GEN8_STOLEN_RESERVED_1M:
-   *size = 1024 * 1024;
+   *size = 1 << 10 << 10;
break;
case GEN8_STOLEN_RESERVED_2M:
-   *size = 2 * 1024 * 1024;
+   *size = 2 << 10 << 10;
break;
case GEN8_STOLEN_RESERVED_4M:
-   *size = 4 * 1024 * 1024;
+   *size = 4 << 10 << 10;
break;
case GEN8_STOLEN_RESERVED_8M:
-   *size = 8 * 1024 * 1024;
+   *size = 8 << 10 << 10;
break;
default:
-   *size = 8 * 1024 * 1024;
-   MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
-   }
-}
-
-static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
-   unsigned long *base, unsigned long *size)
-{
-   struct i915_ggtt *ggtt = _priv->ggtt;
-   uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
-   unsigned long stolen_top;
+   /* Whatever if it is a BDW device or SKL device
+* Or others devices..
+* This way is always going to work on 5th
+* generation Intel Processer
+*/
+   stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;

-   stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
+   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;

-   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
+   /* MLIMIT - MBASE => PEG */
+   /*   -- mobile-5th-gen-core-family-datasheet-vol-2.pdf */
+   if (*base == 0) {
+   *size = 0;
+   MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
+   } else
+   *size = stolen_top - *base;

-   /* On these platforms, the register doesn't have a size field, so the
-* size is the distance between the base and the top of the stolen
-* memory. We also have the genuine case where base is zero and there's
-* nothing reserved. */
-   if (*base == 0)
-   *size = 0;
-   else
-   *size = stolen_top - *base;
+   break;
+   }
 }

 int i915_gem_init_stolen(struct drm_device *dev)
@@ -442,14 +439,14 @@ int i915_gem_init_stolen(struct drm_device *dev)
gen7_get_stolen_reserved(dev_priv, _base,
 _size);
break;
+   case 8:
+   gen8_get_stolen_reserved(dev_priv, _base,
+_size);
+   break;
default:
-   if (IS_BROADWELL(dev_priv) ||
-   IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
-   bdw_get_stolen_reserved(dev_priv, _base,
-   _size);
-   else
-   gen8_get_stolen_reserved(dev_priv, _base,
-_size);
+   // FIXME: This seemed like going to work
+   gen8_get_stolen_reserved(dev_priv, _base,
+_size);
break;
}

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index bf2cad3..3dce37b 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1748,6 +1748,12 @@ enum 

[ADV7393] DRM Encoder Slave or DRM Bridge

2016-09-15 Thread Vikas Patil
On Wed, Sep 14, 2016 at 3:04 PM, Tomi Valkeinen  
wrote:
>
>
> On 13/09/16 16:13, Vikas Patil wrote:
>> Thanks Tomi for quick comment.
>>
>> I am thinking to base adv7393 driver on
>> "drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
>> any similar to adv7393 chip driver available. Could you please comment
>> if this will help to get adv chip running?
>
> I presume you're not using mainline kernel, as that driver is not there.
> I'm not familiar with adv7393, but yes, I think you can use that as an
> example.
>

Thanks a lot for your comments. I am using latest (i.e. 3.00.00.03 )
Processor SDK Linux Automotive which is based on linux 4.4.14.

As my display panel is connected as follows. I am little confused over
the values I need to set for following properties in probe function.

DPI1/VOUT1 -16bit DRGB---> ADV7393 (Digital to Analog video
encoder) --> CVBS Out --> Display Panel


 dssdev->ops.dpi = _dpi_ops; (atv?)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DPI; (Do I need to use
OMAP_DISPLAY_TYPE_VENC, but DRA74x do not have VENC Encoder I think)
dssdev->phy.dpi.data_lines = ddata->dpi_ndl;
dssdev->port_num = 1;


As adv7393 takes 16-bit DRGB as input and gives composite as output,
does above configuration looks correct? or Do I need to change to
something else (e.g. dpi,sdi,dvi, hdmi, atv, dsi)?


>> I tried to add the device tree config but after adding device
>> configuration related to adv7393, my first display stopped working and
>> whenever I run kmscube or modetest it fails.
>
> If you don't have all the display pipelines working (i.e. the drivers
> present and working), none of the displays will work.
>
>> I have following configuration related to displays. Could anyone tell
>> me if I am doing anything wrong in DTS configuration? What could be
>> going wrong when I enable adv7393 related config so display 1 stops
>> working?
>
> The dts looks ok.
>
>  Tomi
>


[PATCH 14/26] drm/omap: dispc: Simplify _dispc_mgr_set_lcd_timings() parameters

2016-09-15 Thread Tomi Valkeinen
On 01/09/16 14:23, Peter Ujfalusi wrote:
> Instead of passing the omap_video_timings structure's members individually,
> use the pointer to the struct.
> 
> Signed-off-by: Peter Ujfalusi 
> ---
>  drivers/gpu/drm/omapdrm/dss/dispc.c | 38 
> ++---
>  1 file changed, 14 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
> b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 858d87dd7fe8..915609be7a33 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -3141,29 +3141,23 @@ bool dispc_mgr_timings_ok(enum omap_channel channel,
>   return true;
>  }
>  
> -static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int 
> hsync_len,
> - int hfp, int hbp, int vsw, int vfp, int vbp,
> - enum omap_dss_signal_level vsync_level,
> - enum omap_dss_signal_level hsync_level,
> - enum omap_dss_signal_edge data_pclk_edge,
> - enum omap_dss_signal_level de_level,
> - enum omap_dss_signal_edge sync_pclk_edge)
> -
> +static void _dispc_mgr_set_lcd_timings(enum omap_channel channel,
> +struct omap_video_timings *ovt)

const pointer?

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/5c382a69/attachment.sig>


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

2016-09-15 Thread Benjamin Gaignard
Acked-by: Benjamin Gaignard 

2016-09-14 10:20 GMT+02:00 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
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog


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

2016-09-15 Thread Benjamin Gaignard
Acked-by: Benjamin Gaignard 

2016-09-14 13:40 GMT+02:00 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
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog


[PATCH 13/26] drm/omap: omap_display_timings: Use display_flags for interlace mode

2016-09-15 Thread Tomi Valkeinen
On 01/09/16 14:23, Peter Ujfalusi wrote:
> Remove the interlace member and add display_flags to omap_video_timings to
> configure the interlace mode.
> 
> Signed-off-by: Peter Ujfalusi 
> ---


> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index aca9d3028155..97acc340dcd5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -323,8 +323,6 @@ struct omap_video_timings {
>   enum omap_dss_signal_level vsync_level;
>   /* Hsync logic level */
>   enum omap_dss_signal_level hsync_level;
> - /* Interlaced or Progressive timings */
> - bool interlace;
>   /* Pixel clock edge to drive LCD data */
>   enum omap_dss_signal_edge data_pclk_edge;
>   /* Data enable logic level */
> @@ -333,6 +331,8 @@ struct omap_video_timings {
>   enum omap_dss_signal_edge sync_pclk_edge;
>  
>   bool double_pixel;
> +
> + enum display_flags flags; /* display flags */

The comment here feels a bit pointless.

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/5477c92d/attachment.sig>


[PATCH 12/26] drm/omap: HDMI5: Use pointer to cfg->v_fc_config.timings in hdmi_core_video_config

2016-09-15 Thread Tomi Valkeinen
On 01/09/16 14:23, Peter Ujfalusi wrote:
> By using a pointer to the omap_vode_timings struct we can unwrap lines to

s/vode/mode/

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/28bc8917/attachment.sig>


[Bug 92248] [KBL/SKL/BYT/BXT] igt/kms_plane_scaling fail

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=92248

--- Comment #28 from cprigent  ---
Skip on BDW

Platform: NUC5i7RYB
CPU: Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz (Family 6, Model 61, Stepping 4)
Motherboard version: H73774-102
GPU: Intel® Iris™ Graphics 6100 - Intel Corporation Broadwell-U Integrated
Graphics (rev 09)
Memory: two 4GB card Kingston 99U5469-045.A00LF
SSD: INTEL SSDSC2KW24

Software
Bios: RYBDWi35.86A.0358.2016.0606.1423 from
https://downloadcenter.intel.com/downloads/eula/26081/BIOS-Update-RYBDWi35-86A-?httpDown=https%3A%2F%2Fdownloadmirror.intel.com%2F26081%2Feng%2FRY0358.bio
Linux distribution: Ubuntu 16.04 64 bits
Kernel: 4.8.0-rc5 bef9c1f from http://cgit.freedesktop.org/drm-intel/
  commit bef9c1f4afe24cfff578d386bde349add65673eb
  Author: Joonas Lahtinen 
  Date:   Mon Sep 12 11:35:34 2016 +0300
  drm-intel-nightly: 2016y-09m-12d-08h-35m-02s UTC integration manifest
libdrm-2.4.70-12 2d00869 from git://anongit.freedesktop.org/mesa/drm
mesa: mesa-11.2.2 3a9f628 from git://anongit.freedesktop.org/mesa/mesa
cairo 1.15.2 db8a7f1 from git://anongit.freedesktop.org/cairo
xorg-server-1.18.0-549 527c6ba from git://git.freedesktop.org/git/xorg/xserver
xf86-video-intel 2.99.917-703 15c5ff1 from
git://git.freedesktop.org/git/xorg/driver/xf86-video-intel
libva-1.7.0-47 2ebf897 from git://git.freedesktop.org/git/vaapi/libva 
vaapi-intel-driver: 1.7.0-117 8c11f51 from
git://git.freedesktop.org/git/vaapi/intel-driver
Intel-Gpu-Tools 1.16 f565b6c from
http://anongit.freedesktop.org/git/xorg/app/intel-gpu-tools.git

Let's check on the other platforms ...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/a6a9f8f5/attachment.html>


[Intel-gfx] [PATCH v9 00/12] drm/i915: DP branch devices

2016-09-15 Thread Jani Nikula
On Fri, 09 Sep 2016, Mika Kahola  wrote:
> Prep work for DP branch device handling
>
> This series of patches reads DPCD register 0x80h for receiver
> capabilities for DP branch devices. The branch device types are
> converters for the following standards
>
>  - DP to VGA
>  - DP to DVI
>  - DP to HDMI
>  - DP++ dual mode
>  - Wireless WiGig
>  
> DPCD register defines max pixel rate for VGA dongles. This
> check is carried out during mode validation. 

Pushed all except the last patch to drm-intel-next-queued, with Dave's
IRC ack on queuing the drm patches through the Intel tree.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH 04/26] drm/omap: omap_display_timings: rename x_res to hactive

2016-09-15 Thread Tomi Valkeinen
On 01/09/16 14:22, Peter Ujfalusi wrote:
> In preparation to move the stack to use the generic videmode
> struct for display timing information.

I really don't like the description to depend on the subject =).

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/fe1fe301/attachment.sig>


[PULL] drm-intel-fixes

2016-09-15 Thread Jani Nikula

Hi Dave, more Intel fixes for v4.8.

BR,
Jani.

The following changes since commit fc2780b66b15092ac68272644a522c1624c48547:

  drm/i915: Add GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE to SNB 
(2016-09-07 17:40:43 +0300)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/drm-intel-fixes-2016-09-15

for you to fetch changes up to ea54ff4008892b46c7a3e6bc8ab8aaec9d198639:

  drm/i915: Ignore OpRegion panel type except on select machines (2016-09-14 
11:25:05 +0300)


Chris Wilson (1):
  drm/i915: Restore lost "Initialized i915" welcome message

Rodrigo Vivi (1):
  Revert "drm/i915/psr: Make idle_frames sensible again"

Ville Syrjälä (1):
  drm/i915: Ignore OpRegion panel type except on select machines

 drivers/gpu/drm/i915/i915_drv.c   |  5 +
 drivers/gpu/drm/i915/intel_opregion.c | 27 +++
 drivers/gpu/drm/i915/intel_psr.c  | 14 +++---
 3 files changed, 39 insertions(+), 7 deletions(-)

-- 
Jani Nikula, Intel Open Source Technology Center


Hibernation broken since commit 274ad65c9d02 ("drm/radeon: hard reset r600 and newer GPU when hibernating.")

2016-09-15 Thread Pavel Machek
On Mon 2016-09-05 00:20:06, Sven Joachim wrote:
> Recently I got myself a new laptop with the following integrated GPU:
> 
> 00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] 
> Mullins [Radeon R3 Graphics] (rev 40)
> 
> I found that hibernation is broken in Linux 4.7+ (it works in Linux 4.6)
> and bisected it to commit 274ad65c9d02 ("drm/radeon: hard reset r600 and
> newer GPU when hibernating.").
> 
> This has already been reported three months ago, but for a much older
> GPU, see the thread starting at
> https://lists.freedesktop.org/archives/dri-devel/2016-June/110050.html.
> The symptoms are exactly the same as described by Boris Petkov in that
> thread: after "systemctl hibernate" the screen goes blank, but the
> machine remains powered on and needs to be power-cycled.

If it is still unfixed, you may want to notify regressions maintainer,
and Linus.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


[Bug 97816] EDID checksum is invalid - PHL 247ELH

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97816

--- Comment #1 from Alex Deucher  ---
The EDID parser is part of the drm core.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/16ebd280/attachment-0001.html>


[Bug 97816] EDID checksum is invalid - PHL 247ELH

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97816

Alex Deucher  changed:

   What|Removed |Added

Version|7.7 (2012.06)   |unspecified
Product|xorg|DRI
 QA Contact|xorg-team at lists.x.org   |
  Component|Driver/Radeon   |General
   Assignee|xorg-driver-ati at lists.x.org |dri-devel at 
lists.freedesktop
   ||.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/78f120db/attachment.html>


[Bug 95427] gem_userptr_blits@mlocked-* should skip due to memory pre-condition not met

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95427

cprigent  changed:

   What|Removed |Added

   Assignee|dri-devel at lists.freedesktop |intel-gfx-bugs at 
lists.freede
   |.org|sktop.org
  i915 platform||BDW
 QA Contact||intel-gfx-bugs at lists.freede
   ||sktop.org
  Component|IGT |DRM/Intel

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/201f363b/attachment.html>


[ADV7393] DRM Encoder Slave or DRM Bridge

2016-09-15 Thread Tomi Valkeinen


On 15/09/16 12:44, Vikas Patil wrote:
> On Wed, Sep 14, 2016 at 3:04 PM, Tomi Valkeinen  
> wrote:
>>
>>
>> On 13/09/16 16:13, Vikas Patil wrote:
>>> Thanks Tomi for quick comment.
>>>
>>> I am thinking to base adv7393 driver on
>>> "drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
>>> any similar to adv7393 chip driver available. Could you please comment
>>> if this will help to get adv chip running?
>>
>> I presume you're not using mainline kernel, as that driver is not there.
>> I'm not familiar with adv7393, but yes, I think you can use that as an
>> example.
>>
> 
> Thanks a lot for your comments. I am using latest (i.e. 3.00.00.03 )
> Processor SDK Linux Automotive which is based on linux 4.4.14.
> 
> As my display panel is connected as follows. I am little confused over
> the values I need to set for following properties in probe function.
> 
> DPI1/VOUT1 -16bit DRGB---> ADV7393 (Digital to Analog video
> encoder) --> CVBS Out --> Display Panel
> 
> 
>  dssdev->ops.dpi = _dpi_ops; (atv?)
> dssdev->type = OMAP_DISPLAY_TYPE_DPI;
> dssdev->output_type = OMAP_DISPLAY_TYPE_DPI; (Do I need to use
> OMAP_DISPLAY_TYPE_VENC, but DRA74x do not have VENC Encoder I think)
> dssdev->phy.dpi.data_lines = ddata->dpi_ndl;
> dssdev->port_num = 1;
> 
> 
> As adv7393 takes 16-bit DRGB as input and gives composite as output,
> does above configuration looks correct? or Do I need to change to
> something else (e.g. dpi,sdi,dvi, hdmi, atv, dsi)?

The API is quite messy (full of legacy)...

But the "ops" there are for the "downstream" direction, i.e. towards the
connector. So here you should have atv ops. You should then have
connector-analog-tv as a device after adv7393, and that connector driver
will be calling those atv ops.

adv7393 itself will be calling dpi ops, offered by the DSS.

You should set dssdev->type to DPI (that's the input).
dssdev->output_type to OMAP_DISPLAY_TYPE_VENC (output, although "venc"
is not quite correct here, but closest match we have). DRA74x doesn't
have VENC, but this is what the adv7393 outputs.

 Tomi

------ next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/819c6c95/attachment.sig>


[PATCH v4 07/14] drm: tilcdc: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

2016-09-15 Thread Jyri Sarha
On 09/15/16 12:36, Tomi Valkeinen wrote:
> On 08/09/16 17:44, 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.
>>
>> In the tilcdc_crtc_mode_set() function compute the hardware register
>> value directly from the pixel format instead of computing the number of
>> bits per pixels first.
>>
>> Signed-off-by: Laurent Pinchart 
>> Reviewed-by: Tomi Valkeinen 
>> ---
>> Changes since v3:
>>
>> - Removed DRM_FORMAT_ARGB support
>> - Fixed coding style
>> - Renamed min_pitch to pitch
>> ---
>>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c  | 15 +--
>>  drivers/gpu/drm/tilcdc/tilcdc_plane.c |  7 ---
>>  2 files changed, 9 insertions(+), 13 deletions(-)
>>
>> Cc: Jyri Sarha 
>>
>> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
>> b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
>> index 25d6b220ee8a..a64718630cdb 100644
>> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
>> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
>> @@ -67,15 +67,13 @@ static void set_scanout(struct drm_crtc *crtc, struct 
>> drm_framebuffer *fb)
>>  struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
>>  struct drm_device *dev = crtc->dev;
>>  struct drm_gem_cma_object *gem;
>> -unsigned int depth, bpp;
>>  dma_addr_t start, end;
>>  
>> -drm_fb_get_bpp_depth(fb->pixel_format, , );
>>  gem = drm_fb_cma_get_gem_obj(fb, 0);
>>  
>>  start = gem->paddr + fb->offsets[0] +
>>  crtc->y * fb->pitches[0] +
>> -crtc->x * bpp / 8;
>> +crtc->x * drm_format_plane_cpp(fb->pixel_format, 0);
>>  
>>  end = start + (crtc->mode.vdisplay * fb->pitches[0]);
>>  
>> @@ -404,16 +402,13 @@ static void tilcdc_crtc_mode_set_nofb(struct drm_crtc 
>> *crtc)
>>  if (info->tft_alt_mode)
>>  reg |= LCDC_TFT_ALT_ENABLE;
>>  if (priv->rev == 2) {
>> -unsigned int depth, bpp;
>> -
>> -drm_fb_get_bpp_depth(fb->pixel_format, , );
>> -switch (bpp) {
>> -case 16:
>> +switch (fb->pixel_format) {
>> +case DRM_FORMAT_RGB565:
>>  break;
>> -case 32:
>> +case DRM_FORMAT_XRGB:
>>  reg |= LCDC_V2_TFT_24BPP_UNPACK;
>>  /* fallthrough */
>> -case 24:
>> +case DRM_FORMAT_RGB888:
>>  reg |= LCDC_V2_TFT_24BPP_MODE;
>>  break;
> 
> Jyri, with your latest tilcdc changes, we need also BGR565, XBGR and
> BGR888 here, don't we?
> 

Yes we do.

BR,
Jyri



[PATCH v2 5/5] drm/i915: use i915_gem_open() directly instead of i915_driver_open()

2016-09-15 Thread Jani Nikula
On Wed, 14 Sep 2016, Masahiro Yamada  wrote:
> i915_driver_open() is equivalent to i915_gem_open().  Replace the
> i915_driver_open with the direct use of i915_gem_open().

Sorry I know I asked for this, but there was opposition to doing
this. Please just do the return i915_gem_open(dev, file) version like
you had originally.

Thanks,
Jani.


>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  drivers/gpu/drm/i915/i915_drv.c | 13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 7f4e8ad..d3a33c4 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1322,17 +1322,6 @@ void i915_driver_unload(struct drm_device *dev)
>   i915_driver_cleanup_early(dev_priv);
>  }
>  
> -static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
> -{
> - int ret;
> -
> - ret = i915_gem_open(dev, file);
> - if (ret)
> - return ret;
> -
> - return 0;
> -}
> -
>  /**
>   * i915_driver_lastclose - clean up after all DRM clients have exited
>   * @dev: DRM device
> @@ -2569,7 +2558,7 @@ static int intel_runtime_resume(struct device *kdev)
>   .driver_features =
>   DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME |
>   DRIVER_RENDER | DRIVER_MODESET,
> - .open = i915_driver_open,
> + .open = i915_gem_open,
>   .lastclose = i915_driver_lastclose,
>   .preclose = i915_driver_preclose,
>   .postclose = i915_driver_postclose,

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH v4 5/8] ARM: dts: am335x-boneblack: Add blue-and-red-wiring -property to LCDC node

2016-09-15 Thread Jyri Sarha
Tony,
The functional changes are now merged. But let's not merge this bbb dts
patch just yet, so we do not cause a conflict with the other bbb hdmi
audio dts change[1] that slipped into tda998x pull request. The patch
can very well wait until v4.10 if needed.

However, the other three dts patches[2] can be merged. Should I rebase
those on top of some branch and resend them?

Best regards,
Jyri

[1] https://lists.freedesktop.org/archives/dri-devel/2016-August/115269.html

[2]
https://lists.freedesktop.org/archives/dri-devel/2016-September/117282.html
https://lists.freedesktop.org/archives/dri-devel/2016-September/117283.html
https://lists.freedesktop.org/archives/dri-devel/2016-September/117284.html

On 09/01/16 12:09, Jyri Sarha wrote:
> Add blue-and-red-wiring -property to LCDC node. Also adds comments on
> how to get support 24 bit RGB mode. After this patch am335x-boneblack
> support RGB565, BGR888, and XBGR color formats. See details in
> Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt.
> 
> The BBB has straight color wiring from am335x to tda19988, however the
> tda19988 can be configured to cross the blue and red wires. The
> comments show how to do that with video-ports property of tda19988
> node and how to tell LCDC that blue and red wires are crossed, with
> blue-and-red-wiring LCDC node property. This changes supported color
> formats from 16 bit RGB and 24 bit BGR to 16 bit BGR and 24 bit RGB.
> 
> Signed-off-by: Jyri Sarha 
> ---
>  arch/arm/boot/dts/am335x-boneblack.dts | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/am335x-boneblack.dts 
> b/arch/arm/boot/dts/am335x-boneblack.dts
> index 528559b..a32d73a 100644
> --- a/arch/arm/boot/dts/am335x-boneblack.dts
> +++ b/arch/arm/boot/dts/am335x-boneblack.dts
> @@ -90,6 +90,14 @@
>  
>   {
>   status = "okay";
> +
> + /* If you want to get 24 bit RGB and 16 BGR mode instead of
> +  * current 16 bit RGB and 24 BGR modes, set the propety
> +  * below to "crossed" and uncomment the video-ports -property
> +  * in tda19988 node.
> +  */
> + blue-and-red-wiring = "straight";
> +
>   port {
>   lcdc_0: endpoint at 0 {
>   remote-endpoint = <_0>;
> @@ -106,6 +114,9 @@
>   pinctrl-0 = <_hdmi_bonelt_pins>;
>   pinctrl-1 = <_hdmi_bonelt_off_pins>;
>  
> + /* Convert 24bit BGR to RGB, e.g. cross red and blue wiring */
> + /* video-ports = <0x234501>; */
> +
>   #sound-dai-cells = <0>;
>   audio-ports = < TDA998x_I2S 0x03>;
>  
> 



[Bug 97796] Parts of screen do not update

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97796

--- Comment #5 from Paul Menzel  ---
Created attachment 126547
  --> https://bugs.freedesktop.org/attachment.cgi?id=126547=edit
Example image with offset detected by GIMP

Interestingly, opening the screenshot with GIMP it says that the PNG has an
offset.

> The PNG image you are importing specifies an offset of 192, 0. Do you want to 
> apply that offset to the layer?

Is that normal?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/32d9c220/attachment.html>


[PATCH v4 14/14] drm: Don't export the drm_fb_get_bpp_depth() function

2016-09-15 Thread Tomi Valkeinen
On 08/09/16 17:44, Laurent Pinchart wrote:
> The function is only used by the drm_helper_mode_fill_fb_struct() core
> function to fill the drm_framebuffer bpp and depth fields, used by
> drivers that haven't been converted to use pixel formats directly yet.
> It should not be used by new drivers, so inline it in its only caller.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/drm_fourcc.c | 31 ---
>  drivers/gpu/drm/drm_modeset_helper.c | 17 +++--
>  include/drm/drm_fourcc.h |  1 -
>  3 files changed, 15 insertions(+), 34 deletions(-)

Reviewed-by: Tomi Valkeinen 

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/c1236f2a/attachment.sig>


[PATCH v4 07/14] drm: tilcdc: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

2016-09-15 Thread Tomi Valkeinen
On 08/09/16 17:44, 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.
> 
> In the tilcdc_crtc_mode_set() function compute the hardware register
> value directly from the pixel format instead of computing the number of
> bits per pixels first.
> 
> Signed-off-by: Laurent Pinchart 
> Reviewed-by: Tomi Valkeinen 
> ---
> Changes since v3:
> 
> - Removed DRM_FORMAT_ARGB support
> - Fixed coding style
> - Renamed min_pitch to pitch
> ---
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c  | 15 +--
>  drivers/gpu/drm/tilcdc/tilcdc_plane.c |  7 ---
>  2 files changed, 9 insertions(+), 13 deletions(-)
> 
> Cc: Jyri Sarha 
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c 
> b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> index 25d6b220ee8a..a64718630cdb 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> @@ -67,15 +67,13 @@ static void set_scanout(struct drm_crtc *crtc, struct 
> drm_framebuffer *fb)
>   struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
>   struct drm_device *dev = crtc->dev;
>   struct drm_gem_cma_object *gem;
> - unsigned int depth, bpp;
>   dma_addr_t start, end;
>  
> - drm_fb_get_bpp_depth(fb->pixel_format, , );
>   gem = drm_fb_cma_get_gem_obj(fb, 0);
>  
>   start = gem->paddr + fb->offsets[0] +
>   crtc->y * fb->pitches[0] +
> - crtc->x * bpp / 8;
> + crtc->x * drm_format_plane_cpp(fb->pixel_format, 0);
>  
>   end = start + (crtc->mode.vdisplay * fb->pitches[0]);
>  
> @@ -404,16 +402,13 @@ static void tilcdc_crtc_mode_set_nofb(struct drm_crtc 
> *crtc)
>   if (info->tft_alt_mode)
>   reg |= LCDC_TFT_ALT_ENABLE;
>   if (priv->rev == 2) {
> - unsigned int depth, bpp;
> -
> - drm_fb_get_bpp_depth(fb->pixel_format, , );
> - switch (bpp) {
> - case 16:
> + switch (fb->pixel_format) {
> + case DRM_FORMAT_RGB565:
>   break;
> - case 32:
> + case DRM_FORMAT_XRGB:
>   reg |= LCDC_V2_TFT_24BPP_UNPACK;
>   /* fallthrough */
> - case 24:
> + case DRM_FORMAT_RGB888:
>   reg |= LCDC_V2_TFT_24BPP_MODE;
>   break;

Jyri, with your latest tilcdc changes, we need also BGR565, XBGR and
BGR888 here, don't we?

 Tomi

------ next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/aea28ddb/attachment.sig>


[PATCH] drm/tilcdc: Remove "default" from blue-and-red-wiring property binding

2016-09-15 Thread Jyri Sarha
Remove "default" keyword from blue-and-red-wiring devicetree property
binding document. The code does not support and there is no intention
to support it.

Reported-by: Rob Herring 
Signed-off-by: Jyri Sarha 
---
I sent the pull request for the color errata changes before I received
the review mail[1] from Rob Herring. This fixes the issue reported in
the mail.

[1] https://lists.freedesktop.org/archives/dri-devel/2016-September/118115.html

 Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt 
b/Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt
index a5007aa..a83abd7 100644
--- a/Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt
+++ b/Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt
@@ -17,9 +17,9 @@ Optional properties:
the lcd controller.
  - max-pixelclock: The maximum pixel clock that can be supported
by the lcd controller in KHz.
- - blue-and-red-wiring: Recognized values "default", "straight" or
-   "crossed". This property deals with the LCDC revision 2 (found on
-   AM335x) color errata [1].
+ - blue-and-red-wiring: Recognized values "straight" or "crossed".
+   This property deals with the LCDC revision 2 (found on AM335x)
+   color errata [1].
 - "straight" indicates normal wiring that supports RGB565,
   BGR888, and XBGR color formats.
 - "crossed" indicates wiring that has blue and red wires
-- 
1.9.1



[PATCH v4 04/14] drm: WARN when calling drm_format_info() for an unsupported format

2016-09-15 Thread Tomi Valkeinen
On 08/09/16 17:44, Laurent Pinchart wrote:
> The format helpers have historically treated unsupported formats as part
> of the default case, returning values that are likely wrong. We can't
> change this behaviour now without risking breaking drivers in difficult
> to detect ways, but we can WARN on unsupported formats to catch faulty
> callers.
> 
> The only exception is the framebuffer_check() function that calls
> drm_format_info() to validate the format passed from userspace. This is
> a valid use case that shouldn't generate a warning.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/drm_fourcc.c  | 32 
>  drivers/gpu/drm/drm_framebuffer.c |  2 +-
>  include/drm/drm_fourcc.h  |  1 +
>  3 files changed, 26 insertions(+), 9 deletions(-)

Reviewed-by: Tomi Valkeinen 

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/083050a3/attachment.sig>


[PATCH v4 5/8] ARM: dts: am335x-boneblack: Add blue-and-red-wiring -property to LCDC node

2016-09-15 Thread Tony Lindgren
* Jyri Sarha  [160915 02:44]:
> Tony,
> The functional changes are now merged. But let's not merge this bbb dts
> patch just yet, so we do not cause a conflict with the other bbb hdmi
> audio dts change[1] that slipped into tda998x pull request. The patch
> can very well wait until v4.10 if needed.
> 
> However, the other three dts patches[2] can be merged. Should I rebase
> those on top of some branch and resend them?

Sorry I've lost count of all the patches and about tag all my emails
as read for v4.9 merge window. So yeah it's best to resend the dts
changes separately :)

Regards,

Tony


[PATCH v3] dma-buf/sync_file: Increment refcount of fence when all are signaled.

2016-09-15 Thread Rafael Antognolli
When we merge several fences, if all of them are signaled already, we
still keep one of them. So instead of using add_fence(), which will not
increase the refcount of signaled fences, we should explicitly call
fence_get() for the fence we are keeping.

This patch fixes a kernel panic that can be triggered by creating a fence that
is expired (or increasing the timeline until it expires), then creating a
merged fence out of it, and deleting the merged fence. This will make the
original expired fence's refcount go to zero.

Testcase: igt/sw_sync/sync_expired_merge
Signed-off-by: Rafael Antognolli 
Reviewed-by: Chris Wilson 
Reviewed-by: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index abb5fda..0fe7ec2 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -253,10 +253,8 @@ static struct sync_file *sync_file_merge(const char *name, 
struct sync_file *a,
for (; i_b < b_num_fences; i_b++)
add_fence(fences, , b_fences[i_b]);

-   if (i == 0) {
-   add_fence(fences, , a_fences[0]);
-   i++;
-   }
+   if (i == 0)
+   fences[i++] = fence_get(a_fences[0]);

if (num_fences > i) {
nfences = krealloc(fences, i * sizeof(*fences),
-- 
2.7.4



[PATCH] DRM: i915: Fix random GPU hang, Bug 156851

2016-09-15 Thread Jani Nikula

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97814

On Thu, 15 Sep 2016, Cheng Cao  wrote:
> Signed-off-by: Cheng Cao 
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |  6 
>  drivers/gpu/drm/i915/i915_gem_stolen.c  | 61 
> -
>  drivers/gpu/drm/i915/i915_reg.h |  6 
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 20 ++-
>  4 files changed, 60 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 7a30af7..0b05dd9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2907,6 +2907,12 @@ static unsigned int gen8_get_total_gtt_size(u16 
> bdw_gmch_ctl)
>   if (bdw_gmch_ctl > 4)
>   bdw_gmch_ctl = 4;
>  #endif
> +#ifdef CONFIG_X86_64
> + /* Limit 64b platforms to a 4GB GGTT */
> + /* DMA 4GB protection */
> + if (bdw_gmch_ctl > 8)
> + bdw_gmch_ctl = 8;
> +#endif
>  
>   return bdw_gmch_ctl << 20;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
> b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 66be299a1..da272ae 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -352,47 +352,44 @@ static void gen8_get_stolen_reserved(struct 
> drm_i915_private *dev_priv,
>unsigned long *base, unsigned long *size)
>  {
>   uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
> + unsigned long stolen_top;
> + struct i915_ggtt *ggtt = _priv->ggtt;
>  
>   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
>  
>   switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
>   case GEN8_STOLEN_RESERVED_1M:
> - *size = 1024 * 1024;
> + *size = 1 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_2M:
> - *size = 2 * 1024 * 1024;
> + *size = 2 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_4M:
> - *size = 4 * 1024 * 1024;
> + *size = 4 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_8M:
> - *size = 8 * 1024 * 1024;
> + *size = 8 << 10 << 10;
>   break;
>   default:
> - *size = 8 * 1024 * 1024;
> - MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> - }
> -}
> -
> -static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
> - unsigned long *base, unsigned long *size)
> -{
> - struct i915_ggtt *ggtt = _priv->ggtt;
> - uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
> - unsigned long stolen_top;
> + /* Whatever if it is a BDW device or SKL device
> +  * Or others devices..
> +  * This way is always going to work on 5th
> +  * generation Intel Processer
> +  */
> + stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
>  
> - stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
> + *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
>  
> - *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
> + /* MLIMIT - MBASE => PEG */
> + /*   -- mobile-5th-gen-core-family-datasheet-vol-2.pdf */
> + if (*base == 0) {
> + *size = 0;
> + MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> + } else
> + *size = stolen_top - *base;
>  
> - /* On these platforms, the register doesn't have a size field, so the
> -  * size is the distance between the base and the top of the stolen
> -  * memory. We also have the genuine case where base is zero and there's
> -  * nothing reserved. */
> - if (*base == 0)
> - *size = 0;
> - else
> - *size = stolen_top - *base;
> + break;
> + }
>  }
>  
>  int i915_gem_init_stolen(struct drm_device *dev)
> @@ -442,14 +439,14 @@ int i915_gem_init_stolen(struct drm_device *dev)
>   gen7_get_stolen_reserved(dev_priv, _base,
>_size);
>   break;
> + case 8:
> + gen8_get_stolen_reserved(dev_priv, _base,
> +  _size);
> + break;
>   default:
> - if (IS_BROADWELL(dev_priv) ||
> - IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
> - bdw_get_stolen_reserved(dev_priv, _base,
> - _size);
> - else
> - gen8_get_stolen_reserved(dev_priv, _base,
> -  _size);
> + // FIXME: This seemed like going to work
> + gen8_get_stolen_reserved(dev_priv, _base,
> +  _size);
>   break;
>   }
>  
> diff --git 

[PATCH v6 3/3] gpu: ipu-v3: Add queued image conversion support

2016-09-15 Thread Steve Longerbeam
This patch implements image conversion support using the IC tasks, with
tiling to support scaling to and from images up to 4096x4096. Image
rotation is also supported. Image conversion requests are added to
a run queue under the IC tasks.

The internal API is subsystem agnostic (no V4L2 dependency except
for the use of V4L2 fourcc pixel formats).

Callers prepare for image conversion by calling
ipu_image_convert_prepare(), which initializes the parameters of
the conversion. The caller passes in the ipu and IC task to use for
the conversion, the input and output image formats, a rotation mode,
and a completion callback and completion context pointer:

struct ipu_image_converter_ctx *
ipu_image_convert_prepare(struct ipu_soc *ipu, enum ipu_ic_task ic_task,
  struct ipu_image *in, struct ipu_image *out,
  enum ipu_rotate_mode rot_mode,
  ipu_image_converter_cb_t complete,
  void *complete_context);

A new conversion context is created that is added to an IC task
context queue. The caller is given the new conversion context,
which can then be passed to the further APIs:

int ipu_image_convert_queue(struct ipu_image_converter_run *run);

This queues the given image conversion request run to a run queue,
and starts the conversion immediately if the run queue is empty. Only
the physaddr's of the input and output image buffers are needed,
since the conversion context was created previously with
ipu_image_convert_prepare(). When the conversion completes, the run
pointer is returned to the completion callback.

void ipu_image_convert_abort(struct ipu_image_converter_ctx *ctx);

This will abort any active or pending conversions for this context.
Any currently active or pending runs belonging to this context are
returned via the completion callback with an error status.

void ipu_image_convert_unprepare(struct ipu_image_converter_ctx *ctx);

Unprepares the conversion context. Any active or pending runs will
be aborted by calling ipu_image_convert_abort().

Signed-off-by: Steve Longerbeam 

---

v6:
- fixed call to ipu_image_convert_adjust() in ipu_image_convert_verify().

v5:
- moved all the ipu_image_convert support to ipu-image-convert.c.
  Prototypes moved to include/video/imx-image-convert.h with comment
  headers.
- removed the IC_TASK_ENCODE channels from image_convert_dma_chan[] list.
  The encode task cannnot be used by the image converter, since this
  task has no memory source IDMAC channels (buffers come directly from
  CSI).
- renamed some structs and a few of the exported APIs: struct
  image_converter is renamed ipu_image_convert_chan, ipu_image_convert_run()
  is renamed ipu_image_convert_queue().
- the ipu_ic handle passed to ipu_image_convert_prepare() is replaced by
  the IPU handle and IC task that are requested for carrying out the
  conversion. The image converter acquires the ipu_ic handle internally,
  in get_ipu_resources() along with the other resources required.
- removed .name field in the supported pixel format list, and
  ipu_image_convert_enum_format() no longer takes a char* desc arg.
- y_depth in 'struct ipu_image_pixfmt' replaced with boolean planar
  (Y pixel depth is always 8 bits).
- removed dmabuf reallocation in alloc_dma_buf().
- added lockdep_assert_held() to functions that require the irqlock.
- added IC task number to dev_dbg() output.
- exported 'struct ipu_image_convert_run'. ipu_image_convert_queue() now
  takes a run pointer. Caller must dynamically allocate and fill the run
  with a conversion context handle and the input/output buffer dma addresses,
  and free the run object when it is returned in the completion callback.
- ipu_image_convert_adjust() is now a void.

v4:
- do away with struct ipu_ic_tile_off, and move tile offsets into
  struct ipu_ic_tile. This paves the way for possibly allowing for
  each tile to have different dimensions in the future.

v3: no changes
v2: no changes
---
 drivers/gpu/ipu-v3/Makefile|3 +-
 drivers/gpu/ipu-v3/ipu-common.c|9 +
 drivers/gpu/ipu-v3/ipu-image-convert.c | 1718 
 drivers/gpu/ipu-v3/ipu-prv.h   |5 +
 include/video/imx-image-convert.h  |  207 
 5 files changed, 1941 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c
 create mode 100644 include/video/imx-image-convert.h

diff --git a/drivers/gpu/ipu-v3/Makefile b/drivers/gpu/ipu-v3/Makefile
index 107ec23..8ac08e3 100644
--- a/drivers/gpu/ipu-v3/Makefile
+++ b/drivers/gpu/ipu-v3/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o

 imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \
-   ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-smfc.o
+   ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-image-convert.o \
+   ipu-smfc.o
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index fe389dd..a1219fb 

[PATCH v6 2/3] gpu: ipu-v3: Add ipu_rot_mode_is_irt()

2016-09-15 Thread Steve Longerbeam
Add a macro that returns boolean true if the given ipu_rotate_mode
requires the use of the Image Rotator.

Signed-off-by: Steve Longerbeam 
---
 drivers/gpu/ipu-v3/ipu-ic.c |  2 +-
 include/video/imx-ipu-v3.h  | 22 +++---
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c
index 1a37afc..321eb98 100644
--- a/drivers/gpu/ipu-v3/ipu-ic.c
+++ b/drivers/gpu/ipu-v3/ipu-ic.c
@@ -619,7 +619,7 @@ int ipu_ic_task_idma_init(struct ipu_ic *ic, struct 
ipuv3_channel *channel,
ipu_ic_write(ic, ic_idmac_2, IC_IDMAC_2);
ipu_ic_write(ic, ic_idmac_3, IC_IDMAC_3);

-   if (rot >= IPU_ROTATE_90_RIGHT)
+   if (ipu_rot_mode_is_irt(rot))
ic->rotation = true;

 unlock:
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 49d5439..f39a3d6 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -63,17 +63,25 @@ enum ipu_csi_dest {
 /*
  * Enumeration of IPU rotation modes
  */
+#define IPU_ROT_BIT_VFLIP (1 << 0)
+#define IPU_ROT_BIT_HFLIP (1 << 1)
+#define IPU_ROT_BIT_90(1 << 2)
+
 enum ipu_rotate_mode {
IPU_ROTATE_NONE = 0,
-   IPU_ROTATE_VERT_FLIP,
-   IPU_ROTATE_HORIZ_FLIP,
-   IPU_ROTATE_180,
-   IPU_ROTATE_90_RIGHT,
-   IPU_ROTATE_90_RIGHT_VFLIP,
-   IPU_ROTATE_90_RIGHT_HFLIP,
-   IPU_ROTATE_90_LEFT,
+   IPU_ROTATE_VERT_FLIP = IPU_ROT_BIT_VFLIP,
+   IPU_ROTATE_HORIZ_FLIP = IPU_ROT_BIT_HFLIP,
+   IPU_ROTATE_180 = (IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP),
+   IPU_ROTATE_90_RIGHT = IPU_ROT_BIT_90,
+   IPU_ROTATE_90_RIGHT_VFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_VFLIP),
+   IPU_ROTATE_90_RIGHT_HFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_HFLIP),
+   IPU_ROTATE_90_LEFT = (IPU_ROT_BIT_90 |
+ IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP),
 };

+/* 90-degree rotations require the IRT unit */
+#define ipu_rot_mode_is_irt(m) (((m) & IPU_ROT_BIT_90) != 0)
+
 enum ipu_color_space {
IPUV3_COLORSPACE_RGB,
IPUV3_COLORSPACE_YUV,
-- 
2.7.4



[PATCH v6 1/3] gpu: ipu-v3: Add FSU channel linking support

2016-09-15 Thread Steve Longerbeam
Adds functions to link and unlink source channels to sink
channels in the FSU:

int ipu_fsu_link(struct ipu_soc *ipu, int src_ch, int sink_ch);
int ipu_fsu_unlink(struct ipu_soc *ipu, int src_ch, int sink_ch);

The channels numbers are usually IDMAC channels, but they can also be
channels that do not transfer data to or from memory. The following
convenience functions can be used in place of ipu_fsu_link/unlink()
when both source and sink channels are IDMAC channels:

int ipu_idmac_link(struct ipuv3_channel *src, struct ipuv3_channel *sink);
int ipu_idmac_unlink(struct ipuv3_channel *src, struct ipuv3_channel *sink);

So far the following links are supported:

IPUV3_CHANNEL_IC_PRP_ENC_MEM -> IPUV3_CHANNEL_MEM_ROT_ENC
PUV3_CHANNEL_IC_PRP_VF_MEM   -> IPUV3_CHANNEL_MEM_ROT_VF
IPUV3_CHANNEL_IC_PP_MEM  -> IPUV3_CHANNEL_MEM_ROT_PP
IPUV3_CHANNEL_CSI_DIRECT -> IPUV3_CHANNEL_CSI_VDI_PREV

More links can be added to the fsu_link_info[] array.

Signed-off-by: Steve Longerbeam 
---
 drivers/gpu/ipu-v3/ipu-common.c | 131 
 drivers/gpu/ipu-v3/ipu-prv.h|  27 +
 include/video/imx-ipu-v3.h  |  13 
 3 files changed, 171 insertions(+)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index d230988..fe389dd 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -730,6 +730,137 @@ void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, 
bool vdi)
 }
 EXPORT_SYMBOL_GPL(ipu_set_ic_src_mux);

+
+/* Frame Synchronization Unit Channel Linking */
+
+struct fsu_link_reg_info {
+   int chno;
+   u32 reg;
+   u32 mask;
+   u32 val;
+};
+
+struct fsu_link_info {
+   struct fsu_link_reg_info src;
+   struct fsu_link_reg_info sink;
+};
+
+static const struct fsu_link_info fsu_link_info[] = {
+   {
+   .src  = { IPUV3_CHANNEL_IC_PRP_ENC_MEM, IPU_FS_PROC_FLOW2,
+ FS_PRP_ENC_DEST_SEL_MASK, FS_PRP_ENC_DEST_SEL_IRT_ENC 
},
+   .sink = { IPUV3_CHANNEL_MEM_ROT_ENC, IPU_FS_PROC_FLOW1,
+ FS_PRPENC_ROT_SRC_SEL_MASK, FS_PRPENC_ROT_SRC_SEL_ENC 
},
+   }, {
+   .src =  { IPUV3_CHANNEL_IC_PRP_VF_MEM, IPU_FS_PROC_FLOW2,
+ FS_PRPVF_DEST_SEL_MASK, FS_PRPVF_DEST_SEL_IRT_VF },
+   .sink = { IPUV3_CHANNEL_MEM_ROT_VF, IPU_FS_PROC_FLOW1,
+ FS_PRPVF_ROT_SRC_SEL_MASK, FS_PRPVF_ROT_SRC_SEL_VF },
+   }, {
+   .src =  { IPUV3_CHANNEL_IC_PP_MEM, IPU_FS_PROC_FLOW2,
+ FS_PP_DEST_SEL_MASK, FS_PP_DEST_SEL_IRT_PP },
+   .sink = { IPUV3_CHANNEL_MEM_ROT_PP, IPU_FS_PROC_FLOW1,
+ FS_PP_ROT_SRC_SEL_MASK, FS_PP_ROT_SRC_SEL_PP },
+   }, {
+   .src =  { IPUV3_CHANNEL_CSI_DIRECT, 0 },
+   .sink = { IPUV3_CHANNEL_CSI_VDI_PREV, IPU_FS_PROC_FLOW1,
+ FS_VDI_SRC_SEL_MASK, FS_VDI_SRC_SEL_CSI_DIRECT },
+   },
+};
+
+static const struct fsu_link_info *find_fsu_link_info(int src, int sink)
+{
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(fsu_link_info); i++) {
+   if (src == fsu_link_info[i].src.chno &&
+   sink == fsu_link_info[i].sink.chno)
+   return _link_info[i];
+   }
+
+   return NULL;
+}
+
+/*
+ * Links a source channel to a sink channel in the FSU.
+ */
+int ipu_fsu_link(struct ipu_soc *ipu, int src_ch, int sink_ch)
+{
+   const struct fsu_link_info *link;
+   u32 src_reg, sink_reg;
+   unsigned long flags;
+
+   link = find_fsu_link_info(src_ch, sink_ch);
+   if (!link)
+   return -EINVAL;
+
+   spin_lock_irqsave(>lock, flags);
+
+   if (link->src.mask) {
+   src_reg = ipu_cm_read(ipu, link->src.reg);
+   src_reg &= ~link->src.mask;
+   src_reg |= link->src.val;
+   ipu_cm_write(ipu, src_reg, link->src.reg);
+   }
+
+   if (link->sink.mask) {
+   sink_reg = ipu_cm_read(ipu, link->sink.reg);
+   sink_reg &= ~link->sink.mask;
+   sink_reg |= link->sink.val;
+   ipu_cm_write(ipu, sink_reg, link->sink.reg);
+   }
+
+   spin_unlock_irqrestore(>lock, flags);
+   return 0;
+}
+EXPORT_SYMBOL_GPL(ipu_fsu_link);
+
+/*
+ * Unlinks source and sink channels in the FSU.
+ */
+int ipu_fsu_unlink(struct ipu_soc *ipu, int src_ch, int sink_ch)
+{
+   const struct fsu_link_info *link;
+   u32 src_reg, sink_reg;
+   unsigned long flags;
+
+   link = find_fsu_link_info(src_ch, sink_ch);
+   if (!link)
+   return -EINVAL;
+
+   spin_lock_irqsave(>lock, flags);
+
+   if (link->src.mask) {
+   src_reg = ipu_cm_read(ipu, link->src.reg);
+   src_reg &= ~link->src.mask;
+   ipu_cm_write(ipu, src_reg, link->src.reg);
+   }
+
+   if (link->sink.mask) {
+   sink_reg = 

[PATCH v6 0/3] IPUv3 prep for i.MX5/6 v4l2 staging drivers, v6

2016-09-15 Thread Steve Longerbeam
Fixed a missed compile error from v5. Also, although "gpu: ipu-v3: Add
FSU channel linking support" has already been accepted, need to inlcude
it again here only to allow ipu-image-convert.c to compile.

Steve Longerbeam (3):
  gpu: ipu-v3: Add FSU channel linking support
  gpu: ipu-v3: Add ipu_rot_mode_is_irt()
  gpu: ipu-v3: Add queued image conversion support

 drivers/gpu/ipu-v3/Makefile|3 +-
 drivers/gpu/ipu-v3/ipu-common.c|  140 +++
 drivers/gpu/ipu-v3/ipu-ic.c|2 +-
 drivers/gpu/ipu-v3/ipu-image-convert.c | 1718 
 drivers/gpu/ipu-v3/ipu-prv.h   |   32 +
 include/video/imx-image-convert.h  |  207 
 include/video/imx-ipu-v3.h |   35 +-
 7 files changed, 2128 insertions(+), 9 deletions(-)
 create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c
 create mode 100644 include/video/imx-image-convert.h

-- 
2.7.4



[PATCH] DRM: i915: Fix random GPU hang, Bug 156851

2016-09-15 Thread Jani Nikula

You'll still need that commit message. See 'git log' on our driver for
examples of the level of commit messages we expect. You'll also see how
to reference bugs using the Bugzilla: tag. And please do file the bug
where I asked, not somewhere else.

BR,
Jani.


On Thu, 15 Sep 2016, Cheng Cao  wrote:
> Signed-off-by: Cheng Cao 
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |  6 
>  drivers/gpu/drm/i915/i915_gem_stolen.c  | 61 
> -
>  drivers/gpu/drm/i915/i915_reg.h |  6 
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 20 ++-
>  4 files changed, 60 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 7a30af7..0b05dd9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2907,6 +2907,12 @@ static unsigned int gen8_get_total_gtt_size(u16 
> bdw_gmch_ctl)
>   if (bdw_gmch_ctl > 4)
>   bdw_gmch_ctl = 4;
>  #endif
> +#ifdef CONFIG_X86_64
> + /* Limit 64b platforms to a 4GB GGTT */
> + /* DMA 4GB protection */
> + if (bdw_gmch_ctl > 8)
> + bdw_gmch_ctl = 8;
> +#endif
>  
>   return bdw_gmch_ctl << 20;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
> b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 66be299a1..da272ae 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -352,47 +352,44 @@ static void gen8_get_stolen_reserved(struct 
> drm_i915_private *dev_priv,
>unsigned long *base, unsigned long *size)
>  {
>   uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
> + unsigned long stolen_top;
> + struct i915_ggtt *ggtt = _priv->ggtt;
>  
>   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
>  
>   switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
>   case GEN8_STOLEN_RESERVED_1M:
> - *size = 1024 * 1024;
> + *size = 1 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_2M:
> - *size = 2 * 1024 * 1024;
> + *size = 2 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_4M:
> - *size = 4 * 1024 * 1024;
> + *size = 4 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_8M:
> - *size = 8 * 1024 * 1024;
> + *size = 8 << 10 << 10;
>   break;
>   default:
> - *size = 8 * 1024 * 1024;
> - MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> - }
> -}
> -
> -static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
> - unsigned long *base, unsigned long *size)
> -{
> - struct i915_ggtt *ggtt = _priv->ggtt;
> - uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
> - unsigned long stolen_top;
> + /* Whatever if it is a BDW device or SKL device
> +  * Or others devices..
> +  * This way is always going to work on 5th
> +  * generation Intel Processer
> +  */
> + stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
>  
> - stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
> + *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
>  
> - *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
> + /* MLIMIT - MBASE => PEG */
> + /*   -- mobile-5th-gen-core-family-datasheet-vol-2.pdf */
> + if (*base == 0) {
> + *size = 0;
> + MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> + } else
> + *size = stolen_top - *base;
>  
> - /* On these platforms, the register doesn't have a size field, so the
> -  * size is the distance between the base and the top of the stolen
> -  * memory. We also have the genuine case where base is zero and there's
> -  * nothing reserved. */
> - if (*base == 0)
> - *size = 0;
> - else
> - *size = stolen_top - *base;
> + break;
> + }
>  }
>  
>  int i915_gem_init_stolen(struct drm_device *dev)
> @@ -442,14 +439,14 @@ int i915_gem_init_stolen(struct drm_device *dev)
>   gen7_get_stolen_reserved(dev_priv, _base,
>_size);
>   break;
> + case 8:
> + gen8_get_stolen_reserved(dev_priv, _base,
> +  _size);
> + break;
>   default:
> - if (IS_BROADWELL(dev_priv) ||
> - IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
> - bdw_get_stolen_reserved(dev_priv, _base,
> - _size);
> - else
> - gen8_get_stolen_reserved(dev_priv, _base,
> -  _size);
> + // 

[PATCH] DRM: i915: Fix gen8 graphics on Broadwell-U. These patches stop the random gpu hang on my XPS-13-9343, kernel version 4.8-rc5.

2016-09-15 Thread bobcao3
Signed-off-by: bobcao3 
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |  6 
 drivers/gpu/drm/i915/i915_gem_stolen.c  | 61 -
 drivers/gpu/drm/i915/i915_reg.h |  6 
 drivers/gpu/drm/i915/intel_ringbuffer.c | 19 +-
 4 files changed, 59 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 7a30af7..0b05dd9 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2907,6 +2907,12 @@ static unsigned int gen8_get_total_gtt_size(u16 
bdw_gmch_ctl)
if (bdw_gmch_ctl > 4)
bdw_gmch_ctl = 4;
 #endif
+#ifdef CONFIG_X86_64
+   /* Limit 64b platforms to a 4GB GGTT */
+   /* DMA 4GB protection */
+   if (bdw_gmch_ctl > 8)
+   bdw_gmch_ctl = 8;
+#endif

return bdw_gmch_ctl << 20;
 }
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 66be299a1..da272ae 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -352,47 +352,44 @@ static void gen8_get_stolen_reserved(struct 
drm_i915_private *dev_priv,
 unsigned long *base, unsigned long *size)
 {
uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
+   unsigned long stolen_top;
+   struct i915_ggtt *ggtt = _priv->ggtt;

*base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;

switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
case GEN8_STOLEN_RESERVED_1M:
-   *size = 1024 * 1024;
+   *size = 1 << 10 << 10;
break;
case GEN8_STOLEN_RESERVED_2M:
-   *size = 2 * 1024 * 1024;
+   *size = 2 << 10 << 10;
break;
case GEN8_STOLEN_RESERVED_4M:
-   *size = 4 * 1024 * 1024;
+   *size = 4 << 10 << 10;
break;
case GEN8_STOLEN_RESERVED_8M:
-   *size = 8 * 1024 * 1024;
+   *size = 8 << 10 << 10;
break;
default:
-   *size = 8 * 1024 * 1024;
-   MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
-   }
-}
-
-static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
-   unsigned long *base, unsigned long *size)
-{
-   struct i915_ggtt *ggtt = _priv->ggtt;
-   uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
-   unsigned long stolen_top;
+   /* Whatever if it is a BDW device or SKL device
+* Or others devices..
+* This way is always going to work on 5th
+* generation Intel Processer
+*/
+   stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;

-   stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
+   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;

-   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
+   /* MLIMIT - MBASE => PEG */
+   /*   -- mobile-5th-gen-core-family-datasheet-vol-2.pdf */
+   if (*base == 0) {
+   *size = 0;
+   MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
+   } else
+   *size = stolen_top - *base;

-   /* On these platforms, the register doesn't have a size field, so the
-* size is the distance between the base and the top of the stolen
-* memory. We also have the genuine case where base is zero and there's
-* nothing reserved. */
-   if (*base == 0)
-   *size = 0;
-   else
-   *size = stolen_top - *base;
+   break;
+   }
 }

 int i915_gem_init_stolen(struct drm_device *dev)
@@ -442,14 +439,14 @@ int i915_gem_init_stolen(struct drm_device *dev)
gen7_get_stolen_reserved(dev_priv, _base,
 _size);
break;
+   case 8:
+   gen8_get_stolen_reserved(dev_priv, _base,
+_size);
+   break;
default:
-   if (IS_BROADWELL(dev_priv) ||
-   IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
-   bdw_get_stolen_reserved(dev_priv, _base,
-   _size);
-   else
-   gen8_get_stolen_reserved(dev_priv, _base,
-_size);
+   // FIXME: This seemed like going to work
+   gen8_get_stolen_reserved(dev_priv, _base,
+_size);
break;
}

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index bf2cad3..3dce37b 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1748,6 +1748,12 @@ enum 

[PATCH] dma-buf/sync_file: Increment refcount of fence when all are signaled.

2016-09-15 Thread Chris Wilson
On Wed, Sep 14, 2016 at 04:46:18PM -0700, Rafael Antognolli wrote:
> When we merge several fences, if all of them are signaled already, we
> still keep one of them. So instead of using add_fence(), which will not
> increase the refcount of signaled fences, we should explicitly call
> fence_get() for the fence we are keeping.
> 
> This patch fixes a kernel panic that can be triggered by creating a fence that
> is expired (or increasing the timeline until it expires), then creating a
> merged fence out of it, and deleting the merged fence. This will make the
> original expired fence's refcount go to zero.
> 

Testcase: igt/sw_sync/...?
> Signed-off-by: Rafael Antognolli 

Lgtm,
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


Hibernation broken since commit 274ad65c9d02 ("drm/radeon: hard reset r600 and newer GPU when hibernating.")

2016-09-15 Thread Jerome Glisse
> On Mon, Sep 5, 2016 at 10:25 PM, Jerome Glisse  wrote:
> >> Recently I got myself a new laptop with the following integrated GPU:
> >>
> >> 00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI]
> >> Mullins [Radeon R3 Graphics] (rev 40)
> >>
> >> I found that hibernation is broken in Linux 4.7+ (it works in Linux 4.6)
> >> and bisected it to commit 274ad65c9d02 ("drm/radeon: hard reset r600 and
> >> newer GPU when hibernating.").
> >>
> >> This has already been reported three months ago, but for a much older
> >> GPU, see the thread starting at
> >> https://lists.freedesktop.org/archives/dri-devel/2016-June/110050.html.
> >> The symptoms are exactly the same as described by Boris Petkov in that
> >> thread: after "systemctl hibernate" the screen goes blank, but the
> >> machine remains powered on and needs to be power-cycled.
> >>
> >> Any suggestions would be welcome.
> >>
> >> Cheers,
> >>Sven
> >
> > I guess we can invert the logic and only do it for the GPU for which it fix
> > hibernation.
> 
> Do you remember which asics this fixed?
> 

No that's the issue, i don't have hw anymore but according to bug it is AMD 
FirePro
M5170 and M6170 which would make them amdgpu afaict but i remember the hw was 
using
radeon so i am not sure how to figure out what GPU it was really.

Bug https://bugzilla.redhat.com/show_bug.cgi?id=1269009

Cheers,
Jérôme


[PATCH v5 2/2] gpu: ipu-v3: Add queued image conversion support

2016-09-15 Thread Steve Longerbeam
This patch implements image conversion support using the IC tasks, with
tiling to support scaling to and from images up to 4096x4096. Image
rotation is also supported. Image conversion requests are added to
a run queue under the IC tasks.

The internal API is subsystem agnostic (no V4L2 dependency except
for the use of V4L2 fourcc pixel formats).

Callers prepare for image conversion by calling
ipu_image_convert_prepare(), which initializes the parameters of
the conversion. The caller passes in the ipu and IC task to use for
the conversion, the input and output image formats, a rotation mode,
and a completion callback and completion context pointer:

struct ipu_image_converter_ctx *
ipu_image_convert_prepare(struct ipu_soc *ipu, enum ipu_ic_task ic_task,
  struct ipu_image *in, struct ipu_image *out,
  enum ipu_rotate_mode rot_mode,
  ipu_image_converter_cb_t complete,
  void *complete_context);

A new conversion context is created that is added to an IC task
context queue. The caller is given the new conversion context,
which can then be passed to the further APIs:

int ipu_image_convert_queue(struct ipu_image_converter_run *run);

This queues the given image conversion request run to a run queue,
and starts the conversion immediately if the run queue is empty. Only
the physaddr's of the input and output image buffers are needed,
since the conversion context was created previously with
ipu_image_convert_prepare(). When the conversion completes, the run
pointer is returned to the completion callback.

void ipu_image_convert_abort(struct ipu_image_converter_ctx *ctx);

This will abort any active or pending conversions for this context.
Any currently active or pending runs belonging to this context are
returned via the completion callback with an error status.

void ipu_image_convert_unprepare(struct ipu_image_converter_ctx *ctx);

Unprepares the conversion context. Any active or pending runs will
be aborted by calling ipu_image_convert_abort().

Signed-off-by: Steve Longerbeam 

---

v5:
- moved all the ipu_image_convert support to ipu-image-convert.c.
  Prototypes moved to include/video/imx-image-convert.h with comment
  headers.
- removed the IC_TASK_ENCODE channels from image_convert_dma_chan[] list.
  The encode task cannnot be used by the image converter, since this
  task has no memory source IDMAC channels (buffers come directly from
  CSI).
- renamed some structs and a few of the exported APIs: struct
  image_converter is renamed ipu_image_convert_chan, ipu_image_convert_run()
  is renamed ipu_image_convert_queue().
- the ipu_ic handle passed to ipu_image_convert_prepare() is replaced by
  the IPU handle and IC task that are requested for carrying out the
  conversion. The image converter acquires the ipu_ic handle internally,
  in get_ipu_resources() along with the other resources required.
- removed .name field in the supported pixel format list, and
  ipu_image_convert_enum_format() no longer takes a char* desc arg.
- y_depth in 'struct ipu_image_pixfmt' replaced with boolean planar
  (Y pixel depth is always 8 bits).
- removed dmabuf reallocation in alloc_dma_buf().
- added lockdep_assert_held() to functions that require the irqlock.
- added IC task number to dev_dbg() output.
- exported 'struct ipu_image_convert_run'. ipu_image_convert_queue() now
  takes a run pointer. Caller must dynamically allocate and fill the run
  with a conversion context handle and the input/output buffer dma addresses,
  and free the run object when it is returned in the completion callback.
- ipu_image_convert_adjust() is now a void.

v4:
- do away with struct ipu_ic_tile_off, and move tile offsets into
  struct ipu_ic_tile. This paves the way for possibly allowing for
  each tile to have different dimensions in the future.

v3: no changes
v2: no changes
---
 drivers/gpu/ipu-v3/Makefile|3 +-
 drivers/gpu/ipu-v3/ipu-common.c|9 +
 drivers/gpu/ipu-v3/ipu-image-convert.c | 1721 
 drivers/gpu/ipu-v3/ipu-prv.h   |5 +
 include/video/imx-image-convert.h  |  207 
 5 files changed, 1944 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c
 create mode 100644 include/video/imx-image-convert.h

diff --git a/drivers/gpu/ipu-v3/Makefile b/drivers/gpu/ipu-v3/Makefile
index 107ec23..8ac08e3 100644
--- a/drivers/gpu/ipu-v3/Makefile
+++ b/drivers/gpu/ipu-v3/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o

 imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \
-   ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-smfc.o
+   ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-image-convert.o \
+   ipu-smfc.o
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index d230988..5136d66 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ 

[PATCH v5 1/2] gpu: ipu-v3: Add ipu_rot_mode_is_irt()

2016-09-15 Thread Steve Longerbeam
Add a macro that returns boolean true if the given ipu_rotate_mode
requires the use of the Image Rotator.

Signed-off-by: Steve Longerbeam 
---
 drivers/gpu/ipu-v3/ipu-ic.c |  2 +-
 include/video/imx-ipu-v3.h  | 22 +++---
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c
index 1a37afc..321eb98 100644
--- a/drivers/gpu/ipu-v3/ipu-ic.c
+++ b/drivers/gpu/ipu-v3/ipu-ic.c
@@ -619,7 +619,7 @@ int ipu_ic_task_idma_init(struct ipu_ic *ic, struct 
ipuv3_channel *channel,
ipu_ic_write(ic, ic_idmac_2, IC_IDMAC_2);
ipu_ic_write(ic, ic_idmac_3, IC_IDMAC_3);

-   if (rot >= IPU_ROTATE_90_RIGHT)
+   if (ipu_rot_mode_is_irt(rot))
ic->rotation = true;

 unlock:
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index c3de740..fbbbecf 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -63,17 +63,25 @@ enum ipu_csi_dest {
 /*
  * Enumeration of IPU rotation modes
  */
+#define IPU_ROT_BIT_VFLIP (1 << 0)
+#define IPU_ROT_BIT_HFLIP (1 << 1)
+#define IPU_ROT_BIT_90(1 << 2)
+
 enum ipu_rotate_mode {
IPU_ROTATE_NONE = 0,
-   IPU_ROTATE_VERT_FLIP,
-   IPU_ROTATE_HORIZ_FLIP,
-   IPU_ROTATE_180,
-   IPU_ROTATE_90_RIGHT,
-   IPU_ROTATE_90_RIGHT_VFLIP,
-   IPU_ROTATE_90_RIGHT_HFLIP,
-   IPU_ROTATE_90_LEFT,
+   IPU_ROTATE_VERT_FLIP = IPU_ROT_BIT_VFLIP,
+   IPU_ROTATE_HORIZ_FLIP = IPU_ROT_BIT_HFLIP,
+   IPU_ROTATE_180 = (IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP),
+   IPU_ROTATE_90_RIGHT = IPU_ROT_BIT_90,
+   IPU_ROTATE_90_RIGHT_VFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_VFLIP),
+   IPU_ROTATE_90_RIGHT_HFLIP = (IPU_ROT_BIT_90 | IPU_ROT_BIT_HFLIP),
+   IPU_ROTATE_90_LEFT = (IPU_ROT_BIT_90 |
+ IPU_ROT_BIT_VFLIP | IPU_ROT_BIT_HFLIP),
 };

+/* 90-degree rotations require the IRT unit */
+#define ipu_rot_mode_is_irt(m) (((m) & IPU_ROT_BIT_90) != 0)
+
 enum ipu_color_space {
IPUV3_COLORSPACE_RGB,
IPUV3_COLORSPACE_YUV,
-- 
2.7.4



[PATCH v5 0/2] IPUv3 prep for i.MX5/6 v4l2 staging drivers, v5

2016-09-15 Thread Steve Longerbeam
This now contains only the queued image conversion support, along
with a split-out patch that adds macro ipu_rot_mode_is_irt().

Steve Longerbeam (2):
  gpu: ipu-v3: Add ipu_rot_mode_is_irt()
  gpu: ipu-v3: Add queued image conversion support

 drivers/gpu/ipu-v3/Makefile|3 +-
 drivers/gpu/ipu-v3/ipu-common.c|9 +
 drivers/gpu/ipu-v3/ipu-ic.c|2 +-
 drivers/gpu/ipu-v3/ipu-image-convert.c | 1721 
 drivers/gpu/ipu-v3/ipu-prv.h   |5 +
 include/video/imx-image-convert.h  |  207 
 include/video/imx-ipu-v3.h |   22 +-
 7 files changed, 1960 insertions(+), 9 deletions(-)
 create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c
 create mode 100644 include/video/imx-image-convert.h

-- 
2.7.4



[PATCH] dma-buf/sync_file: Increment refcount of fence when all are signaled.

2016-09-15 Thread Gustavo Padovan
Hi Rafael,

2016-09-14 Rafael Antognolli :

> When we merge several fences, if all of them are signaled already, we
> still keep one of them. So instead of using add_fence(), which will not
> increase the refcount of signaled fences, we should explicitly call
> fence_get() for the fence we are keeping.
> 
> This patch fixes a kernel panic that can be triggered by creating a fence that
> is expired (or increasing the timeline until it expires), then creating a
> merged fence out of it, and deleting the merged fence. This will make the
> original expired fence's refcount go to zero.
> 
> Signed-off-by: Rafael Antognolli 
> ---
>  drivers/dma-buf/sync_file.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)

Yes, mention the igt test case would be good.

Otherwise:

Reviewed-by: Gustavo Padovan 

Gustavo


[PATCH v2 4/5] drm/qxl: squash lines for simple wrapper functions

2016-09-15 Thread Gustavo Padovan
2016-09-14 Masahiro Yamada :

> Remove unneeded variables and assignments.
> 
> Signed-off-by: Masahiro Yamada 
> ---
> 
>  drivers/gpu/drm/qxl/qxl_draw.c| 7 ++-
>  drivers/gpu/drm/qxl/qxl_release.c | 7 ++-
>  2 files changed, 4 insertions(+), 10 deletions(-)

For patches 1 to 4:

Reviewed-by: Gustavo Padovan 

Gustavo


[PATCH v2 3/5] drm/bridge: squash lines for simple wrapper functions

2016-09-15 Thread Sean Paul
On Thu, Sep 15, 2016 at 9:51 AM, Sean Paul  wrote:
> On Wed, Sep 14, 2016 at 10:39 AM, Masahiro Yamada
>  wrote:
>> Remove unneeded variables and assignments.
>>
>> Signed-off-by: Masahiro Yamada 
>
> Reviewed-by: Sean Paul 
>

Decided to apply patches 1-4 to drm-misc

Thanks,

Sean

>> ---
>>
>>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 
>>  1 file changed, 4 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c 
>> b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
>> index 52c1b6b..fae0293 100644
>> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
>> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
>> @@ -1073,34 +1073,22 @@ void analogix_dp_set_lane3_link_training(struct 
>> analogix_dp_device *dp,
>>
>>  u32 analogix_dp_get_lane0_link_training(struct analogix_dp_device *dp)
>>  {
>> -   u32 reg;
>> -
>> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
>> -   return reg;
>> +   return readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
>>  }
>>
>>  u32 analogix_dp_get_lane1_link_training(struct analogix_dp_device *dp)
>>  {
>> -   u32 reg;
>> -
>> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
>> -   return reg;
>> +   return readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
>>  }
>>
>>  u32 analogix_dp_get_lane2_link_training(struct analogix_dp_device *dp)
>>  {
>> -   u32 reg;
>> -
>> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
>> -   return reg;
>> +   return readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
>>  }
>>
>>  u32 analogix_dp_get_lane3_link_training(struct analogix_dp_device *dp)
>>  {
>> -   u32 reg;
>> -
>> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL);
>> -   return reg;
>> +   return readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL);
>>  }
>>
>>  void analogix_dp_reset_macro(struct analogix_dp_device *dp)
>> --
>> 1.9.1
>>


[PATCH v2 4/5] drm/qxl: squash lines for simple wrapper functions

2016-09-15 Thread Sean Paul
On Thu, Sep 15, 2016 at 9:47 AM, Gustavo Padovan  wrote:
> 2016-09-14 Masahiro Yamada :
>
>> Remove unneeded variables and assignments.
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>  drivers/gpu/drm/qxl/qxl_draw.c| 7 ++-
>>  drivers/gpu/drm/qxl/qxl_release.c | 7 ++-
>>  2 files changed, 4 insertions(+), 10 deletions(-)
>
> For patches 1 to 4:
>
> Reviewed-by: Gustavo Padovan 



Applied to drm-misc

Sean

>
> Gustavo
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/5] drm/amdgpu: squash lines for simple wrapper functions

2016-09-15 Thread Sean Paul
On Wed, Sep 14, 2016 at 10:39 AM, Masahiro Yamada
 wrote:
> Remove unneeded variables and assignments.
>
> Signed-off-by: Masahiro Yamada 


Applied to drm-misc

Sean

> ---
>
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 6 +-
>  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   | 6 +-
>  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 6 +-
>  3 files changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 00663a7..619b604 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -466,11 +466,7 @@ static int dce_virtual_suspend(void *handle)
>
>  static int dce_virtual_resume(void *handle)
>  {
> -   int ret;
> -
> -   ret = dce_virtual_hw_init(handle);
> -
> -   return ret;
> +   return dce_virtual_hw_init(handle);
>  }
>
>  static bool dce_virtual_is_idle(void *handle)
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c 
> b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> index 2b10e88..3d01291 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> @@ -190,12 +190,8 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device 
> *adev)
>   */
>  static uint32_t sdma_v2_4_ring_get_rptr(struct amdgpu_ring *ring)
>  {
> -   u32 rptr;
> -
> /* XXX check if swapping is necessary on BE */
> -   rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2;
> -
> -   return rptr;
> +   return ring->adev->wb.wb[ring->rptr_offs] >> 2;
>  }
>
>  /**
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c 
> b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> index bee4978..ddb8081 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> @@ -335,12 +335,8 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device 
> *adev)
>   */
>  static uint32_t sdma_v3_0_ring_get_rptr(struct amdgpu_ring *ring)
>  {
> -   u32 rptr;
> -
> /* XXX check if swapping is necessary on BE */
> -   rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2;
> -
> -   return rptr;
> +   return ring->adev->wb.wb[ring->rptr_offs] >> 2;
>  }
>
>  /**
> --
> 1.9.1
>


[PATCH v2 2/5] drm/radeon: squash lines for simple wrapper functions

2016-09-15 Thread Sean Paul
On Wed, Sep 14, 2016 at 10:39 AM, Masahiro Yamada
 wrote:
> Remove unneeded variables and assignments.
>
> Signed-off-by: Masahiro Yamada 

Applied to drm-misc

Sean

> ---
>
>  drivers/gpu/drm/radeon/cik.c  | 6 +-
>  drivers/gpu/drm/radeon/r100.c | 6 +-
>  drivers/gpu/drm/radeon/r600.c | 6 +-
>  3 files changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index b1784a1..f6ff41a 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -4193,11 +4193,7 @@ u32 cik_gfx_get_rptr(struct radeon_device *rdev,
>  u32 cik_gfx_get_wptr(struct radeon_device *rdev,
>  struct radeon_ring *ring)
>  {
> -   u32 wptr;
> -
> -   wptr = RREG32(CP_RB0_WPTR);
> -
> -   return wptr;
> +   return RREG32(CP_RB0_WPTR);
>  }
>
>  void cik_gfx_set_wptr(struct radeon_device *rdev,
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index f25994b..f5e84f4 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -1071,11 +1071,7 @@ u32 r100_gfx_get_rptr(struct radeon_device *rdev,
>  u32 r100_gfx_get_wptr(struct radeon_device *rdev,
>   struct radeon_ring *ring)
>  {
> -   u32 wptr;
> -
> -   wptr = RREG32(RADEON_CP_RB_WPTR);
> -
> -   return wptr;
> +   return RREG32(RADEON_CP_RB_WPTR);
>  }
>
>  void r100_gfx_set_wptr(struct radeon_device *rdev,
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 6406536..a951881 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -2631,11 +2631,7 @@ u32 r600_gfx_get_rptr(struct radeon_device *rdev,
>  u32 r600_gfx_get_wptr(struct radeon_device *rdev,
>   struct radeon_ring *ring)
>  {
> -   u32 wptr;
> -
> -   wptr = RREG32(R600_CP_RB_WPTR);
> -
> -   return wptr;
> +   return RREG32(R600_CP_RB_WPTR);
>  }
>
>  void r600_gfx_set_wptr(struct radeon_device *rdev,
> --
> 1.9.1
>


[PATCH] drm: Only use compat ioctl for addfb2 on X86/IA64

2016-09-15 Thread Sean Paul
On Wed, Sep 14, 2016 at 1:00 PM, Rob Clark  wrote:
> On Tue, Sep 13, 2016 at 5:20 PM, Kristian H. Kristensen
>  wrote:
>> Similar to struct drm_update_draw, struct drm_mode_fb_cmd2 has an
>> unaligned 64 bit field (modifier). This get packed differently between
>> 32 bit and 64 bit modes on architectures that can handle unaligned 64
>> bit access (X86 and IA64).  Other architectures pack the structs the
>> same and don't need the compat wrapper. Use the same condition for
>> drm_mode_fb_cmd2 as we use for drm_update_draw.
>
> might not hurt to mention that this only effects stuff using modifiers
> in commit msg
>
> Reviewed-by: Rob Clark 


Added the note to the commit msg and applied to drm-misc

Sean

>
>> Signed-off-by: Kristian H. Kristensen 
>> ---
>>  drivers/gpu/drm/drm_ioc32.c | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
>> index 57676f8..a628975 100644
>> --- a/drivers/gpu/drm/drm_ioc32.c
>> +++ b/drivers/gpu/drm/drm_ioc32.c
>> @@ -1015,6 +1015,7 @@ static int compat_drm_wait_vblank(struct file *file, 
>> unsigned int cmd,
>> return 0;
>>  }
>>
>> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
>>  typedef struct drm_mode_fb_cmd232 {
>> u32 fb_id;
>> u32 width;
>> @@ -1071,6 +1072,7 @@ static int compat_drm_mode_addfb2(struct file *file, 
>> unsigned int cmd,
>>
>> return 0;
>>  }
>> +#endif
>>
>>  static drm_ioctl_compat_t *drm_compat_ioctls[] = {
>> [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version,
>> @@ -1104,7 +1106,9 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = {
>> [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw,
>>  #endif
>> [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank,
>> +#if defined(CONFIG_X86) || defined(CONFIG_IA64)
>> [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2,
>> +#endif
>>  };
>>
>>  /**
>> --
>> 2.8.0.rc3.226.g39d4020
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] dma-buf/sync_file: Increment refcount of fence when all are signaled.

2016-09-15 Thread Rafael Antognolli
When we merge several fences, if all of them are signaled already, we
still keep one of them. So instead of using add_fence(), which will not
increase the refcount of signaled fences, we should explicitly call
fence_get() for the fence we are keeping.

This patch fixes a kernel panic that can be triggered by creating a fence that
is expired (or increasing the timeline until it expires), then creating a
merged fence out of it, and deleting the merged fence. This will make the
original expired fence's refcount go to zero.

Testcase: igt/sw_sync/sync_expired_merge
Signed-off-by: Rafael Antognolli 
---
 drivers/dma-buf/sync_file.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index abb5fda..0fe7ec2 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -253,10 +253,8 @@ static struct sync_file *sync_file_merge(const char *name, 
struct sync_file *a,
for (; i_b < b_num_fences; i_b++)
add_fence(fences, , b_fences[i_b]);

-   if (i == 0) {
-   add_fence(fences, , a_fences[0]);
-   i++;
-   }
+   if (i == 0)
+   fences[i++] = fence_get(a_fences[0]);

if (num_fences > i) {
nfences = krealloc(fences, i * sizeof(*fences),
-- 
2.7.4



Hibernation broken since commit 274ad65c9d02 ("drm/radeon: hard reset r600 and newer GPU when hibernating.")

2016-09-15 Thread Alex Deucher
On Mon, Sep 5, 2016 at 10:25 PM, Jerome Glisse  wrote:
>> Recently I got myself a new laptop with the following integrated GPU:
>>
>> 00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI]
>> Mullins [Radeon R3 Graphics] (rev 40)
>>
>> I found that hibernation is broken in Linux 4.7+ (it works in Linux 4.6)
>> and bisected it to commit 274ad65c9d02 ("drm/radeon: hard reset r600 and
>> newer GPU when hibernating.").
>>
>> This has already been reported three months ago, but for a much older
>> GPU, see the thread starting at
>> https://lists.freedesktop.org/archives/dri-devel/2016-June/110050.html.
>> The symptoms are exactly the same as described by Boris Petkov in that
>> thread: after "systemctl hibernate" the screen goes blank, but the
>> machine remains powered on and needs to be power-cycled.
>>
>> Any suggestions would be welcome.
>>
>> Cheers,
>>Sven
>
> I guess we can invert the logic and only do it for the GPU for which it fix
> hibernation.

Do you remember which asics this fixed?

Alex

>
> Cheers,
> Jérôme
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/8] drm/rockchip: Flip wait clean-up

2016-09-15 Thread Sean Paul
On Wed, Sep 14, 2016 at 8:54 AM, Tomasz Figa  wrote:
> The display controller found on Rockchip SoCs supported by Rockchip DRM
> driver (VOP) is a bit problematic, because it does not provide hardware
> vblank counter. Because vblank interrupt is used to feed the software
> counter, the driver had custom code to wait for flip completion to avoid
> race between atomic flush and vblank interrupt handler.
>
> This, however, brought a different set of issues. In fact, even with the
> custom wait code, there is stil a race between the handler and driver
> state update (of the values used to compare with registers to determine
> if flip has completed). On top of that, legacy cursor updates are not
> implemented properly and have to wait for vblank to complete, which
> is against the API specification.
>
> This series attempts to clean up the driver from this custom waiting code,
> eliminating related races and bringing correct handling of legacy cursor
> plane. It also gives a nice effect of more than 100 lines of code removed.
>
> This is a forward port of patches from 4.4 kernel used by ChromiumOS and
> tested there. Even though the code base has not changed significantly, it
> would be nice if someone with proper testing environment could give them
> a try.
>
> Based on for-next branch of Sean Paul's dogwood tree:
> https://cgit.freedesktop.org/~seanpaul/dogwood/log/?h=for-next
> git://people.freedesktop.org/~seanpaul/dogwood
>

Thanks for the patches, Tomasz.

I'll queue them up in my rockchip for-next branch.

Sean



> Tomasz Figa (8):
>   drm/rockchip: Clear interrupt status bits before enabling
>   drm/rockchip: Get rid of some unnecessary code
>   drm/rockchip: Avoid race with vblank count increment
>   drm/rockchip: Unreference framebuffers from flip work
>   drm/rockchip: Replace custom wait_for_vblanks with helper
>   drm/rockchip: Do not enable vblank without event
>   drm/rockchip: Always signal event in next vblank after cfg_done
>   drm/rockchip: Kill vop_plane_state
>
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   1 -
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c  |  64 +--
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 247 
> +++-
>  3 files changed, 95 insertions(+), 217 deletions(-)
>
> --
> 2.8.0.rc3.226.g39d4020
>


[PATCH] DRM: i915: Fix gen8 graphics on Broadwell-U. These patches stop the random gpu hang on my XPS-13-9343, kernel version 4.8-rc5.

2016-09-15 Thread Jani Nikula

On Thu, 15 Sep 2016, bobcao3  wrote:
> DRM: i915: Fix gen8 graphics on Broadwell-U. These patches stop the
> random gpu hang on my XPS-13-9343, kernel version 4.8-rc5.

Please do everyone a favor and file a bug on the hangs over at [1],
describing the issue and attaching the error state etc. After that,
referencing the bug in a patch fixing the issue goes a long way for
justifying the patch. What you have here isn't enough.

BR,
Jani.


[1] https://bugs.freedesktop.org/enter_bug.cgi?product=DRI=DRM/Intel


On Thu, 15 Sep 2016, bobcao3  wrote:
> Signed-off-by: bobcao3 
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |  6 
>  drivers/gpu/drm/i915/i915_gem_stolen.c  | 61 
> -
>  drivers/gpu/drm/i915/i915_reg.h |  6 
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 19 +-
>  4 files changed, 59 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 7a30af7..0b05dd9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2907,6 +2907,12 @@ static unsigned int gen8_get_total_gtt_size(u16 
> bdw_gmch_ctl)
>   if (bdw_gmch_ctl > 4)
>   bdw_gmch_ctl = 4;
>  #endif
> +#ifdef CONFIG_X86_64
> + /* Limit 64b platforms to a 4GB GGTT */
> + /* DMA 4GB protection */
> + if (bdw_gmch_ctl > 8)
> + bdw_gmch_ctl = 8;
> +#endif
>  
>   return bdw_gmch_ctl << 20;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
> b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 66be299a1..da272ae 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -352,47 +352,44 @@ static void gen8_get_stolen_reserved(struct 
> drm_i915_private *dev_priv,
>unsigned long *base, unsigned long *size)
>  {
>   uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
> + unsigned long stolen_top;
> + struct i915_ggtt *ggtt = _priv->ggtt;
>  
>   *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
>  
>   switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
>   case GEN8_STOLEN_RESERVED_1M:
> - *size = 1024 * 1024;
> + *size = 1 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_2M:
> - *size = 2 * 1024 * 1024;
> + *size = 2 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_4M:
> - *size = 4 * 1024 * 1024;
> + *size = 4 << 10 << 10;
>   break;
>   case GEN8_STOLEN_RESERVED_8M:
> - *size = 8 * 1024 * 1024;
> + *size = 8 << 10 << 10;
>   break;
>   default:
> - *size = 8 * 1024 * 1024;
> - MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> - }
> -}
> -
> -static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
> - unsigned long *base, unsigned long *size)
> -{
> - struct i915_ggtt *ggtt = _priv->ggtt;
> - uint32_t reg_val = I915_READ(GEN6_STOLEN_RESERVED);
> - unsigned long stolen_top;
> + /* Whatever if it is a BDW device or SKL device
> +  * Or others devices..
> +  * This way is always going to work on 5th
> +  * generation Intel Processer
> +  */
> + stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
>  
> - stolen_top = dev_priv->mm.stolen_base + ggtt->stolen_size;
> + *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
>  
> - *base = reg_val & GEN6_STOLEN_RESERVED_ADDR_MASK;
> + /* MLIMIT - MBASE => PEG */
> + /*   -- mobile-5th-gen-core-family-datasheet-vol-2.pdf */
> + if (*base == 0) {
> + *size = 0;
> + MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> + } else
> + *size = stolen_top - *base;
>  
> - /* On these platforms, the register doesn't have a size field, so the
> -  * size is the distance between the base and the top of the stolen
> -  * memory. We also have the genuine case where base is zero and there's
> -  * nothing reserved. */
> - if (*base == 0)
> - *size = 0;
> - else
> - *size = stolen_top - *base;
> + break;
> + }
>  }
>  
>  int i915_gem_init_stolen(struct drm_device *dev)
> @@ -442,14 +439,14 @@ int i915_gem_init_stolen(struct drm_device *dev)
>   gen7_get_stolen_reserved(dev_priv, _base,
>_size);
>   break;
> + case 8:
> + gen8_get_stolen_reserved(dev_priv, _base,
> +  _size);
> + break;
>   default:
> - if (IS_BROADWELL(dev_priv) ||
> - IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
> - 

[PATCH v2 3/5] drm/bridge: squash lines for simple wrapper functions

2016-09-15 Thread Sean Paul
On Wed, Sep 14, 2016 at 10:39 AM, Masahiro Yamada
 wrote:
> Remove unneeded variables and assignments.
>
> Signed-off-by: Masahiro Yamada 

Reviewed-by: Sean Paul 

> ---
>
>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c 
> b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> index 52c1b6b..fae0293 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> @@ -1073,34 +1073,22 @@ void analogix_dp_set_lane3_link_training(struct 
> analogix_dp_device *dp,
>
>  u32 analogix_dp_get_lane0_link_training(struct analogix_dp_device *dp)
>  {
> -   u32 reg;
> -
> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
> -   return reg;
> +   return readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
>  }
>
>  u32 analogix_dp_get_lane1_link_training(struct analogix_dp_device *dp)
>  {
> -   u32 reg;
> -
> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
> -   return reg;
> +   return readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
>  }
>
>  u32 analogix_dp_get_lane2_link_training(struct analogix_dp_device *dp)
>  {
> -   u32 reg;
> -
> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
> -   return reg;
> +   return readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
>  }
>
>  u32 analogix_dp_get_lane3_link_training(struct analogix_dp_device *dp)
>  {
> -   u32 reg;
> -
> -   reg = readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL);
> -   return reg;
> +   return readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL);
>  }
>
>  void analogix_dp_reset_macro(struct analogix_dp_device *dp)
> --
> 1.9.1
>


[PATCH] drm/radeon/radeon_device: clean function declarations in radeon_device.c up

2016-09-15 Thread Christian König
Am 14.09.2016 um 09:35 schrieb Baoyou Xie:
>
>
> On 14 September 2016 at 15:22, Christian König 
> mailto:christian.koenig at amd.com>> wrote:
>
> Am 14.09.2016 um 08:10 schrieb Baoyou Xie:
>
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/radeon/radeon_device.c:1961:5: warning: no
> previous prototype for 'radeon_debugfs_init'
> [-Wmissing-prototypes]
> drivers/gpu/drm/radeon/radeon_device.c:1966:6: warning: no
> previous prototype for 'radeon_debugfs_cleanup'
> [-Wmissing-prototypes]
>
> In fact, both functions are declared in
> drivers/gpu/drm/radeon/radeon_drv.c, but should be declared in
> a header file, thus can be recognized in other file.
>
> So this patch moves the declarations into
> drivers/gpu/drm/radeon/radeon.h.
>
> Signed-off-by: Baoyou Xie  <mailto:baoyou.xie at linaro.org>>
>
>
> Actually if I see it correctly we could also just remove the two
> callbacks cause they are optional and our implementations are just
> empty dummys.
>
>
> Is it sure? if true, we can simply remove them.

Yeah, they are just empty skeletons as far as I can see.

>
> someone maybe implementation these functions in order to support debugfs.

Well then someone can also add back the skeleton functions as well.

Regards,
Christian.

> Christian.
>
>
> ---
>   drivers/gpu/drm/radeon/radeon_device.c | 1 +
>   drivers/gpu/drm/radeon/radeon_drv.c| 5 -
>   drivers/gpu/drm/radeon/radeon_drv.h| 5 +
>   3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c
> b/drivers/gpu/drm/radeon/radeon_device.c
> index a00dd2f..811abde 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -36,6 +36,7 @@
>   #include 
>   #include "radeon_reg.h"
>   #include "radeon.h"
> +#include "radeon_drv.h"
>   #include "atom.h"
> static const char radeon_family_name[][16] = {
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index 07e4493..6cc4a9e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -156,11 +156,6 @@ void radeon_gem_prime_vunmap(struct
> drm_gem_object *obj, void *vaddr);
>   extern long radeon_kms_compat_ioctl(struct file *filp,
> unsigned int cmd,
> unsigned long arg);
>   -#if defined(CONFIG_DEBUG_FS)
> -int radeon_debugfs_init(struct drm_minor *minor);
> -void radeon_debugfs_cleanup(struct drm_minor *minor);
> -#endif
> -
>   /* atpx handler */
>   #if defined(CONFIG_VGA_SWITCHEROO)
>   void radeon_register_atpx_handler(void);
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.h
> b/drivers/gpu/drm/radeon/radeon_drv.h
> index afef2d9..3d35e0e 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.h
> +++ b/drivers/gpu/drm/radeon/radeon_drv.h
> @@ -119,4 +119,9 @@
>   long radeon_drm_ioctl(struct file *filp,
>   unsigned int cmd, unsigned long arg);
>   +#if defined(CONFIG_DEBUG_FS)
> +int radeon_debugfs_init(struct drm_minor *minor);
> +void radeon_debugfs_cleanup(struct drm_minor *minor);
> +#endif
> +
>   #endif/* __RADEON_DRV_H__ */
>
>
>
>
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/9b6e4e1d/attachment-0001.html>


[PATCH v2 4/5] drm/qxl: squash lines for simple wrapper functions

2016-09-15 Thread Gustavo Padovan
Hi Masahiro,

2016-09-14 Masahiro Yamada :

> Remove unneeded variables and assignments.
> 
> Signed-off-by: Masahiro Yamada 
> ---
> 
>  drivers/gpu/drm/qxl/qxl_draw.c| 7 ++-
>  drivers/gpu/drm/qxl/qxl_release.c | 7 ++-
>  2 files changed, 4 insertions(+), 10 deletions(-)

Reviewed-by: Gustavo Padovan 

Gustavo


[PATCH v4 01/14] drm: Centralize format information

2016-09-15 Thread Tomi Valkeinen
On 15/09/16 01:22, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the review.
> 
> On Wednesday 14 Sep 2016 14:49:26 Tomi Valkeinen wrote:
>> On 08/09/16 17:44, Laurent Pinchart wrote:
>>> Various pieces of information about DRM formats (number of planes, color
>>> depth, chroma subsampling, ...) are scattered across different helper
>>> functions in the DRM core. Callers of those functions often need to
>>> access more than a single parameter of the format, leading to
>>> inefficiencies due to multiple lookups.
>>>
>>> Centralize all format information in a data structure and create a
>>> function to look up information based on the format 4CC.
>>>
>>> Signed-off-by: Laurent Pinchart 
>>> ---
>>>
>>>  Documentation/gpu/drm-kms.rst |  3 ++
>>>  drivers/gpu/drm/drm_fourcc.c  | 84 ++
>>>  include/drm/drm_fourcc.h  | 19 ++
>>>  3 files changed, 106 insertions(+)
> 
> [snip]
> 
>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>> index 29c56b4331e0..6b91bd8a510d 100644
>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>> @@ -103,6 +103,90 @@ char *drm_get_format_name(uint32_t format)
>>>  EXPORT_SYMBOL(drm_get_format_name);
>>>  
>>>  /**
>>> + * drm_format_info - query information for a given format
>>> + * @format: pixel format (DRM_FORMAT_*)
>>> + *
>>> + * Returns:
>>> + * The instance of struct drm_format_info that describes the pixel
>>> format, or
>>> + * NULL if the format is unsupported.
>>> + */
>>> +const struct drm_format_info *drm_format_info(u32 format)
>>> +{
>>> +   static const struct drm_format_info formats[] = {
>>> +   { .format = DRM_FORMAT_C8,  .depth = 8, 
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_RGB332,  .depth = 8, 
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_BGR233,  .depth = 8,
>>> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_XRGB,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_XBGR,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_RGBX,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_BGRX,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_ARGB,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_ABGR,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_RGBA,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>> +   { .format = DRM_FORMAT_BGRA,.depth = 12,
>>> .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 1, .vsub = 1 },
>>
>> Aren't these 16 bit deep modes? 4+4+4+4 = 16.
> 
> No, the depth value is the number of colour bits, excluding the alpha bits. 
> This is used to implement the fbdev compatibility code, as fbdev (unlike kms) 
> makes use of that information.
> 
> The total number of bits per pixel is not stored in the table as it can be 
> computed by cpp[0]*8 + (cpp[1]+cpp[2])*8/hsub/vsub. For RGB formats, which 
> are 
> the only formats supported by the existing drm_fb_get_bpp_depth() function, 
> this simplifies to just cpp[0] * 8.

Ok. Then the ARGB & co. formats have depth wrong. I presumed those
were right as they're the "normal" ones =).

I'm not sure if it's worth the hassle, but if the depth is only for
fbdev compat code, maybe a separate format->depth table in fbdev code
(for the formats fbdev supports) would make this cleaner and avoid any
future mistakes with new drm drivers.

>>> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
>>> index 30c30fa87ee8..4e79d6159856 100644
>>> --- a/include/drm/drm_fourcc.h
>>> +++ b/include/drm/drm_fourcc.h
>>> @@ -25,6 +25,25 @@
>>>  #include 
>>>  #include 
>>>
>>> +/**
>>> + * struct drm_format_info - information about a DRM format
>>> + * @format: 4CC format identifier (DRM_FORMAT_*)
>>> + * @depth: color depth (number of bits per pixel excluding padding bits)
>>
>> Depth is zero for yuv formats. Maybe that should be made clear here.
> 
> How about
> 
> "color depth (number of bits per pixel excluding padding and alpha bits), 
> valid for RGB formats only" ?

Yes, that makes it clear.

 Tomi

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/aab33957/attachment.sig>


[Bug 97494] Tonga vce perf regression since drm/amdgpu: add vce bypass mode for tonga.

2016-09-15 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97494

Andy Furniss  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #1 from Andy Furniss  ---
Working OK with current agd5f drm-next-4.9-wip

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160915/4b2cdb62/attachment-0001.html>


[PATCH] DRM: i915: Fix gen8 graphics on Broadwell-U. These patches stop the random gpu hang on my XPS-13-9343, kernel version 4.8-rc5.

2016-09-15 Thread Greg KH
On Thu, Sep 15, 2016 at 11:12:08AM +0800, bobcao3 wrote:
> Signed-off-by: bobcao3 
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |  6 
>  drivers/gpu/drm/i915/i915_gem_stolen.c  | 61 
> -
>  drivers/gpu/drm/i915/i915_reg.h |  6 
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 19 +-
>  4 files changed, 59 insertions(+), 33 deletions(-)



This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.



Also, you need a "real" name in the from and signed-off-by: area, and I
know I never take patches without any changelog text...

thanks,

greg k-h


  1   2   >