[Bug 73378] [drm:radeon_uvd_send_upll_ctlreq] *ERROR* Timeout setting UVD clocks!

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73378

--- Comment #37 from Chernovsky Oleg  ---
Created attachment 113544
  --> https://bugs.freedesktop.org/attachment.cgi?id=113544=edit
fglrx mmiotrace dump

(In reply to Christian König from comment #36)
> Well it might already help if you provide the values for the UPLL registers
> together under fglrx, so that we can compare them to the values Radeon uses.
> 
> Regards,
> Christian.

Just thought about that.
Here it is, quite near the place where first related register R/W occured.

-- 
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/20150216/8d8cbc81/attachment.html>


[Bug 93281] Kernel modesetting causes the kernel to lock up during boot on a late 2011 MacBook Pro

2015-02-16 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=93281

Roland Scheidegger  changed:

   What|Removed |Added

 CC||rscheidegger at gmx.ch

--- Comment #11 from Roland Scheidegger  ---
FWIW I've got the same notebook and I can confirm the gmux is problematic (the
apple-gmux driver should support it in theory). Though I don't think it ever
hanged for me, but you can easily lose the display on bootup depending on how
you boot - there's essentially 3 different methods:
1) via CSM bios emulation. In this case you will get working AMD graphics, with
no ability to switch to the intel one (it does not even appear in the pci
device list).
2) via direct efi boot (refind or similar). This will get you working AMD
graphics like the above, with the theoretical ability to switch to the intel
one with vgaswitcheroo as it is now properly enumerated and the apple-gmux
driver used, however switching does not actually work (it seems the intel
graphics only works if it was active on boot in my experiments). (*)
3) via grub-efi (looks like this is what you do?). Unfortunately this will not
work without extra grub parameters, because the radeon graphics bios cannot be
retrieved (though last I looked there was some discussion about fixing this in
grub, so it may work with a newer grub version). The grub parameters are to
force the mux to switch to intel graphics, in which case you get working intel
(but not amd) graphics, though you won't see initial bootup messages before kms
is loaded. (Note that after suspend/resume, the AMD chip will be powered on but
unused again for some needlessly higher (IIRC over 5W) power consumption,
though you can write a hack app to force it off again.)
This page has some information on this - in particular the 4 outb commands for
the grub config:
http://blog.tkassembled.com/364/intel-graphics-on-a-2011-macbook-pro-in-linux/

(*) I actually got switching graphics to work as a proof-of-concept by using
direct efi boot and forcing the gmux to intel by using the efi console, though
halfway through you will lose the screen in there and have to remember what
keystrokes are needed to select the right boot entry in the refind menu...

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


[Bug 89155] Dual monitor setup does not initialize

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89155

--- Comment #4 from Adam Reichold  ---
(In reply to Alex Deucher from comment #3)
> (In reply to Adam Reichold from comment #2)
> > Maybe as a clarification: Both monitors always initialize properly when only
> > one is connected.
> 
> When only one is connected at boot time?  If so does it matter which one?

If at boot time, only one monitor is connected, then it does initialize
properly. This is true for both monitors, i.e. VGA-only works and DVI-only
works, but not both at the same time. (It also works correctly if I boot using
only one monitor and attach the second one later.)

-- 
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/20150216/1f41b19a/attachment.html>


[Bug 89148] r300g: Kernel rejected CS in Wine d3d multisample test

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89148

--- Comment #2 from Alex Deucher  ---
Type 1 packets shouldn't be emitted at all and none of the user mode drivers
emit them.  I suspect either the command stream is getting corrupted somewhere
or there is a prior packet count getting set wrong.

-- 
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/20150216/9f6ca2a7/attachment.html>


[Bug 73378] [drm:radeon_uvd_send_upll_ctlreq] *ERROR* Timeout setting UVD clocks!

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73378

--- Comment #36 from Christian König  ---
As Alex already noted the detailed register specs are unfortunately only
available internally.

We tried to have at least all the bit definitions needed by the driver
documented in the header files, but some things are just market as for hardware
validation only or debug only etc... and those aren't documented.

(In reply to Chernovsky Oleg from comment #33)
> Yep, I rechecked it and it seems set to 1 always...
> 
> Anyway I gathered around 18 Mb of mmiotrace logs to investigate. Now digging
> through divider and clock registers.

Well it might already help if you provide the values for the UPLL registers
together under fglrx, so that we can compare them to the values Radeon uses.

Regards,
Christian.

-- 
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/20150216/722c4ddf/attachment.html>


[Bug 89155] Dual monitor setup does not initialize

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89155

--- Comment #3 from Alex Deucher  ---
(In reply to Adam Reichold from comment #2)
> Maybe as a clarification: Both monitors always initialize properly when only
> one is connected.

When only one is connected at boot time?  If so does it matter which one?

-- 
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/20150216/08151a39/attachment.html>


[Bug 73378] [drm:radeon_uvd_send_upll_ctlreq] *ERROR* Timeout setting UVD clocks!

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73378

--- Comment #35 from Alex Deucher  ---
(In reply to Chernovsky Oleg from comment #34)
> 
> Is this some kind of open hardware docs? Or just internal? Maybe I missed
> something

Just internal.

(In reply to Chernovsky Oleg from comment #33)
> P.S. I only fear that maybe I launched mmiotrace too late, I did rmmod and
> then modprobe fglrx again. Could it setup any registers at the first run?
> Because at second it touched UVD only when I launched mpv.

To save power the UVD clocks are only raised when it's actually in use.  I
think fglrx does some low level hw init similar to what we do in radeon, but
they don't do a ring test so they probably don't change the UVD plls at driver
load time only when UVD is in use (although I'm not 100% sure off hand).

-- 
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/20150216/da8b3d09/attachment.html>


[Bug 93281] Kernel modesetting causes the kernel to lock up during boot on a late 2011 MacBook Pro

2015-02-16 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=93281

Alex Deucher  changed:

   What|Removed |Added

 CC||alexdeucher at gmail.com

--- Comment #10 from Alex Deucher  ---
You have a muxed hybrid laptop with multiple GPUs.  IIRC, Macs require a
special driver and probably special handling to switch the mux between the AMD
and the Intel GPUs.

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


[git pull] drm pull for 3.20-rc1

2015-02-16 Thread Linus Torvalds
On Sun, Feb 15, 2015 at 10:43 PM, Dave Airlie  wrote:
>
> This is the main drm pull, it has a shared branch with some alsa crossover
> but everything should be acked by relevant people.

Ugh. Your diffstat is crap, because you don't show the inexact renames
that are very abundant in the nouveau driver.

The reason is likely that there are just so many renames that the
default git limits kick in, as it takes some amount of CPU and memory
to do well, and the git defaults are set to work on some really crappy
machines too.

Normally you don't hit the limits, because it's pretty unusual to see
that many renames, but the nouveau guys clearly reorganized their
whole subdirectory. And the difference is quite noticeable:

  # without inexact rename detection:
   1558 files changed, 141213 insertions(+), 125111 deletions(-)

  # with inexact rename detection:
   1138 files changed, 50782 insertions(+), 34680 deletions(-)

Git will actually warn you about a low renamelimit setting. So you
should have seen a warning something like

warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at
least XYZ and retry the command.

but you might have overlooked it.

So may I ask you to just add

   [diff]
renamelimit=0

to your ~/.gitconfig.  Or you can just do

git config --global diff.renamelimit 0

to do it without editing it yourself, if that's what you prefer (the
"--global" just does it to your ~/.gitconfig so that it will affect
all your git projects - you can obviously just do it to the
".git/config" for individual repositories instead if you prefer).

Oh, and you can do it for merges too - just replace the "diff" with
"merge" - where it can arguably be even more important.

 Linus


[PATCH v2 15/15] exynos: fimg2d: introduce G2D_OP_INTERPOLATE

2015-02-16 Thread Tobias Jakobi
This sets up the blending equation in the following way:
out = src * src_alpha + dst * (1 - src_alpha)

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c | 4 
 exynos/exynos_fimg2d.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 126a15d..18d5b89 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -85,6 +85,10 @@ static unsigned int g2d_get_blend_op(enum e_g2d_op op)
SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0,
G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0);
break;
+   case G2D_OP_INTERPOLATE:
+   SET_BF(val, G2D_COEFF_MODE_SRC_ALPHA, 0, 0, 0,
+   G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0);
+   break;
default:
fprintf(stderr, "Not support operation(%d).\n", op);
SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO,
diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
index 78cff47..79e6907 100644
--- a/exynos/exynos_fimg2d.h
+++ b/exynos/exynos_fimg2d.h
@@ -149,6 +149,7 @@ enum e_g2d_op {
G2D_OP_SRC  = 0x01,
G2D_OP_DST  = 0x02,
G2D_OP_OVER = 0x03,
+   G2D_OP_INTERPOLATE  = 0x04,
G2D_OP_DISJOINT_CLEAR   = 0x10,
G2D_OP_DISJOINT_SRC = 0x11,
G2D_OP_DISJOINT_DST = 0x12,
-- 
2.0.5



[PATCH v2 14/15] exynos: fimg2d: unify register style

2015-02-16 Thread Tobias Jakobi
Register defines all use uppercase hex codes.

Signed-off-by: Tobias Jakobi 
---
 exynos/fimg2d_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exynos/fimg2d_reg.h b/exynos/fimg2d_reg.h
index 5782488..07dd634 100644
--- a/exynos/fimg2d_reg.h
+++ b/exynos/fimg2d_reg.h
@@ -15,7 +15,7 @@

 #define SOFT_RESET_REG (0x)
 #define INTEN_REG  (0x0004)
-#define INTC_PEND_REG  (0x000c)
+#define INTC_PEND_REG  (0x000C)
 #define FIFO_STAT_REG  (0x0010)
 #define AXI_MODE_REG   (0x001C)
 #define DMA_SFR_BASE_ADDR_REG  (0x0080)
-- 
2.0.5



[PATCH] drm: Fix the CRTC_STEREO_DOUBLE_ONLY define to include stero modes

2015-02-16 Thread Damien Lespiau
The CRTC_STEREO_DOUBLE_ONLY define was introduced in commit:

  commit ecb7e16bf187bc369cf6a5cd108582c01329980d
  Author: Gustavo Padovan 
  Date:   Mon Dec 1 15:40:09 2014 -0800

  drm: add helper to get crtc timings (v5)

but if we want the stereo h/v adjustments, we need to set the
CRTC_STEREO_DOUBLE flag. Otherwise, we'll get the wrong h/v for frame packing
stereo 3d modes.

Cc: Gustavo Padovan 
Cc: Matt Roper 
Cc: Ander Conselvan de Oliveira 
Signed-off-by: Damien Lespiau 
---
 include/drm/drm_modes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index d92f6dd..0616188 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -92,7 +92,7 @@ enum drm_mode_status {
 #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */
 #define CRTC_NO_DBLSCAN(1 << 2) /* don't adjust doublescan */
 #define CRTC_NO_VSCAN  (1 << 3) /* don't adjust doublescan */
-#define CRTC_STEREO_DOUBLE_ONLY(CRTC_NO_DBLSCAN | CRTC_NO_VSCAN)
+#define CRTC_STEREO_DOUBLE_ONLY(CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | 
CRTC_NO_VSCAN)

 #define DRM_MODE_FLAG_3D_MAX   DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF

-- 
1.8.3.1



[PATCH v2 13/15] exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR

2015-02-16 Thread Tobias Jakobi
The coefficient mode enables use of global color, not alpha.

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
index bd116cf..78cff47 100644
--- a/exynos/exynos_fimg2d.h
+++ b/exynos/exynos_fimg2d.h
@@ -166,7 +166,7 @@ enum e_g2d_coeff_mode {
G2D_COEFF_MODE_DST_COLOR,
/* Global Alpha : Set by ALPHA_REG(0x618) */
G2D_COEFF_MODE_GB_ALPHA,
-   /* Global Alpha : Set by ALPHA_REG(0x618) */
+   /* Global Color : Set by ALPHA_REG(0x618) */
G2D_COEFF_MODE_GB_COLOR,
/* (1-SRC alpha)/DST Alpha */
G2D_COEFF_MODE_DISJOINT_S,
-- 
2.0.5



[PATCH v2 12/15] exynos: add fimg2d header to common includes

2015-02-16 Thread Tobias Jakobi
The reason for this change is to let userspace use the header.
Currently 'make install' does not install it.

Signed-off-by: Tobias Jakobi 
---
 exynos/Makefile.am | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index 1715a85..35bc71f 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -14,11 +14,10 @@ libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
 libdrm_exynos_la_SOURCES = \
exynos_drm.c \
exynos_fimg2d.c \
-   exynos_fimg2d.h \
fimg2d_reg.h

 libdrm_exynoscommonincludedir = ${includedir}/exynos
-libdrm_exynoscommoninclude_HEADERS = exynos_drm.h
+libdrm_exynoscommoninclude_HEADERS = exynos_drm.h exynos_fimg2d.h

 libdrm_exynosincludedir = ${includedir}/libdrm
 libdrm_exynosinclude_HEADERS = exynos_drmif.h
-- 
2.0.5



[PATCH v2 11/15] exynos: add exynos prefix to fimg2d header

2015-02-16 Thread Tobias Jakobi
Signed-off-by: Tobias Jakobi 
---
 exynos/Makefile.am|   2 +-
 exynos/exynos_fimg2d.c|   2 +-
 exynos/exynos_fimg2d.h| 328 ++
 exynos/fimg2d.h   | 328 --
 tests/exynos/exynos_fimg2d_test.c |   2 +-
 5 files changed, 331 insertions(+), 331 deletions(-)
 create mode 100644 exynos/exynos_fimg2d.h
 delete mode 100644 exynos/fimg2d.h

diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index 06bee00..1715a85 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -14,7 +14,7 @@ libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
 libdrm_exynos_la_SOURCES = \
exynos_drm.c \
exynos_fimg2d.c \
-   fimg2d.h \
+   exynos_fimg2d.h \
fimg2d_reg.h

 libdrm_exynoscommonincludedir = ${includedir}/exynos
diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index c6f964b..126a15d 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -27,7 +27,7 @@
 #include "libdrm.h"
 #include "exynos_drm.h"
 #include "fimg2d_reg.h"
-#include "fimg2d.h"
+#include "exynos_fimg2d.h"

 #defineSET_BF(val, sc, si, scsa, scda, dc, di, dcsa, dcda) \
val.data.src_coeff = sc;\
diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h
new file mode 100644
index 000..bd116cf
--- /dev/null
+++ b/exynos/exynos_fimg2d.h
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics Co.Ltd
+ * Authors:
+ * Inki Dae 
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _FIMG2D_H_
+#define _FIMG2D_H_
+
+#ifndef TRUE
+#define TRUE 0
+#endif
+#ifndef FALSE
+#define FALSE -1
+#endif
+
+#define G2D_MAX_CMD_NR 64
+#define G2D_MAX_GEM_CMD_NR 64
+#define G2D_MAX_CMD_LIST_NR64
+#define G2D_PLANE_MAX_NR   2
+
+enum e_g2d_color_mode {
+   /* COLOR FORMAT */
+   G2D_COLOR_FMT_XRGB,
+   G2D_COLOR_FMT_ARGB,
+   G2D_COLOR_FMT_RGB565,
+   G2D_COLOR_FMT_XRGB1555,
+   G2D_COLOR_FMT_ARGB1555,
+   G2D_COLOR_FMT_XRGB,
+   G2D_COLOR_FMT_ARGB,
+   G2D_COLOR_FMT_PRGB888,
+   G2D_COLOR_FMT_YCbCr444,
+   G2D_COLOR_FMT_YCbCr422,
+   G2D_COLOR_FMT_YCbCr420,
+   /* alpha 8bit */
+   G2D_COLOR_FMT_A8,
+   /* Luminance 8bit: gray color */
+   G2D_COLOR_FMT_L8,
+   /* alpha 1bit */
+   G2D_COLOR_FMT_A1,
+   /* alpha 4bit */
+   G2D_COLOR_FMT_A4,
+   G2D_COLOR_FMT_MASK, /* VER4.1 */
+
+   /* COLOR ORDER */
+   G2D_ORDER_AXRGB = (0 << 4), /* VER4.1 */
+   G2D_ORDER_RGBAX = (1 << 4), /* VER4.1 */
+   G2D_ORDER_AXBGR = (2 << 4), /* VER4.1 */
+   G2D_ORDER_BGRAX = (3 << 4), /* VER4.1 */
+   G2D_ORDER_MASK  = (3 << 4), /* VER4.1 */
+
+   /* Number of YCbCr plane */
+   G2D_YCbCr_1PLANE= (0 << 8), /* VER4.1 */
+   G2D_YCbCr_2PLANE= (1 << 8), /* VER4.1 */
+   G2D_YCbCr_PLANE_MASK= (3 << 8), /* VER4.1 */
+
+   /* Order in YCbCr */
+   G2D_YCbCr_ORDER_CrY1CbY0 = (0 << 12),   /* VER4.1 */
+   G2D_YCbCr_ORDER_CbY1CrY0 = (1 << 12),   /* VER4.1 */
+   G2D_YCbCr_ORDER_Y1CrY0Cb = (2 << 12),   /* VER4.1 */
+   G2D_YCbCr_ORDER_Y1CbY0Cr = (3 << 12),   /* VER4.1 */
+   G2D_YCbCr_ORDER_CrCb = G2D_YCbCr_ORDER_CrY1CbY0,/* VER4.1 */
+   G2D_YCbCr_ORDER_CbCr = G2D_YCbCr_ORDER_CbY1CrY0,/* VER4.1 */
+   G2D_YCbCr_ORDER_MASK = (3 < 12),/* VER4.1 */
+
+   /* CSC */
+   G2D_CSC_601 = (0 << 16),/* VER4.1 */
+   G2D_CSC_709 = (1 << 16),/* VER4.1 */
+   G2D_CSC_MASK = (1 << 16),   /* VER4.1 */
+
+   /* Valid value range of YCbCr */
+   G2D_YCbCr_RANGE_NARROW = (0 << 17), /* VER4.1 */
+   G2D_YCbCr_RANGE_WIDE = (1 << 17),   /* VER4.1 */
+   G2D_YCbCr_RANGE_MASK = (1 << 17),   /* VER4.1 */
+
+   G2D_COLOR_MODE_MASK = 0x,
+};
+
+enum e_g2d_select_mode {
+   G2D_SELECT_MODE_NORMAL  = (0 << 0),
+   G2D_SELECT_MODE_FGCOLOR = (1 << 0),
+   G2D_SELECT_MODE_BGCOLOR = (2 << 0),
+};
+
+enum e_g2d_repeat_mode {
+   G2D_REPEAT_MODE_REPEAT,
+   G2D_REPEAT_MODE_PAD,
+   G2D_REPEAT_MODE_REFLECT,
+   G2D_REPEAT_MODE_CLAMP,
+   G2D_REPEAT_MODE_NONE,
+};
+
+enum e_g2d_scale_mode {
+   G2D_SCALE_MODE_NONE = 0,
+   G2D_SCALE_MODE_NEAREST,
+   G2D_SCALE_MODE_BILINEAR,
+   G2D_SCALE_MODE_MAX,
+};
+
+enum e_g2d_buf_type {
+   

[PATCH v2 10/15] tests/exynos: improve error handling

2015-02-16 Thread Tobias Jakobi
Check for a useable connector and also if the resolution is sane
(width and height are both non-zero).

Signed-off-by: Tobias Jakobi 
---
 tests/exynos/exynos_fimg2d_test.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/exynos/exynos_fimg2d_test.c 
b/tests/exynos/exynos_fimg2d_test.c
index cffe11b..497d57a 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -725,10 +725,22 @@ int main(int argc, char **argv)
connector_find_mode(dev->fd, , resources);
drmModeFreeResources(resources);

+   if (!con.mode) {
+   fprintf(stderr, "failed to find usable connector\n");
+   ret = -EFAULT;
+   goto err_drm_close;
+   }
+
screen_width = con.mode->hdisplay;
screen_height = con.mode->vdisplay;

-   printf("screen width  = %d, screen height = %d\n", screen_width,
+   if (screen_width == 0 || screen_height == 0) {
+   fprintf(stderr, "failed to find sane resolution on 
connector\n");
+   ret = -EFAULT;
+   goto err_drm_close;
+   }
+
+   printf("screen width = %d, screen height = %d\n", screen_width,
screen_height);

bo = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);
-- 
2.0.5



[PATCH v2 09/15] exynos: use structure initialization instead of memset

2015-02-16 Thread Tobias Jakobi
Keeps the code cleaner, since the structs have to be initialized
once anyway.

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c|  4 +---
 tests/exynos/exynos_fimg2d_test.c | 15 ---
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index c08974a..c6f964b 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -181,7 +181,7 @@ static void g2d_reset(struct g2d_context *ctx)
 static int g2d_flush(struct g2d_context *ctx)
 {
int ret;
-   struct drm_exynos_g2d_set_cmdlist cmdlist;
+   struct drm_exynos_g2d_set_cmdlist cmdlist = {0};

if (ctx->cmd_nr  == 0 && ctx->cmd_buf_nr == 0)
return FALSE;
@@ -191,8 +191,6 @@ static int g2d_flush(struct g2d_context *ctx)
return -EINVAL;
}

-   memset(, 0, sizeof(struct drm_exynos_g2d_set_cmdlist));
-
cmdlist.cmd = (uint64_t)(uintptr_t)>cmd[0];
cmdlist.cmd_buf = (uint64_t)(uintptr_t)>cmd_buf[0];
cmdlist.cmd_nr = ctx->cmd_nr;
diff --git a/tests/exynos/exynos_fimg2d_test.c 
b/tests/exynos/exynos_fimg2d_test.c
index 446a6c6..cffe11b 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -257,7 +257,7 @@ static void exynos_destroy_buffer(struct exynos_bo *bo)
 static int g2d_solid_fill_test(struct exynos_device *dev, struct exynos_bo 
*dst)
 {
struct g2d_context *ctx;
-   struct g2d_image img;
+   struct g2d_image img = {0};
unsigned int count, img_w, img_h;
int ret = 0;

@@ -265,7 +265,6 @@ static int g2d_solid_fill_test(struct exynos_device *dev, 
struct exynos_bo *dst)
if (!ctx)
return -EFAULT;

-   memset(, 0, sizeof(struct g2d_image));
img.bo[0] = dst->handle;

printf("solid fill test.\n");
@@ -308,7 +307,7 @@ static int g2d_copy_test(struct exynos_device *dev, struct 
exynos_bo *src,
enum e_g2d_buf_type type)
 {
struct g2d_context *ctx;
-   struct g2d_image src_img, dst_img;
+   struct g2d_image src_img = {0}, dst_img = {0};
unsigned int count;
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
@@ -318,8 +317,6 @@ static int g2d_copy_test(struct exynos_device *dev, struct 
exynos_bo *src,
if (!ctx)
return -EFAULT;

-   memset(_img, 0, sizeof(struct g2d_image));
-   memset(_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle;

src_x = 0;
@@ -392,7 +389,7 @@ static int g2d_copy_with_scale_test(struct exynos_device 
*dev,
enum e_g2d_buf_type type)
 {
struct g2d_context *ctx;
-   struct g2d_image src_img, dst_img;
+   struct g2d_image src_img = {0}, dst_img = {0};
unsigned int count;
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
@@ -402,8 +399,6 @@ static int g2d_copy_with_scale_test(struct exynos_device 
*dev,
if (!ctx)
return -EFAULT;

-   memset(_img, 0, sizeof(struct g2d_image));
-   memset(_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle;

src_x = 0;
@@ -481,7 +476,7 @@ static int g2d_blend_test(struct exynos_device *dev,
enum e_g2d_buf_type type)
 {
struct g2d_context *ctx;
-   struct g2d_image src_img, dst_img;
+   struct g2d_image src_img = {0}, dst_img = {0};
unsigned int count;
unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
unsigned long userptr, size;
@@ -491,8 +486,6 @@ static int g2d_blend_test(struct exynos_device *dev,
if (!ctx)
return -EFAULT;

-   memset(_img, 0, sizeof(struct g2d_image));
-   memset(_img, 0, sizeof(struct g2d_image));
dst_img.bo[0] = dst->handle;

src_x = 0;
-- 
2.0.5



[PATCH v2 08/15] exynos: introduce g2d_add_base_addr helper function

2015-02-16 Thread Tobias Jakobi
In almost all functions the base address register is written, so it
makes sense to have a helper function for this.

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c | 87 +++---
 1 file changed, 33 insertions(+), 54 deletions(-)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index b79081e..c08974a 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -41,6 +41,11 @@

 #define MIN(a, b)  ((a) < (b) ? (a) : (b))

+enum g2d_base_addr_reg {
+   g2d_dst = 0,
+   g2d_src
+};
+
 static unsigned int g2d_get_scaling(unsigned int src, unsigned int dst)
 {
/* The G2D hw scaling factor is a normalized inverse of the scaling 
factor. *
@@ -132,6 +137,25 @@ static int g2d_add_cmd(struct g2d_context *ctx, unsigned 
long cmd,
 }

 /*
+ * g2d_add_base_addr - helper function to set dst/src base address register.
+ *
+ * @ctx: a pointer to g2d_context structure.
+ * @img: a pointer to the dst/src g2d_image structure.
+ * @reg: the register that should be set.
+ */
+static void g2d_add_base_addr(struct g2d_context *ctx, struct g2d_image *img,
+   enum g2d_base_addr_reg reg)
+{
+   const unsigned long cmd = (reg == g2d_dst) ? DST_BASE_ADDR_REG : 
SRC_BASE_ADDR_REG;
+
+   if (img->buf_type == G2D_IMGBUF_USERPTR)
+   g2d_add_cmd(ctx, cmd | G2D_BUF_USERPTR,
+   (unsigned long)>user_ptr[0]);
+   else
+   g2d_add_cmd(ctx, cmd, img->bo[0]);
+}
+
+/*
  * g2d_reset - reset fimg2d hardware.
  *
  * @ctx: a pointer to g2d_context structure.
@@ -276,13 +300,7 @@ g2d_solid_fill(struct g2d_context *ctx, struct g2d_image 
*img,

g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, img->color_mode);
-
-   if (img->buf_type == G2D_IMGBUF_USERPTR)
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
-   (unsigned long)>user_ptr[0]);
-   else
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG, img->bo[0]);
-
+   g2d_add_base_addr(ctx, img, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, img->stride);

if (x + w > img->width)
@@ -339,22 +357,12 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src,

g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
-   if (dst->buf_type == G2D_IMGBUF_USERPTR)
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
-   (unsigned long)>user_ptr[0]);
-   else
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
-
+   g2d_add_base_addr(ctx, dst, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);

g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
-   if (src->buf_type == G2D_IMGBUF_USERPTR)
-   g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
-   (unsigned long)>user_ptr[0]);
-   else
-   g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
-
+   g2d_add_base_addr(ctx, src, g2d_src);
g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);

src_w = w;
@@ -442,12 +450,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,

g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
-   if (dst->buf_type == G2D_IMGBUF_USERPTR)
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
-   (unsigned long)>user_ptr[0]);
-   else
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
-
+   g2d_add_base_addr(ctx, dst, g2d_dst);
g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);

g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
@@ -457,11 +460,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,
if (src->repeat_mode == G2D_REPEAT_MODE_PAD)
g2d_add_cmd(ctx, SRC_PAD_VALUE_REG, dst->color);

-   if (src->buf_type == G2D_IMGBUF_USERPTR)
-   g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
-   (unsigned long)>user_ptr[0]);
-   else
-   g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
+   g2d_add_base_addr(ctx, src, g2d_src);

g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);

@@ -565,12 +564,7 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);

g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
-   if (dst->buf_type == G2D_IMGBUF_USERPTR)
-   g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
-   (unsigned long)>user_ptr[0]);
-   else
-   g2d_add_cmd(ctx, 

[PATCH v2 07/15] exynos: honor the repeat mode in g2d_copy_with_scale

2015-02-16 Thread Tobias Jakobi
This is useful when the default repeat mode, which is 'repeat'
produces artifacts at the borders of the copied image.
Choose the 'pad' mode to make use of the color of the destination
image.

In my usage case the destination is the framebuffer, which is
solid filled with a background color. Scaling with 'pad' mode
would then just do the right thing and also produces nice
borders on the output.

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 0d89b1d..b79081e 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -452,6 +452,11 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,

g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL);
g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
+
+   g2d_add_cmd(ctx, SRC_REPEAT_MODE_REG, src->repeat_mode);
+   if (src->repeat_mode == G2D_REPEAT_MODE_PAD)
+   g2d_add_cmd(ctx, SRC_PAD_VALUE_REG, dst->color);
+
if (src->buf_type == G2D_IMGBUF_USERPTR)
g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
(unsigned long)>user_ptr[0]);
-- 
2.0.5



[PATCH v2 06/15] tests/exynos: introduce wait_for_user_input

2015-02-16 Thread Tobias Jakobi
Currently getchar() is used to pause execution after each test.
The user isn't informed if one is supposed to do anything for
the tests to continue, so print a simple message to make this
more clear.

Signed-off-by: Tobias Jakobi 
---
 tests/exynos/exynos_fimg2d_test.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/exynos/exynos_fimg2d_test.c 
b/tests/exynos/exynos_fimg2d_test.c
index 55d2970..446a6c6 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -237,6 +237,18 @@ void *create_checkerboard_pattern(unsigned int num_tiles_x,
return buf;
 }

+static void wait_for_user_input(int last)
+{
+   printf("press  to ");
+
+   if (last)
+   printf("exit test application\n");
+   else
+   printf("skip to next test\n");
+
+   getchar();
+}
+
 static void exynos_destroy_buffer(struct exynos_bo *bo)
 {
exynos_bo_destroy(bo);
@@ -756,7 +768,7 @@ int main(int argc, char **argv)
goto err_rm_fb;
}

-   getchar();
+   wait_for_user_input(0);

src = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);
if (!src) {
@@ -770,7 +782,7 @@ int main(int argc, char **argv)
goto err_free_src;
}

-   getchar();
+   wait_for_user_input(0);

ret = test_case.copy_with_scale(dev, src, bo, G2D_IMGBUF_GEM);
if (ret < 0) {
@@ -778,7 +790,7 @@ int main(int argc, char **argv)
goto err_free_src;
}

-   getchar();
+   wait_for_user_input(0);

ret = test_case.checkerboard(dev, src, bo, G2D_IMGBUF_GEM);
if (ret < 0) {
@@ -786,7 +798,7 @@ int main(int argc, char **argv)
goto err_free_src;
}

-   getchar();
+   wait_for_user_input(1);

   /* The blend test uses the userptr functionality of exynos-drm, which *
* is currently not safe to use. If the kernel hasn't been build with *
-- 
2.0.5



[PATCH v2 05/15] exynos: add g2d_scale_and_blend

2015-02-16 Thread Tobias Jakobi
This is a combination of g2d_copy_with_scale and g2d_scale.
It is a pretty common operation to scale one buffer and then
blend it on top of another, so provide a direct way to that
operation.

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c | 129 +
 exynos/fimg2d.h|   5 ++
 2 files changed, 134 insertions(+)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 8b1a0ff..0d89b1d 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -643,3 +643,132 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src,
return 0;
 }

+/**
+ * g2d_scale_and_blend - apply scaling to source buffer and then blend to 
destination buffer
+ *
+ * @ctx: a pointer to g2d_context structure.
+ * @src: a pointer to g2d_image structure including image and buffer
+ * information to source.
+ * @dst: a pointer to g2d_image structure including image and buffer
+ * information to destination.
+ * @src_x: x start position to source buffer.
+ * @src_y: y start position to source buffer.
+ * @src_w: width value to source buffer.
+ * @src_h: height value to source buffer.
+ * @dst_x: x start position to destination buffer.
+ * @dst_y: y start position to destination buffer.
+ * @dst_w: width value to destination buffer.
+ * @dst_h: height value to destination buffer.
+ * @op: blend operation type.
+ */
+drm_public int
+g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src,
+   struct g2d_image *dst, unsigned int src_x, unsigned int src_y,
+   unsigned int src_w, unsigned int src_h, unsigned int dst_x,
+   unsigned int dst_y, unsigned int dst_w, unsigned int dst_h,
+   enum e_g2d_op op)
+{
+   union g2d_point_val pt;
+   union g2d_bitblt_cmd_val bitblt;
+   union g2d_blend_func_val blend;
+   unsigned int scale;
+   unsigned int scale_x, scale_y;
+
+   bitblt.val = 0;
+   blend.val = 0;
+
+   if (op == G2D_OP_SRC || op == G2D_OP_CLEAR)
+   g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
+   else
+   g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL);
+
+   g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
+   if (dst->buf_type == G2D_IMGBUF_USERPTR)
+   g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR,
+   (unsigned long)>user_ptr[0]);
+   else
+   g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]);
+
+   g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride);
+
+   g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode);
+   g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode);
+
+   switch (src->select_mode) {
+   case G2D_SELECT_MODE_NORMAL:
+   if (src->buf_type == G2D_IMGBUF_USERPTR)
+   g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR,
+   (unsigned long)>user_ptr[0]);
+   else
+   g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]);
+
+   g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride);
+   break;
+   case G2D_SELECT_MODE_FGCOLOR:
+   g2d_add_cmd(ctx, FG_COLOR_REG, src->color);
+   break;
+   case G2D_SELECT_MODE_BGCOLOR:
+   g2d_add_cmd(ctx, BG_COLOR_REG, src->color);
+   break;
+   default:
+   fprintf(stderr , "failed to set src.\n");
+   return -EINVAL;
+   }
+
+   if (src_w == dst_w && src_h == dst_h)
+   scale = 0;
+   else {
+   scale = 1;
+   scale_x = g2d_get_scaling(src_w, dst_w);
+   scale_y = g2d_get_scaling(src_h, dst_h);
+   }
+
+   if (src_x + src_w > src->width)
+   src_w = src->width - src_x;
+   if (src_y + src_h > src->height)
+   src_h = src->height - src_y;
+
+   if (dst_x + dst_w > dst->width)
+   dst_w = dst->width - dst_x;
+   if (dst_y + dst_h > dst->height)
+   dst_h = dst->height - dst_y;
+
+   if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) {
+   fprintf(stderr, "invalid width or height.\n");
+   g2d_reset(ctx);
+   return -EINVAL;
+   }
+
+   if (scale) {
+   g2d_add_cmd(ctx, SRC_SCALE_CTRL_REG, G2D_SCALE_MODE_BILINEAR);
+   g2d_add_cmd(ctx, SRC_XSCALE_REG, scale_x);
+   g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y);
+   }
+
+   bitblt.data.alpha_blend_mode = G2D_ALPHA_BLEND_MODE_ENABLE;
+   blend.val = g2d_get_blend_op(op);
+   g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val);
+   g2d_add_cmd(ctx, BLEND_FUNCTION_REG, blend.val);
+
+   pt.val = 0;
+   pt.data.x = src_x;
+   pt.data.y = src_y;
+   g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val);
+   pt.val = 0;
+   pt.data.x = src_x + src_w;
+   pt.data.y = src_y + src_h;
+   

[PATCH v2 04/15] tests/exynos: disable the G2D userptr/blend test

2015-02-16 Thread Tobias Jakobi
v2: Move the commit description into the patch itself.
Signed-off-by: Tobias Jakobi 
---
 tests/exynos/exynos_fimg2d_test.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/tests/exynos/exynos_fimg2d_test.c 
b/tests/exynos/exynos_fimg2d_test.c
index aa140e5..55d2970 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -788,11 +788,19 @@ int main(int argc, char **argv)

getchar();

+  /* The blend test uses the userptr functionality of exynos-drm, which *
+   * is currently not safe to use. If the kernel hasn't been build with *
+   * exynos-iommu support, then the blend test is going to produce (kernel) *
+   * memory corruption, eventually leading to a system crash.   *
+   **
+   * Disable the test for now, until the kernel code has been sanitized.*/
+#if 0
ret  = test_case.blend(dev, src, bo, G2D_IMGBUF_USERPTR);
if (ret < 0)
fprintf(stderr, "failed to test blend operation.\n");

getchar();
+#endif

 err_free_src:
if (src)
-- 
2.0.5



[PATCH v2 03/15] tests/exynos: fix typos and change wording

2015-02-16 Thread Tobias Jakobi
No functional changes.

Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c| 8 
 tests/exynos/exynos_fimg2d_test.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index 037021a..8b1a0ff 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -146,13 +146,13 @@ static void g2d_reset(struct g2d_context *ctx)
 }

 /*
- * g2d_flush - summit all commands and values in user side command buffer
+ * g2d_flush - submit all commands and values in user side command buffer
  * to command queue aware of fimg2d dma.
  *
  * @ctx: a pointer to g2d_context structure.
  *
  * This function should be called after all commands and values to user
- * side command buffer is set to summit that buffer to kernel side driver.
+ * side command buffer are set. It submits that buffer to the kernel side 
driver.
  */
 static int g2d_flush(struct g2d_context *ctx)
 {
@@ -193,7 +193,7 @@ static int g2d_flush(struct g2d_context *ctx)
 /**
  * g2d_init - create a new g2d context and get hardware version.
  *
- * fd: a file descriptor to drm device driver opened.
+ * fd: a file descriptor to an opened drm device.
  */
 drm_public struct g2d_context *g2d_init(int fd)
 {
@@ -525,7 +525,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,
 }

 /**
- * g2d_blend - blend image data in source and destion buffers
+ * g2d_blend - blend image data in source and destination buffers.
  *
  * @ctx: a pointer to g2d_context structure.
  * @src: a pointer to g2d_image structure including image and buffer
diff --git a/tests/exynos/exynos_fimg2d_test.c 
b/tests/exynos/exynos_fimg2d_test.c
index 41fb869..aa140e5 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -39,7 +39,7 @@ static unsigned int screen_width, screen_height;
 /*
  * A structure to test fimg2d hw.
  *
- * @solid_fild: fill given color data to source buffer.
+ * @solid_fill: fill given color data to source buffer.
  * @copy: copy source to destination buffer.
  * @copy_with_scale: copy source to destination buffer scaling up or
  * down properly.
@@ -256,7 +256,7 @@ static int g2d_solid_fill_test(struct exynos_device *dev, 
struct exynos_bo *dst)
memset(, 0, sizeof(struct g2d_image));
img.bo[0] = dst->handle;

-   printf("soild fill test.\n");
+   printf("solid fill test.\n");

srand(time(NULL));
img_w = screen_width;
-- 
2.0.5



[PATCH v2 02/15] exynos: replace G2D_DOUBLE_TO_FIXED macro with function

2015-02-16 Thread Tobias Jakobi
This also avoids the floating point conversion steps and just
uses pure integer arithmetic.
Since the G2D hardware scaling approach is a bit unintuitive,
document it in the function as well.

v2: Explicitly mention the normalization constant.
Signed-off-by: Tobias Jakobi 
---
 exynos/exynos_fimg2d.c | 20 +++-
 exynos/fimg2d.h|  2 --
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index ce1ba1e..037021a 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -41,6 +41,16 @@

 #define MIN(a, b)  ((a) < (b) ? (a) : (b))

+static unsigned int g2d_get_scaling(unsigned int src, unsigned int dst)
+{
+   /* The G2D hw scaling factor is a normalized inverse of the scaling 
factor. *
+* For example: When source width is 100 and destination width is 200   
*
+* (scaling of 2x), then the hw factor is NC * 100 / 200.   
*
+* The normalization factor (NC) is 2^16 = 0x1. 
*/
+
+   return ((src << 16) / dst);
+}
+
 static unsigned int g2d_get_blend_op(enum e_g2d_op op)
 {
union g2d_blend_func_val val;
@@ -428,7 +438,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,
union g2d_rop4_val rop4;
union g2d_point_val pt;
unsigned int scale;
-   double scale_x = 0.0f, scale_y = 0.0f;
+   unsigned int scale_x, scale_y;

g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR);
g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode);
@@ -454,8 +464,8 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,
scale = 0;
else {
scale = 1;
-   scale_x = (double)src_w / (double)dst_w;
-   scale_y = (double)src_h / (double)dst_h;
+   scale_x = g2d_get_scaling(src_w, dst_w);
+   scale_y = g2d_get_scaling(src_h, dst_h);
}

if (src_x + src_w > src->width)
@@ -487,8 +497,8 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct 
g2d_image *src,

if (scale) {
g2d_add_cmd(ctx, SRC_SCALE_CTRL_REG, G2D_SCALE_MODE_BILINEAR);
-   g2d_add_cmd(ctx, SRC_XSCALE_REG, G2D_DOUBLE_TO_FIXED(scale_x));
-   g2d_add_cmd(ctx, SRC_YSCALE_REG, G2D_DOUBLE_TO_FIXED(scale_y));
+   g2d_add_cmd(ctx, SRC_XSCALE_REG, scale_x);
+   g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y);
}

pt.val = 0;
diff --git a/exynos/fimg2d.h b/exynos/fimg2d.h
index 4785e2f..8e0321c 100644
--- a/exynos/fimg2d.h
+++ b/exynos/fimg2d.h
@@ -25,8 +25,6 @@
 #define G2D_MAX_CMD_LIST_NR64
 #define G2D_PLANE_MAX_NR   2

-#define G2D_DOUBLE_TO_FIXED(d) ((unsigned int)((d) * 65536.0))
-
 enum e_g2d_color_mode {
/* COLOR FORMAT */
G2D_COLOR_FMT_XRGB,
-- 
2.0.5



[PATCH v2 01/15] tests/exynos: fimg2d: add a checkerboard test

2015-02-16 Thread Tobias Jakobi
This makes it easier to spot memory corruptions which don't become
visible when using a plain buffer filled with a solid color (so
corruptions that are just a permutation of the bytes in the buffer).

Signed-off-by: Tobias Jakobi 
---
 tests/exynos/exynos_fimg2d_test.c | 117 ++
 1 file changed, 117 insertions(+)

diff --git a/tests/exynos/exynos_fimg2d_test.c 
b/tests/exynos/exynos_fimg2d_test.c
index c6bd558..41fb869 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -55,6 +55,9 @@ struct fimg2d_test_case {
int (*blend)(struct exynos_device *dev,
struct exynos_bo *src, struct exynos_bo *dst,
enum e_g2d_buf_type);
+   int (*checkerboard)(struct exynos_device *dev,
+   struct exynos_bo *src, struct exynos_bo *dst,
+   enum e_g2d_buf_type);
 };

 struct connector {
@@ -207,6 +210,33 @@ static struct exynos_bo *exynos_create_buffer(struct 
exynos_device *dev,
return bo;
 }

+/* Allocate buffer and fill it with checkerboard pattern, where the tiles *
+ * have a random color. The caller has to free the buffer.*/
+void *create_checkerboard_pattern(unsigned int num_tiles_x,
+   unsigned int num_tiles_y, 
unsigned int tile_size)
+{
+   unsigned int *buf;
+   unsigned int x, y, i, j;
+   const unsigned int stride = num_tiles_x * tile_size;
+
+   if (posix_memalign((void*), 64, num_tiles_y * tile_size * stride * 
4) != 0)
+   return NULL;
+
+   for (x = 0; x < num_tiles_x; ++x) {
+   for (y = 0; y < num_tiles_y; ++y) {
+   const unsigned int color = 0xff00 + (random() & 
0xff);
+
+   for (i = 0; i < tile_size; ++i) {
+   for (j = 0; j < tile_size; ++j) {
+   buf[x * tile_size + y * stride * 
tile_size + i + j * stride] = color;
+   }
+   }
+   }
+   }
+
+   return buf;
+}
+
 static void exynos_destroy_buffer(struct exynos_bo *bo)
 {
exynos_bo_destroy(bo);
@@ -533,11 +563,90 @@ err_free_userptr:
return 0;
 }

+static int g2d_checkerboard_test(struct exynos_device *dev,
+   struct exynos_bo *src,
+   struct exynos_bo *dst,
+   enum e_g2d_buf_type type)
+{
+   struct g2d_context *ctx;
+   struct g2d_image src_img = {0}, dst_img = {0};
+   unsigned int src_x, src_y, dst_x, dst_y, img_w, img_h;
+   void *checkerboard = NULL;
+   int ret;
+
+   ctx = g2d_init(dev->fd);
+   if (!ctx)
+   return -EFAULT;
+
+   dst_img.bo[0] = dst->handle;
+
+   src_x = 0;
+   src_y = 0;
+   dst_x = 0;
+   dst_y = 0;
+
+   checkerboard = create_checkerboard_pattern(screen_width / 32, 
screen_height / 32, 32);
+   if (checkerboard == NULL) {
+   ret = -1;
+   goto fail;
+   }
+
+   img_w = screen_width - (screen_width % 32);
+   img_h = screen_height - (screen_height % 32);
+
+   switch (type) {
+   case G2D_IMGBUF_GEM:
+   memcpy(src->vaddr, checkerboard, img_w * img_h * 4);
+   src_img.bo[0] = src->handle;
+   break;
+   case G2D_IMGBUF_USERPTR:
+   src_img.user_ptr[0].userptr = (unsigned long)checkerboard;
+   src_img.user_ptr[0].size = img_w * img_h * 4;
+   break;
+   default:
+   ret = -EFAULT;
+   goto fail;
+   }
+
+   printf("checkerboard test with %s.\n",
+   type == G2D_IMGBUF_GEM ? "gem" : "userptr");
+
+   src_img.width = img_w;
+   src_img.height = img_h;
+   src_img.stride = src_img.width * 4;
+   src_img.buf_type = type;
+   src_img.color_mode = G2D_COLOR_FMT_ARGB | G2D_ORDER_AXRGB;
+
+   dst_img.width = screen_width;
+   dst_img.height = screen_height;
+   dst_img.stride = dst_img.width * 4;
+   dst_img.buf_type = G2D_IMGBUF_GEM;
+   dst_img.color_mode = G2D_COLOR_FMT_ARGB | G2D_ORDER_AXRGB;
+   src_img.color = 0xff00;
+   ret = g2d_solid_fill(ctx, _img, src_x, src_y, screen_width, 
screen_height);
+   if (ret < 0)
+   goto fail;
+
+   ret = g2d_copy(ctx, _img, _img, src_x, src_y, dst_x, dst_y,
+   img_w, img_h);
+   if (ret < 0)
+   goto fail;
+
+   g2d_exec(ctx);
+
+fail:
+   free(checkerboard);
+   g2d_fini(ctx);
+
+   return ret;
+}
+
 static struct fimg2d_test_case test_case = {
.solid_fill = _solid_fill_test,
.copy = _copy_test,
.copy_with_scale = _copy_with_scale_test,
.blend = _blend_test,
+   

[v2] libdrm: improvements to userspace exynos component

2015-02-16 Thread Tobias Jakobi
Hello,

here are some miscellaneous improvements (small features, bugfixes, spelling 
fixes, etc.) for the exynos component of libdrm. The general idea is to let 
userspace use the G2D engine functionality more 
efficiently.

If someone is interested in an application that actually makes use of this, the 
RetroArch frontend has a custom video backend:
https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c


Please review and let me know what I can improve.

v2:
- Mention value of G2D scaling normalization factor (02/15).
- Moved patch (04/15) description from commit message to source itself, like 
suggested by Joonyoung Shim.

With best wishes,
Tobias




[BISECTED REGRESSION in 3.19-rc1] [drm/i915] WARNING: drivers/gpu/drm/drm_irq.c:1077 drm_wait_one_vblank

2015-02-16 Thread Paul Bolle
Andrey Skvortsov schreef op wo 04-02-2015 om 20:26 [+0300]:
> On Wed, Feb 04, 2015 at 01:32:14PM +0100, Paul Bolle wrote:
> > Andrey Skvortsov schreef op zo 01-02-2015 om 00:16 [+0300]:
> > > this warning exist in v3.19-rc6 and does not in v3.18. Bisection
> > > points to the commit 51e31d49c890552 "drm/i915: Use generic vblank wait".
> > > I have two machines with integrated Intel graphics and the problem
> > > happens only on the old one with  GM965 chipset and X3100 integrated 
> > > graphics.
> > 
> > I see this too, since v3.19-rc1, on an (outdated) ThinkPad X41.
> > 
> > > backtrace information:
> > > 
> > > [   31.780813] WARNING: CPU: 0 PID: 718 at drivers/gpu/drm/drm_irq.c:1077 
> > > drm_wait_one_vblank+0x33/0x141 [drm]()
> > 
> > But it also prints
> > vblank not available on crtc 0, ret=-22
> > 
> > after the WARNING line, on that machine.
> 
> I have "vblank not available on crtc 1, ret=-22" there.
> 
> 
> > > [   31.780862]  thermal_sys(E)
> > > [   31.780866] CPU: 0 PID: 718 Comm: kworker/u4:3 Tainted: GE 
> > >  3.17.0-rc5-150116--00578-g51e31d4 #16
> > > [   31.780868] Hardware name: Dell Inc. Vostro 1500 
> > > /0NX907, BIOS A06 04/21/2008
> > > [   31.780873] Workqueue: events_unbound async_run_entry_fn
> > > [   31.780875]   a0544b9d 813d4e81 
> > > 
> > > [   31.780879]  8103dec3 8800d84e0068 a0521c73 
> > > 00070008
> > > [   31.780882]  8800d84e 8801973e0800  
> > > 6014
> > > [   31.780886] Call Trace:
> > > [   31.780890]  [] ? dump_stack+0x4a/0x75
> > > [   31.780894]  [] ? warn_slowpath_common+0x7e/0x97
> > > [   31.781050]  [] ? drm_wait_one_vblank+0x33/0x141 
> > > [drm]
> > > [   31.781078]  [] ? drm_wait_one_vblank+0x33/0x141 
> > > [drm]
> > > [   31.781122]  [] ? intel_enable_tv+0x22/0x58 [i915]
> > > [   31.781153]  [] ? i9xx_crtc_enable+0x33b/0x397 [i915]
> > > [   31.781184]  [] ? __intel_set_mode+0x1160/0x1209 
> > > [i915]
> > > [   31.781216]  [] ? intel_set_mode+0x12/0x2c [i915]
> > > [   31.781247]  [] ? 
> > > intel_get_load_detect_pipe+0x367/0x408 [i915]
> > > [   31.781281]  [] ? intel_tv_detect+0x103/0x444 [i915]
> > > [   31.781289]  [] ? 
> > > drm_helper_probe_single_connector_modes_merge_bits+0xc0/0x327 
> > > [drm_kms_helper]
> > > [   31.781296]  [] ? 
> > > drm_fb_helper_probe_connector_modes+0x3d/0x51 [drm_kms_helper]
> > > [   31.781303]  [] ? 
> > > drm_fb_helper_initial_config+0x3d/0x303 [drm_kms_helper]
> > > [   31.781306]  [] ? async_run_entry_fn+0x5a/0x110
> > > [   31.781310]  [] ? process_one_work+0x194/0x292
> > > [   31.781313]  [] ? worker_thread+0x236/0x298
> > > [   31.781316]  [] ? process_scheduled_works+0x2a/0x2a
> > > [   31.781319]  [] ? kthread+0x9e/0xa6
> > > [   31.781322]  [] ? 
> > > kthread_freezable_should_stop+0x36/0x36
> > > [   31.781326]  [] ? ret_from_fork+0x7c/0xb0
> > > [   31.781329]  [] ? 
> > > kthread_freezable_should_stop+0x36/0x36
> > > [   31.782726] ---[ end trace e2b78017f1a10054 ]---

I still see this on v3.19. I booted with drm.debug=0x4. The almost 2K
lines in dmesg containing either "[drm" or this WARNING are pasted
below. I really know nothing about all this, but I do note that only the
WARNINGS are preceded by:
[drm:intel_calculate_wm] FIFO watermark level: -5
[drm:i9xx_update_wm] FIFO watermarks - A: 26, B: 8

But perhaps that's another symptom of the same issue. A bit of staring
at the code couldn't help me determine that.

Perhaps these debug messages help someone in discovering what might be
going on here.


Paul Bolle

<6>[2.537208] [drm] Initialized drm 1.1.0 20060810
<7>[2.845633] [drm:intel_detect_pch] No PCH found.
<6>[2.845642] [drm] Memory usable by graphics device = 256M
<6>[2.846625] [drm] Replacing VGA console driver
<6>[2.848689] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
<6>[2.848695] [drm] Driver supports precise vblank timestamp query.
<7>[2.848700] [drm:init_vbt_defaults] Set default to SSC at 10 kHz
<7>[2.848735] [drm:validate_vbt] Using VBT from PCI ROM: $VBT ALVISO
 d
<7>[2.848739] [drm:parse_general_features] BDB_GENERAL_FEATURES 
int_tv_support 1 int_crt_support 0 lvds_use_ssc 1 lvds_ssc_freq 10 
display_clock_mode 0 fdi_rx_polarity_inverted 0
<7>[2.848743] [drm:parse_general_definitions] crt_ddc_bus_pin: 2
<7>[2.848747] [drm:parse_lfp_panel_data] DRRS supported mode is static
<7>[2.848752] [drm:parse_lfp_panel_data] Found panel mode in BIOS VBT 
tables:
<7>[2.848757] [drm:drm_mode_debug_printmodeline] Modeline 0:"1024x768" 0 
54160 1024 1048 1184 1344 768 771 777 806 0x8 0xa
<7>[2.848761] [drm:parse_lfp_panel_data] VBT initial LVDS value 4300
<7>[2.848765] [drm:parse_lfp_backlight] VBT backlight PWM modulation 
frequency 225 Hz, active high, min brightness 0, level 0
<7>[2.848769] [drm:parse_sdvo_panel_data] Found SDVO panel 

[PATCH] drm/amdkfd: Initialize only amdkfd's assigned pipelines

2015-02-16 Thread Oded Gabbay
This patch fixes a bug in the initialization of the pipelines. The
init_pipelines() function was called with a constant value of 0 in the
first_pipe argument. This is an error because amdkfd doesn't handle pipe 0.

The correct way is to pass the value that get_first_pipe() returns as the
argument for first_pipe.

This bug appeared in 3.19 (first version with amdkfd) and it causes around 15%
drop in CPU performance of Kaveri (A10-7850).

Signed-off-by: Oded Gabbay 
Cc: stable at vger.kernel.org
Tested-by: Michel Dänzer 
---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 --
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 6 ++
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 36b95e1..38568b2 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -62,12 +62,6 @@ enum KFD_MQD_TYPE get_mqd_type_from_queue_type(enum 
kfd_queue_type type)
return KFD_MQD_TYPE_CP;
 }

-static inline unsigned int get_first_pipe(struct device_queue_manager *dqm)
-{
-   BUG_ON(!dqm);
-   return dqm->dev->shared_resources.first_compute_pipe;
-}
-
 static inline unsigned int get_pipes_num_cpsch(void)
 {
return PIPE_PER_ME_CP_SCHEDULING;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
index d64f86c..8e8e5985 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
@@ -181,4 +181,10 @@ extern inline unsigned int get_pipes_num(struct 
device_queue_manager *dqm)
return dqm->dev->shared_resources.compute_pipe_count;
 }

+extern inline unsigned int get_first_pipe(struct device_queue_manager *dqm)
+{
+   BUG_ON(!dqm);
+   return dqm->dev->shared_resources.first_compute_pipe;
+}
+
 #endif /* KFD_DEVICE_QUEUE_MANAGER_H_ */
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c
index 6b07246..5469efe 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c
@@ -131,5 +131,5 @@ static int register_process_cik(struct device_queue_manager 
*dqm,

 static int initialize_cpsch_cik(struct device_queue_manager *dqm)
 {
-   return init_pipelines(dqm, get_pipes_num(dqm), 0);
+   return init_pipelines(dqm, get_pipes_num(dqm), get_first_pipe(dqm));
 }
-- 
1.9.1



Update front buffer without CPU interaction?

2015-02-16 Thread Volker Vogelhuber
I'm currently trying to setup a rendering pipe on an Intel Baytrail 
E3845 cpu.
In our product we want to have an FPGA streaming video images to a 
predefined memory area using bus master dma and render those images 
using OpenGL. So far this works in a preliminary state.
We now have the security requirement that in case the CPU 
(software/kernel driver) crashes for what ever reason, the GPU display 
signal should still output at least the video images (obviously any 
additional render stuff will not be available anymore). My question is 
now, would it be possible to get the physical address of the DRM front 
buffer, so that I can provide this address to the FPGA (connected via 
PCIe) and is it possible to have the GPU still reading the last front 
buffer for the display output while the FPGA writes to that area. So I 
would think that the GPU has some kind of DMA engine running, that 
continuously reading the last front buffer until switched to another 
buffer by the CPU. So even if the CPU does not control the GPU anymore, 
it might be possible to have the front buffer updated by the FPGA 
directly. Of course there will be tearing artefacts as no VSYNC will be 
available but that wouldn't be an issue so far.

Kind regards,
 Volker




Regression caused by "drm/radeon: Don't increment pipe_id in kgd_init_pipeline"

2015-02-16 Thread Oded Gabbay


On 02/13/2015 12:01 PM, Michel Dänzer wrote:
>
> Hi Oded,
>
>
> the commit in the subject (5aa3119eb5b67f6e90605be9ed2e04807126)
> somehow causes degraded CPU (!) performance on my Kaveri box. E.g. a
> piglit run takes about 15% longer, and I suspect the same is true for
> e.g. compiling the kernel, though I haven't measured that explicitly.
>
> In addition to the measurably worse performance, the commit causes the
> CPU fan to stay significantly quieter during CPU-bound tasks, so maybe
> the commit somehow causes the CPU not to achieve turbo clocks or
> something like that.
>
> I'm attaching my .config. I don't see any difference in dmesg with or
> without the commit.
>
>
Hi Michel,
Thanks for catching that.
As we talked on IRC, there is indeed a bug in amdkfd.
I will publish the fix you tested to be included in 3.20 and mark it as stable.
I will also add piglit to my regression tests.

Oded


[PATCH RFC v9 01/20] clk: divider: Correct parent clk round rate if no bestdiv is normally found

2015-02-16 Thread Tomi Valkeinen
On 13/02/15 20:57, Sascha Hauer wrote:
> On Fri, Feb 13, 2015 at 04:35:36PM +0200, Tomi Valkeinen wrote:
>> On 12/02/15 15:41, Sascha Hauer wrote:
>>
>>> Tomis patch is based on the assumption that 
>>> clk_set_rate(clk_round_rate(rate))
>>> is equal to clk_round_rate(rate). So when this assumption is wrong then
>>> it should simply be reverted.
>>
>> When is it not equal?
>>
>> I agree that doing clk_set_rate(clk, clk_round_rate(clk, rate)) is
>> pointless, but shouldn't it still work?
>>
>> And we can forget about clk_round_rate. Without my patch, this would
>> behave oddly also:
>>
>> rate = clk_get_rate(clk);
>> clk_set_rate(clk, rate);
>>
>> The end result could be something else than 'rate'.
> 
> I agree that it's a bit odd, but I think it has to be like this.
> Consider that you request a rate of 100Hz, but the clock can only
> produce 99.5Hz, so due to rounding clk_round_rate() returns 99Hz.
> Now when you request 99Hz from clk_set_rate() the 99.5Hz value
> can't be used because it's too high.

Would that problem better be fixed by changing the clock driver so that
when asked for 99Hz, it would look for rates less than 100Hz?

I think the old behavior was so odd that I would call it broken, so I
hope the current problems can be fixed via some other ways than breaking
it again.

 Tomi


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


Bug in uninorth-agp.c parsing of module parameter uninorth_agp.aperture

2015-02-16 Thread Michel Dänzer
On 16.02.2015 03:27, Jochen Rollwagen wrote:
> Hi,
> 
> i found a bug in uninorth-agp.c, function uninorth_fetch_size.
> 
> the line
> 
> size = memparse(aperture, ) >> 20;
> 
> always sets size to zero which makes the driver allocate the default
> size of 256 MB which is obviously too large for older uninorth
> revisions.

Sounds like the default should be lower for older UniNorth revisions.
Can you make a patch for that?


> I split the line into memparse and shifting and inserted diagnostic
> messages, output with uninorth_agp.aperture = 32 as boot parameter:
> 
> Feb 15 19:12:44 mac-mini kernel: [2.568636] agpgart-uninorth
> :00:0b.0: size in uninorth_fetch_size after memparse: 32 Feb 15
> 19:12:44 mac-mini kernel: [2.568642] agpgart-uninorth
> :00:0b.0: size after >> 20: 0

Following your memparse link to
http://lxr.free-electrons.com/source/lib/cmdline.c#L127 , you can see
that the memparse function supports suffices such as 'M' or 'm'; without
suffix, the size is interpreted as bytes.

So you need something like uninorth_agp.aperture=32m .


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH RFC v9 01/20] clk: divider: Correct parent clk round rate if no bestdiv is normally found

2015-02-16 Thread Russell King - ARM Linux
On Fri, Feb 13, 2015 at 07:57:13PM +0100, Sascha Hauer wrote:
> I agree that it's a bit odd, but I think it has to be like this.
> Consider that you request a rate of 100Hz, but the clock can only
> produce 99.5Hz, so due to rounding clk_round_rate() returns 99Hz.
> Now when you request 99Hz from clk_set_rate() the 99.5Hz value
> can't be used because it's too high.

Math rounding rules normally state that anything of .5 and greater
should be rounded up, not rounded down.  So, for 99.5Hz, you really
ought to be returning 100Hz, not 99Hz.

However, you do have a point for 99.4Hz, which would be returned as
99Hz, and when set, it would result in something which isn't 99.4Hz.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[Bug 89164] AMD Kaveri: gbm_bo_get_stride returns wrong values for cursor buffers

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89164

Michel Dänzer  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTABUG

--- Comment #1 from Michel Dänzer  ---
You need to pass the dimensions queried from DRM_CAP_CURSOR_WIDTH and
DRM_CAP_CURSOR_HEIGHT instead of hardcoding 64. As of CIK, Radeon hardware only
supports 256x256 hardware cursors.

-- 
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/20150216/dcc38048/attachment.html>


[Bug 89164] AMD Kaveri: gbm_bo_get_stride returns wrong values for cursor buffers

2015-02-16 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89164

Bug ID: 89164
   Summary: AMD Kaveri: gbm_bo_get_stride returns wrong values for
cursor buffers
   Product: Mesa
   Version: 10.4
  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: andreas.pokorny at gmail.com
QA Contact: dri-devel at lists.freedesktop.org

When creating a cursor with GBM_BO_USE_CURSOR{_64x64} and a dimension of 64 by
64 pixel the operation succeeds and the returned stride size is always 256.
When drawing the cursor buffer and displaying on screen graphical artifacts
appear. Instead of 128 bytes a stride size of 512 seems to be correct on Kaveri
systems. 

For this particular scenario there is a workaround: query 'an arbitrary but
valid cursor buffer size' with DRM_CAP_CURSOR_WIDTH DRM_CAP_CURSOR_HEIGHT.

Still gbm_bo_get_stride should not return a wrong stride size.

-- 
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/20150216/407acfe6/attachment.html>


[git pull] drm pull for 3.20-rc1

2015-02-16 Thread Dave Airlie

Hi Linus,

This is the main drm pull, it has a shared branch with some alsa crossover
but everything should be acked by relevant people.

New drivers:
ATMEL HLCDC driver
designware HDMI core support (used in multiple SoCs).

core: 
lots more atomic modesetting work, properties and atomic ioctl (hidden 
under option)
bridge rework allows support for Samsung exynos chromebooks to work 
finally.
some more panels supported

i915:
atomic plane update support
DSI uses shared DSI infrastructure
Skylake basic support is all merged now
component framework used for i915/snd-hda interactions
write-combine cpu memory mappings
engine init code refactored
full ppgtt enabled where execlists are enabled.
cherryview rps/gpu turbo and pipe CRC support.

radeon:
indirect draw support for evergreen/cayman
SMC and manual fan control for SI/CI
Displayport audio support

amdkfd:
SDMA usermode queue support
replace suballocator usage with more suitable one
rework for allowing interfacing to more than radeon

nouveau:
major renaming in prep for later splitting work
merge arm platform driver into nouveau
GK20A reclocking support

msm:
conversion to atomic modesetting
YUV support for mdp4/5
eDP support
hw cursor for mdp5

tegra:
conversion to atomic modesetting
better suspend/resume support for child devices

rcar-du:
interlaced support

imx:
move to using dw_hdmi shared support
mode_fixup support

sti:
DVO support
HDMI infoframe support

exynos:
refactoring and cleanup, removed lots of internal unnecessary 
abstraction
exynos7 DECON display controller support

Along with the usual bunch of fixes, cleanups etc.

Dave.

The following changes since commit c59c961ca511dc7ee2f4f7e9c224d16f5c76ca6e:

  Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 
(2015-01-27 19:12:38 -0800)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux drm-next

for you to fetch changes up to 45ee2dbc65cbf6910892c480e6f428be342fa733:

  Merge branch 'drm-next-3.20' of git://people.freedesktop.org/~agd5f/linux 
into drm-next (2015-02-16 13:55:49 +1000)



Ajay Kumar (13):
  drm/exynos: fimd: check error status for drm_iommu_attach_device
  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
  drm/exynos: Add DECON driver

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

Alban Browaeys (1):
  drm/exynos: fix no hdmi output

Alex Deucher (19):
  drm/radeon: bind fan control on SI cards to hwmon interface
  drm/radeon: enable smc fan control on SI
  drm/radeon: comment out some currently unused ci dpm code
  drm/radeon: comment out some currently unused si dpm code
  drm/radeon: comment out some currently unused kv dpm code
  drm/radeon: comment out some currently unused ni dpm code
  drm/radeon: comment out some currently unused btc dpm code
  drm/radeon: comment out some currently unused tn dpm code
  drm/radeon: comment out some currently unused sumo dpm code
  drm/radeon: comment out some currently unused eg dpm code
  drm/radeon: comment out some currently unused 7xx dpm code
  radeon/audio: consolidate write_sad_regs() functions
  radeon/audio: moved VBI packet programming to separate functions
  drm/radeon: whitespace clean up in radeon_audio.c
  drm/radeon: use NULL rather then 0 in audio detect
  drm/radeon: use 0-255 rather than 0-100 for pwm fan range
  drm/radeon: only enable kv/kb dpm interrupts once v3
  drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary
  drm/radeon: fix voltage setup on hawaii

Alexandre Courbot (3):
  drm/nouveau: sgdma: remove unused nouveau_sgdma_be::dev
  drm/nouveau: sgdma: add comment around suspiscious error handler
  drm/nouveau: merge nouveau_platform.ko into nouveau.ko

Alexey Skidanov (2):
  drm/amdkfd: Add number of watch points to topology
  drm/amdkfd: Process-device data creation and lookup split

Ander Conselvan de Oliveira (11):
  drm/i915: Remove unnecessary goto in intel_primary_plane_disable()

[Bug 93281] Kernel modesetting causes the kernel to lock up during boot on a late 2011 MacBook Pro

2015-02-16 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=93281

--- Comment #9 from Michel Dänzer  ---
Looks like this should be reassigned to the Intel component.

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