[Bug 41762] radeon default power_profile "default" makes laptop overheat (Mobility Radeon HD 3650)

2013-03-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=41762

aleritty  changed:

   What|Removed |Added

   Hardware|x86-64 (AMD64)  |All

--- Comment #9 from aleritty  ---
I tested this on a lot of kernels and distribution both iX86 or x64

My card is a Mobility Radeon HD 4500, RV710

Actually I think that the profile have to be set on low by default, to prevent
hardware damages.

But this is not enough, because with proprietary drivers the card run around
55?C on my system, but with the radeon and low profile is around 70?C, and with
the default the temperature (idle system) go around 82?C for most of the time.

This can easily harm a system.

Actually this bug assume a big importance because most of the affected chip
aren't supported anymore from proprietary drivers, so a user can unconsciously
run into troubles and hardware damage after a simply upgrade.

-- 
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/20130308/3f987a0d/attachment.html>


[PATCHv5,RESEND 3/8] gpu: host1x: Add channel support

2013-03-08 Thread Thierry Reding
On Fri, Mar 08, 2013 at 06:16:16PM +0200, Terje Bergstr?m wrote:
> On 26.02.2013 11:48, Terje Bergstr?m wrote:
> > On 25.02.2013 17:24, Thierry Reding wrote:
[...]
> >>> +struct mem_handle;
> >>> +struct platform_device;
> >>> +
> >>> +struct host1x_job_unpin_data {
> >>> + struct mem_handle *h;
> >>> + struct sg_table *mem;
> >>> +};
> >>> +
> >>> +enum mem_mgr_flag {
> >>> + mem_mgr_flag_uncacheable = 0,
> >>> + mem_mgr_flag_write_combine = 1,
> >>> +};
> >>
> >> I'd like to see this use a more object-oriented approach and more common
> >> terminology. All of these handles are essentially buffer objects, so
> >> maybe something like host1x_bo would be a nice and short name.
> 
> We did this a bit differently, but following pretty much the same
> principles. We have host1x_mem_handle, which contains an ops pointer.
> The handle gets encapsulated inside drm_gem_cma_object.
> 
> _bo structs seem to usually contains a drm_gem_object, so we thought
> it's better not to reuse that term.
> 
> Please check the code and let us know what you think. This pretty much
> follows what Lucas proposed a while ago, and keeps neatly the DRM
> specific parts inside the drm directory.

A bo is just a buffer object, so I don't see why the name shouldn't be
used. The name is in no way specific to DRM or GEM. But the point that I
was trying to make was that there is nothing to suggest that we couldn't
use drm_gem_object as the underlying scaffold to base all host1x buffer
objects on.

Furthermore I don't understand why you've chosen this approach. It is
completely different from what other drivers do and therefore makes it
more difficult to comprehend. That alone I could live with if there were
any advantages to that approach, but as far as I can tell there are
none.

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


[Bug 36934] screen corruption after running a game

2013-03-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=36934

--- Comment #18 from auxsvr at gmail.com ---
This hasn't occurred since I upgraded to openSUSE 12.2.

-- 
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/20130308/e05b4f12/attachment.html>


[Bug 61979] backlight adjustment doesn't work on HP Pavilion m6-1035dx

2013-03-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=61979

S. Christian Collins  changed:

   What|Removed |Added

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

--- Comment #2 from S. Christian Collins  ---
I tested the newer kernel by using a Kubuntu Raring CD, and the backlight
adjustments work fine with the Radeon driver. So, I am marking this bug as
fixed.

-- 
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/20130308/11507405/attachment.html>


[PATCHv5,RESEND 3/8] gpu: host1x: Add channel support

2013-03-08 Thread Terje Bergström
On 26.02.2013 11:48, Terje Bergstr?m wrote:
> On 25.02.2013 17:24, Thierry Reding wrote:
>> You use two different styles to indent the function parameters. You
>> might want to stick to one, preferably aligning them with the first
>> parameter on the first line.
> 
> I've generally favored "two tabs" indenting, but we'll anyway
> standardize on one.

We standardized on the convention used in tegradrm, i.e. aligning with
first parameter.

>> There's nothing in this function that requires a platform_device, so
>> passing struct device should be enough. Or maybe host1x_cdma should get
>> a struct device * field?
> 
> I think we'll just start using struct device * in general in code.
> Arto's been already fixing a lot of these, so he might've already fixed
> this.

We did a sweep in the code and now I hope everything that can, uses
struct device *. The side effect was getting rid of a lot of casting,
which is good.

>> Why don't you use any of the kernel's reference counting mechanisms?
>>
>>> +void host1x_channel_put(struct host1x_channel *ch)
>>> +{
>>> + mutex_lock(>reflock);
>>> + if (ch->refcount == 1) {
>>> + host1x_get_host(ch->dev)->cdma_op.stop(>cdma);
>>> + host1x_cdma_deinit(>cdma);
>>> + }
>>> + ch->refcount--;
>>> + mutex_unlock(>reflock);
>>> +}
>>
>> I think you can do all of this using a kref.
> 
> I think the original reason was that there's no reason to use atomic
> kref, as we anyway have to do mutual exclusion via mutex. But, using
> kref won't be any problem, so we could use that.

Actually, we ended up with a problem with this. kref assumes that once
refcount goes to zero, it gets destroyed. In ch->refcount, going to zero
is just fine and just indicates that we need to initialize. And, we
anyway need to do locking, so we didn't do the conversion to kref.

>>> +struct host1x_channel *host1x_channel_alloc(struct platform_device *pdev)
>>> +{
(...)
>>> +}
>>
>> I think the critical section could be shorter here. It's probably not
>> worth the extra trouble, though, given that channels are not often
>> allocated.
> 
> Yeah, boot time isn't measured in microseconds. :-) But, if we just make
> allocated_channels an atomic, we should be able to drop chlist_mutex
> altogether and it could simplify the code.

There wasn't much we could have moved outside the critical section, so
we didn't touch this area.

>> Also, is it really necessary to abstract these into an ops structure? I
>> get that newer hardware revisions might require different ops for sync-
>> point handling because the register layout or number of syncpoints may
>> be different, but the CDMA and push buffer (below) concepts are pretty
>> much a software abstraction, and as such its implementation is unlikely
>> to change with some future hardware revision.
> 
> Pushbuffer ops can become generic. There's only one catch - init uses
> the restart opcode. But the opcode is not going to change, so we can
> generalize that.

We ended up keeping the init as an operation, but rest of push buffer
ops became generic.

>>
>>> +/*
>>> + * Push two words to the push buffer
>>> + * Caller must ensure push buffer is not full
>>> + */
>>> +static void push_buffer_push_to(struct push_buffer *pb,
>>> + struct mem_handle *handle,
>>> + u32 op1, u32 op2)
>>> +{
>>> + u32 cur = pb->cur;
>>> + u32 *p = (u32 *)((u32)pb->mapped + cur);
>>
>> You do all this extra casting to make sure to increment by bytes and not
>> 32-bit words. How about you change pb->cur to contain the word index, so
>> that you don't have to go through hoops each time around.

When we changed DMASTART and DMAEND to actually denote the push buffer
area, we noticed that DMAGET and DMAPUT are actually relative to
DMASTART and DMAEND. This and the need to access both CPU and device
virtual addresses coupled with changing to word indexes didn't actually
simplify the code, so we kept still using byte indexes.

>>
>>> +/*
>>> + * Return the number of two word slots free in the push buffer
>>> + */
>>> +static u32 push_buffer_space(struct push_buffer *pb)
>>> +{
>>> + return ((pb->fence - pb->cur) & (PUSH_BUFFER_SIZE - 1)) / 8;
>>> +}
>>
>> Why & (PUSH_BUFFER_SIZE - 1) here? fence - cur can never be larger than
>> PUSH_BUFFER_SIZE, can it?
> 
> You're right, this function doesn't need to worry about wrapping.

Arto noticed this, but actually I was wrong - the wrapping is very
possible. We just have to remember that if we're processing something at
the end of push buffer, cur might be in the end, and fence in the beginning.

>>> diff --git a/drivers/gpu/host1x/memmgr.h b/drivers/gpu/host1x/memmgr.h
>> [...]
>>> +struct mem_handle;
>>> +struct platform_device;
>>> +
>>> +struct host1x_job_unpin_data {
>>> + struct mem_handle *h;
>>> + struct sg_table *mem;
>>> +};
>>> +
>>> +enum mem_mgr_flag {
>>> + mem_mgr_flag_uncacheable = 0,
>>> + mem_mgr_flag_write_combine = 1,
>>> +};
>>
>> I'd like to see 

[Bug 60879] X11 can't start with acceleration enabled

2013-03-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=60879

--- Comment #12 from Michel D?nzer  ---
(In reply to comment #11)
> egltri_screen doesn't hang the GPU. Only Xorg does. egltri_screen and weston
> fail to clear the buffer or render anything.

Because the GPU hangs trying to render anything. :) The kernel output is from
resetting the hung GPU.

-- 
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/20130308/34a48519/attachment.html>


[Bug 60879] X11 can't start with acceleration enabled

2013-03-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=60879

--- Comment #11 from Hristo Venev  ---
It's the same as starting weston. egltri_screen doesn't hang the GPU. Only Xorg
does. egltri_screen and weston fail to clear the buffer or render anything.
With current llvm svn, mesa git, libdrm git and linux 3.8.2 the problem is
still there.

-- 
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/20130308/0200d7f7/attachment.html>


[PATCHv6 9/9] drm: tegra: Add gr2d device

2013-03-08 Thread Terje Bergstrom
Add client driver for 2D device, and IOCTLs to pass work to host1x
channel for 2D.

Also adds functions that can be called to access sync points from
DRM.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/Makefile   |1 +
 drivers/gpu/host1x/dev.c  |7 +
 drivers/gpu/host1x/drm/drm.c  |  239 +-
 drivers/gpu/host1x/drm/drm.h  |   28 +++-
 drivers/gpu/host1x/drm/gr2d.c |  325 +
 drivers/gpu/host1x/host1x.h   |3 +-
 include/drm/tegra_drm.h   |  131 +
 7 files changed, 730 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/host1x/drm/gr2d.c
 create mode 100644 include/drm/tegra_drm.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index d1d7e35..d90168f 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -17,4 +17,5 @@ ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
 host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/cma.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/gr2d.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 6af8081..0091632 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -211,11 +211,17 @@ static int __init tegra_host1x_init(void)
err = platform_driver_register(_hdmi_driver);
if (err < 0)
goto unregister_dc;
+
+   err = platform_driver_register(_gr2d_driver);
+   if (err < 0)
+   goto unregister_hdmi;
 #endif

return 0;

 #ifdef CONFIG_DRM_TEGRA
+unregister_hdmi:
+   platform_driver_unregister(_hdmi_driver);
 unregister_dc:
platform_driver_unregister(_dc_driver);
 unregister_host1x:
@@ -228,6 +234,7 @@ module_init(tegra_host1x_init);
 static void __exit tegra_host1x_exit(void)
 {
 #ifdef CONFIG_DRM_TEGRA
+   platform_driver_unregister(_gr2d_driver);
platform_driver_unregister(_hdmi_driver);
platform_driver_unregister(_dc_driver);
 #endif
diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c
index dbd4808..1f0754a 100644
--- a/drivers/gpu/host1x/drm/drm.c
+++ b/drivers/gpu/host1x/drm/drm.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Avionic Design GmbH
- * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (C) 2012-2013 NVIDIA CORPORATION.  All rights reserved.
  *
  * 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
@@ -8,13 +8,17 @@
  */

 #include 
+#include 
 #include 
 #include 
 #include 
 #include 

+#include "cma.h"
+#include "dev.h"
 #include "drm.h"
 #include "host1x_client.h"
+#include "syncpt.h"

 #define DRIVER_NAME "tegra"
 #define DRIVER_DESC "NVIDIA Tegra graphics"
@@ -77,8 +81,10 @@ static int host1x_parse_dt(struct host1x_drm *host1x)
static const char * const compat[] = {
"nvidia,tegra20-dc",
"nvidia,tegra20-hdmi",
+   "nvidia,tegra20-gr2d",
"nvidia,tegra30-dc",
"nvidia,tegra30-hdmi",
+   "nvidia,tegra30-gr2d",
};
unsigned int i;
int err;
@@ -273,9 +279,24 @@ static int tegra_drm_unload(struct drm_device *drm)

 static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp)
 {
+   struct host1x_drm_file *fpriv;
+
+   fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
+   if (!fpriv)
+   return -ENOMEM;
+
+   INIT_LIST_HEAD(>contexts);
+   filp->driver_priv = fpriv;
+
return 0;
 }

+static void host1x_drm_context_free(struct host1x_drm_context *context)
+{
+   context->client->ops->close_channel(context);
+   kfree(context);
+}
+
 static void tegra_drm_lastclose(struct drm_device *drm)
 {
struct host1x_drm *host1x = drm->dev_private;
@@ -283,7 +304,214 @@ static void tegra_drm_lastclose(struct drm_device *drm)
drm_fbdev_cma_restore_mode(host1x->fbdev);
 }

+static int tegra_drm_ioctl_syncpt_read(struct drm_device *drm, void *data,
+  struct drm_file *file_priv)
+{
+   struct tegra_drm_syncpt_read_args *args = data;
+   struct host1x *host = host1x_get_host(drm->dev);
+   struct host1x_syncpt *sp = host1x_syncpt_get(host, args->id);
+
+   if (!sp)
+   return -EINVAL;
+
+   args->value = host1x_syncpt_read_min(sp);
+   return 0;
+}
+
+static int tegra_drm_ioctl_syncpt_incr(struct drm_device *drm, void *data,
+  struct drm_file *file_priv)
+{
+   struct tegra_drm_syncpt_incr_args *args = data;
+   struct host1x *host = host1x_get_host(drm->dev);
+   struct host1x_syncpt *sp = host1x_syncpt_get(host, args->id);
+
+   if (!sp)
+   return -EINVAL;
+
+   

[PATCHv6 8/9] gpu: host1x: drm: Add CMA ops for host1x driver

2013-03-08 Thread Terje Bergstrom
From: Arto Merilainen 

This patch adds CMA memory operations for host1x driver. This allows
usage of CMA buffers inside host1x driver.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/Makefile  |1 +
 drivers/gpu/host1x/drm/cma.c |   87 ++
 drivers/gpu/host1x/drm/cma.h |   26 +
 3 files changed, 114 insertions(+)
 create mode 100644 drivers/gpu/host1x/drm/cma.c
 create mode 100644 drivers/gpu/host1x/drm/cma.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index ad39fef..d1d7e35 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -16,4 +16,5 @@ ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG

 host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/cma.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/drm/cma.c b/drivers/gpu/host1x/drm/cma.c
new file mode 100644
index 000..1c5d000
--- /dev/null
+++ b/drivers/gpu/host1x/drm/cma.c
@@ -0,0 +1,87 @@
+/*
+ * Tegra host1x CMA support
+ *
+ * Copyright (c) 2012-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "memmgr.h"
+
+static void cma_put(void *handle_data)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   struct drm_device *drm = obj->base.dev;
+
+   mutex_lock(>struct_mutex);
+   drm_gem_object_unreference(>base);
+   mutex_unlock(>struct_mutex);
+}
+
+static dma_addr_t cma_pin(void *handle_data, struct sg_table **sgt)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   return obj->paddr;
+}
+
+static void cma_unpin(void *handle_data, struct sg_table *sgt)
+{
+}
+
+static void *cma_mmap(void *handle_data)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   return obj->vaddr;
+}
+
+static void cma_munmap(void *handle_data, void *addr)
+{
+}
+
+static void *cma_kmap(void *handle_data, unsigned int pagenum)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   return obj->vaddr + pagenum * PAGE_SIZE;
+}
+
+static void cma_kunmap(void *handle_data, unsigned int pagenum, void *addr)
+{
+}
+
+static struct host1x_mem_handle *cma_get(void *handle_data)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   struct drm_device *drm = obj->base.dev;
+
+   mutex_lock(>struct_mutex);
+   drm_gem_object_reference(>base);
+   mutex_unlock(>struct_mutex);
+
+   return obj->base.driver_private;
+}
+
+const struct host1x_mem_op host1x_cma_ops = {
+   .get = cma_get,
+   .put = cma_put,
+   .pin = cma_pin,
+   .unpin = cma_unpin,
+   .mmap = cma_mmap,
+   .munmap = cma_munmap,
+   .kmap = cma_kmap,
+   .kunmap = cma_kunmap,
+};
diff --git a/drivers/gpu/host1x/drm/cma.h b/drivers/gpu/host1x/drm/cma.h
new file mode 100644
index 000..06aa0ba
--- /dev/null
+++ b/drivers/gpu/host1x/drm/cma.h
@@ -0,0 +1,26 @@
+/*
+ * Tegra host1x cma memory manager
+ *
+ * Copyright (c) 2012-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#ifndef __HOST1X_CMA_H
+#define __HOST1X_CMA_H
+
+#include "memmgr.h"
+
+extern const struct host1x_mem_op host1x_cma_ops;
+
+#endif
-- 
1.7.9.5



[PATCHv6 7/9] gpu: host1x: Remove second host1x driver

2013-03-08 Thread Terje Bergstrom
Remove second host1x driver, and bind tegra-drm to the new host1x
driver. The logic to parse device tree and track clients is moved
to drm.c.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/Makefile|2 +-
 drivers/gpu/host1x/dev.c   |   58 ++-
 drivers/gpu/host1x/dev.h   |6 +
 drivers/gpu/host1x/drm/Kconfig |2 +-
 drivers/gpu/host1x/drm/dc.c|5 +-
 drivers/gpu/host1x/drm/drm.c   |  217 +++-
 drivers/gpu/host1x/drm/drm.h   |3 -
 drivers/gpu/host1x/drm/hdmi.c  |5 +-
 drivers/gpu/host1x/drm/host1x.c|  329 
 drivers/gpu/host1x/host1x_client.h |   35 
 10 files changed, 318 insertions(+), 344 deletions(-)
 delete mode 100644 drivers/gpu/host1x/drm/host1x.c
 create mode 100644 drivers/gpu/host1x/host1x_client.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index db4dc25..ad39fef 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -14,6 +14,6 @@ host1x-y = \
 ccflags-y += -Iinclude/drm
 ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG

-host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o drm/host1x.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index d7c6e3e..6af8081 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -32,6 +32,19 @@
 #include "channel.h"
 #include "debug.h"
 #include "hw/host1x01.h"
+#include "host1x_client.h"
+
+void host1x_set_drm_data(struct device *dev, void *data)
+{
+   struct host1x *host1x = dev_get_drvdata(dev);
+   host1x->drm_data = data;
+}
+
+void *host1x_get_drm_data(struct device *dev)
+{
+   struct host1x *host1x = dev_get_drvdata(dev);
+   return host1x->drm_data;
+}

 void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
 {
@@ -154,6 +167,8 @@ static int host1x_probe(struct platform_device *pdev)

host1x_debug_init(host);

+   host1x_drm_alloc(pdev);
+
return 0;

 fail_deinit_syncpt:
@@ -170,7 +185,7 @@ static int __exit host1x_remove(struct platform_device 
*pdev)
return 0;
 }

-static struct platform_driver platform_driver = {
+static struct platform_driver tegra_host1x_driver = {
.probe = host1x_probe,
.remove = __exit_p(host1x_remove),
.driver = {
@@ -180,8 +195,47 @@ static struct platform_driver platform_driver = {
},
 };

-module_platform_driver(platform_driver);
+static int __init tegra_host1x_init(void)
+{
+   int err;
+
+   err = platform_driver_register(_host1x_driver);
+   if (err < 0)
+   return err;
+
+#ifdef CONFIG_DRM_TEGRA
+   err = platform_driver_register(_dc_driver);
+   if (err < 0)
+   goto unregister_host1x;
+
+   err = platform_driver_register(_hdmi_driver);
+   if (err < 0)
+   goto unregister_dc;
+#endif
+
+   return 0;
+
+#ifdef CONFIG_DRM_TEGRA
+unregister_dc:
+   platform_driver_unregister(_dc_driver);
+unregister_host1x:
+   platform_driver_unregister(_host1x_driver);
+   return err;
+#endif
+}
+module_init(tegra_host1x_init);
+
+static void __exit tegra_host1x_exit(void)
+{
+#ifdef CONFIG_DRM_TEGRA
+   platform_driver_unregister(_hdmi_driver);
+   platform_driver_unregister(_dc_driver);
+#endif
+   platform_driver_unregister(_host1x_driver);
+}
+module_exit(tegra_host1x_exit);

+MODULE_AUTHOR("Thierry Reding ");
 MODULE_AUTHOR("Terje Bergstrom ");
 MODULE_DESCRIPTION("Host1x driver for Tegra products");
 MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 3542c00..e74ed4a 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -125,6 +125,8 @@ struct host1x {
unsigned int num_allocated_channels;

struct dentry *debugfs;
+
+   void *drm_data;
 };

 static inline struct host1x *host1x_get_host(struct device *dev)
@@ -308,4 +310,8 @@ static inline void host1x_hw_show_mlocks(struct host1x 
*host, struct output *o)
host->debug_op->show_mlocks(host, o);
 }

+extern struct platform_driver tegra_hdmi_driver;
+extern struct platform_driver tegra_dc_driver;
+extern struct platform_driver tegra_gr2d_driver;
+
 #endif
diff --git a/drivers/gpu/host1x/drm/Kconfig b/drivers/gpu/host1x/drm/Kconfig
index c92955d..8fb6545 100644
--- a/drivers/gpu/host1x/drm/Kconfig
+++ b/drivers/gpu/host1x/drm/Kconfig
@@ -1,5 +1,5 @@
 config DRM_TEGRA
-   tristate "NVIDIA Tegra DRM"
+   bool "NVIDIA Tegra DRM"
depends on DRM && OF && ARCH_TEGRA
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
diff --git a/drivers/gpu/host1x/drm/dc.c b/drivers/gpu/host1x/drm/dc.c
index d1f6609..29a79b6 100644
--- a/drivers/gpu/host1x/drm/dc.c
+++ b/drivers/gpu/host1x/drm/dc.c
@@ 

[PATCHv6 6/9] gpu: host1x: drm: Rename host1x to host1x_drm

2013-03-08 Thread Terje Bergstrom
From: Arto Merilainen 

Both host1x and drm drivers have host1x structures. This patch
renames the host1x structure under drm to follow name host1x_drm.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/drm/dc.c |4 ++--
 drivers/gpu/host1x/drm/drm.c|4 ++--
 drivers/gpu/host1x/drm/drm.h|   14 +++---
 drivers/gpu/host1x/drm/fb.c |6 +++---
 drivers/gpu/host1x/drm/hdmi.c   |4 ++--
 drivers/gpu/host1x/drm/host1x.c |   22 --
 6 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/host1x/drm/dc.c b/drivers/gpu/host1x/drm/dc.c
index de94707..d1f6609 100644
--- a/drivers/gpu/host1x/drm/dc.c
+++ b/drivers/gpu/host1x/drm/dc.c
@@ -1097,7 +1097,7 @@ static const struct host1x_client_ops dc_client_ops = {

 static int tegra_dc_probe(struct platform_device *pdev)
 {
-   struct host1x *host1x = dev_get_drvdata(pdev->dev.parent);
+   struct host1x_drm *host1x = dev_get_drvdata(pdev->dev.parent);
struct resource *regs;
struct tegra_dc *dc;
int err;
@@ -1160,7 +1160,7 @@ static int tegra_dc_probe(struct platform_device *pdev)

 static int tegra_dc_remove(struct platform_device *pdev)
 {
-   struct host1x *host1x = dev_get_drvdata(pdev->dev.parent);
+   struct host1x_drm *host1x = dev_get_drvdata(pdev->dev.parent);
struct tegra_dc *dc = platform_get_drvdata(pdev);
int err;

diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c
index 9d452df..6c59bcd 100644
--- a/drivers/gpu/host1x/drm/drm.c
+++ b/drivers/gpu/host1x/drm/drm.c
@@ -26,7 +26,7 @@
 static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 {
struct device *dev = drm->dev;
-   struct host1x *host1x;
+   struct host1x_drm *host1x;
int err;

host1x = dev_get_drvdata(dev);
@@ -69,7 +69,7 @@ static int tegra_drm_open(struct drm_device *drm, struct 
drm_file *filp)

 static void tegra_drm_lastclose(struct drm_device *drm)
 {
-   struct host1x *host1x = drm->dev_private;
+   struct host1x_drm *host1x = drm->dev_private;

drm_fbdev_cma_restore_mode(host1x->fbdev);
 }
diff --git a/drivers/gpu/host1x/drm/drm.h b/drivers/gpu/host1x/drm/drm.h
index a6c011d..7fedb6c 100644
--- a/drivers/gpu/host1x/drm/drm.h
+++ b/drivers/gpu/host1x/drm/drm.h
@@ -18,7 +18,7 @@
 #include 
 #include 

-struct host1x {
+struct host1x_drm {
struct drm_device *drm;
struct device *dev;
void __iomem *regs;
@@ -44,7 +44,7 @@ struct host1x_client_ops {
 };

 struct host1x_client {
-   struct host1x *host1x;
+   struct host1x_drm *host1x;
struct device *dev;

const struct host1x_client_ops *ops;
@@ -52,12 +52,12 @@ struct host1x_client {
struct list_head list;
 };

-extern int host1x_drm_init(struct host1x *host1x, struct drm_device *drm);
-extern int host1x_drm_exit(struct host1x *host1x);
+extern int host1x_drm_init(struct host1x_drm *host1x, struct drm_device *drm);
+extern int host1x_drm_exit(struct host1x_drm *host1x);

-extern int host1x_register_client(struct host1x *host1x,
+extern int host1x_register_client(struct host1x_drm *host1x,
  struct host1x_client *client);
-extern int host1x_unregister_client(struct host1x *host1x,
+extern int host1x_unregister_client(struct host1x_drm *host1x,
struct host1x_client *client);

 struct tegra_output;
@@ -66,7 +66,7 @@ struct tegra_dc {
struct host1x_client client;
spinlock_t lock;

-   struct host1x *host1x;
+   struct host1x_drm *host1x;
struct device *dev;

struct drm_crtc base;
diff --git a/drivers/gpu/host1x/drm/fb.c b/drivers/gpu/host1x/drm/fb.c
index 0391495..6ed885a 100644
--- a/drivers/gpu/host1x/drm/fb.c
+++ b/drivers/gpu/host1x/drm/fb.c
@@ -11,7 +11,7 @@

 static void tegra_drm_fb_output_poll_changed(struct drm_device *drm)
 {
-   struct host1x *host1x = drm->dev_private;
+   struct host1x_drm *host1x = drm->dev_private;

drm_fbdev_cma_hotplug_event(host1x->fbdev);
 }
@@ -23,7 +23,7 @@ static const struct drm_mode_config_funcs 
tegra_drm_mode_funcs = {

 int tegra_drm_fb_init(struct drm_device *drm)
 {
-   struct host1x *host1x = drm->dev_private;
+   struct host1x_drm *host1x = drm->dev_private;
struct drm_fbdev_cma *fbdev;

drm->mode_config.min_width = 0;
@@ -46,7 +46,7 @@ int tegra_drm_fb_init(struct drm_device *drm)

 void tegra_drm_fb_exit(struct drm_device *drm)
 {
-   struct host1x *host1x = drm->dev_private;
+   struct host1x_drm *host1x = drm->dev_private;

drm_fbdev_cma_fini(host1x->fbdev);
 }
diff --git a/drivers/gpu/host1x/drm/hdmi.c b/drivers/gpu/host1x/drm/hdmi.c
index bb747f6..f438f80 100644
--- a/drivers/gpu/host1x/drm/hdmi.c
+++ b/drivers/gpu/host1x/drm/hdmi.c
@@ -1189,7 +1189,7 @@ static const struct host1x_client_ops hdmi_client_ops = 

[PATCHv6 5/9] drm: tegra: Move drm to live under host1x

2013-03-08 Thread Terje Bergstrom
Make drm part of host1x driver.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/drm/Kconfig|2 --
 drivers/gpu/drm/Makefile   |1 -
 drivers/gpu/drm/tegra/Makefile |7 ---
 drivers/gpu/host1x/Kconfig |2 ++
 drivers/gpu/host1x/Makefile|5 +
 drivers/gpu/{drm/tegra => host1x/drm}/Kconfig  |0
 drivers/gpu/{drm/tegra => host1x/drm}/dc.c |0
 drivers/gpu/{drm/tegra => host1x/drm}/dc.h |0
 drivers/gpu/{drm/tegra => host1x/drm}/drm.c|0
 drivers/gpu/{drm/tegra => host1x/drm}/drm.h|6 +++---
 drivers/gpu/{drm/tegra => host1x/drm}/fb.c |0
 drivers/gpu/{drm/tegra => host1x/drm}/hdmi.c   |0
 drivers/gpu/{drm/tegra => host1x/drm}/hdmi.h   |0
 drivers/gpu/{drm/tegra => host1x/drm}/host1x.c |0
 drivers/gpu/{drm/tegra => host1x/drm}/output.c |0
 drivers/gpu/{drm/tegra => host1x/drm}/rgb.c|0
 16 files changed, 10 insertions(+), 13 deletions(-)
 delete mode 100644 drivers/gpu/drm/tegra/Makefile
 rename drivers/gpu/{drm/tegra => host1x/drm}/Kconfig (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/dc.c (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/dc.h (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/drm.c (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/drm.h (98%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/fb.c (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/hdmi.c (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/hdmi.h (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/host1x.c (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/output.c (100%)
 rename drivers/gpu/{drm/tegra => host1x/drm}/rgb.c (100%)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 1e82882..9031bb7 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -215,8 +215,6 @@ source "drivers/gpu/drm/cirrus/Kconfig"

 source "drivers/gpu/drm/shmobile/Kconfig"

-source "drivers/gpu/drm/tegra/Kconfig"
-
 source "drivers/gpu/drm/omapdrm/Kconfig"

 source "drivers/gpu/drm/tilcdc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 0d59b24..847b830 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -49,7 +49,6 @@ obj-$(CONFIG_DRM_GMA500) += gma500/
 obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
-obj-$(CONFIG_DRM_TEGRA) += tegra/
 obj-$(CONFIG_DRM_OMAP) += omapdrm/
 obj-$(CONFIG_DRM_TILCDC)   += tilcdc/
 obj-y  += i2c/
diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile
deleted file mode 100644
index 80f73d1..000
--- a/drivers/gpu/drm/tegra/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ccflags-y := -Iinclude/drm
-ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
-
-tegra-drm-y := drm.o fb.o dc.o host1x.o
-tegra-drm-y += output.o rgb.o hdmi.o
-
-obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
index 00f0859..ee3af1e 100644
--- a/drivers/gpu/host1x/Kconfig
+++ b/drivers/gpu/host1x/Kconfig
@@ -18,4 +18,6 @@ config TEGRA_HOST1X_FIREWALL

  If unsure, choose Y.

+source "drivers/gpu/host1x/drm/Kconfig"
+
 endif
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index dfc6f35..db4dc25 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -11,4 +11,9 @@ host1x-y = \
memmgr.o \
hw/host1x01.o

+ccflags-y += -Iinclude/drm
+ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
+
+host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o drm/host1x.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/host1x/drm/Kconfig
similarity index 100%
rename from drivers/gpu/drm/tegra/Kconfig
rename to drivers/gpu/host1x/drm/Kconfig
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/host1x/drm/dc.c
similarity index 100%
rename from drivers/gpu/drm/tegra/dc.c
rename to drivers/gpu/host1x/drm/dc.c
diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/host1x/drm/dc.h
similarity index 100%
rename from drivers/gpu/drm/tegra/dc.h
rename to drivers/gpu/host1x/drm/dc.h
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/host1x/drm/drm.c
similarity index 100%
rename from drivers/gpu/drm/tegra/drm.c
rename to drivers/gpu/host1x/drm/drm.c
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/host1x/drm/drm.h
similarity index 98%
rename from drivers/gpu/drm/tegra/drm.h
rename to drivers/gpu/host1x/drm/drm.h
index 6dd75a2..a6c011d 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/host1x/drm/drm.h
@@ -7,8 +7,8 @@
  * published by the Free Software Foundation.
  */

-#ifndef TEGRA_DRM_H
-#define TEGRA_DRM_H 1
+#ifndef HOST1X_DRM_H
+#define HOST1X_DRM_H 1

 #include 
 #include 
@@ -234,4 +234,4 @@ extern struct platform_driver 

[PATCHv6 4/9] gpu: host1x: Add debug support

2013-03-08 Thread Terje Bergstrom
Add support for host1x debugging. Adds debugfs entries, and dumps
channel state to UART in case of stuck job.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/Makefile |1 +
 drivers/gpu/host1x/cdma.c   |5 +
 drivers/gpu/host1x/debug.c  |  210 +
 drivers/gpu/host1x/debug.h  |   51 +
 drivers/gpu/host1x/dev.c|3 +
 drivers/gpu/host1x/dev.h|   42 
 drivers/gpu/host1x/hw/cdma_hw.c |3 +
 drivers/gpu/host1x/hw/channel_hw.c  |   27 ++-
 drivers/gpu/host1x/hw/debug_hw.c|  322 +++
 drivers/gpu/host1x/hw/host1x01.c|2 +
 drivers/gpu/host1x/hw/hw_host1x01_channel.h |   18 ++
 drivers/gpu/host1x/hw/hw_host1x01_sync.h|  115 ++
 drivers/gpu/host1x/hw/hw_host1x01_uclass.h  |6 +
 drivers/gpu/host1x/hw/syncpt_hw.c   |1 +
 drivers/gpu/host1x/syncpt.c |5 +
 15 files changed, 810 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/host1x/debug.c
 create mode 100644 drivers/gpu/host1x/debug.h
 create mode 100644 drivers/gpu/host1x/hw/debug_hw.c

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index 7278bf3..dfc6f35 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -7,6 +7,7 @@ host1x-y = \
cdma.o \
channel.o \
job.o \
+   debug.o \
memmgr.o \
hw/host1x01.o

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index a45bb94..f3167bf 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -29,6 +29,7 @@
 #include "cdma.h"
 #include "channel.h"
 #include "dev.h"
+#include "debug.h"
 #include "job.h"
 #include "memmgr.h"

@@ -438,6 +439,10 @@ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, 
u32 op2)
struct push_buffer *pb = >push_buffer;
u32 slots_free = cdma->slots_free;

+   if (host1x_debug_trace_cmdbuf)
+   trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev),
+  op1, op2);
+
if (slots_free == 0) {
host1x_hw_cdma_flush(host1x, cdma);
slots_free = host1x_cdma_wait_locked(cdma,
diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
new file mode 100644
index 000..cb8aff9
--- /dev/null
+++ b/drivers/gpu/host1x/debug.c
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2010 Google, Inc.
+ * Author: Erik Gilling 
+ *
+ * Copyright (C) 2011-2013 NVIDIA Corporation
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "dev.h"
+#include "debug.h"
+#include "channel.h"
+
+unsigned int host1x_debug_trace_cmdbuf;
+
+static pid_t host1x_debug_force_timeout_pid;
+static u32 host1x_debug_force_timeout_val;
+static u32 host1x_debug_force_timeout_channel;
+
+void host1x_debug_output(struct output *o, const char *fmt, ...)
+{
+   va_list args;
+   int len;
+
+   va_start(args, fmt);
+   len = vsnprintf(o->buf, sizeof(o->buf), fmt, args);
+   va_end(args);
+   o->fn(o->ctx, o->buf, len);
+}
+
+static int show_channels(struct host1x_channel *ch, void *data, bool show_fifo)
+{
+   struct host1x *m = host1x_get_host(ch->dev);
+   struct output *o = data;
+
+   mutex_lock(>reflock);
+   if (ch->refcount) {
+   mutex_lock(>cdma.lock);
+   if (show_fifo)
+   host1x_hw_show_channel_fifo(m, ch, o);
+   host1x_hw_show_channel_cdma(m, ch, o);
+   mutex_unlock(>cdma.lock);
+   }
+   mutex_unlock(>reflock);
+
+   return 0;
+}
+
+static void show_syncpts(struct host1x *m, struct output *o)
+{
+   int i;
+   host1x_debug_output(o, " syncpts \n");
+   for (i = 0; i < host1x_syncpt_nb_pts(m); i++) {
+   u32 max = host1x_syncpt_read_max(m->syncpt + i);
+   u32 min = host1x_syncpt_load(m->syncpt + i);
+   if (!min && !max)
+   continue;
+   host1x_debug_output(o, "id %d (%s) min %d max %d\n",
+   i, m->syncpt[i].name, min, max);
+   }
+
+   for (i = 0; i < host1x_syncpt_nb_bases(m); i++) {
+   u32 base_val;
+   base_val = host1x_syncpt_load_wait_base(m->syncpt + i);
+   if (base_val)
+   host1x_debug_output(o, "waitbase id %d val 

[PATCHv6 3/9] gpu: host1x: Add channel support

2013-03-08 Thread Terje Bergstrom
Add support for host1x client modules, and host1x channels to submit
work to the clients.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/Kconfig  |   12 +
 drivers/gpu/host1x/Makefile |4 +
 drivers/gpu/host1x/cdma.c   |  486 ++
 drivers/gpu/host1x/cdma.h   |  102 +
 drivers/gpu/host1x/channel.c|  120 ++
 drivers/gpu/host1x/channel.h|   52 +++
 drivers/gpu/host1x/dev.c|   17 +
 drivers/gpu/host1x/dev.h|  114 +
 drivers/gpu/host1x/host1x.h |   28 ++
 drivers/gpu/host1x/hw/cdma_hw.c |  324 +++
 drivers/gpu/host1x/hw/channel_hw.c  |  142 +++
 drivers/gpu/host1x/hw/host1x01.c|5 +
 drivers/gpu/host1x/hw/host1x01_hardware.h   |  116 ++
 drivers/gpu/host1x/hw/hw_host1x01_channel.h |  102 +
 drivers/gpu/host1x/hw/hw_host1x01_sync.h|   12 +
 drivers/gpu/host1x/hw/hw_host1x01_uclass.h  |  168 
 drivers/gpu/host1x/hw/syncpt_hw.c   |   11 +
 drivers/gpu/host1x/intr.c   |   28 +-
 drivers/gpu/host1x/intr.h   |6 +
 drivers/gpu/host1x/job.c|  598 +++
 drivers/gpu/host1x/job.h|  158 +++
 drivers/gpu/host1x/memmgr.c |   82 
 drivers/gpu/host1x/memmgr.h |   64 +++
 drivers/gpu/host1x/syncpt.c |   11 +
 drivers/gpu/host1x/syncpt.h |6 +
 include/trace/events/host1x.h   |  211 ++
 26 files changed, 2978 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/host1x/cdma.c
 create mode 100644 drivers/gpu/host1x/cdma.h
 create mode 100644 drivers/gpu/host1x/channel.c
 create mode 100644 drivers/gpu/host1x/channel.h
 create mode 100644 drivers/gpu/host1x/host1x.h
 create mode 100644 drivers/gpu/host1x/hw/cdma_hw.c
 create mode 100644 drivers/gpu/host1x/hw/channel_hw.c
 create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_channel.h
 create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_uclass.h
 create mode 100644 drivers/gpu/host1x/job.c
 create mode 100644 drivers/gpu/host1x/job.h
 create mode 100644 drivers/gpu/host1x/memmgr.c
 create mode 100644 drivers/gpu/host1x/memmgr.h

diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
index c01c450..00f0859 100644
--- a/drivers/gpu/host1x/Kconfig
+++ b/drivers/gpu/host1x/Kconfig
@@ -7,3 +7,15 @@ config TEGRA_HOST1X
  Tegra's graphics- and multimedia-related modules. The modules served
  by host1x are referred to as clients. host1x includes some other
  functionality, such as synchronization.
+
+if TEGRA_HOST1X
+
+config TEGRA_HOST1X_FIREWALL
+   bool "Enable HOST1X security firewall"
+   default y
+   help
+ Say yes if kernel should protect command streams from tampering.
+
+ If unsure, choose Y.
+
+endif
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index 5ef47ff..7278bf3 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -4,6 +4,10 @@ host1x-y = \
syncpt.o \
dev.o \
intr.o \
+   cdma.o \
+   channel.o \
+   job.o \
+   memmgr.o \
hw/host1x01.o

 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
new file mode 100644
index 000..a45bb94
--- /dev/null
+++ b/drivers/gpu/host1x/cdma.c
@@ -0,0 +1,486 @@
+/*
+ * Tegra host1x Command DMA
+ *
+ * Copyright (c) 2010-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cdma.h"
+#include "channel.h"
+#include "dev.h"
+#include "job.h"
+#include "memmgr.h"
+
+/*
+ * push_buffer
+ *
+ * The push buffer is a circular array of words to be fetched by command DMA.
+ * Note that it works slightly differently to the sync queue; fence == pos
+ * means that the push buffer is full, not empty.
+ */
+
+#define HOST1X_PUSHBUFFER_SLOTS512
+
+/*
+ * Clean up push buffer resources
+ */
+static void host1x_pushbuffer_destroy(struct push_buffer *pb)
+{
+   struct host1x_cdma *cdma = pb_to_cdma(pb);
+   struct host1x *host1x = cdma_to_host1x(cdma);

[PATCHv6 2/9] gpu: host1x: Add syncpoint wait and interrupts

2013-03-08 Thread Terje Bergstrom
Add support for sync point interrupts, and sync point wait. Sync
point wait used interrupts for unblocking wait.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/host1x/Makefile  |1 +
 drivers/gpu/host1x/dev.c |   12 ++
 drivers/gpu/host1x/dev.h |   51 +
 drivers/gpu/host1x/hw/host1x01.c |2 +
 drivers/gpu/host1x/hw/hw_host1x01_sync.h |   42 
 drivers/gpu/host1x/hw/intr_hw.c  |  143 +
 drivers/gpu/host1x/intr.c|  328 ++
 drivers/gpu/host1x/intr.h|   96 +
 drivers/gpu/host1x/syncpt.c  |  159 +++
 drivers/gpu/host1x/syncpt.h  |   14 +-
 10 files changed, 847 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/host1x/hw/intr_hw.c
 create mode 100644 drivers/gpu/host1x/intr.c
 create mode 100644 drivers/gpu/host1x/intr.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index 363e6ab..5ef47ff 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -3,6 +3,7 @@ ccflags-y = -Idrivers/gpu/host1x
 host1x-y = \
syncpt.o \
dev.o \
+   intr.o \
hw/host1x01.o

 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index d95a9b2..4421e28 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -28,6 +28,7 @@
 #include 

 #include "dev.h"
+#include "intr.h"
 #include "hw/host1x01.h"

 void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
@@ -127,12 +128,23 @@ static int host1x_probe(struct platform_device *pdev)
return err;
}

+   err = host1x_intr_init(host, syncpt_irq);
+   if (err) {
+   dev_err(dev, "failed to init irq");
+   goto fail_deinit_syncpt;
+   }
+
return 0;
+
+fail_deinit_syncpt:
+   host1x_syncpt_deinit(host);
+   return err;
 }

 static int __exit host1x_remove(struct platform_device *pdev)
 {
struct host1x *host = platform_get_drvdata(pdev);
+   host1x_intr_deinit(host);
host1x_syncpt_deinit(host);
clk_disable_unprepare(host->clk);
return 0;
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 750daa3..fb5f842 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -21,6 +21,7 @@
 #include 

 #include "syncpt.h"
+#include "intr.h"

 struct host1x_syncpt;

@@ -33,6 +34,17 @@ struct host1x_syncpt_ops {
int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
 };

+struct host1x_intr_ops {
+   int (*init_host_sync)(struct host1x *host, u32 cpm,
+   void (*syncpt_thresh_work)(struct work_struct *work));
+   void (*set_syncpt_threshold)(
+   struct host1x *host, u32 id, u32 thresh);
+   void (*enable_syncpt_intr)(struct host1x *host, u32 id);
+   void (*disable_syncpt_intr)(struct host1x *host, u32 id);
+   void (*disable_all_syncpt_intrs)(struct host1x *host);
+   int (*free_syncpt_irq)(struct host1x *host);
+};
+
 struct host1x_info {
int nb_channels;/* host1x: num channels supported */
int nb_pts; /* host1x: num syncpoints supported */
@@ -50,7 +62,13 @@ struct host1x {
struct device *dev;
struct clk *clk;

+   struct mutex intr_mutex;
+   struct workqueue_struct *intr_wq;
+   int intr_syncpt_irq;
+
const struct host1x_syncpt_ops *syncpt_op;
+   const struct host1x_intr_ops *intr_op;
+
 };

 static inline struct host1x *host1x_get_host(struct device *dev)
@@ -101,4 +119,37 @@ static inline int host1x_hw_syncpt_patch_wait(struct 
host1x *host,
return host->syncpt_op->patch_wait(sp, patch_addr);
 }

+static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
+   void (*syncpt_thresh_work)(struct work_struct *))
+{
+   return host->intr_op->init_host_sync(host, cpm, syncpt_thresh_work);
+}
+
+static inline void host1x_hw_intr_set_syncpt_threshold(struct host1x *host,
+  u32 id, u32 thresh)
+{
+   host->intr_op->set_syncpt_threshold(host, id, thresh);
+}
+
+static inline void host1x_hw_intr_enable_syncpt_intr(struct host1x *host,
+u32 id)
+{
+   host->intr_op->enable_syncpt_intr(host, id);
+}
+
+static inline void host1x_hw_intr_disable_syncpt_intr(struct host1x *host,
+ u32 id)
+{
+   host->intr_op->disable_syncpt_intr(host, id);
+}
+
+static inline void host1x_hw_intr_disable_all_syncpt_intrs(struct host1x *host)
+{
+   host->intr_op->disable_all_syncpt_intrs(host);
+}
+
+static inline int host1x_hw_intr_free_syncpt_irq(struct host1x *host)
+{
+   return host->intr_op->free_syncpt_irq(host);
+}
 #endif
diff --git 

[PATCHv6 1/9] gpu: host1x: Add host1x driver

2013-03-08 Thread Terje Bergstrom
Add host1x, the driver for host1x and its client unit 2D. The Tegra
host1x module is the DMA engine for register access to Tegra's
graphics- and multimedia-related modules. The modules served by
host1x are referred to as clients. host1x includes some other
functionality, such as synchronization.

Signed-off-by: Arto Merilainen 
Signed-off-by: Terje Bergstrom 
---
 drivers/gpu/Makefile  |1 +
 drivers/gpu/host1x/Kconfig|9 ++
 drivers/gpu/host1x/Makefile   |8 ++
 drivers/gpu/host1x/dev.c  |  155 +
 drivers/gpu/host1x/dev.h  |  104 ++
 drivers/gpu/host1x/hw/Makefile|6 +
 drivers/gpu/host1x/hw/host1x01.c  |   33 +
 drivers/gpu/host1x/hw/host1x01.h  |   25 
 drivers/gpu/host1x/hw/host1x01_hardware.h |   27 
 drivers/gpu/host1x/hw/hw_host1x01_sync.h  |   74 ++
 drivers/gpu/host1x/hw/syncpt_hw.c |  102 ++
 drivers/gpu/host1x/syncpt.c   |  212 +
 drivers/gpu/host1x/syncpt.h   |  147 
 drivers/video/Kconfig |2 +
 include/trace/events/host1x.h |   61 +
 15 files changed, 966 insertions(+)
 create mode 100644 drivers/gpu/host1x/Kconfig
 create mode 100644 drivers/gpu/host1x/Makefile
 create mode 100644 drivers/gpu/host1x/dev.c
 create mode 100644 drivers/gpu/host1x/dev.h
 create mode 100644 drivers/gpu/host1x/hw/Makefile
 create mode 100644 drivers/gpu/host1x/hw/host1x01.c
 create mode 100644 drivers/gpu/host1x/hw/host1x01.h
 create mode 100644 drivers/gpu/host1x/hw/host1x01_hardware.h
 create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_sync.h
 create mode 100644 drivers/gpu/host1x/hw/syncpt_hw.c
 create mode 100644 drivers/gpu/host1x/syncpt.c
 create mode 100644 drivers/gpu/host1x/syncpt.h
 create mode 100644 include/trace/events/host1x.h

diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
index 30879df..d8a22c2 100644
--- a/drivers/gpu/Makefile
+++ b/drivers/gpu/Makefile
@@ -1 +1,2 @@
 obj-y  += drm/ vga/
+obj-$(CONFIG_TEGRA_HOST1X) += host1x/
diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
new file mode 100644
index 000..c01c450
--- /dev/null
+++ b/drivers/gpu/host1x/Kconfig
@@ -0,0 +1,9 @@
+config TEGRA_HOST1X
+   tristate "NVIDIA Tegra host1x driver"
+   help
+ Driver for the NVIDIA Tegra host1x hardware.
+
+ The Tegra host1x module is the DMA engine for register access to
+ Tegra's graphics- and multimedia-related modules. The modules served
+ by host1x are referred to as clients. host1x includes some other
+ functionality, such as synchronization.
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
new file mode 100644
index 000..363e6ab
--- /dev/null
+++ b/drivers/gpu/host1x/Makefile
@@ -0,0 +1,8 @@
+ccflags-y = -Idrivers/gpu/host1x
+
+host1x-y = \
+   syncpt.o \
+   dev.o \
+   hw/host1x01.o
+
+obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
new file mode 100644
index 000..d95a9b2
--- /dev/null
+++ b/drivers/gpu/host1x/dev.c
@@ -0,0 +1,155 @@
+/*
+ * Tegra host1x driver
+ *
+ * Copyright (c) 2010-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CREATE_TRACE_POINTS
+#include 
+
+#include "dev.h"
+#include "hw/host1x01.h"
+
+void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
+{
+   void __iomem *sync_regs = host1x->regs + host1x->info->sync_offset;
+
+   writel(v, sync_regs + r);
+}
+
+u32 host1x_sync_readl(struct host1x *host1x, u32 r)
+{
+   void __iomem *sync_regs = host1x->regs + host1x->info->sync_offset;
+
+   return readl(sync_regs + r);
+}
+
+static const struct host1x_info host1x01_info = {
+   .nb_channels= 8,
+   .nb_pts = 32,
+   .nb_mlocks  = 16,
+   .nb_bases   = 8,
+   .init   = host1x01_init,
+   .sync_offset= 0x3000,
+};
+
+static struct of_device_id host1x_match[] = {
+   { .compatible = "nvidia,tegra30-host1x", .data = _info, },
+   { .compatible = "nvidia,tegra20-host1x", .data = _info, },
+   { },
+};
+
+static int 

[PATCHv6 0/9] Support for Tegra 2D hardware

2013-03-08 Thread Terje Bergstrom
This set of patches adds support for Tegra20 and Tegra30 host1x and
2D. It is based on linux-next-20130307.

Changes in this version:
 * Rebased on latest tegradrm
 * Renamed tegradrm's host1x to host1x_drm
 * Indentation and line split fixed to follow tegradrm convention
 * Pointers to platform_device replaced with pointers to device
 * Added host1x allocator, and wired it in
 * Debug spew code fixed to access mem handles from host1x_job
 * CDMA code doesn't keep the mem handles anymore
 * Push buffer ops have been made generic code
 * Removed the pin_array optimization in host1x_job to simplify code
 * Large number of smaller changes

The driver implements an allocator using the DRM CMA helper. Each buffer is
assigned an ops structure to operate on it. In future the DRM CMA helper will
be replaced with an own allocator to implement IOMMU support.

host1x is the driver that controls host1x hardware. It supports
host1x command channels, synchronization, and memory management. It
is sectioned into logical driver under drivers/gpu/host1x and
physical driver under drivers/host1x/hw. The physical driver is
compiled with the hardware headers of the particular host1x version.

The hardware units are described (briefly) in the Tegra2 TRM. Wiki
page http://http.download.nvidia.com/tegra-public-appnotes/host1x.html
also contains a short description of the functionality.

The patch set merges tegradrm into host1x and adds 2D driver, which
uses host1x channels and sync points. The patch set also adds user
space API to tegradrm for accessing host1x and 2D.

The changes to add support to libdrm are in
git at gitorious.org:linux-host1x/libdrm-host1x.git

Arto Merilainen (2):
  gpu: host1x: drm: Rename host1x to host1x_drm
  gpu: host1x: drm: Add CMA ops for host1x driver

Terje Bergstrom (7):
  gpu: host1x: Add host1x driver
  gpu: host1x: Add syncpoint wait and interrupts
  gpu: host1x: Add channel support
  gpu: host1x: Add debug support
  drm: tegra: Move drm to live under host1x
  gpu: host1x: Remove second host1x driver
  drm: tegra: Add gr2d device

 drivers/gpu/Makefile   |1 +
 drivers/gpu/drm/Kconfig|2 -
 drivers/gpu/drm/Makefile   |1 -
 drivers/gpu/drm/tegra/Makefile |7 -
 drivers/gpu/drm/tegra/drm.c|  217 
 drivers/gpu/drm/tegra/host1x.c |  327 
 drivers/gpu/host1x/Kconfig |   23 +
 drivers/gpu/host1x/Makefile|   21 +
 drivers/gpu/host1x/cdma.c  |  491 ++
 drivers/gpu/host1x/cdma.h  |  102 
 drivers/gpu/host1x/channel.c   |  120 +
 drivers/gpu/host1x/channel.h   |   52 ++
 drivers/gpu/host1x/debug.c |  210 
 drivers/gpu/host1x/debug.h |   51 ++
 drivers/gpu/host1x/dev.c   |  248 +
 drivers/gpu/host1x/dev.h   |  317 
 drivers/gpu/{drm/tegra => host1x/drm}/Kconfig  |2 +-
 drivers/gpu/host1x/drm/cma.c   |   87 
 drivers/gpu/host1x/drm/cma.h   |   26 +
 drivers/gpu/{drm/tegra => host1x/drm}/dc.c |5 +-
 drivers/gpu/{drm/tegra => host1x/drm}/dc.h |0
 drivers/gpu/host1x/drm/drm.c   |  661 
 drivers/gpu/{drm/tegra => host1x/drm}/drm.h|   51 +-
 drivers/gpu/{drm/tegra => host1x/drm}/fb.c |6 +-
 drivers/gpu/host1x/drm/gr2d.c  |  325 
 drivers/gpu/{drm/tegra => host1x/drm}/hdmi.c   |5 +-
 drivers/gpu/{drm/tegra => host1x/drm}/hdmi.h   |0
 drivers/gpu/{drm/tegra => host1x/drm}/output.c |0
 drivers/gpu/{drm/tegra => host1x/drm}/rgb.c|0
 drivers/gpu/host1x/host1x.h|   29 ++
 drivers/gpu/host1x/host1x_client.h |   35 ++
 drivers/gpu/host1x/hw/Makefile |6 +
 drivers/gpu/host1x/hw/cdma_hw.c|  327 
 drivers/gpu/host1x/hw/channel_hw.c |  167 ++
 drivers/gpu/host1x/hw/debug_hw.c   |  322 
 drivers/gpu/host1x/hw/host1x01.c   |   42 ++
 drivers/gpu/host1x/hw/host1x01.h   |   25 +
 drivers/gpu/host1x/hw/host1x01_hardware.h  |  143 +
 drivers/gpu/host1x/hw/hw_host1x01_channel.h|  120 +
 drivers/gpu/host1x/hw/hw_host1x01_sync.h   |  243 +
 drivers/gpu/host1x/hw/hw_host1x01_uclass.h |  174 +++
 drivers/gpu/host1x/hw/intr_hw.c|  143 +
 drivers/gpu/host1x/hw/syncpt_hw.c  |  114 
 drivers/gpu/host1x/intr.c  |  354 +
 drivers/gpu/host1x/intr.h  |  102 
 drivers/gpu/host1x/job.c   |  598 +
 drivers/gpu/host1x/job.h   |  158 ++
 drivers/gpu/host1x/memmgr.c   

[PATCH] drm/i915: Fix missing variable initilization

2013-03-08 Thread Damien Lespiau
On Sun, Mar 03, 2013 at 06:20:26PM +0100, Daniel Vetter wrote:
> On Mon, Feb 25, 2013 at 04:05:38AM +0530, Syam Sidhardhan wrote:
> > Need to initialize the variable wait to false.
> > 
> > Signed-off-by: Syam Sidhardhan 
> 
> Looks sane, thanks for the patch. Cc'ing Paulo in case I've missed
> something.

FWIW, I posted a similar patch (without moving the variable around) on
intel-gfx yesterday, so:

Reviewed-by: Damien Lespiau 

-- 
Damien


[PATCH RFC] drm/exynos: hdmi: move hdmiphy related code to hdmiphy driver

2013-03-08 Thread Rahul Sharma
On Thu, Mar 7, 2013 at 2:05 PM, Inki Dae  wrote:
>
>
>> -Original Message-
>> From: ??? [mailto:sw0312.kim at samsung.com]
>> Sent: Thursday, March 07, 2013 4:04 PM
>> To: Rahul Sharma
>> Cc: Inki Dae; linux-samsung-soc at vger.kernel.org; Sean Paul; sunil joshi;
>> dri-devel at lists.freedesktop.org; Rahul Sharma; sw0312.kim at samsung.com
>> Subject: Re: [PATCH RFC] drm/exynos: hdmi: move hdmiphy related code to
>> hdmiphy driver
>>
>>
>>
>> On 2013? 03? 07? 15:45, Rahul Sharma wrote:
>> > Thanks Seung Woo, Mr. Dae,
>> >
>> > On Thu, Mar 7, 2013 at 10:13 AM, Inki Dae  wrote:
>> >> 2013/3/7 ??? :
>> >>>
>> >>>
>> >>> On 2013? 03? 04? 23:05, Rahul Sharma wrote:
>>  Thanks Sean,
>> 
>>  On Wed, Feb 27, 2013 at 9:47 PM, Sean Paul 
>> wrote:
>> > On Wed, Feb 27, 2013 at 8:22 AM, Rahul Sharma
>>  wrote:
>> >> Right now hdmiphy operations and configs are kept inside hdmi
>> driver. hdmiphy related
>> >> code is tightly coupled with hdmi ip driver. Physicaly they are
>> different devices and
>> >
>> > s/Physicaly/Physically/
>> >
>> >> should be instantiated independently.
>> >>
>> >> In terms of versions/mapping/configurations Hdmi and hdmiphy are
>> independent of each
>> >> other. It is preferred to isolate them and maintained
> independently.
>> >>
>> >> This implementations is tested for:
>> >> 1) Resolutions supported by exynos4 and 5 hdmi.
>> >> 2) Runtime PM and S2R scenarions for exynos5.
>> >>
>> >
>> > I don't like the idea of spawning off yet another driver in here. It
>> > adds more globals, more suspend/resume ordering issues, and more
>> > implicit dependencies. I understand, however, that this is the
>> Chosen
>> > Way for the exynos driver, so I will save my rant.
>> >
>> 
>>  I agree to it. splitting phy to a new driver will complicate the
>> power related
>>  scenarios. But in upcoming SoC,s, Phy is changing considerably in
>> terms of
>>  config values, mapping (i2c/platform bus) etc. Handling this
>> diversity
>>  inside hdmi driver is complicating it with unrelated changes.
>> >>>
>> >>> Basically, I agree with the idea to split hdmiphy from hdmi. And it
>> >>> seems that already existing hdmiphy i2c device is just reused and
>> >>> hdmiphy_power_on is reorganized to hdmiphy dpms operation: even
>> calling
>> >>> flow of power operations is reordered.
>> >>>
>> >>> But I'm not sure exynos_hdmiphy_driver_register() really need to be
>> >>> called from exynos_drm_init() of exynos_drm_drv.c. IMO, it is enough
>> to
>> >>> call exynos_hdmiphy_driver_register() from hdmi_probe() because
>> hdmiphy
>> >>> is only used from hdmi.
>> >>>
>> >>
>> >> I agree with Seung-Woo. The hdmiphy is just one part of HDMI subsystem.
>> >>
>> >
>> > I agree to the Seung Woo's point that hdmi-phy used to be solely
>> accessed by
>> > hdmi driver.  But in this RFC, hdmi-phy is not called by hdmi driver
>> > anymore. Phy
>> > ops will be called from drm-common-hdmi platform driver along with mixer
>> and
>> > hdmi ops.
>>
>> Considering this, exynos_drm_hdmi_probe() is more proper position.
>>
>> >
>> > The rational behind my implementation is that I am projecting hdmi-phy
>> as
>> > a device which is peer to hdmi ip and mixer. These 3 devices together
>> makes
>> > DRM HDMI subsystem.
>> >
>> > Even physically hdmi-phy doesn't seems to be a part of hdmi ip though
>> > configurations are listed under hdmi ip user manual. It looks like a
>> > isolated module accessed by i2c.
>> >
>> > Though I don't find anything wrong with Seung Woo suggestion but above
>> > placement of hdmi-phy (parallel to hdmi and mixer) makes more sense
>> > to me.
>> >
>> > Please have a another look at it and let me know your opinion.
>> >
>> > Another things which bothers me is registering mixer, hdmi driver inside
>> > exynos_drm_init(). If we strictly follow the hierarchy inside drm,
>> > exynos_drm_init()
>> > should register drm-common-hdmi only. drm-common-hdmi should register
>> > mixer and hdmi (or hdmi-phy as well).
>>
>> Yes, it makes sense. All real hw blocks for hdmi including mixer, hdmi,
>> and hdmiphy shoulde be registered in exynos_drm_hdmi (drm-common-hdmi
>> for exynos).
>>
>
> Ideally, right. But the reason I designed and implemented hdmi subsystem
> framework like this, is that there was one issue that
> platform_device_register() can't be called at probe(). On other words, when
> one platform device driver is being probed, anyone can't be probed. Anyway,
> existing way needs to be improved. So let's find better way and improve the
> hdmi subsystem framework this time. :)

Mr. Dae,

if we move exynos_drm_drv.o towards last in the makefile, we can
conveniently move all driver(or plf device for drm-comon-hdmi) registrations
from exynos_drm_init to module_init of the respective drivers.

I verified above changes for hdmi and S2R scenarios.

regards,
Rahul Sharma

>
> Thanks,
> Inki Dae
>
>> Thanks and 

[PATCH] libdrm/exynos: add test application for 2d gpu.

2013-03-08 Thread Rob Clark
On Mon, Feb 18, 2013 at 7:51 AM, Inki Dae  wrote:
> This patch adds library and test application for g2d gpu(fimg2d).
>
> The fimg2d hardware is a 2D graphics accelerator(G2D) that
> supports Bit Block Transfer(BitBLT).
>
> The library includes the following primitive drawing operations:
> .solid fill - This operation fills the given buffer with
> the given color data.
> .copy - This operation copies contents in source buffer to
> destination buffer.
> .copy_with_scale - This operation copies contents in source buffer
> to destination buffer scaling up or down properly.
> .blend - This operation blends contents in source buffer with
> the ones in destination buffer.
>
> And the above operations uses gem handle or user space address
> allocated by malloc() as source or destination buffer.
>
> And the test application includes just simple primitive drawing
> tests with the above library.
> And the guide to test is as the following,
> "#exynos_fimg2d_test -s connector_id at crtc_id:mode"
>
> With this above simple command, four primitive drawing operations
> would be called step by step and also rendered on the output device
> to the given connector and crtc id.
>
> Signed-off-by: Inki Dae 
> Signed-off-by: Kyungmin Park 

Fyi, I've pushed this now to libdrm tree

BR,
-R


> ---
>  configure.ac  |1 +
>  exynos/Makefile.am|2 +-
>  exynos/exynos_drm.h   |   52 +++
>  exynos/exynos_fimg2d.c|  630 +
>  exynos/fimg2d.h   |  325 +
>  exynos/fimg2d_reg.h   |  114 ++
>  tests/Makefile.am |4 +
>  tests/exynos/Makefile.am  |   19 +
>  tests/exynos/exynos_fimg2d_test.c |  695 
> +
>  9 files changed, 1841 insertions(+), 1 deletions(-)
>  create mode 100644 exynos/exynos_fimg2d.c
>  create mode 100644 exynos/fimg2d.h
>  create mode 100644 exynos/fimg2d_reg.h
>  create mode 100644 tests/exynos/Makefile.am
>  create mode 100644 tests/exynos/exynos_fimg2d_test.c
>
> diff --git a/configure.ac b/configure.ac
> index e2e3466..2896f91 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -364,6 +364,7 @@ AC_CONFIG_FILES([
> tests/kmstest/Makefile
> tests/radeon/Makefile
> tests/vbltest/Makefile
> +   tests/exynos/Makefile
> include/Makefile
> include/drm/Makefile
> man/Makefile
> diff --git a/exynos/Makefile.am b/exynos/Makefile.am
> index e782d34..539aea0 100644
> --- a/exynos/Makefile.am
> +++ b/exynos/Makefile.am
> @@ -10,7 +10,7 @@ libdrm_exynos_ladir = $(libdir)
>  libdrm_exynos_la_LDFLAGS = -version-number 1:0:0 -no-undefined
>  libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
>
> -libdrm_exynos_la_SOURCES = exynos_drm.c
> +libdrm_exynos_la_SOURCES = exynos_drm.c exynos_fimg2d.c
>
>  libdrm_exynoscommonincludedir = ${includedir}/exynos
>  libdrm_exynoscommoninclude_HEADERS = exynos_drm.h
> diff --git a/exynos/exynos_drm.h b/exynos/exynos_drm.h
> index aa97b22..c3c6579 100644
> --- a/exynos/exynos_drm.h
> +++ b/exynos/exynos_drm.h
> @@ -123,6 +123,46 @@ enum e_drm_exynos_gem_mem_type {
> EXYNOS_BO_WC
>  };
>
> +struct drm_exynos_g2d_get_ver {
> +   __u32   major;
> +   __u32   minor;
> +};
> +
> +struct drm_exynos_g2d_cmd {
> +   __u32   offset;
> +   __u32   data;
> +};
> +
> +enum drm_exynos_g2d_buf_type {
> +   G2D_BUF_USERPTR = 1 << 31,
> +};
> +
> +enum drm_exynos_g2d_event_type {
> +   G2D_EVENT_NOT,
> +   G2D_EVENT_NONSTOP,
> +   G2D_EVENT_STOP, /* not yet */
> +};
> +
> +struct drm_exynos_g2d_userptr {
> +   unsigned long userptr;
> +   unsigned long size;
> +};
> +
> +struct drm_exynos_g2d_set_cmdlist {
> +   __u64   cmd;
> +   __u64   cmd_buf;
> +   __u32   cmd_nr;
> +   __u32   cmd_buf_nr;
> +
> +   /* for g2d event */
> +   __u64   event_type;
> +   __u64   user_data;
> +};
> +
> +struct drm_exynos_g2d_exec {
> +   __u64   async;
> +};
> +
>  #define DRM_EXYNOS_GEM_CREATE  0x00
>  #define DRM_EXYNOS_GEM_MAP_OFFSET  0x01
>  #define DRM_EXYNOS_GEM_MMAP0x02
> @@ -130,6 +170,11 @@ enum e_drm_exynos_gem_mem_type {
>  #define DRM_EXYNOS_GEM_GET 0x04
>  #define DRM_EXYNOS_VIDI_CONNECTION 0x07
>
> +/* G2D */
> +#define DRM_EXYNOS_G2D_GET_VER 0x20
> +#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
> +#define DRM_EXYNOS_G2D_EXEC0x22
> +
>  #define DRM_IOCTL_EXYNOS_GEM_CREATEDRM_IOWR(DRM_COMMAND_BASE + \
> DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
>
> @@ -145,4 +190,11 @@ enum 

[PATCH V3] drm/exynos: fimd: calculate the correct address offset

2013-03-08 Thread Joonyoung Shim
On 03/07/2013 06:42 PM, Leela Krishna Amudala wrote:
> Calculate the correct address offset values for alpha and color key
> control registers based on exynos4 and exynos5 user manuals.

+ remove VIDOSD_C_SIZE_W0 macro and fix comments about registers for
size and alpha.

> Signed-off-by: Leela Krishna Amudala 
> ---
>   drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 +
>   1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 9537761..f5f2b25 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -38,11 +38,12 @@
>   /* position control register for hardware window 0, 2 ~ 4.*/
>   #define VIDOSD_A(win)   (VIDOSD_BASE + 0x00 + (win) * 16)
>   #define VIDOSD_B(win)   (VIDOSD_BASE + 0x04 + (win) * 16)
> -/* size control register for hardware window 0. */
> -#define VIDOSD_C_SIZE_W0 (VIDOSD_BASE + 0x08)
> -/* alpha control register for hardware window 1 ~ 4. */
> -#define VIDOSD_C(win)(VIDOSD_BASE + 0x18 + (win) * 16)
> -/* size control register for hardware window 1 ~ 4. */
> +/*
> + * size control register for hardware windows 0 and alpha control register
> + * for hardware windows 1 ~ 4
> + */
> +#define VIDOSD_C(win)(VIDOSD_BASE + 0x08 + (win) * 16)
> +/* size control register for hardware windows 1 ~ 2. */
>   #define VIDOSD_D(win)   (VIDOSD_BASE + 0x0C + (win) * 16)
>   
>   #define VIDWx_BUF_START(win, buf)   (VIDW_BUF_START(buf) + (win) * 8)
> @@ -50,9 +51,9 @@
>   #define VIDWx_BUF_SIZE(win, buf)(VIDW_BUF_SIZE(buf) + (win) * 4)
>   
>   /* color key control register for hardware window 1 ~ 4. */
> -#define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + (x * 8))
> +#define WKEYCON0_BASE(x) ((WKEYCON0 + 0x140) + ((x - 1) * 8))
>   /* color key value register for hardware window 1 ~ 4. */
> -#define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + (x * 8))
> +#define WKEYCON1_BASE(x) ((WKEYCON1 + 0x140) + ((x - 1) * 8))
>   
>   /* FIMD has totally five hardware windows. */
>   #define WINDOWS_NR  5
> @@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos)
>   if (win != 3 && win != 4) {
>   u32 offset = VIDOSD_D(win);
>   if (win == 0)
> - offset = VIDOSD_C_SIZE_W0;
> + offset = VIDOSD_C(win);
>   val = win_data->ovl_width * win_data->ovl_height;
>   writel(val, ctx->regs + offset);
>   

Acked-by: Joonyoung Shim 

Thanks.


Wrong vsync offset calculation in drm_edid.c

2013-03-08 Thread Paul Menzel
Dear Peter,


thank you for your patch. It has some formal issues though.


Am Donnerstag, den 07.03.2013, 16:41 +0100 schrieb Peter Blum:


1. Your subject line does not contain the tag [PATCH].
2. You should CC the maintainers.

> This patch is a bug fix for the file drm_edid.c of the kernel 3.8.

Is that bug also present in Linux 3.9 (Linus? master branch), which is
the current development branch. Patches have to be submitted against
that branch.

> The vsync offset is calculated wrong from the EDID set because of the

s,wrong,incorrectly,

> wrong shift direction.
> We could measure the bad old setting and also the good new setting after 
> the bug fix.
> 
> 
> Signed-off-by: Peter Blum 
> 
> 
> diff -Naur a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> --- a/drivers/gpu/drm/drm_edid.c2013-02-19 00:58:34.0 +0100
> +++ b/drivers/gpu/drm/drm_edid.c2013-03-07 12:04:24.527609783 +0100
> @@ -893,7 +893,7 @@
>  unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | 
> pt->vblank_lo;

3. Your MUA Thunderbird mangled the patch by automatically breaking
lines. You should disable that or use `git send-email`.

>  unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi 
> & 0xc0) << 2 | pt->hsync_offset_lo;
>  unsigned hsync_pulse_width = 
> (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | 
> pt->hsync_pulse_width_lo;
> -   unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 
> 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4;
> +   unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 
> 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4;

Not sure where it is determined how to shift that. But if it works for
you, good.

>  unsigned vsync_pulse_width = 
> (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | 
> (pt->vsync_offset_pulse_width_lo & 0xf);
> 
>  /* ignore tiny modes */

Please send a [PATCH v2] with a comment, what changed in v2 after `---`
right before the diff line.

$ git commit --amend # to edit commit message
$ git format-patch -1 --subject-prefix="PATCH v2"


Thanks,

Paul
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20130308/a3146bc2/attachment.pgp>


[Bug 62012] New: Intermittent black geometry

2013-03-08 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=62012

  Priority: medium
Bug ID: 62012
  Assignee: dri-devel at lists.freedesktop.org
   Summary: Intermittent black geometry
  Severity: major
Classification: Unclassified
OS: All
  Reporter: michel at daenzer.net
  Hardware: Other
Status: NEW
   Version: git
 Component: Drivers/Gallium/radeonsi
   Product: Mesa

Some apps intermittently show black instead of the expected coloration for some
parts of the geometry.

Investigating this with the rss-glx hack atunnel, the depth buffer appears to
have the correct values for the affected areas. So apparently the pixel shader
either doesn't run or fails to produce the correct colour values there for some
reason.

-- 
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/20130308/90e23d7b/attachment.html>


Black screen with nouveau in 3.8.x (regression)

2013-03-08 Thread Nick Bowler
On 2013-03-07 10:06 -0500, Nick Bowler wrote:
> I started a bisection... here's the first steps so far.  I will try to
> finish the procedure over the next couple days but I'm reporting this
> now in case someone needs me to get some other info.

I carried this on a bit further, but it seems that most of the remaining
commits bisect wants to test do not compile, so there is a huge number
of skipped commits.  Not exactly a lot of fun...

git bisect start 'drivers/gpu/drm'
# good: [3820288942d1c1524c3ee85cbf503fee1533cfc3] Linux 3.6.6
git bisect good 3820288942d1c1524c3ee85cbf503fee1533cfc3
# bad: [19b00d2dc9bedf0856e366cb7b9c7733ded659e4] Linux 3.8.2
git bisect bad 19b00d2dc9bedf0856e366cb7b9c7733ded659e4
# good: [a0d271cbfed1dd50278c6b06bead3d00ba0a88f9] Linux 3.6
git bisect good a0d271cbfed1dd50278c6b06bead3d00ba0a88f9
# bad: [daed2dbb7ea4d179e472396ce46377fe758d5faf] drm/i915: use the CPU and PCH 
transcoders on lpt_pch_enable
git bisect bad daed2dbb7ea4d179e472396ce46377fe758d5faf
# good: [df86b5765a48d5f557489577652bd6df145b0e1b] drm/savage: re-add busmaster 
enable, regression fix
git bisect good df86b5765a48d5f557489577652bd6df145b0e1b
# bad: [39df01cd6ce9f6dd755ace0030e2bebe75da7727] Merge branch 'drm-fixes-3.7' 
of git://people.freedesktop.org/~agd5f/linux into drm-fixes
git bisect bad 39df01cd6ce9f6dd755ace0030e2bebe75da7727
# bad: [b9f10852fcb1f09369d931dcbfbaad89ad1da4ad] drm/nv98/crypt: fix fuc build 
with latest envyas
git bisect bad b9f10852fcb1f09369d931dcbfbaad89ad1da4ad
# bad: [b10f20d590aa040e4028c04a70a27b9ad6650ba8] drm/nvc0-/gr: remove 
reset-after-grctx-construction hack
git bisect bad b10f20d590aa040e4028c04a70a27b9ad6650ba8
# skip: [18c9b959fd8ea6f3602efbedad788f53e305e6f1] drm/nouveau/gpuobj: create 
wrapper functions for mapping gpuobj into vm/bar
git bisect skip 18c9b959fd8ea6f3602efbedad788f53e305e6f1
# skip: [092599da308bf56b96c849ecdd315b8a1a13ca52] drm/nv50/instmem: remove use 
of nouveau_gpuobj_new_fake()
git bisect skip 092599da308bf56b96c849ecdd315b8a1a13ca52
# skip: [4196faa8623264b79279a06fd186654c959f2767] drm/nouveau/i2c: port to 
subdev interfaces
git bisect skip 4196faa8623264b79279a06fd186654c959f2767
# skip: [9da226f698c01b268b9172050df4150f269a7613] drm/nvc0/fifo: handle bar1 
control regs much like fifo/nve0
git bisect skip 9da226f698c01b268b9172050df4150f269a7613
# skip: [8aceb7de47ea2491abc1a577dc875b19e9947a54] drm/nouveau/clk: implement 
stub clock subdev
git bisect skip 8aceb7de47ea2491abc1a577dc875b19e9947a54
# skip: [70ee6f1cd6911098ddd4c11ee21b69dbe51fb3f9] drm/nv04-nv40/fifo: remove 
use of nouveau_gpuobj_new_fake()
git bisect skip 70ee6f1cd6911098ddd4c11ee21b69dbe51fb3f9
# skip: [f589be88caf32501a734e531180d5df5d6089ef3] drm/nouveau/pageflip: kick 
flip handling out of engsw and into fence
git bisect skip f589be88caf32501a734e531180d5df5d6089ef3
# skip: [73a60c0d218a292f8ef29d3467726ff26ed366fc] drm/nouveau/gpuobj: remove 
flags for vm-mappings
git bisect skip 73a60c0d218a292f8ef29d3467726ff26ed366fc
# skip: [70790f4f819875e8f390871fd15bbbf823f28e1b] drm/nouveau/clock: pull in 
the implementation from all over the place
git bisect skip 70790f4f819875e8f390871fd15bbbf823f28e1b
# skip: [5787640db6ae722aeadb394d480c7ca21b603e34] drm/nv04-nv40/instmem: 
remove use of nouveau_gpuobj_new_fake()
git bisect skip 5787640db6ae722aeadb394d480c7ca21b603e34
# skip: [cb75d97e9c77743ecfcc43375be135a55a4d9b25] drm/nouveau: implement 
devinit subdev, and new init table parser
git bisect skip cb75d97e9c77743ecfcc43375be135a55a4d9b25
# skip: [8a9b889e668a5bc2f4031015fe4893005c43403d] drm/nouveau: remove last use 
of nouveau_gpuobj_new_fake()
git bisect skip 8a9b889e668a5bc2f4031015fe4893005c43403d
# skip: [a73c5c526a8a39b2e61709c753d44be597c9a4c0] drm/nvc0-nve0/graph: rename 
dev to priv, no code changes
git bisect skip a73c5c526a8a39b2e61709c753d44be597c9a4c0
# good: [d6ba6d215a538a58f0f0026f0961b0b9125e8042] drm/nvc0/fence: restore 
pre-suspend fence buffer context on resume
git bisect good d6ba6d215a538a58f0f0026f0961b0b9125e8042
# skip: [7d9115dee978e8540734c456c925d71a37752b8d] drm/nouveau/mc: port to 
subdev interfaces
git bisect skip 7d9115dee978e8540734c456c925d71a37752b8d
# good: [3a92d37e4099054fe187b485a9d27c439c10eca7] drm/nouveau/gem: use 
bo.offset rather than mm_node.start
git bisect good 3a92d37e4099054fe187b485a9d27c439c10eca7
# skip: [5a5c7432bbbd2e318dff107b4ff960ab543a7cef] drm/nouveau/timer: port to 
subdev interfaces
git bisect skip 5a5c7432bbbd2e318dff107b4ff960ab543a7cef
# bad: [77145f1cbdf8d28b46ff8070ca749bad821e0774] drm/nouveau: port remainder 
of drm code, and rip out compat layer
git bisect bad 77145f1cbdf8d28b46ff8070ca749bad821e0774
# skip: [51a3d3425663698a79e8a9d01998a8a32ddee13b] drm/nouveau/backlight: 
remove dependence on nouveau_drv.h
git bisect skip 51a3d3425663698a79e8a9d01998a8a32ddee13b

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)


[PATCH v12 2/2] drm/exynos: enable OF_VIDEOMODE and FB_MODE_HELPERS for exynos drm fimd

2013-03-08 Thread Vikas Sajjan
Hi Mr. Dae,

On 7 March 2013 13:34, Inki Dae  wrote:
>
>
>> -Original Message-
>> From: linux-media-owner at vger.kernel.org [mailto:linux-media-
>> owner at vger.kernel.org] On Behalf Of Vikas Sajjan
>> Sent: Thursday, March 07, 2013 4:40 PM
>> To: dri-devel at lists.freedesktop.org
>> Cc: linux-media at vger.kernel.org; kgene.kim at samsung.com;
>> inki.dae at samsung.com; l.krishna at samsung.com; joshi at samsung.com; 
>> linaro-
>> kernel at lists.linaro.org
>> Subject: [PATCH v12 2/2] drm/exynos: enable OF_VIDEOMODE and
>> FB_MODE_HELPERS for exynos drm fimd
>>
>> patch adds "select OF_VIDEOMODE" and "select FB_MODE_HELPERS" when
>> EXYNOS_DRM_FIMD config is selected.
>>
>> Signed-off-by: Vikas Sajjan 
>> ---
>>  drivers/gpu/drm/exynos/Kconfig |2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/exynos/Kconfig
>> b/drivers/gpu/drm/exynos/Kconfig
>> index 046bcda..bb25130 100644
>> --- a/drivers/gpu/drm/exynos/Kconfig
>> +++ b/drivers/gpu/drm/exynos/Kconfig
>> @@ -25,6 +25,8 @@ config DRM_EXYNOS_DMABUF
>>  config DRM_EXYNOS_FIMD
>>   bool "Exynos DRM FIMD"
>>   depends on DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM
>
> Again, you missed 'OF' dependency. At least, let's have build testing surely
> before posting :)
>
 Surely will add " depends on OF && DRM_EXYNOS && !FB_S3C &&
!ARCH_MULTIPLATFORM "
and repost.

> Thanks,
> Inki Dae
>
>> + select OF_VIDEOMODE
>> + select FB_MODE_HELPERS
>>   help
>> Choose this option if you want to use Exynos FIMD for DRM.
>>
>> --
>> 1.7.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Thanks and Regards
 Vikas Sajjan


Re: [PATCH RFC] drm/exynos: hdmi: move hdmiphy related code to hdmiphy driver

2013-03-08 Thread Rahul Sharma
On Thu, Mar 7, 2013 at 2:05 PM, Inki Dae inki@samsung.com wrote:


 -Original Message-
 From: 김승우 [mailto:sw0312@samsung.com]
 Sent: Thursday, March 07, 2013 4:04 PM
 To: Rahul Sharma
 Cc: Inki Dae; linux-samsung-...@vger.kernel.org; Sean Paul; sunil joshi;
 dri-devel@lists.freedesktop.org; Rahul Sharma; sw0312@samsung.com
 Subject: Re: [PATCH RFC] drm/exynos: hdmi: move hdmiphy related code to
 hdmiphy driver



 On 2013년 03월 07일 15:45, Rahul Sharma wrote:
  Thanks Seung Woo, Mr. Dae,
 
  On Thu, Mar 7, 2013 at 10:13 AM, Inki Dae inki@samsung.com wrote:
  2013/3/7 김승우 sw0312@samsung.com:
 
 
  On 2013년 03월 04일 23:05, Rahul Sharma wrote:
  Thanks Sean,
 
  On Wed, Feb 27, 2013 at 9:47 PM, Sean Paul seanp...@google.com
 wrote:
  On Wed, Feb 27, 2013 at 8:22 AM, Rahul Sharma
 rahul.sha...@samsung.com wrote:
  Right now hdmiphy operations and configs are kept inside hdmi
 driver. hdmiphy related
  code is tightly coupled with hdmi ip driver. Physicaly they are
 different devices and
 
  s/Physicaly/Physically/
 
  should be instantiated independently.
 
  In terms of versions/mapping/configurations Hdmi and hdmiphy are
 independent of each
  other. It is preferred to isolate them and maintained
 independently.
 
  This implementations is tested for:
  1) Resolutions supported by exynos4 and 5 hdmi.
  2) Runtime PM and S2R scenarions for exynos5.
 
 
  I don't like the idea of spawning off yet another driver in here. It
  adds more globals, more suspend/resume ordering issues, and more
  implicit dependencies. I understand, however, that this is the
 Chosen
  Way for the exynos driver, so I will save my rant.
 
 
  I agree to it. splitting phy to a new driver will complicate the
 power related
  scenarios. But in upcoming SoC,s, Phy is changing considerably in
 terms of
  config values, mapping (i2c/platform bus) etc. Handling this
 diversity
  inside hdmi driver is complicating it with unrelated changes.
 
  Basically, I agree with the idea to split hdmiphy from hdmi. And it
  seems that already existing hdmiphy i2c device is just reused and
  hdmiphy_power_on is reorganized to hdmiphy dpms operation: even
 calling
  flow of power operations is reordered.
 
  But I'm not sure exynos_hdmiphy_driver_register() really need to be
  called from exynos_drm_init() of exynos_drm_drv.c. IMO, it is enough
 to
  call exynos_hdmiphy_driver_register() from hdmi_probe() because
 hdmiphy
  is only used from hdmi.
 
 
  I agree with Seung-Woo. The hdmiphy is just one part of HDMI subsystem.
 
 
  I agree to the Seung Woo's point that hdmi-phy used to be solely
 accessed by
  hdmi driver.  But in this RFC, hdmi-phy is not called by hdmi driver
  anymore. Phy
  ops will be called from drm-common-hdmi platform driver along with mixer
 and
  hdmi ops.

 Considering this, exynos_drm_hdmi_probe() is more proper position.

 
  The rational behind my implementation is that I am projecting hdmi-phy
 as
  a device which is peer to hdmi ip and mixer. These 3 devices together
 makes
  DRM HDMI subsystem.
 
  Even physically hdmi-phy doesn't seems to be a part of hdmi ip though
  configurations are listed under hdmi ip user manual. It looks like a
  isolated module accessed by i2c.
 
  Though I don't find anything wrong with Seung Woo suggestion but above
  placement of hdmi-phy (parallel to hdmi and mixer) makes more sense
  to me.
 
  Please have a another look at it and let me know your opinion.
 
  Another things which bothers me is registering mixer, hdmi driver inside
  exynos_drm_init(). If we strictly follow the hierarchy inside drm,
  exynos_drm_init()
  should register drm-common-hdmi only. drm-common-hdmi should register
  mixer and hdmi (or hdmi-phy as well).

 Yes, it makes sense. All real hw blocks for hdmi including mixer, hdmi,
 and hdmiphy shoulde be registered in exynos_drm_hdmi (drm-common-hdmi
 for exynos).


 Ideally, right. But the reason I designed and implemented hdmi subsystem
 framework like this, is that there was one issue that
 platform_device_register() can't be called at probe(). On other words, when
 one platform device driver is being probed, anyone can't be probed. Anyway,
 existing way needs to be improved. So let's find better way and improve the
 hdmi subsystem framework this time. :)

Mr. Dae,

if we move exynos_drm_drv.o towards last in the makefile, we can
conveniently move all driver(or plf device for drm-comon-hdmi) registrations
from exynos_drm_init to module_init of the respective drivers.

I verified above changes for hdmi and S2R scenarios.

regards,
Rahul Sharma


 Thanks,
 Inki Dae

 Thanks and Regards,
 - Seung-Woo Kim

 
  regards,
  Rahul Sharma.
 
  Thanks,
  Inki Dae
 
  Thanks and Regards,
  - Seung-Woo Kim
 
 
  I have tested this RFC for Runtime PM / S2R. But if we see any major
 roadblock
  we should re-factor this by explicitly calling power related
 callbacks
  of mixer, phy,
  hdmi drivers in a required order. We can call them from exynos-drm-
 hdmi 

Re: Wrong vsync offset calculation in drm_edid.c

2013-03-08 Thread Paul Menzel
Dear Peter,


thank you for your patch. It has some formal issues though.


Am Donnerstag, den 07.03.2013, 16:41 +0100 schrieb Peter Blum:


1. Your subject line does not contain the tag [PATCH].
2. You should CC the maintainers.

 This patch is a bug fix for the file drm_edid.c of the kernel 3.8.

Is that bug also present in Linux 3.9 (Linus’ master branch), which is
the current development branch. Patches have to be submitted against
that branch.

 The vsync offset is calculated wrong from the EDID set because of the

s,wrong,incorrectly,

 wrong shift direction.
 We could measure the bad old setting and also the good new setting after 
 the bug fix.
 
 
 Signed-off-by: Peter Blum peter.b...@lxco.com
 
 
 diff -Naur a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
 --- a/drivers/gpu/drm/drm_edid.c2013-02-19 00:58:34.0 +0100
 +++ b/drivers/gpu/drm/drm_edid.c2013-03-07 12:04:24.527609783 +0100
 @@ -893,7 +893,7 @@
  unsigned vblank = (pt-vactive_vblank_hi  0xf)  8 | 
 pt-vblank_lo;

3. Your MUA Thunderbird mangled the patch by automatically breaking
lines. You should disable that or use `git send-email`.

  unsigned hsync_offset = (pt-hsync_vsync_offset_pulse_width_hi 
  0xc0)  2 | pt-hsync_offset_lo;
  unsigned hsync_pulse_width = 
 (pt-hsync_vsync_offset_pulse_width_hi  0x30)  4 | 
 pt-hsync_pulse_width_lo;
 -   unsigned vsync_offset = (pt-hsync_vsync_offset_pulse_width_hi  
 0xc)  2 | pt-vsync_offset_pulse_width_lo  4;
 +   unsigned vsync_offset = (pt-hsync_vsync_offset_pulse_width_hi  
 0xc)  2 | pt-vsync_offset_pulse_width_lo  4;

Not sure where it is determined how to shift that. But if it works for
you, good.

  unsigned vsync_pulse_width = 
 (pt-hsync_vsync_offset_pulse_width_hi  0x3)  4 | 
 (pt-vsync_offset_pulse_width_lo  0xf);
 
  /* ignore tiny modes */

Please send a [PATCH v2] with a comment, what changed in v2 after `---`
right before the diff line.

$ git commit --amend # to edit commit message
$ git format-patch -1 --subject-prefix=PATCH v2


Thanks,

Paul


signature.asc
Description: This is a digitally signed message part
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 62012] New: Intermittent black geometry

2013-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=62012

  Priority: medium
Bug ID: 62012
  Assignee: dri-devel@lists.freedesktop.org
   Summary: Intermittent black geometry
  Severity: major
Classification: Unclassified
OS: All
  Reporter: mic...@daenzer.net
  Hardware: Other
Status: NEW
   Version: git
 Component: Drivers/Gallium/radeonsi
   Product: Mesa

Some apps intermittently show black instead of the expected coloration for some
parts of the geometry.

Investigating this with the rss-glx hack atunnel, the depth buffer appears to
have the correct values for the affected areas. So apparently the pixel shader
either doesn't run or fails to produce the correct colour values there for some
reason.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv6 0/9] Support for Tegra 2D hardware

2013-03-08 Thread Terje Bergstrom
This set of patches adds support for Tegra20 and Tegra30 host1x and
2D. It is based on linux-next-20130307.

Changes in this version:
 * Rebased on latest tegradrm
 * Renamed tegradrm's host1x to host1x_drm
 * Indentation and line split fixed to follow tegradrm convention
 * Pointers to platform_device replaced with pointers to device
 * Added host1x allocator, and wired it in
 * Debug spew code fixed to access mem handles from host1x_job
 * CDMA code doesn't keep the mem handles anymore
 * Push buffer ops have been made generic code
 * Removed the pin_array optimization in host1x_job to simplify code
 * Large number of smaller changes

The driver implements an allocator using the DRM CMA helper. Each buffer is
assigned an ops structure to operate on it. In future the DRM CMA helper will
be replaced with an own allocator to implement IOMMU support.

host1x is the driver that controls host1x hardware. It supports
host1x command channels, synchronization, and memory management. It
is sectioned into logical driver under drivers/gpu/host1x and
physical driver under drivers/host1x/hw. The physical driver is
compiled with the hardware headers of the particular host1x version.

The hardware units are described (briefly) in the Tegra2 TRM. Wiki
page http://http.download.nvidia.com/tegra-public-appnotes/host1x.html
also contains a short description of the functionality.

The patch set merges tegradrm into host1x and adds 2D driver, which
uses host1x channels and sync points. The patch set also adds user
space API to tegradrm for accessing host1x and 2D.

The changes to add support to libdrm are in
g...@gitorious.org:linux-host1x/libdrm-host1x.git

Arto Merilainen (2):
  gpu: host1x: drm: Rename host1x to host1x_drm
  gpu: host1x: drm: Add CMA ops for host1x driver

Terje Bergstrom (7):
  gpu: host1x: Add host1x driver
  gpu: host1x: Add syncpoint wait and interrupts
  gpu: host1x: Add channel support
  gpu: host1x: Add debug support
  drm: tegra: Move drm to live under host1x
  gpu: host1x: Remove second host1x driver
  drm: tegra: Add gr2d device

 drivers/gpu/Makefile   |1 +
 drivers/gpu/drm/Kconfig|2 -
 drivers/gpu/drm/Makefile   |1 -
 drivers/gpu/drm/tegra/Makefile |7 -
 drivers/gpu/drm/tegra/drm.c|  217 
 drivers/gpu/drm/tegra/host1x.c |  327 
 drivers/gpu/host1x/Kconfig |   23 +
 drivers/gpu/host1x/Makefile|   21 +
 drivers/gpu/host1x/cdma.c  |  491 ++
 drivers/gpu/host1x/cdma.h  |  102 
 drivers/gpu/host1x/channel.c   |  120 +
 drivers/gpu/host1x/channel.h   |   52 ++
 drivers/gpu/host1x/debug.c |  210 
 drivers/gpu/host1x/debug.h |   51 ++
 drivers/gpu/host1x/dev.c   |  248 +
 drivers/gpu/host1x/dev.h   |  317 
 drivers/gpu/{drm/tegra = host1x/drm}/Kconfig  |2 +-
 drivers/gpu/host1x/drm/cma.c   |   87 
 drivers/gpu/host1x/drm/cma.h   |   26 +
 drivers/gpu/{drm/tegra = host1x/drm}/dc.c |5 +-
 drivers/gpu/{drm/tegra = host1x/drm}/dc.h |0
 drivers/gpu/host1x/drm/drm.c   |  661 
 drivers/gpu/{drm/tegra = host1x/drm}/drm.h|   51 +-
 drivers/gpu/{drm/tegra = host1x/drm}/fb.c |6 +-
 drivers/gpu/host1x/drm/gr2d.c  |  325 
 drivers/gpu/{drm/tegra = host1x/drm}/hdmi.c   |5 +-
 drivers/gpu/{drm/tegra = host1x/drm}/hdmi.h   |0
 drivers/gpu/{drm/tegra = host1x/drm}/output.c |0
 drivers/gpu/{drm/tegra = host1x/drm}/rgb.c|0
 drivers/gpu/host1x/host1x.h|   29 ++
 drivers/gpu/host1x/host1x_client.h |   35 ++
 drivers/gpu/host1x/hw/Makefile |6 +
 drivers/gpu/host1x/hw/cdma_hw.c|  327 
 drivers/gpu/host1x/hw/channel_hw.c |  167 ++
 drivers/gpu/host1x/hw/debug_hw.c   |  322 
 drivers/gpu/host1x/hw/host1x01.c   |   42 ++
 drivers/gpu/host1x/hw/host1x01.h   |   25 +
 drivers/gpu/host1x/hw/host1x01_hardware.h  |  143 +
 drivers/gpu/host1x/hw/hw_host1x01_channel.h|  120 +
 drivers/gpu/host1x/hw/hw_host1x01_sync.h   |  243 +
 drivers/gpu/host1x/hw/hw_host1x01_uclass.h |  174 +++
 drivers/gpu/host1x/hw/intr_hw.c|  143 +
 drivers/gpu/host1x/hw/syncpt_hw.c  |  114 
 drivers/gpu/host1x/intr.c  |  354 +
 drivers/gpu/host1x/intr.h  |  102 
 drivers/gpu/host1x/job.c   |  598 +
 drivers/gpu/host1x/job.h   |  158 ++
 drivers/gpu/host1x/memmgr.c| 

[PATCHv6 6/9] gpu: host1x: drm: Rename host1x to host1x_drm

2013-03-08 Thread Terje Bergstrom
From: Arto Merilainen amerilai...@nvidia.com

Both host1x and drm drivers have host1x structures. This patch
renames the host1x structure under drm to follow name host1x_drm.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/host1x/drm/dc.c |4 ++--
 drivers/gpu/host1x/drm/drm.c|4 ++--
 drivers/gpu/host1x/drm/drm.h|   14 +++---
 drivers/gpu/host1x/drm/fb.c |6 +++---
 drivers/gpu/host1x/drm/hdmi.c   |4 ++--
 drivers/gpu/host1x/drm/host1x.c |   22 --
 6 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/host1x/drm/dc.c b/drivers/gpu/host1x/drm/dc.c
index de94707..d1f6609 100644
--- a/drivers/gpu/host1x/drm/dc.c
+++ b/drivers/gpu/host1x/drm/dc.c
@@ -1097,7 +1097,7 @@ static const struct host1x_client_ops dc_client_ops = {
 
 static int tegra_dc_probe(struct platform_device *pdev)
 {
-   struct host1x *host1x = dev_get_drvdata(pdev-dev.parent);
+   struct host1x_drm *host1x = dev_get_drvdata(pdev-dev.parent);
struct resource *regs;
struct tegra_dc *dc;
int err;
@@ -1160,7 +1160,7 @@ static int tegra_dc_probe(struct platform_device *pdev)
 
 static int tegra_dc_remove(struct platform_device *pdev)
 {
-   struct host1x *host1x = dev_get_drvdata(pdev-dev.parent);
+   struct host1x_drm *host1x = dev_get_drvdata(pdev-dev.parent);
struct tegra_dc *dc = platform_get_drvdata(pdev);
int err;
 
diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c
index 9d452df..6c59bcd 100644
--- a/drivers/gpu/host1x/drm/drm.c
+++ b/drivers/gpu/host1x/drm/drm.c
@@ -26,7 +26,7 @@
 static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 {
struct device *dev = drm-dev;
-   struct host1x *host1x;
+   struct host1x_drm *host1x;
int err;
 
host1x = dev_get_drvdata(dev);
@@ -69,7 +69,7 @@ static int tegra_drm_open(struct drm_device *drm, struct 
drm_file *filp)
 
 static void tegra_drm_lastclose(struct drm_device *drm)
 {
-   struct host1x *host1x = drm-dev_private;
+   struct host1x_drm *host1x = drm-dev_private;
 
drm_fbdev_cma_restore_mode(host1x-fbdev);
 }
diff --git a/drivers/gpu/host1x/drm/drm.h b/drivers/gpu/host1x/drm/drm.h
index a6c011d..7fedb6c 100644
--- a/drivers/gpu/host1x/drm/drm.h
+++ b/drivers/gpu/host1x/drm/drm.h
@@ -18,7 +18,7 @@
 #include drm/drm_fb_cma_helper.h
 #include drm/drm_fixed.h
 
-struct host1x {
+struct host1x_drm {
struct drm_device *drm;
struct device *dev;
void __iomem *regs;
@@ -44,7 +44,7 @@ struct host1x_client_ops {
 };
 
 struct host1x_client {
-   struct host1x *host1x;
+   struct host1x_drm *host1x;
struct device *dev;
 
const struct host1x_client_ops *ops;
@@ -52,12 +52,12 @@ struct host1x_client {
struct list_head list;
 };
 
-extern int host1x_drm_init(struct host1x *host1x, struct drm_device *drm);
-extern int host1x_drm_exit(struct host1x *host1x);
+extern int host1x_drm_init(struct host1x_drm *host1x, struct drm_device *drm);
+extern int host1x_drm_exit(struct host1x_drm *host1x);
 
-extern int host1x_register_client(struct host1x *host1x,
+extern int host1x_register_client(struct host1x_drm *host1x,
  struct host1x_client *client);
-extern int host1x_unregister_client(struct host1x *host1x,
+extern int host1x_unregister_client(struct host1x_drm *host1x,
struct host1x_client *client);
 
 struct tegra_output;
@@ -66,7 +66,7 @@ struct tegra_dc {
struct host1x_client client;
spinlock_t lock;
 
-   struct host1x *host1x;
+   struct host1x_drm *host1x;
struct device *dev;
 
struct drm_crtc base;
diff --git a/drivers/gpu/host1x/drm/fb.c b/drivers/gpu/host1x/drm/fb.c
index 0391495..6ed885a 100644
--- a/drivers/gpu/host1x/drm/fb.c
+++ b/drivers/gpu/host1x/drm/fb.c
@@ -11,7 +11,7 @@
 
 static void tegra_drm_fb_output_poll_changed(struct drm_device *drm)
 {
-   struct host1x *host1x = drm-dev_private;
+   struct host1x_drm *host1x = drm-dev_private;
 
drm_fbdev_cma_hotplug_event(host1x-fbdev);
 }
@@ -23,7 +23,7 @@ static const struct drm_mode_config_funcs 
tegra_drm_mode_funcs = {
 
 int tegra_drm_fb_init(struct drm_device *drm)
 {
-   struct host1x *host1x = drm-dev_private;
+   struct host1x_drm *host1x = drm-dev_private;
struct drm_fbdev_cma *fbdev;
 
drm-mode_config.min_width = 0;
@@ -46,7 +46,7 @@ int tegra_drm_fb_init(struct drm_device *drm)
 
 void tegra_drm_fb_exit(struct drm_device *drm)
 {
-   struct host1x *host1x = drm-dev_private;
+   struct host1x_drm *host1x = drm-dev_private;
 
drm_fbdev_cma_fini(host1x-fbdev);
 }
diff --git a/drivers/gpu/host1x/drm/hdmi.c b/drivers/gpu/host1x/drm/hdmi.c
index bb747f6..f438f80 100644
--- a/drivers/gpu/host1x/drm/hdmi.c
+++ 

[PATCHv6 5/9] drm: tegra: Move drm to live under host1x

2013-03-08 Thread Terje Bergstrom
Make drm part of host1x driver.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/drm/Kconfig|2 --
 drivers/gpu/drm/Makefile   |1 -
 drivers/gpu/drm/tegra/Makefile |7 ---
 drivers/gpu/host1x/Kconfig |2 ++
 drivers/gpu/host1x/Makefile|5 +
 drivers/gpu/{drm/tegra = host1x/drm}/Kconfig  |0
 drivers/gpu/{drm/tegra = host1x/drm}/dc.c |0
 drivers/gpu/{drm/tegra = host1x/drm}/dc.h |0
 drivers/gpu/{drm/tegra = host1x/drm}/drm.c|0
 drivers/gpu/{drm/tegra = host1x/drm}/drm.h|6 +++---
 drivers/gpu/{drm/tegra = host1x/drm}/fb.c |0
 drivers/gpu/{drm/tegra = host1x/drm}/hdmi.c   |0
 drivers/gpu/{drm/tegra = host1x/drm}/hdmi.h   |0
 drivers/gpu/{drm/tegra = host1x/drm}/host1x.c |0
 drivers/gpu/{drm/tegra = host1x/drm}/output.c |0
 drivers/gpu/{drm/tegra = host1x/drm}/rgb.c|0
 16 files changed, 10 insertions(+), 13 deletions(-)
 delete mode 100644 drivers/gpu/drm/tegra/Makefile
 rename drivers/gpu/{drm/tegra = host1x/drm}/Kconfig (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/dc.c (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/dc.h (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/drm.c (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/drm.h (98%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/fb.c (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/hdmi.c (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/hdmi.h (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/host1x.c (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/output.c (100%)
 rename drivers/gpu/{drm/tegra = host1x/drm}/rgb.c (100%)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 1e82882..9031bb7 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -215,8 +215,6 @@ source drivers/gpu/drm/cirrus/Kconfig
 
 source drivers/gpu/drm/shmobile/Kconfig
 
-source drivers/gpu/drm/tegra/Kconfig
-
 source drivers/gpu/drm/omapdrm/Kconfig
 
 source drivers/gpu/drm/tilcdc/Kconfig
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 0d59b24..847b830 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -49,7 +49,6 @@ obj-$(CONFIG_DRM_GMA500) += gma500/
 obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
 obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
-obj-$(CONFIG_DRM_TEGRA) += tegra/
 obj-$(CONFIG_DRM_OMAP) += omapdrm/
 obj-$(CONFIG_DRM_TILCDC)   += tilcdc/
 obj-y  += i2c/
diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile
deleted file mode 100644
index 80f73d1..000
--- a/drivers/gpu/drm/tegra/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ccflags-y := -Iinclude/drm
-ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
-
-tegra-drm-y := drm.o fb.o dc.o host1x.o
-tegra-drm-y += output.o rgb.o hdmi.o
-
-obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
index 00f0859..ee3af1e 100644
--- a/drivers/gpu/host1x/Kconfig
+++ b/drivers/gpu/host1x/Kconfig
@@ -18,4 +18,6 @@ config TEGRA_HOST1X_FIREWALL
 
  If unsure, choose Y.
 
+source drivers/gpu/host1x/drm/Kconfig
+
 endif
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index dfc6f35..db4dc25 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -11,4 +11,9 @@ host1x-y = \
memmgr.o \
hw/host1x01.o
 
+ccflags-y += -Iinclude/drm
+ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
+
+host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o drm/host1x.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/host1x/drm/Kconfig
similarity index 100%
rename from drivers/gpu/drm/tegra/Kconfig
rename to drivers/gpu/host1x/drm/Kconfig
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/host1x/drm/dc.c
similarity index 100%
rename from drivers/gpu/drm/tegra/dc.c
rename to drivers/gpu/host1x/drm/dc.c
diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/host1x/drm/dc.h
similarity index 100%
rename from drivers/gpu/drm/tegra/dc.h
rename to drivers/gpu/host1x/drm/dc.h
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/host1x/drm/drm.c
similarity index 100%
rename from drivers/gpu/drm/tegra/drm.c
rename to drivers/gpu/host1x/drm/drm.c
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/host1x/drm/drm.h
similarity index 98%
rename from drivers/gpu/drm/tegra/drm.h
rename to drivers/gpu/host1x/drm/drm.h
index 6dd75a2..a6c011d 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/host1x/drm/drm.h
@@ -7,8 +7,8 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef TEGRA_DRM_H
-#define TEGRA_DRM_H 1
+#ifndef HOST1X_DRM_H
+#define HOST1X_DRM_H 1
 
 #include drm/drmP.h
 #include drm/drm_crtc_helper.h
@@ -234,4 

[PATCHv6 4/9] gpu: host1x: Add debug support

2013-03-08 Thread Terje Bergstrom
Add support for host1x debugging. Adds debugfs entries, and dumps
channel state to UART in case of stuck job.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/host1x/Makefile |1 +
 drivers/gpu/host1x/cdma.c   |5 +
 drivers/gpu/host1x/debug.c  |  210 +
 drivers/gpu/host1x/debug.h  |   51 +
 drivers/gpu/host1x/dev.c|3 +
 drivers/gpu/host1x/dev.h|   42 
 drivers/gpu/host1x/hw/cdma_hw.c |3 +
 drivers/gpu/host1x/hw/channel_hw.c  |   27 ++-
 drivers/gpu/host1x/hw/debug_hw.c|  322 +++
 drivers/gpu/host1x/hw/host1x01.c|2 +
 drivers/gpu/host1x/hw/hw_host1x01_channel.h |   18 ++
 drivers/gpu/host1x/hw/hw_host1x01_sync.h|  115 ++
 drivers/gpu/host1x/hw/hw_host1x01_uclass.h  |6 +
 drivers/gpu/host1x/hw/syncpt_hw.c   |1 +
 drivers/gpu/host1x/syncpt.c |5 +
 15 files changed, 810 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/host1x/debug.c
 create mode 100644 drivers/gpu/host1x/debug.h
 create mode 100644 drivers/gpu/host1x/hw/debug_hw.c

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index 7278bf3..dfc6f35 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -7,6 +7,7 @@ host1x-y = \
cdma.o \
channel.o \
job.o \
+   debug.o \
memmgr.o \
hw/host1x01.o
 
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index a45bb94..f3167bf 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -29,6 +29,7 @@
 #include cdma.h
 #include channel.h
 #include dev.h
+#include debug.h
 #include job.h
 #include memmgr.h
 
@@ -438,6 +439,10 @@ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, 
u32 op2)
struct push_buffer *pb = cdma-push_buffer;
u32 slots_free = cdma-slots_free;
 
+   if (host1x_debug_trace_cmdbuf)
+   trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)-dev),
+  op1, op2);
+
if (slots_free == 0) {
host1x_hw_cdma_flush(host1x, cdma);
slots_free = host1x_cdma_wait_locked(cdma,
diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
new file mode 100644
index 000..cb8aff9
--- /dev/null
+++ b/drivers/gpu/host1x/debug.c
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2010 Google, Inc.
+ * Author: Erik Gilling konk...@android.com
+ *
+ * Copyright (C) 2011-2013 NVIDIA Corporation
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/debugfs.h
+#include linux/seq_file.h
+#include linux/uaccess.h
+
+#include linux/io.h
+
+#include dev.h
+#include debug.h
+#include channel.h
+
+unsigned int host1x_debug_trace_cmdbuf;
+
+static pid_t host1x_debug_force_timeout_pid;
+static u32 host1x_debug_force_timeout_val;
+static u32 host1x_debug_force_timeout_channel;
+
+void host1x_debug_output(struct output *o, const char *fmt, ...)
+{
+   va_list args;
+   int len;
+
+   va_start(args, fmt);
+   len = vsnprintf(o-buf, sizeof(o-buf), fmt, args);
+   va_end(args);
+   o-fn(o-ctx, o-buf, len);
+}
+
+static int show_channels(struct host1x_channel *ch, void *data, bool show_fifo)
+{
+   struct host1x *m = host1x_get_host(ch-dev);
+   struct output *o = data;
+
+   mutex_lock(ch-reflock);
+   if (ch-refcount) {
+   mutex_lock(ch-cdma.lock);
+   if (show_fifo)
+   host1x_hw_show_channel_fifo(m, ch, o);
+   host1x_hw_show_channel_cdma(m, ch, o);
+   mutex_unlock(ch-cdma.lock);
+   }
+   mutex_unlock(ch-reflock);
+
+   return 0;
+}
+
+static void show_syncpts(struct host1x *m, struct output *o)
+{
+   int i;
+   host1x_debug_output(o,  syncpts \n);
+   for (i = 0; i  host1x_syncpt_nb_pts(m); i++) {
+   u32 max = host1x_syncpt_read_max(m-syncpt + i);
+   u32 min = host1x_syncpt_load(m-syncpt + i);
+   if (!min  !max)
+   continue;
+   host1x_debug_output(o, id %d (%s) min %d max %d\n,
+   i, m-syncpt[i].name, min, max);
+   }
+
+   for (i = 0; i  host1x_syncpt_nb_bases(m); i++) {
+   u32 base_val;
+   base_val = host1x_syncpt_load_wait_base(m-syncpt + i);
+ 

[PATCHv6 2/9] gpu: host1x: Add syncpoint wait and interrupts

2013-03-08 Thread Terje Bergstrom
Add support for sync point interrupts, and sync point wait. Sync
point wait used interrupts for unblocking wait.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/host1x/Makefile  |1 +
 drivers/gpu/host1x/dev.c |   12 ++
 drivers/gpu/host1x/dev.h |   51 +
 drivers/gpu/host1x/hw/host1x01.c |2 +
 drivers/gpu/host1x/hw/hw_host1x01_sync.h |   42 
 drivers/gpu/host1x/hw/intr_hw.c  |  143 +
 drivers/gpu/host1x/intr.c|  328 ++
 drivers/gpu/host1x/intr.h|   96 +
 drivers/gpu/host1x/syncpt.c  |  159 +++
 drivers/gpu/host1x/syncpt.h  |   14 +-
 10 files changed, 847 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/host1x/hw/intr_hw.c
 create mode 100644 drivers/gpu/host1x/intr.c
 create mode 100644 drivers/gpu/host1x/intr.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index 363e6ab..5ef47ff 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -3,6 +3,7 @@ ccflags-y = -Idrivers/gpu/host1x
 host1x-y = \
syncpt.o \
dev.o \
+   intr.o \
hw/host1x01.o
 
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index d95a9b2..4421e28 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -28,6 +28,7 @@
 #include trace/events/host1x.h
 
 #include dev.h
+#include intr.h
 #include hw/host1x01.h
 
 void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
@@ -127,12 +128,23 @@ static int host1x_probe(struct platform_device *pdev)
return err;
}
 
+   err = host1x_intr_init(host, syncpt_irq);
+   if (err) {
+   dev_err(dev, failed to init irq);
+   goto fail_deinit_syncpt;
+   }
+
return 0;
+
+fail_deinit_syncpt:
+   host1x_syncpt_deinit(host);
+   return err;
 }
 
 static int __exit host1x_remove(struct platform_device *pdev)
 {
struct host1x *host = platform_get_drvdata(pdev);
+   host1x_intr_deinit(host);
host1x_syncpt_deinit(host);
clk_disable_unprepare(host-clk);
return 0;
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 750daa3..fb5f842 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -21,6 +21,7 @@
 #include linux/device.h
 
 #include syncpt.h
+#include intr.h
 
 struct host1x_syncpt;
 
@@ -33,6 +34,17 @@ struct host1x_syncpt_ops {
int (*patch_wait)(struct host1x_syncpt *syncpt, void *patch_addr);
 };
 
+struct host1x_intr_ops {
+   int (*init_host_sync)(struct host1x *host, u32 cpm,
+   void (*syncpt_thresh_work)(struct work_struct *work));
+   void (*set_syncpt_threshold)(
+   struct host1x *host, u32 id, u32 thresh);
+   void (*enable_syncpt_intr)(struct host1x *host, u32 id);
+   void (*disable_syncpt_intr)(struct host1x *host, u32 id);
+   void (*disable_all_syncpt_intrs)(struct host1x *host);
+   int (*free_syncpt_irq)(struct host1x *host);
+};
+
 struct host1x_info {
int nb_channels;/* host1x: num channels supported */
int nb_pts; /* host1x: num syncpoints supported */
@@ -50,7 +62,13 @@ struct host1x {
struct device *dev;
struct clk *clk;
 
+   struct mutex intr_mutex;
+   struct workqueue_struct *intr_wq;
+   int intr_syncpt_irq;
+
const struct host1x_syncpt_ops *syncpt_op;
+   const struct host1x_intr_ops *intr_op;
+
 };
 
 static inline struct host1x *host1x_get_host(struct device *dev)
@@ -101,4 +119,37 @@ static inline int host1x_hw_syncpt_patch_wait(struct 
host1x *host,
return host-syncpt_op-patch_wait(sp, patch_addr);
 }
 
+static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
+   void (*syncpt_thresh_work)(struct work_struct *))
+{
+   return host-intr_op-init_host_sync(host, cpm, syncpt_thresh_work);
+}
+
+static inline void host1x_hw_intr_set_syncpt_threshold(struct host1x *host,
+  u32 id, u32 thresh)
+{
+   host-intr_op-set_syncpt_threshold(host, id, thresh);
+}
+
+static inline void host1x_hw_intr_enable_syncpt_intr(struct host1x *host,
+u32 id)
+{
+   host-intr_op-enable_syncpt_intr(host, id);
+}
+
+static inline void host1x_hw_intr_disable_syncpt_intr(struct host1x *host,
+ u32 id)
+{
+   host-intr_op-disable_syncpt_intr(host, id);
+}
+
+static inline void host1x_hw_intr_disable_all_syncpt_intrs(struct host1x *host)
+{
+   host-intr_op-disable_all_syncpt_intrs(host);
+}
+
+static inline int host1x_hw_intr_free_syncpt_irq(struct host1x *host)
+{
+   

[PATCHv6 9/9] drm: tegra: Add gr2d device

2013-03-08 Thread Terje Bergstrom
Add client driver for 2D device, and IOCTLs to pass work to host1x
channel for 2D.

Also adds functions that can be called to access sync points from
DRM.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/host1x/Makefile   |1 +
 drivers/gpu/host1x/dev.c  |7 +
 drivers/gpu/host1x/drm/drm.c  |  239 +-
 drivers/gpu/host1x/drm/drm.h  |   28 +++-
 drivers/gpu/host1x/drm/gr2d.c |  325 +
 drivers/gpu/host1x/host1x.h   |3 +-
 include/drm/tegra_drm.h   |  131 +
 7 files changed, 730 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/host1x/drm/gr2d.c
 create mode 100644 include/drm/tegra_drm.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index d1d7e35..d90168f 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -17,4 +17,5 @@ ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
 host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/cma.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/gr2d.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 6af8081..0091632 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -211,11 +211,17 @@ static int __init tegra_host1x_init(void)
err = platform_driver_register(tegra_hdmi_driver);
if (err  0)
goto unregister_dc;
+
+   err = platform_driver_register(tegra_gr2d_driver);
+   if (err  0)
+   goto unregister_hdmi;
 #endif
 
return 0;
 
 #ifdef CONFIG_DRM_TEGRA
+unregister_hdmi:
+   platform_driver_unregister(tegra_hdmi_driver);
 unregister_dc:
platform_driver_unregister(tegra_dc_driver);
 unregister_host1x:
@@ -228,6 +234,7 @@ module_init(tegra_host1x_init);
 static void __exit tegra_host1x_exit(void)
 {
 #ifdef CONFIG_DRM_TEGRA
+   platform_driver_unregister(tegra_gr2d_driver);
platform_driver_unregister(tegra_hdmi_driver);
platform_driver_unregister(tegra_dc_driver);
 #endif
diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c
index dbd4808..1f0754a 100644
--- a/drivers/gpu/host1x/drm/drm.c
+++ b/drivers/gpu/host1x/drm/drm.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Avionic Design GmbH
- * Copyright (C) 2012 NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (C) 2012-2013 NVIDIA CORPORATION.  All rights reserved.
  *
  * 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
@@ -8,13 +8,17 @@
  */
 
 #include asm/dma-iommu.h
+#include drm/tegra_drm.h
 #include linux/module.h
 #include linux/of_address.h
 #include linux/of_platform.h
 #include linux/dma-mapping.h
 
+#include cma.h
+#include dev.h
 #include drm.h
 #include host1x_client.h
+#include syncpt.h
 
 #define DRIVER_NAME tegra
 #define DRIVER_DESC NVIDIA Tegra graphics
@@ -77,8 +81,10 @@ static int host1x_parse_dt(struct host1x_drm *host1x)
static const char * const compat[] = {
nvidia,tegra20-dc,
nvidia,tegra20-hdmi,
+   nvidia,tegra20-gr2d,
nvidia,tegra30-dc,
nvidia,tegra30-hdmi,
+   nvidia,tegra30-gr2d,
};
unsigned int i;
int err;
@@ -273,9 +279,24 @@ static int tegra_drm_unload(struct drm_device *drm)
 
 static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp)
 {
+   struct host1x_drm_file *fpriv;
+
+   fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
+   if (!fpriv)
+   return -ENOMEM;
+
+   INIT_LIST_HEAD(fpriv-contexts);
+   filp-driver_priv = fpriv;
+
return 0;
 }
 
+static void host1x_drm_context_free(struct host1x_drm_context *context)
+{
+   context-client-ops-close_channel(context);
+   kfree(context);
+}
+
 static void tegra_drm_lastclose(struct drm_device *drm)
 {
struct host1x_drm *host1x = drm-dev_private;
@@ -283,7 +304,214 @@ static void tegra_drm_lastclose(struct drm_device *drm)
drm_fbdev_cma_restore_mode(host1x-fbdev);
 }
 
+static int tegra_drm_ioctl_syncpt_read(struct drm_device *drm, void *data,
+  struct drm_file *file_priv)
+{
+   struct tegra_drm_syncpt_read_args *args = data;
+   struct host1x *host = host1x_get_host(drm-dev);
+   struct host1x_syncpt *sp = host1x_syncpt_get(host, args-id);
+
+   if (!sp)
+   return -EINVAL;
+
+   args-value = host1x_syncpt_read_min(sp);
+   return 0;
+}
+
+static int tegra_drm_ioctl_syncpt_incr(struct drm_device *drm, void *data,
+  struct drm_file *file_priv)
+{
+   struct tegra_drm_syncpt_incr_args *args = data;
+   struct host1x *host = 

[PATCHv6 7/9] gpu: host1x: Remove second host1x driver

2013-03-08 Thread Terje Bergstrom
Remove second host1x driver, and bind tegra-drm to the new host1x
driver. The logic to parse device tree and track clients is moved
to drm.c.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/host1x/Makefile|2 +-
 drivers/gpu/host1x/dev.c   |   58 ++-
 drivers/gpu/host1x/dev.h   |6 +
 drivers/gpu/host1x/drm/Kconfig |2 +-
 drivers/gpu/host1x/drm/dc.c|5 +-
 drivers/gpu/host1x/drm/drm.c   |  217 +++-
 drivers/gpu/host1x/drm/drm.h   |3 -
 drivers/gpu/host1x/drm/hdmi.c  |5 +-
 drivers/gpu/host1x/drm/host1x.c|  329 
 drivers/gpu/host1x/host1x_client.h |   35 
 10 files changed, 318 insertions(+), 344 deletions(-)
 delete mode 100644 drivers/gpu/host1x/drm/host1x.c
 create mode 100644 drivers/gpu/host1x/host1x_client.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index db4dc25..ad39fef 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -14,6 +14,6 @@ host1x-y = \
 ccflags-y += -Iinclude/drm
 ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
 
-host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o drm/host1x.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index d7c6e3e..6af8081 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -32,6 +32,19 @@
 #include channel.h
 #include debug.h
 #include hw/host1x01.h
+#include host1x_client.h
+
+void host1x_set_drm_data(struct device *dev, void *data)
+{
+   struct host1x *host1x = dev_get_drvdata(dev);
+   host1x-drm_data = data;
+}
+
+void *host1x_get_drm_data(struct device *dev)
+{
+   struct host1x *host1x = dev_get_drvdata(dev);
+   return host1x-drm_data;
+}
 
 void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
 {
@@ -154,6 +167,8 @@ static int host1x_probe(struct platform_device *pdev)
 
host1x_debug_init(host);
 
+   host1x_drm_alloc(pdev);
+
return 0;
 
 fail_deinit_syncpt:
@@ -170,7 +185,7 @@ static int __exit host1x_remove(struct platform_device 
*pdev)
return 0;
 }
 
-static struct platform_driver platform_driver = {
+static struct platform_driver tegra_host1x_driver = {
.probe = host1x_probe,
.remove = __exit_p(host1x_remove),
.driver = {
@@ -180,8 +195,47 @@ static struct platform_driver platform_driver = {
},
 };
 
-module_platform_driver(platform_driver);
+static int __init tegra_host1x_init(void)
+{
+   int err;
+
+   err = platform_driver_register(tegra_host1x_driver);
+   if (err  0)
+   return err;
+
+#ifdef CONFIG_DRM_TEGRA
+   err = platform_driver_register(tegra_dc_driver);
+   if (err  0)
+   goto unregister_host1x;
+
+   err = platform_driver_register(tegra_hdmi_driver);
+   if (err  0)
+   goto unregister_dc;
+#endif
+
+   return 0;
+
+#ifdef CONFIG_DRM_TEGRA
+unregister_dc:
+   platform_driver_unregister(tegra_dc_driver);
+unregister_host1x:
+   platform_driver_unregister(tegra_host1x_driver);
+   return err;
+#endif
+}
+module_init(tegra_host1x_init);
+
+static void __exit tegra_host1x_exit(void)
+{
+#ifdef CONFIG_DRM_TEGRA
+   platform_driver_unregister(tegra_hdmi_driver);
+   platform_driver_unregister(tegra_dc_driver);
+#endif
+   platform_driver_unregister(tegra_host1x_driver);
+}
+module_exit(tegra_host1x_exit);
 
+MODULE_AUTHOR(Thierry Reding thierry.red...@avionic-design.de);
 MODULE_AUTHOR(Terje Bergstrom tbergst...@nvidia.com);
 MODULE_DESCRIPTION(Host1x driver for Tegra products);
 MODULE_LICENSE(GPL);
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 3542c00..e74ed4a 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -125,6 +125,8 @@ struct host1x {
unsigned int num_allocated_channels;
 
struct dentry *debugfs;
+
+   void *drm_data;
 };
 
 static inline struct host1x *host1x_get_host(struct device *dev)
@@ -308,4 +310,8 @@ static inline void host1x_hw_show_mlocks(struct host1x 
*host, struct output *o)
host-debug_op-show_mlocks(host, o);
 }
 
+extern struct platform_driver tegra_hdmi_driver;
+extern struct platform_driver tegra_dc_driver;
+extern struct platform_driver tegra_gr2d_driver;
+
 #endif
diff --git a/drivers/gpu/host1x/drm/Kconfig b/drivers/gpu/host1x/drm/Kconfig
index c92955d..8fb6545 100644
--- a/drivers/gpu/host1x/drm/Kconfig
+++ b/drivers/gpu/host1x/drm/Kconfig
@@ -1,5 +1,5 @@
 config DRM_TEGRA
-   tristate NVIDIA Tegra DRM
+   bool NVIDIA Tegra DRM
depends on DRM  OF  ARCH_TEGRA
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
diff --git a/drivers/gpu/host1x/drm/dc.c 

[PATCHv6 8/9] gpu: host1x: drm: Add CMA ops for host1x driver

2013-03-08 Thread Terje Bergstrom
From: Arto Merilainen amerilai...@nvidia.com

This patch adds CMA memory operations for host1x driver. This allows
usage of CMA buffers inside host1x driver.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/host1x/Makefile  |1 +
 drivers/gpu/host1x/drm/cma.c |   87 ++
 drivers/gpu/host1x/drm/cma.h |   26 +
 3 files changed, 114 insertions(+)
 create mode 100644 drivers/gpu/host1x/drm/cma.c
 create mode 100644 drivers/gpu/host1x/drm/cma.h

diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
index ad39fef..d1d7e35 100644
--- a/drivers/gpu/host1x/Makefile
+++ b/drivers/gpu/host1x/Makefile
@@ -16,4 +16,5 @@ ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
 
 host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o
 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o
+host1x-$(CONFIG_DRM_TEGRA) += drm/cma.o
 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/drm/cma.c b/drivers/gpu/host1x/drm/cma.c
new file mode 100644
index 000..1c5d000
--- /dev/null
+++ b/drivers/gpu/host1x/drm/cma.c
@@ -0,0 +1,87 @@
+/*
+ * Tegra host1x CMA support
+ *
+ * Copyright (c) 2012-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#include drm/drmP.h
+#include drm/drm.h
+#include drm/drm_gem_cma_helper.h
+#include linux/mutex.h
+
+#include memmgr.h
+
+static void cma_put(void *handle_data)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   struct drm_device *drm = obj-base.dev;
+
+   mutex_lock(drm-struct_mutex);
+   drm_gem_object_unreference(obj-base);
+   mutex_unlock(drm-struct_mutex);
+}
+
+static dma_addr_t cma_pin(void *handle_data, struct sg_table **sgt)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   return obj-paddr;
+}
+
+static void cma_unpin(void *handle_data, struct sg_table *sgt)
+{
+}
+
+static void *cma_mmap(void *handle_data)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   return obj-vaddr;
+}
+
+static void cma_munmap(void *handle_data, void *addr)
+{
+}
+
+static void *cma_kmap(void *handle_data, unsigned int pagenum)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   return obj-vaddr + pagenum * PAGE_SIZE;
+}
+
+static void cma_kunmap(void *handle_data, unsigned int pagenum, void *addr)
+{
+}
+
+static struct host1x_mem_handle *cma_get(void *handle_data)
+{
+   struct drm_gem_cma_object *obj = handle_data;
+   struct drm_device *drm = obj-base.dev;
+
+   mutex_lock(drm-struct_mutex);
+   drm_gem_object_reference(obj-base);
+   mutex_unlock(drm-struct_mutex);
+
+   return obj-base.driver_private;
+}
+
+const struct host1x_mem_op host1x_cma_ops = {
+   .get = cma_get,
+   .put = cma_put,
+   .pin = cma_pin,
+   .unpin = cma_unpin,
+   .mmap = cma_mmap,
+   .munmap = cma_munmap,
+   .kmap = cma_kmap,
+   .kunmap = cma_kunmap,
+};
diff --git a/drivers/gpu/host1x/drm/cma.h b/drivers/gpu/host1x/drm/cma.h
new file mode 100644
index 000..06aa0ba
--- /dev/null
+++ b/drivers/gpu/host1x/drm/cma.h
@@ -0,0 +1,26 @@
+/*
+ * Tegra host1x cma memory manager
+ *
+ * Copyright (c) 2012-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#ifndef __HOST1X_CMA_H
+#define __HOST1X_CMA_H
+
+#include memmgr.h
+
+extern const struct host1x_mem_op host1x_cma_ops;
+
+#endif
-- 
1.7.9.5

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


[PATCHv6 1/9] gpu: host1x: Add host1x driver

2013-03-08 Thread Terje Bergstrom
Add host1x, the driver for host1x and its client unit 2D. The Tegra
host1x module is the DMA engine for register access to Tegra's
graphics- and multimedia-related modules. The modules served by
host1x are referred to as clients. host1x includes some other
functionality, such as synchronization.

Signed-off-by: Arto Merilainen amerilai...@nvidia.com
Signed-off-by: Terje Bergstrom tbergst...@nvidia.com
---
 drivers/gpu/Makefile  |1 +
 drivers/gpu/host1x/Kconfig|9 ++
 drivers/gpu/host1x/Makefile   |8 ++
 drivers/gpu/host1x/dev.c  |  155 +
 drivers/gpu/host1x/dev.h  |  104 ++
 drivers/gpu/host1x/hw/Makefile|6 +
 drivers/gpu/host1x/hw/host1x01.c  |   33 +
 drivers/gpu/host1x/hw/host1x01.h  |   25 
 drivers/gpu/host1x/hw/host1x01_hardware.h |   27 
 drivers/gpu/host1x/hw/hw_host1x01_sync.h  |   74 ++
 drivers/gpu/host1x/hw/syncpt_hw.c |  102 ++
 drivers/gpu/host1x/syncpt.c   |  212 +
 drivers/gpu/host1x/syncpt.h   |  147 
 drivers/video/Kconfig |2 +
 include/trace/events/host1x.h |   61 +
 15 files changed, 966 insertions(+)
 create mode 100644 drivers/gpu/host1x/Kconfig
 create mode 100644 drivers/gpu/host1x/Makefile
 create mode 100644 drivers/gpu/host1x/dev.c
 create mode 100644 drivers/gpu/host1x/dev.h
 create mode 100644 drivers/gpu/host1x/hw/Makefile
 create mode 100644 drivers/gpu/host1x/hw/host1x01.c
 create mode 100644 drivers/gpu/host1x/hw/host1x01.h
 create mode 100644 drivers/gpu/host1x/hw/host1x01_hardware.h
 create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_sync.h
 create mode 100644 drivers/gpu/host1x/hw/syncpt_hw.c
 create mode 100644 drivers/gpu/host1x/syncpt.c
 create mode 100644 drivers/gpu/host1x/syncpt.h
 create mode 100644 include/trace/events/host1x.h

diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
index 30879df..d8a22c2 100644
--- a/drivers/gpu/Makefile
+++ b/drivers/gpu/Makefile
@@ -1 +1,2 @@
 obj-y  += drm/ vga/
+obj-$(CONFIG_TEGRA_HOST1X) += host1x/
diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
new file mode 100644
index 000..c01c450
--- /dev/null
+++ b/drivers/gpu/host1x/Kconfig
@@ -0,0 +1,9 @@
+config TEGRA_HOST1X
+   tristate NVIDIA Tegra host1x driver
+   help
+ Driver for the NVIDIA Tegra host1x hardware.
+
+ The Tegra host1x module is the DMA engine for register access to
+ Tegra's graphics- and multimedia-related modules. The modules served
+ by host1x are referred to as clients. host1x includes some other
+ functionality, such as synchronization.
diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
new file mode 100644
index 000..363e6ab
--- /dev/null
+++ b/drivers/gpu/host1x/Makefile
@@ -0,0 +1,8 @@
+ccflags-y = -Idrivers/gpu/host1x
+
+host1x-y = \
+   syncpt.o \
+   dev.o \
+   hw/host1x01.o
+
+obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
new file mode 100644
index 000..d95a9b2
--- /dev/null
+++ b/drivers/gpu/host1x/dev.c
@@ -0,0 +1,155 @@
+/*
+ * Tegra host1x driver
+ *
+ * Copyright (c) 2010-2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/module.h
+#include linux/list.h
+#include linux/slab.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/clk.h
+#include linux/io.h
+
+#define CREATE_TRACE_POINTS
+#include trace/events/host1x.h
+
+#include dev.h
+#include hw/host1x01.h
+
+void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r)
+{
+   void __iomem *sync_regs = host1x-regs + host1x-info-sync_offset;
+
+   writel(v, sync_regs + r);
+}
+
+u32 host1x_sync_readl(struct host1x *host1x, u32 r)
+{
+   void __iomem *sync_regs = host1x-regs + host1x-info-sync_offset;
+
+   return readl(sync_regs + r);
+}
+
+static const struct host1x_info host1x01_info = {
+   .nb_channels= 8,
+   .nb_pts = 32,
+   .nb_mlocks  = 16,
+   .nb_bases   = 8,
+   .init   = host1x01_init,
+   .sync_offset= 0x3000,
+};
+
+static struct of_device_id host1x_match[] = {
+   { .compatible = nvidia,tegra30-host1x, 

Re: Black screen with nouveau in 3.8.x (regression)

2013-03-08 Thread Nick Bowler
On 2013-03-07 10:06 -0500, Nick Bowler wrote:
 I started a bisection... here's the first steps so far.  I will try to
 finish the procedure over the next couple days but I'm reporting this
 now in case someone needs me to get some other info.

I carried this on a bit further, but it seems that most of the remaining
commits bisect wants to test do not compile, so there is a huge number
of skipped commits.  Not exactly a lot of fun...

git bisect start 'drivers/gpu/drm'
# good: [3820288942d1c1524c3ee85cbf503fee1533cfc3] Linux 3.6.6
git bisect good 3820288942d1c1524c3ee85cbf503fee1533cfc3
# bad: [19b00d2dc9bedf0856e366cb7b9c7733ded659e4] Linux 3.8.2
git bisect bad 19b00d2dc9bedf0856e366cb7b9c7733ded659e4
# good: [a0d271cbfed1dd50278c6b06bead3d00ba0a88f9] Linux 3.6
git bisect good a0d271cbfed1dd50278c6b06bead3d00ba0a88f9
# bad: [daed2dbb7ea4d179e472396ce46377fe758d5faf] drm/i915: use the CPU and PCH 
transcoders on lpt_pch_enable
git bisect bad daed2dbb7ea4d179e472396ce46377fe758d5faf
# good: [df86b5765a48d5f557489577652bd6df145b0e1b] drm/savage: re-add busmaster 
enable, regression fix
git bisect good df86b5765a48d5f557489577652bd6df145b0e1b
# bad: [39df01cd6ce9f6dd755ace0030e2bebe75da7727] Merge branch 'drm-fixes-3.7' 
of git://people.freedesktop.org/~agd5f/linux into drm-fixes
git bisect bad 39df01cd6ce9f6dd755ace0030e2bebe75da7727
# bad: [b9f10852fcb1f09369d931dcbfbaad89ad1da4ad] drm/nv98/crypt: fix fuc build 
with latest envyas
git bisect bad b9f10852fcb1f09369d931dcbfbaad89ad1da4ad
# bad: [b10f20d590aa040e4028c04a70a27b9ad6650ba8] drm/nvc0-/gr: remove 
reset-after-grctx-construction hack
git bisect bad b10f20d590aa040e4028c04a70a27b9ad6650ba8
# skip: [18c9b959fd8ea6f3602efbedad788f53e305e6f1] drm/nouveau/gpuobj: create 
wrapper functions for mapping gpuobj into vm/bar
git bisect skip 18c9b959fd8ea6f3602efbedad788f53e305e6f1
# skip: [092599da308bf56b96c849ecdd315b8a1a13ca52] drm/nv50/instmem: remove use 
of nouveau_gpuobj_new_fake()
git bisect skip 092599da308bf56b96c849ecdd315b8a1a13ca52
# skip: [4196faa8623264b79279a06fd186654c959f2767] drm/nouveau/i2c: port to 
subdev interfaces
git bisect skip 4196faa8623264b79279a06fd186654c959f2767
# skip: [9da226f698c01b268b9172050df4150f269a7613] drm/nvc0/fifo: handle bar1 
control regs much like fifo/nve0
git bisect skip 9da226f698c01b268b9172050df4150f269a7613
# skip: [8aceb7de47ea2491abc1a577dc875b19e9947a54] drm/nouveau/clk: implement 
stub clock subdev
git bisect skip 8aceb7de47ea2491abc1a577dc875b19e9947a54
# skip: [70ee6f1cd6911098ddd4c11ee21b69dbe51fb3f9] drm/nv04-nv40/fifo: remove 
use of nouveau_gpuobj_new_fake()
git bisect skip 70ee6f1cd6911098ddd4c11ee21b69dbe51fb3f9
# skip: [f589be88caf32501a734e531180d5df5d6089ef3] drm/nouveau/pageflip: kick 
flip handling out of engsw and into fence
git bisect skip f589be88caf32501a734e531180d5df5d6089ef3
# skip: [73a60c0d218a292f8ef29d3467726ff26ed366fc] drm/nouveau/gpuobj: remove 
flags for vm-mappings
git bisect skip 73a60c0d218a292f8ef29d3467726ff26ed366fc
# skip: [70790f4f819875e8f390871fd15bbbf823f28e1b] drm/nouveau/clock: pull in 
the implementation from all over the place
git bisect skip 70790f4f819875e8f390871fd15bbbf823f28e1b
# skip: [5787640db6ae722aeadb394d480c7ca21b603e34] drm/nv04-nv40/instmem: 
remove use of nouveau_gpuobj_new_fake()
git bisect skip 5787640db6ae722aeadb394d480c7ca21b603e34
# skip: [cb75d97e9c77743ecfcc43375be135a55a4d9b25] drm/nouveau: implement 
devinit subdev, and new init table parser
git bisect skip cb75d97e9c77743ecfcc43375be135a55a4d9b25
# skip: [8a9b889e668a5bc2f4031015fe4893005c43403d] drm/nouveau: remove last use 
of nouveau_gpuobj_new_fake()
git bisect skip 8a9b889e668a5bc2f4031015fe4893005c43403d
# skip: [a73c5c526a8a39b2e61709c753d44be597c9a4c0] drm/nvc0-nve0/graph: rename 
dev to priv, no code changes
git bisect skip a73c5c526a8a39b2e61709c753d44be597c9a4c0
# good: [d6ba6d215a538a58f0f0026f0961b0b9125e8042] drm/nvc0/fence: restore 
pre-suspend fence buffer context on resume
git bisect good d6ba6d215a538a58f0f0026f0961b0b9125e8042
# skip: [7d9115dee978e8540734c456c925d71a37752b8d] drm/nouveau/mc: port to 
subdev interfaces
git bisect skip 7d9115dee978e8540734c456c925d71a37752b8d
# good: [3a92d37e4099054fe187b485a9d27c439c10eca7] drm/nouveau/gem: use 
bo.offset rather than mm_node.start
git bisect good 3a92d37e4099054fe187b485a9d27c439c10eca7
# skip: [5a5c7432bbbd2e318dff107b4ff960ab543a7cef] drm/nouveau/timer: port to 
subdev interfaces
git bisect skip 5a5c7432bbbd2e318dff107b4ff960ab543a7cef
# bad: [77145f1cbdf8d28b46ff8070ca749bad821e0774] drm/nouveau: port remainder 
of drm code, and rip out compat layer
git bisect bad 77145f1cbdf8d28b46ff8070ca749bad821e0774
# skip: [51a3d3425663698a79e8a9d01998a8a32ddee13b] drm/nouveau/backlight: 
remove dependence on nouveau_drv.h
git bisect skip 51a3d3425663698a79e8a9d01998a8a32ddee13b

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
___
dri-devel mailing 

Re: [PATCH] drm/i915: Fix missing variable initilization

2013-03-08 Thread Damien Lespiau
On Sun, Mar 03, 2013 at 06:20:26PM +0100, Daniel Vetter wrote:
 On Mon, Feb 25, 2013 at 04:05:38AM +0530, Syam Sidhardhan wrote:
  Need to initialize the variable wait to false.
  
  Signed-off-by: Syam Sidhardhan s.s...@samsung.com
 
 Looks sane, thanks for the patch. Cc'ing Paulo in case I've missed
 something.

FWIW, I posted a similar patch (without moving the variable around) on
intel-gfx yesterday, so:

Reviewed-by: Damien Lespiau damien.lesp...@intel.com

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


Re: [PATCHv5,RESEND 3/8] gpu: host1x: Add channel support

2013-03-08 Thread Terje Bergström
On 26.02.2013 11:48, Terje Bergström wrote:
 On 25.02.2013 17:24, Thierry Reding wrote:
 You use two different styles to indent the function parameters. You
 might want to stick to one, preferably aligning them with the first
 parameter on the first line.
 
 I've generally favored two tabs indenting, but we'll anyway
 standardize on one.

We standardized on the convention used in tegradrm, i.e. aligning with
first parameter.

 There's nothing in this function that requires a platform_device, so
 passing struct device should be enough. Or maybe host1x_cdma should get
 a struct device * field?
 
 I think we'll just start using struct device * in general in code.
 Arto's been already fixing a lot of these, so he might've already fixed
 this.

We did a sweep in the code and now I hope everything that can, uses
struct device *. The side effect was getting rid of a lot of casting,
which is good.

 Why don't you use any of the kernel's reference counting mechanisms?

 +void host1x_channel_put(struct host1x_channel *ch)
 +{
 + mutex_lock(ch-reflock);
 + if (ch-refcount == 1) {
 + host1x_get_host(ch-dev)-cdma_op.stop(ch-cdma);
 + host1x_cdma_deinit(ch-cdma);
 + }
 + ch-refcount--;
 + mutex_unlock(ch-reflock);
 +}

 I think you can do all of this using a kref.
 
 I think the original reason was that there's no reason to use atomic
 kref, as we anyway have to do mutual exclusion via mutex. But, using
 kref won't be any problem, so we could use that.

Actually, we ended up with a problem with this. kref assumes that once
refcount goes to zero, it gets destroyed. In ch-refcount, going to zero
is just fine and just indicates that we need to initialize. And, we
anyway need to do locking, so we didn't do the conversion to kref.

 +struct host1x_channel *host1x_channel_alloc(struct platform_device *pdev)
 +{
(...)
 +}

 I think the critical section could be shorter here. It's probably not
 worth the extra trouble, though, given that channels are not often
 allocated.
 
 Yeah, boot time isn't measured in microseconds. :-) But, if we just make
 allocated_channels an atomic, we should be able to drop chlist_mutex
 altogether and it could simplify the code.

There wasn't much we could have moved outside the critical section, so
we didn't touch this area.

 Also, is it really necessary to abstract these into an ops structure? I
 get that newer hardware revisions might require different ops for sync-
 point handling because the register layout or number of syncpoints may
 be different, but the CDMA and push buffer (below) concepts are pretty
 much a software abstraction, and as such its implementation is unlikely
 to change with some future hardware revision.
 
 Pushbuffer ops can become generic. There's only one catch - init uses
 the restart opcode. But the opcode is not going to change, so we can
 generalize that.

We ended up keeping the init as an operation, but rest of push buffer
ops became generic.


 +/*
 + * Push two words to the push buffer
 + * Caller must ensure push buffer is not full
 + */
 +static void push_buffer_push_to(struct push_buffer *pb,
 + struct mem_handle *handle,
 + u32 op1, u32 op2)
 +{
 + u32 cur = pb-cur;
 + u32 *p = (u32 *)((u32)pb-mapped + cur);

 You do all this extra casting to make sure to increment by bytes and not
 32-bit words. How about you change pb-cur to contain the word index, so
 that you don't have to go through hoops each time around.

When we changed DMASTART and DMAEND to actually denote the push buffer
area, we noticed that DMAGET and DMAPUT are actually relative to
DMASTART and DMAEND. This and the need to access both CPU and device
virtual addresses coupled with changing to word indexes didn't actually
simplify the code, so we kept still using byte indexes.


 +/*
 + * Return the number of two word slots free in the push buffer
 + */
 +static u32 push_buffer_space(struct push_buffer *pb)
 +{
 + return ((pb-fence - pb-cur)  (PUSH_BUFFER_SIZE - 1)) / 8;
 +}

 Why  (PUSH_BUFFER_SIZE - 1) here? fence - cur can never be larger than
 PUSH_BUFFER_SIZE, can it?
 
 You're right, this function doesn't need to worry about wrapping.

Arto noticed this, but actually I was wrong - the wrapping is very
possible. We just have to remember that if we're processing something at
the end of push buffer, cur might be in the end, and fence in the beginning.

 diff --git a/drivers/gpu/host1x/memmgr.h b/drivers/gpu/host1x/memmgr.h
 [...]
 +struct mem_handle;
 +struct platform_device;
 +
 +struct host1x_job_unpin_data {
 + struct mem_handle *h;
 + struct sg_table *mem;
 +};
 +
 +enum mem_mgr_flag {
 + mem_mgr_flag_uncacheable = 0,
 + mem_mgr_flag_write_combine = 1,
 +};

 I'd like to see this use a more object-oriented approach and more common
 terminology. All of these handles are essentially buffer objects, so
 maybe something like host1x_bo would be a nice and short name.

We did this a bit differently, 

[Bug 60879] X11 can't start with acceleration enabled

2013-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=60879

--- Comment #11 from Hristo Venev mustrum...@gmail.com ---
It's the same as starting weston. egltri_screen doesn't hang the GPU. Only Xorg
does. egltri_screen and weston fail to clear the buffer or render anything.
With current llvm svn, mesa git, libdrm git and linux 3.8.2 the problem is
still there.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 60879] X11 can't start with acceleration enabled

2013-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=60879

--- Comment #12 from Michel Dänzer mic...@daenzer.net ---
(In reply to comment #11)
 egltri_screen doesn't hang the GPU. Only Xorg does. egltri_screen and weston
 fail to clear the buffer or render anything.

Because the GPU hangs trying to render anything. :) The kernel output is from
resetting the hung GPU.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 61979] backlight adjustment doesn't work on HP Pavilion m6-1035dx

2013-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=61979

S. Christian Collins s_chriscoll...@hotmail.com changed:

   What|Removed |Added

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

--- Comment #2 from S. Christian Collins s_chriscoll...@hotmail.com ---
I tested the newer kernel by using a Kubuntu Raring CD, and the backlight
adjustments work fine with the Radeon driver. So, I am marking this bug as
fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 36934] screen corruption after running a game

2013-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36934

--- Comment #18 from aux...@gmail.com ---
This hasn't occurred since I upgraded to openSUSE 12.2.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv5,RESEND 3/8] gpu: host1x: Add channel support

2013-03-08 Thread Thierry Reding
On Fri, Mar 08, 2013 at 06:16:16PM +0200, Terje Bergström wrote:
 On 26.02.2013 11:48, Terje Bergström wrote:
  On 25.02.2013 17:24, Thierry Reding wrote:
[...]
  +struct mem_handle;
  +struct platform_device;
  +
  +struct host1x_job_unpin_data {
  + struct mem_handle *h;
  + struct sg_table *mem;
  +};
  +
  +enum mem_mgr_flag {
  + mem_mgr_flag_uncacheable = 0,
  + mem_mgr_flag_write_combine = 1,
  +};
 
  I'd like to see this use a more object-oriented approach and more common
  terminology. All of these handles are essentially buffer objects, so
  maybe something like host1x_bo would be a nice and short name.
 
 We did this a bit differently, but following pretty much the same
 principles. We have host1x_mem_handle, which contains an ops pointer.
 The handle gets encapsulated inside drm_gem_cma_object.
 
 _bo structs seem to usually contains a drm_gem_object, so we thought
 it's better not to reuse that term.
 
 Please check the code and let us know what you think. This pretty much
 follows what Lucas proposed a while ago, and keeps neatly the DRM
 specific parts inside the drm directory.

A bo is just a buffer object, so I don't see why the name shouldn't be
used. The name is in no way specific to DRM or GEM. But the point that I
was trying to make was that there is nothing to suggest that we couldn't
use drm_gem_object as the underlying scaffold to base all host1x buffer
objects on.

Furthermore I don't understand why you've chosen this approach. It is
completely different from what other drivers do and therefore makes it
more difficult to comprehend. That alone I could live with if there were
any advantages to that approach, but as far as I can tell there are
none.

Thierry


pgpwKhzUdPjOx.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 41762] radeon default power_profile default makes laptop overheat (Mobility Radeon HD 3650)

2013-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=41762

aleritty aleri...@gmail.com changed:

   What|Removed |Added

   Hardware|x86-64 (AMD64)  |All

--- Comment #9 from aleritty aleri...@gmail.com ---
I tested this on a lot of kernels and distribution both iX86 or x64

My card is a Mobility Radeon HD 4500, RV710

Actually I think that the profile have to be set on low by default, to prevent
hardware damages.

But this is not enough, because with proprietary drivers the card run around
55°C on my system, but with the radeon and low profile is around 70°C, and with
the default the temperature (idle system) go around 82°C for most of the time.

This can easily harm a system.

Actually this bug assume a big importance because most of the affected chip
aren't supported anymore from proprietary drivers, so a user can unconsciously
run into troubles and hardware damage after a simply upgrade.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v13 0/2] Add display-timing node parsing to exynos drm fimd

2013-03-08 Thread Vikas Sajjan
Add display-timing node parsing to drm fimd and depends on
the display helper patchset at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

changes since v12:
- Added dependency of OF for exynos drm fimd as suggested
by Inki Dae inki@samsung.com

changes since v11:
- Oops, there was a build error, fixed that.

changes since v10:
- abandoned the pinctrl patch, as commented by Linus Walleij
linus.wall...@linaro.org
- added new patch to enable the OF_VIDEOMODE and FB_MODE_HELPERS for
EXYNOS DRM FIMD.

changes since v9:
- replaced IS_ERR_OR_NULL() with IS_ERR(), since IS_ERR_OR_NULL()
will be depreciated, as discussed at

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/140543.html
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg78030.html

changes since v8:
- replaced IS_ERR() with IS_ERR_OR_NULL(),
because devm_pinctrl_get_select_default can return NULL,
If CONFIG_PINCTRL is disabled.
- modified the error log, such that it shall NOT cross 80 column.
- added Acked-by.

changes since v7:
- addressed comments from Joonyoung Shim jy0922.s...@samsung.com
to remove a unnecessary variable.

changes since v6:
addressed comments from Inki Dae inki@samsung.com to
separated out the pinctrl functionality and made a separate patch.

changes since v5:
- addressed comments from Inki Dae inki@samsung.com,
to remove the allocation of 'fbmode' and replaced
'-1'in of_get_fb_videomode(dev-of_node, fbmode, -1) with
OF_USE_NATIVE_MODE.

changes since v4:
- addressed comments from Paul Menzel
paulepan...@users.sourceforge.net, to modify the commit message

changes since v3:
- addressed comments from Sean Paul seanp...@chromium.org, to modify
the return values and print messages.

changes since v2:
- moved 'devm_pinctrl_get_select_default' function call under
'if (pdev-dev.of_node)', this makes NON-DT code unchanged.
(reported by: Rahul Sharma r.sh.o...@gmail.com)

changes since v1:
- addressed comments from Sean Paul seanp...@chromium.org


Vikas Sajjan (2):
  video: drm: exynos: Add display-timing node parsing using video
helper function
  drm/exynos: enable OF_VIDEOMODE and FB_MODE_HELPERS for exynos drm
fimd

 drivers/gpu/drm/exynos/Kconfig   |4 +++-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   24 
 2 files changed, 23 insertions(+), 5 deletions(-)

-- 
1.7.9.5

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


[PATCH v13 1/2] video: drm: exynos: Add display-timing node parsing using video helper function

2013-03-08 Thread Vikas Sajjan
Add support for parsing the display-timing node using video helper
function.

The DT node parsing is done only if 'dev.of_node'
exists and the NON-DT logic is still maintained under the 'else' part.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org
Acked-by: Joonyoung Shim jy0922.s...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..e323cf9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -20,6 +20,7 @@
 #include linux/of_device.h
 #include linux/pm_runtime.h
 
+#include video/of_display_timing.h
 #include video/samsung_fimd.h
 #include drm/exynos_drm.h
 
@@ -883,10 +884,25 @@ static int fimd_probe(struct platform_device *pdev)
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(dev, no platform data specified\n);
-   return -EINVAL;
+   if (pdev-dev.of_node) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   DRM_ERROR(memory allocation for pdata failed\n);
+   return -ENOMEM;
+   }
+
+   ret = of_get_fb_videomode(dev-of_node, pdata-panel.timing,
+   OF_USE_NATIVE_MODE);
+   if (ret) {
+   DRM_ERROR(failed: of_get_fb_videomode() : %d\n, ret);
+   return ret;
+   }
+   } else {
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   DRM_ERROR(no platform data specified\n);
+   return -EINVAL;
+   }
}
 
panel = pdata-panel;
-- 
1.7.9.5

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


[PATCH v13 2/2] drm/exynos: enable OF_VIDEOMODE and FB_MODE_HELPERS for exynos drm fimd

2013-03-08 Thread Vikas Sajjan
patch adds select OF_VIDEOMODE and select FB_MODE_HELPERS when
EXYNOS_DRM_FIMD config is selected. Also adds the OF dependency.

Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org
---
 drivers/gpu/drm/exynos/Kconfig |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 046bcda..406f32a 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -24,7 +24,9 @@ config DRM_EXYNOS_DMABUF
 
 config DRM_EXYNOS_FIMD
bool Exynos DRM FIMD
-   depends on DRM_EXYNOS  !FB_S3C  !ARCH_MULTIPLATFORM
+   depends on OF  DRM_EXYNOS  !FB_S3C  !ARCH_MULTIPLATFORM
+   select OF_VIDEOMODE
+   select FB_MODE_HELPERS
help
  Choose this option if you want to use Exynos FIMD for DRM.
 
-- 
1.7.9.5

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