[drm-exynos:exynos-drm-fixes 6/6] drivers/gpu/drm/exynos/exynos_drm_gsc.c:1763:0: error: unterminated #ifdef

2016-09-19 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git 
exynos-drm-fixes
head:   f14b71e73240a6264f5ea71879219f97fd227e34
commit: f14b71e73240a6264f5ea71879219f97fd227e34 [6/6] Subject: [PATCH, RESEND] 
drm: exynos: avoid unused function warning
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
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 f14b71e73240a6264f5ea71879219f97fd227e34
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/exynos/exynos_drm_gsc.c:1763:0: error: unterminated #ifdef
#ifdef CONFIG_PM


vim +1763 drivers/gpu/drm/exynos/exynos_drm_gsc.c

f2646380 Eunchul Kim   2012-12-14  1757 pm_runtime_set_suspended(dev);
f2646380 Eunchul Kim   2012-12-14  1758 pm_runtime_disable(dev);
f2646380 Eunchul Kim   2012-12-14  1759  
f2646380 Eunchul Kim   2012-12-14  1760 return 0;
f2646380 Eunchul Kim   2012-12-14  1761  }
f2646380 Eunchul Kim   2012-12-14  1762  
06453edb Rafael J. Wysocki 2014-12-04 @1763  #ifdef CONFIG_PM
f14b71e7 Arnd Bergmann 2016-09-18  1764  static int __maybe_unused 
gsc_runtime_suspend(struct device *dev)
f2646380 Eunchul Kim   2012-12-14  1765  {
f2646380 Eunchul Kim   2012-12-14  1766 struct gsc_context *ctx = 
get_gsc_context(dev);

:: The code at line 1763 was first introduced by commit
:: 06453edba4bfe54a4d17ae5cbdda39cb59ed4c6a drm / exynos / PM: Replace 
CONFIG_PM_RUNTIME with CONFIG_PM

:: TO: Rafael J. Wysocki 
:: CC: Rafael J. Wysocki 

---
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/gzip
Size: 58520 bytes
Desc: not available
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160919/a15eff4b/attachment-0001.gz>


[PATCH v8 9/9] drm/mediatek: add support for Mediatek SoC MT2701

2016-09-19 Thread CK Hu
Hi, YT:

On Mon, 2016-09-12 at 20:01 +0800, YT Shen wrote:
> This patch add support for the Mediatek MT2701 DISP subsystem.
> There is only one OVL engine in MT2701.
> 
> Signed-off-by: YT Shen 
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c |  6 ++
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c|  6 ++
>  drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 17 +
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |  7 +++
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 29 
> +
>  drivers/gpu/drm/mediatek/mtk_dsi.c  |  1 +
>  drivers/gpu/drm/mediatek/mtk_mipi_tx.c  |  6 ++
>  7 files changed, 72 insertions(+)
> 

[snip...]

> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 4b4e449..465819b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -112,6 +112,7 @@ struct mtk_ddp_comp_match {
>  
>  static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] 
> = {
>   [DDP_COMPONENT_AAL] = { MTK_DISP_AAL,   0, NULL },
> + [DDP_COMPONENT_BLS] = { MTK_DISP_PWM,   0, NULL },

I would like to move this modification to the patch of "Add BLS
component". Just like 'shadow register', even we first introduce it in
MT2701, we separate it in another independent patch because it may be
included in other Mediatek Soc. I prefer modification of this patch is
something which exist in MT8173 but is different in MT2701. 

Regards,
CK

>   [DDP_COMPONENT_COLOR0]  = { MTK_DISP_COLOR, 0, &ddp_color },
>   [DDP_COMPONENT_COLOR1]  = { MTK_DISP_COLOR, 1, &ddp_color },
>   [DDP_COMPONENT_DPI0]= { MTK_DPI,0, NULL },
> @@ -130,11 +131,17 @@ static const struct mtk_ddp_comp_match 
> mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
>   [DDP_COMPONENT_WDMA1]   = { MTK_DISP_WDMA,  1, NULL },
>  };
>  



[GIT PULL] exynos-drm-fixes

2016-09-19 Thread Inki Dae
Hi Dave,

There was my mistake reported below when I merged one fixup manually.
http://www.spinics.net/lists/dri-devel/msg118283.html

Fixed.

Thanks,
Inki Dae


2016년 09월 18일 23:12에 Inki Dae 이(가) 쓴 글:
> Hi Dave,
> 
>Just fixup to runtime pm usage and some cleanups.
> 
>Please kindly let me know if there is any problem.
> 
>Ps. We will request git-pull for -next soon if no critical issue,
>which includes only code refactoring on hdmi ddc and phy.
> 
> Thanks,
> Inki Dae
> 
> The following changes since commit 09cb5b78af52208afb9f1b194c8a9154df4a4782:
> 
>   Merge tag 'drm-vc4-fixes-2016-09-14' of https://github.com/anholt/linux 
> into drm-fixes (2016-09-17 07:57:55 +1000)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git 
> exynos-drm-fixes
> 
> for you to fetch changes up to f14b71e73240a6264f5ea71879219f97fd227e34:
> 
>   Subject: [PATCH, RESEND] drm: exynos: avoid unused function warning 
> (2016-09-18 22:52:29 +0900)
> 
> 
> Arnd Bergmann (1):
>   Subject: [PATCH, RESEND] drm: exynos: avoid unused function warning
> 
> Marek Szyprowski (4):
>   drm/exynos: fimc: fix system and runtime pm integration
>   drm/exynos: gsc: fix system and runtime pm integration
>   drm/exynos: rotator: fix system and runtime pm integration
>   drm/exynos: g2d: fix system and runtime pm integration
> 
> Shuah Khan (1):
>   exynos-drm: Fix unsupported GEM memory type error message to be clear
> 
>  drivers/gpu/drm/exynos/exynos_drm_fb.c  |6 ++---
>  drivers/gpu/drm/exynos/exynos_drm_fimc.c|   29 ++-
>  drivers/gpu/drm/exynos/exynos_drm_g2d.c |   29 ++-
>  drivers/gpu/drm/exynos/exynos_drm_gsc.c |   34 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_rotator.c |   26 ++--
>  5 files changed, 18 insertions(+), 106 deletions(-)
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 


[Bug 91880] Radeonsi on Grenada cards (r9 390) exceptionally unstable and poorly performing

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

--- Comment #120 from DesiOtaku  ---
I hate to "me too" here, but I can confirm that the steps outlined in comment
#115 does not resolve the problem. However, the
power_dpm_force_performance_level and power_dpm_state trick outlined in comment
#29 does prevent it from freezing.

I have a ASUS Radeon R9 390X running Kubuntu 16.04. I am willing to test out
any potential fixes.

-- 
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/20160919/30c21a9b/attachment.html>


[PATCH] drm/rockchip: Cleanup dangling devm pointers

2016-09-19 Thread Daniel Kurtz
Hi Sean,

On Sat, Sep 17, 2016 at 2:22 AM, Sean Paul  wrote:
>
> Instead of assigning device managed resources to local variables,
> keep track of them in the vop struct.

Why this patch?
Is it fixing an issue?
Or, is it preparing for some future use of ahb_rst outside of vop_initial?

I thought that one of the nice features of using devm is you do not
need to carry around pointers to devm allocated resources in the
driver local device struct.

-Dan

>
> Signed-off-by: Sean Paul 
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 131ae0f..bed782e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -142,6 +142,7 @@ struct vop {
>
> /* vop dclk reset */
> struct reset_control *dclk_rst;
> +   struct reset_control *ahb_rst;
>
> struct vop_win win[];
>  };
> @@ -1333,7 +1334,6 @@ static int vop_initial(struct vop *vop)
>  {
> const struct vop_data *vop_data = vop->data;
> const struct vop_reg_data *init_table = vop_data->init_table;
> -   struct reset_control *ahb_rst;
> int i, ret;
>
> vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
> @@ -1374,15 +1374,15 @@ static int vop_initial(struct vop *vop)
> /*
>  * do hclk_reset, reset all vop registers.
>  */
> -   ahb_rst = devm_reset_control_get(vop->dev, "ahb");
> -   if (IS_ERR(ahb_rst)) {
> +   vop->ahb_rst = devm_reset_control_get(vop->dev, "ahb");
> +   if (IS_ERR(vop->ahb_rst)) {
> dev_err(vop->dev, "failed to get ahb reset\n");
> -   ret = PTR_ERR(ahb_rst);
> +   ret = PTR_ERR(vop->ahb_rst);
> goto err_disable_aclk;
> }
> -   reset_control_assert(ahb_rst);
> +   reset_control_assert(vop->ahb_rst);
> usleep_range(10, 20);
> -   reset_control_deassert(ahb_rst);
> +   reset_control_deassert(vop->ahb_rst);
>
> memcpy(vop->regsbak, vop->regs, vop->len);
>
> --
> 2.8.0.rc3.226.g39d4020
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/rockchip: Balance irq refcount on failure

2016-09-19 Thread Daniel Kurtz
On Sat, Sep 17, 2016 at 2:22 AM, Sean Paul  wrote:
> If create_crtc fails in vop bind, ensure the irq refcount is zeroed
> back out before exiting.
>
> Signed-off-by: Sean Paul 

Reviewed-by: Daniel Kurtz 

> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 57650c9..131ae0f 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1551,11 +1551,15 @@ static int vop_bind(struct device *dev, struct device 
> *master, void *data)
>
> ret = vop_create_crtc(vop);
> if (ret)
> -   return ret;
> +   goto err_enable_irq;
>
> pm_runtime_enable(&pdev->dev);
>
> return 0;
> +
> +err_enable_irq:
> +   enable_irq(vop->irq); /* To balance out the disable_irq above */
> +   return ret;
>  }
>
>  static void vop_unbind(struct device *dev, struct device *master, void *data)
> --
> 2.8.0.rc3.226.g39d4020
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/i915: Fix non static symbol warning

2016-09-19 Thread Jani Nikula
On Sat, 17 Sep 2016, Wei Yongjun  wrote:
> From: Wei Yongjun 
>
> Fixes the following sparse warning:
>
> drivers/gpu/drm/i915/intel_dp.c:1527:5: warning:
>  symbol 'intel_dp_compute_bpp' was not declared. Should it be static?
>
> Signed-off-by: Wei Yongjun 
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 69cee9b..acd0c51 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1524,8 +1524,8 @@ void intel_dp_compute_rate(struct intel_dp *intel_dp, 
> int port_clock,
>   }
>  }
>  
> -int intel_dp_compute_bpp(struct intel_dp *intel_dp,
> -  struct intel_crtc_state *pipe_config)
> +static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
> + struct intel_crtc_state *pipe_config)

Already fixed upstream.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH] drm/udl: Fix for the X server screen update

2016-09-19 Thread poma
On 18.09.2016 19:42, Noralf Trønnes wrote:
> 
> Den 18.09.2016 15:48, skrev poma:
>> Fix for DisplayLink GPU USB2.0 device X server screen update
>>
>> Within X server on top of DisplayLink GPU USB2.0 device,
>> screen content is not refreshed i.e. updated,
>> which is the most basic functionality of the screen.
>>
>> This partially (udl_handle_damage()) reverts commit:
>>
>> - e375882406d0cc24030746638592004755ed4ae0
>>"drm/udl: Use drm_fb_helper deferred_io support"
>>
>> Thanks Noralf for the tip.
>>
>> $ modinfo udl
>> filename:   /lib/modules/4.7.4-234.fc24.x86_64/updates/udl.ko
>> license:GPL
>> alias:  usb:v17E9p*d*dc*dsc*dp*icFFisc00ip00in*
>> depends:
>> intree: Y
>> vermagic:   4.7.4-234.fc24.x86_64 SMP mod_unload
>> parm:   fb_bpp:int
>> parm:   fb_defio:int
>>
>> $ dmesg | grep udl
>> [   41.888469] udl: module verification failed: signature and/or required 
>> key missing - tainting kernel
>> [   42.156988] udl 1-2:1.0: fb1: udldrmfb frame buffer device
>> [   42.158940] [drm] Initialized udl on minor 1
>> [   42.159676] usbcore: registered new interface driver udl
>>
>> $ grep udl /var/log/Xorg.0.log
>> [71.194] (**) |   |-->Device "udl0"
>>
>> Tested-by: poma 
>> ---
>>   drivers/gpu/drm/udl/udl_drv.h |  2 ++
>>   drivers/gpu/drm/udl/udl_fb.c  | 39 +--
>>   2 files changed, 39 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h
>> index 0b03d34..4a064ef 100644
>> --- a/drivers/gpu/drm/udl/udl_drv.h
>> +++ b/drivers/gpu/drm/udl/udl_drv.h
>> @@ -81,6 +81,8 @@ struct udl_framebuffer {
>>  struct drm_framebuffer base;
>>  struct udl_gem_object *obj;
>>  bool active_16; /* active on the 16-bit channel */
>> +int x1, y1, x2, y2; /* dirty rect */
>> +spinlock_t dirty_lock;
>>   };
>>   
>>   #define to_udl_fb(x) container_of(x, struct udl_framebuffer, base)
>> diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
>> index d5df555..b2b42d2 100644
>> --- a/drivers/gpu/drm/udl/udl_fb.c
>> +++ b/drivers/gpu/drm/udl/udl_fb.c
>> @@ -90,6 +90,9 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, 
>> int y,
>>  struct urb *urb;
>>  int aligned_x;
>>  int bpp = (fb->base.bits_per_pixel / 8);
>> +int x2, y2;
>> +bool store_for_later = false;
>> +unsigned long flags;
>>   
>>  if (!fb->active_16)
>>  return 0;
>> @@ -115,6 +118,38 @@ int udl_handle_damage(struct udl_framebuffer *fb, int 
>> x, int y,
>>  (y + height > fb->base.height))
>>  return -EINVAL;
>>   
>> +/* if we are in atomic just store the info
>> +   can't test inside spin lock */
>> +if (in_atomic())
>> +store_for_later = true;
>> +
>> +x2 = x + width - 1;
>> +y2 = y + height - 1;
>> +
>> +spin_lock_irqsave(&fb->dirty_lock, flags);
> 
> You can drop the spinlock and store_for_later since it always runs in
> process context.
> Which means that there's no need to store x1/x2/y1/y2 in fb.
> 
>> +
>> +if (fb->y1 < y)
>> +y = fb->y1;
>> +if (fb->y2 > y2)
>> +y2 = fb->y2;
>> +if (fb->x1 < x)
>> +x = fb->x1;
>> +if (fb->x2 > x2)
>> +x2 = fb->x2;
>> +
>> +if (store_for_later) {
>> +fb->x1 = x;
>> +fb->x2 = x2;
>> +fb->y1 = y;
>> +fb->y2 = y2;
>> +spin_unlock_irqrestore(&fb->dirty_lock, flags);
>> +return 0;
>> +}
>> +
>> +fb->x1 = fb->y1 = INT_MAX;
>> +fb->x2 = fb->y2 = 0;
>> +
>> +spin_unlock_irqrestore(&fb->dirty_lock, flags);
>>  start_cycles = get_cycles();
>>   
>>  urb = udl_get_urb(dev);
>> @@ -122,14 +157,14 @@ int udl_handle_damage(struct udl_framebuffer *fb, int 
>> x, int y,
>>  return 0;
>>  cmd = urb->transfer_buffer;
>>   
>> -for (i = y; i < height ; i++) {
>> +for (i = y; i <= y2 ; i++) {
>>  const int line_offset = fb->base.pitches[0] * i;
>>  const int byte_offset = line_offset + (x * bpp);
>>  const int dev_byte_offset = (fb->base.width * bpp * i) + (x * 
>> bpp);
>>  if (udl_render_hline(dev, bpp, &urb,
>>   (char *) fb->obj->vmapping,
>>   &cmd, byte_offset, dev_byte_offset,
>> - width * bpp,
> 

That's right, this is sufficient

---
 drivers/gpu/drm/udl/udl_fb.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index d5df555..05ab114 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -90,6 +90,7 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int 
y,
struct urb *urb;
int aligned_x;
int bpp = (fb->base.bits_per_pixel / 8);
+   int x2, y2;

if (!fb->active_1

[PATCH v6] drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support

2016-09-19 Thread Philipp Zabel
Am Freitag, den 16.09.2016, 20:38 +0300 schrieb Vladimir Zapolskiy:
> Hi Philipp,
[...]
> >> as far as I know David accepts pull requests from you, can you please
> >> create and send a pull request for v4.9 containing these changes?
> >>
> >> https://patchwork.kernel.org/patch/9284717/ -- with Russell's ack
> >
> > Is that a forward looking statement? I don't see Russell's ack.
> 
> Here it is: http://www.spinics.net/lists/dri-devel/msg115880.html

Thank you.

> Please don't bother about two other commits from that series, at least
> there are official maintainers for the changes. And by the way please
> consider to add youself as a maintainer of DW HDMI.
> 
> >> https://patchwork.kernel.org/patch/9296883/ -- with Rob's ack and 
> >> yours tested-by
> >>
> >> Some users anticipate this change, for example see 
> >> https://lkml.org/lkml/2016/9/14/55
> >
> > Those I see. I can re-test and prepare a pull request.

Re-tested on Nitrogen6X with this patch applied:

--8<--
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi 
b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index 97d9c33..5d60c14 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -292,7 +292,6 @@
 };

 &hdmi {
-   ddc-i2c-bus = <&i2c2>;
status = "okay";
 };

@@ -439,8 +438,8 @@

pinctrl_i2c2: i2c2grp {
fsl,pins = <
-   MX6QDL_PAD_KEY_COL3__I2C2_SCL   
0x4001b8b1
-   MX6QDL_PAD_KEY_ROW3__I2C2_SDA   
0x4001b8b1
+   MX6QDL_PAD_KEY_COL3__HDMI_TX_DDC_SCL
0x4001b8b1
+   MX6QDL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA
0x4001b8b1
>;
};

-->8--

I'll send a pull request shortly.

regards
Philipp



[PULL] topic/drm-misc

2016-09-19 Thread Daniel Vetter
Hi Dave,

Just random misc stuff that Sean/Sumit&Archit picked up while I relaxed.
Well except for one commit:

commit a988588b1806b40ae115fe1c9ab38706fd1a7c2b
Author: Kristian H. Kristensen 
Date:   Tue Sep 13 14:20:45 2016 -0700

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

Pls also cherry-pick that over to drm-fixes and add a cc:stable tag.

Cheers, Daniel


The following changes since commit dec90ea1456b5a5d990d94ade2e45a2457cfd149:

  drm: Fix error path in drm_mode_page_flip_ioctl() (2016-09-08 11:57:13 +0300)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/topic/drm-misc-2016-09-19

for you to fetch changes up to a988588b1806b40ae115fe1c9ab38706fd1a7c2b:

  drm: Only use compat ioctl for addfb2 on X86/IA64 (2016-09-15 10:42:11 -0400)


Chris Wilson (1):
  dma-buf/sync-file: Avoid enable fence signaling if poll(.timeout=0)

Gustavo Padovan (1):
  drm/fence: allow fence waiting to be interrupted by userspace

Kristian H. Kristensen (1):
  drm: Only use compat ioctl for addfb2 on X86/IA64

Maarten Lankhorst (1):
  drm: Move property validation to a helper, v2.

Masahiro Yamada (4):
  drm/amdgpu: squash lines for simple wrapper functions
  drm/radeon: squash lines for simple wrapper functions
  drm/bridge: analogix_dp: squash lines for simple wrapper functions
  drm/qxl: squash lines for simple wrapper functions

Sergei Shtylyov (1):
  drm/bridge: adv7511: add support for the 2nd chip

 drivers/dma-buf/sync_file.c   |  3 +-
 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 +---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c  | 12 +++
 drivers/gpu/drm/bridge/adv7511/adv7533.c  |  5 ++-
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 +++
 drivers/gpu/drm/drm_atomic.c  | 13 ++-
 drivers/gpu/drm/drm_atomic_helper.c   | 41 ++-
 drivers/gpu/drm/drm_crtc_internal.h   |  2 ++
 drivers/gpu/drm/drm_ioc32.c   |  4 +++
 drivers/gpu/drm/drm_mode_object.c | 31 -
 drivers/gpu/drm/msm/msm_atomic.c  |  2 +-
 drivers/gpu/drm/qxl/qxl_draw.c|  7 ++--
 drivers/gpu/drm/qxl/qxl_release.c |  7 ++--
 drivers/gpu/drm/radeon/cik.c  |  6 +---
 drivers/gpu/drm/radeon/r100.c |  6 +---
 drivers/gpu/drm/radeon/r600.c |  6 +---
 include/drm/drm_atomic_helper.h   |  5 +--
 19 files changed, 84 insertions(+), 104 deletions(-)

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[GIT PULL] bridge/dw-hdmi: I2C master controller support

2016-09-19 Thread Philipp Zabel
Hi Dave,

this tag contains support for the I2C master controller contained in the
HDMI TX IP core, for those boards that don't allow to mux their DDC pins
to SoC I2C controllers. This will make the dw-hdmi driver register its
internal I2C master if the ddc-i2c-bus property is not set on the device
tree node.

regards
Philipp

The following changes since commit 694d0d0bb2030d2e36df73e2d23d5770511dbc8d:

  Linux 4.8-rc2 (2016-08-14 19:11:36 -0700)

are available in the git repository at:

  git://git.pengutronix.de/git/pza/linux.git tags/dw-hdmi-next-2016-09-19

for you to fetch changes up to 3efc2fa3b777e65e344a7612d38a8278e78a0514:

  drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support (2016-09-19 08:07:24 
+0200)


dw-hdmi i2c master controller

- add support for the HDMI I2C master controller, for boards that
  can have their DDC pins connected only to the HDMI TX directly.


Vladimir Zapolskiy (2):
  drm: dw_hdmi: use of_get_i2c_adapter_by_node interface
  drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support

 .../devicetree/bindings/display/bridge/dw_hdmi.txt |   4 +-
 drivers/gpu/drm/bridge/dw-hdmi.c   | 279 -
 drivers/gpu/drm/bridge/dw-hdmi.h   |  19 ++
 3 files changed, 290 insertions(+), 12 deletions(-)



[PATCH v4 0/7] drm/imx: Add active plane reconfiguration support

2016-09-19 Thread Daniel Vetter
On Wed, Sep 14, 2016 at 1:05 PM, Philipp Zabel  
wrote:
> Hi Dave,
>
> Am Montag, den 29.08.2016, 17:44 +0200 schrieb Daniel Vetter:
>> On Mon, Aug 29, 2016 at 4:59 PM, Philipp Zabel  
>> wrote:
>> > Am Montag, den 29.08.2016, 12:53 +0200 schrieb Philipp Zabel:
>> >> Am Freitag, den 26.08.2016, 15:30 +0800 schrieb Liu Ying:
>> >> > This patch adds active plane reconfiguration support for imx-drm.
>> >> > This may fixes some mode setting failure issues which were introduced
>> >> > by imx-drm atomic conversion patch set.  The main idea is to disable the
>> >> > plane in question in CRTC's atomic_disable operation and then the drm
>> >> > atomic core will enable it again automatically.
>> >>
>> >> I have rebased onto drm-misc and picked up the remaining patches (4-7)
>> >
>> > Actually, since this is a regression and the new drm-misc patches won't
>> > make it into 4.8, I'd be inclined to take the v2 patch as a fix for 4.8
>> > and then apply the remaining patches as relative changes to that on top
>> > of drm-misc instead.
>>
>> Just apply the 4.8 to 4.8 and then once that's in an -rc do a
>> backmerge with -X ours and explain in the commit what you're doing. No
>> need to rework the patches once more to be incremental on top of the
>> 4.8 fix.
>>
>> At least that's what we're doing all the time in i915.
>> -Daniel
>
> Could you merge v4.8-rc3 into drm-next? After backmerging
> drm-intel-fixes-2016-08-15 with -s ours, v4.8-rc3 just auto-merges
> cleanly, but I assume I shouldn't do that inside an imx-drm pull
> request.
>
> Since imx-drm-fixes-2016-08-29 is based on v4.8-rc3, I'd otherwise have
> to pull it in with that backmerge, to resolve the conflict between
> commit c6c1f9bc798b ("drm/imx: Add active plane reconfiguration
> support") that went into v4.8-rc5 and the newer version in imx-drm/next.

Yup, don't do backmerges in your driver tree which affect other
drivers. Those need to happen in Dave's main drm-next tree to avoid
confusion and chaos. I'll ping him about it.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH 0/3] ARM: dts: am335x-* Add blue-and-red-wiring propery to lcdc nodes

2016-09-19 Thread Jyri Sarha
On 09/16/16 18:02, Tony Lindgren wrote:
> * Jyri Sarha  [160916 04:50]:
>> > These patches complete the am335x LCDC color errata fix[1]. The
>> > functional patches are now queued for v4.9.
>> > 
>> > The patch for am335x-boneblack.dts is delayed until v4.10 or v4.9-rc
>> > phase to avoid conflickt with BBB HDMI audio DTS patch that slipped
>> > into tda998x pull request.
>> > 
>> > [1] http://www.spinics.net/lists/devicetree/msg141246.html
> OK. Are these safe to merge even if the dts changes get merged before
> the driver changes? Or does it break something if merged out of order?

Yes, they are safe. The new property just simply is not interpreted and
everything works as before.

BR,
Jyri


[GIT PULL] imx-drm fixes, cleanups, image conversion

2016-09-19 Thread Philipp Zabel
Hi Dave,

please consider merging this tag containing the latest active plane
reconfiguration patches, several fixes and cleanups, and image
conversion support for the V4L2 drivers to build upon.

The active plane reconfiguration patch (v4) will conflict with the v2
patch that already went into v4.8-rc5 to fix a regression. I have not
yet included a backmerge with this tag, because that would mean also
pulling in v4.8-rc3. Please let me know if I also should prepare a pull
request containing the merges.

regards
Philipp

The following changes since commit 2b58e98d42af854037439f51bd89f83dbfa8e30d:

  drm/atomic-helper: Add NO_DISABLE_AFTER_MODESET flag support for plane commit 
(2016-08-29 11:29:37 +0200)

are available in the git repository at:

  git://git.pengutronix.de/git/pza/linux.git tags/imx-drm-next-2016-09-19

for you to fetch changes up to cd98e85a6b786da83e0b120b53a182d100c19c9b:

  gpu: ipu-v3: Add queued image conversion support (2016-09-19 08:30:27 +0200)


imx-drm active plane reconfiguration, cleanup, FSU/IC/IRT/VDIC support

- add active plane reconfiguration support (v4),
  use the atomic_disable callback
- stop calling disable_plane manually in the plane destroy path
- let mode cleanup destroy mode objects on driver unbind
- drop deprecated load/unload drm_driver ops
- add exclusive fence to plane state, so the atomic helper can
  wait on them, remove the open-coded fence wait from imx-drm
- add low level deinterlacer (VDIC) support
- add support for channel linking via the frame synchronisation unit (FSU)
- add queued image conversion support for memory-to-memory scaling, rotation,
  and color space conversion, using IC and IRT.


LABBE Corentin (1):
  gpu: ipu-v3: fix a possible NULL dereference

Liu Ying (4):
  gpu: ipu-v3: Do not wait for DMFC FIFO to clear when disabling DMFC 
channel
  drm/imx: ipuv3-crtc: Use the callback ->atomic_disable instead of 
->disable
  drm/imx: Use DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET flag
  drm/imx: Add active plane reconfiguration support

Lucas Stach (6):
  drm/imx: don't call disable_plane in plane destroy path
  drm/imx: drop deprecated load/unload drm_driver ops
  drm/imx: don't destroy mode objects manually on driver unbind
  drm/imx: fold ipu_plane_disable into ipu_disable_plane
  drm/imx: add exclusive fence to plane state
  drm/imx: imx-ldb: detach panel on unbind

Philipp Zabel (2):
  drm/imx: imx-ldb: detach bridge on unbind
  drm/imx: parallel-display: detach bridge or panel on unbind

Steve Longerbeam (4):
  gpu: ipu-v3: Add Video Deinterlacer unit
  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/drm/bridge/dw-hdmi.c   |3 -
 drivers/gpu/drm/imx/imx-drm-core.c |  332 ---
 drivers/gpu/drm/imx/imx-ldb.c  |9 +-
 drivers/gpu/drm/imx/imx-tve.c  |3 -
 drivers/gpu/drm/imx/ipuv3-crtc.c   |   17 +-
 drivers/gpu/drm/imx/ipuv3-plane.c  |   37 +-
 drivers/gpu/drm/imx/parallel-display.c |6 +-
 drivers/gpu/ipu-v3/Makefile|3 +-
 drivers/gpu/ipu-v3/ipu-common.c|  157 ++-
 drivers/gpu/ipu-v3/ipu-dmfc.c  |   18 +-
 drivers/gpu/ipu-v3/ipu-ic.c|2 +-
 drivers/gpu/ipu-v3/ipu-image-convert.c | 1709 
 drivers/gpu/ipu-v3/ipu-prv.h   |   38 +
 drivers/gpu/ipu-v3/ipu-vdi.c   |  243 +
 include/video/imx-ipu-image-convert.h  |  207 
 include/video/imx-ipu-v3.h |   58 +-
 16 files changed, 2612 insertions(+), 230 deletions(-)
 create mode 100644 drivers/gpu/ipu-v3/ipu-image-convert.c
 create mode 100644 drivers/gpu/ipu-v3/ipu-vdi.c
 create mode 100644 include/video/imx-ipu-image-convert.h



[PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible

2016-09-19 Thread Arnd Bergmann
On Monday, September 19, 2016 3:28:39 PM CEST Baoyou Xie wrote:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: warning: 
> no previous prototype for 'tonga_program_jump_on_start' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: warning: 
> no previous prototype for 'fiji_save_vft_table' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: 
> warning: no previous prototype for 'polaris10_avfs_event_mgr' 
> [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: 
> warning: no previous prototype for 'iceland_program_jump_on_start' 
> [-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 
> 

Hi Baoyou,

All your drm/amd patches seem fine to me, but again (as with the nouveau
driver patches before), I think it would make more sense to consolidate
them, and do a small number of patches such as

[PATCH 1/3] drm/amdgpu: add missing includes
[PATCH 2/3] drm/amdgpu: remove unused functions
[PATCH 3/3] drm/amdgpu: mark symbol static where possible

This is all one big driver, and I see no value in splitting it up
per file within the driver.

Arnd


[GIT PULL] imx-drm fixes, cleanups, image conversion

2016-09-19 Thread Dave Airlie
On 19 September 2016 at 17:31, Philipp Zabel  wrote:
> Hi Dave,
>
> please consider merging this tag containing the latest active plane
> reconfiguration patches, several fixes and cleanups, and image
> conversion support for the V4L2 drivers to build upon.
>
> The active plane reconfiguration patch (v4) will conflict with the v2
> patch that already went into v4.8-rc5 to fix a regression. I have not
> yet included a backmerge with this tag, because that would mean also
> pulling in v4.8-rc3. Please let me know if I also should prepare a pull
> request containing the merges.

fatal: unable to connect to git.pengutronix.de:
git.pengutronix.de[0: 5.9.183.235]: errno=Connection refused

temporary?

How conflicty is the backmerge, might be nice to just post an extra
branch for reference if it's too messy..

I probably won't get to a backmerge to -next this week.

Dave.


[git pull] drm fixes for 4.8

2016-09-19 Thread Dave Airlie
Hi Linus,

One important drm 32/64 ABI fix came in so I'll dequeue what I have, the rest is
just exynos runtime pm fixes, but the net removal of code seems like a
win to me.

I'm going to be sporadic this week due to school holidays, so if anything urgent
turns up, Daniel will take care of it.

Dave.

The following changes since commit 09cb5b78af52208afb9f1b194c8a9154df4a4782:

  Merge tag 'drm-vc4-fixes-2016-09-14' of
https://github.com/anholt/linux into drm-fixes (2016-09-17 07:57:55
+1000)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux tags/drm-fixes-for-4.8-rc7

for you to fetch changes up to 47a66e45d7a7613322549c2475ea9d809baaf514:

  drm: Only use compat ioctl for addfb2 on X86/IA64 (2016-09-19 17:28:20 +1000)


exynos and one stable ABI fix


Arnd Bergmann (1):
  Subject: [PATCH, RESEND] drm: exynos: avoid unused function warning

Dave Airlie (1):
  Merge branch 'exynos-drm-fixes' of
git://git.kernel.org/.../daeinki/drm-exynos into drm-fixes

Kristian H. Kristensen (1):
  drm: Only use compat ioctl for addfb2 on X86/IA64

Marek Szyprowski (4):
  drm/exynos: fimc: fix system and runtime pm integration
  drm/exynos: gsc: fix system and runtime pm integration
  drm/exynos: rotator: fix system and runtime pm integration
  drm/exynos: g2d: fix system and runtime pm integration

Shuah Khan (1):
  exynos-drm: Fix unsupported GEM memory type error message to be clear

 drivers/gpu/drm/drm_ioc32.c |  4 
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c| 29 ++--
 drivers/gpu/drm/exynos/exynos_drm_g2d.c | 29 ++--
 drivers/gpu/drm/exynos/exynos_drm_gsc.c | 35 -
 drivers/gpu/drm/exynos/exynos_drm_rotator.c | 26 ++---
 6 files changed, 22 insertions(+), 107 deletions(-)


[PATCH 1/3] ARM: dts: am335x-evm: Add blue-and-red-wiring -property to lcdc node

2016-09-19 Thread Jyri Sarha
On 09/17/16 01:17, Nishanth Menon wrote:
> On 09/16/2016 06:50 AM, Jyri Sarha wrote:
> [..]
>> +blue-and-red-wiring = "crossed";
> 
> Dumb question: Why is this a Linux generic property - does it make sense
> to have "blue-and-red-wiring" as a Linux generic property? I mean, it
> reminds me little of those movies "cut the blue or red wire to diffuse
> the bomb" ;)

It is a property of "ti,tilcdc" node. I did not think I should add a ti
specific prefix for it. And after all if some other SoC or display chip
has the same bug (eg. blue and red colour components swapped between two
different colour modes), they could use the same property.

Of course in theory, if such bugs were common, a generic property that
would describe how connections between different display data wires are
drawn could make sense, but AFAIK am335x is the only one out there with
such a bug [1].

> 
> "The am335x-evm has blue and red wires crossed to get 24-bit RGB (and
> 16-bit BGR". I mean, there has to be some sort of better description
> specific to lcdc if some product used yellow and green wires for the
> same signals crossed?
> 

The property and why it is there is described in detail in the binding
document referred to in the commit description.

The functional patches, with the binding document can be found here:
http://www.spinics.net/lists/devicetree/msg141246.html

[1] For more details see section 3.1.1 in AM335x Silicon Errata:
http://www.ti.com/general/docs/lit/getliterature.tsp?baseLiteratureNumber=sprz360

Best regards,
Jyri


[PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible

2016-09-19 Thread Christian König
Am 19.09.2016 um 09:34 schrieb Arnd Bergmann:
> On Monday, September 19, 2016 3:28:39 PM CEST Baoyou Xie wrote:
>> We get a few warnings when building kernel with W=1:
>> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: 
>> warning: no previous prototype for 'tonga_program_jump_on_start' 
>> [-Wmissing-prototypes]
>> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: warning: 
>> no previous prototype for 'fiji_save_vft_table' [-Wmissing-prototypes]
>> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: 
>> warning: no previous prototype for 'polaris10_avfs_event_mgr' 
>> [-Wmissing-prototypes]
>> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: 
>> warning: no previous prototype for 'iceland_program_jump_on_start' 
>> [-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 
>>
> Hi Baoyou,
>
> All your drm/amd patches seem fine to me, but again (as with the nouveau
> driver patches before), I think it would make more sense to consolidate
> them, and do a small number of patches such as
>
> [PATCH 1/3] drm/amdgpu: add missing includes
> [PATCH 2/3] drm/amdgpu: remove unused functions
> [PATCH 3/3] drm/amdgpu: mark symbol static where possible
>
> This is all one big driver,

No it isn't. The different parts are developed by different teams at 
AMD, so the splitting them up is rather welcome here.

So please keep your style as it is, at least for the amdgpu driver.

Regards,
Christian.

>   and I see no value in splitting it up
> per file within the driver.
>
>   Arnd




[PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible

2016-09-19 Thread Arnd Bergmann
On Monday, September 19, 2016 9:59:56 AM CEST Christian König wrote:
> Am 19.09.2016 um 09:34 schrieb Arnd Bergmann:
> > On Monday, September 19, 2016 3:28:39 PM CEST Baoyou Xie wrote:
> >> We get a few warnings when building kernel with W=1:
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: 
> >> warning: no previous prototype for 'tonga_program_jump_on_start' 
> >> [-Wmissing-prototypes]
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: 
> >> warning: no previous prototype for 'fiji_save_vft_table' 
> >> [-Wmissing-prototypes]
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: 
> >> warning: no previous prototype for 'polaris10_avfs_event_mgr' 
> >> [-Wmissing-prototypes]
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: 
> >> warning: no previous prototype for 'iceland_program_jump_on_start' 
> >> [-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 
> >>
> > Hi Baoyou,
> >
> > All your drm/amd patches seem fine to me, but again (as with the nouveau
> > driver patches before), I think it would make more sense to consolidate
> > them, and do a small number of patches such as
> >
> > [PATCH 1/3] drm/amdgpu: add missing includes
> > [PATCH 2/3] drm/amdgpu: remove unused functions
> > [PATCH 3/3] drm/amdgpu: mark symbol static where possible
> >
> > This is all one big driver,
> 
> No it isn't. The different parts are developed by different teams at 
> AMD, so the splitting them up is rather welcome here.
> 
> So please keep your style as it is, at least for the amdgpu driver.

Ok, fair enough. Thanks for the clarification!

Arnd



[PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible

2016-09-19 Thread Huang Rui
Hi Baoyou,

On Mon, Sep 19, 2016 at 03:28:39PM +0800, Baoyou Xie wrote:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: warning: 
> no previous prototype for 'tonga_program_jump_on_start' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: warning: 
> no previous prototype for 'fiji_save_vft_table' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: 
> warning: no previous prototype for 'polaris10_avfs_event_mgr' 
> [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: 
> warning: no previous prototype for 'iceland_program_jump_on_start' 
> [-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'.
> 

+ amd-gfx mail list.

Thanks to your patch. But powerplay part is refactored recently below, some
functions are already updated. So you might need rebase them. :-)

https://lists.freedesktop.org/archives/amd-gfx/2016-September/002118.html

Thanks,
Rui


[GIT PULL] imx-drm fixes, cleanups, image conversion

2016-09-19 Thread Philipp Zabel
Am Montag, den 19.09.2016, 17:37 +1000 schrieb Dave Airlie:
> On 19 September 2016 at 17:31, Philipp Zabel  
> wrote:
> > Hi Dave,
> >
> > please consider merging this tag containing the latest active plane
> > reconfiguration patches, several fixes and cleanups, and image
> > conversion support for the V4L2 drivers to build upon.
> >
> > The active plane reconfiguration patch (v4) will conflict with the v2
> > patch that already went into v4.8-rc5 to fix a regression. I have not
> > yet included a backmerge with this tag, because that would mean also
> > pulling in v4.8-rc3. Please let me know if I also should prepare a pull
> > request containing the merges.
> 
> fatal: unable to connect to git.pengutronix.de:
> git.pengutronix.de[0: 5.9.183.235]: errno=Connection refused
> 
> temporary?

Temporary, sorry for the inconvenience. I've just double-checked it
works again.

> How conflicty is the backmerge, might be nice to just post an extra
> branch for reference if it's too messy..

I have pushed a branch imx-drm/merge for reference:

git://git.pengutronix.de/git/pza/linux.git refs/heads/imx-drm/merge

There is one hunk that needed manual intervention because commit
a474478642d5 ("drm/imx: fix crtc vblank state regression") is not
contained in imx-drm/next.

> I probably won't get to a backmerge to -next this week.
> 
> Dave.

regards
Philipp




[git pull] drm fixes for 4.8

2016-09-19 Thread Jani Nikula
On Mon, 19 Sep 2016, Dave Airlie  wrote:
> Hi Linus,
>
> One important drm 32/64 ABI fix came in so I'll dequeue what I have, the rest 
> is
> just exynos runtime pm fixes, but the net removal of code seems like a
> win to me.
>
> I'm going to be sporadic this week due to school holidays, so if anything 
> urgent
> turns up, Daniel will take care of it.

Hmm, missing my pull req [1]?

BR,
Jani.


[1] http://marc.info/?i=87intxpfay.fsf at intel.com

-- 
Jani Nikula, Intel Open Source Technology Center


[PULL] drm-intel-next

2016-09-19 Thread Daniel Vetter
Hi Dave,

drm-intel-next-2016-09-19:
- refactor the sseu code (Imre)
- refine guc dmesg output (Dave Gordon)
- more vgpu work
- more skl wm fixes (Lyude)
- refactor dpll code in prep for upfront link training (Jim Bride et al)
- consolidate all platform feature checks into intel_device_info (Carlos Santa)
- refactor elsp/execlist submission as prep for re-submission after hang
  recovery and eventually scheduling (Chris Wilson)
- allow synchronous gpu reset handling, to remove tricky/impossible/fragile
  error recovery code (Chris Wilson)
- prep work for nonblocking (execlist) submission, using fences to track
  depencies and drive elsp submission (Chris Wilson)
- partial error recover/resubmission of non-guilty batches after hangs (Chris 
Wilson)
- full dma-buf implicit fencing support (Chris Wilson)
- dp link training fixes (Jim, Dhinkaran, Navare, ...)
- obey dp branch device pixel rate/bpc/clock limits (Mika Kahola), needed for
  many vga dongles
- bunch of small cleanups and polish all over, as usual
drm-intel-next-2016-09-02:
- skl wm fixes (Lyude, Matt, Maarten)
- cleanup of kdev/drm_dev/i915_dev handling (David Weinehall)
- make (most) encoders take advantage of atomic states (Maarten)
- MMAP_GTT_VERSION driver param to announce that gtt mmaps are reliable (Chris)
- allow contexts on all rings (Chris)
- a few fixes (around diagnostic messages) to make BAT less noisy
- misc fixes and cleanups all over, as usual

Since you're on vacation I figured I'll just combine the pull from before
my vacations, and the final 4.9 feature pile I just assembled. With this
4.9 is now for Jani.

Tomeu just pinged me about the crc drm patches, and David made some noises
about cleanup patches he has pending, so I guess there'll be a few
stragglers for 4.9 for -misc still. But if Linus tags final 4.8 (against
excpectations) this w/e already I'll postpone them I think.

Cheers, Daniel


The following changes since commit d5d0804f8f6d0c89913f6a2de5348adef8ec33e4:

  drm/i915: Update DRIVER_DATE to 20160822 (2016-08-22 08:35:48 +0200)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/drm-intel-next-2016-09-19

for you to fetch changes up to 6e05f3d3b9298a56d6f1acb474a75cf14a17c31e:

  drm/i915: Update DRIVER_DATE to 20160919 (2016-09-19 09:26:08 +0200)


- refactor the sseu code (Imre)
- refine guc dmesg output (Dave Gordon)
- more vgpu work
- more skl wm fixes (Lyude)
- refactor dpll code in prep for upfront link training (Jim Bride et al)
- consolidate all platform feature checks into intel_device_info (Carlos Santa)
- refactor elsp/execlist submission as prep for re-submission after hang
  recovery and eventually scheduling (Chris Wilson)
- allow synchronous gpu reset handling, to remove tricky/impossible/fragile
  error recovery code (Chris Wilson)
- prep work for nonblocking (execlist) submission, using fences to track
  depencies and drive elsp submission (Chris Wilson)
- partial error recover/resubmission of non-guilty batches after hangs (Chris 
Wilson)
- full dma-buf implicit fencing support (Chris Wilson)
- dp link training fixes (Jim, Dhinkaran, Navare, ...)
- obey dp branch device pixel rate/bpc/clock limits (Mika Kahola), needed for
  many vga dongles
- bunch of small cleanups and polish all over, as usual


Ander Conselvan de Oliveira (2):
  drm/i915: Don't pass crtc_state to intel_dp_set_link_params()
  drm/i915: Remove ddi_pll_sel from intel_crtc_state

Carlos Santa (22):
  drm/i915: Move HAS_PSR definition to platform struct definition
  drm/i915: Remove .is_mobile field from platform struct
  drm/i915: Introduce GEN6_FEATURES for device info
  drm/i915: Move HAS_RUNTIME_PM definition to platform
  drm/i915: Remove runtime PM for SNB
  drm/i915: Get rid of HAS_CORE_RING_FREQ
  drm/i915 Move HAS_CSR definition to platform definition
  drm/i915: Move HAS_RESOURCE_STREAMER definition to platform definition
  drm/i915: Move HAS_RC6 definition to platform definition
  drm/i915: Move HAS_RC6p definition to platform definition
  drm/i915: Move HAS_DP_MST definition to platform definition
  drm/i915: Introduce GEN5_FEATURES for device info
  drm/i915: Move HAS_GMBUS_IRQ definition to platform definition
  drm/i915: Introduce GEN4_FEATURES for device info
  drm/i915: Introduce GEN3_FEATURES for device info
  drm/i915: Introduce GEN2_FEATURES for device info
  drm/i915: Move HAS_HW_CONTEXTS definition to platform
  drm/i915: Move HAS_LOGICAL_RING_CONTEXTS definition to platform
  drm/i915: Move HAS_L3_DPF definition to platform definition
  drm/i915: Move HAS_GMCH_DISPLAY definition to platform
  drm/i915: Make HWS_NEEDS_PHYSICAL the exception
  drm/i915: Move HAS_GUC definition to platform definition

Chris Wilson (46):
  

[git pull] drm fixes for 4.8

2016-09-19 Thread Jani Nikula
On Mon, 19 Sep 2016, Jani Nikula  wrote:
> On Mon, 19 Sep 2016, Dave Airlie  wrote:
>> Hi Linus,
>>
>> One important drm 32/64 ABI fix came in so I'll dequeue what I have, the 
>> rest is
>> just exynos runtime pm fixes, but the net removal of code seems like a
>> win to me.
>>
>> I'm going to be sporadic this week due to school holidays, so if anything 
>> urgent
>> turns up, Daniel will take care of it.
>
> Hmm, missing my pull req [1]?

I failed to see Dave's other pull request. Sorry for the noise.

BR,
Jani.



-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH v3 1/4] drm/bridge: Add RGB to VGA bridge support

2016-09-19 Thread Maxime Ripard
On Sun, Sep 18, 2016 at 01:04:17PM +0300, Laurent Pinchart wrote:
> On Sunday 18 Sep 2016 13:01:16 Laurent Pinchart wrote:
> > On Thursday 08 Sep 2016 14:17:48 Maxime Ripard wrote:
> > > Some boards have an entirely passive RGB to VGA bridge, based on either
> > > DACs or resistor ladders.
> > > 
> > > Those might or might not have an i2c bus routed to the VGA connector in
> > > order to access the screen EDIDs.
> > > 
> > > Add a bridge that doesn't do anything but expose the modes available on
> > > the screen, either based on the EDIDs if available, or based on the XGA
> > > standards.
> > > 
> > > Acked-by: Rob Herring 
> > > Signed-off-by: Maxime Ripard 
> > > ---
> > > 
> > >  .../bindings/display/bridge/rgb-to-vga-bridge.txt  |  52 +
> > >  drivers/gpu/drm/bridge/Kconfig |   6 +
> > >  drivers/gpu/drm/bridge/Makefile|   1 +
> > >  drivers/gpu/drm/bridge/rgb-to-vga.c| 232 
> > >  4 files changed, 291 insertions(+)
> > >  create mode 100644
> > > 
> > > Documentation/devicetree/bindings/display/bridge/rgb-to-vga-bridge.txt
> > > create mode 100644 drivers/gpu/drm/bridge/rgb-to-vga.c
> > > 
> > > diff --git
> > > a/Documentation/devicetree/bindings/display/bridge/rgb-to-vga-bridge.txt
> > > b/Documentation/devicetree/bindings/display/bridge/rgb-to-vga-bridge.txt
> > > new file mode 100644
> > > index ..83a053fb51a0
> > > --- /dev/null
> > > +++
> > > b/Documentation/devicetree/bindings/display/bridge/rgb-to-vga-bridge.txt
> > > @@ -0,0 +1,52 @@
> > > +Passive RGB to VGA bridge
> > > +-
> > > +
> > > +This binding is aimed for entirely passive RGB to VGA bridges that do not
> > > +require any configuration.
> > 
> > Couldn't it also support active RGB to VGA bridges that don't require any
> > configuration ? It would seem a bit pointless to define a separate DT
> > binding for them.
> 
> I'm thinking in particular about the ADV7123
> (http://www.analog.com/media/en/technical-documentation/data-sheets/ADV7123.pdf)
> that already has a DT binding.

I guess we don't have the same definition of passive, but I was
thinking of devices that do not need any configuration in order to
operate properly. And this one seems to fall in that category.

> Would it be feasible to combine the two, and support both devices
> with a single driver ?

I don't see why not. But converting the renesas DRM driver seems a bit
out of scope, and the ADV compatible can definitely be added later.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160919/22fa2cec/attachment-0001.sig>


[PATCH] drm/amdgpu: add missing header dependencies

2016-09-19 Thread Christian König
Am 18.09.2016 um 15:12 schrieb Baoyou Xie:
> We get 6 warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c:629:6: warning: no previous prototype 
> for 'dce_v8_0_disable_dce' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:730:6: warning: no previous prototype 
> for 'dce_v10_0_disable_dce' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c:699:6: warning: no previous prototype 
> for 'dce_v11_0_disable_dce' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:40:5: warning: no previous prototype 
> for 'amdgpu_gfx_scratch_get' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:62:6: warning: no previous prototype 
> for 'amdgpu_gfx_scratch_free' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:84:6: warning: no previous prototype 
> for 'amdgpu_gfx_parse_disable_cu' [-Wmissing-prototypes]
>
> In fact, these functions are declared in
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h,
> so this patch adds missing header dependencies.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König .

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 1 +
>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c  | 1 +
>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c  | 1 +
>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c   | 1 +
>   4 files changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index a074edd..01a42b6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -24,6 +24,7 @@
>*/
>   #include 
>   #include "amdgpu.h"
> +#include "amdgpu_gfx.h"
>   
>   /*
>* GPU scratch registers helpers function.
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index bc5bb4e..fb943ee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -35,6 +35,7 @@
>   #include "dce/dce_10_0_d.h"
>   #include "dce/dce_10_0_sh_mask.h"
>   #include "dce/dce_10_0_enum.h"
> +#include "dce_v10_0.h"
>   #include "oss/oss_3_0_d.h"
>   #include "oss/oss_3_0_sh_mask.h"
>   #include "gmc/gmc_8_1_d.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index b93eba0..1555d6d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -35,6 +35,7 @@
>   #include "dce/dce_11_0_d.h"
>   #include "dce/dce_11_0_sh_mask.h"
>   #include "dce/dce_11_0_enum.h"
> +#include "dce_v11_0.h"
>   #include "oss/oss_3_0_d.h"
>   #include "oss/oss_3_0_sh_mask.h"
>   #include "gmc/gmc_8_1_d.h"
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index abd5213..ef7add9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -34,6 +34,7 @@
>   
>   #include "dce/dce_8_0_d.h"
>   #include "dce/dce_8_0_sh_mask.h"
> +#include "dce_v8_0.h"
>   
>   #include "gca/gfx_7_2_enum.h"
>   




[PATCH] drm/amdgpu: amend amdgpu_gfx_parse_disable_cu() declaration

2016-09-19 Thread Christian König
Am 18.09.2016 um 15:37 schrieb Baoyou Xie:
> In amdgpu_gfx.h, the declaration of amdgpu_gfx_parse_disable_cu()
> is incorrect.
>
> Signed-off-by: Baoyou Xie 

Ups, nice catch.

Patch is Reviewed-by: Christian König .

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 +++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 5 -
>   2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 01a42b6..8575039 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -82,7 +82,9 @@ void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, 
> uint32_t reg)
>* The bitmask of CUs to be disabled in the shader array determined by se 
> and
>* sh is stored in mask[se * max_sh + sh].
>*/
> -void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned 
> max_sh)
> +void amdgpu_gfx_parse_disable_cu(unsigned int *mask,
> + unsigned int max_se,
> + unsigned int max_sh)
>   {
>   unsigned se, sh, cu;
>   const char *p;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index 51321e1..0b9ad4f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -27,6 +27,9 @@
>   int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg);
>   void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);
>   
> -unsigned amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, 
> unsigned max_sh);
> +void
> +amdgpu_gfx_parse_disable_cu(unsigned int *mask,
> +unsigned int max_se,
> +unsigned int max_sh);
>   
>   #endif




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

2016-09-19 Thread Christian König
Am 18.09.2016 um 16:09 schrieb Baoyou Xie:
> We get 7 warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1990:5: warning: no previous 
> prototype for 'amdgpu_pre_soft_reset' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c:1548:5: warning: no previous 
> prototype for 'amdgpu_connector_virtual_dpms' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c:1560:5: warning: no previous 
> prototype for 'amdgpu_connector_virtual_set_property' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c:330:5: warning: no previous prototype 
> for 'amdgpu_cs_list_validate' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_virtual.c:98:6: warning: no previous prototype 
> for 'dce_virtual_stop_mc_access' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_virtual.c:130:6: warning: no previous 
> prototype for 'dce_virtual_resume_mc_access' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/dce_virtual.c:136:6: warning: no previous 
> prototype for 'dce_virtual_set_vga_render_state' [-Wmissing-prototypes]
>
> In fact, all of the 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 both functions with 'static'.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König .

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 6 --
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
>   drivers/gpu/drm/amd/amdgpu/dce_virtual.c   | 6 +++---
>   4 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index 319a5e1..decbba5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -1545,7 +1545,8 @@ static int amdgpu_connector_virtual_mode_valid(struct 
> drm_connector *connector,
>   return MODE_OK;
>   }
>   
> -int amdgpu_connector_virtual_dpms(struct drm_connector *connector, int mode)
> +static int
> +amdgpu_connector_virtual_dpms(struct drm_connector *connector, int mode)
>   {
>   return 0;
>   }
> @@ -1557,7 +1558,8 @@ amdgpu_connector_virtual_detect(struct drm_connector 
> *connector, bool force)
>   return connector_status_connected;
>   }
>   
> -int amdgpu_connector_virtual_set_property(struct drm_connector *connector,
> +static int
> +amdgpu_connector_virtual_set_property(struct drm_connector *connector,
> struct drm_property *property,
> uint64_t val)
>   {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index d80e5d3..b408eea 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -327,7 +327,7 @@ retry:
>   return r;
>   }
>   
> -int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
> +static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
>   struct list_head *validated)
>   {
>   struct amdgpu_bo_list_entry *lobj;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index c38dc47..09b809d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1987,7 +1987,7 @@ static bool amdgpu_check_soft_reset(struct 
> amdgpu_device *adev)
>   return asic_hang;
>   }
>   
> -int amdgpu_pre_soft_reset(struct amdgpu_device *adev)
> +static int amdgpu_pre_soft_reset(struct amdgpu_device *adev)
>   {
>   int i, r = 0;
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c 
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 00663a7..2d02acd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -95,7 +95,7 @@ static bool dce_virtual_is_display_hung(struct 
> amdgpu_device *adev)
>   return false;
>   }
>   
> -void dce_virtual_stop_mc_access(struct amdgpu_device *adev,
> +static void dce_virtual_stop_mc_access(struct amdgpu_device *adev,
> struct amdgpu_mode_mc_save *save)
>   {
>   switch (adev->asic_type) {
> @@ -127,13 +127,13 @@ void dce_virtual_stop_mc_access(struct amdgpu_device 
> *adev,
>   
>   return;
>   }
> -void dce_virtual_resume_mc_access(struct amdgpu_device *adev,
> +static void dce_virtual_resume_mc_access(struct amdgpu_device *adev,
>   struct amdgpu_mode_mc_save *save)
>   {
>   return;
>   }
>   
> -void dce_virtual_set_vga_render_state(struct amdgpu_device *adev,
> +static void dce_virtual_set_vga_render_state(struct amdgpu_device *adev,
>   bool render)
>   {
>   return;




[Bug 97806] GPU lockup with mesa-git and llvm-svn with rx 470 on Unigine Heaven and TombRaider 2013

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

--- Comment #6 from Laurent carlier  ---
Bisecting gives me:
c220fde748d8b296c46498b37753c494a57e2ee9 is the first bad commit
commit c220fde748d8b296c46498b37753c494a57e2ee9
Author: Valery Pykhtin 
Date:   Sat Sep 10 13:09:16 2016 +

[AMDGPU] Refactor MUBUF/MTBUF instructions

Differential revision: https://reviews.llvm.org/D24295

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk at 281137
91177308-0d34-0410-b5e6-96231b3b80d8

:04 04 836a392130fd7b35b72ad5a681278a6b5f271258
07e868b807f3eed07c1cc7dd7c766d630f0f9480 M  lib

Bisected from llvm-git mirror

$ git bisect log
git bisect start
# good: [5337a14483af37562e99cd0bb35f1aa06b9ab7ec] Bump the trunk version to
4.0.0svn.   
git bisect good 5337a14483af37562e99cd0bb35f1aa06b9ab7ec
# bad: [f31e66357099bc37f69d251b016fe70ac0b595d3] [PM] Port CFGViewer and
CFGPrinter to the new Pass Manager Differential Revision:
https://reviews.llvm.org/D24592   
git bisect bad f31e66357099bc37f69d251b016fe70ac0b595d3 
# good: [12dc55cb60365c7a75a868e3ce468396ceaf4986] [Hexagon] Improve test to
check for @PCREL, only run llc, not opt -> llc. 
git bisect good 12dc55cb60365c7a75a868e3ce468396ceaf4986
# good: [605a81a85c4c0426b4a59a3a4afeda020eb92316] AMDGPU: Relax SGPR asm
constraint register class
git bisect good 605a81a85c4c0426b4a59a3a4afeda020eb92316
# good: [6d2157da81ba33f283ec7fa6c428bf63594a5715] [AA] Fix typo in comment
(s/hase/has).
git bisect good 6d2157da81ba33f283ec7fa6c428bf63594a5715
# bad: [0aa0c7d910cfa845790645e9d124e4162f9fc44b] Revert "[ARM] Promote small
global constants to constant pools"
git bisect bad 0aa0c7d910cfa845790645e9d124e4162f9fc44b
# good: [1f4e68f079c8fa2a39912c50e3fa984133d7a770] [cmake] Export
gtest/gtest_main and its dependencies via a special build tree only cmake
exports file.
git bisect good 1f4e68f079c8fa2a39912c50e3fa984133d7a770
# bad: [d3eebe7daf2b913d5b1b79ce523c090c64bd4212] [AVX-512] Add test cases to
demonstrate opportunities for commuting vpternlog. Commuting will be added in a
future commit.
git bisect bad d3eebe7daf2b913d5b1b79ce523c090c64bd4212
# good: [da28e63a7469154c6888e0c70b1cad54cd7668bf] AMDGPU: Fix scheduling info
for spill pseudos
git bisect good da28e63a7469154c6888e0c70b1cad54cd7668bf
# bad: [df708a504e06b5769348b09240abcfa8b7aa3a28] Add an isSwiftError predicate
to Value
git bisect bad df708a504e06b5769348b09240abcfa8b7aa3a28
# bad: [c220fde748d8b296c46498b37753c494a57e2ee9] [AMDGPU] Refactor MUBUF/MTBUF
instructions
git bisect bad c220fde748d8b296c46498b37753c494a57e2ee9
# good: [b7ef2005d10c48e878a1b19b504e1386f6e9e7cd] [WebAssembly] Fix typos in
comments
git bisect good b7ef2005d10c48e878a1b19b504e1386f6e9e7cd
# good: [68d7a57aba91c4ebb4f83caf1bf539d16b317c90] [gold/LTO] Add test case for
r281134
git bisect good 68d7a57aba91c4ebb4f83caf1bf539d16b317c90
# first bad commit: [c220fde748d8b296c46498b37753c494a57e2ee9] [AMDGPU]
Refactor MUBUF/MTBUF instructions

-- 
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/20160919/e58dbf67/attachment.html>


[PATCH] drm/amdgpu: remove unused functions

2016-09-19 Thread Christian König
Am 18.09.2016 um 16:13 schrieb Baoyou Xie:
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:146:5: warning: no previous 
> prototype for 'pool_to_domain' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:104:5: warning: no previous prototype for 
> 'cz_send_msg_to_smc_with_parameter_async' [-Wmissing-prototypes]
>
> In fact, both functions are called by no one and not exported,
> so this patch removes them.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König 

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 8 
>   drivers/gpu/drm/amd/amdgpu/cz_smc.c| 7 ---
>   2 files changed, 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index d080d08..dba8a5b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -143,14 +143,6 @@ int amdgpu_amdkfd_resume(struct amdgpu_device *rdev)
>   return r;
>   }
>   
> -u32 pool_to_domain(enum kgd_memory_pool p)
> -{
> - switch (p) {
> - case KGD_POOL_FRAMEBUFFER: return AMDGPU_GEM_DOMAIN_VRAM;
> - default: return AMDGPU_GEM_DOMAIN_GTT;
> - }
> -}
> -
>   int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
>   void **mem_obj, uint64_t *gpu_addr,
>   void **cpu_ptr)
> diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c 
> b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> index 69ac373c4..db67e0c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> @@ -101,13 +101,6 @@ int cz_send_msg_to_smc(struct amdgpu_device *adev, u16 
> msg)
>   return 0;
>   }
>   
> -int cz_send_msg_to_smc_with_parameter_async(struct amdgpu_device *adev,
> - u16 msg, u32 parameter)
> -{
> - WREG32(mmSMU_MP1_SRBM2P_ARG_0, parameter);
> - return cz_send_msg_to_smc_async(adev, msg);
> -}
> -
>   int cz_send_msg_to_smc_with_parameter(struct amdgpu_device *adev,
>   u16 msg, u32 parameter)
>   {




[PATCH] drm/amdgpu: add function declaration in amdgpu.h

2016-09-19 Thread Christian König
Am 18.09.2016 um 16:29 schrieb Baoyou Xie:
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:502:10: warning: no previous prototype 
> for 'init_cond_exec' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:514:6: warning: no previous prototype 
> for 'patch_cond_exec' [-Wmissing-prototypes]
>
> In fact, both functions are not declared in any files.
>
> So this patch declares them in drivers/gpu/drm/amd/amdgpu/amdgpu.h.
>
> Signed-off-by: Baoyou Xie 

NAK, IIRC Alex posted a patch last week to remove those two.

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 8e3d9b2..7b71cbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -396,6 +396,8 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct 
> fence **fence);
>   void amdgpu_fence_process(struct amdgpu_ring *ring);
>   int amdgpu_fence_wait_empty(struct amdgpu_ring *ring);
>   unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);
> +unsigned int init_cond_exec(struct amdgpu_ring *ring);
> +void patch_cond_exec(struct amdgpu_ring *ring, unsigned int offset);
>   
>   /*
>* BO.




[Bug 96449] Dying Light reports OpenGL version 3.0 with mesa-git

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

--- Comment #8 from Jan Ziak <0xe2.0x9a.0x9b at gmail.com> ---
(In reply to Adam Bolte from comment #7)
> MESA_GL_VERSION_OVERRIDE=3.3COMPAT does not work for me. Jan, did it work
> for you? All I get is either a crash (after the loading screen), or a blank
> screen with sound playing in the background. The warning about a lack of
> support for 3.3 compatibility profiles does not go away.
> 
> I've tried launching steam with "export MESA_GL_VERSION_OVERRIDE=3.3COMPAT"
> ran in the xterm prior, and I've tried using
> MESA_GL_VERSION_OVERRIDE=3.3COMPAT as an argument to the game from within
> the Steam launch options. No difference either way.
> 
> Is this a different issue? Should I open a separate bug?

The game needs OpenGL 4.4.

-- 
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/20160919/d25f8ab5/attachment.html>


[PATCH 4/6] drm: provide management functions for drm_file

2016-09-19 Thread Daniel Vetter
On Thu, Sep 01, 2016 at 02:48:35PM +0200, David Herrmann wrote:
> Rather than doing drm_file allocation/destruction right in the fops, lets
> provide separate helpers. This decouples drm_file management from the
> still-mandatory drm-fops. It prepares for use of drm_file without the
> fops, both by possible separate fops implementations and APIs (not that I
> am aware of any such plans), and more importantly from in-kernel use where
> no real file is available.
> 
> Signed-off-by: David Herrmann 
> ---
>  drivers/gpu/drm/drm_drv.c  | 135 
> +
>  drivers/gpu/drm/drm_fops.c | 132 +++-
>  drivers/gpu/drm/drm_internal.h |   4 ++
>  3 files changed, 147 insertions(+), 124 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 57ce973..9ab0016 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -95,6 +95,141 @@ void drm_ut_debug_printk(const char *function_name, const 
> char *format, ...)
>  }
>  EXPORT_SYMBOL(drm_ut_debug_printk);
>  
> +/**
> + * drm_file_alloc - allocate file context
> + * @minor: minor to allocate on
> + *
> + * This allocates a new DRM file context. It is not linked into any context 
> and
> + * can be used by the caller freely. Note that the context keeps a pointer to
> + * @minor, so it must be freed before @minor is.
> + *
> + * The legacy paths might require the drm_global_mutex to be held.
> + *
> + * RETURNS:
> + * Pointer to newly allocated context, ERR_PTR on failure.
> + */


Hm, in drm core we only type kerneldoc for exported stuff, not internal
interfaces. The idea being that the target audience for those docs is
(mostly) driver authors.

And since you're touching this, drm_file.[hc] would look pretty I think,
with kerneldoc for the structures ...
-Daniel


> +struct drm_file *drm_file_alloc(struct drm_minor *minor)
> +{
> + struct drm_device *dev = minor->dev;
> + struct drm_file *file;
> + int ret;
> +
> + file = kzalloc(sizeof(*file), GFP_KERNEL);
> + if (!file)
> + return ERR_PTR(-ENOMEM);
> +
> + file->pid = get_pid(task_pid(current));
> + file->minor = minor;
> + file->authenticated = capable(CAP_SYS_ADMIN); /* legacy compat */
> + INIT_LIST_HEAD(&file->lhead);
> + INIT_LIST_HEAD(&file->fbs);
> + mutex_init(&file->fbs_lock);
> + INIT_LIST_HEAD(&file->blobs);
> + INIT_LIST_HEAD(&file->pending_event_list);
> + INIT_LIST_HEAD(&file->event_list);
> + init_waitqueue_head(&file->event_wait);
> + file->event_space = 4096; /* set aside 4k for event buffer */
> + mutex_init(&file->event_read_lock);
> +
> + if (drm_core_check_feature(dev, DRIVER_GEM))
> + drm_gem_open(dev, file);
> + if (drm_core_check_feature(dev, DRIVER_PRIME))
> + drm_prime_init_file_private(&file->prime);
> +
> + if (dev->driver->open) {
> + ret = dev->driver->open(dev, file);
> + if (ret < 0)
> + goto out_prime_destroy;
> + }
> +
> + if (drm_is_primary_client(file)) {
> + ret = drm_master_open(file);
> + if (ret)
> + goto out_close;
> + }
> +
> + return file;
> +
> +out_close:
> + if (dev->driver->postclose)
> + dev->driver->postclose(dev, file);
> +out_prime_destroy:
> + if (drm_core_check_feature(dev, DRIVER_PRIME))
> + drm_prime_destroy_file_private(&file->prime);
> + if (drm_core_check_feature(dev, DRIVER_GEM))
> + drm_gem_release(dev, file);
> + put_pid(file->pid);
> + kfree(file);
> + return ERR_PTR(ret);
> +}
> +
> +/**
> + * drm_file_free - free file context
> + * @file: context to free, or NULL
> + *
> + * This destroys and deallocates a DRM file context previously allocated via
> + * drm_file_alloc(). The caller must make sure to unlink it from any contexts
> + * before calling this.
> + *
> + * The legacy paths might require the drm_global_mutex to be held.
> + *
> + * If NULL is passed, this is a no-op.
> + *
> + * RETURNS:
> + * 0 on success, or error code on failure.
> + */
> +void drm_file_free(struct drm_file *file)
> +{
> + struct drm_pending_event *e;
> + struct drm_device *dev;
> +
> + if (!file)
> + return;
> +
> + dev = file->minor->dev;
> +
> + if (dev->driver->preclose)
> + dev->driver->preclose(dev, file);
> + if (!drm_core_check_feature(dev, DRIVER_MODESET))
> + drm_legacy_lock_release(dev, file->legacy_filp);
> + if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> + drm_legacy_reclaim_buffers(dev, file);
> +
> + spin_lock_irq(&dev->event_lock);
> + while ((e = list_first_entry_or_null(&file->pending_event_list,
> +  struct drm_pending_event,
> +  pending_link))) {
> + list_del(&e->pending_li

[PATCH 0/6] DRM Core Cleanups

2016-09-19 Thread Daniel Vetter
On Thu, Sep 01, 2016 at 02:48:31PM +0200, David Herrmann wrote:
> Hey
> 
> The remaining cleanup patches pending on dri-devel in one batch. Random 
> cleanups
> all over the place. Should all be straightforward.

Except for patch 4 all applied to drm-misc, thanks.
-Daniel

> 
> Thanks
> David
> 
> David Herrmann (6):
>   drm: remove redundant drm_file->uid
>   drm: use drm_file to tag vm-bos
>   drm: rename drm_file.filp to drm_file.legacy_filp
>   drm: provide management functions for drm_file
>   drm: drop obsolete drm_core.h
>   drm: cleanup drm_core_{init,exit}()
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |   3 +-
>  drivers/gpu/drm/ast/ast_ttm.c   |   3 +-
>  drivers/gpu/drm/bochs/bochs_mm.c|   3 +-
>  drivers/gpu/drm/cirrus/cirrus_ttm.c |   3 +-
>  drivers/gpu/drm/drm_bufs.c  |   7 +-
>  drivers/gpu/drm/drm_drv.c   | 191 
> ++--
>  drivers/gpu/drm/drm_fops.c  | 133 ++
>  drivers/gpu/drm/drm_gem.c   |   8 +-
>  drivers/gpu/drm/drm_info.c  |   4 +-
>  drivers/gpu/drm/drm_internal.h  |   7 ++
>  drivers/gpu/drm/drm_ioc32.c |   1 -
>  drivers/gpu/drm/drm_ioctl.c |   1 -
>  drivers/gpu/drm/drm_sysfs.c |   8 +-
>  drivers/gpu/drm/drm_vma_manager.c   |  40 +++
>  drivers/gpu/drm/mgag200/mgag200_ttm.c   |   3 +-
>  drivers/gpu/drm/nouveau/nouveau_bo.c|   3 +-
>  drivers/gpu/drm/qxl/qxl_ttm.c   |   3 +-
>  drivers/gpu/drm/radeon/radeon_ttm.c |   3 +-
>  include/drm/drmP.h  |   3 +-
>  include/drm/drm_core.h  |  34 --
>  include/drm/drm_vma_manager.h   |  20 ++--
>  21 files changed, 235 insertions(+), 246 deletions(-)
>  delete mode 100644 include/drm/drm_core.h
> 
> -- 
> 2.9.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 0/6] DRM Core Cleanups

2016-09-19 Thread Daniel Vetter
On Mon, Sep 19, 2016 at 01:56:56PM +0200, Daniel Vetter wrote:
> On Thu, Sep 01, 2016 at 02:48:31PM +0200, David Herrmann wrote:
> > Hey
> > 
> > The remaining cleanup patches pending on dri-devel in one batch. Random 
> > cleanups
> > all over the place. Should all be straightforward.
> 
> Except for patch 4 all applied to drm-misc, thanks.

I lied ;-) Patch 3 doesn't compile, you missed i810.
-Daniel

> -Daniel
> 
> > 
> > Thanks
> > David
> > 
> > David Herrmann (6):
> >   drm: remove redundant drm_file->uid
> >   drm: use drm_file to tag vm-bos
> >   drm: rename drm_file.filp to drm_file.legacy_filp
> >   drm: provide management functions for drm_file
> >   drm: drop obsolete drm_core.h
> >   drm: cleanup drm_core_{init,exit}()
> > 
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |   3 +-
> >  drivers/gpu/drm/ast/ast_ttm.c   |   3 +-
> >  drivers/gpu/drm/bochs/bochs_mm.c|   3 +-
> >  drivers/gpu/drm/cirrus/cirrus_ttm.c |   3 +-
> >  drivers/gpu/drm/drm_bufs.c  |   7 +-
> >  drivers/gpu/drm/drm_drv.c   | 191 
> > ++--
> >  drivers/gpu/drm/drm_fops.c  | 133 ++
> >  drivers/gpu/drm/drm_gem.c   |   8 +-
> >  drivers/gpu/drm/drm_info.c  |   4 +-
> >  drivers/gpu/drm/drm_internal.h  |   7 ++
> >  drivers/gpu/drm/drm_ioc32.c |   1 -
> >  drivers/gpu/drm/drm_ioctl.c |   1 -
> >  drivers/gpu/drm/drm_sysfs.c |   8 +-
> >  drivers/gpu/drm/drm_vma_manager.c   |  40 +++
> >  drivers/gpu/drm/mgag200/mgag200_ttm.c   |   3 +-
> >  drivers/gpu/drm/nouveau/nouveau_bo.c|   3 +-
> >  drivers/gpu/drm/qxl/qxl_ttm.c   |   3 +-
> >  drivers/gpu/drm/radeon/radeon_ttm.c |   3 +-
> >  include/drm/drmP.h  |   3 +-
> >  include/drm/drm_core.h  |  34 --
> >  include/drm/drm_vma_manager.h   |  20 ++--
> >  21 files changed, 235 insertions(+), 246 deletions(-)
> >  delete mode 100644 include/drm/drm_core.h
> > 
> > -- 
> > 2.9.3
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH v3 01/20] drm: omapdrm: fb: Limit number of planes per framebuffer to two

2016-09-19 Thread Laurent Pinchart
The only multi-planar format supported by the driver is NV12, there will
thus never be more than two planes per framebuffer.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/omap_fb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c 
b/drivers/gpu/drm/omapdrm/omap_fb.c
index 5f3337f1e9aa..7646df33f9a1 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -36,7 +36,7 @@ struct format {
struct {
int stride_bpp;   /* this times width is stride */
int sub_y;/* sub-sample in y dimension */
-   } planes[4];
+   } planes[2];
bool yuv;
 };

@@ -90,7 +90,7 @@ struct omap_framebuffer {
struct drm_framebuffer base;
int pin_count;
const struct format *format;
-   struct plane planes[4];
+   struct plane planes[2];
/* lock for pinning (pin_count and planes.paddr) */
struct mutex lock;
 };
-- 
Regards,

Laurent Pinchart



[PATCH v3 00/20] OMAP DRM fixes and improvements

2016-09-19 Thread Laurent Pinchart
Hello,

Here's the third version of my current stack of pending patches for the
omapdrm driver.

All comments received for v2 have been considered and patches updated where
applicable. Changes since v2 include

- Rebased on top of Dave's latest drm-next branch
- Replaced "drm: omapdrm: Use atomic state instead of local device state"
  (09/20) with "drm: omapdrm: Replace DSS manager state check with omapdrm
  CRTC state" (09/20)

Individual changelogs are available in the patches.

The most notable change in this series is still the rework of the IRQ handling
code (patches 06/20 to 19/20) that, beside simplifying the code, ensures that
the vblank count and timestamp get updated properly in order to be reported to
userspace.

The series is based on top of the "[PATCH v4 00/14] Centralize format
information" patches sent to the dri-devel mailing list.

Laurent Pinchart (20):
  drm: omapdrm: fb: Limit number of planes per framebuffer to two
  drm: omapdrm: fb: Use format information provided by the DRM core
  drm: omapdrm: fb: Simplify objects lookup when creating framebuffer
  drm: omapdrm: fb: Simplify mode command checks when creating
framebuffer
  drm: omapdrm: fb: Turn framebuffer creation error messages into debug
  drm: omapdrm: Handle FIFO underflow IRQs internally
  drm: omapdrm: Handle CRTC error IRQs directly
  drm: omapdrm: Handle OCP error IRQ directly
  drm: omapdrm: Replace DSS manager state check with omapdrm CRTC state
  drm: omapdrm: Only commit planes on active CRTCs
  drm: omapdrm: Check DSS manager state in the enable/disable helpers
  drm: omapdrm: Prevent processing the same event multiple times
  drm: omapdrm: Use a spinlock to protect the CRTC pending flag
  drm: omapdrm: Keep vblank interrupt enabled while CRTC is active
  drm: omapdrm: Don't expose the omap_irq_(un)register() functions
  drm: omapdrm: Remove unused parameter from omap_drm_irq handler
  drm: omapdrm: Don't call DISPC power handling in IRQ wait functions
  drm: omapdrm: Make pipe2vbl function static
  drm: omapdrm: Simplify IRQ wait implementation
  drm: omapdrm: Remove global variables

 drivers/gpu/drm/omapdrm/dss/dispc.c  |   1 -
 drivers/gpu/drm/omapdrm/dss/output.c |   6 +
 drivers/gpu/drm/omapdrm/omap_crtc.c  | 126 +-
 drivers/gpu/drm/omapdrm/omap_drv.c   |   7 +-
 drivers/gpu/drm/omapdrm/omap_drv.h   |  51 +---
 drivers/gpu/drm/omapdrm/omap_fb.c| 170 
 drivers/gpu/drm/omapdrm/omap_irq.c   | 242 +++
 drivers/gpu/drm/omapdrm/omap_plane.c |  24 
 8 files changed, 310 insertions(+), 317 deletions(-)

-- 
Regards,

Laurent Pinchart



[PATCH v3 02/20] drm: omapdrm: fb: Use format information provided by the DRM core

2016-09-19 Thread Laurent Pinchart
The driver stores in a custom structure named format several pieces of
information about the format that are available in the DRM core. Remove
them and get the information from the DRM core instead.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_fb.c | 91 ---
 1 file changed, 46 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c 
b/drivers/gpu/drm/omapdrm/omap_fb.c
index 7646df33f9a1..3cd627f49e5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -29,37 +29,30 @@
  * framebuffer funcs
  */

-/* per-format info: */
-struct format {
+/* DSS to DRM formats mapping */
+static const struct {
enum omap_color_mode dss_format;
uint32_t pixel_format;
-   struct {
-   int stride_bpp;   /* this times width is stride */
-   int sub_y;/* sub-sample in y dimension */
-   } planes[2];
-   bool yuv;
-};
-
-static const struct format formats[] = {
+} formats[] = {
/* 16bpp [A]RGB: */
-   { OMAP_DSS_COLOR_RGB16,   DRM_FORMAT_RGB565,   {{2, 1}}, false }, 
/* RGB16-565 */
-   { OMAP_DSS_COLOR_RGB12U,  DRM_FORMAT_RGBX, {{2, 1}}, false }, 
/* RGB12x- */
-   { OMAP_DSS_COLOR_RGBX16,  DRM_FORMAT_XRGB, {{2, 1}}, false }, 
/* xRGB12- */
-   { OMAP_DSS_COLOR_RGBA16,  DRM_FORMAT_RGBA, {{2, 1}}, false }, 
/* RGBA12- */
-   { OMAP_DSS_COLOR_ARGB16,  DRM_FORMAT_ARGB, {{2, 1}}, false }, 
/* ARGB16- */
-   { OMAP_DSS_COLOR_XRGB16_1555, DRM_FORMAT_XRGB1555, {{2, 1}}, false }, 
/* xRGB15-1555 */
-   { OMAP_DSS_COLOR_ARGB16_1555, DRM_FORMAT_ARGB1555, {{2, 1}}, false }, 
/* ARGB16-1555 */
+   { OMAP_DSS_COLOR_RGB16,   DRM_FORMAT_RGB565 },   /* RGB16-565 */
+   { OMAP_DSS_COLOR_RGB12U,  DRM_FORMAT_RGBX }, /* RGB12x- */
+   { OMAP_DSS_COLOR_RGBX16,  DRM_FORMAT_XRGB }, /* xRGB12- */
+   { OMAP_DSS_COLOR_RGBA16,  DRM_FORMAT_RGBA }, /* RGBA12- */
+   { OMAP_DSS_COLOR_ARGB16,  DRM_FORMAT_ARGB }, /* ARGB16- */
+   { OMAP_DSS_COLOR_XRGB16_1555, DRM_FORMAT_XRGB1555 }, /* xRGB15-1555 */
+   { OMAP_DSS_COLOR_ARGB16_1555, DRM_FORMAT_ARGB1555 }, /* ARGB16-1555 */
/* 24bpp RGB: */
-   { OMAP_DSS_COLOR_RGB24P,  DRM_FORMAT_RGB888,   {{3, 1}}, false }, 
/* RGB24-888 */
+   { OMAP_DSS_COLOR_RGB24P,  DRM_FORMAT_RGB888 },   /* RGB24-888 */
/* 32bpp [A]RGB: */
-   { OMAP_DSS_COLOR_RGBX32,  DRM_FORMAT_RGBX, {{4, 1}}, false }, 
/* RGBx24- */
-   { OMAP_DSS_COLOR_RGB24U,  DRM_FORMAT_XRGB, {{4, 1}}, false }, 
/* xRGB24- */
-   { OMAP_DSS_COLOR_RGBA32,  DRM_FORMAT_RGBA, {{4, 1}}, false }, 
/* RGBA32- */
-   { OMAP_DSS_COLOR_ARGB32,  DRM_FORMAT_ARGB, {{4, 1}}, false }, 
/* ARGB32- */
+   { OMAP_DSS_COLOR_RGBX32,  DRM_FORMAT_RGBX }, /* RGBx24- */
+   { OMAP_DSS_COLOR_RGB24U,  DRM_FORMAT_XRGB }, /* xRGB24- */
+   { OMAP_DSS_COLOR_RGBA32,  DRM_FORMAT_RGBA }, /* RGBA32- */
+   { OMAP_DSS_COLOR_ARGB32,  DRM_FORMAT_ARGB }, /* ARGB32- */
/* YUV: */
-   { OMAP_DSS_COLOR_NV12,DRM_FORMAT_NV12, {{1, 1}, {1, 2}}, 
true },
-   { OMAP_DSS_COLOR_YUV2,DRM_FORMAT_YUYV, {{2, 1}}, true },
-   { OMAP_DSS_COLOR_UYVY,DRM_FORMAT_UYVY, {{2, 1}}, true },
+   { OMAP_DSS_COLOR_NV12,DRM_FORMAT_NV12 },
+   { OMAP_DSS_COLOR_YUV2,DRM_FORMAT_YUYV },
+   { OMAP_DSS_COLOR_UYVY,DRM_FORMAT_UYVY },
 };

 /* convert from overlay's pixel formats bitmask to an array of fourcc's */
@@ -89,7 +82,8 @@ struct plane {
 struct omap_framebuffer {
struct drm_framebuffer base;
int pin_count;
-   const struct format *format;
+   const struct drm_format_info *format;
+   enum omap_color_mode dss_format;
struct plane planes[2];
/* lock for pinning (pin_count and planes.paddr) */
struct mutex lock;
@@ -128,13 +122,13 @@ static const struct drm_framebuffer_funcs 
omap_framebuffer_funcs = {
 };

 static uint32_t get_linear_addr(struct plane *plane,
-   const struct format *format, int n, int x, int y)
+   const struct drm_format_info *format, int n, int x, int y)
 {
uint32_t offset;

-   offset = plane->offset +
-   (x * format->planes[n].stride_bpp) +
-   (y * plane->pitch / format->planes[n].sub_y);
+   offset = plane->offset
+  + (x * format->cpp[n] / (n == 1 ? 1 : format->hsub))
+  + (y * plane->pitch / (n == 1 ? 1 : format->vsub));

return plane->paddr + offset;
 }
@@ -153,11 +147,11 @@ void omap_framebuffer_update_scanout(struct 
drm_framebuffer *fb,
struct omap_drm_window *win, struct omap_overlay_info *info)
 {
struct oma

[PATCH v3 05/20] drm: omapdrm: fb: Turn framebuffer creation error messages into debug

2016-09-19 Thread Laurent Pinchart
Don't print userspace parameters validation failures as error messages
to avoid giving userspace the ability to flood the kernel log.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/omap_fb.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c 
b/drivers/gpu/drm/omapdrm/omap_fb.c
index 903d61dd910c..691f5c9f73f5 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -404,8 +404,8 @@ struct drm_framebuffer *omap_framebuffer_init(struct 
drm_device *dev,
}

if (!format || !dss_format) {
-   dev_err(dev->dev, "unsupported pixel format: %4.4s\n",
-   (char *)&mode_cmd->pixel_format);
+   dev_dbg(dev->dev, "unsupported pixel format: %4.4s\n",
+   (char *)&mode_cmd->pixel_format);
ret = -EINVAL;
goto fail;
}
@@ -427,13 +427,13 @@ struct drm_framebuffer *omap_framebuffer_init(struct 
drm_device *dev,
 * bytes per pixel.
 */
if (format->num_planes == 2 && pitch != mode_cmd->pitches[1]) {
-   dev_err(dev->dev, "pitches differ between planes 0 and 1\n");
+   dev_dbg(dev->dev, "pitches differ between planes 0 and 1\n");
ret = -EINVAL;
goto fail;
}

if (pitch < mode_cmd->width * format->cpp[0]) {
-   dev_err(dev->dev,
+   dev_dbg(dev->dev,
"provided buffer pitch is too small! %u < %u\n",
pitch, mode_cmd->width * format->cpp[0]);
ret = -EINVAL;
@@ -441,7 +441,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct 
drm_device *dev,
}

if (pitch % format->cpp[0]) {
-   dev_err(dev->dev,
+   dev_dbg(dev->dev,
"buffer pitch (%u bytes) is not a multiple of pixel 
size (%u bytes)\n",
pitch, format->cpp[0]);
ret = -EINVAL;
@@ -456,7 +456,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct 
drm_device *dev,
size = pitch * mode_cmd->height / vsub;

if (size > omap_gem_mmap_size(bos[i]) - mode_cmd->offsets[i]) {
-   dev_err(dev->dev,
+   dev_dbg(dev->dev,
"provided buffer object is too small! %d < 
%d\n",
bos[i]->size - mode_cmd->offsets[i], size);
ret = -EINVAL;
-- 
Regards,

Laurent Pinchart



[PATCH v3 06/20] drm: omapdrm: Handle FIFO underflow IRQs internally

2016-09-19 Thread Laurent Pinchart
As the FIFO underflow IRQ handler just prints an error message to the
kernel log, simplify the code by not registering one IRQ handler per
plane but print the messages directly from the main IRQ handler.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Only register error IRQs that exist on the HW
---
 drivers/gpu/drm/omapdrm/omap_drv.c   |  4 +--
 drivers/gpu/drm/omapdrm/omap_drv.h   |  2 +-
 drivers/gpu/drm/omapdrm/omap_irq.c   | 66 ++--
 drivers/gpu/drm/omapdrm/omap_plane.c | 24 -
 4 files changed, 66 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index e1cfba51cff6..23e12362c4b5 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -321,8 +321,6 @@ static int omap_modeset_init(struct drm_device *dev)

drm_mode_config_init(dev);

-   omap_drm_irq_install(dev);
-
ret = omap_modeset_init_properties(dev);
if (ret < 0)
return ret;
@@ -491,6 +489,8 @@ static int omap_modeset_init(struct drm_device *dev)

drm_mode_config_reset(dev);

+   omap_drm_irq_install(dev);
+
return 0;
 }

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 897c5656908b..6bc1588e1c9e 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -102,7 +102,7 @@ struct omap_drm_private {

/* irq handling: */
struct list_head irq_list;/* list of omap_drm_irq */
-   uint32_t vblank_mask; /* irq bits set for userspace vblank */
+   uint32_t irq_mask;  /* enabled irqs in addition to irq_list 
*/
struct omap_drm_irq error_handler;

/* atomic commit */
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index 60e1e8016708..23045f528a93 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -32,7 +32,7 @@ static void omap_irq_update(struct drm_device *dev)
 {
struct omap_drm_private *priv = dev->dev_private;
struct omap_drm_irq *irq;
-   uint32_t irqmask = priv->vblank_mask;
+   uint32_t irqmask = priv->irq_mask;

assert_spin_locked(&list_lock);

@@ -153,7 +153,7 @@ int omap_irq_enable_vblank(struct drm_device *dev, unsigned 
int pipe)
DBG("dev=%p, crtc=%u", dev, pipe);

spin_lock_irqsave(&list_lock, flags);
-   priv->vblank_mask |= pipe2vbl(crtc);
+   priv->irq_mask |= pipe2vbl(crtc);
omap_irq_update(dev);
spin_unlock_irqrestore(&list_lock, flags);

@@ -178,11 +178,52 @@ void omap_irq_disable_vblank(struct drm_device *dev, 
unsigned int pipe)
DBG("dev=%p, crtc=%u", dev, pipe);

spin_lock_irqsave(&list_lock, flags);
-   priv->vblank_mask &= ~pipe2vbl(crtc);
+   priv->irq_mask &= ~pipe2vbl(crtc);
omap_irq_update(dev);
spin_unlock_irqrestore(&list_lock, flags);
 }

+static void omap_irq_fifo_underflow(struct omap_drm_private *priv,
+   u32 irqstatus)
+{
+   static DEFINE_RATELIMIT_STATE(_rs, DEFAULT_RATELIMIT_INTERVAL,
+ DEFAULT_RATELIMIT_BURST);
+   static const struct {
+   const char *name;
+   u32 mask;
+   } sources[] = {
+   { "gfx", DISPC_IRQ_GFX_FIFO_UNDERFLOW },
+   { "vid1", DISPC_IRQ_VID1_FIFO_UNDERFLOW },
+   { "vid2", DISPC_IRQ_VID2_FIFO_UNDERFLOW },
+   { "vid3", DISPC_IRQ_VID3_FIFO_UNDERFLOW },
+   };
+
+   const u32 mask = DISPC_IRQ_GFX_FIFO_UNDERFLOW
+  | DISPC_IRQ_VID1_FIFO_UNDERFLOW
+  | DISPC_IRQ_VID2_FIFO_UNDERFLOW
+  | DISPC_IRQ_VID3_FIFO_UNDERFLOW;
+   unsigned int i;
+
+   spin_lock(&list_lock);
+   irqstatus &= priv->irq_mask & mask;
+   spin_unlock(&list_lock);
+
+   if (!irqstatus)
+   return;
+
+   if (!__ratelimit(&_rs))
+   return;
+
+   DRM_ERROR("FIFO underflow on ");
+
+   for (i = 0; i < ARRAY_SIZE(sources); ++i) {
+   if (sources[i].mask & irqstatus)
+   pr_cont("%s ", sources[i].name);
+   }
+
+   pr_cont("(0x%08x)\n", irqstatus);
+}
+
 static irqreturn_t omap_irq_handler(int irq, void *arg)
 {
struct drm_device *dev = (struct drm_device *) arg;
@@ -205,6 +246,8 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
drm_handle_vblank(dev, id);
}

+   omap_irq_fifo_underflow(priv, irqstatus);
+
spin_lock_irqsave(&list_lock, flags);
list_for_each_entry_safe(handler, n, &priv->irq_list, node) {
if (handler->irqmask & irqstatus) {
@@ -218,6 +261,13 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
return IRQ_HANDLED;
 }

+static const u32 error_irqs[] = {
+   [OMAP_DSS_GF

[PATCH v3 11/20] drm: omapdrm: Check DSS manager state in the enable/disable helpers

2016-09-19 Thread Laurent Pinchart
The omapdrm DSS manager enable/disable operations check the DSS manager
state to avoid double enabling/disabling. Move that code to the DSS
manager to decrease the dependency of the DRM layer to the DSS layer.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/dss/dispc.c  | 1 -
 drivers/gpu/drm/omapdrm/dss/output.c | 6 ++
 drivers/gpu/drm/omapdrm/omap_crtc.c  | 3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 535240fba671..ab150bf21dd8 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -2911,7 +2911,6 @@ bool dispc_mgr_is_enabled(enum omap_channel channel)
 {
return !!mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE);
 }
-EXPORT_SYMBOL(dispc_mgr_is_enabled);

 void dispc_wb_enable(bool enable)
 {
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index 24f859488201..f0be621895fa 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -217,12 +217,18 @@ EXPORT_SYMBOL(dss_mgr_set_lcd_config);

 int dss_mgr_enable(enum omap_channel channel)
 {
+   if (dispc_mgr_is_enabled(channel))
+   return 0;
+
return dss_mgr_ops->enable(channel);
 }
 EXPORT_SYMBOL(dss_mgr_enable);

 void dss_mgr_disable(enum omap_channel channel)
 {
+   if (!dispc_mgr_is_enabled(channel))
+   return;
+
dss_mgr_ops->disable(channel);
 }
 EXPORT_SYMBOL(dss_mgr_disable);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 4b7e16786e1e..a0c26592fc69 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -141,9 +141,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, 
bool enable)
return;
}

-   if (dispc_mgr_is_enabled(channel) == enable)
-   return;
-
if (omap_crtc->channel == OMAP_DSS_CHANNEL_DIGIT) {
/*
 * Digit output produces some sync lost interrupts during the
-- 
Regards,

Laurent Pinchart



[PATCH v3 10/20] drm: omapdrm: Only commit planes on active CRTCs

2016-09-19 Thread Laurent Pinchart
The DRM core supports skipping plane update for inactive CRTCs for
hardware that don't need it or can't cope with it. That's our case, so
use the DRM core infrastructure instead of reinventing it.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 8 +++-
 drivers/gpu/drm/omapdrm/omap_drv.c  | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index f41a638c8d65..4b7e16786e1e 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -424,7 +424,13 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
dispc_mgr_set_gamma(omap_crtc->channel, lut, length);
}

-   /* Only flush the CRTC if it is currently enabled. */
+   /*
+* Only flush the CRTC if it is currently enabled. CRTCs that require a
+* mode set are disabled prior plane updates and enabled afterwards.
+* They are thus not active (regardless of what their CRTC core state
+* reports) and the DRM core could thus call this function even though
+* the CRTC is currently disabled. Do nothing in that case.
+*/
if (!omap_crtc->enabled)
return;

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 23e12362c4b5..113f7a22c41c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -96,7 +96,8 @@ static void omap_atomic_complete(struct 
omap_atomic_state_commit *commit)
dispc_runtime_get();

drm_atomic_helper_commit_modeset_disables(dev, old_state);
-   drm_atomic_helper_commit_planes(dev, old_state, 0);
+   drm_atomic_helper_commit_planes(dev, old_state,
+   DRM_PLANE_COMMIT_ACTIVE_ONLY);
drm_atomic_helper_commit_modeset_enables(dev, old_state);

omap_atomic_wait_for_completion(dev, old_state);
-- 
Regards,

Laurent Pinchart



[PATCH v3 13/20] drm: omapdrm: Use a spinlock to protect the CRTC pending flag

2016-09-19 Thread Laurent Pinchart
The flag will need to be accessed atomically in the vblank interrupt
handler, memory barriers won't be enough.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 8fef6558197b..ac0ec851865c 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -69,6 +69,19 @@ enum omap_channel omap_crtc_channel(struct drm_crtc *crtc)
return omap_crtc->channel;
 }

+static bool omap_crtc_is_pending(struct drm_crtc *crtc)
+{
+   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+   unsigned long flags;
+   bool pending;
+
+   spin_lock_irqsave(&crtc->dev->event_lock, flags);
+   pending = omap_crtc->pending;
+   spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
+
+   return pending;
+}
+
 int omap_crtc_wait_pending(struct drm_crtc *crtc)
 {
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
@@ -78,7 +91,7 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc)
 * a single frame refresh even on slower displays.
 */
return wait_event_timeout(omap_crtc->pending_wait,
- !omap_crtc->pending,
+ !omap_crtc_is_pending(crtc),
  msecs_to_jiffies(250));
 }

@@ -297,6 +310,7 @@ static void omap_crtc_vblank_irq(struct omap_drm_irq *irq, 
uint32_t irqstatus)
struct omap_crtc *omap_crtc =
container_of(irq, struct omap_crtc, vblank_irq);
struct drm_device *dev = omap_crtc->base.dev;
+   struct drm_crtc *crtc = &omap_crtc->base;

if (dispc_mgr_go_busy(omap_crtc->channel))
return;
@@ -305,10 +319,10 @@ static void omap_crtc_vblank_irq(struct omap_drm_irq 
*irq, uint32_t irqstatus)

__omap_irq_unregister(dev, &omap_crtc->vblank_irq);

-   rmb();
+   spin_lock(&crtc->dev->event_lock);
WARN_ON(!omap_crtc->pending);
omap_crtc->pending = false;
-   wmb();
+   spin_unlock(&crtc->dev->event_lock);

/* wake up userspace */
omap_crtc_complete_page_flip(&omap_crtc->base);
@@ -340,10 +354,10 @@ static void omap_crtc_enable(struct drm_crtc *crtc)

DBG("%s", omap_crtc->name);

-   rmb();
+   spin_lock_irq(&crtc->dev->event_lock);
WARN_ON(omap_crtc->pending);
omap_crtc->pending = true;
-   wmb();
+   spin_unlock_irq(&crtc->dev->event_lock);

omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);

@@ -449,10 +463,10 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,

DBG("%s: GO", omap_crtc->name);

-   rmb();
+   spin_lock_irq(&crtc->dev->event_lock);
WARN_ON(omap_crtc->pending);
omap_crtc->pending = true;
-   wmb();
+   spin_unlock_irq(&crtc->dev->event_lock);

dispc_mgr_go(omap_crtc->channel);
omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
-- 
Regards,

Laurent Pinchart



[PATCH v3 18/20] drm: omapdrm: Make pipe2vbl function static

2016-09-19 Thread Laurent Pinchart
The function is only used in omap_irq.c, move it there and make it
static.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 7 ---
 drivers/gpu/drm/omapdrm/omap_drv.h  | 1 -
 drivers/gpu/drm/omapdrm/omap_irq.c  | 7 ++-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 6983a889d811..fb01357721fe 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -48,13 +48,6 @@ struct omap_crtc {
  * Helper Functions
  */

-uint32_t pipe2vbl(struct drm_crtc *crtc)
-{
-   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-
-   return dispc_mgr_get_vsync_irq(omap_crtc->channel);
-}
-
 struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc)
 {
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 8aa8e45098a2..4fee7b94eefb 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -234,7 +234,6 @@ struct drm_gem_object *omap_gem_prime_import(struct 
drm_device *dev,
struct dma_buf *buffer);

 /* map crtc to vblank mask */
-uint32_t pipe2vbl(struct drm_crtc *crtc);
 struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder);

 #endif /* __OMAP_DRV_H__ */
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index 27225492c81b..28ff7b73a853 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -108,6 +108,11 @@ int omap_irq_wait(struct drm_device *dev, struct 
omap_irq_wait *wait,
return 0;
 }

+static uint32_t pipe2vbl(struct drm_crtc *crtc)
+{
+   return dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc));
+}
+
 /**
  * enable_vblank - enable vblank interrupt events
  * @dev: DRM device
@@ -228,7 +233,7 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
struct drm_crtc *crtc = priv->crtcs[id];
enum omap_channel channel = omap_crtc_channel(crtc);

-   if (irqstatus & pipe2vbl(crtc)) {
+   if (irqstatus & dispc_mgr_get_vsync_irq(channel)) {
drm_handle_vblank(dev, id);
omap_crtc_vblank_irq(crtc);
}
-- 
Regards,

Laurent Pinchart



[PATCH v3 09/20] drm: omapdrm: Replace DSS manager state check with omapdrm CRTC state

2016-09-19 Thread Laurent Pinchart
Instead of conditioning planes update based on the DD manager state, use
the enabled field newly added to the omap_crtc structure. This reduces
the dependency from the DRM layer to the DSS layer.

The enabled field is a transitory measure, the implementation should use
the CRTC atomic state instead. However, given that CRTCs are currently
not enabled/disabled through their .enable() and .disable() operations
but through a convoluted code paths starting at the associated encoder
operations, there is not clear guarantee that the atomic state always
matches the hardware state. This will be refactored later, at which
point the enabled field will be removed.

Signed-off-by: Laurent Pinchart 
---
Changes since v2:

- Use enabled field in struct omap_crtc instead of CRTC atomic state
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index cdcfda31043e..f41a638c8d65 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -40,6 +40,7 @@ struct omap_crtc {

bool ignore_digit_sync_lost;

+   bool enabled;
bool pending;
wait_queue_head_t pending_wait;
 };
@@ -136,6 +137,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, 
bool enable)

if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) {
dispc_mgr_enable(channel, enable);
+   omap_crtc->enabled = enable;
return;
}

@@ -172,6 +174,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, 
bool enable)
}

dispc_mgr_enable(channel, enable);
+   omap_crtc->enabled = enable;

ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
if (ret) {
@@ -421,18 +424,19 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
dispc_mgr_set_gamma(omap_crtc->channel, lut, length);
}

-   if (dispc_mgr_is_enabled(omap_crtc->channel)) {
+   /* Only flush the CRTC if it is currently enabled. */
+   if (!omap_crtc->enabled)
+   return;

-   DBG("%s: GO", omap_crtc->name);
+   DBG("%s: GO", omap_crtc->name);

-   rmb();
-   WARN_ON(omap_crtc->pending);
-   omap_crtc->pending = true;
-   wmb();
+   rmb();
+   WARN_ON(omap_crtc->pending);
+   omap_crtc->pending = true;
+   wmb();

-   dispc_mgr_go(omap_crtc->channel);
-   omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
-   }
+   dispc_mgr_go(omap_crtc->channel);
+   omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
 }

 static bool omap_crtc_is_plane_prop(struct drm_device *dev,
-- 
Regards,

Laurent Pinchart



[PATCH v3 08/20] drm: omapdrm: Handle OCP error IRQ directly

2016-09-19 Thread Laurent Pinchart
Instead of going through a complicated registration mechanism, just
call the OCP error IRQ handler directly from the main IRQ handler.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Rename IRQ handler to omap_irq_ocp_error_handler()
- Replace hex error value with "OCP error" message
---
 drivers/gpu/drm/omapdrm/omap_drv.h |  1 -
 drivers/gpu/drm/omapdrm/omap_irq.c | 28 ++--
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 7a1d8384147c..05375bc40091 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -103,7 +103,6 @@ struct omap_drm_private {
/* irq handling: */
struct list_head irq_list;/* list of omap_drm_irq */
uint32_t irq_mask;  /* enabled irqs in addition to irq_list 
*/
-   struct omap_drm_irq error_handler;

/* atomic commit */
struct {
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index f0f110faf1e6..257c1f3c76f3 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -21,12 +21,6 @@

 static DEFINE_SPINLOCK(list_lock);

-static void omap_irq_error_handler(struct omap_drm_irq *irq,
-   uint32_t irqstatus)
-{
-   DRM_ERROR("errors: %08x\n", irqstatus);
-}
-
 /* call with list_lock and dispc runtime held */
 static void omap_irq_update(struct drm_device *dev)
 {
@@ -224,6 +218,14 @@ static void omap_irq_fifo_underflow(struct 
omap_drm_private *priv,
pr_cont("(0x%08x)\n", irqstatus);
 }

+static void omap_irq_ocp_error_handler(u32 irqstatus)
+{
+   if (!(irqstatus & DISPC_IRQ_OCP_ERR))
+   return;
+
+   DRM_ERROR("OCP error\n");
+}
+
 static irqreturn_t omap_irq_handler(int irq, void *arg)
 {
struct drm_device *dev = (struct drm_device *) arg;
@@ -250,6 +252,7 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
omap_crtc_error_irq(crtc, irqstatus);
}

+   omap_irq_ocp_error_handler(irqstatus);
omap_irq_fifo_underflow(priv, irqstatus);

spin_lock_irqsave(&list_lock, flags);
@@ -282,7 +285,6 @@ static const u32 error_irqs[] = {
 int omap_drm_irq_install(struct drm_device *dev)
 {
struct omap_drm_private *priv = dev->dev_private;
-   struct omap_drm_irq *error_handler = &priv->error_handler;
unsigned int num_mgrs = dss_feat_get_num_mgrs();
unsigned int max_planes;
unsigned int i;
@@ -290,7 +292,7 @@ int omap_drm_irq_install(struct drm_device *dev)

INIT_LIST_HEAD(&priv->irq_list);

-   priv->irq_mask = 0;
+   priv->irq_mask = DISPC_IRQ_OCP_ERR;

max_planes = min(ARRAY_SIZE(priv->planes), ARRAY_SIZE(error_irqs));
for (i = 0; i < max_planes; ++i) {
@@ -309,16 +311,6 @@ int omap_drm_irq_install(struct drm_device *dev)
if (ret < 0)
return ret;

-   error_handler->irq = omap_irq_error_handler;
-   error_handler->irqmask = DISPC_IRQ_OCP_ERR;
-
-   /* for now ignore DISPC_IRQ_SYNC_LOST_DIGIT.. really I think
-* we just need to ignore it while enabling tv-out
-*/
-   error_handler->irqmask &= ~DISPC_IRQ_SYNC_LOST_DIGIT;
-
-   omap_irq_register(dev, error_handler);
-
dev->irq_enabled = true;

return 0;
-- 
Regards,

Laurent Pinchart



[PATCH v3 14/20] drm: omapdrm: Keep vblank interrupt enabled while CRTC is active

2016-09-19 Thread Laurent Pinchart
Instead of going through a complicated private IRQ registration
mechanism, handle the vblank interrupt activation with the standard
drm_crtc_vblank_get() and drm_crtc_vblank_put() mechanism. This will let
the DRM core keep the vblank interrupt enabled as long as needed to
update the frame counter.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 38 ++---
 drivers/gpu/drm/omapdrm/omap_drv.h  |  1 +
 drivers/gpu/drm/omapdrm/omap_irq.c  |  4 +++-
 3 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index ac0ec851865c..6983a889d811 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -36,8 +36,6 @@ struct omap_crtc {

struct omap_video_timings timings;

-   struct omap_drm_irq vblank_irq;
-
bool ignore_digit_sync_lost;

bool enabled;
@@ -305,25 +303,24 @@ void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t 
irqstatus)
DRM_ERROR_RATELIMITED("%s: errors: %08x\n", omap_crtc->name, irqstatus);
 }

-static void omap_crtc_vblank_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
+void omap_crtc_vblank_irq(struct drm_crtc *crtc)
 {
-   struct omap_crtc *omap_crtc =
-   container_of(irq, struct omap_crtc, vblank_irq);
-   struct drm_device *dev = omap_crtc->base.dev;
-   struct drm_crtc *crtc = &omap_crtc->base;
+   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+   bool pending;

if (dispc_mgr_go_busy(omap_crtc->channel))
return;

DBG("%s: apply done", omap_crtc->name);

-   __omap_irq_unregister(dev, &omap_crtc->vblank_irq);
-
spin_lock(&crtc->dev->event_lock);
-   WARN_ON(!omap_crtc->pending);
+   pending = omap_crtc->pending;
omap_crtc->pending = false;
spin_unlock(&crtc->dev->event_lock);

+   if (pending)
+   drm_crtc_vblank_put(crtc);
+
/* wake up userspace */
omap_crtc_complete_page_flip(&omap_crtc->base);

@@ -341,8 +338,6 @@ static void omap_crtc_destroy(struct drm_crtc *crtc)

DBG("%s", omap_crtc->name);

-   WARN_ON(omap_crtc->vblank_irq.registered);
-
drm_crtc_cleanup(crtc);

kfree(omap_crtc);
@@ -354,14 +349,13 @@ static void omap_crtc_enable(struct drm_crtc *crtc)

DBG("%s", omap_crtc->name);

+   drm_crtc_vblank_on(crtc);
+   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+
spin_lock_irq(&crtc->dev->event_lock);
WARN_ON(omap_crtc->pending);
omap_crtc->pending = true;
spin_unlock_irq(&crtc->dev->event_lock);
-
-   omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
-
-   drm_crtc_vblank_on(crtc);
 }

 static void omap_crtc_disable(struct drm_crtc *crtc)
@@ -423,8 +417,6 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 {
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);

-   WARN_ON(omap_crtc->vblank_irq.registered);
-
if (crtc->state->color_mgmt_changed) {
struct drm_color_lut *lut = NULL;
uint length = 0;
@@ -463,13 +455,14 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,

DBG("%s: GO", omap_crtc->name);

+   dispc_mgr_go(omap_crtc->channel);
+
+   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+
spin_lock_irq(&crtc->dev->event_lock);
WARN_ON(omap_crtc->pending);
omap_crtc->pending = true;
spin_unlock_irq(&crtc->dev->event_lock);
-
-   dispc_mgr_go(omap_crtc->channel);
-   omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
 }

 static bool omap_crtc_is_plane_prop(struct drm_device *dev,
@@ -593,9 +586,6 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
omap_crtc->channel = channel;
omap_crtc->name = channel_names[channel];

-   omap_crtc->vblank_irq.irqmask = pipe2vbl(crtc);
-   omap_crtc->vblank_irq.irq = omap_crtc_vblank_irq;
-
ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
&omap_crtc_funcs, NULL);
if (ret < 0) {
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 05375bc40091..c549f943ebff 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -155,6 +155,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
struct drm_plane *plane, enum omap_channel channel, int id);
 int omap_crtc_wait_pending(struct drm_crtc *crtc);
 void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus);
+void omap_crtc_vblank_irq(struct drm_crtc *crtc);

 struct drm_plane *omap_plane_init(struct drm_device *dev,
int id, enum drm_plane_type type);
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index 257c1f3c76f3..dd018d7a1e91 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/om

[PATCH v3 15/20] drm: omapdrm: Don't expose the omap_irq_(un)register() functions

2016-09-19 Thread Laurent Pinchart
The IRQ registration functions are not used outside of their compilation
unit, make them static. As the __omap_irq_(un)register() functions are
only called by their omap_irq_(un)register() counterparts, merge them
together.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Split the omap_drm_irq irqstatus parameter removal change out
---
 drivers/gpu/drm/omapdrm/omap_drv.h |  4 
 drivers/gpu/drm/omapdrm/omap_irq.c | 23 +--
 2 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index c549f943ebff..ce9bb54bf03e 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -127,10 +127,6 @@ int omap_gem_resume(struct device *dev);

 int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe);
 void omap_irq_disable_vblank(struct drm_device *dev, unsigned int pipe);
-void __omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq);
-void __omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq);
-void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq);
-void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq);
 void omap_drm_irq_uninstall(struct drm_device *dev);
 int omap_drm_irq_install(struct drm_device *dev);

diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index dd018d7a1e91..b324c45ce01e 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -39,11 +39,12 @@ static void omap_irq_update(struct drm_device *dev)
dispc_read_irqenable();/* flush posted write */
 }

-void __omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq)
+static void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq)
 {
struct omap_drm_private *priv = dev->dev_private;
unsigned long flags;

+   dispc_runtime_get();
spin_lock_irqsave(&list_lock, flags);

if (!WARN_ON(irq->registered)) {
@@ -53,21 +54,15 @@ void __omap_irq_register(struct drm_device *dev, struct 
omap_drm_irq *irq)
}

spin_unlock_irqrestore(&list_lock, flags);
-}
-
-void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq)
-{
-   dispc_runtime_get();
-
-   __omap_irq_register(dev, irq);
-
dispc_runtime_put();
 }

-void __omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq)
+static void omap_irq_unregister(struct drm_device *dev,
+   struct omap_drm_irq *irq)
 {
unsigned long flags;

+   dispc_runtime_get();
spin_lock_irqsave(&list_lock, flags);

if (!WARN_ON(!irq->registered)) {
@@ -77,14 +72,6 @@ void __omap_irq_unregister(struct drm_device *dev, struct 
omap_drm_irq *irq)
}

spin_unlock_irqrestore(&list_lock, flags);
-}
-
-void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq)
-{
-   dispc_runtime_get();
-
-   __omap_irq_unregister(dev, irq);
-
dispc_runtime_put();
 }

-- 
Regards,

Laurent Pinchart



[PATCH v3 19/20] drm: omapdrm: Simplify IRQ wait implementation

2016-09-19 Thread Laurent Pinchart
Now that the IRQ list is used for IRQ wait only we can merge
omap_drm_irq and omap_irq_wait and simplify the implementation.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_drv.h | 17 +--
 drivers/gpu/drm/omapdrm/omap_irq.c | 94 ++
 2 files changed, 37 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 4fee7b94eefb..9baae072fe88 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -48,19 +48,6 @@ struct omap_drm_window {
uint32_t src_w, src_h;
 };

-/* For transiently registering for different DSS irqs that various parts
- * of the KMS code need during setup/configuration.  We these are not
- * necessarily the same as what drm_vblank_get/put() are requesting, and
- * the hysteresis in drm_vblank_put() is not necessarily desirable for
- * internal housekeeping related irq usage.
- */
-struct omap_drm_irq {
-   struct list_head node;
-   uint32_t irqmask;
-   bool registered;
-   void (*irq)(struct omap_drm_irq *irq);
-};
-
 /* For KMS code that needs to wait for a certain # of IRQs:
  */
 struct omap_irq_wait;
@@ -101,8 +88,8 @@ struct omap_drm_private {
struct drm_property *zorder_prop;

/* irq handling: */
-   struct list_head irq_list;/* list of omap_drm_irq */
-   uint32_t irq_mask;  /* enabled irqs in addition to irq_list 
*/
+   struct list_head wait_list; /* list of omap_irq_wait */
+   uint32_t irq_mask;  /* enabled irqs in addition to 
wait_list */

/* atomic commit */
struct {
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index 28ff7b73a853..c93e28be8ff7 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -21,17 +21,23 @@

 static DEFINE_SPINLOCK(list_lock);

+struct omap_irq_wait {
+   struct list_head node;
+   uint32_t irqmask;
+   int count;
+};
+
 /* call with list_lock and dispc runtime held */
 static void omap_irq_update(struct drm_device *dev)
 {
struct omap_drm_private *priv = dev->dev_private;
-   struct omap_drm_irq *irq;
+   struct omap_irq_wait *wait;
uint32_t irqmask = priv->irq_mask;

assert_spin_locked(&list_lock);

-   list_for_each_entry(irq, &priv->irq_list, node)
-   irqmask |= irq->irqmask;
+   list_for_each_entry(wait, &priv->wait_list, node)
+   irqmask |= wait->irqmask;

DBG("irqmask=%08x", irqmask);

@@ -39,61 +45,29 @@ static void omap_irq_update(struct drm_device *dev)
dispc_read_irqenable();/* flush posted write */
 }

-static void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq)
-{
-   struct omap_drm_private *priv = dev->dev_private;
-   unsigned long flags;
-
-   spin_lock_irqsave(&list_lock, flags);
-
-   if (!WARN_ON(irq->registered)) {
-   irq->registered = true;
-   list_add(&irq->node, &priv->irq_list);
-   omap_irq_update(dev);
-   }
-
-   spin_unlock_irqrestore(&list_lock, flags);
-}
-
-static void omap_irq_unregister(struct drm_device *dev,
-   struct omap_drm_irq *irq)
-{
-   unsigned long flags;
-
-   spin_lock_irqsave(&list_lock, flags);
-
-   if (!WARN_ON(!irq->registered)) {
-   irq->registered = false;
-   list_del(&irq->node);
-   omap_irq_update(dev);
-   }
-
-   spin_unlock_irqrestore(&list_lock, flags);
-}
-
-struct omap_irq_wait {
-   struct omap_drm_irq irq;
-   int count;
-};
-
 static DECLARE_WAIT_QUEUE_HEAD(wait_event);

-static void wait_irq(struct omap_drm_irq *irq)
+static void omap_irq_wait_irq(struct omap_irq_wait *wait)
 {
-   struct omap_irq_wait *wait =
-   container_of(irq, struct omap_irq_wait, irq);
wait->count--;
-   wake_up_all(&wait_event);
+   wake_up(&wait_event);
 }

 struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev,
uint32_t irqmask, int count)
 {
+   struct omap_drm_private *priv = dev->dev_private;
struct omap_irq_wait *wait = kzalloc(sizeof(*wait), GFP_KERNEL);
-   wait->irq.irq = wait_irq;
-   wait->irq.irqmask = irqmask;
+   unsigned long flags;
+
+   wait->irqmask = irqmask;
wait->count = count;
-   omap_irq_register(dev, &wait->irq);
+
+   spin_lock_irqsave(&list_lock, flags);
+   list_add(&wait->node, &priv->wait_list);
+   omap_irq_update(dev);
+   spin_unlock_irqrestore(&list_lock, flags);
+
return wait;
 }

@@ -101,11 +75,16 @@ int omap_irq_wait(struct drm_device *dev, struct 
omap_irq_wait *wait,
unsigned long timeout)
 {
int ret = wait_event_timeout(wait_event, (wait->count <= 0), timeout);
-   omap_irq_unregister(dev, &wait->irq);
+

[PATCH v3 20/20] drm: omapdrm: Remove global variables

2016-09-19 Thread Laurent Pinchart
Move the list of pending IRQ wait instances to the omap_drm_private
structure and the wait queue head to the IRQ wait structure.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_drv.h |  3 ++-
 drivers/gpu/drm/omapdrm/omap_irq.c | 42 --
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 9baae072fe88..5f278a74f4e9 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -88,7 +88,8 @@ struct omap_drm_private {
struct drm_property *zorder_prop;

/* irq handling: */
-   struct list_head wait_list; /* list of omap_irq_wait */
+   spinlock_t wait_lock;   /* protects the wait_list */
+   struct list_head wait_list; /* list of omap_irq_wait */
uint32_t irq_mask;  /* enabled irqs in addition to 
wait_list */

/* atomic commit */
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index c93e28be8ff7..4bde4fc16a66 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -19,22 +19,21 @@

 #include "omap_drv.h"

-static DEFINE_SPINLOCK(list_lock);
-
 struct omap_irq_wait {
struct list_head node;
+   wait_queue_head_t wq;
uint32_t irqmask;
int count;
 };

-/* call with list_lock and dispc runtime held */
+/* call with wait_lock and dispc runtime held */
 static void omap_irq_update(struct drm_device *dev)
 {
struct omap_drm_private *priv = dev->dev_private;
struct omap_irq_wait *wait;
uint32_t irqmask = priv->irq_mask;

-   assert_spin_locked(&list_lock);
+   assert_spin_locked(&priv->wait_lock);

list_for_each_entry(wait, &priv->wait_list, node)
irqmask |= wait->irqmask;
@@ -45,12 +44,10 @@ static void omap_irq_update(struct drm_device *dev)
dispc_read_irqenable();/* flush posted write */
 }

-static DECLARE_WAIT_QUEUE_HEAD(wait_event);
-
 static void omap_irq_wait_irq(struct omap_irq_wait *wait)
 {
wait->count--;
-   wake_up(&wait_event);
+   wake_up(&wait->wq);
 }

 struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev,
@@ -60,13 +57,14 @@ struct omap_irq_wait * omap_irq_wait_init(struct drm_device 
*dev,
struct omap_irq_wait *wait = kzalloc(sizeof(*wait), GFP_KERNEL);
unsigned long flags;

+   init_waitqueue_head(&wait->wq);
wait->irqmask = irqmask;
wait->count = count;

-   spin_lock_irqsave(&list_lock, flags);
+   spin_lock_irqsave(&priv->wait_lock, flags);
list_add(&wait->node, &priv->wait_list);
omap_irq_update(dev);
-   spin_unlock_irqrestore(&list_lock, flags);
+   spin_unlock_irqrestore(&priv->wait_lock, flags);

return wait;
 }
@@ -74,13 +72,16 @@ struct omap_irq_wait * omap_irq_wait_init(struct drm_device 
*dev,
 int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
unsigned long timeout)
 {
-   int ret = wait_event_timeout(wait_event, (wait->count <= 0), timeout);
+   struct omap_drm_private *priv = dev->dev_private;
unsigned long flags;
+   int ret;
+
+   ret = wait_event_timeout(wait->wq, (wait->count <= 0), timeout);

-   spin_lock_irqsave(&list_lock, flags);
+   spin_lock_irqsave(&priv->wait_lock, flags);
list_del(&wait->node);
omap_irq_update(dev);
-   spin_unlock_irqrestore(&list_lock, flags);
+   spin_unlock_irqrestore(&priv->wait_lock, flags);

kfree(wait);

@@ -113,10 +114,10 @@ int omap_irq_enable_vblank(struct drm_device *dev, 
unsigned int pipe)

DBG("dev=%p, crtc=%u", dev, pipe);

-   spin_lock_irqsave(&list_lock, flags);
+   spin_lock_irqsave(&priv->wait_lock, flags);
priv->irq_mask |= pipe2vbl(crtc);
omap_irq_update(dev);
-   spin_unlock_irqrestore(&list_lock, flags);
+   spin_unlock_irqrestore(&priv->wait_lock, flags);

return 0;
 }
@@ -138,10 +139,10 @@ void omap_irq_disable_vblank(struct drm_device *dev, 
unsigned int pipe)

DBG("dev=%p, crtc=%u", dev, pipe);

-   spin_lock_irqsave(&list_lock, flags);
+   spin_lock_irqsave(&priv->wait_lock, flags);
priv->irq_mask &= ~pipe2vbl(crtc);
omap_irq_update(dev);
-   spin_unlock_irqrestore(&list_lock, flags);
+   spin_unlock_irqrestore(&priv->wait_lock, flags);
 }

 static void omap_irq_fifo_underflow(struct omap_drm_private *priv,
@@ -165,9 +166,9 @@ static void omap_irq_fifo_underflow(struct omap_drm_private 
*priv,
   | DISPC_IRQ_VID3_FIFO_UNDERFLOW;
unsigned int i;

-   spin_lock(&list_lock);
+   spin_lock(&priv->wait_lock);
irqstatus &= priv->irq_mask & mask;
-   spin_unlock(&list_lock);
+   spin_unlock(&priv->wait_lock);

if (!irqstatus)
return;
@@ -224,12 +225,12 @@

[PATCH v3 03/20] drm: omapdrm: fb: Simplify objects lookup when creating framebuffer

2016-09-19 Thread Laurent Pinchart
Merge the single-user objects_lookup inline function into its caller,
allowing reuse of the error code path.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/omap_drv.h | 25 -
 drivers/gpu/drm/omapdrm/omap_fb.c  | 29 ++---
 2 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index dcc30a98b9d4..897c5656908b 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -240,29 +240,4 @@ struct drm_gem_object *omap_gem_prime_import(struct 
drm_device *dev,
 uint32_t pipe2vbl(struct drm_crtc *crtc);
 struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder);

-/* should these be made into common util helpers?
- */
-
-static inline int objects_lookup(
-   struct drm_file *filp, uint32_t pixel_format,
-   struct drm_gem_object **bos, const uint32_t *handles)
-{
-   int i, n = drm_format_num_planes(pixel_format);
-
-   for (i = 0; i < n; i++) {
-   bos[i] = drm_gem_object_lookup(filp, handles[i]);
-   if (!bos[i])
-   goto fail;
-
-   }
-
-   return 0;
-
-fail:
-   while (--i > 0)
-   drm_gem_object_unreference_unlocked(bos[i]);
-
-   return -ENOENT;
-}
-
 #endif /* __OMAP_DRV_H__ */
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c 
b/drivers/gpu/drm/omapdrm/omap_fb.c
index 3cd627f49e5d..705901bcdfb1 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -354,22 +354,29 @@ void omap_framebuffer_describe(struct drm_framebuffer 
*fb, struct seq_file *m)
 struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd)
 {
+   unsigned int num_planes = drm_format_num_planes(mode_cmd->pixel_format);
struct drm_gem_object *bos[4];
struct drm_framebuffer *fb;
-   int ret;
+   int i;

-   ret = objects_lookup(file, mode_cmd->pixel_format,
-   bos, mode_cmd->handles);
-   if (ret)
-   return ERR_PTR(ret);
+   for (i = 0; i < num_planes; i++) {
+   bos[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
+   if (!bos[i]) {
+   fb = ERR_PTR(-ENOENT);
+   goto error;
+   }
+   }

fb = omap_framebuffer_init(dev, mode_cmd, bos);
-   if (IS_ERR(fb)) {
-   int i, n = drm_format_num_planes(mode_cmd->pixel_format);
-   for (i = 0; i < n; i++)
-   drm_gem_object_unreference_unlocked(bos[i]);
-   return fb;
-   }
+   if (IS_ERR(fb))
+   goto error;
+
+   return fb;
+
+error:
+   while (--i > 0)
+   drm_gem_object_unreference_unlocked(bos[i]);
+
return fb;
 }

-- 
Regards,

Laurent Pinchart



[PATCH v3 04/20] drm: omapdrm: fb: Simplify mode command checks when creating framebuffer

2016-09-19 Thread Laurent Pinchart
The hardware requires all planes to have an identical pitch in number of
pixels. Given that all supported formats use the same number of bytes
per pixel in all planes, framebuffer creation checks can be simplified.
The implementations assumes that no format use more than two planes
which is true with the existing hardware.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Clarify commit message and mention explicitly in the code that only
  one and two planes formats are supported.
- Rebase on top of the switch to drm_format_info()
---
 drivers/gpu/drm/omapdrm/omap_fb.c | 58 +--
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c 
b/drivers/gpu/drm/omapdrm/omap_fb.c
index 705901bcdfb1..903d61dd910c 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -387,6 +387,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct 
drm_device *dev,
struct omap_framebuffer *omap_fb = NULL;
struct drm_framebuffer *fb = NULL;
enum omap_color_mode dss_format = 0;
+   unsigned int pitch = mode_cmd->pitches[0];
int ret, i;

DBG("create framebuffer: dev=%p, mode_cmd=%p (%dx%d@%4.4s)",
@@ -420,41 +421,44 @@ struct drm_framebuffer *omap_framebuffer_init(struct 
drm_device *dev,
omap_fb->dss_format = dss_format;
mutex_init(&omap_fb->lock);

+   /*
+* The code below assumes that no format use more than two planes, and
+* that the two planes of multiplane formats need the same number of
+* bytes per pixel.
+*/
+   if (format->num_planes == 2 && pitch != mode_cmd->pitches[1]) {
+   dev_err(dev->dev, "pitches differ between planes 0 and 1\n");
+   ret = -EINVAL;
+   goto fail;
+   }
+
+   if (pitch < mode_cmd->width * format->cpp[0]) {
+   dev_err(dev->dev,
+   "provided buffer pitch is too small! %u < %u\n",
+   pitch, mode_cmd->width * format->cpp[0]);
+   ret = -EINVAL;
+   goto fail;
+   }
+
+   if (pitch % format->cpp[0]) {
+   dev_err(dev->dev,
+   "buffer pitch (%u bytes) is not a multiple of pixel 
size (%u bytes)\n",
+   pitch, format->cpp[0]);
+   ret = -EINVAL;
+   goto fail;
+   }
+
for (i = 0; i < format->num_planes; i++) {
struct plane *plane = &omap_fb->planes[i];
-   unsigned int pitch = mode_cmd->pitches[i];
-   unsigned int hsub = i == 0 ? 1 : format->hsub;
unsigned int vsub = i == 0 ? 1 : format->vsub;
unsigned int size;

-   if (pitch < mode_cmd->width * format->cpp[i] / hsub) {
-   dev_err(dev->dev, "provided buffer pitch is too small! 
%d < %d\n",
-   pitch, mode_cmd->width * format->cpp[i] / hsub);
-   ret = -EINVAL;
-   goto fail;
-   }
-
-   if (pitch % format->cpp[i] != 0) {
-   dev_err(dev->dev,
-   "buffer pitch (%d bytes) is not a multiple of 
pixel size (%d bytes)\n",
-   pitch, format->cpp[i]);
-   ret = -EINVAL;
-   goto fail;
-   }
-
size = pitch * mode_cmd->height / vsub;

-   if (size > (omap_gem_mmap_size(bos[i]) - mode_cmd->offsets[i])) 
{
-   dev_err(dev->dev, "provided buffer object is too small! 
%d < %d\n",
-   bos[i]->size - mode_cmd->offsets[i], 
size);
-   ret = -EINVAL;
-   goto fail;
-   }
-
-   if (i > 0 && pitch != mode_cmd->pitches[i - 1]) {
+   if (size > omap_gem_mmap_size(bos[i]) - mode_cmd->offsets[i]) {
dev_err(dev->dev,
-   "pitches are not the same between framebuffer 
planes %d != %d\n",
-   pitch, mode_cmd->pitches[i - 1]);
+   "provided buffer object is too small! %d < 
%d\n",
+   bos[i]->size - mode_cmd->offsets[i], size);
ret = -EINVAL;
goto fail;
}
-- 
Regards,

Laurent Pinchart



[PATCH v3 07/20] drm: omapdrm: Handle CRTC error IRQs directly

2016-09-19 Thread Laurent Pinchart
Instead of going through a complicated registration mechanism, just
expose the CRTC error IRQ function and call it directly from the main
IRQ handler.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 12 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h  |  1 +
 drivers/gpu/drm/omapdrm/omap_irq.c  |  8 
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 180f644e861e..cdcfda31043e 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -37,7 +37,6 @@ struct omap_crtc {
struct omap_video_timings timings;

struct omap_drm_irq vblank_irq;
-   struct omap_drm_irq error_irq;

bool ignore_digit_sync_lost;

@@ -275,10 +274,9 @@ static void omap_crtc_complete_page_flip(struct drm_crtc 
*crtc)
spin_unlock_irqrestore(&dev->event_lock, flags);
 }

-static void omap_crtc_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
+void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus)
 {
-   struct omap_crtc *omap_crtc =
-   container_of(irq, struct omap_crtc, error_irq);
+   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);

if (omap_crtc->ignore_digit_sync_lost) {
irqstatus &= ~DISPC_IRQ_SYNC_LOST_DIGIT;
@@ -325,7 +323,6 @@ static void omap_crtc_destroy(struct drm_crtc *crtc)
DBG("%s", omap_crtc->name);

WARN_ON(omap_crtc->vblank_irq.registered);
-   omap_irq_unregister(crtc->dev, &omap_crtc->error_irq);

drm_crtc_cleanup(crtc);

@@ -562,11 +559,6 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
omap_crtc->vblank_irq.irqmask = pipe2vbl(crtc);
omap_crtc->vblank_irq.irq = omap_crtc_vblank_irq;

-   omap_crtc->error_irq.irqmask =
-   dispc_mgr_get_sync_lost_irq(channel);
-   omap_crtc->error_irq.irq = omap_crtc_error_irq;
-   omap_irq_register(dev, &omap_crtc->error_irq);
-
ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
&omap_crtc_funcs, NULL);
if (ret < 0) {
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 6bc1588e1c9e..7a1d8384147c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -155,6 +155,7 @@ void omap_crtc_pre_uninit(void);
 struct drm_crtc *omap_crtc_init(struct drm_device *dev,
struct drm_plane *plane, enum omap_channel channel, int id);
 int omap_crtc_wait_pending(struct drm_crtc *crtc);
+void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus);

 struct drm_plane *omap_plane_init(struct drm_device *dev,
int id, enum drm_plane_type type);
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index 23045f528a93..f0f110faf1e6 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -241,9 +241,13 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)

for (id = 0; id < priv->num_crtcs; id++) {
struct drm_crtc *crtc = priv->crtcs[id];
+   enum omap_channel channel = omap_crtc_channel(crtc);

if (irqstatus & pipe2vbl(crtc))
drm_handle_vblank(dev, id);
+
+   if (irqstatus & dispc_mgr_get_sync_lost_irq(channel))
+   omap_crtc_error_irq(crtc, irqstatus);
}

omap_irq_fifo_underflow(priv, irqstatus);
@@ -279,6 +283,7 @@ int omap_drm_irq_install(struct drm_device *dev)
 {
struct omap_drm_private *priv = dev->dev_private;
struct omap_drm_irq *error_handler = &priv->error_handler;
+   unsigned int num_mgrs = dss_feat_get_num_mgrs();
unsigned int max_planes;
unsigned int i;
int ret;
@@ -293,6 +298,9 @@ int omap_drm_irq_install(struct drm_device *dev)
priv->irq_mask |= error_irqs[i];
}

+   for (i = 0; i < num_mgrs; ++i)
+   priv->irq_mask |= dispc_mgr_get_sync_lost_irq(i);
+
dispc_runtime_get();
dispc_clear_irqstatus(0x);
dispc_runtime_put();
-- 
Regards,

Laurent Pinchart



[PATCH v3 12/20] drm: omapdrm: Prevent processing the same event multiple times

2016-09-19 Thread Laurent Pinchart
The vblank interrupt is disabled after one occurrence, preventing the
atomic update event from being processed twice. However, this also
prevents the software frame counter from being updated correctly that
would require vblank interrupts to be kept enabled while the CRTC is
active.

In preparation for vblank interrupt fixes, make sure that the atomic
update event will be processed once only when the vblank interrupt will
be kept enabled.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index a0c26592fc69..8fef6558197b 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -43,6 +43,7 @@ struct omap_crtc {
bool enabled;
bool pending;
wait_queue_head_t pending_wait;
+   struct drm_pending_vblank_event *event;
 };

 /* 
-
@@ -260,11 +261,15 @@ static const struct dss_mgr_ops mgr_ops = {

 static void omap_crtc_complete_page_flip(struct drm_crtc *crtc)
 {
+   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
struct drm_pending_vblank_event *event;
struct drm_device *dev = crtc->dev;
unsigned long flags;

-   event = crtc->state->event;
+   spin_lock_irqsave(&dev->event_lock, flags);
+   event = omap_crtc->event;
+   omap_crtc->event = NULL;
+   spin_unlock_irqrestore(&dev->event_lock, flags);

if (!event)
return;
@@ -384,12 +389,23 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc,
 }

 static void omap_crtc_atomic_begin(struct drm_crtc *crtc,
-  struct drm_crtc_state *old_crtc_state)
+  struct drm_crtc_state *old_crtc_state)
 {
+   struct drm_pending_vblank_event *event = crtc->state->event;
+   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+   unsigned long flags;
+
+   if (event) {
+   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
+
+   spin_lock_irqsave(&crtc->dev->event_lock, flags);
+   omap_crtc->event = event;
+   spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
+   }
 }

 static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
-  struct drm_crtc_state *old_crtc_state)
+  struct drm_crtc_state *old_crtc_state)
 {
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);

-- 
Regards,

Laurent Pinchart



[PATCH v3 17/20] drm: omapdrm: Don't call DISPC power handling in IRQ wait functions

2016-09-19 Thread Laurent Pinchart
The IRQ wait functions are called from the DSS enable and disable
operations only, where the DISPC is guaranteed to be enabled. There's no
need for manual DISPC power management there.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/omap_irq.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index df4a83a6f2df..27225492c81b 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -44,7 +44,6 @@ static void omap_irq_register(struct drm_device *dev, struct 
omap_drm_irq *irq)
struct omap_drm_private *priv = dev->dev_private;
unsigned long flags;

-   dispc_runtime_get();
spin_lock_irqsave(&list_lock, flags);

if (!WARN_ON(irq->registered)) {
@@ -54,7 +53,6 @@ static void omap_irq_register(struct drm_device *dev, struct 
omap_drm_irq *irq)
}

spin_unlock_irqrestore(&list_lock, flags);
-   dispc_runtime_put();
 }

 static void omap_irq_unregister(struct drm_device *dev,
@@ -62,7 +60,6 @@ static void omap_irq_unregister(struct drm_device *dev,
 {
unsigned long flags;

-   dispc_runtime_get();
spin_lock_irqsave(&list_lock, flags);

if (!WARN_ON(!irq->registered)) {
@@ -72,7 +69,6 @@ static void omap_irq_unregister(struct drm_device *dev,
}

spin_unlock_irqrestore(&list_lock, flags);
-   dispc_runtime_put();
 }

 struct omap_irq_wait {
-- 
Regards,

Laurent Pinchart



[PATCH v3 16/20] drm: omapdrm: Remove unused parameter from omap_drm_irq handler

2016-09-19 Thread Laurent Pinchart
The only omap_drm_irq handler doesn't use the irqstatus parameter passed
to the function. Remove it.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- New patch
---
 drivers/gpu/drm/omapdrm/omap_drv.h | 2 +-
 drivers/gpu/drm/omapdrm/omap_irq.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index ce9bb54bf03e..8aa8e45098a2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -58,7 +58,7 @@ struct omap_drm_irq {
struct list_head node;
uint32_t irqmask;
bool registered;
-   void (*irq)(struct omap_drm_irq *irq, uint32_t irqstatus);
+   void (*irq)(struct omap_drm_irq *irq);
 };

 /* For KMS code that needs to wait for a certain # of IRQs:
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c 
b/drivers/gpu/drm/omapdrm/omap_irq.c
index b324c45ce01e..df4a83a6f2df 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -82,7 +82,7 @@ struct omap_irq_wait {

 static DECLARE_WAIT_QUEUE_HEAD(wait_event);

-static void wait_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
+static void wait_irq(struct omap_drm_irq *irq)
 {
struct omap_irq_wait *wait =
container_of(irq, struct omap_irq_wait, irq);
@@ -248,7 +248,7 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
list_for_each_entry_safe(handler, n, &priv->irq_list, node) {
if (handler->irqmask & irqstatus) {
spin_unlock_irqrestore(&list_lock, flags);
-   handler->irq(handler, handler->irqmask & irqstatus);
+   handler->irq(handler);
spin_lock_irqsave(&list_lock, flags);
}
}
-- 
Regards,

Laurent Pinchart



[PATCH] drm: include linux/seq_file.h as needed

2016-09-19 Thread Arnd Bergmann
The addition of the debugfs info created references to seq_puts() and
seq_printf(), but relied on the debugfs header to be included implicitly,
which apparently doesn't happen all the time, as seen from this randconfig
build output:

drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_downstream_debug':
drivers/gpu/drm/drm_dp_helper.c:552:2: error: implicit declaration of function 
'seq_printf' [-Werror=implicit-function-declaration]
drivers/gpu/drm/drm_dp_helper.c:560:3: error: implicit declaration of function 
'seq_puts' [-Werror=implicit-function-declaration]

Adding the extra include brings back a clean build.

Fixes: 80209e5f2c42 ("drm: Add DP branch device info on debugfs")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/drm_dp_helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index a07adf0a07db..3e6fe82c6d64 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

-- 
2.9.0



[Intel-gfx] [PATCH 04/10] drm: Extract drm_plane.[hc]

2016-09-19 Thread Daniel Vetter
On Tue, Sep 06, 2016 at 12:59:31PM -0400, Sean Paul wrote:
> On Wed, Aug 31, 2016 at 12:09 PM, Daniel Vetter  
> wrote:
> > Just pure code movement, cleanup and polish will happen in later
> > patches.
> >
> > v2: Don't forget all the ioctl! To extract those cleanly I decided to
> > put check_src_coords into drm_framebuffer.c (and give it a
> > drm_framebuffer_ prefix), since that just checks framebuffer
> > constraints.
> >
> > Signed-off-by: Daniel Vetter 
> > ---
> >  Documentation/gpu/drm-kms.rst   |  12 +
> >  drivers/gpu/drm/Makefile|   3 +-
> >  drivers/gpu/drm/drm_crtc.c  | 939 
> > +---
> >  drivers/gpu/drm/drm_crtc_internal.h |  38 +-
> >  drivers/gpu/drm/drm_framebuffer.c   |  26 +
> >  drivers/gpu/drm/drm_plane.c | 937 
> > +++
> >  include/drm/drm_atomic.h| 154 ++
> >  include/drm/drm_crtc.h  | 583 +-
> >  include/drm/drm_plane.h | 470 ++
> >  9 files changed, 1628 insertions(+), 1534 deletions(-)
> >  create mode 100644 drivers/gpu/drm/drm_plane.c
> >  create mode 100644 include/drm/drm_plane.h
> >
> > diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> > index f9a991bb87d4..33181be97151 100644
> > --- a/Documentation/gpu/drm-kms.rst
> > +++ b/Documentation/gpu/drm-kms.rst
> > @@ -110,6 +110,18 @@ Note that dumb objects may not be used for gpu 
> > acceleration, as has been
> >  attempted on some ARM embedded platforms. Such drivers really must have
> >  a hardware-specific ioctl to allocate suitable buffer objects.
> >
> > +Plane Abstraction
> > +=
> > +
> > +Plane Functions Reference
> > +-
> > +
> > +.. kernel-doc:: include/drm/drm_plane.h
> > +   :internal:
> > +
> > +.. kernel-doc:: drivers/gpu/drm/drm_plane.c
> > +   :export:
> > +
> >  Display Modes Function Reference
> >  
> >
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index 439d89b25ae0..8eeb07a35798 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -14,7 +14,8 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
> > drm_rect.o drm_vma_manager.o drm_flip_work.o \
> > drm_modeset_lock.o drm_atomic.o drm_bridge.o \
> > drm_framebuffer.o drm_connector.o drm_blend.o \
> > -   drm_encoder.o drm_mode_object.o drm_property.o
> > +   drm_encoder.o drm_mode_object.o drm_property.o \
> > +   drm_plane.o
> >
> >  drm-$(CONFIG_COMPAT) += drm_ioc32.o
> >  drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
> > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> > index 0fad433f4d2d..513ab4729683 100644
> > --- a/drivers/gpu/drm/drm_crtc.c
> > +++ b/drivers/gpu/drm/drm_crtc.c
> 
> 
> 
> > -
> > -static int check_src_coords(uint32_t src_x, uint32_t src_y,
> > -   uint32_t src_w, uint32_t src_h,
> > -   const struct drm_framebuffer *fb)
> > -{
> > -   unsigned int fb_width, fb_height;
> > -
> > -   fb_width = fb->width << 16;
> > -   fb_height = fb->height << 16;
> > -
> > -   /* Make sure source coordinates are inside the fb. */
> > -   if (src_w > fb_width ||
> > -   src_x > fb_width - src_w ||
> > -   src_h > fb_height ||
> > -   src_y > fb_height - src_h) {
> > -   DRM_DEBUG_KMS("Invalid source coordinates "
> > - "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
> > - src_w >> 16, ((src_w & 0x) * 15625) >> 10,
> > - src_h >> 16, ((src_h & 0x) * 15625) >> 10,
> > - src_x >> 16, ((src_x & 0x) * 15625) >> 10,
> > - src_y >> 16, ((src_y & 0x) * 15625) >> 
> > 10);
> > -   return -ENOSPC;
> > -   }
> > -
> > -   return 0;
> > -}
> 
> I'm good with this change, but I'd argue that it probably belongs in
> its own patch.

Except for moving the function + giving it a prefix (since it's no longer
static) there's no change here.
> 
> 
> 
> 
> >  /**
> > - * drm_mode_page_flip_ioctl - schedule an asynchronous fb update
> > - * @dev: DRM device
> > - * @data: ioctl data
> > - * @file_priv: DRM file info
> > - *
> > - * This schedules an asynchronous update on a given CRTC, called page flip.
> > - * Optionally a drm event is generated to signal the completion of the 
> > event.
> > - * Generic drivers cannot assume that a pageflip with changed framebuffer
> > - * properties (including driver specific metadata like tiling layout) will 
> > work,
> > - * but some drivers support e.g. pixel format changes through the pageflip
> > - * ioctl.
> > - *
> > - * Called by the user via ioctl.
> > - *
> > - * Returns:
> > - * Zero on success, negative errno on failur

[PATCH 05/10] drm/doc: Polish for drm_plane.[hc]

2016-09-19 Thread Daniel Vetter
On Fri, Sep 02, 2016 at 03:00:38PM +0530, Archit Taneja wrote:
> 
> 
> On 8/31/2016 9:39 PM, Daniel Vetter wrote:
> > Big thing is untangling and carefully documenting the different uapi
> > types of planes. I also sprinkled a few more cross references around
> > to make this easier to discover.
> > 
> > As usual, remove the kerneldoc for internal functions which are not
> > exported. Aside: We should probably go OCD on all the ioctl handlers
> > and consistenly give them an _ioctl postfix.
> > 
> > Signed-off-by: Daniel Vetter 
> > ---
> >   Documentation/gpu/drm-kms.rst |  47 +--
> >   drivers/gpu/drm/drm_crtc.c|   6 +-
> >   drivers/gpu/drm/drm_plane.c   | 132 
> > --
> >   include/drm/drm_plane.h   |  57 +-
> >   4 files changed, 86 insertions(+), 156 deletions(-)
> > 
> 
> 
> > +/**
> > + * enum drm_plane_type - uapi plane type enumeration
> > + *
> > + * For historical reasons not all planes are made the same. This 
> > enumeration is
> > + * used to tell the different types of planes apart to implement the 
> > different
> > + * uapi semantics for them. For userspace which is universal plane aware 
> > and
> > + * which is using that atomic IOCTL there's no difference between these 
> > planes
> > + * (beyong what the driver and hardware can support of course).
> > + *
> > + * For compatibility with legacy userspace, only overlay planes are made
> > + * available to userspace by default. Userspace clients may set the
> > + * DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that 
> > they
> > + * wish to receive a universal plane list containing all plane types. See 
> > also
> > + * drm_for_each_legacy_plane().
> > + */
> >   enum drm_plane_type {
> > -   DRM_PLANE_TYPE_OVERLAY,
> 
> Any reason why you moved this down? I guess there is no harm, but people
> might be printing plane type while debugging, and they'd assume
> DRM_PLANE_TYPE_OVERLAY=0

I think starting out with 0 for the primary plane makes a lot more sense,
and since it's an internal thing we can change it however we want. I also
think from a documentation pov it reads better if the 2 special planes
(primary and cursor) are first.

But I'm happy to shuffle it back if you feel strongly the other way round.
-Daniel

> 
> Thanks,
> Archit
> 
> > +   /**
> > +* @DRM_PLANE_TYPE_PRIMARY:
> > +*
> > +* Primary planes represent a "main" plane for a CRTC.  Primary planes
> > +* are the planes operated upon by CRTC modesetting and flipping
> > +* operations described in the page_flip and set_config hooks in struct
> > +* &drm_crtc_funcs.
> > +*/
> > DRM_PLANE_TYPE_PRIMARY,
> > +
> > +   /**
> > +* @DRM_PLANE_TYPE_CURSOR:
> > +*
> > +* Cursor planes represent a "cursor" plane for a CRTC.  Cursor planes
> > +* are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
> > +* DRM_IOCTL_MODE_CURSOR2 IOCTLs.
> > +*/
> > DRM_PLANE_TYPE_CURSOR,
> > +
> > +   /**
> > +* @DRM_PLANE_TYPE_OVERLAY:
> > +*
> > +* Overlay planes represent all non-primary, non-cursor planes. Some
> > +* drivers refer to these types of planes as "sprites" internally.
> > +*/
> > +   DRM_PLANE_TYPE_OVERLAY,
> >   };
> > 
> > 
> > @@ -458,11 +496,26 @@ static inline struct drm_plane *drm_plane_find(struct 
> > drm_device *dev,
> > list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
> > for_each_if ((plane_mask) & (1 << drm_plane_index(plane)))
> > 
> > -/* Plane list iterator for legacy (overlay only) planes. */
> > +/**
> > + * drm_for_each_legacy_plane - iterate over all planes for legacy userspace
> > + * @plane: the loop cursor
> > + * @dev: the DRM device
> > + *
> > + * Iterate over all legacy planes of @dev, excluding primary and cursor 
> > planes.
> > + * This is useful for implementing userspace apis when userspace is not
> > + * universal plane aware. See also enum &drm_plane_type.
> > + */
> >   #define drm_for_each_legacy_plane(plane, dev) \
> > list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
> > for_each_if (plane->type == DRM_PLANE_TYPE_OVERLAY)
> > 
> > +/**
> > + * drm_for_each_plane - iterate over all planes
> > + * @plane: the loop cursor
> > + * @dev: the DRM device
> > + *
> > + * Iterate over all planes of @dev, include primary and cursor planes.
> > + */
> >   #define drm_for_each_plane(plane, dev) \
> > list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
> > 
> > 
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH] drm: include linux/seq_file.h as needed

2016-09-19 Thread Jani Nikula
On Mon, 19 Sep 2016, Arnd Bergmann  wrote:
> The addition of the debugfs info created references to seq_puts() and
> seq_printf(), but relied on the debugfs header to be included implicitly,
> which apparently doesn't happen all the time, as seen from this randconfig
> build output:
>
> drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_downstream_debug':
> drivers/gpu/drm/drm_dp_helper.c:552:2: error: implicit declaration of 
> function 'seq_printf' [-Werror=implicit-function-declaration]
> drivers/gpu/drm/drm_dp_helper.c:560:3: error: implicit declaration of 
> function 'seq_puts' [-Werror=implicit-function-declaration]
>
> Adding the extra include brings back a clean build.

Beat you to it, but no review/acks...

http://patchwork.freedesktop.org/patch/msgid/1474020396-14875-1-git-send-email-jani.nikula
 at intel.com

BR,
Jani.


>
> Fixes: 80209e5f2c42 ("drm: Add DP branch device info on debugfs")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index a07adf0a07db..3e6fe82c6d64 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -27,6 +27,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH 00/14] drm: Fix a bunch of sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

I got a bit fed up from the sparse noise during a full build,
so I tried to shut some of it up. Mostly missing statics or function
declarations.

I didn't touch the main offender (radeon/amdgpu) since there was enough
of this stuff in the other drivers as well. Nouveau was pretty bad too,
but it was spread around mode so I didn't realize how much there was
until I was already half way through. If I had, I probably wouldn't
have bothered. There's still a bunch of warnings left in many of the
drivers (__mmio type of stuff is probably responsible for most of it).

Entire series avaialable here:
git://github.com/vsyrjala/linux.git drm_sparse_warn

Ville Syrjälä (14):
  drm/atomic-helper: Fix sparse warnings
  drm/blend: Fix sparse warnings
  drm/fb-helper: Fix sparse warnings
  drm/arm: Fix sparse warnings
  drm/ast: Fix sparse warnings
  drm/bochs: Fix sparse warnings
  drm/cirrus: Fix sparse warnings
  drm/mgag200: Fix sparse warnings
  drm/msm: Fix sparse warnings
  drm/nouveau: Fix sparse warnings
  drm/rockchip: Fix sparse warnings
  drm/sti: Fix sparse warnings
  drm/sun4i: Fix sparse warnings
  drm/tilcdc: Fix sparse warnings

 drivers/gpu/drm/arm/malidp_planes.c|  6 ++--
 drivers/gpu/drm/ast/ast_drv.c  |  2 +-
 drivers/gpu/drm/ast/ast_ttm.c  |  2 +-
 drivers/gpu/drm/bochs/bochs_kms.c  |  2 +-
 drivers/gpu/drm/bochs/bochs_mm.c   |  2 +-
 drivers/gpu/drm/cirrus/cirrus_drv.c|  2 +-
 drivers/gpu/drm/cirrus/cirrus_ttm.c|  2 +-
 drivers/gpu/drm/drm_atomic_helper.c|  2 +-
 drivers/gpu/drm/drm_blend.c|  2 +-
 drivers/gpu/drm/drm_crtc_helper_internal.h |  7 
 drivers/gpu/drm/drm_fb_helper.c|  2 ++
 drivers/gpu/drm/mgag200/mgag200_drv.c  |  2 +-
 drivers/gpu/drm/mgag200/mgag200_ttm.c  |  2 +-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c   |  2 +-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c  |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c| 12 +++
 drivers/gpu/drm/msm/msm_fb.c   |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/overlay.c |  2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c|  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c  |  2 +-
 drivers/gpu/drm/nouveau/nv10_fence.c   |  2 +-
 drivers/gpu/drm/nouveau/nvif/client.c  |  2 +-
 drivers/gpu/drm/nouveau/nvkm/core/firmware.c   |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/user.c  |  2 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/channv50.c|  8 ++---
 drivers/gpu/drm/nouveau/nvkm/engine/disp/coreg94.c |  2 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/coregp104.c   |  2 +-
 .../gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c|  2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg94.c  |  2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c |  4 +--
 drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c  |  2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c  |  2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxnv50.c   |  1 +
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c |  4 +--
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c |  4 +--
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c |  2 +-
 drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c  |  4 +--
 drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c |  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c |  4 +--
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c|  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c  |  8 ++---
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr2.c |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr3.c |  1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c   |  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c  |  2 +-
 .../gpu/drm/nouveau/nvkm/subdev/iccsense/base.c|  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c |  4 +--
 drivers/gpu/drm/nouveau/nvkm/subdev/mc/g84.c   |  2 +-
 .../gpu/drm/nouveau/nvkm/subdev/secboot/gm200.c|  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c   |  4 +--
 drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c   |  4 +--
 drivers/gpu/drm/nouveau/nvkm/subdev/volt/gpio.c|  1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  4 +--
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c  |  1 +
 drivers/gpu/drm/sti/sti_compositor.c   |  4 +--
 drivers/gpu/drm/sti/sti_cursor.c   |  2 +-
 drivers/gpu/drm/sti/sti_drv.c  |  2 +-
 drivers/gpu/drm/sti/sti_dvo.c  |  3 +-
 drivers/gpu/drm/sti/sti_gdp.c  |  6 ++--
 drivers/gpu/drm/sti/sti_hqvdp.c|  7 ++--
 drivers/gpu/drm/sti/sti_mixer.c|  2 +-
 drivers/gpu/drm/sti/sti_tvout.c|  1 +
 drivers/gpu/drm/sti/sti_vtac.c |  2 ++
 drivers/gpu/drm/sti/st

[PATCH 01/14] drm/atomic-helper: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/drm_atomic_helper.c:1696:6: warning: symbol 'plane_crtc_active' was not 
declared. Should it be static?

Cc: Daniel Vetter 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_atomic_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index ea78d70de9f3..c3f83476f996 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1693,7 +1693,7 @@ fail:
 }
 EXPORT_SYMBOL(drm_atomic_helper_prepare_planes);

-bool plane_crtc_active(struct drm_plane_state *state)
+static bool plane_crtc_active(const struct drm_plane_state *state)
 {
return state->crtc && state->crtc->state->active;
 }
-- 
2.7.4



[PATCH 02/14] drm/blend: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/drm_blend.c:207:5: warning: symbol 'drm_atomic_normalize_zpos' was not 
declared. Should it be static?

Cc: Marek Szyprowski 
Cc: Benjamin Gaignard 
Cc: Laurent Pinchart 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_blend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 0813b7e021be..0a0b9357db35 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -30,7 +30,7 @@
 #include 
 #include 

-#include "drm_internal.h"
+#include "drm_crtc_internal.h"

 /**
  * drm_plane_create_zpos_property - create mutable zpos property
-- 
2.7.4



[PATCH 05/14] drm/ast: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/ast/ast_drv.c:36:5: warning: symbol 'ast_modeset' was not declared. Should 
it be static?
drm/ast/ast_ttm.c:227:22: warning: symbol 'ast_bo_driver' was not declared. 
Should it be static?

Cc: Dave Airlie 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/ast/ast_drv.c | 2 +-
 drivers/gpu/drm/ast/ast_ttm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index f54afd2113a9..3d16d9f1f3ec 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -33,7 +33,7 @@

 #include "ast_drv.h"

-int ast_modeset = -1;
+static int ast_modeset = -1;

 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, ast_modeset, int, 0400);
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index b29a41218fc9..899ee7711f15 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -224,7 +224,7 @@ static void ast_ttm_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
 }

-struct ttm_bo_driver ast_bo_driver = {
+static struct ttm_bo_driver ast_bo_driver = {
.ttm_tt_create = ast_ttm_tt_create,
.ttm_tt_populate = ast_ttm_tt_populate,
.ttm_tt_unpopulate = ast_ttm_tt_unpopulate,
-- 
2.7.4



[PATCH 10/14] drm/nouveau: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/nouveau/dispnv04/overlay.c:496:1: warning: symbol 'nouveau_overlay_init' 
was not declared. Should it be static?
drm/nouveau/nouveau_connector.c:63:5: warning: symbol 'nouveau_hdmimhz' was not 
declared. Should it be static?
drm/nouveau/nouveau_display.c:96:1: warning: symbol 
'nouveau_display_scanoutpos_head' was not declared. Should it be static?
drm/nouveau/nv10_fence.c:70:1: warning: symbol 'nv10_fence_context_new' was not 
declared. Should it be static?
drm/nouveau/nvif/client.c:58:26: warning: symbol 'nvif_drivers' was not 
declared. Should it be static?
drm/nouveau/nvkm/core/firmware.c:34:1: warning: symbol 'nvkm_firmware_get' was 
not declared. Should it be static?
drm/nouveau/nvkm/core/firmware.c:58:1: warning: symbol 'nvkm_firmware_put' was 
not declared. Should it be static?
drm/nouveau/nvkm/engine/device/user.c:330:1: warning: symbol 'nvkm_udevice_new' 
was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/channv50.c:157:1: warning: symbol 
'nv50_disp_chan_rd32' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/channv50.c:167:1: warning: symbol 
'nv50_disp_chan_wr32' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/channv50.c:177:1: warning: symbol 
'nv50_disp_chan_ntfy' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/channv50.c:193:1: warning: symbol 
'nv50_disp_chan_map' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/coreg94.c:30:1: warning: symbol 
'g94_disp_core_mthd_sor' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/coregp104.c:63:1: warning: symbol 
'gp104_disp_core_func' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/rootnv50.c:70:1: warning: symbol 
'nv50_disp_root_mthd_' was not declared. Should it be static?
drm/nouveau/nvkm/engine/disp/sorg94.c:49:1: warning: symbol 
'g94_sor_output_new' was not declared. Should it be static?
drm/nouveau/nvkm/engine/fifo/chang84.c:133:1: warning: symbol 
'g84_fifo_chan_engine_init' was not declared. Should it be static?
drm/nouveau/nvkm/engine/fifo/chang84.c:174:1: warning: symbol 
'g84_fifo_chan_object_ctor' was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/ctxgf117.c:222:1: warning: symbol 
'gf117_grctx_generate_main' was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/ctxgm107.c:937:1: warning: symbol 
'gm107_grctx_generate_tpcid' was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/ctxnv50.c:255:1: warning: symbol 'nv50_grctx_fill' 
was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/ctxnv50.c:265:1: warning: symbol 'nv50_grctx_init' 
was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/gf100.c:1388:1: warning: symbol 'gf100_gr_init_fw' 
was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/gf100.c:1705:1: warning: symbol 'gf100_gr_init_' was 
not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/gf117.c:106:1: warning: symbol 'gf117_gr_fecs_ucode' 
was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/gf117.c:116:1: warning: symbol 
'gf117_gr_gpccs_ucode' was not declared. Should it be static?
drm/nouveau/nvkm/engine/gr/gm107.c:312:1: warning: symbol 'gm107_gr_init' was 
not declared. Should it be static?
drm/nouveau/nvkm/engine/pm/base.c:703:1: warning: symbol 'nvkm_perfsrc_new' was 
not declared. Should it be static?
drm/nouveau/nvkm/engine/pm/base.c:74:21: warning: symbol 'nvkm_perfsig_find' 
was not declared. Should it be static?
drm/nouveau/nvkm/engine/pm/gf100.c:106:1: warning: symbol 'gf100_pm_part' was 
not declared. Should it be static?
drm/nouveau/nvkm/subdev/bios/fan.c:29:1: warning: symbol 'nvbios_fan_table' was 
not declared. Should it be static?
drm/nouveau/nvkm/subdev/bios/fan.c:56:1: warning: symbol 'nvbios_fan_entry' was 
not declared. Should it be static?
drm/nouveau/nvkm/subdev/clk/gt215.c:184:1: warning: symbol 'gt215_clk_info' was 
not declared. Should it be static?
drm/nouveau/nvkm/subdev/fb/ramgt215.c:153:1: warning: symbol 'gt215_link_train' 
was not declared. Should it be static?
drm/nouveau/nvkm/subdev/fb/ramgt215.c:271:1: warning: symbol 
'gt215_link_train_init' was not declared. Should it be static?
drm/nouveau/nvkm/subdev/fb/ramgt215.c:337:1: warning: symbol 
'gt215_link_train_fini' was not declared. Should it be static?
drm/nouveau/nvkm/subdev/fb/ramgt215.c:99:1: warning: symbol 
'gt215_link_train_calc' was not declared. Should it be static?
drm/nouveau/nvkm/subdev/fb/sddr2.c:60:1: warning: symbol 'nvkm_sddr2_calc' was 
not declared. Should it be static?
drm/nouveau/nvkm/subdev/fb/sddr3.c:69:1: warning: symbol 'nvkm_sddr3_calc' was 
not declared. Should it be static?
drm/nouveau/nvkm/subdev/gpio/gk104.c:41:1: warning: symbol 
'gk104_gpio_intr_mask' was not declared. Should it be static?
drm/nouveau/nvkm/subdev/i2c/aux.c:78:1: warning: symbol 'nvkm_i2c_aux_i2c_algo' 
was not declared. Should it be static?
drm/nouveau/nvkm/subdev/iccsense/base.c:332:25: warn

[PATCH 03/14] drm/fb-helper: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/drm_fb_helper.c:2306:12: warning: symbol 'drm_fb_helper_modinit' was not 
declared. Should it be static?

While at it, move the lefover static inline to the right place.

Cc: Daniel Vetter 
Cc: Sean Paul 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_crtc_helper_internal.h | 7 +++
 drivers/gpu/drm/drm_fb_helper.c| 2 ++
 include/drm/drm_fb_helper.h| 5 -
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper_internal.h 
b/drivers/gpu/drm/drm_crtc_helper_internal.h
index 4e6b57ae7188..28295e5d0d9e 100644
--- a/drivers/gpu/drm/drm_crtc_helper_internal.h
+++ b/drivers/gpu/drm/drm_crtc_helper_internal.h
@@ -29,7 +29,14 @@
 #include 

 /* drm_fb_helper.c */
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 int drm_fb_helper_modinit(void);
+#else
+static inline int drm_fb_helper_modinit(void)
+{
+   return 0;
+}
+#endif

 /* drm_dp_aux_dev.c */
 #ifdef CONFIG_DRM_DP_AUX_CHARDEV
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index dd8e3b68fd53..03414bde1f15 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -41,6 +41,8 @@
 #include 
 #include 

+#include "drm_crtc_helper_internal.h"
+
 static bool drm_fbdev_emulation = true;
 module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
 MODULE_PARM_DESC(fbdev_emulation,
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 797fb5f80c45..e19458dd1a43 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -287,11 +287,6 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper 
*fb_helper, struct drm_
 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
   struct drm_connector *connector);
 #else
-static inline int drm_fb_helper_modinit(void)
-{
-   return 0;
-}
-
 static inline void drm_fb_helper_prepare(struct drm_device *dev,
struct drm_fb_helper *helper,
const struct drm_fb_helper_funcs *funcs)
-- 
2.7.4



[PATCH 06/14] drm/bochs: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/bochs/bochs_mm.c:196:22: warning: symbol 'bochs_bo_driver' was not 
declared. Should it be static?
drm/bochs/bochs_kms.c:181:5: warning: symbol 'bochs_connector_get_modes' was 
not declared. Should it be static?

Cc: Gerd Hoffmann 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/bochs/bochs_kms.c | 2 +-
 drivers/gpu/drm/bochs/bochs_mm.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 207a2cbcc113..0b4e5d117043 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -178,7 +178,7 @@ static void bochs_encoder_init(struct drm_device *dev)
 }


-int bochs_connector_get_modes(struct drm_connector *connector)
+static int bochs_connector_get_modes(struct drm_connector *connector)
 {
int count;

diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index 5c5638a777a1..dafd764134e8 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -193,7 +193,7 @@ static struct ttm_tt *bochs_ttm_tt_create(struct 
ttm_bo_device *bdev,
return tt;
 }

-struct ttm_bo_driver bochs_bo_driver = {
+static struct ttm_bo_driver bochs_bo_driver = {
.ttm_tt_create = bochs_ttm_tt_create,
.ttm_tt_populate = ttm_pool_populate,
.ttm_tt_unpopulate = ttm_pool_unpopulate,
-- 
2.7.4



[PATCH 07/14] drm/cirrus: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/cirrus/cirrus_drv.c:18:5: warning: symbol 'cirrus_modeset' was not 
declared. Should it be static?
drm/cirrus/cirrus_ttm.c:227:22: warning: symbol 'cirrus_bo_driver' was not 
declared. Should it be static?

Cc: Dave Airlie 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c | 2 +-
 drivers/gpu/drm/cirrus/cirrus_ttm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 6c76d125995b..94928af5e7a4 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -15,7 +15,7 @@

 #include "cirrus_drv.h"

-int cirrus_modeset = -1;
+static int cirrus_modeset = -1;
 int cirrus_bpp = 24;

 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c 
b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 1cc9ee607128..13c2303e1d3e 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -224,7 +224,7 @@ static void cirrus_ttm_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
 }

-struct ttm_bo_driver cirrus_bo_driver = {
+static struct ttm_bo_driver cirrus_bo_driver = {
.ttm_tt_create = cirrus_ttm_tt_create,
.ttm_tt_populate = cirrus_ttm_tt_populate,
.ttm_tt_unpopulate = cirrus_ttm_tt_unpopulate,
-- 
2.7.4



[PATCH 08/14] drm/mgag200: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/mgag200/mgag200_drv.c:24:5: warning: symbol 'mgag200_modeset' was not 
declared. Should it be static?
drm/mgag200/mgag200_ttm.c:227:22: warning: symbol 'mgag200_bo_driver' was not 
declared. Should it be static?

Cc: Dave Airlie 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +-
 drivers/gpu/drm/mgag200/mgag200_ttm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c 
b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 1443b3a34775..9c02a22451d2 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -21,7 +21,7 @@
  * which then performs further device association and calls our graphics init
  * functions
  */
-int mgag200_modeset = -1;
+static int mgag200_modeset = -1;

 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, mgag200_modeset, int, 0400);
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c 
b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 68268e55d595..88604af23382 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -224,7 +224,7 @@ static void mgag200_ttm_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
 }

-struct ttm_bo_driver mgag200_bo_driver = {
+static struct ttm_bo_driver mgag200_bo_driver = {
.ttm_tt_create = mgag200_ttm_tt_create,
.ttm_tt_populate = mgag200_ttm_tt_populate,
.ttm_tt_unpopulate = mgag200_ttm_tt_unpopulate,
-- 
2.7.4



[PATCH 09/14] drm/msm: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c:96:22: warning: symbol 'get_connector' was 
not declared. Should it be static?
drm/msm/mdp/mdp4/mdp4_plane.c:84:5: warning: symbol 'mdp4_plane_set_property' 
was not declared. Should it be static?
drm/msm/mdp/mdp5/mdp5_cfg.c:25:26: warning: symbol 'msm8x74v1_config' was not 
declared. Should it be static?
drm/msm/mdp/mdp5/mdp5_cfg.c:95:26: warning: symbol 'msm8x74v2_config' was not 
declared. Should it be static?
drm/msm/mdp/mdp5/mdp5_cfg.c:165:26: warning: symbol 'apq8084_config' was not 
declared. Should it be static?
drm/msm/mdp/mdp5/mdp5_cfg.c:243:26: warning: symbol 'msm8x16_config' was not 
declared. Should it be static?
drm/msm/mdp/mdp5/mdp5_cfg.c:304:26: warning: symbol 'msm8x94_config' was not 
declared. Should it be static?
drm/msm/mdp/mdp5/mdp5_cfg.c:382:26: warning: symbol 'msm8x96_config' was not 
declared. Should it be static?

Cc: Rob Clark 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  2 +-
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c|  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c  | 12 ++--
 drivers/gpu/drm/msm/msm_fb.c |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
index bc3d8e719c6c..a06b064f86c1 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
@@ -93,7 +93,7 @@ static const struct drm_encoder_funcs mdp4_lcdc_encoder_funcs 
= {
 };

 /* this should probably be a helper: */
-struct drm_connector *get_connector(struct drm_encoder *encoder)
+static struct drm_connector *get_connector(struct drm_encoder *encoder)
 {
struct drm_device *dev = encoder->dev;
struct drm_connector *connector;
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
index 7c9626d92019..3903dbcda763 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
@@ -81,7 +81,7 @@ static void mdp4_plane_install_properties(struct drm_plane 
*plane,
// XXX
 }

-int mdp4_plane_set_property(struct drm_plane *plane,
+static int mdp4_plane_set_property(struct drm_plane *plane,
struct drm_property *property, uint64_t val)
 {
// XXX
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
index ac9e4cde1380..94f9d1ad45b1 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
@@ -22,7 +22,7 @@ struct mdp5_cfg_handler {
 /* mdp5_cfg must be exposed (used in mdp5.xml.h) */
 const struct mdp5_cfg_hw *mdp5_cfg = NULL;

-const struct mdp5_cfg_hw msm8x74v1_config = {
+static const struct mdp5_cfg_hw msm8x74v1_config = {
.name = "msm8x74v1",
.mdp = {
.count = 1,
@@ -92,7 +92,7 @@ const struct mdp5_cfg_hw msm8x74v1_config = {
.max_clk = 2,
 };

-const struct mdp5_cfg_hw msm8x74v2_config = {
+static const struct mdp5_cfg_hw msm8x74v2_config = {
.name = "msm8x74",
.mdp = {
.count = 1,
@@ -162,7 +162,7 @@ const struct mdp5_cfg_hw msm8x74v2_config = {
.max_clk = 2,
 };

-const struct mdp5_cfg_hw apq8084_config = {
+static const struct mdp5_cfg_hw apq8084_config = {
.name = "apq8084",
.mdp = {
.count = 1,
@@ -240,7 +240,7 @@ const struct mdp5_cfg_hw apq8084_config = {
.max_clk = 32000,
 };

-const struct mdp5_cfg_hw msm8x16_config = {
+static const struct mdp5_cfg_hw msm8x16_config = {
.name = "msm8x16",
.mdp = {
.count = 1,
@@ -301,7 +301,7 @@ const struct mdp5_cfg_hw msm8x16_config = {
.max_clk = 32000,
 };

-const struct mdp5_cfg_hw msm8x94_config = {
+static const struct mdp5_cfg_hw msm8x94_config = {
.name = "msm8x94",
.mdp = {
.count = 1,
@@ -379,7 +379,7 @@ const struct mdp5_cfg_hw msm8x94_config = {
.max_clk = 4,
 };

-const struct mdp5_cfg_hw msm8x96_config = {
+static const struct mdp5_cfg_hw msm8x96_config = {
.name = "msm8x96",
.mdp = {
.count = 1,
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 95cf8fe72ee5..8c5b399f387e 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -132,7 +132,7 @@ const struct msm_format *msm_framebuffer_format(struct 
drm_framebuffer *fb)
 struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd)
 {
-   struct drm_gem_object *bos[4] = {0};
+   struct drm_gem_object *bos[4] = {};
struct drm_framebuffer *fb;
int ret, i, n = drm_format_num_planes(mode_cmd->pixel_format);

-- 
2.7.4



[PATCH 11/14] drm/rockchip: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/rockchip/rockchip_drm_drv.c:312:6: warning: symbol 
'rockchip_drm_fb_suspend' was not declared. Should it be static?
drm/rockchip/rockchip_drm_drv.c:321:6: warning: symbol 'rockchip_drm_fb_resume' 
was not declared. Should it be static?
drm/rockchip/rockchip_drm_fbdev.c:130:5: warning: symbol 
'rockchip_drm_fbdev_init' was not declared. Should it be static?
drm/rockchip/rockchip_drm_fbdev.c:173:6: warning: symbol 
'rockchip_drm_fbdev_fini' was not declared. Should it be static?

Cc: Mark Yao 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   | 4 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 76eaf1de52e4..38c3be5f2c67 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -309,7 +309,7 @@ static struct drm_driver rockchip_drm_driver = {
 };

 #ifdef CONFIG_PM_SLEEP
-void rockchip_drm_fb_suspend(struct drm_device *drm)
+static void rockchip_drm_fb_suspend(struct drm_device *drm)
 {
struct rockchip_drm_private *priv = drm->dev_private;

@@ -318,7 +318,7 @@ void rockchip_drm_fb_suspend(struct drm_device *drm)
console_unlock();
 }

-void rockchip_drm_fb_resume(struct drm_device *drm)
+static void rockchip_drm_fb_resume(struct drm_device *drm)
 {
struct rockchip_drm_private *priv = drm->dev_private;

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
index 207e01de6e32..a16c69f96ed5 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
@@ -20,6 +20,7 @@
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_gem.h"
 #include "rockchip_drm_fb.h"
+#include "rockchip_drm_fbdev.h"

 #define PREFERRED_BPP  32
 #define to_drm_private(x) \
-- 
2.7.4



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

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/sti/sti_mixer.c:361:6: warning: symbol 'sti_mixer_set_matrix' was not 
declared. Should it be static?
drm/sti/sti_gdp.c:476:5: warning: symbol 'sti_gdp_field_cb' was not declared. 
Should it be static?
drm/sti/sti_gdp.c:885:24: warning: symbol 'sti_gdp_plane_helpers_funcs' was not 
declared. Should it be static?
drm/sti/sti_cursor.c:348:24: warning: symbol 'sti_cursor_plane_helpers_funcs' 
was not declared. Should it be static?
drm/sti/sti_compositor.c:28:28: warning: symbol 'stih407_compositor_data' was 
not declared. Should it be static?
drm/sti/sti_compositor.c:49:28: warning: symbol 'stih416_compositor_data' was 
not declared. Should it be static?
drm/sti/sti_vtg.c:75:1: warning: symbol 'vtg_lookup' was not declared. Should 
it be static?
drm/sti/sti_vtg.c:476:24: warning: symbol 'sti_vtg_driver' was not declared. 
Should it be static?
drm/sti/sti_dvo.c:109:5: warning: symbol 'dvo_awg_generate_code' was not 
declared. Should it be static?
drm/sti/sti_dvo.c:602:24: warning: symbol 'sti_dvo_driver' was not declared. 
Should it be static?
drm/sti/sti_vtac.c:209:24: warning: symbol 'sti_vtac_driver' was not declared. 
Should it be static?
drm/sti/sti_tvout.c:914:24: warning: symbol 'sti_tvout_driver' was not 
declared. Should it be static?
drm/sti/sti_hqvdp.c:786:5: warning: symbol 'sti_hqvdp_vtg_cb' was not declared. 
Should it be static?
drm/sti/sti_hqvdp.c:1253:24: warning: symbol 'sti_hqvdp_plane_helpers_funcs' 
was not declared. Should it be static?
drm/sti/sti_hqvdp.c:1292:5: warning: symbol 'sti_hqvdp_bind' was not declared. 
Should it be static?
drm/sti/sti_hqvdp.c:1385:24: warning: symbol 'sti_hqvdp_driver' was not 
declared. Should it be static?
drm/sti/sti_drv.c:143:6: warning: symbol 'sti_drm_dbg_cleanup' was not 
declared. Should it be static?

Cc: Benjamin Gaignard 
Cc: Vincent Abriou 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/sti/sti_compositor.c | 4 ++--
 drivers/gpu/drm/sti/sti_cursor.c | 2 +-
 drivers/gpu/drm/sti/sti_drv.c| 2 +-
 drivers/gpu/drm/sti/sti_dvo.c| 3 ++-
 drivers/gpu/drm/sti/sti_gdp.c| 6 +++---
 drivers/gpu/drm/sti/sti_hqvdp.c  | 7 ---
 drivers/gpu/drm/sti/sti_mixer.c  | 2 +-
 drivers/gpu/drm/sti/sti_tvout.c  | 1 +
 drivers/gpu/drm/sti/sti_vtac.c   | 2 ++
 drivers/gpu/drm/sti/sti_vtg.c| 3 ++-
 10 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index 134201ecc6fd..a8441ae2623a 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -25,7 +25,7 @@
 /*
  * stiH407 compositor properties
  */
-struct sti_compositor_data stih407_compositor_data = {
+static const struct sti_compositor_data stih407_compositor_data = {
.nb_subdev = 8,
.subdev_desc = {
{STI_CURSOR_SUBDEV, (int)STI_CURSOR, 0x000},
@@ -46,7 +46,7 @@ struct sti_compositor_data stih407_compositor_data = {
  * Moreover, GDPx is different for Main and Aux Mixer. So this subdev map does
  * not fit for stiH416 if we want to enable the MIXER_AUX.
  */
-struct sti_compositor_data stih416_compositor_data = {
+static const struct sti_compositor_data stih416_compositor_data = {
.nb_subdev = 3,
.subdev_desc = {
{STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 3b53f7f2e3fc..651f231c4615 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -345,7 +345,7 @@ static int sti_cursor_late_register(struct drm_plane 
*drm_plane)
return cursor_debugfs_init(cursor, drm_plane->dev->primary);
 }

-struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
+static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = sti_cursor_destroy,
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 7cd3804c6dee..e6f0706bc6c7 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -140,7 +140,7 @@ err:
return ret;
 }

-void sti_drm_dbg_cleanup(struct drm_minor *minor)
+static void sti_drm_dbg_cleanup(struct drm_minor *minor)
 {
drm_debugfs_remove_files(sti_drm_dbg_list,
 ARRAY_SIZE(sti_drm_dbg_list), minor);
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 00881eb4536e..e8c1ed08a9f7 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -17,6 +17,7 @@
 #include 

 #include "sti_awg_utils.h"
+#include "sti_drv.h"
 #include "sti_mixer.h"

 /* DVO registers */
@@ -106,7 +107,7 @@ struct sti_dvo_connector {
container_of(x, struct sti_dvo_connector, drm_connector)

 #define BLANKING_LEVEL 16
-int dvo_awg_generate_code(struct sti_dvo *dvo

[PATCH 13/14] drm/sun4i: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/sun4i/sun4i_tv.c:181:21: warning: symbol 'ntsc_video_levels' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:185:21: warning: symbol 'pal_video_levels' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:189:21: warning: symbol 'ntsc_burst_levels' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:193:21: warning: symbol 'pal_burst_levels' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:197:20: warning: symbol 'ntsc_color_gains' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:201:20: warning: symbol 'pal_color_gains' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:205:26: warning: symbol 'ntsc_resync_parameters' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:209:26: warning: symbol 'pal_resync_parameters' was not 
declared. Should it be static?
drm/sun4i/sun4i_tv.c:213:16: warning: symbol 'tv_modes' was not declared. 
Should it be static?

Cc: Maxime Ripard 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/sun4i/sun4i_tv.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index b84147896294..3d69bd34f36c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -161,10 +161,10 @@ struct tv_mode {
booldac3_en;
booldac_bit25_en;

-   struct color_gains  *color_gains;
-   struct burst_levels *burst_levels;
-   struct video_levels *video_levels;
-   struct resync_parameters*resync_params;
+   const struct color_gains*color_gains;
+   const struct burst_levels   *burst_levels;
+   const struct video_levels   *video_levels;
+   const struct resync_parameters  *resync_params;
 };

 struct sun4i_tv {
@@ -178,39 +178,39 @@ struct sun4i_tv {
struct sun4i_drv*drv;
 };

-struct video_levels ntsc_video_levels = {
+static const struct video_levels ntsc_video_levels = {
.black = 282,   .blank = 240,
 };

-struct video_levels pal_video_levels = {
+static const struct video_levels pal_video_levels = {
.black = 252,   .blank = 252,
 };

-struct burst_levels ntsc_burst_levels = {
+static const struct burst_levels ntsc_burst_levels = {
.cb = 79,   .cr = 0,
 };

-struct burst_levels pal_burst_levels = {
+static const struct burst_levels pal_burst_levels = {
.cb = 40,   .cr = 40,
 };

-struct color_gains ntsc_color_gains = {
+static const struct color_gains ntsc_color_gains = {
.cb = 160,  .cr = 160,
 };

-struct color_gains pal_color_gains = {
+static const struct color_gains pal_color_gains = {
.cb = 224,  .cr = 224,
 };

-struct resync_parameters ntsc_resync_parameters = {
+static const struct resync_parameters ntsc_resync_parameters = {
.field = false, .line = 14, .pixel = 12,
 };

-struct resync_parameters pal_resync_parameters = {
+static const struct resync_parameters pal_resync_parameters = {
.field = true,  .line = 13, .pixel = 12,
 };

-struct tv_mode tv_modes[] = {
+static const struct tv_mode tv_modes[] = {
{
.name   = "NTSC",
.mode   = SUN4I_TVE_CFG0_RES_480i,
@@ -289,13 +289,13 @@ drm_connector_to_sun4i_tv(struct drm_connector *connector)
  * So far, it doesn't seem to be preserved when the mode is passed by
  * to mode_set for some reason.
  */
-static struct tv_mode *sun4i_tv_find_tv_by_mode(struct drm_display_mode *mode)
+static const struct tv_mode *sun4i_tv_find_tv_by_mode(const struct 
drm_display_mode *mode)
 {
int i;

/* First try to identify the mode by name */
for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
-   struct tv_mode *tv_mode = &tv_modes[i];
+   const struct tv_mode *tv_mode = &tv_modes[i];

DRM_DEBUG_DRIVER("Comparing mode %s vs %s",
 mode->name, tv_mode->name);
@@ -306,7 +306,7 @@ static struct tv_mode *sun4i_tv_find_tv_by_mode(struct 
drm_display_mode *mode)

/* Then by number of lines */
for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
-   struct tv_mode *tv_mode = &tv_modes[i];
+   const struct tv_mode *tv_mode = &tv_modes[i];

DRM_DEBUG_DRIVER("Comparing mode %s vs %s (X: %d vs %d)",
 mode->name, tv_mode->name,
@@ -319,7 +319,7 @@ static struct tv_mode *sun4i_tv_find_tv_by_mode(struct 
drm_display_mode *mode)
return NULL;
 }

-static void sun4i_tv_mode_to_drm_mode(struct tv_mode *tv_mode,
+static void sun4i_tv_mode_to_drm_mode(const struct tv_mode *tv_mode,
  struct drm_display_mode *mode)
 {
DRM_DEBUG_DRIVER("Creating mode %s\n", mode->name);
@@ -386,7 +386,7 @@ static void sun4i_tv_mode_set(struct drm_encode

[PATCH 14/14] drm/tilcdc: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/tilcdc/tilcdc_tfp410.c:385:24: warning: symbol 'tfp410_driver' was not 
declared. Should it be static?
drm/tilcdc/tilcdc_tfp410.c:395:12: warning: symbol 'tilcdc_tfp410_init' was not 
declared. Should it be static?
drm/tilcdc/tilcdc_tfp410.c:400:13: warning: symbol 'tilcdc_tfp410_fini' was not 
declared. Should it be static?
drm/tilcdc/tilcdc_panel.c:436:24: warning: symbol 'panel_driver' was not 
declared. Should it be static?
drm/tilcdc/tilcdc_panel.c:446:12: warning: symbol 'tilcdc_panel_init' was not 
declared. Should it be static?
drm/tilcdc/tilcdc_panel.c:451:13: warning: symbol 'tilcdc_panel_fini' was not 
declared. Should it be static?
drm/tilcdc/tilcdc_drv.c:78:5: warning: symbol 'tilcdc_atomic_check' was not 
declared. Should it be static?

Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c| 4 ++--
 drivers/gpu/drm/tilcdc/tilcdc_panel.c  | 3 ++-
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f8892e9ad169..d6f8780e41df 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -75,8 +75,8 @@ static void tilcdc_fb_output_poll_changed(struct drm_device 
*dev)
drm_fbdev_cma_hotplug_event(priv->fbdev);
 }

-int tilcdc_atomic_check(struct drm_device *dev,
-   struct drm_atomic_state *state)
+static int tilcdc_atomic_check(struct drm_device *dev,
+  struct drm_atomic_state *state)
 {
int ret;

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c 
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 7b3650901930..b8dbcc2a4b7c 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -25,6 +25,7 @@
 #include 

 #include "tilcdc_drv.h"
+#include "tilcdc_panel.h"

 struct panel_module {
struct tilcdc_module base;
@@ -433,7 +434,7 @@ static struct of_device_id panel_of_match[] = {
{ },
 };

-struct platform_driver panel_driver = {
+static struct platform_driver panel_driver = {
.probe = panel_probe,
.remove = panel_remove,
.driver = {
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c 
b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index c6a70da6473d..2247150f326a 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -23,6 +23,7 @@
 #include 

 #include "tilcdc_drv.h"
+#include "tilcdc_tfp410.h"

 struct tfp410_module {
struct tilcdc_module base;
@@ -382,7 +383,7 @@ static struct of_device_id tfp410_of_match[] = {
{ },
 };

-struct platform_driver tfp410_driver = {
+static struct platform_driver tfp410_driver = {
.probe = tfp410_probe,
.remove = tfp410_remove,
.driver = {
-- 
2.7.4



[PATCH 04/14] drm/arm: Fix sparse warnings

2016-09-19 Thread ville.syrj...@linux.intel.com
From: Ville Syrjälä 

drm/arm/malidp_planes.c:49:24: warning: symbol 'malidp_duplicate_plane_state' 
was not declared. Should it be static?
drm/arm/malidp_planes.c:66:6: warning: symbol 'malidp_destroy_plane_state' was 
not declared. Should it be static?

Cc: Liviu Dudau 
Cc: Brian Starkey 
Cc: Mali DP Maintainers 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/arm/malidp_planes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 82c193e5e0d6..cc9b8e02904d 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -46,7 +46,7 @@ static void malidp_de_plane_destroy(struct drm_plane *plane)
devm_kfree(plane->dev->dev, mp);
 }

-struct drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane)
+static struct drm_plane_state *malidp_duplicate_plane_state(struct drm_plane 
*plane)
 {
struct malidp_plane_state *state, *m_state;

@@ -63,8 +63,8 @@ struct drm_plane_state *malidp_duplicate_plane_state(struct 
drm_plane *plane)
return &state->base;
 }

-void malidp_destroy_plane_state(struct drm_plane *plane,
-   struct drm_plane_state *state)
+static void malidp_destroy_plane_state(struct drm_plane *plane,
+  struct drm_plane_state *state)
 {
struct malidp_plane_state *m_state = to_malidp_plane_state(state);

-- 
2.7.4



[PATCH 09/14] drm/msm: Fix sparse warnings

2016-09-19 Thread Emil Velikov
On 19 September 2016 at 14:33,   wrote:

> --- a/drivers/gpu/drm/msm/msm_fb.c
> +++ b/drivers/gpu/drm/msm/msm_fb.c
> @@ -132,7 +132,7 @@ const struct msm_format *msm_framebuffer_format(struct 
> drm_framebuffer *fb)
>  struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
> struct drm_file *file, const struct drm_mode_fb_cmd2 
> *mode_cmd)
>  {
> -   struct drm_gem_object *bos[4] = {0};
> +   struct drm_gem_object *bos[4] = {};
Fwiw I was reminded using empty initializers isn't standard C [1].

Regards,
Emil

[1] 
http://stackoverflow.com/questions/17589533/is-an-empty-initializer-list-valid-c-code


[RFC 0/2] drm/exynos: mixer: small optimisations

2016-09-19 Thread Tobias Jakobi
Hello,

I had these two patches in my private tree for some time. Might as well ask if 
there is any interested in merging these.

The first is just some unification on how booleans are used in the mixer code. 
The second one reduces register manipulation by moving stuff to the atomic 
flush call. I think one could even move more code there, like e.g. 
mixer_cfg_scan() and mixer_cfg_rgb_fmt().

Anyway, feedback is appreciated a lot!

With best wishes,
Tobias

Tobias Jakobi (2):
  drm/exynos: mixer: convert booleans to flags in mixer context
  drm/exynos: mixer: configure layers once in mixer_atomic_flush()

 drivers/gpu/drm/exynos/exynos_mixer.c | 156 +-
 drivers/gpu/drm/exynos/regs-mixer.h   |   2 +
 2 files changed, 97 insertions(+), 61 deletions(-)

-- 
2.7.3



[RFC 1/2] drm/exynos: mixer: convert booleans to flags in mixer context

2016-09-19 Thread Tobias Jakobi
The mixer context struct already has a 'flags' field, so
we can use it to store the 'interlace', 'vp_enabled' and
'has_sclk' booleans.
We use the non-atomic helper functions to access these bits.

Signed-off-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 54 +++
 1 file changed, 29 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 9a48aa1..1e78d57 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -73,6 +73,9 @@ enum mixer_version_id {
 enum mixer_flag_bits {
MXR_BIT_POWERED,
MXR_BIT_VSYNC,
+   MXR_BIT_INTERLACE,
+   MXR_BIT_VP_ENABLED,
+   MXR_BIT_HAS_SCLK,
 };

 static const uint32_t mixer_formats[] = {
@@ -98,9 +101,6 @@ struct mixer_context {
struct exynos_drm_plane planes[MIXER_WIN_NR];
int pipe;
unsigned long   flags;
-   boolinterlace;
-   boolvp_enabled;
-   boolhas_sclk;

struct mixer_resources  mixer_res;
enum mixer_version_id   mxr_ver;
@@ -346,7 +346,7 @@ static void mixer_vsync_set_update(struct mixer_context 
*ctx, bool enable)
mixer_reg_writemask(res, MXR_STATUS, enable ?
MXR_STATUS_SYNC_ENABLE : 0, MXR_STATUS_SYNC_ENABLE);

-   if (ctx->vp_enabled)
+   if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags))
vp_reg_write(res, VP_SHADOW_UPDATE, enable ?
VP_SHADOW_UPDATE_ENABLE : 0);
 }
@@ -357,8 +357,8 @@ static void mixer_cfg_scan(struct mixer_context *ctx, 
unsigned int height)
u32 val;

/* choosing between interlace and progressive mode */
-   val = (ctx->interlace ? MXR_CFG_SCAN_INTERLACE :
-   MXR_CFG_SCAN_PROGRESSIVE);
+   val = test_bit(MXR_BIT_INTERLACE, &ctx->flags) ?
+   MXR_CFG_SCAN_INTERLACE : MXR_CFG_SCAN_PROGRESSIVE;

if (ctx->mxr_ver != MXR_VER_128_0_0_184) {
/* choosing between proper HD and SD mode */
@@ -436,9 +436,10 @@ static void mixer_cfg_layer(struct mixer_context *ctx, 
unsigned int win,
mixer_reg_writemask(res, MXR_LAYER_CFG,
MXR_LAYER_CFG_GRP1_VAL(priority),
MXR_LAYER_CFG_GRP1_MASK);
+
break;
case VP_DEFAULT_WIN:
-   if (ctx->vp_enabled) {
+   if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) {
vp_reg_writemask(res, VP_ENABLE, val, VP_ENABLE_ON);
mixer_reg_writemask(res, MXR_CFG, val,
MXR_CFG_VP_ENABLE);
@@ -501,7 +502,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
chroma_addr[0] = exynos_drm_fb_dma_addr(fb, 1);

if (mode->flags & DRM_MODE_FLAG_INTERLACE) {
-   ctx->interlace = true;
+   __set_bit(MXR_BIT_INTERLACE, &ctx->flags);
if (tiled_mode) {
luma_addr[1] = luma_addr[0] + 0x40;
chroma_addr[1] = chroma_addr[0] + 0x40;
@@ -510,7 +511,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
chroma_addr[1] = chroma_addr[0] + fb->pitches[0];
}
} else {
-   ctx->interlace = false;
+   __clear_bit(MXR_BIT_INTERLACE, &ctx->flags);
luma_addr[1] = 0;
chroma_addr[1] = 0;
}
@@ -518,7 +519,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
spin_lock_irqsave(&res->reg_slock, flags);

/* interlace or progressive scan mode */
-   val = (ctx->interlace ? ~0 : 0);
+   val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0);
vp_reg_writemask(res, VP_MODE, val, VP_MODE_LINE_SKIP);

/* setup format */
@@ -541,7 +542,7 @@ static void vp_video_buffer(struct mixer_context *ctx,

vp_reg_write(res, VP_DST_WIDTH, state->crtc.w);
vp_reg_write(res, VP_DST_H_POSITION, state->crtc.x);
-   if (ctx->interlace) {
+   if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) {
vp_reg_write(res, VP_DST_HEIGHT, state->crtc.h / 2);
vp_reg_write(res, VP_DST_V_POSITION, state->crtc.y / 2);
} else {
@@ -636,9 +637,9 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
src_y_offset = 0;

if (mode->flags & DRM_MODE_FLAG_INTERLACE)
-   ctx->interlace = true;
+   __set_bit(MXR_BIT_INTERLACE, &ctx->flags);
else
-   ctx->interlace = false;
+   __clear_bit(MXR_BIT_INTERLACE, &ctx->flags);

spin_lock_irqsave(&res->reg_slock, flags);

@@ -733,7 +734,7 @@ static void mixer_win_reset(struct mixer_context *ctx)
mixer_reg_write(res, MXR_BG_COLOR1, 0x008080);
mixer_reg_write(res, MXR_

[PATCH] drm/amdgpu: add function declaration in amdgpu.h

2016-09-19 Thread Deucher, Alexander
> -Original Message-
> From: Baoyou Xie [mailto:baoyou.xie at linaro.org]
> Sent: Sunday, September 18, 2016 10:29 AM
> To: Deucher, Alexander; Koenig, Christian; airlied at linux.ie; Zhou,
> David(ChunMing); Liu, Monk; Zhu, Rex; Huang, JinHuiEric; Cui, Flora
> Cc: dri-devel at lists.freedesktop.org; linux-kernel at vger.kernel.org;
> arnd at arndb.de; baoyou.xie at linaro.org; xie.baoyou at zte.com.cn
> Subject: [PATCH] drm/amdgpu: add function declaration in amdgpu.h
> 
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:502:10: warning: no previous
> prototype for 'init_cond_exec' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c:514:6: warning: no previous
> prototype for 'patch_cond_exec' [-Wmissing-prototypes]
> 
> In fact, both functions are not declared in any files.
> 
> So this patch declares them in drivers/gpu/drm/amd/amdgpu/amdgpu.h.
> 
> Signed-off-by: Baoyou Xie 

These functions were unused so they were already dropped.

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 8e3d9b2..7b71cbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -396,6 +396,8 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring,
> struct fence **fence);
>  void amdgpu_fence_process(struct amdgpu_ring *ring);
>  int amdgpu_fence_wait_empty(struct amdgpu_ring *ring);
>  unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);
> +unsigned int init_cond_exec(struct amdgpu_ring *ring);
> +void patch_cond_exec(struct amdgpu_ring *ring, unsigned int offset);
> 
>  /*
>   * BO.
> --
> 2.7.4



[PATCH 4/5] drm/amdgpu: Rename a jump label in amdgpu_device_init()

2016-09-19 Thread Deucher, Alexander
> -Original Message-
> From: SF Markus Elfring [mailto:elfring at users.sourceforge.net]
> Sent: Sunday, September 18, 2016 12:53 PM
> To: dri-devel at lists.freedesktop.org; Deucher, Alexander; Koenig, Christian;
> Zhou, David(ChunMing); David Airlie; Liu, Monk; StDenis, Tom
> Cc: LKML; kernel-janitors at vger.kernel.org; Julia Lawall
> Subject: [PATCH 4/5] drm/amdgpu: Rename a jump label in
> amdgpu_device_init()
> 
> From: Markus Elfring 
> Date: Sun, 18 Sep 2016 17:50:09 +0200
> 
> Adjust jump labels according to the current Linux coding style convention.
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 ++--
> -
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 2b8ba97..fed4854 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1566,18 +1566,18 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   /* Read BIOS */
>   if (!amdgpu_get_bios(adev)) {
>   r = -EINVAL;
> - goto failed;
> + goto check_runtime;

NACK.  Failed is a more appropriate label here.  The runtime check is just part 
of the failure cleanup.

Alex

>   }
>   /* Must be an ATOMBIOS */
>   if (!adev->is_atom_bios) {
>   dev_err(adev->dev, "Expecting atombios for GPU\n");
>   r = -EINVAL;
> - goto failed;
> + goto check_runtime;
>   }
>   r = amdgpu_atombios_init(adev);
>   if (r) {
>   dev_err(adev->dev, "amdgpu_atombios_init failed\n");
> - goto failed;
> + goto check_runtime;
>   }
> 
>   /* See if the asic supports SR-IOV */
> @@ -1595,7 +1595,7 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   if (!adev->bios) {
>   dev_err(adev->dev, "Card not posted and no BIOS -
> ignoring\n");
>   r = -EINVAL;
> - goto failed;
> + goto check_runtime;
>   }
>   DRM_INFO("GPU not posted. posting now...\n");
>   amdgpu_atom_asic_init(adev->mode_info.atom_context);
> @@ -1605,7 +1605,7 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   r = amdgpu_atombios_get_clock_info(adev);
>   if (r) {
>   dev_err(adev->dev, "amdgpu_atombios_get_clock_info
> failed\n");
> - goto failed;
> + goto check_runtime;
>   }
>   /* init i2c buses */
>   amdgpu_atombios_i2c_init(adev);
> @@ -1614,7 +1614,7 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   r = amdgpu_fence_driver_init(adev);
>   if (r) {
>   dev_err(adev->dev, "amdgpu_fence_driver_init failed\n");
> - goto failed;
> + goto check_runtime;
>   }
> 
>   /* init the mode config */
> @@ -1624,7 +1624,7 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   if (r) {
>   dev_err(adev->dev, "amdgpu_init failed\n");
>   amdgpu_fini(adev);
> - goto failed;
> + goto check_runtime;
>   }
> 
>   adev->accel_working = true;
> @@ -1634,7 +1634,7 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   r = amdgpu_ib_pool_init(adev);
>   if (r) {
>   dev_err(adev->dev, "IB initialization failed (%d).\n", r);
> - goto failed;
> + goto check_runtime;
>   }
> 
>   r = amdgpu_ib_ring_tests(adev);
> @@ -1682,12 +1682,11 @@ int amdgpu_device_init(struct amdgpu_device
> *adev,
>   r = amdgpu_late_init(adev);
>   if (r) {
>   dev_err(adev->dev, "amdgpu_late_init failed\n");
> - goto failed;
> + goto check_runtime;
>   }
> 
>   return 0;
> -
> -failed:
> + check_runtime:
>   if (runtime)
>   vga_switcheroo_fini_domain_pm_ops(adev->dev);
>   return r;
> --
> 2.10.0



[RFC 2/2] drm/exynos: mixer: configure layers once in mixer_atomic_flush()

2016-09-19 Thread Tobias Jakobi
Only manipulate the MXR_CFG and MXR_LAYER_CFG registers once
in mixer_cfg_layer().
Trigger this via atomic flush.

Signed-off-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 104 ++
 drivers/gpu/drm/exynos/regs-mixer.h   |   2 +
 2 files changed, 69 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 1e78d57..d4efd9c 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -99,6 +99,7 @@ struct mixer_context {
struct drm_device   *drm_dev;
struct exynos_drm_crtc  *crtc;
struct exynos_drm_plane planes[MIXER_WIN_NR];
+   unsigned long   state_cache;
int pipe;
unsigned long   flags;

@@ -418,37 +419,68 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, 
unsigned int height)
mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK);
 }

-static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win,
-   unsigned int priority, bool enable)
+static void mixer_cfg_layer(struct mixer_context *ctx)
 {
struct mixer_resources *res = &ctx->mixer_res;
-   u32 val = enable ? ~0 : 0;
-
-   switch (win) {
-   case 0:
-   mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_GRP0_ENABLE);
-   mixer_reg_writemask(res, MXR_LAYER_CFG,
-   MXR_LAYER_CFG_GRP0_VAL(priority),
-   MXR_LAYER_CFG_GRP0_MASK);
-   break;
-   case 1:
-   mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_GRP1_ENABLE);
-   mixer_reg_writemask(res, MXR_LAYER_CFG,
-   MXR_LAYER_CFG_GRP1_VAL(priority),
-   MXR_LAYER_CFG_GRP1_MASK);
+   unsigned int win;

-   break;
-   case VP_DEFAULT_WIN:
-   if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) {
-   vp_reg_writemask(res, VP_ENABLE, val, VP_ENABLE_ON);
-   mixer_reg_writemask(res, MXR_CFG, val,
-   MXR_CFG_VP_ENABLE);
-   mixer_reg_writemask(res, MXR_LAYER_CFG,
-   MXR_LAYER_CFG_VP_VAL(priority),
-   MXR_LAYER_CFG_VP_MASK);
+   struct exynos_drm_plane_state *state;
+   struct drm_framebuffer *fb;
+   unsigned int priority;
+   u32 mxr_cfg = 0, mxr_layer_cfg = 0, vp_enable = 0;
+   bool enable;
+
+   for (win = 0; win < MIXER_WIN_NR; ++win) {
+   state = to_exynos_plane_state(ctx->planes[win].base.state);
+   fb = state->fb;
+
+   priority = state->base.normalized_zpos + 1;
+   enable = test_bit(win, &ctx->state_cache);
+
+   if (!enable)
+   continue;
+
+   switch (win) {
+   case 0:
+   mxr_cfg |=  MXR_CFG_GRP0_ENABLE;
+   mxr_layer_cfg |= MXR_LAYER_CFG_GRP0_VAL(priority);
+   break;
+
+   case 1:
+   mxr_cfg |=  MXR_CFG_GRP1_ENABLE;
+   mxr_layer_cfg |= MXR_LAYER_CFG_GRP1_VAL(priority);
+   break;
+
+   case VP_DEFAULT_WIN:
+   vp_enable = VP_ENABLE_ON;
+   mxr_cfg |=  MXR_CFG_VP_ENABLE;
+   mxr_layer_cfg |= MXR_LAYER_CFG_VP_VAL(priority);
+   break;
+   }
+
+   if (!fb)
+   continue;
+
+   /*
+* TODO: Don't enable alpha blending for the bottom window.
+*/
+   switch (win) {
+   case 0:
+   case 1:
+   mixer_cfg_gfx_blend(ctx, win, 
is_alpha_format(fb->pixel_format));
+   break;
+
+   case VP_DEFAULT_WIN:
+   mixer_cfg_vp_blend(ctx);
+   break;
}
-   break;
}
+
+   if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags))
+   vp_reg_writemask(res, VP_ENABLE, vp_enable, VP_ENABLE_ON);
+
+   mixer_reg_writemask(res, MXR_CFG, mxr_cfg, MXR_CFG_ENABLE_MASK);
+   mixer_reg_writemask(res, MXR_LAYER_CFG, mxr_layer_cfg, 
MXR_LAYER_CFG_MASK);
 }

 static void mixer_run(struct mixer_context *ctx)
@@ -478,7 +510,6 @@ static void vp_video_buffer(struct mixer_context *ctx,
struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode;
struct mixer_resources *res = &ctx->mixer_res;
struct drm_framebuffer *fb = state->fb;
-   unsigned int priority = state->base.normalized_zpos + 1;
unsigned long flags;
dma_addr_t luma_addr[2], chroma_addr[2];
bool tiled_mode = false;

[PATCH 03/10] drm: Move all decl for drm_edid.c to drm_edid.h

2016-09-19 Thread Daniel Vetter
On Tue, Sep 06, 2016 at 12:59:39PM -0400, Sean Paul wrote:
> On Wed, Aug 31, 2016 at 12:09 PM, Daniel Vetter  
> wrote:
> > Some were still left in drm_crtc.h. Also include drm_edid.h in the
> > rst files.
> >
> > Signed-off-by: Daniel Vetter 
> 
> Reviewed-by: Sean Paul 

Merged up to this patch, thanks for the review.
-Daniel

> 
> > ---
> >  Documentation/gpu/drm-kms-helpers.rst |  3 +++
> >  include/drm/drm_crtc.h| 30 +-
> >  include/drm/drm_edid.h| 30 ++
> >  3 files changed, 34 insertions(+), 29 deletions(-)
> >
> > diff --git a/Documentation/gpu/drm-kms-helpers.rst 
> > b/Documentation/gpu/drm-kms-helpers.rst
> > index 48fc5a96bf95..bb4254d19cbb 100644
> > --- a/Documentation/gpu/drm-kms-helpers.rst
> > +++ b/Documentation/gpu/drm-kms-helpers.rst
> > @@ -208,6 +208,9 @@ Output Probing Helper Functions Reference
> >  EDID Helper Functions Reference
> >  ===
> >
> > +.. kernel-doc:: include/drm/drm_edid.h
> > +   :internal:
> > +
> >  .. kernel-doc:: drivers/gpu/drm/drm_edid.c
> > :export:
> >
> > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> > index bf9ee1b97c26..7bb3aa87a8be 100644
> > --- a/include/drm/drm_crtc.h
> > +++ b/include/drm/drm_crtc.h
> > @@ -43,6 +43,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  struct drm_device;
> >  struct drm_mode_set;
> > @@ -1992,33 +1993,4 @@ assert_drm_connector_list_read_locked(struct 
> > drm_mode_config *mode_config)
> > !drm_modeset_is_locked(&mode_config->connection_mutex));
> >  }
> >
> > -/* drm_edid.c */
> > -bool drm_probe_ddc(struct i2c_adapter *adapter);
> > -struct edid *drm_get_edid(struct drm_connector *connector,
> > - struct i2c_adapter *adapter);
> > -struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
> > -struct i2c_adapter *adapter);
> > -struct edid *drm_edid_duplicate(const struct edid *edid);
> > -int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
> > -
> > -u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> > -enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
> > -bool drm_detect_hdmi_monitor(struct edid *edid);
> > -bool drm_detect_monitor_audio(struct edid *edid);
> > -bool drm_rgb_quant_range_selectable(struct edid *edid);
> > -int drm_add_modes_noedid(struct drm_connector *connector,
> > -int hdisplay, int vdisplay);
> > -void drm_set_preferred_mode(struct drm_connector *connector,
> > -   int hpref, int vpref);
> > -
> > -int drm_edid_header_is_valid(const u8 *raw_edid);
> > -bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
> > - bool *edid_corrupt);
> > -bool drm_edid_is_valid(struct edid *edid);
> > -void drm_edid_get_monitor_name(struct edid *edid, char *name,
> > -  int buflen);
> > -struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
> > -  int hsize, int vsize, int fresh,
> > -  bool rb);
> > -
> >  #endif /* __DRM_CRTC_H__ */
> > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> > index 919933d1beb4..c3a7d440bc11 100644
> > --- a/include/drm/drm_edid.h
> > +++ b/include/drm/drm_edid.h
> > @@ -25,6 +25,9 @@
> >
> >  #include 
> >
> > +struct drm_device;
> > +struct i2c_adapter;
> > +
> >  #define EDID_LENGTH 128
> >  #define DDC_ADDR 0x50
> >  #define DDC_ADDR2 0x52 /* E-DDC 1.2 - where DisplayID can hide */
> > @@ -423,9 +426,36 @@ static inline u8 drm_eld_get_conn_type(const uint8_t 
> > *eld)
> > return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK;
> >  }
> >
> > +bool drm_probe_ddc(struct i2c_adapter *adapter);
> >  struct edid *drm_do_get_edid(struct drm_connector *connector,
> > int (*get_edid_block)(void *data, u8 *buf, unsigned int block,
> >   size_t len),
> > void *data);
> > +struct edid *drm_get_edid(struct drm_connector *connector,
> > + struct i2c_adapter *adapter);
> > +struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
> > +struct i2c_adapter *adapter);
> > +struct edid *drm_edid_duplicate(const struct edid *edid);
> > +int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
> > +
> > +u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> > +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
> > +bool drm_detect_hdmi_monitor(struct edid *edid);
> > +bool drm_detect_monitor_audio(struct edid *edid);
> > +bool drm_rgb_quant_range_selectable(struct edid *edid);
> > +int drm_add_modes_noedid(struct drm_connector *connector,
> > +int hdisplay, int vdisplay);

[Intel-gfx] [PATCH] drm: fix implicit declaration build error on ia64

2016-09-19 Thread Daniel Vetter
On Fri, Sep 16, 2016 at 01:06:36PM +0300, Jani Nikula wrote:
>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");
>  ^
> 
> Reported-by: kbuild test robot 
> References: 
> https://lists.freedesktop.org/archives/intel-gfx/2016-September/106638.html
> Fixes: 80209e5f2c42 ("drm: Add DP branch device info on debugfs")
> Cc: Mika Kahola 
> Signed-off-by: Jani Nikula 

Applied to drm-misc (yeah wrong branch, but easier that way ...).

Thanks, Daniel

> 
> ---
> 
> The commit being fixed is only in drm-intel tree. I failed at actually
> testing this, but I presume this is the fix...
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index a5365142cdba..894a6ac6f6e7 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -27,6 +27,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> -- 
> 2.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 03/14] drm/fb-helper: Fix sparse warnings

2016-09-19 Thread Daniel Vetter
On Mon, Sep 19, 2016 at 04:33:44PM +0300, ville.syrjala at linux.intel.com 
wrote:
> From: Ville Syrjälä 
> 
> drm/drm_fb_helper.c:2306:12: warning: symbol 'drm_fb_helper_modinit' was not 
> declared. Should it be static?
> 
> While at it, move the lefover static inline to the right place.
> 
> Cc: Daniel Vetter 
> Cc: Sean Paul 
> Signed-off-by: Ville Syrjälä 

Merged the first 3 core patches to drm-misc. For the others a bit more
soaking time for maintainers to ack them I guess.
-Daniel

> ---
>  drivers/gpu/drm/drm_crtc_helper_internal.h | 7 +++
>  drivers/gpu/drm/drm_fb_helper.c| 2 ++
>  include/drm/drm_fb_helper.h| 5 -
>  3 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper_internal.h 
> b/drivers/gpu/drm/drm_crtc_helper_internal.h
> index 4e6b57ae7188..28295e5d0d9e 100644
> --- a/drivers/gpu/drm/drm_crtc_helper_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_helper_internal.h
> @@ -29,7 +29,14 @@
>  #include 
>  
>  /* drm_fb_helper.c */
> +#ifdef CONFIG_DRM_FBDEV_EMULATION
>  int drm_fb_helper_modinit(void);
> +#else
> +static inline int drm_fb_helper_modinit(void)
> +{
> + return 0;
> +}
> +#endif
>  
>  /* drm_dp_aux_dev.c */
>  #ifdef CONFIG_DRM_DP_AUX_CHARDEV
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index dd8e3b68fd53..03414bde1f15 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -41,6 +41,8 @@
>  #include 
>  #include 
>  
> +#include "drm_crtc_helper_internal.h"
> +
>  static bool drm_fbdev_emulation = true;
>  module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
>  MODULE_PARM_DESC(fbdev_emulation,
> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> index 797fb5f80c45..e19458dd1a43 100644
> --- a/include/drm/drm_fb_helper.h
> +++ b/include/drm/drm_fb_helper.h
> @@ -287,11 +287,6 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper 
> *fb_helper, struct drm_
>  int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
>  struct drm_connector *connector);
>  #else
> -static inline int drm_fb_helper_modinit(void)
> -{
> - return 0;
> -}
> -
>  static inline void drm_fb_helper_prepare(struct drm_device *dev,
>   struct drm_fb_helper *helper,
>   const struct drm_fb_helper_funcs *funcs)
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


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

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

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

[Bug 97838] Hang on resume [AMD/ATI] RV515/M54 [Mobility Radeon X1400]

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

--- Comment #1 from Alex Deucher  ---
Can you bisect?

-- 
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/20160919/e6d00c1c/attachment-0001.html>


[Bug 97861] [amdgpu SI] purple line is visible on left side of the screen connected by HDMI

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

Bug ID: 97861
   Summary: [amdgpu SI] purple line is visible on left side of the
screen connected by HDMI
   Product: DRI
   Version: DRI git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: arek.rusi at gmail.com

Created attachment 126615
  --> https://bugs.freedesktop.org/attachment.cgi?id=126615&action=edit
the purple line

kernel - 3 days old drm-next-4.9-wip
mesa/llvm/libdrm - latest
xorg - 1.18.4 / ~1.19

I have two displays: DVI monitor, always "on" and HDMI (TV) usually "off". 

When i turn on HDMI screen:
$xrandr --output DVI-I-1 --primary --mode 1680x1050 --output HDMI-A-0 --mode
1920x1080

On left side TV screen appears purple vertical line. 


1) this is 80-90% bug 91041, but amdgpu here and srcreen isn't blurry
$xrandr --output HDMI-A-0 --auto --set audio off
works for me
2) option audio=0 did the job as well 
3) Before Xorg/wayland start tty's are clean&black after X/wayland purple line
is visible.  
4) problem is probably related to hdmi-audio so i don't even know if it's bug
at all

-- 
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/20160919/61aca785/attachment.html>


[Bug 97861] [amdgpu SI] purple line is visible on left side of the screen connected by HDMI

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

--- Comment #1 from Arek Ruśniak  ---
Created attachment 126616
  --> https://bugs.freedesktop.org/attachment.cgi?id=126616&action=edit
dmesg

[drm] : dce_v6_0_afmt_setmode no impl 

-- 
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/20160919/12916da5/attachment.html>


[Bug 97838] Hang on resume [AMD/ATI] RV515/M54 [Mobility Radeon X1400]

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

--- Comment #2 from Nikolay  ---
Hi.

  Thanks for your response!

It is somewhat hard because it goes from 'hangs almost always' on ubuntu's
4.4.0 kernel to 'hangs every time' on 4.7.3.

Also I assume xorg and its version may play some role in that because it
doesn't happen in text console.

It also looks like that there is some sort of dependency on how log it was off
- 4.4.0 almost never wakes up overnight.

I'll try to play with different versions to see if I can find a pattern...

I was hoping that there is some way to delay radeon awakening for after I get
net and can tail debug logs - so if there are errors it would dump them.

-- 
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/20160919/3e20a7e9/attachment.html>


[Intel-gfx] Skylake graphics regression: projector failure with 4.8-rc3

2016-09-19 Thread James Bottomley
On Sun, 2016-09-18 at 13:35 +0200, Thorsten Leemhuis wrote:
> Hi! James & Paulo: What's the current status of this?

No, the only interaction has been the suggestion below for a revert,
which didn't fix the problem.

>  Was this issue discussed elsewhere or even fixed in between? Just 
> asking, because this issue is on the list of regressions for 4.8.


I'm just about to try out -rc7, but it's not fixed so far.

James


> Ciao, Thorsten
> 
> On 01.09.2016 00:25, James Bottomley wrote:
> > On Wed, 2016-08-31 at 21:51 +, Zanoni, Paulo R wrote:
> > > Em Qua, 2016-08-31 às 14:43 -0700, James Bottomley escreveu:
> > > > On Wed, 2016-08-31 at 11:23 -0700, James Bottomley wrote:
> > > > > On Fri, 2016-08-26 at 09:10 -0400, James Bottomley wrote:
> > > > > > We seem to have an xrandr regression with skylake now. 
> > > > > >  What's
> > > > > > happening is that I can get output on to a projector, but
> > > > > > the 
> > > > > > system is losing video when I change the xrandr sessions
> > > > > > (like 
> > > > > > going from a --above b to a --same-as b).  The main screen
> > > > > > goes
> > > > > > blank, which is basically a reboot situation. 
> > > > > >  Unfortunately, I
> > > > > > can't seem to get the logs out of systemd to see if there
> > > > > > was a
> > > > > > dump to dmesg (the system was definitely responding).
> > > > > > 
> > > > > > I fell back to 4.6.2 which worked perfectly, so this is
> > > > > > definitely 
> > > > > > some sort of regression.  I'll be able to debug more fully
> > > > > > when
> > > > > > I 
> > > > > > get back home from the Linux Security Summit.
> > > > > 
> > > > > I'm home now.  Unfortunately, my monitor isn't as problematic
> > > > > as
> > > > > the
> > > > > projector, but by flipping between various modes and
> > > > > separating
> > > > > and
> > > > > overlaying the panels with --above and --same-as (xrandr), I
> > > > > can
> > > > > eventually get it to the point where the main LCD panel goes
> > > > > black 
> > > > > and can only be restarted by specifying a different mode.
> > > > > 
> > > > > This seems to be associated with these lines in the X
> > > > > 
> > > > > [ 14714.389] (EE) intel(0): failed to set mode: Invalid
> > > > > argument
> > > > > [22]
> > > > > 
> > > > > But the curious thing is that even if this fails with the
> > > > > error 
> > > > > message once, it may succeed a second time, so it looks to be
> > > > > a 
> > > > > transient error translation problem from the kernel driver.
> > > > > 
> > > > > I've attached the full log below.
> > > > > 
> > > > > This is only with a VGA output.  I currently don't have a
> > > > > HDMI 
> > > > > dongle, but I'm in the process of acquiring one.
> > > > 
> > > > After more playing around, I'm getting thousands of these in
> > > > the
> > > > kernel
> > > > log (possibly millions: the log wraps very fast):
> > > > 
> > > > [23504.873606] [drm:intel_dp_start_link_train [i915]] *ERROR*
> > > > failed
> > > > to train DP, aborting
> > > > 
> > > > And then finally it gives up with 
> > > > 
> > > > [25023.770951] [drm:intel_cpu_fifo_underrun_irq_handler [i915]]
> > > > *ERROR* CPU pipe B FIFO underrun
> > > > [25561.926075] [drm:intel_cpu_fifo_underrun_irq_handler [i915]]
> > > > *ERROR* CPU pipe A FIFO underrun
> > > > 
> > > > And the crtc for the VGA output becomes non-responsive to any
> > > > configuration command.  This requires a reboot and sometimes a
> > > > UEFI
> > > > variable reset before it comes back.
> > > 
> > > Please see this discussion:
> > > https://patchwork.freedesktop.org/patch/103237/
> > > 
> > > Do you have this patch on your tree? Does the problem go away if
> > > you
> > > revert it?
> > 
> > Yes, I've got it, it went in in 4.8-rc3 according to git:
> > 
> > commit 58e311b09c319183254d9220c50a533e7157c9ab
> > Author: Matt Roper 
> > Date:   Thu Aug 4 14:08:00 2016 -0700
> > 
> > drm/i915/gen9: Give one extra block per line for SKL plane WM
> > calculations
> > 
> > Reverting it causes the secondary display not to sync pretty much
> > at
> > all.  However, in the flickers I can see, it does work OK and
> > doesn't
> > now crash switching from --same-as to --above and back
> > 
> > I also still get the logs filling up with the link training errors.
> > 
> > On balance, although the behaviour is different, it's not an
> > improvement because if I can't sync with the projector, I can't
> > really
> > use this as a fix.
> > 
> > James
> 



[Bug 97856] Computer restart playing 3D games (possibly overheating)

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

--- Comment #2 from Alex Deucher  ---
Please attach your xorg log and dmesg output.  Does setting radeon.dpm=1 on the
kernel command line in grub help?

-- 
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/20160919/73bd5f34/attachment.html>


[PATCH 09/14] drm/msm: Fix sparse warnings

2016-09-19 Thread Jani Nikula
On Mon, 19 Sep 2016, Emil Velikov  wrote:
> On 19 September 2016 at 14:33,   wrote:
>
>> --- a/drivers/gpu/drm/msm/msm_fb.c
>> +++ b/drivers/gpu/drm/msm/msm_fb.c
>> @@ -132,7 +132,7 @@ const struct msm_format *msm_framebuffer_format(struct 
>> drm_framebuffer *fb)
>>  struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
>> struct drm_file *file, const struct drm_mode_fb_cmd2 
>> *mode_cmd)
>>  {
>> -   struct drm_gem_object *bos[4] = {0};
>> +   struct drm_gem_object *bos[4] = {};
> Fwiw I was reminded using empty initializers isn't standard C [1].

Well, meh, we're not doing -std=c11 -pedantic. Arguably {} is neater.

I guess the commit message lacks the sparse warning about using plain
integer 0 as NULL pointer.

BR,
Jani.



>
> Regards,
> Emil
>
> [1] 
> http://stackoverflow.com/questions/17589533/is-an-empty-initializer-list-valid-c-code
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH 0/5] GPU-DRM: Fine-tuning for four function implementations

2016-09-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 19 Sep 2016 17:47:37 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  Use kmalloc_array() in drm_legacy_addbufs_pci()
  Replace two kzalloc() calls by kcalloc() in drm_legacy_addbufs_pci()
  Replace a kzalloc() call by kcalloc() in drm_legacy_addbufs_agp()
  Replace a kzalloc() call by kcalloc() in drm_legacy_addbufs_sg()
  Rename a jump label in drm_legacy_mapbufs()

 drivers/gpu/drm/drm_bufs.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

-- 
2.10.0



[PATCH 1/5] GPU-DRM: Use kmalloc_array() in drm_legacy_addbufs_pci()

2016-09-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 19 Sep 2016 17:07:06 +0200

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/gpu/drm/drm_bufs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 3219151..ed33f43 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -923,8 +923,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
/* Keep the original pagelist until we know all the allocations
 * have succeeded
 */
-   temp_pagelist = kmalloc((dma->page_count + (count << page_order)) *
-  sizeof(*dma->pagelist), GFP_KERNEL);
+   temp_pagelist = kmalloc_array(dma->page_count + (count << page_order),
+ sizeof(*dma->pagelist),
+ GFP_KERNEL);
if (!temp_pagelist) {
kfree(entry->buflist);
kfree(entry->seglist);
-- 
2.10.0



[PATCH 2/5] GPU-DRM: Replace two kzalloc() calls by kcalloc() in drm_legacy_addbufs_pci()

2016-09-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 19 Sep 2016 17:17:34 +0200

The script "checkpatch.pl" can point information out like the following.

WARNING: Prefer kcalloc over kzalloc with multiply

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/gpu/drm/drm_bufs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index ed33f43..8a31dac 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -905,14 +905,14 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
return -EINVAL;
}

-   entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL);
+   entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}

-   entry->seglist = kzalloc(count * sizeof(*entry->seglist), GFP_KERNEL);
+   entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL);
if (!entry->seglist) {
kfree(entry->buflist);
mutex_unlock(&dev->struct_mutex);
-- 
2.10.0



[PATCH 3/5] GPU-DRM: Replace a kzalloc() call by kcalloc() in drm_legacy_addbufs_agp()

2016-09-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 19 Sep 2016 17:24:20 +0200

The script "checkpatch.pl" can point information out like the following.

WARNING: Prefer kcalloc over kzalloc with multiply

Thus fix the affected source code place.

Signed-off-by: Markus Elfring 
---
 drivers/gpu/drm/drm_bufs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 8a31dac..36dd685 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -755,7 +755,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
return -EINVAL;
}

-   entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL);
+   entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc);
-- 
2.10.0



[PATCH 4/5] GPU-DRM: Replace a kzalloc() call by kcalloc() in drm_legacy_addbufs_sg()

2016-09-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 19 Sep 2016 17:30:31 +0200

The script "checkpatch.pl" can point information out like the following.

WARNING: Prefer kcalloc over kzalloc with multiply

Thus fix the affected source code place.

Signed-off-by: Markus Elfring 
---
 drivers/gpu/drm/drm_bufs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 36dd685..adb1dd7 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1117,8 +1117,7 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
return -EINVAL;
}

-   entry->buflist = kzalloc(count * sizeof(*entry->buflist),
-   GFP_KERNEL);
+   entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc);
-- 
2.10.0



[PATCH 5/5] GPU-DRM: Rename a jump label in drm_legacy_mapbufs()

2016-09-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 19 Sep 2016 17:37:27 +0200

Adjust jump labels according to the current Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/gpu/drm/drm_bufs.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index adb1dd7..0d5ee1e 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1476,7 +1476,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data,

if (!map) {
retcode = -EINVAL;
-   goto done;
+   goto status_indication;
}
virtual = vm_mmap(file_priv->filp, 0, map->size,
  PROT_READ | PROT_WRITE,
@@ -1490,7 +1490,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data,
if (virtual > -1024UL) {
/* Real error */
retcode = (signed long)virtual;
-   goto done;
+   goto status_indication;
}
request->virtual = (void __user *)virtual;

@@ -1499,28 +1499,28 @@ int drm_legacy_mapbufs(struct drm_device *dev, void 
*data,
 &dma->buflist[i]->idx,
 sizeof(request->list[0].idx))) {
retcode = -EFAULT;
-   goto done;
+   goto status_indication;
}
if (copy_to_user(&request->list[i].total,
 &dma->buflist[i]->total,
 sizeof(request->list[0].total))) {
retcode = -EFAULT;
-   goto done;
+   goto status_indication;
}
if (copy_to_user(&request->list[i].used,
 &zero, sizeof(zero))) {
retcode = -EFAULT;
-   goto done;
+   goto status_indication;
}
address = virtual + dma->buflist[i]->offset;/* *** 
*/
if (copy_to_user(&request->list[i].address,
 &address, sizeof(address))) {
retcode = -EFAULT;
-   goto done;
+   goto status_indication;
}
}
}
-  done:
+ status_indication:
request->count = dma->buf_count;
DRM_DEBUG("%d buffers, retcode = %d\n", request->count, retcode);

-- 
2.10.0



[PATCH 09/14] drm/msm: Fix sparse warnings

2016-09-19 Thread Emil Velikov
On 19 September 2016 at 16:33, Jani Nikula  
wrote:
> On Mon, 19 Sep 2016, Emil Velikov  wrote:
>> On 19 September 2016 at 14:33,   wrote:
>>
>>> --- a/drivers/gpu/drm/msm/msm_fb.c
>>> +++ b/drivers/gpu/drm/msm/msm_fb.c
>>> @@ -132,7 +132,7 @@ const struct msm_format *msm_framebuffer_format(struct 
>>> drm_framebuffer *fb)
>>>  struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
>>> struct drm_file *file, const struct drm_mode_fb_cmd2 
>>> *mode_cmd)
>>>  {
>>> -   struct drm_gem_object *bos[4] = {0};
>>> +   struct drm_gem_object *bos[4] = {};
>> Fwiw I was reminded using empty initializers isn't standard C [1].
>
> Well, meh, we're not doing -std=c11 -pedantic. Arguably {} is neater.
>
> I guess the commit message lacks the sparse warning about using plain
> integer 0 as NULL pointer.
>
Ack. Just pointing it out for people, who weren't familiar. Fwiw this
is one of the bigger bikesheding topics I've seen, esp. since
different compiler (versions) produce warnings for each permutation
:-\

Sparse shouldn't produce warning since the spec explicitly states that
0 should be 'good enough' for anyone ;-)

Regards,
Emil


  1   2   >