[Bug 88263] Civilization Beyond Earth crashes on r600

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88263

--- Comment #5 from oleid at mescharet.de ---
That's strange. It works for me, even without being loged in to google.

Please try this link:

https://mescharet.de/owncloud/public.php?service=files=ab882a446ac7ca180c98d17370dddebc

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


[Bug 88183] radeonsi: R9 280X hangs with SuperTuxKart

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88183

--- Comment #21 from Alexandre Demers  ---
(In reply to Marek Olšák from comment #20)
> Yes. VM faults can cause hangs too. Were you able to bisect the problematic
> commit?

Are you refering to the VM faults? If so, not yet? I've been busy with other
things lately, but I could give it a go in the next week.

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


[PATCH libdrm 1/2] Rename DRM_NODE_RENDER to DRM_NODE_PRIMARY

2015-01-23 Thread Emil Velikov
On 23/01/15 16:17, Frank Binns wrote:
> Ping
> 
Thanks for the patches and reminder Frank.
I've pushed these to master with Rob's r-b.

Cheers,
Emil



[Bug 90741] Radeon: System pauses on TAHITI

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=90741

--- Comment #20 from Gustaw Smolarczyk  ---
I will try that on Sunday since I have no access to the radeonsi hardware at
the moment.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Intel-gfx] [BUG, bisect] drm/i915: mouse pointer lags and overshoots

2015-01-23 Thread Jeremiah Mahler
all,

On Tue, Jan 20, 2015 at 06:48:42AM +0100, Daniel Vetter wrote:
> On Mon, Jan 19, 2015 at 08:40:24AM -0800, Matt Roper wrote:
> > On Mon, Jan 19, 2015 at 11:04:04AM +, Chris Wilson wrote:
> > > On Mon, Jan 19, 2015 at 11:51:43AM +0100, Daniel Vetter wrote:
> > > > There's also an issue in (most) X drivers which exaberates this
> > > > issues: When changing the cursor buffer the X cursor code does a a)
> > > > disable cursor b) update cursor image c) enable cursor cycle.
> > > 
> > > Notably not -intel on which the bug has been observed. And more
> > > importantly, the slow downs don't seem to correlate with cursor change,
> > > just cursor movement.
> > > -Chris
> > > 
> > > -- 
> > > Chris Wilson, Intel Open Source Technology Centre
> > 
> > It seems that the simple fix for this case (movement only) is to just
> > skip the prepare_fb/cleanup_fb calls (and the associated vblank wait) in
> > the transitional plane helper when newfb == oldfb.  I just posted a
> > small patch that makes that change (and solves the cursor lag for me).
> > 
> > This won't solve the case if userspace uses a different framebuffer for
> > each update (while trying to update faster than the refresh rate).  Is
> > there any existing userspace that behaves this way that we can test
> > with?
> 
> Hm, I've thought I've merged that patch already:
> 
> commit ab58e3384b9f9863bfd029b458ff337d381bf6d2
> Author: Daniel Vetter 
> Date:   Mon Nov 24 20:42:42 2014 +0100
> 
> drm/atomic-helper: Skip vblank waits for unchanged fbs
> 
> Or is the problem here that the transitional plane helpers aren't up to
> the task? If so please reference that in your patch.
> 
> And we still need a hack for the "changed fb cursor" issue, I'll whip
> something up.
> -Daniel
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

Just checking if anyone has come up with a fix.  I am still stuck at
next-20150112 because of this bug.

-- 
- Jeremiah Mahler


[Bug 88263] Civilization Beyond Earth crashes on r600

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88263

--- Comment #4 from Marek Olšák  ---
I can't download the trace. The google download returns error 400.

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


[Bug 88263] Civilization Beyond Earth crashes on r600

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88263

--- Comment #3 from oleid at mescharet.de ---
Hey Marek!

Thanks for having a look into this!

As far as I can tell, the bug occurs without the LLVM backend. I just realized,
that you have to set the environment variable "R600_LLVM", which I didn't.
Instead, I tried to activate the LLVM backend by adding the string "llvm" to
R600_DEBUG (yet, not in the run which created the traces). Furthermore,
R600_LLVM is not set by default on ArchLinux. So actually, I never tried the
LLVM backend.

If you'd like to have a trace using the LLVM backend, please let me know.

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


[PATCH] drm/dp: Use large transactions for I2C over AUX

2015-01-23 Thread Thierry Reding
On Fri, Jan 23, 2015 at 09:46:29PM +0200, Ville Syrjälä wrote:
> On Fri, Jan 23, 2015 at 06:40:38PM +, Simon Farnsworth wrote:
> > DisplayPort to DVI-D Dual Link adapters designed by Bizlink have bugs in
> > their I2C over AUX implementation. They work fine with Windows, but fail
> > with Linux.
> > 
> > It turns out that they cannot keep an I2C transaction open unless the
> > previous read was 16 bytes; shorter reads can only be followed by a zero
> > byte transfer ending the I2C transaction.
> > 
> > Copy Windows's behaviour, and read 16 bytes at a time. Analysis of the
> > failure state was provided by Datapath Ltd.
> > 
> > Signed-off-by: Simon Farnsworth 
> > ---
> > Thierry,
> > 
> > You put in the comment about "decreased performance", back in December 2013;
> > would you mind testing that this still works with the devices you tested?
> > 
> > Unfortunately, Bizlink are the only game in town for DP->DVI-DL adapters -
> > and their firmware is prone to giving up on I2C if we look at it
> > wrongly. Even Apple's device is Bizlink designed.
> > 
> >  drivers/gpu/drm/drm_dp_helper.c | 13 +
> >  1 file changed, 5 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_dp_helper.c 
> > b/drivers/gpu/drm/drm_dp_helper.c
> > index 79968e3..b4a9d4a 100644
> > --- a/drivers/gpu/drm/drm_dp_helper.c
> > +++ b/drivers/gpu/drm/drm_dp_helper.c
> > @@ -507,16 +507,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter 
> > *adapter, struct i2c_msg *msgs,
> > err = drm_dp_i2c_do_msg(aux, );
> > if (err < 0)
> > break;
> > -   /*
> > -* Many hardware implementations support FIFOs larger than a
> > -* single byte, but it has been empirically determined that
> > -* transferring data in larger chunks can actually lead to
> > -* decreased performance. Therefore each message is simply
> > -* transferred byte-by-byte.
> > +   /* Bizlink designed DP->DVI-D Dual Link adapters require the
> > + * I2C over AUX packets to be as large as possible. If not,
> > + * the I2C transactions never succeed.
> >  */
> > -   for (j = 0; j < msgs[i].len; j++) {
> > +   for (j = 0; j < msgs[i].len; j+=16) {
> > msg.buffer = msgs[i].buf + j;
> > -   msg.size = 1;
> > +   msg.size = min(16, msgs[i].len - 16);
> 
> I don't think it's quite this simple. The sink is allowed to ACK
> partial data for multi-byte messages. The code doesn't handle that.

Also not all hardware may support transferring 16 bytes at a time. How
does that work with these adapters? Does it mean they can't work on DP
hardware that can't do 16 byte block transfers?

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150123/3761dd96/attachment.sig>


[Bug 88183] radeonsi: R9 280X hangs with SuperTuxKart

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88183

--- Comment #20 from Marek Olšák  ---
Yes. VM faults can cause hangs too. Were you able to bisect the problematic
commit?

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


[Bug 88263] Civilization Beyond Earth crashes on r600

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88263

--- Comment #2 from Marek Olšák  ---
Is the bug present without LLVM?

BTW, I don't recommend using LLVM with r600g for graphics, because it's not
tested by developers and likely incomplete.

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


[Bug 88209] HAVE_LLVM undelcared in r600_pipe_common.c if enable_r600_llvm not set

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88209

Marek Olšák  changed:

   What|Removed |Added

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

--- Comment #4 from Marek Olšák  ---
Fixed with bed6f20f28af8bf531c14e3cab12a00354a31. Closing.

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


[PATCH] drm/dp: Use large transactions for I2C over AUX

2015-01-23 Thread Ville Syrjälä
On Fri, Jan 23, 2015 at 06:40:38PM +, Simon Farnsworth wrote:
> DisplayPort to DVI-D Dual Link adapters designed by Bizlink have bugs in
> their I2C over AUX implementation. They work fine with Windows, but fail
> with Linux.
> 
> It turns out that they cannot keep an I2C transaction open unless the
> previous read was 16 bytes; shorter reads can only be followed by a zero
> byte transfer ending the I2C transaction.
> 
> Copy Windows's behaviour, and read 16 bytes at a time. Analysis of the
> failure state was provided by Datapath Ltd.
> 
> Signed-off-by: Simon Farnsworth 
> ---
> Thierry,
> 
> You put in the comment about "decreased performance", back in December 2013;
> would you mind testing that this still works with the devices you tested?
> 
> Unfortunately, Bizlink are the only game in town for DP->DVI-DL adapters -
> and their firmware is prone to giving up on I2C if we look at it
> wrongly. Even Apple's device is Bizlink designed.
> 
>  drivers/gpu/drm/drm_dp_helper.c | 13 +
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 79968e3..b4a9d4a 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -507,16 +507,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, 
> struct i2c_msg *msgs,
>   err = drm_dp_i2c_do_msg(aux, );
>   if (err < 0)
>   break;
> - /*
> -  * Many hardware implementations support FIFOs larger than a
> -  * single byte, but it has been empirically determined that
> -  * transferring data in larger chunks can actually lead to
> -  * decreased performance. Therefore each message is simply
> -  * transferred byte-by-byte.
> + /* Bizlink designed DP->DVI-D Dual Link adapters require the
> + * I2C over AUX packets to be as large as possible. If not,
> + * the I2C transactions never succeed.
>*/
> - for (j = 0; j < msgs[i].len; j++) {
> + for (j = 0; j < msgs[i].len; j+=16) {
>   msg.buffer = msgs[i].buf + j;
> - msg.size = 1;
> + msg.size = min(16, msgs[i].len - 16);

I don't think it's quite this simple. The sink is allowed to ACK
partial data for multi-byte messages. The code doesn't handle that.

>  
>   err = drm_dp_i2c_do_msg(aux, );
>   if (err < 0)
> -- 
> 2.1.0
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC


[PATCH] drm: fix drm_display_info_set_bus_formats kernel doc header

2015-01-23 Thread Boris Brezillon
formats and num_formats arguments were previously called fmts and nfmts.
Fix the kernel doc comment so that it matches the new argument names.

Signed-off-by: Boris Brezillon 
---
 drivers/gpu/drm/drm_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index df90048..ad2934b 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -764,8 +764,8 @@ static void drm_mode_remove(struct drm_connector *connector,
 /**
  * drm_display_info_set_bus_formats - set the supported bus formats
  * @info: display info to store bus formats in
- * @fmts: array containing the supported bus formats
- * @nfmts: the number of entries in the fmts array
+ * @formats: array containing the supported bus formats
+ * @num_formats: the number of entries in the fmts array
  *
  * Store the supported bus formats in display info structure.
  * See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
-- 
1.9.1



[Bug 71051] Cannot suspend with radeon drivers.

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=71051

Thomas J. Moore  changed:

   What|Removed |Added

 CC||darktjm at gmail.com

--- Comment #16 from Thomas J. Moore  ---
I have a Dell Inspiron with AMD A6 (Advanced Micro Devices, Inc. [AMD/ATI]
Mullins [Radeon R4/R5 Graphics]), and stopped upgrading my kernel at 3.16.3
because it would no longer resume from disk about 90% or more of the time.  I
have finally given in and looked for the cause a bit, and have traced it to
this patch.  Without this patch, 3.18.3 (and probably all other versions I
skipped before it) works fine for me.  That said, I never suspend to memory,
and so I tried with and without, and indeed the patch seems to be necessary for
resume-from-memory on my system as well.  So, while this patch does fix a bug,
it introduces a regression for me.  Is it possible the value of nb_dpm_enabled
is not restored or initialized properly on resume from disk, due to the video
mode change?

The symptoms when resuming from disk are similar to comment 9 (ring test
failures, which do not occur without the patch), with X crashing (and, due to
the fact that I start it in inittab, retrying with "couldn't schedule ib" error
until I reboot or disable the inittab entry).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH] drm: atmel-hlcdc: Add dependency on ARM

2015-01-23 Thread Boris Brezillon
The atmel-hlcdc driver selects DRM_GEM_CMA_HELPER which makes use of
symbols only available when HAVE_DMA_ATTRS is selected.
Add a dependency on the ARM architecture which select this option.

Signed-off-by: Boris Brezillon 
---
 drivers/gpu/drm/atmel-hlcdc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/Kconfig 
b/drivers/gpu/drm/atmel-hlcdc/Kconfig
index 1a08562..99b4f06 100644
--- a/drivers/gpu/drm/atmel-hlcdc/Kconfig
+++ b/drivers/gpu/drm/atmel-hlcdc/Kconfig
@@ -1,6 +1,6 @@
 config DRM_ATMEL_HLCDC
tristate "DRM Support for ATMEL HLCDC Display Controller"
-   depends on DRM && OF && COMMON_CLK && MFD_ATMEL_HLCDC
+   depends on DRM && OF && COMMON_CLK && MFD_ATMEL_HLCDC && ARM
select DRM_GEM_CMA_HELPER
select DRM_KMS_HELPER
select DRM_KMS_FB_HELPER
-- 
1.9.1



[Bug 90741] Radeon: System pauses on TAHITI

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=90741

--- Comment #19 from Maarten Lankhorst  ---
Created attachment 164511
  --> https://bugzilla.kernel.org/attachment.cgi?id=164511=edit
Clear irqs before processing.. Patch on top of 'another approach'

Can you try with the irq_put/get lines commented, and this patch applied? Lets
see if clearing irqs before processing helps..

Also there is a line in radeon_fence.c with
"radeon_irq_kms_sw_irq_get_delayed", can you add a WARN_ON_ONCE above that line
after the else? To check if that path is taken...

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 91861] [Radeon RS780] Blank screen (no signal) on HDMI after boot in 3.15 & later

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=91861

Alex Deucher  changed:

   What|Removed |Added

 CC||alexdeucher at gmail.com

--- Comment #2 from Alex Deucher  ---
(In reply to Mike S. from comment #0)
> I think this problem may be related to
> https://bugzilla.kernel.org/show_bug.cgi?id=83461.
>

Probably the same issue.  Do any of the patches on that bug help?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH] drm/dp: Use large transactions for I2C over AUX

2015-01-23 Thread Simon Farnsworth
DisplayPort to DVI-D Dual Link adapters designed by Bizlink have bugs in
their I2C over AUX implementation. They work fine with Windows, but fail
with Linux.

It turns out that they cannot keep an I2C transaction open unless the
previous read was 16 bytes; shorter reads can only be followed by a zero
byte transfer ending the I2C transaction.

Copy Windows's behaviour, and read 16 bytes at a time. Analysis of the
failure state was provided by Datapath Ltd.

Signed-off-by: Simon Farnsworth 
---
Thierry,

You put in the comment about "decreased performance", back in December 2013;
would you mind testing that this still works with the devices you tested?

Unfortunately, Bizlink are the only game in town for DP->DVI-DL adapters -
and their firmware is prone to giving up on I2C if we look at it
wrongly. Even Apple's device is Bizlink designed.

 drivers/gpu/drm/drm_dp_helper.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 79968e3..b4a9d4a 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -507,16 +507,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, 
struct i2c_msg *msgs,
err = drm_dp_i2c_do_msg(aux, );
if (err < 0)
break;
-   /*
-* Many hardware implementations support FIFOs larger than a
-* single byte, but it has been empirically determined that
-* transferring data in larger chunks can actually lead to
-* decreased performance. Therefore each message is simply
-* transferred byte-by-byte.
+   /* Bizlink designed DP->DVI-D Dual Link adapters require the
+ * I2C over AUX packets to be as large as possible. If not,
+ * the I2C transactions never succeed.
 */
-   for (j = 0; j < msgs[i].len; j++) {
+   for (j = 0; j < msgs[i].len; j+=16) {
msg.buffer = msgs[i].buf + j;
-   msg.size = 1;
+   msg.size = min(16, msgs[i].len - 16);

err = drm_dp_i2c_do_msg(aux, );
if (err < 0)
-- 
2.1.0



[PATCH 2/2] drm/imx: ldb: fix lvds<->di channel mapping on mx53

2015-01-23 Thread Philipp Zabel
From: Lucas Stach 

On systems without a mux between the IPU display interfaces
and the LVDS channels it isn't possible to infer the DI
number from the LDB port numbers, but have a static 1:1
mapping.

Signed-off-by: Lucas Stach 
Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/imx-ldb.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 631909e..4fca2b9 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -131,6 +131,19 @@ static bool imx_ldb_encoder_mode_fixup(struct drm_encoder 
*encoder,
return true;
 }

+static int imx_ldb_get_mux_id(struct imx_ldb_channel *channel)
+{
+   /*
+* If there is no mux in between the mapping from lvds channel number
+* to display interface number is 1:1
+*/
+   if (channel->ldb->lvds_mux)
+   return imx_drm_encoder_get_mux_id(channel->child,
+ >encoder);
+   else
+   return channel->chno;
+}
+
 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno,
unsigned long serial_clk, unsigned long di_clk)
 {
@@ -195,7 +208,7 @@ static void imx_ldb_encoder_commit(struct drm_encoder 
*encoder)
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
struct imx_ldb *ldb = imx_ldb_ch->ldb;
int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
-   int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);
+   int mux = imx_ldb_get_mux_id(imx_ldb_ch);

if (dual) {
clk_prepare_enable(ldb->clk[0]);
@@ -241,7 +254,7 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
*encoder,
int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
unsigned long serial_clk;
unsigned long di_clk = mode->clock * 1000;
-   int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);
+   int mux = imx_ldb_get_mux_id(imx_ldb_ch);

if (mode->clock > 17) {
dev_warn(ldb->dev,
-- 
2.1.4



[PATCH 1/2] drm/imx: ldb: fix split mode for i.MX53

2015-01-23 Thread Philipp Zabel
On i.MX53, the DI0 clock can only be sourced from ldb_di0, and
the DI1 clock can only be sourced from ldb_di1. i.MX6q does not
have this limitation.
Luckily, in split mode both ldb_di0 and ldb_di1 have to be
synchronous, so we can choose either one of them as source for
the display interface. imx_ldb_set_clock is called for both
ldb_di0 and ldb_di1.
With this patch we only try to set the parent clock during the
combination of DI and ldb_di which works on i.MX53.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/imx-ldb.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 2d6dc94..631909e 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -151,6 +151,13 @@ static void imx_ldb_set_clock(struct imx_ldb *ldb, int 
mux, int chno,
dev_dbg(ldb->dev, "%s after: %ld\n", __func__,
clk_get_rate(ldb->clk[chno]));

+   /*
+* In split mode, do not try to set the di0 parent clock to ldb_di1,
+* or the di1 parent clock to ldb_di0, which is not possible on i.MX53.
+*/
+   if ((ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) && (mux != chno))
+   return;
+
/* set display clock mux to LDB input clock */
ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]);
if (ret)
-- 
2.1.4



[PATCH] drm/imx: imx-ldb: enable DI clock in encoder_mode_set

2015-01-23 Thread Philipp Zabel
Commit eb10d6355532 ("imx-drm: encoder prepare/mode_set must use adjusted mode")
broke the first LVDS modeset by using crtc->hwmode before crtc mode_set is
called. In fact, encoder prepare is not supposed to prepare the display clock
at all. Rather encoder mode_set should be used to set the DI clock rate, before
it is enabled by crtc commit.

Reported-by: Liu Ying 
Tested-by: Fabio Estevam 
Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/imx-ldb.c | 28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 1b86aac..2d6dc94 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -163,22 +163,7 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
 {
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
struct imx_ldb *ldb = imx_ldb_ch->ldb;
-   struct drm_display_mode *mode = >crtc->hwmode;
u32 pixel_fmt;
-   unsigned long serial_clk;
-   unsigned long di_clk = mode->clock * 1000;
-   int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);
-
-   if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) {
-   /* dual channel LVDS mode */
-   serial_clk = 3500UL * mode->clock;
-   imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk);
-   imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk);
-   } else {
-   serial_clk = 7000UL * mode->clock;
-   imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk,
-   di_clk);
-   }

switch (imx_ldb_ch->chno) {
case 0:
@@ -247,6 +232,9 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
*encoder,
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
struct imx_ldb *ldb = imx_ldb_ch->ldb;
int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
+   unsigned long serial_clk;
+   unsigned long di_clk = mode->clock * 1000;
+   int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);

if (mode->clock > 17) {
dev_warn(ldb->dev,
@@ -257,6 +245,16 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
*encoder,
 "%s: mode exceeds 85 MHz pixel clock\n", __func__);
}

+   if (dual) {
+   serial_clk = 3500UL * mode->clock;
+   imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk);
+   imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk);
+   } else {
+   serial_clk = 7000UL * mode->clock;
+   imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk,
+ di_clk);
+   }
+
/* FIXME - assumes straight connections DI0 --> CH0, DI1 --> CH1 */
if (imx_ldb_ch == >channel[0]) {
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
-- 
2.1.4



[PATCH v2] pci: Fix infinite loop with ROM image of size 0

2015-01-23 Thread Bjorn Helgaas
On Mon, Jan 19, 2015 at 05:53:20PM +0900, Michel Dänzer wrote:
> From: Michel Dänzer 
> 
> If the image size would ever read as 0, pci_get_rom_size could keep
> processing the same image over and over again.
> 
> Reported-by: Federico 
> Cc: stable at vger.kernel.org
> Signed-off-by: Michel Dänzer 

Applied with Alex's ack to pci/resource for v3.20, thanks!

> ---
> 
> v2:
> * Use unsigned instead of u16 for the local length variable (not sure if
>   the multiplication by 512 could overflow otherwise)
> * Integrate length condition into while statement
> * Add stable tag
> 
>  drivers/pci/rom.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
> index f955edb..eb0ad53 100644
> --- a/drivers/pci/rom.c
> +++ b/drivers/pci/rom.c
> @@ -71,6 +71,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem 
> *rom, size_t size)
>  {
>   void __iomem *image;
>   int last_image;
> + unsigned length;
>  
>   image = rom;
>   do {
> @@ -93,9 +94,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem 
> *rom, size_t size)
>   if (readb(pds + 3) != 'R')
>   break;
>   last_image = readb(pds + 21) & 0x80;
> - /* this length is reliable */
> - image += readw(pds + 16) * 512;
> - } while (!last_image);
> + length = readw(pds + 16);
> + image += length * 512;
> + } while (length && !last_image);
>  
>   /* never return a size larger than the PCI resource window */
>   /* there are known ROMs that get the size wrong */
> -- 
> 2.1.4
> 


[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Philipp Zabel
Am Freitag, den 23.01.2015, 14:27 -0200 schrieb Fabio Estevam:
> Hi Philipp,
> 
> On Fri, Jan 23, 2015 at 2:18 PM, Philipp Zabel  
> wrote:
> > @@ -281,6 +267,9 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
> > *encoder,
> > struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
> > struct imx_ldb *ldb = imx_ldb_ch->ldb;
> > int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
> > +   unsigned long serial_clk;
> > +   unsigned long di_clk = mode->clock * 1000;
> > +   int mux = imx_ldb_get_mux_id(imx_ldb_ch);
> 
> I can't find imx_ldb_get_mux_id() on linux-next.

Sorry, that should be

int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);

regards
Philipp



[Bug 88758] Low FPS in settings on Dota2

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88758

--- Comment #1 from Lorenzo Bona  ---
Created attachment 112735
  --> https://bugs.freedesktop.org/attachment.cgi?id=112735=edit
mesa-build script

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


[Bug 88758] Low FPS in settings on Dota2

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88758

Bug ID: 88758
   Summary: Low FPS in settings on Dota2
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: minor
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: lorenz.bona at gmail.com
QA Contact: dri-devel at lists.freedesktop.org

Created attachment 112734
  --> https://bugs.freedesktop.org/attachment.cgi?id=112734=edit
LIBGL_DEBUG=verbose steam

It's more then a week that I've faced a new issue with steam. 
I haven't played since November so I don't know if it's a known bug or a dumb
configuration.

In Dota2 settings I get only 10 (or less) FPS but as soon as I start a game I
have almost 30 FPS. The GPU is an R7-265 with an FX-8320 at 4.4GHz.
I'm sure that back in November I can run Dota settings at about 50+ FPS. What's
going on? I can't see any warning in dmesg.

Is this a common behaviour or it's a configuration problem?
I'm running kernel from agd5f git repo, drm-fixes-3.19 branch.
I've tried also with mesa in Debian Sid branch or with llvm3.6. No changes at
all.

I've run:
$ LIBGL_DEBUG=verbose steam > dota2.txt

I hope this can help.

PS: I build mesa on a separate 32bit chroot.

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


videos of X, DRM, & Mesa talks from LCA2015

2015-01-23 Thread Alan Coopersmith
The amazing 2015 linux.conf.au video team has already posted all the videos
from the talks at this years conference - you can find them on their YouTube
channel at https://www.youtube.com/user/linuxconfau2015 or via the links on
http://lca2015.linux.org.au/

Talks of particular relevance to Xorg, DRI, and Mesa developers include:

Botching up IOCTLs
Daniel Vetter (Intel)
https://www.youtube.com/watch?v=WnqXHs_tGR4
http://lca2015.linux.org.au/schedule/30266/view_talk
Slides: http://people.freedesktop.org/~danvet/presentations/lca-2015.pdf

Displayport MST: why do my laptop dockoutputs not work?
David Airlie (Red Hat)
https://www.youtube.com/watch?v=6301tGNs9Dc
http://lca2015.linux.org.au/schedule/30303/view_talk
Slides: http://lca2015.linux.org.au/slides/93/lca2015mst.odp

Open-source OpenGL on the Raspberry Pi
Eric Anholt (Broadcom)
https://www.youtube.com/watch?v=EXDeketJNdk
http://lca2015.linux.org.au/schedule/30256/view_talk
Slides: http://lca2015.linux.org.au/slides/125/lca2015-rpi.pdf

Putting the Polish on Glamor
Keith Packard (HP)
https://www.youtube.com/watch?v=dXR-MVQvQZw
http://lca2015.linux.org.au/schedule/30108/view_talk
Slides: http://lca2015.linux.org.au/slides/64/glamor.odp

Reducing GLSL Compiler Memory Usage (or Fitting 5kg of Potatoes in a 2kg Bag)
Ian Romanick (Intel)
https://www.youtube.com/watch?v=K-5DTAD2Isk
http://lca2015.linux.org.au/schedule/30149/view_talk
Slides: http://people.freedesktop.org/~idr/LCA2015/

And semi-related is a talk from former-SFLC-lawyer Karen Sandler on the
troubles open source groups have had with non-profit status that have been
pushing the X.Org Foundation to join a larger group to leverage their
lawyers and accountants in meeting all the needed requirements, resulting
in our current moves to become part of SPI:
https://www.youtube.com/watch?v=Z5uY01QlyK0
http://lca2015.linux.org.au/schedule/30178/view_talk

-- 
-Alan Coopersmith-  alan.coopersmith at oracle.com
 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Philipp Zabel
Am Freitag, den 23.01.2015, 13:06 -0200 schrieb Fabio Estevam:
> On Fri, Jan 23, 2015 at 12:56 AM, Liu Ying  wrote:
> > Hi,
> >
> > It looks that the below commit makes my Hannstar XGA LVDS panel stop working
> > on the i.MX6DL SabreSD board.  Any idea?
> 
> Yes, with eb10d6355532def3a ("mx-drm: encoder prepare/mode_set must
> use adjusted mode") applied
> the DI clock is 0:

My bad, the problem is we are misusing encoder_prepare to enable the
display interface clock needed for the following crtc mode set.

What we really want is to use is adjusted_mode given to
encoder_funcs->mode_set, before the clock is enabled by
crtc_funcs->commit.

How about this patch:

-8<-
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index abceb3d..99fe4bb 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -193,22 +193,8 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
 {
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
struct imx_ldb *ldb = imx_ldb_ch->ldb;
-   struct drm_display_mode *mode = >crtc->hwmode;
u32 pixel_fmt;
-   unsigned long serial_clk;
-   unsigned long di_clk = mode->clock * 1000;
-   int mux = imx_ldb_get_mux_id(imx_ldb_ch);

-   if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) {
-   /* dual channel LVDS mode */
-   serial_clk = 3500UL * mode->clock;
-   imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk);
-   imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk);
-   } else {
-   serial_clk = 7000UL * mode->clock;
-   imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk,
-   di_clk);
-   }

switch (imx_ldb_ch->chno) {
case 0:
@@ -281,6 +267,9 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
*encoder,
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
struct imx_ldb *ldb = imx_ldb_ch->ldb;
int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
+   unsigned long serial_clk;
+   unsigned long di_clk = mode->clock * 1000;
+   int mux = imx_ldb_get_mux_id(imx_ldb_ch);

if (mode->clock > 17) {
dev_warn(ldb->dev,
@@ -291,6 +280,16 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
*encoder,
 "%s: mode exceeds 85 MHz pixel clock\n", __func__);
}

+   if (dual) {
+   serial_clk = 3500UL * mode->clock;
+   imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk);
+   imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk);
+   } else {
+   serial_clk = 7000UL * mode->clock;
+   imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk,
+ di_clk);
+   }
+
/* FIXME - assumes straight connections DI0 --> CH0, DI1 --> CH1 */
if (imx_ldb_ch == >channel[0]) {
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
-- 
2.1.4
->8-

regards
Philipp



[PATCH libdrm 11/11] tests: kms: Implement universal planes test

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

This small program allows universal planes to be tested. Currently this
isn't very flexible because it allows only the first plane of a given
type to be tested on the first CRTC. However it should be simple to
extend this with some additional command-line arguments.

Signed-off-by: Thierry Reding 
---
 tests/kms/Makefile.am|   9 +-
 tests/kms/kms-universal-planes.c | 358 +++
 2 files changed, 365 insertions(+), 2 deletions(-)
 create mode 100644 tests/kms/kms-universal-planes.c

diff --git a/tests/kms/Makefile.am b/tests/kms/Makefile.am
index 10584c8930a4..e9589221e489 100644
--- a/tests/kms/Makefile.am
+++ b/tests/kms/Makefile.am
@@ -20,11 +20,16 @@ libkms_test_la_LIBADD = \

 if HAVE_INSTALL_TESTS
 bin_PROGRAMS = \
-   kms-steal-crtc
+   kms-steal-crtc \
+   kms-universal-planes
 else
 noinst_PROGRAMS = \
-   kms-steal-crtc
+   kms-steal-crtc \
+   kms-universal-planes
 endif

 kms_steal_crtc_SOURCES = kms-steal-crtc.c
 kms_steal_crtc_LDADD = libkms-test.la ../util/libutil.la
+
+kms_universal_planes_SOURCES = kms-universal-planes.c
+kms_universal_planes_LDADD = libkms-test.la
diff --git a/tests/kms/kms-universal-planes.c b/tests/kms/kms-universal-planes.c
new file mode 100644
index ..9151231ff860
--- /dev/null
+++ b/tests/kms/kms-universal-planes.c
@@ -0,0 +1,358 @@
+/*
+ * Copyright © 2014 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "xf86drm.h"
+
+#include "util/common.h"
+#include "libkms-test.h"
+
+static const uint32_t formats[] = {
+   DRM_FORMAT_XRGB,
+   DRM_FORMAT_XBGR,
+   DRM_FORMAT_RGBA,
+};
+
+static uint32_t choose_format(struct kms_plane *plane)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(formats); i++)
+   if (kms_plane_supports_format(plane, formats[i]))
+   return formats[i];
+
+   return 0;
+}
+
+static void prepare_framebuffer(struct kms_framebuffer *fb, bool invert)
+{
+   const unsigned int block_size = 16;
+   uint32_t colors[2];
+   unsigned int i, j;
+   uint32_t *buf;
+   void *ptr;
+   int err;
+
+   switch (fb->format) {
+   case DRM_FORMAT_XRGB:
+   printf("using XRGB format\n");
+  /* XXRRGGBB */
+   colors[0] = 0x;
+   colors[1] = 0xffff;
+   break;
+
+   case DRM_FORMAT_XBGR:
+   printf("using XBGR format\n");
+  /* XXBBGGRR */
+   colors[0] = 0xffff;
+   colors[1] = 0x;
+   break;
+
+   case DRM_FORMAT_RGBA:
+   printf("using RGBA format\n");
+  /* RRGGBBAA */
+   colors[0] = 0xffff;
+   colors[1] = 0x;
+   break;
+
+   default:
+   colors[0] = 0x;
+   colors[1] = 0x;
+   break;
+   }
+
+   err = kms_framebuffer_map(fb, );
+   if (err < 0) {
+   fprintf(stderr, "kms_framebuffer_map() failed: %s\n",
+   strerror(-err));
+   return;
+   }
+
+   buf = ptr;
+
+   for (j = 0; j < fb->height; j++) {
+   for (i = 0; i < fb->width; i++) {
+   unsigned int color = (j / block_size) ^
+(i / block_size);
+
+   if (invert)
+   color ^= color;
+
+   *buf++ = colors[color & 1];
+   }
+   }
+
+   kms_framebuffer_unmap(fb);
+}
+
+int main(int argc, char 

[PATCH libdrm 10/11] tests: kms: Implement CRTC stealing test

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

This test program sets a mode and framebuffer on a connector and cycles
through all CRTCs, moving the connector to each of them in turn. This is
useful to verify that CRTC stealing is properly handled in the DRM core
and drivers.

Signed-off-by: Thierry Reding 
---
 tests/kms/Makefile.am  |  11 
 tests/kms/kms-steal-crtc.c | 161 +
 2 files changed, 172 insertions(+)
 create mode 100644 tests/kms/kms-steal-crtc.c

diff --git a/tests/kms/Makefile.am b/tests/kms/Makefile.am
index c84bae05d869..10584c8930a4 100644
--- a/tests/kms/Makefile.am
+++ b/tests/kms/Makefile.am
@@ -17,3 +17,14 @@ libkms_test_la_SOURCES = \

 libkms_test_la_LIBADD = \
$(top_builddir)/libdrm.la
+
+if HAVE_INSTALL_TESTS
+bin_PROGRAMS = \
+   kms-steal-crtc
+else
+noinst_PROGRAMS = \
+   kms-steal-crtc
+endif
+
+kms_steal_crtc_SOURCES = kms-steal-crtc.c
+kms_steal_crtc_LDADD = libkms-test.la ../util/libutil.la
diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c
new file mode 100644
index ..2f7f327edc16
--- /dev/null
+++ b/tests/kms/kms-steal-crtc.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright © 2014 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "util/pattern.h"
+#include "libkms-test.h"
+
+static void signal_handler(int signum)
+{
+}
+
+int main(int argc, char *argv[])
+{
+   struct kms_framebuffer *fb;
+   struct kms_screen *screen;
+   struct kms_device *device;
+   unsigned int index = 0;
+   struct sigaction sa;
+   int fd, err;
+   void *ptr;
+
+   if (argc < 2) {
+   fprintf(stderr, "usage: %s DEVICE\n", argv[0]);
+   return 1;
+   }
+
+   memset(, 0, sizeof(sa));
+   sa.sa_handler = signal_handler;
+
+   err = sigaction(SIGINT, , NULL);
+   if (err < 0) {
+   fprintf(stderr, "sigaction() failed: %m\n");
+   return 1;
+   }
+
+   fd = open(argv[1], O_RDWR);
+   if (fd < 0) {
+   fprintf(stderr, "open() failed: %m\n");
+   return 1;
+   }
+
+   device = kms_device_open(fd);
+   if (!device) {
+   fprintf(stderr, "kms_device_open() failed: %m\n");
+   return 1;
+   }
+
+   if (device->num_screens < 1) {
+   fprintf(stderr, "no screens found\n");
+   kms_device_close(device);
+   close(fd);
+   return 1;
+   }
+
+   /* TODO: allow command-line to override */
+   screen = device->screens[0];
+
+   printf("Using screen %s, resolution %ux%u\n", screen->name,
+  screen->width, screen->height);
+
+   fb = kms_framebuffer_create(device, screen->width, screen->height,
+   DRM_FORMAT_XRGB);
+   if (!fb) {
+   fprintf(stderr, "kms_framebuffer_create() failed\n");
+   return 1;
+   }
+
+   err = kms_framebuffer_map(fb, );
+   if (err < 0) {
+   fprintf(stderr, "kms_framebuffer_map() failed: %d\n", err);
+   return 1;
+   }
+
+   util_fill_pattern(fb->format, UTIL_PATTERN_SMPTE, , fb->width,
+ fb->height, fb->pitch);
+
+   kms_framebuffer_unmap(fb);
+
+   err = kms_screen_set(screen, device->crtcs[index++], fb);
+   if (err < 0) {
+   fprintf(stderr, "kms_screen_set() failed: %d\n", err);
+   return 1;
+   }
+
+   while (true) {
+   int nfds = STDIN_FILENO + 1;
+   struct timeval timeout;
+   fd_set fds;
+
+   memset(, 0, sizeof(timeout));
+   timeout.tv_sec = 5;
+   timeout.tv_usec = 0;
+

[PATCH libdrm 09/11] tests: Add libkms-test library

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

This library contains abstractions for KMS that help remove the need for
a lot of boilerplate in KMS test programs.

Signed-off-by: Thierry Reding 
---
 configure.ac|   1 +
 tests/Makefile.am   |   2 +-
 tests/kms/Makefile.am   |  19 
 tests/kms/libkms-test-crtc.c|  47 
 tests/kms/libkms-test-device.c  | 218 
 tests/kms/libkms-test-framebuffer.c | 157 ++
 tests/kms/libkms-test-plane.c   | 139 +++
 tests/kms/libkms-test-screen.c  |  92 +++
 tests/kms/libkms-test.h | 120 
 9 files changed, 794 insertions(+), 1 deletion(-)
 create mode 100644 tests/kms/Makefile.am
 create mode 100644 tests/kms/libkms-test-crtc.c
 create mode 100644 tests/kms/libkms-test-device.c
 create mode 100644 tests/kms/libkms-test-framebuffer.c
 create mode 100644 tests/kms/libkms-test-plane.c
 create mode 100644 tests/kms/libkms-test-screen.c
 create mode 100644 tests/kms/libkms-test.h

diff --git a/configure.ac b/configure.ac
index 58411b79b682..0a6c414bf9eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -435,6 +435,7 @@ AC_CONFIG_FILES([
tests/Makefile
tests/modeprint/Makefile
tests/modetest/Makefile
+   tests/kms/Makefile
tests/kmstest/Makefile
tests/proptest/Makefile
tests/radeon/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 310032732f6e..e14cc3d24a22 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,7 +10,7 @@ check_PROGRAMS = \
dristat \
drmstat

-SUBDIRS = util modeprint proptest
+SUBDIRS = util kms modeprint proptest

 if HAVE_LIBKMS
 SUBDIRS += kmstest modetest
diff --git a/tests/kms/Makefile.am b/tests/kms/Makefile.am
new file mode 100644
index ..c84bae05d869
--- /dev/null
+++ b/tests/kms/Makefile.am
@@ -0,0 +1,19 @@
+AM_CPPFLAGS = \
+   -I$(top_srcdir)/include/drm \
+   -I$(top_srcdir)/tests \
+   -I$(top_srcdir)
+
+AM_CFLAGS = \
+   $(WARN_CFLAGS)
+
+noinst_LTLIBRARIES = libkms-test.la
+
+libkms_test_la_SOURCES = \
+   libkms-test-crtc.c \
+   libkms-test-device.c \
+   libkms-test-framebuffer.c \
+   libkms-test-plane.c \
+   libkms-test-screen.c
+
+libkms_test_la_LIBADD = \
+   $(top_builddir)/libdrm.la
diff --git a/tests/kms/libkms-test-crtc.c b/tests/kms/libkms-test-crtc.c
new file mode 100644
index ..3adb4903919f
--- /dev/null
+++ b/tests/kms/libkms-test-crtc.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2014 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "libkms-test.h"
+
+struct kms_crtc *kms_crtc_create(struct kms_device *device, uint32_t id)
+{
+   struct kms_crtc *crtc;
+
+   crtc = calloc(1, sizeof(*crtc));
+   if (!crtc)
+   return NULL;
+
+   crtc->device = device;
+   crtc->id = id;
+
+   return crtc;
+}
+
+void kms_crtc_free(struct kms_crtc *crtc)
+{
+   free(crtc);
+}
diff --git a/tests/kms/libkms-test-device.c b/tests/kms/libkms-test-device.c
new file mode 100644
index ..53c7349b89ab
--- /dev/null
+++ b/tests/kms/libkms-test-device.c
@@ -0,0 +1,218 @@
+/*
+ * Copyright © 2014 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission 

[PATCH libdrm 08/11] tests: modetest: Accept connector names

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Allow connector names to be used in the specification of the -s option.
This requires storing the string passed on the command-line so that it
can later be resolved to a connector ID (after the DRM device has been
opened).

Signed-off-by: Thierry Reding 
---
 tests/modetest/modetest.c | 134 ++
 1 file changed, 123 insertions(+), 11 deletions(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index d5fd99ebe1fd..a7cc94f8938c 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -82,6 +82,7 @@ struct connector {
drmModeConnector *connector;
drmModeObjectProperties *props;
drmModePropertyRes **props_info;
+   char *name;
 };

 struct fb {
@@ -327,7 +328,7 @@ static void dump_connectors(struct device *dev)
int i, j;

printf("Connectors:\n");
-   printf("id\tencoder\tstatus\t\ttype\tsize (mm)\tmodes\tencoders\n");
+   printf("id\tencoder\tstatus\t\tname\t\tsize (mm)\tmodes\tencoders\n");
for (i = 0; i < dev->resources->res->count_connectors; i++) {
struct connector *_connector = >resources->connectors[i];
drmModeConnector *connector = _connector->connector;
@@ -338,7 +339,7 @@ static void dump_connectors(struct device *dev)
   connector->connector_id,
   connector->encoder_id,
   util_lookup_connector_status_name(connector->connection),
-  
util_lookup_connector_type_name(connector->connector_type),
+  _connector->name,
   connector->mmWidth, connector->mmHeight,
   connector->count_modes);

@@ -464,12 +465,13 @@ static void dump_planes(struct device *dev)

 static void free_resources(struct resources *res)
 {
+   int i;
+
if (!res)
return;

 #define free_resource(_res, __res, type, Type) 
\
do {
\
-   int i;  
\
if (!(_res)->type##s)   
\
break;  
\
for (i = 0; i < (int)(_res)->__res->count_##type##s; ++i) { 
\
@@ -482,7 +484,6 @@ static void free_resources(struct resources *res)

 #define free_properties(_res, __res, type) 
\
do {
\
-   int i;  
\
for (i = 0; i < (int)(_res)->__res->count_##type##s; ++i) { 
\
drmModeFreeObjectProperties(res->type##s[i].props); 
\
free(res->type##s[i].props_info);   
\
@@ -494,6 +495,10 @@ static void free_resources(struct resources *res)

free_resource(res, res, crtc, Crtc);
free_resource(res, res, encoder, Encoder);
+
+   for (i = 0; i < res->res->count_connectors; i++)
+   free(res->connectors[i].name);
+
free_resource(res, res, connector, Connector);
free_resource(res, res, fb, FB);

@@ -511,6 +516,47 @@ static void free_resources(struct resources *res)
free(res);
 }

+static unsigned int get_connector_index(struct resources *res, uint32_t type)
+{
+   unsigned int index = 0;
+   int i;
+
+   for (i = 0; i < res->res->count_connectors; i++)
+   if (res->connectors[i].connector->connector_type == type)
+   index++;
+
+   return index - 1;
+}
+
+static unsigned int get_order(unsigned int value)
+{
+   unsigned int order = 0;
+
+   do {
+   value /= 10;
+   order++;
+   } while (value > 0);
+
+   return order - 1;
+}
+
+static void connector_set_name(struct connector *connector,
+  struct resources *res)
+{
+   uint32_t type = connector->connector->connector_type;
+   const char *type_name;
+   unsigned int index;
+   int len;
+
+   type_name = util_lookup_connector_type_name(type);
+   index = get_connector_index(res, type);
+   len = strlen(type_name) + get_order(index) + 2;
+
+   connector->name = malloc(len + 1);
+   if (connector->name)
+   snprintf(connector->name, len + 1, "%s-%u", type_name,  index);
+}
+
 static struct resources *get_resources(struct device *dev)
 {
struct resources *res;
@@ -562,6 +608,12 @@ static struct resources *get_resources(struct device *dev)
get_resource(res, res, connector, Connector);
get_resource(res, res, fb, FB);

+   for (i = 0; i < res->res->count_connectors; i++) {
+ 

[PATCH libdrm 07/11] xf86drmMode.h: Add DisplayPort MST encoder type

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

This brings xf86drmMode.h in sync with include/drm/drm_mode.h.
Eventually we really should only have a single set of definitions rather
than duplicating this in two files.

Signed-off-by: Thierry Reding 
---
 xf86drmMode.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xf86drmMode.h b/xf86drmMode.h
index e70c16d437f4..70f14a1ae506 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -130,6 +130,7 @@ extern "C" {
 #define DRM_MODE_ENCODER_TVDAC   4
 #define DRM_MODE_ENCODER_VIRTUAL 5
 #define DRM_MODE_ENCODER_DSI 6
+#define DRM_MODE_ENCODER_DPMST   7

 #define DRM_MODE_SUBCONNECTOR_Automatic 0
 #define DRM_MODE_SUBCONNECTOR_Unknown   0
-- 
2.1.3



[PATCH libdrm 06/11] xf86drmMode.h: Use consistent padding

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Signed-off-by: Thierry Reding 
---
 xf86drmMode.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xf86drmMode.h b/xf86drmMode.h
index 856a6bb0f569..e70c16d437f4 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -123,13 +123,13 @@ extern "C" {
 #define DRM_MODE_DITHERING_OFF  0
 #define DRM_MODE_DITHERING_ON   1

-#define DRM_MODE_ENCODER_NONE   0
-#define DRM_MODE_ENCODER_DAC1
-#define DRM_MODE_ENCODER_TMDS   2
-#define DRM_MODE_ENCODER_LVDS   3
-#define DRM_MODE_ENCODER_TVDAC  4
+#define DRM_MODE_ENCODER_NONE0
+#define DRM_MODE_ENCODER_DAC 1
+#define DRM_MODE_ENCODER_TMDS2
+#define DRM_MODE_ENCODER_LVDS3
+#define DRM_MODE_ENCODER_TVDAC   4
 #define DRM_MODE_ENCODER_VIRTUAL 5
-#define DRM_MODE_ENCODER_DSI   6
+#define DRM_MODE_ENCODER_DSI 6

 #define DRM_MODE_SUBCONNECTOR_Automatic 0
 #define DRM_MODE_SUBCONNECTOR_Unknown   0
@@ -153,8 +153,8 @@ extern "C" {
 #define DRM_MODE_CONNECTOR_DisplayPort  10
 #define DRM_MODE_CONNECTOR_HDMIA11
 #define DRM_MODE_CONNECTOR_HDMIB12
-#define DRM_MODE_CONNECTOR_TV  13
-#define DRM_MODE_CONNECTOR_eDP 14
+#define DRM_MODE_CONNECTOR_TV   13
+#define DRM_MODE_CONNECTOR_eDP  14
 #define DRM_MODE_CONNECTOR_VIRTUAL  15
 #define DRM_MODE_CONNECTOR_DSI  16

-- 
2.1.3



[PATCH libdrm 05/11] tests: Move name tables to libutil

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

These tables are duplicated in several places, so move them into libutil
so that they can be shared.

Signed-off-by: Thierry Reding 
---
 tests/modetest/modetest.c  |  50 ++-
 tests/proptest/Makefile.am |   4 +-
 tests/proptest/proptest.c  |  40 +--
 tests/util/Makefile.am |   2 +
 tests/util/kms.c   | 122 +
 tests/util/kms.h   |  33 
 6 files changed, 165 insertions(+), 86 deletions(-)
 create mode 100644 tests/util/kms.c
 create mode 100644 tests/util/kms.h

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index b610956adfcb..d5fd99ebe1fd 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -61,6 +61,7 @@

 #include "util/common.h"
 #include "util/format.h"
+#include "util/kms.h"
 #include "util/pattern.h"

 #include "buffers.h"
@@ -123,11 +124,6 @@ static inline int64_t U642I64(uint64_t val)
return (int64_t)*((int64_t *));
 }

-struct type_name {
-   int type;
-   const char *name;
-};
-
 #define type_name_fn(res) \
 const char * res##_str(int type) { \
unsigned int i; \
@@ -138,44 +134,6 @@ const char * res##_str(int type) { \
return "(invalid)"; \
 }

-struct type_name encoder_type_names[] = {
-   { DRM_MODE_ENCODER_NONE, "none" },
-   { DRM_MODE_ENCODER_DAC, "DAC" },
-   { DRM_MODE_ENCODER_TMDS, "TMDS" },
-   { DRM_MODE_ENCODER_LVDS, "LVDS" },
-   { DRM_MODE_ENCODER_TVDAC, "TVDAC" },
-};
-
-static type_name_fn(encoder_type)
-
-struct type_name connector_status_names[] = {
-   { DRM_MODE_CONNECTED, "connected" },
-   { DRM_MODE_DISCONNECTED, "disconnected" },
-   { DRM_MODE_UNKNOWNCONNECTION, "unknown" },
-};
-
-static type_name_fn(connector_status)
-
-struct type_name connector_type_names[] = {
-   { DRM_MODE_CONNECTOR_Unknown, "unknown" },
-   { DRM_MODE_CONNECTOR_VGA, "VGA" },
-   { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
-   { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
-   { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
-   { DRM_MODE_CONNECTOR_Composite, "composite" },
-   { DRM_MODE_CONNECTOR_SVIDEO, "s-video" },
-   { DRM_MODE_CONNECTOR_LVDS, "LVDS" },
-   { DRM_MODE_CONNECTOR_Component, "component" },
-   { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
-   { DRM_MODE_CONNECTOR_DisplayPort, "DP" },
-   { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
-   { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
-   { DRM_MODE_CONNECTOR_TV, "TV" },
-   { DRM_MODE_CONNECTOR_eDP, "eDP" },
-};
-
-static type_name_fn(connector_type)
-
 #define bit_name_fn(res)   \
 const char * res##_str(int type) { \
unsigned int i; \
@@ -235,7 +193,7 @@ static void dump_encoders(struct device *dev)
printf("%d\t%d\t%s\t0x%08x\t0x%08x\n",
   encoder->encoder_id,
   encoder->crtc_id,
-  encoder_type_str(encoder->encoder_type),
+  util_lookup_encoder_type_name(encoder->encoder_type),
   encoder->possible_crtcs,
   encoder->possible_clones);
}
@@ -379,8 +337,8 @@ static void dump_connectors(struct device *dev)
printf("%d\t%d\t%s\t%s\t%dx%d\t\t%d\t",
   connector->connector_id,
   connector->encoder_id,
-  connector_status_str(connector->connection),
-  connector_type_str(connector->connector_type),
+  util_lookup_connector_status_name(connector->connection),
+  
util_lookup_connector_type_name(connector->connector_type),
   connector->mmWidth, connector->mmHeight,
   connector->count_modes);

diff --git a/tests/proptest/Makefile.am b/tests/proptest/Makefile.am
index f81a3c00846b..c615489b9a92 100644
--- a/tests/proptest/Makefile.am
+++ b/tests/proptest/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
-I$(top_srcdir)/include/drm \
+   -I$(top_srcdir)/tests \
-I$(top_srcdir)

 noinst_PROGRAMS = \
@@ -8,4 +9,5 @@ noinst_PROGRAMS = \
 proptest_SOURCES = \
proptest.c
 proptest_LDADD = \
-   $(top_builddir)/libdrm.la
+   $(top_builddir)/libdrm.la \
+   $(top_builddir)/tests/util/libutil.la
diff --git a/tests/proptest/proptest.c b/tests/proptest/proptest.c
index ee3fa408a310..b442d583d528 100644
--- a/tests/proptest/proptest.c
+++ b/tests/proptest/proptest.c
@@ -45,44 +45,6 @@ static inline int64_t U642I64(uint64_t val)
 int fd;
 drmModeResPtr res = NULL;

-const char *connector_type_str(uint32_t type)
-{
-   switch (type) {
-   case DRM_MODE_CONNECTOR_Unknown:
-   return "Unknown";
-   case 

[PATCH libdrm 04/11] tests: Split helpers into library

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Some of the helpers, such as the pattern drawing helpers or the format
lookup helpers, have potential to be reused. Move them into a separate
library to make it easier to share them.

Signed-off-by: Thierry Reding 
---
 configure.ac|   1 +
 tests/Makefile.am   |   2 +-
 tests/modeprint/Makefile.am |   1 +
 tests/modeprint/modeprint.c |   2 +-
 tests/modetest/Makefile.am  |   2 +
 tests/modetest/buffers.c| 956 +---
 tests/modetest/buffers.h|  12 +-
 tests/modetest/cursor.c |   4 +-
 tests/modetest/modetest.c   |  25 +-
 tests/proptest/proptest.c   |   3 +-
 tests/util/Makefile.am  |  19 +
 tests/util/common.h |  33 ++
 tests/util/format.c | 119 ++
 tests/util/format.h |  65 +++
 tests/util/pattern.c| 870 
 tests/util/pattern.h|  39 ++
 tests/vbltest/Makefile.am   |   1 +
 tests/vbltest/vbltest.c |   2 +-
 18 files changed, 1177 insertions(+), 979 deletions(-)
 create mode 100644 tests/util/Makefile.am
 create mode 100644 tests/util/common.h
 create mode 100644 tests/util/format.c
 create mode 100644 tests/util/format.h
 create mode 100644 tests/util/pattern.c
 create mode 100644 tests/util/pattern.h

diff --git a/configure.ac b/configure.ac
index 8afee834508d..58411b79b682 100644
--- a/configure.ac
+++ b/configure.ac
@@ -441,6 +441,7 @@ AC_CONFIG_FILES([
tests/vbltest/Makefile
tests/exynos/Makefile
tests/tegra/Makefile
+   tests/util/Makefile
man/Makefile
libdrm.pc])
 AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e7ec4fa5ecff..310032732f6e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,7 +10,7 @@ check_PROGRAMS = \
dristat \
drmstat

-SUBDIRS = modeprint proptest
+SUBDIRS = util modeprint proptest

 if HAVE_LIBKMS
 SUBDIRS += kmstest modetest
diff --git a/tests/modeprint/Makefile.am b/tests/modeprint/Makefile.am
index 6420ef336705..32a702ab0bdc 100644
--- a/tests/modeprint/Makefile.am
+++ b/tests/modeprint/Makefile.am
@@ -1,5 +1,6 @@
 AM_CFLAGS = \
-I$(top_srcdir)/include/drm \
+   -I$(top_srcdir)/tests \
-I$(top_srcdir)

 if HAVE_INSTALL_TESTS
diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c
index 6f0d03905a46..8f9471023b52 100644
--- a/tests/modeprint/modeprint.c
+++ b/tests/modeprint/modeprint.c
@@ -41,7 +41,7 @@
 #include "xf86drm.h"
 #include "xf86drmMode.h"

-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#include "util/common.h"

 int connectors;
 int full_props;
diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am
index 93820fac7395..88fde2eb8345 100644
--- a/tests/modetest/Makefile.am
+++ b/tests/modetest/Makefile.am
@@ -4,6 +4,7 @@ AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))

 AM_CFLAGS += \
-I$(top_srcdir)/include/drm \
+   -I$(top_srcdir)/tests \
-I$(top_srcdir)

 if HAVE_INSTALL_TESTS
@@ -18,6 +19,7 @@ modetest_SOURCES = $(MODETEST_FILES)

 modetest_LDADD = \
$(top_builddir)/libdrm.la \
+   $(top_builddir)/tests/util/libutil.la \
-lpthread

 if HAVE_CAIRO
diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c
index e4e8149591ef..4db4e9a72124 100644
--- a/tests/modetest/buffers.c
+++ b/tests/modetest/buffers.c
@@ -49,8 +49,6 @@
 #include 
 #endif

-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-
 struct bo
 {
int fd;
@@ -62,956 +60,6 @@ struct bo
 };

 /* 
-
- * Formats
- */
-
-struct color_component {
-   unsigned int length;
-   unsigned int offset;
-};
-
-struct rgb_info {
-   struct color_component red;
-   struct color_component green;
-   struct color_component blue;
-   struct color_component alpha;
-};
-
-enum yuv_order {
-   YUV_YCbCr = 1,
-   YUV_YCrCb = 2,
-   YUV_YC = 4,
-   YUV_CY = 8,
-};
-
-struct yuv_info {
-   enum yuv_order order;
-   unsigned int xsub;
-   unsigned int ysub;
-   unsigned int chroma_stride;
-};
-
-struct format_info {
-   unsigned int format;
-   const char *name;
-   const struct rgb_info rgb;
-   const struct yuv_info yuv;
-};
-
-#define MAKE_RGB_INFO(rl, ro, bl, bo, gl, go, al, ao) \
-   .rgb = { { (rl), (ro) }, { (bl), (bo) }, { (gl), (go) }, { (al), (ao) } 
}
-
-#define MAKE_YUV_INFO(order, xsub, ysub, chroma_stride) \
-   .yuv = { (order), (xsub), (ysub), (chroma_stride) }
-
-static const struct format_info format_info[] = {
-   /* YUV packed */
-   { DRM_FORMAT_UYVY, "UYVY", MAKE_YUV_INFO(YUV_YCbCr | YUV_CY, 2, 2, 2) },
-   { DRM_FORMAT_VYUY, "VYUY", MAKE_YUV_INFO(YUV_YCrCb | YUV_CY, 2, 2, 2) },
-   { DRM_FORMAT_YUYV, "YUYV", MAKE_YUV_INFO(YUV_YCbCr | YUV_YC, 2, 2, 2) },
-   { DRM_FORMAT_YVYU, "YVYU", MAKE_YUV_INFO(YUV_YCrCb | YUV_YC, 2, 

[PATCH libdrm 03/11] libdrm: Make indentation consistent

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Signed-off-by: Thierry Reding 
---
 xf86drmMode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index 7e228b3e7aa3..3d6b9cc307d1 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -250,7 +250,7 @@ err_allocs:
 }

 int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
- uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
+uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
 uint32_t *buf_id)
 {
struct drm_mode_fb_cmd f;
@@ -374,7 +374,7 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
 }

 int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
-   uint32_t x, uint32_t y, uint32_t *connectors, int count,
+  uint32_t x, uint32_t y, uint32_t *connectors, int count,
   drmModeModeInfoPtr mode)
 {
struct drm_mode_crtc crtc;
-- 
2.1.3



[PATCH libdrm 02/11] libdrm: Remove gratuitous blank lines

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Usage of blank lines can be a matter of taste, of course, but for these
we can surely all agree that they're not needed and inconsistent.

Signed-off-by: Thierry Reding 
---
 xf86drmMode.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index f6e4416b88b5..7e228b3e7aa3 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -115,7 +115,6 @@ void drmModeFreeResources(drmModeResPtr ptr)
drmFree(ptr->connectors);
drmFree(ptr->encoders);
drmFree(ptr);
-
 }

 void drmModeFreeFB(drmModeFBPtr ptr)
@@ -133,7 +132,6 @@ void drmModeFreeCrtc(drmModeCrtcPtr ptr)
return;

drmFree(ptr);
-
 }

 void drmModeFreeConnector(drmModeConnectorPtr ptr)
@@ -146,7 +144,6 @@ void drmModeFreeConnector(drmModeConnectorPtr ptr)
drmFree(ptr->props);
drmFree(ptr->modes);
drmFree(ptr);
-
 }

 void drmModeFreeEncoder(drmModeEncoderPtr ptr)
@@ -301,8 +298,6 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
 int drmModeRmFB(int fd, uint32_t bufferId)
 {
return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, );
-
-
 }

 drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
@@ -342,7 +337,6 @@ int drmModeDirtyFB(int fd, uint32_t bufferId,
return DRM_IOCTL(fd, DRM_IOCTL_MODE_DIRTYFB, );
 }

-
 /*
  * Crtc functions
  */
@@ -379,7 +373,6 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
return r;
 }

-
 int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
uint32_t x, uint32_t y, uint32_t *connectors, int count,
   drmModeModeInfoPtr mode)
@@ -594,7 +587,6 @@ int drmModeDetachMode(int fd, uint32_t connector_id, 
drmModeModeInfoPtr mode_inf
return DRM_IOCTL(fd, DRM_IOCTL_MODE_DETACHMODE, );
 }

-
 drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
 {
struct drm_mode_get_property prop;
@@ -812,7 +804,6 @@ int drmCheckModesettingSupported(const char *busid)
return 0;
 #endif
return -ENOSYS;
-
 }

 int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
@@ -914,7 +905,6 @@ int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t 
crtc_id,
uint32_t crtc_w, uint32_t crtc_h,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
-
 {
struct drm_mode_set_plane s;

@@ -934,7 +924,6 @@ int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t 
crtc_id,
return DRM_IOCTL(fd, DRM_IOCTL_MODE_SETPLANE, );
 }

-
 drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
 {
struct drm_mode_get_plane ovr, counts;
-- 
2.1.3



[PATCH libdrm 01/11] libdrm: valgrind-clear a few more IOCTL arguments

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Fixes a few complaints raised by valgrind when running the Tegra tests.

Signed-off-by: Thierry Reding 
---
 xf86drmMode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index 60ce3699f3e3..f6e4416b88b5 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -282,6 +282,7 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
struct drm_mode_fb_cmd2 f;
int ret;

+   VG_CLEAR(f);
f.width  = width;
f.height = height;
f.pixel_format = pixel_format;
@@ -309,6 +310,7 @@ drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
struct drm_mode_fb_cmd info;
drmModeFBPtr r;

+   VG_CLEAR(info);
info.fb_id = buf;

if (drmIoctl(fd, DRM_IOCTL_MODE_GETFB, ))
-- 
2.1.3



[PATCH libdrm 00/11] Random assortment of fixes and enhancements

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

This is a stash of commits that I've been carrying for a couple months.
Laurent really wanted to have the connector name patch for modetest so
I thought I'd send them all out for review.

Thierry

Thierry Reding (11):
  libdrm: valgrind-clear a few more IOCTL arguments
  libdrm: Remove gratuitous blank lines
  libdrm: Make indentation consistent
  tests: Split helpers into library
  tests: Move name tables to libutil
  xf86drmMode.h: Use consistent padding
  xf86drmMode.h: Add DisplayPort MST encoder type
  tests: modetest: Accept connector names
  tests: Add libkms-test library
  tests: kms: Implement CRTC stealing test
  tests: kms: Implement universal planes test

 configure.ac|   2 +
 tests/Makefile.am   |   2 +-
 tests/kms/Makefile.am   |  35 ++
 tests/kms/kms-steal-crtc.c  | 161 ++
 tests/kms/kms-universal-planes.c| 358 ++
 tests/kms/libkms-test-crtc.c|  47 ++
 tests/kms/libkms-test-device.c  | 218 
 tests/kms/libkms-test-framebuffer.c | 157 ++
 tests/kms/libkms-test-plane.c   | 139 ++
 tests/kms/libkms-test-screen.c  |  92 
 tests/kms/libkms-test.h | 120 +
 tests/modeprint/Makefile.am |   1 +
 tests/modeprint/modeprint.c |   2 +-
 tests/modetest/Makefile.am  |   2 +
 tests/modetest/buffers.c| 956 +---
 tests/modetest/buffers.h|  12 +-
 tests/modetest/cursor.c |   4 +-
 tests/modetest/modetest.c   | 207 +---
 tests/proptest/Makefile.am  |   4 +-
 tests/proptest/proptest.c   |  43 +-
 tests/util/Makefile.am  |  21 +
 tests/util/common.h |  33 ++
 tests/util/format.c | 119 +
 tests/util/format.h |  65 +++
 tests/util/kms.c| 122 +
 tests/util/kms.h|  33 ++
 tests/util/pattern.c| 870 
 tests/util/pattern.h|  39 ++
 tests/vbltest/Makefile.am   |   1 +
 tests/vbltest/vbltest.c |   2 +-
 xf86drmMode.c   |  17 +-
 xf86drmMode.h   |  17 +-
 32 files changed, 2805 insertions(+), 1096 deletions(-)
 create mode 100644 tests/kms/Makefile.am
 create mode 100644 tests/kms/kms-steal-crtc.c
 create mode 100644 tests/kms/kms-universal-planes.c
 create mode 100644 tests/kms/libkms-test-crtc.c
 create mode 100644 tests/kms/libkms-test-device.c
 create mode 100644 tests/kms/libkms-test-framebuffer.c
 create mode 100644 tests/kms/libkms-test-plane.c
 create mode 100644 tests/kms/libkms-test-screen.c
 create mode 100644 tests/kms/libkms-test.h
 create mode 100644 tests/util/Makefile.am
 create mode 100644 tests/util/common.h
 create mode 100644 tests/util/format.c
 create mode 100644 tests/util/format.h
 create mode 100644 tests/util/kms.c
 create mode 100644 tests/util/kms.h
 create mode 100644 tests/util/pattern.c
 create mode 100644 tests/util/pattern.h

-- 
2.1.3



[PATCH] drm/panel: add s6e3ha2 LCD panel driver

2015-01-23 Thread Hyungwon Hwang
From: Donghwa Lee 

This patch adds MIPI-DSI based S6E3HA2 panel driver. This panel has
1440x2560 resolution in 5.7-inch physical panel. This panel was
selected for Galaxy Note 4.

Signed-off-by: Donghwa Lee 
Signed-off-by: Hyungwon Hwang 
Cc: Inki Dae 
Cc: Sangbae Lee 
---
 .../devicetree/bindings/panel/samsung,s6e3ha2.txt  |  49 ++
 drivers/gpu/drm/panel/Kconfig  |   6 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-s6e3ha2.c  | 513 +
 4 files changed, 569 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt
 create mode 100644 drivers/gpu/drm/panel/panel-s6e3ha2.c

diff --git a/Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt 
b/Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt
new file mode 100644
index 000..098089b
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/samsung,s6e3ha2.txt
@@ -0,0 +1,49 @@
+Samsung S6E63J0X03 1.63" 320x320 TFT LCD panel
+
+Required properties:
+  - compatible: "samsung,s6e63j0x03"
+  - reg: the virtual channel number of a DSI peripheral
+  - vdd3-supply: core voltage supply
+  - vci-supply: voltage supply for analog circuits
+  - reset-gpios: a GPIO spec for the reset pin
+  - lcd-en-gpios: a GPIO spec for the LCD enable pin
+  - te-gpios: a GPIO spec for the tearing effect synchronization signal gpio 
pin
+
+Optional properties:
+  - display-timings: timings for the connected panel as described by [1]
+  - panel-width-mm: physical panel width [mm]
+  - panel-height-mm: physical panel height [mm]
+
+The device node can contain one 'port' child node with one child
+'endpoint' node, according to the bindings defined in [2]. This
+node should describe panel's video bus.
+
+[1]: Documentation/devicetree/bindings/video/display-timing.txt
+[2]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+
+panel at 0 {
+   compatible = "samsung,s6e3ha2";
+   reg = <0>;
+   vdd3-supply = <_reg>;
+   vci-supply = <_reg>;
+   reset-gpios = < 0 0>;
+   lcd-en-gpios = < 5 0>;
+   te-gpios = < 3 1>;
+   panel-width-mm = <71>;
+   panel-height-mm = <125>;
+
+   display-timings {
+   timing-0 {
+   clock-frequency = <0>;
+   hactive = <1440>;
+   vactive = <2560>;
+   hfront-porch = <1>;
+   hback-porch = <1>;
+   hsync-len = <1>;
+   vfront-porch = <1>;
+   vback-porch = <15>;
+   vsync-len = <1>;
+   };
+   };
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index dec60b2..451b5f3 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -46,4 +46,10 @@ config DRM_PANEL_S6E63J0X03
select DRM_MIPI_DSI
select VIDEOMODE_HELPERS

+config DRM_PANEL_S6E3HA2
+   tristate "S6E3HA2 DSI video mode panel"
+   depends on OF
+   select DRM_MIPI_DSI
+   select VIDEOMODE_HELPERS
+
 endmenu
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 6467be7..7bd7b84 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o
 obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o
 obj-$(CONFIG_DRM_PANEL_S6E63J0X03) += panel-s6e63j0x03.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
+obj-$(CONFIG_DRM_PANEL_S6E3HA2) += panel-s6e3ha2.o
diff --git a/drivers/gpu/drm/panel/panel-s6e3ha2.c 
b/drivers/gpu/drm/panel/panel-s6e3ha2.c
new file mode 100644
index 000..9664b72
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-s6e3ha2.c
@@ -0,0 +1,513 @@
+/*
+ * MIPI-DSI based s6e3ha2 AMOLED LCD 5.3 inch panel driver.
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd
+ *
+ * Donghwa Lee 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+struct s6e3ha2 {
+   struct device *dev;
+   struct drm_panel panel;
+
+   struct regulator_bulk_data supplies[2];
+   struct gpio_desc *reset_gpio;
+   struct gpio_desc *lcd_en_gpio;
+   struct videomode vm;
+   u32 width_mm;
+   u32 height_mm;
+
+   /* This field is tested by functions directly accessing DSI bus before
+* transfer, transfer is skipped if it is set. In case of transfer
+* failure or unexpected response the field is set to error value.
+* Such construct allows to eliminate many checks in higher level
+* functions.
+*/
+   int error;
+};
+
+static inline struct 

[PULL] topic/core-stuff

2015-01-23 Thread Daniel Vetter
Hi Dave,

Just flushing out my drm-misc branch, nothing major. Well too old patches
I've dug out from years since a patch from Rob look eerily familiar ;-)

I'm cooking some more atomic patches that I'd like to sneak into 3.20, but
still need a bit more testing. I'll send the pull for that next week,
impact should be really minimal (mostly new code to allow drivers to do
dpms on atomic and so get rid of the last legacy entry point).

Cheers, Daniel


The following changes since commit fc83975348ebce07793e6b9f780edc3cbcffa9fc:

  Merge tag 'imx-drm-next-2015-01-09' of git://git.pengutronix.de/git/pza/linux 
into drm-next (2015-01-21 10:17:16 +1000)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/topic/core-stuff-2015-01-23

for you to fetch changes up to b7703726251191cd9f3ef3a80b2d9667901eec95:

  drm/probe-helper: clamp unknown connector status in the poll work (2015-01-22 
06:11:39 +0100)


Chris Wilson (1):
  drm: Make drm_read() more robust against multithreaded races

Daniel Vetter (2):
  drm/probe-helper: don't lose hotplug event
  drm/probe-helper: clamp unknown connector status in the poll work

Geert Uytterhoeven (1):
  drm: Drop superfluous "select VT_HW_CONSOLE_BINDING"

Guenter Roeck (1):
  next: drm/atomic: Use copy_from_user to copy 64 bit data from user space

Thierry Reding (1):
  drm/fb-helper: Propagate errors from initial config failure

 drivers/gpu/drm/ast/ast_fb.c| 21 +---
 drivers/gpu/drm/bochs/bochs_fbdev.c | 14 +-
 drivers/gpu/drm/cirrus/cirrus_fbdev.c   | 12 ++---
 drivers/gpu/drm/drm_atomic.c|  4 +-
 drivers/gpu/drm/drm_fb_helper.c |  2 +-
 drivers/gpu/drm/drm_fops.c  | 89 -
 drivers/gpu/drm/drm_probe_helper.c  | 54 +++-
 drivers/gpu/drm/exynos/Kconfig  |  1 -
 drivers/gpu/drm/gma500/framebuffer.c| 22 ++--
 drivers/gpu/drm/mgag200/mgag200_fb.c| 12 -
 drivers/gpu/drm/msm/msm_fbdev.c | 10 +++-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c | 21 +---
 drivers/gpu/drm/omapdrm/omap_fbdev.c| 10 +++-
 drivers/gpu/drm/qxl/qxl_fb.c| 22 +---
 drivers/gpu/drm/radeon/radeon_fb.c  | 21 +---
 drivers/gpu/drm/rockchip/Kconfig|  1 -
 drivers/gpu/drm/udl/udl_fb.c| 22 +---
 include/drm/drm_crtc.h  |  1 +
 include/drm/drm_fb_helper.h |  2 +-
 19 files changed, 238 insertions(+), 103 deletions(-)

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PULL] drm-intel-next

2015-01-23 Thread Daniel Vetter
Hi Dave,

drm-intel-next-2015-01-17:
- refactor i915/snd-hda interaction to use the component framework (Imre)
- psr cleanups and small fixes (Rodrigo)
- a few perf w/a from Ken Graunke
- switch to atomic plane helpers (Matt Roper)
- wc mmap support (Chris Wilson & Akash Goel)
- smaller things all over

Cheers, Daniel


The following changes since commit eaa27f34e91a14cdceed26ed6c6793ec1d186115:

  linux 3.19-rc4 (2015-01-11 12:44:53 -0800)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/drm-intel-next-2015-01-17

for you to fetch changes up to 0a0c0018f6badd4adebe1cb453dc42143a464f87:

  drm/i915: Update DRIVER_DATE to 20150117 (2015-01-17 10:43:04 +0100)


- refactor i915/snd-hda interaction to use the component framework (Imre)
- psr cleanups and small fixes (Rodrigo)
- a few perf w/a from Ken Graunke
- switch to atomic plane helpers (Matt Roper)
- wc mmap support (Chris Wilson & Akash Goel)
- smaller things all over


Akash Goel (1):
  drm/i915: Support creation of unbound wc user mappings for objects

Andy Shevchenko (1):
  i915: reuse %ph to dump small buffers

Ben Widawsky (1):
  drm/i915: Add some extra guards in evict_vm

Chris Wilson (3):
  drm/i915: Broaden application of set-domain(GTT)
  drm/i915: Move the ban period onto the context
  drm/i915: Add ioctl to set per-context parameters

Daniel Vetter (4):
  drm/i915: Include i915_gem_evict.c kerneldoc into the drm docbook
  drm/i915: Push vblank enable/disable past encoder->enable/disable
  Merge tag 'topic/i915-hda-componentized-2015-01-12' into 
drm-intel-next-queued
  drm/i915: Update DRIVER_DATE to 20150117

Imre Deak (6):
  drm/i915: add dev_to_i915 helper
  drm/i915: add component support
  ALSA: hda: export struct hda_intel
  ALSA: hda: pass intel_hda to all i915 interface functions
  ALSA: hda: add component support
  drm/i915: remove unused power_well/get_cdclk_freq api

Jani Nikula (1):
  drm/i915: fix build for CONFIG_BUG=n

Kenneth Graunke (4):
  drm/i915: Make sample_c messages go faster on Haswell.
  drm/i915: Improve HiZ throughput on Cherryview.
  drm/i915: Enable the HiZ RAW Stall Optimization on Broadwell.
  drm/i915: Ensure the HiZ RAW Stall Optimization is on for Cherryview.

Matt Roper (6):
  drm/i915: Refactor work that can sleep out of commit (v7)
  drm/i915: Move vblank evasion to commit (v4)
  drm/i915: Clarify sprite plane function names (v4)
  drm/i915: Move to atomic plane helpers (v9)
  drm/i915: Drop unused position fields (v2)
  drm/i915: Fix kerneldoc for i915 atomic plane code

Rodrigo Vivi (8):
  Revert "drm/i915: Parsing LFP brightness control from VBT"
  Revert "drm/i915/chv: Use timeout mode for RC6 on chv"
  drm/i915: VLV/CHV PSR needs to exit PSR on every flush.
  drm/i915: PSR VLV/CHV: Remove condition checks that only applies to 
Haswell.
  drm/i915: PSR HSW/BDW: Fix inverted logic at sink main_link_active bit.
  drm/i915: Add missing vbt check.
  drm/i915: group link_standby setup and let this info visible everywhere.
  drm/i915: PSR link standby at debugfs

Thomas Daniel (1):
  drm/i915: Reset CSB read pointer in ring init

Tvrtko Ursulin (1):
  drm/i915: Reserve shadow batch VMA analogue to others

Ville Syrjälä (4):
  drm/i915: Make hpd arrays big enough to avoid out of bounds access
  drm/i915: Remove I915_HAS_HOTPLUG() check from i915_hpd_irq_setup()
  drm/i915: Don't register HDMI connectors for eDP ports on VLV/CHV
  drm/i915: Don't pretend SDVO hotplug works on 915

 Documentation/DocBook/drm.tmpl|   31 +
 drivers/gpu/drm/drm_crtc.c|   32 +-
 drivers/gpu/drm/drm_modes.c   |   26 +-
 drivers/gpu/drm/i915/Makefile |3 +
 drivers/gpu/drm/i915/i915_cmd_parser.c|  131 ++-
 drivers/gpu/drm/i915/i915_debugfs.c   |  235 --
 drivers/gpu/drm/i915/i915_dma.c   |   21 +-
 drivers/gpu/drm/i915/i915_drv.c   |   18 +-
 drivers/gpu/drm/i915/i915_drv.h   |  272 +-
 drivers/gpu/drm/i915/i915_gem.c   |  600 +++--
 drivers/gpu/drm/i915/i915_gem_batch_pool.c|  137 +++
 drivers/gpu/drm/i915/i915_gem_context.c   |  114 ++-
 drivers/gpu/drm/i915/i915_gem_evict.c |   11 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c|  119 ++-
 drivers/gpu/drm/i915/i915_gem_gtt.c   |  170 +++-
 drivers/gpu/drm/i915/i915_gem_gtt.h   |   35 +-
 drivers/gpu/drm/i915/i915_gem_render_state.c  |2 +-
 drivers/gpu/drm/i915/i915_gem_tiling.c|2 +-
 drivers/gpu/drm/i915/i915_gpu_error.c |   91 +-
 drivers/gpu/drm/i915/i915_irq.c   |   84 +-
 drivers/gpu/drm/i915/i915_params.c|9 +-
 

[PATCH libdrm 1/2] Rename DRM_NODE_RENDER to DRM_NODE_PRIMARY

2015-01-23 Thread Frank Binns
Ping

On 14/01/15 14:07, Frank Binns wrote:
> Now that there are render nodes it doesn't seem appropriate for the type of
> the card nodes to be DRM_NODE_RENDER. For this reason, rename this type to
> DRM_NODE_PRIMARY as this name better represents the purpose of these nodes.
>
> Signed-off-by: Frank Binns 
> ---
>  tests/dristat.c |  2 +-
>  xf86drm.c   | 10 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/dristat.c b/tests/dristat.c
> index 4f2ee80..449aa24 100644
> --- a/tests/dristat.c
> +++ b/tests/dristat.c
> @@ -268,7 +268,7 @@ int main(int argc, char **argv)
>  
>  for (i = 0; i < 16; i++) if (!minor || i == minor) {
>   sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i);
> - fd = drmOpenMinor(i, 1, DRM_NODE_RENDER);
> + fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY);
>   if (fd >= 0) {
>   printf("%s\n", buf);
>   if (mask & DRM_BUSID)   getbusid(fd);
> diff --git a/xf86drm.c b/xf86drm.c
> index d900b4b..a23d029 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -86,7 +86,7 @@
>  #define DRM_MSG_VERBOSITY 3
>  
>  #define DRM_NODE_CONTROL 0
> -#define DRM_NODE_RENDER 1
> +#define DRM_NODE_PRIMARY 1
>  
>  static drmServerInfoPtr drm_server_info;
>  
> @@ -444,7 +444,7 @@ int drmAvailable(void)
>  int   retval = 0;
>  int   fd;
>  
> -if ((fd = drmOpenMinor(0, 1, DRM_NODE_RENDER)) < 0) {
> +if ((fd = drmOpenMinor(0, 1, DRM_NODE_PRIMARY)) < 0) {
>  #ifdef __linux__
>   /* Try proc for backward Linux compatibility */
>   if (!access("/proc/dri/0", R_OK))
> @@ -485,7 +485,7 @@ static int drmOpenByBusid(const char *busid)
>  
>  drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid);
>  for (i = 0; i < DRM_MAX_MINOR; i++) {
> - fd = drmOpenMinor(i, 1, DRM_NODE_RENDER);
> + fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY);
>   drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd);
>   if (fd >= 0) {
>   /* We need to try for 1.4 first for proper PCI domain support
> @@ -547,7 +547,7 @@ static int drmOpenByName(const char *name)
>   * already in use.  If it's in use it will have a busid assigned already.
>   */
>  for (i = 0; i < DRM_MAX_MINOR; i++) {
> - if ((fd = drmOpenMinor(i, 1, DRM_NODE_RENDER)) >= 0) {
> + if ((fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY)) >= 0) {
>   if ((version = drmGetVersion(fd))) {
>   if (!strcmp(version->name, name)) {
>   drmFreeVersion(version);
> @@ -591,7 +591,7 @@ static int drmOpenByName(const char *name)
>   if (*pt) { /* Found busid */
>   return drmOpenByBusid(++pt);
>   } else { /* No busid */
> - return drmOpenDevice(strtol(devstring, NULL, 0),i, 
> DRM_NODE_RENDER);
> + return drmOpenDevice(strtol(devstring, NULL, 0),i, 
> DRM_NODE_PRIMARY);
>   }
>   }
>   }



[PATCH V9 13/14] ARM: dts: snow: represent the connection between bridge and panel using videoport and endpoints

2015-01-23 Thread Kukjin Kim
Ajay Kumar wrote:
> 
> Define videoports and use endpoints to describe the connection between
> the encoder, bridge and the panel, instead of using phandles.
> 
> Signed-off-by: Ajay Kumar 
> Acked-by: Inki Dae 
> Tested-by: Rahul Sharma 
> Tested-by: Javier Martinez Canillas 
> Tested-by: Gustavo Padovan 
> Tested-by: Sjoerd Simons 
> ---
>  arch/arm/boot/dts/exynos5250-snow.dts |   30 --
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos5250-snow.dts 
> b/arch/arm/boot/dts/exynos5250-snow.dts
> index b9aeec4..1bd5d3a 100644
> --- a/arch/arm/boot/dts/exynos5250-snow.dts
> +++ b/arch/arm/boot/dts/exynos5250-snow.dts
> @@ -183,7 +183,20 @@
>   powerdown-gpios = < 5 GPIO_ACTIVE_HIGH>;
>   reset-gpios = < 5 GPIO_ACTIVE_HIGH>;
>   edid-emulation = <5>;
> - panel = <>;
> +
> + ports {
> + port at 0 {
> + bridge_out: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
> +
> + port at 1 {
> + bridge_in: endpoint {
> + remote-endpoint = <_out>;
> + };
> + };
> + };
>   };
>   };
> 
> @@ -228,6 +241,12 @@
>   compatible = "auo,b116xw03";
>   power-supply = <>;
>   backlight = <>;
> +
> + port {
> + panel_in: endpoint {
> + remote-endpoint = <_out>;
> + };
> + };
>   };
>  };
> 
> @@ -242,7 +261,14 @@
>   samsung,link-rate = <0x0a>;
>   samsung,lane-count = <2>;
>   samsung,hpd-gpio = < 7 GPIO_ACTIVE_HIGH>;
> - bridge = <>;
> +
> + ports {
> + port at 0 {
> + dp_out: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
> + };
>  };
> 
>   {
> --
> 1.7.9.5

I'm fine on the DT changes in this series, shall I take 13/14 and 14/14 in
Samsung tree?

- Kukjin



[GIT PULL] drm/tegra: Changes for v3.20-rc1

2015-01-23 Thread Thierry Reding
Hi Dave,

The following changes since commit 281d1bbd34b734e4f22b30b6f3b673dda46a7470:

  Merge remote-tracking branch 'origin/master' into drm-next (2015-01-22 
10:44:41 +1000)

are available in the git repository at:

  git://anongit.freedesktop.org/tegra/linux tags/drm/tegra/for-3.20-rc1

for you to fetch changes up to 28dd241d37bd136e140c884897f64b79bf8d7a83:

  drm/tegra: Use correct relocation target offsets (2015-01-23 12:17:04 +0100)

Thanks,
Thierry


drm/tegra: Changes for v3.20-rc1

The biggest part of these changes is the conversion to atomic mode-
setting. A lot of cleanup and demidlayering was required before the
conversion, with the result being a whole lot of changes.

Besides the atomic mode-setting support, the host1x bus now has the
proper infrastructure to support suspend/resume for child devices.

Finally, a couple of smaller cleanup patches round things off.


Dan Carpenter (3):
  drm/tegra: Check for NULL pointer instead of IS_ERR()
  drm/tegra: dc: Fix bad irqsave/restore in tegra_dc_finish_page_flip()
  drm/tegra: gem: oops in error handling

David Ung (2):
  drm/tegra: dsi: Adjust D-PHY timing
  drm/tegra: Use correct relocation target offsets

Thierry Reding (49):
  gpu: host1x: Call ->remove() only when a device is bound
  gpu: host1x: Call host1x_device_add() under lock
  gpu: host1x: Factor out __host1x_device_del()
  gpu: host1x: Provide a proper struct bus_type
  drm/tegra: gem: Use iommu_map_sg()
  drm/tegra: Remove redundant zeroing out of memory
  drm/tegra: plane: Use proper possible_crtcs mask
  drm/tegra: dc: Initialize border color
  drm/tegra: dc: Describe register copies
  drm/tegra: dc: Return planar flag for non-YUV modes
  drm/tegra: hdmi: Registers are 32-bit
  drm/tegra: dsi: Registers are 32-bit
  drm/tegra: dsi: Soft-reset controller on ->disable
  drm/tegra: dsi: Reset across ->exit()/->init()
  drm/plane: Make ->atomic_update() mandatory
  drm/plane: Add optional ->atomic_disable() callback
  drm/atomic: Add ->atomic_check() to encoder helpers
  drm/tegra: Use tegra_commit_dc() in output drivers
  drm/tegra: Stop CRTC at CRTC disable time
  drm/tegra: dc: Wait for idle when disabled
  drm/tegra: Move tegra_drm_mode_funcs to the core
  drm/tegra: dc: No longer disable planes at CRTC disable
  drm/tegra: Convert output midlayer to helpers
  drm/tegra: output: Make ->setup_clock() optional
  drm/tegra: Add tegra_dc_setup_clock() helper
  drm/tegra: rgb: Demidlayer
  drm/tegra: hdmi: Demidlayer
  drm/tegra: dsi: Demidlayer
  drm/tegra: sor: Demidlayer
  drm/tegra: debugfs cleanup cannot fail
  drm/tegra: Remove remnants of the output midlayer
  drm/tegra: Output cleanup functions cannot fail
  drm/tegra: dc: Do not needlessly deassert reset
  drm/tegra: Atomic conversion, phase 1
  drm/tegra: Atomic conversion, phase 2
  drm/tegra: Atomic conversion, phase 3, step 1
  drm/tegra: dc: Store clock setup in atomic state
  drm/tegra: rgb: Implement ->atomic_check()
  drm/tegra: dsi: Implement ->atomic_check()
  drm/tegra: hdmi: Implement ->atomic_check()
  drm/tegra: sor: Implement ->atomic_check()
  drm/tegra: dc: Use atomic clock state in modeset
  drm/tegra: Atomic conversion, phase 3, step 2
  drm/tegra: Atomic conversion, phase 3, step 3
  drm/tegra: Remove unused ->mode_fixup() callbacks
  drm/tegra: Track active planes in CRTC state
  drm/tegra: Track tiling and format in plane state
  drm/tegra: dc: Unify enabling the display controller
  drm/tegra: Add minimal power management

 drivers/gpu/drm/drm_atomic_helper.c |   34 +-
 drivers/gpu/drm/drm_plane_helper.c  |   10 +-
 drivers/gpu/drm/tegra/dc.c  |  955 ++
 drivers/gpu/drm/tegra/drm.c |  140 -
 drivers/gpu/drm/tegra/drm.h |   91 +--
 drivers/gpu/drm/tegra/dsi.c |  578 ++
 drivers/gpu/drm/tegra/fb.c  |   25 +-
 drivers/gpu/drm/tegra/gem.c |   39 +-
 drivers/gpu/drm/tegra/hdmi.c|  327 +--
 drivers/gpu/drm/tegra/mipi-phy.c|   25 +-
 drivers/gpu/drm/tegra/output.c  |  168 +-
 drivers/gpu/drm/tegra/rgb.c |  218 +++
 drivers/gpu/drm/tegra/sor.c | 1105 ++-
 drivers/gpu/host1x/Makefile |3 +-
 drivers/gpu/host1x/bus.c|  199 ---
 drivers/gpu/host1x/bus.h|3 -
 drivers/gpu/host1x/dev.c|9 +-
 include/drm/drm_atomic_helper.h |   37 ++
 include/drm/drm_crtc_helper.h   |6 +
 include/drm/drm_plane_helper.h  |5 +-
 include/linux/host1x.h  |   18 +-
 21 files changed, 2187 insertions(+), 1808 deletions(-)


[GIT PULL] drm/panel: Changes for v3.20-rc1

2015-01-23 Thread Thierry Reding
Hi Dave,

The following changes since commit 97bf6af1f928216fd6c5a66e8a57bfa95a659672:

  Linux 3.19-rc1 (2014-12-20 17:08:50 -0800)

are available in the git repository at:

  git://anongit.freedesktop.org/tegra/linux tags/drm/panel/for-3.20-rc1

for you to fetch changes up to c618c446adffebd4a0593f387952e450ac191a00:

  Documentation: bridge: Add documentation for ps8622 DT properties (2015-01-23 
14:40:24 +0100)

Thanks,
Thierry


drm/panel: Changes for v3.20-rc1

This contains the long-awaited drm_bridge series that makes Chromebooks
work for people. I had thought this would've been perfect by now, but
then I go and build test it and the first thing it does is yell about a
recursive dependency. I fixed that up because I was feeling bad for not
getting around to look at this earlier.

Biseds that there is new support for two more panels, a couple of fixup
patches to the Sharp LQ101R1SX01 dual-channel DSI panel driver and a
potential NULL pointer dereference fix.


Ajay Kumar (11):
  drm/bridge: ptn3460: Few trivial cleanups
  drm/bridge: do not pass drm_bridge_funcs to drm_bridge_init
  drm/bridge: make bridge registration independent of drm flow
  drm/bridge: ptn3460: Convert to I2C driver model
  drm/exynos: dp: support drm_bridge
  drm/bridge: ptn3460: support drm_panel
  drm/bridge: ptn3460: probe connector at the end of bridge attach
  drm/bridge: ptn3460: use gpiod interface
  Documentation: drm: bridge: move to video/bridge
  Documentation: devicetree: Add vendor prefix for parade
  Documentation: bridge: Add documentation for ps8622 DT properties

Philipp Zabel (4):
  of: Add vendor prefix for Giantplus Technology Co., Ltd.
  drm/panel: simple: Add support for Giantplus GPG482739QS5
  of: Add vendor prefix for Shanghai AVIC Optoelectronics Co., Ltd.
  drm/panel: simple: Add AVIC TM070DDH03 panel support

Thierry Reding (4):
  drm/mipi-dsi: Avoid potential NULL pointer dereference
  drm/panel: sharp: lq101r1sx01: Add delay after display on
  drm/panel: sharp: lq101r1sx01: Respect power timings
  drm/panel: sharp: lq101r1sx01: Remove unneeded include

 .../devicetree/bindings/panel/avic,tm070ddh03.txt  |   7 +
 .../bindings/panel/giantplus,gpg482739qs5.txt  |   7 +
 .../devicetree/bindings/vendor-prefixes.txt|   3 +
 .../devicetree/bindings/video/bridge/ps8622.txt|  31 +++
 .../bindings/{drm => video}/bridge/ptn3460.txt |  16 +-
 .../devicetree/bindings/video/exynos_dp.txt|  12 +
 drivers/gpu/drm/Makefile   |   2 +-
 drivers/gpu/drm/bridge/Kconfig |   3 +
 drivers/gpu/drm/bridge/ptn3460.c   | 310 +
 drivers/gpu/drm/drm_bridge.c   |  91 ++
 drivers/gpu/drm/drm_crtc.c |  70 -
 drivers/gpu/drm/drm_mipi_dsi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c|  53 ++--
 drivers/gpu/drm/exynos/exynos_dp_core.h|   1 +
 drivers/gpu/drm/msm/hdmi/hdmi.c|   4 +-
 drivers/gpu/drm/msm/hdmi/hdmi.h|   1 +
 drivers/gpu/drm/msm/hdmi/hdmi_bridge.c |   7 +-
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c|  33 ++-
 drivers/gpu/drm/panel/panel-simple.c   |  57 
 drivers/gpu/drm/sti/sti_hda.c  |  11 +-
 drivers/gpu/drm/sti/sti_hdmi.c |  11 +-
 include/drm/bridge/ptn3460.h   |   8 +
 include/drm/drm_crtc.h |  27 +-
 23 files changed, 503 insertions(+), 268 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/panel/avic,tm070ddh03.txt
 create mode 100644 
Documentation/devicetree/bindings/panel/giantplus,gpg482739qs5.txt
 create mode 100644 Documentation/devicetree/bindings/video/bridge/ps8622.txt
 rename Documentation/devicetree/bindings/{drm => video}/bridge/ptn3460.txt 
(65%)
 create mode 100644 drivers/gpu/drm/drm_bridge.c


My minnow was broken by: drm/i915: Consolidate forcewake code

2015-01-23 Thread Darren Hart
+Jani

Jani, I think this may have inadvertently undone the fix you made for
us on the MinnowMax.

On Fri, Jan 23, 2015 at 1:44 PM, Olof Johansson  wrote:
> Hi Daniel, Mika,
>
> For the first time in a few days, -next was bootable last night. I
> noticed that my Minnowboard Max didn't actually boot though, it got
> stuck shortly after or during DRM probing:
>
> http://arm-soc.lixom.net/bootlogs/next/next-20150123/minnowmax-x86-minnowmax_defconfig.html
>
> I bisected it down to the below patch that I failed to find posted
> (with that subject) anywhere on a public list that I am subscribed to.
>
> The patch isn't revertable without considerable effort so I can't
> double check that it's just this one change, but the commit before
> that in the branch boots, this one does not.
>
>
> commit fc72355f5c04c40f2916a07e9f8d4b357e2e0a93
> Author: Mika Kuoppala 
> AuthorDate: Mon Jan 19 16:20:43 2015 +0200
> Commit: Daniel Vetter 
> CommitDate: Tue Jan 20 12:36:57 2015 +0100
>
> drm/i915: Consolidate forcewake code
>
> As we now have forcewake domains, take advantage of it
> by putting the differences in gen fw handling in data rather
> than in code.
>
> In past we have opencoded this quite extensively as the fw handling
> is in the fast path. There has also been a lot of cargo-culted
> copy'n'pasting from older gens to newer ones.
>
> Now when the releasing of the forcewake is done by deferred timer,
> it gives chance to consolidate more. Due to the frequency of actual hw
> access being significantly less.
>
> Take advantage of this and generalize the fw handling code
> as much as possible. But we still aim to keep the forcewake sequence
> particularities for each gen intact. So the access pattern
> to fw engines should remain the same.
>
> v2: - s/old_ack/clear_ack (Chris)
> - s/post_read/posting_read (Chris)
> - less polite commit msg (Chris)
>
> v3: - rebase
> - check and clear wake_count in init
>
> v4: - fix posting reads for gen8 (PRTS)
>
> Signed-off-by: Mika Kuoppala 
> Reviewed-by: Deepak S  (v2)
> Signed-off-by: Daniel Vetter 



-- 
Darren Hart


[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Fabio Estevam
On Fri, Jan 23, 2015 at 2:39 PM, Philipp Zabel  
wrote:
> Am Freitag, den 23.01.2015, 14:27 -0200 schrieb Fabio Estevam:
>> Hi Philipp,
>>
>> On Fri, Jan 23, 2015 at 2:18 PM, Philipp Zabel  
>> wrote:
>> > @@ -281,6 +267,9 @@ static void imx_ldb_encoder_mode_set(struct 
>> > drm_encoder *encoder,
>> > struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
>> > struct imx_ldb *ldb = imx_ldb_ch->ldb;
>> > int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
>> > +   unsigned long serial_clk;
>> > +   unsigned long di_clk = mode->clock * 1000;
>> > +   int mux = imx_ldb_get_mux_id(imx_ldb_ch);
>>
>> I can't find imx_ldb_get_mux_id() on linux-next.
>
> Sorry, that should be
>
> int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);

It works fine now, thanks:

Tested-by: Fabio Estevam 


[LKP] [PATCH] drm/radeon: Try to init amdkfd only if 64 bit kernel

2015-01-23 Thread Rusty Russell
Kees Cook  writes:
> On Sun, Jan 4, 2015 at 8:28 PM, Rusty Russell  
> wrote:
>> Oded Gabbay  writes:
>>> On 12/24/2014 01:01 AM, Rusty Russell wrote:
 Oded Gabbay  writes:
> I didn't say it doesn't always work.
> The actual thing that doesn't work is the define symbol_get and only in a
> specific case of 32bit kernel AND CONFIG_MODULES is unset AND
> CONFIG_RANDOMIZE_BASE is set.
> The define in that case is:
> #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); 
> })
>
> Why it doesn't work (doesn't return NULL when symbol doesn't exists) ?

 Hmm, I'd guess CONFIG_RANDOMIZE_BASE is relocating NULL symbols...

 No, I can't reproduce this.  Please send your .config privately.

 Here's my test case:

 diff --git a/init/main.c b/init/main.c
 index 61b993767db5..a3ee1ec97ec3 100644
 --- a/init/main.c
 +++ b/init/main.c
 @@ -683,6 +683,12 @@ asmlinkage __visible void __init start_kernel(void)

  ftrace_init();

 +{
 +extern void nonexistent_fn(void);
 +printk("symbol_get(nonexistent_fn) = %p\n",
 +   symbol_get(nonexistent_fn));
 +}
 +
  /* Do the rest non-__init'ed, we're now alive */
  rest_init();
   }

 Thanks,
 Rusty.

>>> Hi Rusty,
>>>
>>> Attached is the bad config file. (config-bad)
>>> I have narrowed the changes you need to do to the config file in order to
>>> reproduce this bug.
>>> The base assumption is a 32-bit kernel and without modules support. Rest of 
>>> the
>>> config file is pretty standard, IMO.
>>> Then, its not enough to enable CONFIG_RANDOMIZE_BASE like I wrote in my 
>>> original
>>> post. You need also to unset CONFIG_HIBERNATION.
>>
>> Indeed, thanks; your config breaks as reported.  With CONFIG_HIBERNATION
>> the kernel offset is 0, so we don't see this.
>>
>> Kees, as far as I can tell you need another 0-terminated vmlinux.relocs
>> section for weak symbols.  These should not be relocated if already 0.
>>
>> Put this somewhere to test.  It fails for x86_64, too:
>>
>> diff --git a/init/main.c b/init/main.c
>> index 61b993767db5..c9e0195c792a 100644
>> --- a/init/main.c
>> +++ b/init/main.c
>> @@ -683,6 +683,12 @@ asmlinkage __visible void __init start_kernel(void)
>>
>> ftrace_init();
>>
>> +   {
>> +   extern void __attribute__((weak)) nonexistent_fn(void);
>> +   printk("nonexistent_fn = %p\n", nonexistent_fn);
>> +   BUG_ON(nonexistent_fn != NULL);
>> +   }
>> +
>> /* Do the rest non-__init'ed, we're now alive */
>> rest_init();
>>  }
>
> Hm, I can't reproduce this on v3.19-rc4. My nonexistent_fn comes back
> NULL regardless of CONFIG and kaslr on/off states I've tried. Could
> this be a (yet another) linker bug? What was the toolchain used? I
> built with gcc 4.8.2 and binutils 2.24.

$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.24.90.20141014
...
$ gcc --version
gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1

I tested with gcc 4.8.3 as well, same fail.

I'll send you the config I used separately.

Cheers,
Rusty.





[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Fabio Estevam
Hi Philipp,

On Fri, Jan 23, 2015 at 2:18 PM, Philipp Zabel  
wrote:
> @@ -281,6 +267,9 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder 
> *encoder,
> struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
> struct imx_ldb *ldb = imx_ldb_ch->ldb;
> int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
> +   unsigned long serial_clk;
> +   unsigned long di_clk = mode->clock * 1000;
> +   int mux = imx_ldb_get_mux_id(imx_ldb_ch);

I can't find imx_ldb_get_mux_id() on linux-next.


[Bug 88717] [r300g] r300compiler error: Failed to translate rgb instruction - while running a game with gallium-nine

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88717

--- Comment #4 from Fabio Pedretti  ---
The patch also regresses other games with different corruption types (e.g.
sauerbraten becomes in black/white, 0ad has flickering textures).

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


My minnow was broken by: drm/i915: Consolidate forcewake code

2015-01-23 Thread Olof Johansson
Hi Daniel, Mika,

For the first time in a few days, -next was bootable last night. I
noticed that my Minnowboard Max didn't actually boot though, it got
stuck shortly after or during DRM probing:

http://arm-soc.lixom.net/bootlogs/next/next-20150123/minnowmax-x86-minnowmax_defconfig.html

I bisected it down to the below patch that I failed to find posted
(with that subject) anywhere on a public list that I am subscribed to.

The patch isn't revertable without considerable effort so I can't
double check that it's just this one change, but the commit before
that in the branch boots, this one does not.


commit fc72355f5c04c40f2916a07e9f8d4b357e2e0a93
Author: Mika Kuoppala 
AuthorDate: Mon Jan 19 16:20:43 2015 +0200
Commit: Daniel Vetter 
CommitDate: Tue Jan 20 12:36:57 2015 +0100

drm/i915: Consolidate forcewake code

As we now have forcewake domains, take advantage of it
by putting the differences in gen fw handling in data rather
than in code.

In past we have opencoded this quite extensively as the fw handling
is in the fast path. There has also been a lot of cargo-culted
copy'n'pasting from older gens to newer ones.

Now when the releasing of the forcewake is done by deferred timer,
it gives chance to consolidate more. Due to the frequency of actual hw
access being significantly less.

Take advantage of this and generalize the fw handling code
as much as possible. But we still aim to keep the forcewake sequence
particularities for each gen intact. So the access pattern
to fw engines should remain the same.

v2: - s/old_ack/clear_ack (Chris)
- s/post_read/posting_read (Chris)
- less polite commit msg (Chris)

v3: - rebase
- check and clear wake_count in init

v4: - fix posting reads for gen8 (PRTS)

Signed-off-by: Mika Kuoppala 
Reviewed-by: Deepak S  (v2)
Signed-off-by: Daniel Vetter 


[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Fabio Estevam
On Fri, Jan 23, 2015 at 12:56 AM, Liu Ying  wrote:
> Hi,
>
> It looks that the below commit makes my Hannstar XGA LVDS panel stop working
> on the i.MX6DL SabreSD board.  Any idea?

Yes, with eb10d6355532def3a ("mx-drm: encoder prepare/mode_set must
use adjusted mode") applied
the DI clock is 0:

--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -169,6 +169,8 @@ static void imx_ldb_encoder_prepare(struct
drm_encoder *encoder)
unsigned long di_clk = mode->clock * 1000;
int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder);

+   pr_err("* DI clock is %ld\n", di_clk);
+
if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) {

With eb10d6355532def3a applied:

[1.493745] * DI clock is 0

With eb10d6355532def3a reverted:

[1.493639] * DI clock is 6500

Should we just go back to the previous usage?

--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -163,12 +163,14 @@ static void imx_ldb_encoder_prepare(struct
drm_encoder *encoder)
 {
struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
struct imx_ldb *ldb = imx_ldb_ch->ldb;
-   struct drm_display_mode *mode = >crtc->hwmode;
+   struct drm_display_mode *mode = >crtc->mode;
u32 pixel_fmt;


[RFC] dma-buf: cleanup dma_buf_export() to make it easily extensible

2015-01-23 Thread Sumit Semwal
At present, dma_buf_export() takes a series of parameters, which
makes it difficult to add any new parameters for exporters, if required.

Make it simpler by moving all these parameters into a struct, and pass
the struct * as parameter to dma_buf_export().

While at it, unite dma_buf_export_named() with dma_buf_export(), and
change all callers accordingly.

Signed-off-by: Sumit Semwal 
---
 drivers/dma-buf/dma-buf.c  | 47 +-
 drivers/gpu/drm/armada/armada_gem.c| 12 +--
 drivers/gpu/drm/drm_prime.c| 14 +---
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 13 +--
 drivers/gpu/drm/i915/i915_gem_dmabuf.c | 12 +--
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c  | 11 +-
 drivers/gpu/drm/tegra/gem.c| 12 +--
 drivers/gpu/drm/ttm/ttm_object.c   | 11 --
 drivers/gpu/drm/udl/udl_dmabuf.c   | 10 +-
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 10 +-
 drivers/media/v4l2-core/videobuf2-dma-sg.c | 10 +-
 drivers/media/v4l2-core/videobuf2-vmalloc.c| 10 +-
 drivers/staging/android/ion/ion.c  | 11 --
 include/linux/dma-buf.h| 28 +++
 14 files changed, 160 insertions(+), 51 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 5be225c2ba98..6d3df3dd9310 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -265,7 +265,7 @@ static inline int is_dma_buf_file(struct file *file)
 }

 /**
- * dma_buf_export_named - Creates a new dma_buf, and associates an anon file
+ * dma_buf_export - Creates a new dma_buf, and associates an anon file
  * with this buffer, so it can be exported.
  * Also connect the allocator specific data and ops to the buffer.
  * Additionally, provide a name string for exporter; useful in debugging.
@@ -277,31 +277,32 @@ static inline int is_dma_buf_file(struct file *file)
  * @exp_name:  [in]name of the exporting module - useful for debugging.
  * @resv:  [in]reservation-object, NULL to allocate default one.
  *
+ * All the above info comes from struct dma_buf_export_info.
+ *
  * Returns, on success, a newly created dma_buf object, which wraps the
  * supplied private data and operations for dma_buf_ops. On either missing
  * ops, or error in allocating struct dma_buf, will return negative error.
  *
  */
-struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops,
-   size_t size, int flags, const char *exp_name,
-   struct reservation_object *resv)
+struct dma_buf *dma_buf_export(struct dma_buf_export_info *exp_info)
 {
struct dma_buf *dmabuf;
struct file *file;
size_t alloc_size = sizeof(struct dma_buf);
-   if (!resv)
+   if (!exp_info->resv)
alloc_size += sizeof(struct reservation_object);
else
/* prevent _buf[1] == dma_buf->resv */
alloc_size += 1;

-   if (WARN_ON(!priv || !ops
- || !ops->map_dma_buf
- || !ops->unmap_dma_buf
- || !ops->release
- || !ops->kmap_atomic
- || !ops->kmap
- || !ops->mmap)) {
+   if (WARN_ON(!exp_info->priv
+ || !exp_info->ops
+ || !exp_info->ops->map_dma_buf
+ || !exp_info->ops->unmap_dma_buf
+ || !exp_info->ops->release
+ || !exp_info->ops->kmap_atomic
+ || !exp_info->ops->kmap
+ || !exp_info->ops->mmap)) {
return ERR_PTR(-EINVAL);
}

@@ -309,21 +310,22 @@ struct dma_buf *dma_buf_export_named(void *priv, const 
struct dma_buf_ops *ops,
if (dmabuf == NULL)
return ERR_PTR(-ENOMEM);

-   dmabuf->priv = priv;
-   dmabuf->ops = ops;
-   dmabuf->size = size;
-   dmabuf->exp_name = exp_name;
+   dmabuf->priv = exp_info->priv;
+   dmabuf->ops = exp_info->ops;
+   dmabuf->size = exp_info->size;
+   dmabuf->exp_name = exp_info->exp_name;
init_waitqueue_head(>poll);
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = >poll;
dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0;

-   if (!resv) {
-   resv = (struct reservation_object *)[1];
-   reservation_object_init(resv);
+   if (!exp_info->resv) {
+   exp_info->resv = (struct reservation_object *)[1];
+   reservation_object_init(exp_info->resv);
}
-   dmabuf->resv = resv;
+   dmabuf->resv = exp_info->resv;

-   file = anon_inode_getfile("dmabuf", _buf_fops, dmabuf, flags);
+   file = anon_inode_getfile("dmabuf", _buf_fops, dmabuf,
+   

[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Fabio Estevam
Hi Philipp,

On Fri, Jan 23, 2015 at 8:50 AM, Philipp Zabel  
wrote:

> What are this panel timings? The adjustment should increase the vertical
> back porch by up to two lines (so it is at least two lines), reducing
> the front porch or vsync length by the same amount. Does this panel use
> the HSYNC/VSYNC signals embedded in the LVDS stream?

The panel on this board is a Hannstar HSD100PXN1. The timings we use
are described in imx6qdl-sabresd.dtsi:

display-timings {
native-mode = <>;
timing0: hsd100pxn1 {
clock-frequency = <6500>;
hactive = <1024>;
vactive = <768>;
hback-porch = <220>;
hfront-porch = <40>;
vback-porch = <21>;
vfront-porch = <7>;
hsync-len = <60>;
vsync-len = <10>;
};


[PATCH] drm: atmel-hlcdc: Add dependency on ARM

2015-01-23 Thread Guenter Roeck
On 01/23/2015 12:03 PM, Boris Brezillon wrote:
> The atmel-hlcdc driver selects DRM_GEM_CMA_HELPER which makes use of
> symbols only available when HAVE_DMA_ATTRS is selected.
> Add a dependency on the ARM architecture which select this option.
>
> Signed-off-by: Boris Brezillon 
> ---
>   drivers/gpu/drm/atmel-hlcdc/Kconfig | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/Kconfig 
> b/drivers/gpu/drm/atmel-hlcdc/Kconfig
> index 1a08562..99b4f06 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/Kconfig
> +++ b/drivers/gpu/drm/atmel-hlcdc/Kconfig
> @@ -1,6 +1,6 @@
>   config DRM_ATMEL_HLCDC
>   tristate "DRM Support for ATMEL HLCDC Display Controller"
> - depends on DRM && OF && COMMON_CLK && MFD_ATMEL_HLCDC
> + depends on DRM && OF && COMMON_CLK && MFD_ATMEL_HLCDC && ARM

&& HAVE_DMA_ATTRS

might have been a bit less restrictive. Are you sure this controller
is never used on any other architecture but arm, not even arm64 ?

Anyway, the xtensa:allmodconfig build is passing again with this patch
applied, so

Tested-by: Guenter Roeck 



[Bug 88717] [r300g] r300compiler error: Failed to translate rgb instruction - while running a game with gallium-nine

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88717

--- Comment #3 from Fabio Pedretti  ---
Created attachment 112717
  --> https://bugs.freedesktop.org/attachment.cgi?id=112717=edit
screenshot with patch

The patch fixes the error, thanks.

The rendering is also improved but not correct however, while before the patch
I got a black screen now I get the attached blurred image.

Running nine with D3D_ALWAYS_SOFTWARE=1 shows a proper render.

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


[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Philipp Zabel
Hi Liu,

Am Freitag, den 23.01.2015, 10:56 +0800 schrieb Liu Ying:
> Hi,
> 
> It looks that the below commit makes my Hannstar XGA LVDS panel stop working
> on the i.MX6DL SabreSD board.  Any idea?
> 
> commit eb10d6355532def3a74aaabd115e2373cca70b9d
> Author: Steve Longerbeam 
> Date:   Thu Dec 18 18:00:24 2014 -0800
> 
> imx-drm: encoder prepare/mode_set must use adjusted mode
> 
> The encoder ->prepare() and ->mode_set() methods need to use the
> hw adjusted mode, not the original mode.
> 
> Signed-off-by: Steve Longerbeam 
> Signed-off-by: Philipp Zabel 
> 
> Regards,
> Liu Ying

What are this panel timings? The adjustment should increase the vertical
back porch by up to two lines (so it is at least two lines), reducing
the front porch or vsync length by the same amount. Does this panel use
the HSYNC/VSYNC signals embedded in the LVDS stream?

regards
Philipp



[PATCH libdrm 1/2] Rename DRM_NODE_RENDER to DRM_NODE_PRIMARY

2015-01-23 Thread Rob Clark
On Wed, Jan 14, 2015 at 9:07 AM, Frank Binns  wrote:
> Now that there are render nodes it doesn't seem appropriate for the type of
> the card nodes to be DRM_NODE_RENDER. For this reason, rename this type to
> DRM_NODE_PRIMARY as this name better represents the purpose of these nodes.
>
> Signed-off-by: Frank Binns 

looks reasonable.. for the series:

Reviewed-by: Rob Clark 

> ---
>  tests/dristat.c |  2 +-
>  xf86drm.c   | 10 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/dristat.c b/tests/dristat.c
> index 4f2ee80..449aa24 100644
> --- a/tests/dristat.c
> +++ b/tests/dristat.c
> @@ -268,7 +268,7 @@ int main(int argc, char **argv)
>
>  for (i = 0; i < 16; i++) if (!minor || i == minor) {
> sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i);
> -   fd = drmOpenMinor(i, 1, DRM_NODE_RENDER);
> +   fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY);
> if (fd >= 0) {
> printf("%s\n", buf);
> if (mask & DRM_BUSID)   getbusid(fd);
> diff --git a/xf86drm.c b/xf86drm.c
> index d900b4b..a23d029 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -86,7 +86,7 @@
>  #define DRM_MSG_VERBOSITY 3
>
>  #define DRM_NODE_CONTROL 0
> -#define DRM_NODE_RENDER 1
> +#define DRM_NODE_PRIMARY 1
>
>  static drmServerInfoPtr drm_server_info;
>
> @@ -444,7 +444,7 @@ int drmAvailable(void)
>  int   retval = 0;
>  int   fd;
>
> -if ((fd = drmOpenMinor(0, 1, DRM_NODE_RENDER)) < 0) {
> +if ((fd = drmOpenMinor(0, 1, DRM_NODE_PRIMARY)) < 0) {
>  #ifdef __linux__
> /* Try proc for backward Linux compatibility */
> if (!access("/proc/dri/0", R_OK))
> @@ -485,7 +485,7 @@ static int drmOpenByBusid(const char *busid)
>
>  drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid);
>  for (i = 0; i < DRM_MAX_MINOR; i++) {
> -   fd = drmOpenMinor(i, 1, DRM_NODE_RENDER);
> +   fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY);
> drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd);
> if (fd >= 0) {
> /* We need to try for 1.4 first for proper PCI domain support
> @@ -547,7 +547,7 @@ static int drmOpenByName(const char *name)
>   * already in use.  If it's in use it will have a busid assigned already.
>   */
>  for (i = 0; i < DRM_MAX_MINOR; i++) {
> -   if ((fd = drmOpenMinor(i, 1, DRM_NODE_RENDER)) >= 0) {
> +   if ((fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY)) >= 0) {
> if ((version = drmGetVersion(fd))) {
> if (!strcmp(version->name, name)) {
> drmFreeVersion(version);
> @@ -591,7 +591,7 @@ static int drmOpenByName(const char *name)
> if (*pt) { /* Found busid */
> return drmOpenByBusid(++pt);
> } else { /* No busid */
> -   return drmOpenDevice(strtol(devstring, NULL, 
> 0),i, DRM_NODE_RENDER);
> +   return drmOpenDevice(strtol(devstring, NULL, 
> 0),i, DRM_NODE_PRIMARY);
> }
> }
> }
> --
> 1.8.5.4.gfd2
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 88745] [RADEONSI] [LLVM] [bisected] GPU hang when running Lightsmark

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88745

Bug ID: 88745
   Summary: [RADEONSI] [LLVM] [bisected] GPU hang when running
Lightsmark
   Product: Mesa
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: arek.rusi at gmail.com
QA Contact: dri-devel at lists.freedesktop.org

Created attachment 112715
  --> https://bugs.freedesktop.org/attachment.cgi?id=112715=edit
dmesg log

GPU hang while running lightsmark (before "penumbra shadows", after "soft
shadows" test).

Befor llvm r222584 [R600/SI: Add an s_mov_b32 to patterns which use the
M0RegClass] problem disappear
llvm-3.5.1 & mesa-git at master works good. 


GPU: Cape Verde XT
ArchLinux x86_64
linux: 1.19rc5
libdrm-git: d2e0f55
mesa-git: 991d5cf (latest mesa didn't build against older llvm3.6svn revision
for me) 
ddx: 7.5.0
xorg: 1.6.3
llvm-svn: r221909 - r226904

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


[PATCH] drm: fix fb-helper vs MST dangling connector ptrs

2015-01-23 Thread Rob Clark
VT switch back/forth from console to xserver (for example) has potential
to go horribly wrong if a dynamic DP MST connector ends up in the saved
modeset that is restored when switching back to fbcon.

When removing a dynamic connector, don't forget to clean up the saved
state.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1184968
Signed-off-by: Rob Clark 
---
 drivers/gpu/drm/drm_fb_helper.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 52ce26d..ff98b31 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -145,6 +145,25 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper 
*fb_helper, struct drm_
 }
 EXPORT_SYMBOL(drm_fb_helper_add_one_connector);

+static void remove_from_modeset(struct drm_mode_set *set,
+   struct drm_connector *connector)
+{
+   int i, j;
+
+   for (i = 0; i < set->num_connectors; i++) {
+   if (set->connectors[i] == connector)
+   break;
+   }
+
+   if (i == set->num_connectors)
+   return;
+
+   for (j = i + 1; j < set->num_connectors; j++) {
+   set->connectors[j - 1] = set->connectors[j];
+   }
+   set->num_connectors--;
+}
+
 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
   struct drm_connector *connector)
 {
@@ -167,6 +186,11 @@ int drm_fb_helper_remove_one_connector(struct 
drm_fb_helper *fb_helper,
}
fb_helper->connector_count--;
kfree(fb_helper_connector);
+
+   /* also cleanup dangling references to the connector: */
+   for (i = 0; i < fb_helper->crtc_count; i++)
+   remove_from_modeset(_helper->crtc_info[i].mode_set, 
connector);
+
return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_remove_one_connector);
-- 
2.1.0



[RFC v2 3/7] cec: add new framework for cec support.

2015-01-23 Thread Sean Young
On Thu, Jan 22, 2015 at 05:04:35PM +0100, Kamil Debski wrote:
> Add the CEC framework.
-snip-
> +Remote control handling
> +---
> +
> +The CEC framework provides two ways of handling the key messages of remote
> +control. In the first case, the CEC framework will handle these messages and
> +provide the keypressed via the RC framework. In the second case the messages
> +related to the key down/up events are not parsed by the framework and are
> +passed to the userspace as raw messages.
> +
> +Switching between these modes is done with a special ioctl.
> +
> +#define CEC_G_KEY_PASSTHROUGH_IOR('a', 10, __u8)
> +#define CEC_S_KEY_PASSTHROUGH_IOW('a', 11, __u8)
> +#define CEC_KEY_PASSTHROUGH_DISABLE  0
> +#define CEC_KEY_PASSTHROUGH_ENABLE   1

This is ugly. This ioctl stops keypresses from going to rc-core. The cec 
device is still registered with rc-core but no keys will be passed to it. 
This could also be handled by loading an empty keymap; this way the input 
layer will still receive scancodes but no keypresses.

> +static ssize_t cec_read(struct file *filp, char __user *buf,
> + size_t sz, loff_t *off)
> +{
> + struct cec_devnode *cecdev = cec_devnode_data(filp);
> +
> + if (!cec_devnode_is_registered(cecdev))
> + return -EIO;
> + return 0;
> +}
> +
> +static ssize_t cec_write(struct file *filp, const char __user *buf,
> + size_t sz, loff_t *off)
> +{
> + struct cec_devnode *cecdev = cec_devnode_data(filp);
> +
> + if (!cec_devnode_is_registered(cecdev))
> + return -EIO;
> + return 0;
> +}

Both read and write do nothing; they should either -ENOSYS or the fuctions
should be removed.


Sean


[PATCH v2 0/7] imx-drm: ipuv3-crtc: Implement mode_fixup

2015-01-23 Thread Liu Ying
Hi,

It looks that the below commit makes my Hannstar XGA LVDS panel stop working
on the i.MX6DL SabreSD board.  Any idea?

commit eb10d6355532def3a74aaabd115e2373cca70b9d
Author: Steve Longerbeam 
Date:   Thu Dec 18 18:00:24 2014 -0800

imx-drm: encoder prepare/mode_set must use adjusted mode

The encoder ->prepare() and ->mode_set() methods need to use the
hw adjusted mode, not the original mode.

Signed-off-by: Steve Longerbeam 
Signed-off-by: Philipp Zabel 

Regards,
Liu Ying

On Wed, Jan 07, 2015 at 07:27:28PM +0100, Philipp Zabel wrote:
> Am Donnerstag, den 18.12.2014, 18:00 -0800 schrieb Steve Longerbeam:
> > This patchset implements ->mode_fixup() in the imx ipuv3-crtc driver,
> > using a new support function ipu_di_adjust_videomode(). This new
> > function needs to be subsystem independent, so it accepts a video
> > mode as a 'struct videomode'. Hence ipu-crtc ->mode_fixup() needs
> > another support function to convert a drm_display_mode to a videomode
> > before passing the mode to ipu_di_adjust_videomode() for fixup.
> > 
> > Also some related code cleanup: 'struct ipu_di_signal_cfg' should
> > use 'struct videomode' for mode timings.
> 
> Alright, I have applied the series with
> s/videomode_from_drm_display_mode/drm_display_mode_to_videomode/
> 
> thanks
> Philipp
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 88456] Brütal Legend lockup

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88456

--- Comment #2 from smoki  ---
 Confirming with Athlon 5350, probably llvm issue again as it does not happen
with llvm perf-Jan-08-2015 + mesa vgpr-spilling-Jan07-2014 tstellar's branches.

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


[PATCH 6/6] drm/exynos: do not copy adjusted mode into mode during crtc mode_set

2015-01-23 Thread Gustavo Padovan
From: Daniel Kurtz 

The 'mode' is the modeline information which specifies the ideal mode
requested by the mode set initiator (usually userspace).
The 'adjusted_mode' is the actual hardware mode after all the crtcs
and encoders have had a chance to "fix it up".

The adjusted_mode starts as a duplicate of the mode in
drm_crtc_helper_set_mode(), and gets modified as required.  There is no
reason to touch the original requested mode.

In fact, doing so will cause us to think a new mode is being requested
whenever userspace tries to establish a new framebuffer with
drmModeSetCrtc(), since userspace will still be using the ideal mode, but
the crtc will be incorrectly comparing it against the adjusted_mode.

Signed-off-by: Daniel Kurtz 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 5cd6c1a..7fd6426 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -91,12 +91,6 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct 
drm_display_mode *mode,
unsigned int crtc_h;
int ret;

-   /*
-* copy the mode data adjusted by mode_fixup() into crtc->mode
-* so that hardware can be seet to proper mode.
-*/
-   memcpy(>mode, adjusted_mode, sizeof(*adjusted_mode));
-
ret = exynos_check_plane(crtc->primary, fb);
if (ret < 0)
return ret;
-- 
1.9.3



[PATCH 5/6] drm/exynos: remove struct *_win_data abstraction on planes

2015-01-23 Thread Gustavo Padovan
From: Gustavo Padovan 

struct {fimd,mixer,vidi}_win_data was just keeping the same data
as struct exynos_drm_plane thus get ride of it and use exynos_drm_plane
directly.

It changes how planes are created and remove .win_mode_set() callback
that was only filling all *_win_data structs.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |   9 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |   1 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c   |  14 --
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |   5 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 181 ++---
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  20 +--
 drivers/gpu/drm/exynos/exynos_drm_plane.h |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 123 -
 drivers/gpu/drm/exynos/exynos_mixer.c | 212 +++---
 9 files changed, 182 insertions(+), 389 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index d0f4e1b..5cd6c1a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -287,13 +287,13 @@ static void exynos_drm_crtc_attach_mode_property(struct 
drm_crtc *crtc)
 }

 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
+  struct drm_plane *plane,
   int pipe,
   enum exynos_drm_output_type type,
   struct exynos_drm_crtc_ops *ops,
   void *ctx)
 {
struct exynos_drm_crtc *exynos_crtc;
-   struct drm_plane *plane;
struct exynos_drm_private *private = drm_dev->dev_private;
struct drm_crtc *crtc;
int ret;
@@ -309,12 +309,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
exynos_crtc->type = type;
exynos_crtc->ops = ops;
exynos_crtc->ctx = ctx;
-   plane = exynos_plane_init(drm_dev, 1 << pipe,
- DRM_PLANE_TYPE_PRIMARY);
-   if (IS_ERR(plane)) {
-   ret = PTR_ERR(plane);
-   goto err_plane;
-   }

crtc = _crtc->base;

@@ -333,7 +327,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,

 err_crtc:
plane->funcs->destroy(plane);
-err_plane:
kfree(exynos_crtc);
return ERR_PTR(ret);
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 628b787..0ecd8fc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -18,6 +18,7 @@
 #include "exynos_drm_drv.h"

 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
+  struct drm_plane *plane,
   int pipe,
   enum exynos_drm_output_type type,
   struct exynos_drm_crtc_ops *ops,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 731cdbc..1fa2a7f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -55,7 +55,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)
 {
struct exynos_drm_private *private;
int ret;
-   int nr;

private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
if (!private)
@@ -80,19 +79,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned 
long flags)

exynos_drm_mode_config_init(dev);

-   for (nr = 0; nr < MAX_PLANE; nr++) {
-   struct drm_plane *plane;
-   unsigned long possible_crtcs = (1 << MAX_CRTC) - 1;
-
-   plane = exynos_plane_init(dev, possible_crtcs,
- DRM_PLANE_TYPE_OVERLAY);
-   if (!IS_ERR(plane))
-   continue;
-
-   ret = PTR_ERR(plane);
-   goto err_mode_config_cleanup;
-   }
-
/* setup possible_clones. */
exynos_drm_encoder_setup(dev);

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 7411af2..cad54e7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -78,6 +78,7 @@ enum exynos_drm_output_type {
  * @transparency: transparency on or off.
  * @activated: activated or not.
  * @enabled: enabled or not.
+ * @resume: to resume or not.
  *
  * this structure is common to exynos SoC and its contents would be copied
  * to hardware specific overlay info.
@@ -112,6 +113,7 @@ struct exynos_drm_plane {
bool transparency:1;
bool activated:1;
bool enabled:1;
+   

[PATCH 4/6] drm/exynos: remove leftover functions declarations

2015-01-23 Thread Gustavo Padovan
From: Gustavo Padovan 

These functions were already removed by previous cleanup work, but these
ones were left behind.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 6258b80..628b787 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -27,12 +27,6 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, 
int pipe);
 void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb);

-void exynos_drm_crtc_plane_mode_set(struct drm_crtc *crtc,
-   struct exynos_drm_plane *plane);
-void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos);
-void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos);
-void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos);
-
 /* This function gets pipe value to crtc device matched with out_type. */
 int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev,
unsigned int out_type);
-- 
1.9.3



[PATCH 3/6] drm/exynos: Remove exynos_plane_dpms() call with no effect

2015-01-23 Thread Gustavo Padovan
From: Gustavo Padovan 

exynos_plane_dpms(DRM_MODE_DPMS_ON) calls the win_enable()'s callback
from the underlying layer. However neither one of these layers implement
win_enable() - FIMD, Mixer and VIDI. Thus the call to exynos_plane_dpms()
is pointless.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index b1f1b25..d0f4e1b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -65,8 +65,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)

if (exynos_crtc->ops->commit)
exynos_crtc->ops->commit(exynos_crtc);
-
-   exynos_plane_dpms(crtc->primary, DRM_MODE_DPMS_ON);
 }

 static bool
-- 
1.9.3



[PATCH 2/6] drm/exynos: track vblank events on a per crtc basis

2015-01-23 Thread Gustavo Padovan
From: Mandeep Singh Baines 

The goal of the change is to make sure we send the vblank event on the
current vblank. My hope is to fix any races that might be causing flicker.
After this change I only see a flicker in the transition plymouth and
X11.

Simplified the code by tracking vblank events on a per-crtc basis. This
allowed me to remove all error paths from the callback. It also allowed
me to remove the vblank wait from the callback.

Signed-off-by: Mandeep Singh Baines 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 39 
 drivers/gpu/drm/exynos/exynos_drm_drv.c  | 19 
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  6 ++---
 3 files changed, 12 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index a85c451..b1f1b25 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -34,9 +34,8 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int 
mode)
if (mode > DRM_MODE_DPMS_ON) {
/* wait for the completion of page flip. */
if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-   !atomic_read(_crtc->pending_flip),
-   HZ/20))
-   atomic_set(_crtc->pending_flip, 0);
+   (exynos_crtc->event == NULL), HZ/20))
+   exynos_crtc->event = NULL;
drm_crtc_vblank_off(crtc);
}

@@ -166,7 +165,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 uint32_t page_flip_flags)
 {
struct drm_device *dev = crtc->dev;
-   struct exynos_drm_private *dev_priv = dev->dev_private;
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_framebuffer *old_fb = crtc->primary->fb;
unsigned int crtc_w, crtc_h;
@@ -194,12 +192,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
goto out;
}

-   spin_lock_irq(>event_lock);
-   list_add_tail(>base.link,
-   _priv->pageflip_event_list);
-   atomic_set(_crtc->pending_flip, 1);
-   spin_unlock_irq(>event_lock);
-
crtc->primary->fb = fb;
crtc_w = fb->width - crtc->x;
crtc_h = fb->height - crtc->y;
@@ -209,14 +201,12 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
*crtc,
if (ret) {
crtc->primary->fb = old_fb;

-   spin_lock_irq(>event_lock);
drm_vblank_put(dev, exynos_crtc->pipe);
-   list_del(>base.link);
-   atomic_set(_crtc->pending_flip, 0);
-   spin_unlock_irq(>event_lock);

goto out;
}
+
+   exynos_crtc->event = event;
}
 out:
mutex_unlock(>struct_mutex);
@@ -315,7 +305,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
return ERR_PTR(-ENOMEM);

init_waitqueue_head(_crtc->pending_flip_queue);
-   atomic_set(_crtc->pending_flip, 0);

exynos_crtc->dpms = DRM_MODE_DPMS_OFF;
exynos_crtc->pipe = pipe;
@@ -382,27 +371,19 @@ void exynos_drm_crtc_disable_vblank(struct drm_device 
*dev, int pipe)
 void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe)
 {
struct exynos_drm_private *dev_priv = dev->dev_private;
-   struct drm_pending_vblank_event *e, *t;
struct drm_crtc *drm_crtc = dev_priv->crtc[pipe];
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(drm_crtc);
-   unsigned long flags;

-   spin_lock_irqsave(>event_lock, flags);
+   if (exynos_crtc->event) {

-   list_for_each_entry_safe(e, t, _priv->pageflip_event_list,
-   base.link) {
-   /* if event's pipe isn't same as crtc then ignore it. */
-   if (pipe != e->pipe)
-   continue;
-
-   list_del(>base.link);
-   drm_send_vblank_event(dev, -1, e);
+   spin_lock_irq(>event_lock);
+   drm_send_vblank_event(dev, -1, exynos_crtc->event);
drm_vblank_put(dev, pipe);
-   atomic_set(_crtc->pending_flip, 0);
wake_up(_crtc->pending_flip_queue);
-   }
+   spin_unlock_irq(>event_lock);

-   spin_unlock_irqrestore(>event_lock, flags);
+   exynos_crtc->event = NULL;
+   }
 }

 void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index b60fd9b..731cdbc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ 

[PATCH 1/6] drm/exynos: remove leftover code using event_list

2015-01-23 Thread Gustavo Padovan
From: Gustavo Padovan 

The drm_file event_list hasn't been used anymore by exynos, so we don't
need any code to clean it.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 25ba362..b60fd9b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -256,11 +256,6 @@ static void exynos_drm_postclose(struct drm_device *dev, 
struct drm_file *file)
}
}

-   /* Release all events handled by page flip handler but not freed. */
-   list_for_each_entry_safe(e, et, >event_list, link) {
-   list_del(>link);
-   e->destroy(e);
-   }
spin_unlock_irqrestore(>event_lock, flags);

kfree(file->driver_priv);
-- 
1.9.3



[PATCH v2] clk: Introduce clk_has_parent()

2015-01-23 Thread Thierry Reding
On Thu, Jan 22, 2015 at 12:25:46PM -0800, Stephen Boyd wrote:
> On 01/22, Thierry Reding wrote:
> > On Wed, Jan 21, 2015 at 04:16:05PM -0800, Stephen Boyd wrote:
> > > On 01/21/2015 08:13 AM, Thierry Reding wrote:
> > > > From: Thierry Reding 
> > > >
> > > > This new function is similar to clk_set_parent(), except that it doesn't
> > > > actually change the parent. It merely checks that the given parent clock
> > > > can be a parent for the given clock.
> > > >
> > > > A situation where this is useful is to check that a particular setup is
> > > > valid before switching to it. One specific use-case for this is atomic
> > > > modesetting in the DRM framework where setting a mode is divided into a
> > > > check phase where a given configuration is validated before applying
> > > > changes to the hardware.
> > > >
> > > > Cc: Russell King 
> > > > Cc: Mike Turquette 
> > > > Cc: Stephen Boyd 
> > > > Signed-off-by: Thierry Reding 
> > > > ---
> > > 
> > > Reviewed-by: Stephen Boyd 
> > > 
> > > This will slightly conflict with Tomeu's  patches for per-user clock
> > > constraints. It would be best if we can take this through the clk tree
> > > to fix up any conflicts
> > 
> > I had hoped to take this through the drm tree to resolve the build-time.
> > Another possibility would be for me to include the clk tree (or a subset
> > thereof) in my pull-request. That way you can still fix things up in the
> > clock tree if there are any conflicts with other work. We could make
> > that work two ways: this patch gets applied to the clk tree and I pull
> > it, or I provide a stable branch that I base my pull request on and that
> > branch can be pulled into the clk tree.
> > 
> > Yet another alternative would be to split out the clk_has_parent()
> > change from the series and not use it for now. That way we're going to
> > miss this check, but we do that anyway currently and it will only be
> > temporary until v3.21.
> > 
> > Perhaps given where we are in the release cycle the latter would make
> > the most sense for now.
> 
> Ok well let's see what Mike wants to do given that he's doing all
> the patch applying right now. I'd think that we could put this
> one patch on a different branch that we can merge into clk-next
> and you can merge into the drm tree. At least that's the typical
> workflow that usually works for everyone.

I will be sending out a pull request today, so I'm not going to include
this patch or the dependent patch. I'll pick it up again after the merge
window and see if I need to rebase it on top of Tomeu's work.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150123/f4499650/attachment.sig>


[PATCH 05/36] drm/atomic: Add drm_atomic_plane_get_crtc_state()

2015-01-23 Thread Thierry Reding
On Tue, Jan 20, 2015 at 12:10:11PM +0100, Daniel Vetter wrote:
> On Tue, Jan 20, 2015 at 11:48:24AM +0100, Thierry Reding wrote:
> > From: Thierry Reding 
> > 
> > This function is useful to obtain the state of the CRTC that a plane is
> > being attached to.
> > 
> > Signed-off-by: Thierry Reding 
> > ---
> >  include/drm/drm_atomic.h | 21 +
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> > index 51168a8b723a..ddca107e5cce 100644
> > --- a/include/drm/drm_atomic.h
> > +++ b/include/drm/drm_atomic.h
> > @@ -75,4 +75,25 @@ int __must_check drm_atomic_check_only(struct 
> > drm_atomic_state *state);
> >  int __must_check drm_atomic_commit(struct drm_atomic_state *state);
> >  int __must_check drm_atomic_async_commit(struct drm_atomic_state *state);
> >  
> > +/**
> > + * drm_atomic_plane_get_crtc_state - obtain atomic state of the CRTC that a
> > + * plane is being attached to
> > + * @state: atomic state of plane
> > + *
> > + * Getting the atomic state of the CRTC that a given plane being attached 
> > to
> > + * is non-trivial. We need to look at the global atomic state that the 
> > plane
> > + * state is part of and extract the CRTC state using the CRTC's index. 
> > Using
> > + * the drm_atomic_get_crtc_state() helper we make sure to acquire the 
> > proper
> > + * locks, too.
> > + *
> > + * RETURNS:
> > + * The atomic state of the CRTC that the plane is being attached to, or an
> > + * ERR_PTR()-encoded negative error code on failure.
> > + */
> > +static inline struct drm_crtc_state *
> > +drm_atomic_plane_get_crtc_state(struct drm_plane_state *state)
> > +{
> > +   return drm_atomic_get_crtc_state(state->state, state->crtc);
> 
> Hm, imo open-coding this is totally ok. Actually better since state->crtc
> might be NULL, and hiding that isn't a good idea.
> 
> If you have a atomic_plane_disable hook then ->crtc is guaranteed to be
> non-NULL in atomic_plane_update, but being explicit here is imo a feature.
> So nacked from my side.

I've dropped this patch and open-coded this call in patch 34/36.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150123/4ed9e771/attachment.sig>


[PATCH v2] drm/tegra: Track active planes in CRTC state

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

Wrap struct drm_crtc_state in a driver-specific structure and add the
planes field which keeps track of which planes are updated or disabled
during a modeset. This allows atomic updates of the the display engine
at ->atomic_flush() time.

v2: open-code getting the state of the CRTC that the plane is being
attached to (Daniel Vetter)

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/tegra/dc.c | 72 --
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 5da1b59e7cfd..c283ea4d0095 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -54,6 +54,8 @@ struct tegra_dc_state {
struct clk *clk;
unsigned long pclk;
unsigned int div;
+
+   u32 planes;
 };

 static inline struct tegra_dc_state *to_dc_state(struct drm_crtc_state *state)
@@ -64,20 +66,6 @@ static inline struct tegra_dc_state *to_dc_state(struct 
drm_crtc_state *state)
return NULL;
 }

-static void tegra_dc_window_commit(struct tegra_dc *dc, unsigned int index)
-{
-   u32 value = WIN_A_ACT_REQ << index;
-
-   tegra_dc_writel(dc, value << 8, DC_CMD_STATE_CONTROL);
-   tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
-}
-
-static void tegra_dc_cursor_commit(struct tegra_dc *dc)
-{
-   tegra_dc_writel(dc, CURSOR_ACT_REQ << 8, DC_CMD_STATE_CONTROL);
-   tegra_dc_writel(dc, CURSOR_ACT_REQ, DC_CMD_STATE_CONTROL);
-}
-
 /*
  * Reads the active copy of a register. This takes the dc->lock spinlock to
  * prevent races with the VBLANK processing which also needs access to the
@@ -395,8 +383,6 @@ static void tegra_dc_setup_window(struct tegra_dc *dc, 
unsigned int index,
break;
}

-   tegra_dc_window_commit(dc, index);
-
spin_unlock_irqrestore(>lock, flags);
 }

@@ -439,9 +425,28 @@ static void tegra_plane_cleanup_fb(struct drm_plane *plane,
 {
 }

+static int tegra_plane_state_add(struct tegra_plane *plane,
+struct drm_plane_state *state)
+{
+   struct drm_crtc_state *crtc_state;
+   struct tegra_dc_state *tegra;
+
+   /* Propagate errors from allocation or locking failures. */
+   crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
+   if (IS_ERR(crtc_state))
+   return PTR_ERR(crtc_state);
+
+   tegra = to_dc_state(crtc_state);
+
+   tegra->planes |= WIN_A_ACT_REQ << plane->index;
+
+   return 0;
+}
+
 static int tegra_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
 {
+   struct tegra_plane *tegra = to_tegra_plane(plane);
struct tegra_dc *dc = to_tegra_dc(state->crtc);
struct tegra_bo_tiling tiling;
int err;
@@ -472,6 +477,10 @@ static int tegra_plane_atomic_check(struct drm_plane 
*plane,
}
}

+   err = tegra_plane_state_add(tegra, state);
+   if (err < 0)
+   return err;
+
return 0;
 }

@@ -538,8 +547,6 @@ static void tegra_plane_atomic_disable(struct drm_plane 
*plane,
value &= ~WIN_ENABLE;
tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS);

-   tegra_dc_window_commit(dc, p->index);
-
spin_unlock_irqrestore(>lock, flags);
 }

@@ -599,6 +606,9 @@ static const u32 tegra_cursor_plane_formats[] = {
 static int tegra_cursor_atomic_check(struct drm_plane *plane,
 struct drm_plane_state *state)
 {
+   struct tegra_plane *tegra = to_tegra_plane(plane);
+   int err;
+
/* no need for further checks if the plane is being disabled */
if (!state->crtc)
return 0;
@@ -616,6 +626,10 @@ static int tegra_cursor_atomic_check(struct drm_plane 
*plane,
state->crtc_w != 128 && state->crtc_w != 256)
return -EINVAL;

+   err = tegra_plane_state_add(tegra, state);
+   if (err < 0)
+   return err;
+
return 0;
 }

@@ -680,9 +694,6 @@ static void tegra_cursor_atomic_update(struct drm_plane 
*plane,
value = (state->crtc_y & 0x3fff) << 16 | (state->crtc_x & 0x3fff);
tegra_dc_writel(dc, value, DC_DISP_CURSOR_POSITION);

-   /* apply changes */
-   tegra_dc_cursor_commit(dc);
-   tegra_dc_commit(dc);
 }

 static void tegra_cursor_atomic_disable(struct drm_plane *plane,
@@ -700,9 +711,6 @@ static void tegra_cursor_atomic_disable(struct drm_plane 
*plane,
value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
value &= ~CURSOR_ENABLE;
tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
-
-   tegra_dc_cursor_commit(dc);
-   tegra_dc_commit(dc);
 }

 static const struct drm_plane_funcs tegra_cursor_plane_funcs = {
@@ -734,6 +742,13 @@ static struct drm_plane 
*tegra_dc_cursor_plane_create(struct drm_device *drm,
if (!plane)
return ERR_PTR(-ENOMEM);

[PATCH v4] drm/plane: Add optional ->atomic_disable() callback

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

In order to prevent drivers from having to perform the same checks over
and over again, add an optional ->atomic_disable callback which the core
calls under the right circumstances.

v2: pass old state and detect edges to avoid calling ->atomic_disable on
already disabled planes, remove redundant comment (Daniel Vetter)

v3: rename helper to drm_atomic_plane_disabling() to clarify that it is
checking for transitions, move helper to drm_atomic_helper.h, clarify
check for !old_state and its relation to transitional helpers

Here's an extract from some discussion rationalizing the behaviour (for
a full version, see the reference below):

> > Hm, thinking about this some more this will result in a slight 
difference
> > in behaviour, at least when drivers just use the helper ->reset 
functions
> > but don't disable everything:
> > - With transitional helpers we assume we know nothing and call
> >   ->atomic_disable.
> > - With atomic old_state->crtc == NULL in the same situation right after
> >   boot-up, but we asssume the plane is really off and _dont_ call
> >   ->atomic_disable.
> >
> > Should we instead check for (old_state && old_state->crtc) and state 
that
> > drivers need to make sure they don't have stuff hanging around?
>
> I don't think we can check for old_state because otherwise this will
> always return false, whereas we really want it to force-disable planes
> that could be on (lacking any more accurate information). For
> transitional helpers anyway.
>
> For the atomic helpers, old_state will never be NULL, but I'd assume
> that the driver would reconstruct the current state in ->reset().

By the way, the reason for why old_state can be NULL with transitional
helpers is the ordering of the steps in the atomic transition. Currently
the Tegra patches do this (based on your blog post and the Exynos proto-
type):

1) atomic conversion, phase 1:
   - implement ->atomic_{check,update,disable}()
   - use drm_plane_helper_{update,disable}()

2) atomic conversion, phase 2:
   - call drm_mode_config_reset() from ->load()
   - implement ->reset()

That's only a partial list of what's done in these steps, but that's the
only relevant pieces for why old_state is NULL.

What happens is that without ->reset() implemented there won't be any
initial state, hence plane->state (the old_state here) will be NULL the
first time atomic state is applied.

We could of course reorder the sequence such that drivers are required
to hook up ->reset() before they can (or at the same as they) hook up
the transitional helpers. We could add an appropriate WARN_ON to this
helper to make that more obvious.

However, that will not solve the problem because it only gets rid of the
special case. We still don't know whether old_state->crtc == NULL is the
current state or just the initial default.

So no matter which way we do this, I don't see a way to get away without
requiring specific semantics from drivers. They would be that:

- drivers recreate the correct state in ->reset() so that
  old_state->crtc != NULL if the plane is really enabled

or

- drivers have to ensure that the real state in fact mirrors the
  initial default as encoded in the state (plane disabled)

References: 
http://lists.freedesktop.org/archives/dri-devel/2015-January/075578.html
Reviewed-by: Daniel Vetter 
Reviewed-by: Gustavo Padovan 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/drm_atomic_helper.c |  9 -
 drivers/gpu/drm/drm_plane_helper.c  | 10 +-
 include/drm/drm_atomic_helper.h | 37 +
 include/drm/drm_plane_helper.h  |  3 +++
 4 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 010661f23035..1cb04402cd73 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1113,7 +1113,14 @@ void drm_atomic_helper_commit_planes(struct drm_device 
*dev,

old_plane_state = old_state->plane_states[i];

-   funcs->atomic_update(plane, old_plane_state);
+   /*
+* Special-case disabling the plane if drivers support it.
+*/
+   if (drm_atomic_plane_disabling(plane, old_plane_state) &&
+   funcs->atomic_disable)
+   funcs->atomic_disable(plane, old_plane_state);
+   else
+   funcs->atomic_update(plane, old_plane_state);
}

for (i = 0; i < ncrtcs; i++) {
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 2f961c180273..02c1a0b74e04 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ 

[PATCH v2] drm/plane: Make ->atomic_update() mandatory

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

There is no use-case where it would be useful for drivers not to
implement this function and the transitional plane helpers already
require drivers to provide an implementation.

v2: add new requirement to kerneldoc

Reviewed-by: Daniel Vetter 
Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/drm_atomic_helper.c | 2 +-
 include/drm/drm_plane_helper.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index d467185f7942..010661f23035 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1108,7 +1108,7 @@ void drm_atomic_helper_commit_planes(struct drm_device 
*dev,

funcs = plane->helper_private;

-   if (!funcs || !funcs->atomic_update)
+   if (!funcs)
continue;

old_plane_state = old_state->plane_states[i];
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 0f2230311aa8..a44139abbd5e 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -51,7 +51,7 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc 
*crtc,
  * @prepare_fb: prepare a framebuffer for use by the plane
  * @cleanup_fb: cleanup a framebuffer when it's no longer used by the plane
  * @atomic_check: check that a given atomic state is valid and can be applied
- * @atomic_update: apply an atomic state to the plane
+ * @atomic_update: apply an atomic state to the plane (mandatory)
  *
  * The helper operations are called by the mid-layer CRTC helper.
  */
-- 
2.1.3



[PATCH 02/36] drm/plane: Make ->atomic_update() mandatory

2015-01-23 Thread Thierry Reding
On Tue, Jan 20, 2015 at 08:51:15AM -0500, Rob Clark wrote:
> On Tue, Jan 20, 2015 at 5:48 AM, Thierry Reding
>  wrote:
> > From: Thierry Reding 
> >
> > There is no use-case where it would be useful for drivers not to
> > implement this function and the transitional plane helpers already
> > require drivers to provide an implementation.
> >
> > Signed-off-by: Thierry Reding 
> > ---
> >  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 d467185f7942..010661f23035 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1108,7 +1108,7 @@ void drm_atomic_helper_commit_planes(struct 
> > drm_device *dev,
> >
> > funcs = plane->helper_private;
> >
> > -   if (!funcs || !funcs->atomic_update)
> > +   if (!funcs)
> 
> maybe WARN_ON() here.. or drm_universal_plane_init(), or somewhere,
> for missing mandatory fxns would be a nice thing to avoid explosions
> under console_lock for first modeset?

WARN_ON() here isn't going to do you any good under console_lock and
may drivers use drm_universal_plane_init() without having converted to
atomic mode-setting.

Adding a comment to kerneldoc that it's mandatory is probably the best
we can do here.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150123/515b004c/attachment.sig>


[PATCH v2 1/2] drm/rockchip: vop use is_enabled instead of dpms mode

2015-01-23 Thread Daniel Kurtz
On Thu, Jan 22, 2015 at 6:29 PM, Mark Yao  wrote:
> drm dpms have many power modes: ON,OFF,SUSPEND,STANDBY, etc.
> but vop only have enable/disable mode, maybe case such bug:
>  --> DRM_DPMS_ON: power on vop
>  --> DRM_DPMS_SUSPEND: power off vop
>  --> DRM_DPMS_OFF: already power off at SUSPEND, crash
> so use a bool val is more suitable.
>
> Signed-off-by: Mark Yao 

This version looks good.  Moving to atomic is definitely important,
and part of the plan.
For now, though, this series is:

Reviewed-by: Daniel Kurtz 

> ---
> Changes in v2:
> - fix mistake that set is_enabled wrong.
>
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   34 
> ++-
>  1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 9a5c571..d03eb7e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -81,7 +81,7 @@ struct vop {
> struct drm_crtc crtc;
> struct device *dev;
> struct drm_device *drm_dev;
> -   unsigned int dpms;
> +   bool is_enabled;
>
> int connector_type;
> int connector_out_mode;
> @@ -387,6 +387,9 @@ static void vop_enable(struct drm_crtc *crtc)
> struct vop *vop = to_vop(crtc);
> int ret;
>
> +   if (vop->is_enabled)
> +   return;
> +
> ret = clk_enable(vop->hclk);
> if (ret < 0) {
> dev_err(vop->dev, "failed to enable hclk - %d\n", ret);
> @@ -427,6 +430,8 @@ static void vop_enable(struct drm_crtc *crtc)
>
> drm_vblank_on(vop->drm_dev, vop->pipe);
>
> +   vop->is_enabled = true;
> +
> return;
>
>  err_disable_aclk:
> @@ -441,6 +446,9 @@ static void vop_disable(struct drm_crtc *crtc)
>  {
> struct vop *vop = to_vop(crtc);
>
> +   if (!vop->is_enabled)
> +   return;
> +
> drm_vblank_off(crtc->dev, vop->pipe);
>
> disable_irq(vop->irq);
> @@ -463,6 +471,8 @@ static void vop_disable(struct drm_crtc *crtc)
>
> clk_disable(vop->aclk);
> clk_disable(vop->hclk);
> +
> +   vop->is_enabled = false;
>  }
>
>  /*
> @@ -742,7 +752,7 @@ static int vop_crtc_enable_vblank(struct drm_crtc *crtc)
> struct vop *vop = to_vop(crtc);
> unsigned long flags;
>
> -   if (vop->dpms != DRM_MODE_DPMS_ON)
> +   if (!vop->is_enabled)
> return -EPERM;
>
> spin_lock_irqsave(>irq_lock, flags);
> @@ -759,8 +769,9 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc)
> struct vop *vop = to_vop(crtc);
> unsigned long flags;
>
> -   if (vop->dpms != DRM_MODE_DPMS_ON)
> +   if (!vop->is_enabled)
> return;
> +
> spin_lock_irqsave(>irq_lock, flags);
> vop_mask_write(vop, INTR_CTRL0, FS_INTR_MASK, FS_INTR_EN(0));
> spin_unlock_irqrestore(>irq_lock, flags);
> @@ -773,15 +784,8 @@ static const struct rockchip_crtc_funcs 
> private_crtc_funcs = {
>
>  static void vop_crtc_dpms(struct drm_crtc *crtc, int mode)
>  {
> -   struct vop *vop = to_vop(crtc);
> -
> DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
>
> -   if (vop->dpms == mode) {
> -   DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
> -   return;
> -   }
> -
> switch (mode) {
> case DRM_MODE_DPMS_ON:
> vop_enable(crtc);
> @@ -795,8 +799,6 @@ static void vop_crtc_dpms(struct drm_crtc *crtc, int mode)
> DRM_DEBUG_KMS("unspecified mode %d\n", mode);
> break;
> }
> -
> -   vop->dpms = mode;
>  }
>
>  static void vop_crtc_prepare(struct drm_crtc *crtc)
> @@ -934,9 +936,9 @@ static int vop_crtc_page_flip(struct drm_crtc *crtc,
> struct drm_framebuffer *old_fb = crtc->primary->fb;
> int ret;
>
> -   /* when the page flip is requested, crtc's dpms should be on */
> -   if (vop->dpms > DRM_MODE_DPMS_ON) {
> -   DRM_DEBUG("failed page flip request at dpms[%d].\n", 
> vop->dpms);
> +   /* when the page flip is requested, crtc should be on */
> +   if (!vop->is_enabled) {
> +   DRM_DEBUG("page flip request rejected because crtc is 
> off.\n");
> return 0;
> }
>
> @@ -1302,7 +1304,7 @@ static int vop_initial(struct vop *vop)
>
> clk_disable(vop->hclk);
>
> -   vop->dpms = DRM_MODE_DPMS_OFF;
> +   vop->is_enabled = false;
>
> return 0;
>
> --
> 1.7.9.5
>
>


[Bug 88456] Brütal Legend lockup

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88456

--- Comment #1 from Clément Guérin  ---
The apitrace has been downloaded a few times but no one replied... Can anyone
confirm? Thanks.

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


[PATCH] drm/atomic: Fix potential use of state after free

2015-01-23 Thread Ander Conselvan de Oliveira
The atomic helpers rely on drm_atomic_state_clear() to reset an atomic
state if a retry is needed due to the w/w mutexes. The subsequent calls
to drm_atomic_get_{crtc,plane,...}_state() would then return the stale
pointers in state->{crtc,plane,...}_states.

Signed-off-by: Ander Conselvan de Oliveira 
---
 drivers/gpu/drm/drm_atomic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 1b31982..9d16fa4 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -134,6 +134,7 @@ void drm_atomic_state_clear(struct drm_atomic_state *state)

connector->funcs->atomic_destroy_state(connector,
   
state->connector_states[i]);
+   state->connector_states[i] = NULL;
}

for (i = 0; i < config->num_crtc; i++) {
@@ -144,6 +145,7 @@ void drm_atomic_state_clear(struct drm_atomic_state *state)

crtc->funcs->atomic_destroy_state(crtc,
  state->crtc_states[i]);
+   state->crtc_states[i] = NULL;
}

for (i = 0; i < config->num_total_plane; i++) {
@@ -154,6 +156,7 @@ void drm_atomic_state_clear(struct drm_atomic_state *state)

plane->funcs->atomic_destroy_state(plane,
   state->plane_states[i]);
+   state->plane_states[i] = NULL;
}
 }
 EXPORT_SYMBOL(drm_atomic_state_clear);
-- 
1.9.1



[Bug 88719] While using nine gallium tracker and wine Dark Souls 2 causes gpu hang

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88719

Michel Dänzer  changed:

   What|Removed |Added

  Component|DRM/Radeon  |Drivers/Gallium/r600
Version|XOrg git|git
Product|DRI |Mesa
 QA Contact||dri-devel at lists.freedesktop
   ||.org

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


[PATCH] drm/mm: Support 4 GiB and larger ranges

2015-01-23 Thread Thierry Reding
From: Thierry Reding 

The current implementation is limited by the number of addresses that
fit into an unsigned long. This causes problems on 32-bit Tegra where
unsigned long is 32-bit but drm_mm is used to manage an IOVA space of
4 GiB. Given the 32-bit limitation, the range is limited to 4 GiB - 1
(or 4 GiB - 4 KiB for page granularity).

This commit changes the start and size of the range to be an unsigned
64-bit integer, thus allowing much larger ranges to be supported.

Signed-off-by: Thierry Reding 
---
 drivers/gpu/drm/drm_mm.c | 152 ---
 include/drm/drm_mm.h |  52 
 2 files changed, 105 insertions(+), 99 deletions(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 04a209e2b66d..7fc6f8bd4821 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -91,29 +91,29 @@
  */

 static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm,
-   unsigned long size,
+   u64 size,
unsigned alignment,
unsigned long color,
enum drm_mm_search_flags flags);
 static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct 
drm_mm *mm,
-   unsigned long size,
+   u64 size,
unsigned alignment,
unsigned long color,
-   unsigned long start,
-   unsigned long end,
+   u64 start,
+   u64 end,
enum drm_mm_search_flags flags);

 static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
 struct drm_mm_node *node,
-unsigned long size, unsigned alignment,
+u64 size, unsigned alignment,
 unsigned long color,
 enum drm_mm_allocator_flags flags)
 {
struct drm_mm *mm = hole_node->mm;
-   unsigned long hole_start = drm_mm_hole_node_start(hole_node);
-   unsigned long hole_end = drm_mm_hole_node_end(hole_node);
-   unsigned long adj_start = hole_start;
-   unsigned long adj_end = hole_end;
+   u64 hole_start = drm_mm_hole_node_start(hole_node);
+   u64 hole_end = drm_mm_hole_node_end(hole_node);
+   u64 adj_start = hole_start;
+   u64 adj_end = hole_end;

BUG_ON(node->allocated);

@@ -124,12 +124,15 @@ static void drm_mm_insert_helper(struct drm_mm_node 
*hole_node,
adj_start = adj_end - size;

if (alignment) {
-   unsigned tmp = adj_start % alignment;
-   if (tmp) {
+   u64 tmp = adj_start;
+   unsigned rem;
+
+   rem = do_div(tmp, alignment);
+   if (rem) {
if (flags & DRM_MM_CREATE_TOP)
-   adj_start -= tmp;
+   adj_start -= rem;
else
-   adj_start += alignment - tmp;
+   adj_start += alignment - rem;
}
}

@@ -176,9 +179,9 @@ static void drm_mm_insert_helper(struct drm_mm_node 
*hole_node,
 int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
 {
struct drm_mm_node *hole;
-   unsigned long end = node->start + node->size;
-   unsigned long hole_start;
-   unsigned long hole_end;
+   u64 end = node->start + node->size;
+   u64 hole_start;
+   u64 hole_end;

BUG_ON(node == NULL);

@@ -227,7 +230,7 @@ EXPORT_SYMBOL(drm_mm_reserve_node);
  * 0 on success, -ENOSPC if there's no suitable hole.
  */
 int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
-  unsigned long size, unsigned alignment,
+  u64 size, unsigned alignment,
   unsigned long color,
   enum drm_mm_search_flags sflags,
   enum drm_mm_allocator_flags aflags)
@@ -246,16 +249,16 @@ EXPORT_SYMBOL(drm_mm_insert_node_generic);

 static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
   struct drm_mm_node *node,
-  unsigned long size, unsigned alignment,
+  u64 size, unsigned alignment,
   unsigned long color,
-  

[PATCH] drm/atomic: Fix potential use of state after free

2015-01-23 Thread Daniel Vetter
On Fri, Jan 23, 2015 at 09:27:59AM +0200, Ander Conselvan de Oliveira wrote:
> The atomic helpers rely on drm_atomic_state_clear() to reset an atomic
> state if a retry is needed due to the w/w mutexes. The subsequent calls
> to drm_atomic_get_{crtc,plane,...}_state() would then return the stale
> pointers in state->{crtc,plane,...}_states.
> 
> Signed-off-by: Ander Conselvan de Oliveira  intel.com>

Oops, pretty bad oversight. Kinda wonder why that hasn't blown up
anywhere yet - plain legacy paths can't really fail with retries yet since
we usually grab all the locks. But real atomic_ioctl should have fallen
over with ww mutex debugging ...

Anyway, thanks for the patch, applied to my atomic branch.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 1b31982..9d16fa4 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -134,6 +134,7 @@ void drm_atomic_state_clear(struct drm_atomic_state 
> *state)
>  
>   connector->funcs->atomic_destroy_state(connector,
>  
> state->connector_states[i]);
> + state->connector_states[i] = NULL;
>   }
>  
>   for (i = 0; i < config->num_crtc; i++) {
> @@ -144,6 +145,7 @@ void drm_atomic_state_clear(struct drm_atomic_state 
> *state)
>  
>   crtc->funcs->atomic_destroy_state(crtc,
> state->crtc_states[i]);
> + state->crtc_states[i] = NULL;
>   }
>  
>   for (i = 0; i < config->num_total_plane; i++) {
> @@ -154,6 +156,7 @@ void drm_atomic_state_clear(struct drm_atomic_state 
> *state)
>  
>   plane->funcs->atomic_destroy_state(plane,
>  state->plane_states[i]);
> + state->plane_states[i] = NULL;
>   }
>  }
>  EXPORT_SYMBOL(drm_atomic_state_clear);
> -- 
> 1.9.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH] drm/exynos: IOMMU support should not be selectable by user

2015-01-23 Thread Marek Szyprowski
Hello,

On 2015-01-23 00:19, Tobias Jakobi wrote:
> Marek Szyprowski wrote:
>> If system provides IOMMU feature, Exynos DRM should use it by default,
>> because the Exynos DRM subdrivers don't work correctly when Exynos IOMMU
>> driver has been enabled and no IOMMU support has been compiled into Exynos
>> DRM driver.
>>
>> Signed-off-by: Marek Szyprowski 
>> ---
>>   drivers/gpu/drm/exynos/Kconfig | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
>> index 7f9f6f9e9b7e..39fe490efcd4 100644
>> --- a/drivers/gpu/drm/exynos/Kconfig
>> +++ b/drivers/gpu/drm/exynos/Kconfig
>> @@ -13,10 +13,9 @@ config DRM_EXYNOS
>>If M is selected the module will be called exynosdrm.
>>   
>>   config DRM_EXYNOS_IOMMU
>> -bool "EXYNOS DRM IOMMU Support"
>> +bool
>>  depends on DRM_EXYNOS && EXYNOS_IOMMU && ARM_DMA_USE_IOMMU
>> -help
>> -  Choose this option if you want to use IOMMU feature for DRM.
>> +default y
>>   
>>   config DRM_EXYNOS_DMABUF
>>  bool "EXYNOS DRM DMABUF"
>>
> I tested Exynos DRM with the IOMMU enabled today and couldn't find any
> of the previous issues.

Thanks for testing!

> A few things that I noticed though:
>
> 1) Without the IOMMU I get these powerdomain infos in the kernel logs:
> "lcd0-power-domain: Power-on latency exceeded, new value 416167 ns"
> "tv-power-domain: Power-on latency exceeded, new value 456125 ns"
> These don't appear with the IOMMU, so I was wondering if the
> powerdomains are now staying on the whole time?

Yes, when IOMMU is enabled, it keeps power domains enabled all the time.
Proper implementation of runtime power management is on my todo list and
needs some more discussions about the way it will be integrated with power
domain code. For the initial version I just wanted to have a working IOMMU
driver, aggressive runtime pm will be implemented later.

> 2) With Exynos DRM now having a dependency on IOMMU (when it is
> enabled), I was wondering if anything needs to be done for the old
> 's5p-tv' driver to work properly now?

The old driver should work fine with and without IOMMU, because it doesn't
do any fancy buffer management like Exynos DRM drivers.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R Institute Poland



[Bug 91861] [Radeon RS780] Blank screen (no signal) on HDMI after boot in 3.15 & later

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=91861

--- Comment #1 from Mike S.  ---
Sorry, the Ubuntu versions should be 14.04 & 14.10 of course.

Mike

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 91861] New: [Radeon RS780] Blank screen (no signal) on HDMI after boot in 3.15 & later

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=91861

Bug ID: 91861
   Summary: [Radeon RS780] Blank screen (no signal) on HDMI after
boot in 3.15 & later
   Product: Drivers
   Version: 2.5
Kernel Version: 3.15 + later
  Hardware: Intel
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: high
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-dri at kernel-bugs.osdl.org
  Reporter: michael.selig at fs.com.au
Regression: No

Created attachment 164451
  --> https://bugzilla.kernel.org/attachment.cgi?id=164451=edit
dmesg (kernel 3.18.3) - RS780 blank screen

I use this machine as a HTPC connected to our TV via HDMI. It has been running
Ubuntu of various versions using the RADEON driver with no problems until
Ubuntu 4.10 (kernel 3.16), when this problem first showed itself. I can
successfully boot 3.13 (from Ubuntu 4.04), but when it was announced that VDPAU
was supported on this old Radeon hardware from 3.18, I was hoping that by
upgrading to 3.18, it would not only solve the "blank screen" problem, but also
give me better video performance on XBMC/KODI. Unfortunately 3.18 exhibits the
same "blank screen" problem. I then tried installing other kernel versions
(including 3.19rc5), but nothing from 3.15 onwards works.

The RS780 hardware is integrated on the motherboard, and is fast enough for
videos & TV etc, so I don't really want to change it for a noisy and/or heat
generating video card.

My symptoms are that, after seeing the Grub screen, I see a kernel message or 2
(nothing important) flashing up for a fraction of a second, but then it goes
blank, saying "no signal". I do not see the normal purple Ubuntu splash screen,
which appears before Xorg starts. Interestingly, on occasions it will boot 3.18
successfully, but that is usually after a reboot from 3.13 or 3.14. Once it
boots successfully it seems fairly stable, and I have managed to watch videos
and TV on 3.18 a couple of times though I haven't tested it for long. However
if it is booted again, chances are that it will fail. When the screen is blank,
the system is still up - I can SSH to the box fine. And it seems that Xorg is
up and running fine - Xorg.0.log looks fine - it's just that I can't see
anything!

I have tried radeon.runpm=0 radeon.dpm=0, but they make no difference.

I think this problem may be related to
https://bugzilla.kernel.org/show_bug.cgi?id=83461.

Any ideas?

Thanks,
Mike

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 86267] [drm:evergreen_resume] *ERROR* evergreen startup failed on resume

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=86267

Michel Dänzer  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from Michel Dänzer  ---
The fix is queued up in Alex Deucher's -fixes tree.

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


[Bug 85204] [Radeon HD 5650] return from sleep state failed

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=85204

Michel Dänzer  changed:

   What|Removed |Added

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

--- Comment #23 from Michel Dänzer  ---
The fix is queued up in Alex Deucher's -fixes tree.

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


[Bug 90861] Panic on suspend from KDE with radeon

2015-01-23 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=90861

Michel Dänzer  changed:

   What|Removed |Added

 CC||bugs at mblankhorst.nl

--- Comment #11 from Michel Dänzer  ---
Maarten, any ideas?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH v2 0/3] Fix bugs related to init pipelines

2015-01-23 Thread Zhou, Jammy
The series are Reviewed-by: Jammy Zhou 

Regards,
Jammy

-Original Message-
From: Gabbay, Oded 
Sent: Thursday, January 22, 2015 6:59 PM
To: dri-devel at lists.freedesktop.org; Zhou, Jammy
Cc: alexdeucher at gmail.com
Subject: [PATCH v2 0/3] Fix bugs related to init pipelines

Following comments on original patch, I prepared this patch-set to address all 
the issues that were brought up.

Oded

Oded Gabbay (3):
  drm/radeon: Don't increment pipe_id in kgd_init_pipeline
  drm/amdkfd: Fix bug in pipelines initialization
  drm/amdkfd: Fix bug in call to init_pipelines()

 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 ++--
 drivers/gpu/drm/radeon/radeon_kfd.c   | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

--
1.9.1



[Bug 88719] While using nine gallium tracker and wine Dark Souls 2 causes gpu hang

2015-01-23 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=88719

--- Comment #1 from Krzysztof A. Sobiecki  ---
Apitrace of Dark Souls 2:
http://goo.gl/vgz6Y4
I have used
http://people.freedesktop.org/~jrfonseca/apitrace/apitrace-5.0.20140502-windows.7z
How to retrace: https://github.com/apitrace/apitrace/wiki/WINE

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


[PATCH] drm/exynos: IOMMU support should not be selectable by user

2015-01-23 Thread Tobias Jakobi
Hello!

Marek Szyprowski wrote:
> If system provides IOMMU feature, Exynos DRM should use it by default,
> because the Exynos DRM subdrivers don't work correctly when Exynos IOMMU
> driver has been enabled and no IOMMU support has been compiled into Exynos
> DRM driver.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/Kconfig | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
> index 7f9f6f9e9b7e..39fe490efcd4 100644
> --- a/drivers/gpu/drm/exynos/Kconfig
> +++ b/drivers/gpu/drm/exynos/Kconfig
> @@ -13,10 +13,9 @@ config DRM_EXYNOS
> If M is selected the module will be called exynosdrm.
>  
>  config DRM_EXYNOS_IOMMU
> - bool "EXYNOS DRM IOMMU Support"
> + bool
>   depends on DRM_EXYNOS && EXYNOS_IOMMU && ARM_DMA_USE_IOMMU
> - help
> -   Choose this option if you want to use IOMMU feature for DRM.
> + default y
>  
>  config DRM_EXYNOS_DMABUF
>   bool "EXYNOS DRM DMABUF"
> 

I tested Exynos DRM with the IOMMU enabled today and couldn't find any
of the previous issues.

A few things that I noticed though:

1) Without the IOMMU I get these powerdomain infos in the kernel logs:
"lcd0-power-domain: Power-on latency exceeded, new value 416167 ns"
"tv-power-domain: Power-on latency exceeded, new value 456125 ns"
These don't appear with the IOMMU, so I was wondering if the
powerdomains are now staying on the whole time?

2) With Exynos DRM now having a dependency on IOMMU (when it is
enabled), I was wondering if anything needs to be done for the old
's5p-tv' driver to work properly now?

With best wishes,
Tobias