[Intel-gfx] [PATCH 5/5] drm: Use names of ioctls in debug traces

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 05:03:34PM +0100, Damien Lespiau wrote:
> From: Chris Cummins 
> 
> The intention here is to make the output of dmesg with full verbosity a
> bit easier for a human to parse. This commit transforms:
> 
> [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
> [drm:drm_mode_addfb], [FB:32]
> [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
> [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
> [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
> [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
> [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
> 
> into:
> 
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
> [drm:drm_mode_addfb], [FB:32]
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
> [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
> [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
> [drm:intel_crtc_set_config], [CRTC:3] [NOFB]

I like it. But I made drm_ioctls const recently so the patch needs a
small refresh.

BTW am I the only one who hates the DRM_IOCTL_DEF_DRV() macro? Thanks to
the cpp magic it's difficult to look up the ioctls using cscope. OTOH
with this patch looking up the numbers does become less important.

> Signed-off-by: Chris Cummins 
> ---
>  drivers/gpu/drm/drm_drv.c | 20 +---
>  include/drm/drmP.h|  3 ++-
>  2 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 25f91cd..0382f6e 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
>  struct drm_file *file_priv);
>  
>  #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
> - [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
> .cmd_drv = 0}
> + [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
> .cmd_drv = 0, .name = #ioctl}
>  
>  /** Ioctl table */
>  static struct drm_ioctl_desc drm_ioctls[] = {
> @@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
>  {
>   struct drm_file *file_priv = filp->private_data;
>   struct drm_device *dev;
> - struct drm_ioctl_desc *ioctl;
> + struct drm_ioctl_desc *ioctl = NULL;
>   drm_ioctl_t *func;
>   unsigned int nr = DRM_IOCTL_NR(cmd);
>   int retcode = -EINVAL;
> @@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
>   atomic_inc(>counts[_DRM_STAT_IOCTLS]);
>   ++file_priv->ioctl_count;
>  
> - DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
> -   task_pid_nr(current), cmd, nr,
> -   (long)old_encode_dev(file_priv->minor->device),
> -   file_priv->authenticated);
> -
>   if ((nr >= DRM_CORE_IOCTL_COUNT) &&
>   ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
>   goto err_i1;
> @@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
>   } else
>   goto err_i1;
>  
> + DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> +   task_pid_nr(current),
> +   (long)old_encode_dev(file_priv->minor->device),
> +   file_priv->authenticated, ioctl->name);
> +
>   /* Do not trust userspace, use our own definition */
>   func = ioctl->func;
>   /* is there a local override? */
> @@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
>   }
>  
>err_i1:
> + if (!ioctl)
> + DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, 
> cmd=0x%02x, nr=0x%02x\n",
> +   task_pid_nr(current),
> +   (long)old_encode_dev(file_priv->minor->device),
> +   file_priv->authenticated, cmd, nr);
> +
>   if (kdata != stack_kdata)
>   kfree(kdata);
>   atomic_dec(>ioctl_count);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2d94d74..379787c 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -316,6 +316,7 @@ struct drm_ioctl_desc {
>   int flags;
>   drm_ioctl_t *func;
>   unsigned int cmd_drv;
> + const char *name;
>  };
>  
>  /**
> @@ -324,7 +325,7 @@ struct drm_ioctl_desc {
>   */
>  
>  #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)  \
> - [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, 
> .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
> + [DRM_IOCTL_NR(DRM_##ioctl)] = 

[Intel-gfx] [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 05:03:33PM +0100, Damien Lespiau wrote:
> From: "Lespiau, Damien" 
> 
> Signed-off-by: Damien Lespiau 
> ---
>  include/drm/drm_crtc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index e3e0d65..23fb185 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -660,7 +660,7 @@ struct drm_plane_funcs {
>   * @gamma_store: gamma correction table
>   * @enabled: enabled flag
>   * @funcs: helper functions
> - * @helper_private: storage for drver layer
> + * @helper_private: storage for driver layer

I just killed this guy. Well, assuming my patch gets accepted.

>   * @properties: property tracking for this plane
>   */
>  struct drm_plane {
> -- 
> 1.8.1.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrj?l?
Intel OTC


[PATCH 2/5] drm: Make the HPD status updates debug logs more readable

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)
> 
> Signed-off-by: Damien Lespiau 
> Reviewed-by: Jesse Barnes 
> ---
>  drivers/gpu/drm/drm_crtc_helper.c | 22 ++
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 7b2d378..8976eb6 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
>  
> +static const char *connector_status_str(enum drm_connector_status status)
> +{
> + switch (status) {
> + case connector_status_connected:
> + return "connected";
> + case connector_status_disconnected:
> + return "disconnected";
> + default:
> + return "unknown";
> + }
> +}

drm_get_connector_status_name()

> +
>  #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
>  static void output_poll_execute(struct work_struct *work)
>  {
> @@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct 
> *work)
>   continue;
>  
>   connector->status = connector->funcs->detect(connector, false);
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to 
> %d\n",
> + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
> %s\n",
> connector->base.id,
> drm_get_connector_name(connector),
> -   old_status, connector->status);
> +   connector_status_str(old_status),
> +   connector_status_str(connector->status));
>   if (old_status != connector->status)
>   changed = true;
>   }
> @@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
>   old_status = connector->status;
>  
>   connector->status = connector->funcs->detect(connector, false);
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to 
> %d\n",
> + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
> %s\n",
> connector->base.id,
> drm_get_connector_name(connector),
> -   old_status, connector->status);
> +   connector_status_str(old_status),
> +   connector_status_str(connector->status));
>   if (old_status != connector->status)
>   changed = true;
>   }
> -- 
> 1.8.1.4
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrj?l?
Intel OTC


[Intel-gfx] [PATCH 5/5] drm: Use names of ioctls in debug traces

2013-05-08 Thread Ben Widawsky
On Wed, May 08, 2013 at 07:55:18PM +0300, Ville Syrj?l? wrote:
> On Wed, May 08, 2013 at 05:03:34PM +0100, Damien Lespiau wrote:
> > From: Chris Cummins 
> > 
> > The intention here is to make the output of dmesg with full verbosity a
> > bit easier for a human to parse. This commit transforms:
> > 
> > [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
> > [drm:drm_mode_addfb], [FB:32]
> > [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
> > [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
> > [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
> > [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
> > [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
> > 
> > into:
> > 
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
> > [drm:drm_mode_addfb], [FB:32]
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
> > [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
> > [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
> > [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
> 
> I like it. But I made drm_ioctls const recently so the patch needs a
> small refresh.
> 
> BTW am I the only one who hates the DRM_IOCTL_DEF_DRV() macro? Thanks to
> the cpp magic it's difficult to look up the ioctls using cscope. OTOH
> with this patch looking up the numbers does become less important.

You are not the only one who hates it.

> 
> > Signed-off-by: Chris Cummins 
> > ---
> >  drivers/gpu/drm/drm_drv.c | 20 +---
> >  include/drm/drmP.h|  3 ++-
> >  2 files changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index 25f91cd..0382f6e 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
> >struct drm_file *file_priv);
> >  
> >  #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
> > -   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
> > .cmd_drv = 0}
> > +   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
> > .cmd_drv = 0, .name = #ioctl}
> >  
> >  /** Ioctl table */
> >  static struct drm_ioctl_desc drm_ioctls[] = {
> > @@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
> >  {
> > struct drm_file *file_priv = filp->private_data;
> > struct drm_device *dev;
> > -   struct drm_ioctl_desc *ioctl;
> > +   struct drm_ioctl_desc *ioctl = NULL;
> > drm_ioctl_t *func;
> > unsigned int nr = DRM_IOCTL_NR(cmd);
> > int retcode = -EINVAL;
> > @@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
> > atomic_inc(>counts[_DRM_STAT_IOCTLS]);
> > ++file_priv->ioctl_count;
> >  
> > -   DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
> > - task_pid_nr(current), cmd, nr,
> > - (long)old_encode_dev(file_priv->minor->device),
> > - file_priv->authenticated);
> > -
> > if ((nr >= DRM_CORE_IOCTL_COUNT) &&
> > ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
> > goto err_i1;
> > @@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
> > } else
> > goto err_i1;
> >  
> > +   DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
> > + task_pid_nr(current),
> > + (long)old_encode_dev(file_priv->minor->device),
> > + file_priv->authenticated, ioctl->name);
> > +
> > /* Do not trust userspace, use our own definition */
> > func = ioctl->func;
> > /* is there a local override? */
> > @@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
> > }
> >  
> >err_i1:
> > +   if (!ioctl)
> > +   DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, 
> > cmd=0x%02x, nr=0x%02x\n",
> > + task_pid_nr(current),
> > + (long)old_encode_dev(file_priv->minor->device),
> > + file_priv->authenticated, cmd, nr);
> > +
> > if (kdata != stack_kdata)
> > kfree(kdata);
> > atomic_dec(>ioctl_count);
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 2d94d74..379787c 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -316,6 +316,7 @@ struct drm_ioctl_desc {
> > int flags;
> > drm_ioctl_t *func;
> > unsigned int cmd_drv;
> > +   const char *name;
> >  };
> >  
> >  /**
> > @@ -324,7 +325,7 @@ struct 

[PATCH 2/5] drm: Make the HPD status updates debug logs more readable

2013-05-08 Thread Chris Wilson
On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
> 
> Instead of just printing "status updated from 1 to 2", make those enum
> numbers immediately readable.
> 
> v2: Also patch output_poll_execute() (Daniel Vetter)

For bonus points, only emit the message when it is updated.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH] radeon: Allow disabling UVD

2013-05-08 Thread Parag Warudkar


On Wed, 8 May 2013, Christian K?nig wrote:

> Am 07.05.2013 23:13, schrieb Parag Warudkar:
> > On Tue, May 7, 2013 at 4:44 AM, Christian K?nig 
> > wrote:
> > Without SUMO_uvd.bin - suspends fine and only wakes up when I want it to.
> 
> Hui? Wait a second, the firmware doesn't work but still causes an instant
> resume on suspend? Very strange.

Yes, I tested this multiple times - if firmware loads and the init bails 
out, machine resume instantly, like this -

[ 3631.441257] PM: Entering mem sleep
[ 3631.441274] Suspending console(s) (use no_console_suspend to debug)
[ 3631.441825] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 3631.442003] sd 0:0:0:0: [sda] Stopping disk
[ 3631.755076] PM: suspend of devices complete after 313.257 msecs
[ 3631.755219] PM: late suspend of devices complete after 0.134 msecs
[ 3631.795185] PM: noirq suspend of devices complete after 39.904 msecs
[ 3631.821922] pcieport :00:1c.1: power state changed by ACPI to D0
[ 3631.915378] PM: noirq resume of devices complete after 119.999 msecs
[ 3631.915459] PM: early resume of devices complete after 0.062 msecs
[ 3631.915525] ahci :00:1f.2: setting latency timer to 64
[ 3631.915609] ehci-pci :00:1a.7: setting latency timer to 64
[ 3631.915654] uhci_hcd :00:1a.0: setting latency timer to 64
[ 3631.915690] usb usb1: root hub lost power or was reset
[ 3631.915709] snd_hda_intel :00:1b.0: irq 46 for MSI/MSI-X
[ 3631.915770] uhci_hcd :00:1d.0: setting latency timer to 64
[ 3631.915792] usb usb2: root hub lost power or was reset
[ 3631.915804] ehci-pci :00:1d.7: setting latency timer to 64
[ 3631.915821] snd_hda_intel :01:00.1: irq 48 for MSI/MSI-X
[ 3631.918662] [drm] probing gen 2 caps for device 8086:101 = 2212d02/0
[ 3631.918665] [drm] PCIE gen 2 link speeds already enabled
[ 3631.921479] [drm] PCIE GART of 512M enabled (table at 
0x0004).
[ 3631.921584] radeon :01:00.0: WB enabled

Right now, I have removed SUMO_uvd.bin and suspend resume is working 
without fail. Strange indeed, and I only noticed it when the machine did 
not instant resume when running with the UVD disable patch and no_uvd=1 
which skips uvd init just like firmware lodaing failure does I suppose.

> 
> My best guess is that it has something todo with a different clock routing on
> Macs, but without access to the hardware (or precise documentation from Apple
> what the heck they did different) I don't really see a chance to solve that
> problem.

Hopefully it is not that hard and we'll find a way! I will experiment the 
clocks and see how that goes.

> If you want to hack a bit on it you could try commenting out the calls to
> "radeon_set_uvd_clocks" in radeon_uvd.c. That should give you the default
> clocks of 100Mhz, not enough for usable decoding, but on SUMO based UVD blocks
> a very failsafe default.
> 
> Whatever it is, please send me an output of lspci, so I can blacklist the
> offending chip.
> 
Here is the lspci -nn output :

01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee 
ATI Whistler [Radeon HD 6600M/6700M/7600M Series] [1002:6741]

Parag


[PATCH v2] drm: Fix drm_rect documentation

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

The 'struct' keyword was missing so struct drm_rect documentation never
ended up in the generated docs.

Also move the drm_rect documentations to a new section alognside the
various helper functions and add a short description about the intended
purpose of drm_rect.

v2: Move to new section and add general description

Signed-off-by: Ville Syrj?l? 
---
 Documentation/DocBook/drm.tmpl | 8 ++--
 include/drm/drm_rect.h | 9 -
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 7c7af25..91ee107 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1653,8 +1653,6 @@ void intel_crt_init(struct drm_device *dev)
 
   KMS API Functions
 !Edrivers/gpu/drm/drm_crtc.c
-!Edrivers/gpu/drm/drm_rect.c
-!Finclude/drm/drm_rect.h
 
   

@@ -2163,6 +2161,12 @@ void intel_crt_init(struct drm_device *dev)
   EDID Helper Functions Reference
 !Edrivers/gpu/drm/drm_edid.c
 
+
+  Rectangle Utilities Reference
+!Pinclude/drm/drm_rect.h rect utils
+!Iinclude/drm/drm_rect.h
+!Edrivers/gpu/drm/drm_rect.c
+
   

   
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 64fa265..d128629 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -25,7 +25,14 @@
 #define DRM_RECT_H

 /**
- * drm_rect - two dimensional rectangle
+ * DOC: rect utils
+ *
+ * Utility functions to help manage rectangular areas for
+ * clipping, scaling, etc. calculations.
+ */
+
+/**
+ * struct drm_rect - two dimensional rectangle
  * @x1: horizontal starting coordinate (inclusive)
  * @x2: horizontal ending coordinate (exclusive)
  * @y1: vertical starting coordinate (inclusive)
-- 
1.8.1.5



[PATCH 5/5] drm: Use names of ioctls in debug traces

2013-05-08 Thread Damien Lespiau
From: Chris Cummins 

The intention here is to make the output of dmesg with full verbosity a
bit easier for a human to parse. This commit transforms:

[drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
[drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

into:

[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

Signed-off-by: Chris Cummins 
---
 drivers/gpu/drm/drm_drv.c | 20 +---
 include/drm/drmP.h|  3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 25f91cd..0382f6e 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
   struct drm_file *file_priv);

 #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
-   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
.cmd_drv = 0}
+   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
.cmd_drv = 0, .name = #ioctl}

 /** Ioctl table */
 static struct drm_ioctl_desc drm_ioctls[] = {
@@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
 {
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev;
-   struct drm_ioctl_desc *ioctl;
+   struct drm_ioctl_desc *ioctl = NULL;
drm_ioctl_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd);
int retcode = -EINVAL;
@@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
atomic_inc(>counts[_DRM_STAT_IOCTLS]);
++file_priv->ioctl_count;

-   DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
- task_pid_nr(current), cmd, nr,
- (long)old_encode_dev(file_priv->minor->device),
- file_priv->authenticated);
-
if ((nr >= DRM_CORE_IOCTL_COUNT) &&
((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
goto err_i1;
@@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
} else
goto err_i1;

+   DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
+ task_pid_nr(current),
+ (long)old_encode_dev(file_priv->minor->device),
+ file_priv->authenticated, ioctl->name);
+
/* Do not trust userspace, use our own definition */
func = ioctl->func;
/* is there a local override? */
@@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
}

   err_i1:
+   if (!ioctl)
+   DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, 
cmd=0x%02x, nr=0x%02x\n",
+ task_pid_nr(current),
+ (long)old_encode_dev(file_priv->minor->device),
+ file_priv->authenticated, cmd, nr);
+
if (kdata != stack_kdata)
kfree(kdata);
atomic_dec(>ioctl_count);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2d94d74..379787c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -316,6 +316,7 @@ struct drm_ioctl_desc {
int flags;
drm_ioctl_t *func;
unsigned int cmd_drv;
+   const char *name;
 };

 /**
@@ -324,7 +325,7 @@ struct drm_ioctl_desc {
  */

 #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)\
-   [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, 
.flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
+   [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, 
.flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}

 struct drm_magic_entry {
struct list_head head;
-- 
1.8.1.4



[PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation

2013-05-08 Thread Damien Lespiau
From: "Lespiau, Damien" 

Signed-off-by: Damien Lespiau 
---
 include/drm/drm_crtc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e3e0d65..23fb185 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -660,7 +660,7 @@ struct drm_plane_funcs {
  * @gamma_store: gamma correction table
  * @enabled: enabled flag
  * @funcs: helper functions
- * @helper_private: storage for drver layer
+ * @helper_private: storage for driver layer
  * @properties: property tracking for this plane
  */
 struct drm_plane {
-- 
1.8.1.4



[PATCH 3/5] drm: Don't prune modes loudly when a connector is disconnected

2013-05-08 Thread Damien Lespiau
drm_helper_probe_single_connector_modes() is responsible for pruning the
previously detected modes on a disconnected connector. We don't really
need to log, again, the full list of modes that used to be valid when
connected.

Signed-off-by: Damien Lespiau 
---
 drivers/gpu/drm/drm_crtc_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 8976eb6..4fea4a3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -121,6 +121,7 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
connector->helper_private;
int count = 0;
int mode_flags = 0;
+   bool verbose_prune = true;

DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
drm_get_connector_name(connector));
@@ -149,6 +150,7 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
connector->base.id, drm_get_connector_name(connector));
drm_mode_connector_update_edid_property(connector, NULL);
+   verbose_prune = false;
goto prune;
}

@@ -182,7 +184,7 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
}

 prune:
-   drm_mode_prune_invalid(dev, >modes, true);
+   drm_mode_prune_invalid(dev, >modes, verbose_prune);

if (list_empty(>modes))
return 0;
-- 
1.8.1.4



[PATCH 2/5] drm: Make the HPD status updates debug logs more readable

2013-05-08 Thread Damien Lespiau
Instead of just printing "status updated from 1 to 2", make those enum
numbers immediately readable.

v2: Also patch output_poll_execute() (Daniel Vetter)

Signed-off-by: Damien Lespiau 
Reviewed-by: Jesse Barnes 
---
 drivers/gpu/drm/drm_crtc_helper.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 7b2d378..8976eb6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_kms_helper_hotplug_event);

+static const char *connector_status_str(enum drm_connector_status status)
+{
+   switch (status) {
+   case connector_status_connected:
+   return "connected";
+   case connector_status_disconnected:
+   return "disconnected";
+   default:
+   return "unknown";
+   }
+}
+
 #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
 static void output_poll_execute(struct work_struct *work)
 {
@@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct 
*work)
continue;

connector->status = connector->funcs->detect(connector, false);
-   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to 
%d\n",
+   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
%s\n",
  connector->base.id,
  drm_get_connector_name(connector),
- old_status, connector->status);
+ connector_status_str(old_status),
+ connector_status_str(connector->status));
if (old_status != connector->status)
changed = true;
}
@@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
old_status = connector->status;

connector->status = connector->funcs->detect(connector, false);
-   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to 
%d\n",
+   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
%s\n",
  connector->base.id,
  drm_get_connector_name(connector),
- old_status, connector->status);
+ connector_status_str(old_status),
+ connector_status_str(connector->status));
if (old_status != connector->status)
changed = true;
}
-- 
1.8.1.4



[PATCH 1/5] drm: Add missing break in the command line mode parsing code

2013-05-08 Thread Damien Lespiau
As we parse the string given on the command line one char at a time, it
seems that we do want a break at every case.

Signed-off-by: Damien Lespiau 
Reviewed-by: Rodrigo Vivi 
---
 drivers/gpu/drm/drm_modes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 04fa6f1..b1d4836 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1123,6 +1123,7 @@ bool drm_mode_parse_command_line_for_connector(const char 
*mode_option,
was_digit = false;
} else
goto done;
+   break;
case '0' ... '9':
was_digit = true;
break;
-- 
1.8.1.4



Some lost drm patches

2013-05-08 Thread Damien Lespiau
I just collected a few sad patches crying in the dark alley of the Internet
that dri-devel can sometimes be. A few of them even have a r-b tag by
benevolent and fatherly figures. All they want is to find a new home!

-- 
Damien



[PATCH v2] drm: Add fb_helper->restore_fbdev_mode hook

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 04:39:58PM +0300, ville.syrjala at linux.intel.com 
wrote:
> From: Ville Syrj?l? 
> 
> Drivers may need to turn off overlay planes, cursors, etc. when
> restoring the fbdev mode. So allow drivers to provide their own
> version of drm_fb_helper_restore_fbdev_mode() that can take care
> of such details.
> 
> Initially just plug in drm_fb_helper_restore_fbdev_mode for all
> drivers.
> 
> v2: Add kernel-doc for the new hook

And naturally I forgot to mention that this now depends on the
"[PATCH 0/3] drm: kernel-doc fixes" set I just posted.


-- 
Ville Syrj?l?
Intel OTC


[PATCH v2] drm: Fix drm_rect documentation

2013-05-08 Thread Daniel Vetter
On Wed, May 08, 2013 at 05:16:45PM +0300, ville.syrjala at linux.intel.com 
wrote:
> From: Ville Syrj?l? 
> 
> The 'struct' keyword was missing so struct drm_rect documentation never
> ended up in the generated docs.
> 
> Also move the drm_rect documentations to a new section alognside the
> various helper functions and add a short description about the intended
> purpose of drm_rect.
> 
> v2: Move to new section and add general description
> 
> Signed-off-by: Ville Syrj?l? 

Looks neat! Reviewed-by: Daniel Vetter 

> ---
>  Documentation/DocBook/drm.tmpl | 8 ++--
>  include/drm/drm_rect.h | 9 -
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
> index 7c7af25..91ee107 100644
> --- a/Documentation/DocBook/drm.tmpl
> +++ b/Documentation/DocBook/drm.tmpl
> @@ -1653,8 +1653,6 @@ void intel_crt_init(struct drm_device *dev)
>  
>KMS API Functions
>  !Edrivers/gpu/drm/drm_crtc.c
> -!Edrivers/gpu/drm/drm_rect.c
> -!Finclude/drm/drm_rect.h
>  
>
>  
> @@ -2163,6 +2161,12 @@ void intel_crt_init(struct drm_device *dev)
>EDID Helper Functions Reference
>  !Edrivers/gpu/drm/drm_edid.c
>  
> +
> +  Rectangle Utilities Reference
> +!Pinclude/drm/drm_rect.h rect utils
> +!Iinclude/drm/drm_rect.h
> +!Edrivers/gpu/drm/drm_rect.c
> +
>
>  
>
> diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> index 64fa265..d128629 100644
> --- a/include/drm/drm_rect.h
> +++ b/include/drm/drm_rect.h
> @@ -25,7 +25,14 @@
>  #define DRM_RECT_H
>  
>  /**
> - * drm_rect - two dimensional rectangle
> + * DOC: rect utils
> + *
> + * Utility functions to help manage rectangular areas for
> + * clipping, scaling, etc. calculations.
> + */
> +
> +/**
> + * struct drm_rect - two dimensional rectangle
>   * @x1: horizontal starting coordinate (inclusive)
>   * @x2: horizontal ending coordinate (exclusive)
>   * @y1: vertical starting coordinate (inclusive)
> -- 
> 1.8.1.5
> 

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


[PATCH v2] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

There's a bunch of unused members inside drm_plane, bloating the size of
the structure needlessly. Eliminate them.

v2: Remove all of it from kernel-doc too

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/drm_crtc.c |  2 +-
 include/drm/drm_crtc.h | 11 ---
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d7c449f..e591914 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,

plane_resp->plane_id = plane->base.id;
plane_resp->possible_crtcs = plane->possible_crtcs;
-   plane_resp->gamma_size = plane->gamma_size;
+   plane_resp->gamma_size = 0;

/*
 * This ioctl is called twice, once to determine how much space is
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index adb3f9b..e11c6bc 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -654,11 +654,7 @@ struct drm_plane_funcs {
  * @format_count: number of formats supported
  * @crtc: currently bound CRTC
  * @fb: currently bound fb
- * @gamma_size: size of gamma table
- * @gamma_store: gamma correction table
- * @enabled: enabled flag
  * @funcs: helper functions
- * @helper_private: storage for drver layer
  * @properties: property tracking for this plane
  */
 struct drm_plane {
@@ -674,14 +670,7 @@ struct drm_plane {
struct drm_crtc *crtc;
struct drm_framebuffer *fb;

-   /* CRTC gamma size for reporting to userspace */
-   uint32_t gamma_size;
-   uint16_t *gamma_store;
-
-   bool enabled;
-
const struct drm_plane_funcs *funcs;
-   void *helper_private;

struct drm_object_properties properties;
 };
-- 
1.8.1.5



[PATCH v2] drm: Add fb_helper->restore_fbdev_mode hook

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Drivers may need to turn off overlay planes, cursors, etc. when
restoring the fbdev mode. So allow drivers to provide their own
version of drm_fb_helper_restore_fbdev_mode() that can take care
of such details.

Initially just plug in drm_fb_helper_restore_fbdev_mode for all
drivers.

v2: Add kernel-doc for the new hook

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/ast/ast_fb.c  | 1 +
 drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
 drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
 drivers/gpu/drm/drm_fb_helper.c   | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
 drivers/gpu/drm/gma500/framebuffer.c  | 1 +
 drivers/gpu/drm/i915/intel_fb.c   | 1 +
 drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
 drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
 drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
 drivers/gpu/drm/radeon/radeon_fb.c| 1 +
 drivers/gpu/drm/udl/udl_fb.c  | 1 +
 include/drm/drm_fb_helper.h   | 2 ++
 14 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 34931fe..2c1f469 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -254,6 +254,7 @@ static struct drm_fb_helper_funcs ast_fb_helper_funcs = {
.gamma_set = ast_fb_gamma_set,
.gamma_get = ast_fb_gamma_get,
.fb_probe = astfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 static void ast_fbdev_destroy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c 
b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index e25afcc..ee48a21 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -253,6 +253,7 @@ static struct drm_fb_helper_funcs cirrus_fb_helper_funcs = {
.gamma_set = cirrus_crtc_fb_gamma_set,
.gamma_get = cirrus_crtc_fb_gamma_get,
.fb_probe = cirrusfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 int cirrus_fbdev_init(struct cirrus_device *cdev)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0b5af7d..f011628 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -330,6 +330,7 @@ err_drm_gem_cma_free_object:

 static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
.fb_probe = drm_fbdev_cma_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 /**
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b78cbe7..02c70b2 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -315,7 +315,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)
continue;

-   ret = drm_fb_helper_restore_fbdev_mode(helper);
+   ret = helper->funcs->restore_fbdev_mode(helper);
if (ret)
error = true;
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index 68f0045..6ed4065 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -228,6 +228,7 @@ out:

 static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
.fb_probe = exynos_drm_fbdev_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 int exynos_drm_fbdev_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 1534e22..8d7f9c0 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -567,6 +567,7 @@ static struct drm_fb_helper_funcs psb_fb_helper_funcs = {
.gamma_set = psbfb_gamma_set,
.gamma_get = psbfb_gamma_get,
.fb_probe = psbfb_probe,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 0e19e57..a04481f 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -187,6 +187,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.gamma_set = intel_crtc_fb_gamma_set,
.gamma_get = intel_crtc_fb_gamma_get,
.fb_probe = intelfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 static void intel_fbdev_destroy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 421beab..23b8de2 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -239,6 +239,7 @@ static struct drm_fb_helper_funcs 

[PATCH 3/3] drm: Fix drm_rect documentation

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

The 'struct' keyword was missing so struct drm_rect documentation never
ended up in the generated docs.

Also reorder drm_rect.h to become before drm_rect.c so that the struct
documentation appears first in the docs. And change it to use the 'I'
directive instead of 'F' while we're at it.

Signed-off-by: Ville Syrj?l? 
---
 Documentation/DocBook/drm.tmpl | 2 +-
 include/drm/drm_rect.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 7c7af25..89b6faa 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1653,8 +1653,8 @@ void intel_crt_init(struct drm_device *dev)
 
   KMS API Functions
 !Edrivers/gpu/drm/drm_crtc.c
+!Iinclude/drm/drm_rect.h
 !Edrivers/gpu/drm/drm_rect.c
-!Finclude/drm/drm_rect.h
 
   

diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 64fa265..9a98321 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -25,7 +25,7 @@
 #define DRM_RECT_H

 /**
- * drm_rect - two dimensional rectangle
+ * struct drm_rect - two dimensional rectangle
  * @x1: horizontal starting coordinate (inclusive)
  * @x2: horizontal ending coordinate (exclusive)
  * @y1: vertical starting coordinate (inclusive)
-- 
1.8.1.5



[PATCH 2/3] drm: Remove pointless '-' characters from drm_fb_helper documentation

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Signed-off-by: Ville Syrj?l? 
---
 include/drm/drm_fb_helper.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 61ebd51..471f276 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -50,14 +50,14 @@ struct drm_fb_helper_surface_size {

 /**
  * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation 
library
- * @gamma_set: - Set the given gamma lut register on the given crtc.
- * @gamma_get: - Read the given gamma lut register on the given crtc, used to
- *  save the current lut when force-restoring the fbdev for e.g.
- *  kdbg.
- * @fb_probe: - Driver callback to allocate and initialize the fbdev info
- * structure. Futhermore it also needs to allocate the drm
- * framebuffer used to back the fbdev.
- * @initial_config: - Setup an initial fbdev display configuration
+ * @gamma_set: Set the given gamma lut register on the given crtc.
+ * @gamma_get: Read the given gamma lut register on the given crtc, used to
+ * save the current lut when force-restoring the fbdev for e.g.
+ * kdbg.
+ * @fb_probe: Driver callback to allocate and initialize the fbdev info
+ *structure. Futhermore it also needs to allocate the drm
+ *framebuffer used to back the fbdev.
+ * @initial_config: Setup an initial fbdev display configuration
  *
  * Driver callbacks used by the fbdev emulation helper library.
  */
-- 
1.8.1.5



[PATCH 1/3] drm: Add kernel-doc for drm_fb_helper_funcs->initial_config

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Signed-off-by: Ville Syrj?l? 
---
 include/drm/drm_fb_helper.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 8230b46..61ebd51 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -57,6 +57,7 @@ struct drm_fb_helper_surface_size {
  * @fb_probe: - Driver callback to allocate and initialize the fbdev info
  * structure. Futhermore it also needs to allocate the drm
  * framebuffer used to back the fbdev.
+ * @initial_config: - Setup an initial fbdev display configuration
  *
  * Driver callbacks used by the fbdev emulation helper library.
  */
-- 
1.8.1.5



[PATCH 0/3] drm: kernel-doc fixes

2013-05-08 Thread ville.syrj...@linux.intel.com
Just a few misc. kernel-doc fixes I spotted while looking into the
subject matter.


[Intel-gfx] [PATCH 3/3] drm: Fix drm_rect documentation

2013-05-08 Thread Daniel Vetter
On Wed, May 08, 2013 at 04:38:35PM +0300, ville.syrjala at linux.intel.com 
wrote:
> From: Ville Syrj?l? 
> 
> The 'struct' keyword was missing so struct drm_rect documentation never
> ended up in the generated docs.
> 
> Also reorder drm_rect.h to become before drm_rect.c so that the struct
> documentation appears first in the docs. And change it to use the 'I'
> directive instead of 'F' while we're at it.
> 
> Signed-off-by: Ville Syrj?l? 
> ---
>  Documentation/DocBook/drm.tmpl | 2 +-
>  include/drm/drm_rect.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
> index 7c7af25..89b6faa 100644
> --- a/Documentation/DocBook/drm.tmpl
> +++ b/Documentation/DocBook/drm.tmpl
> @@ -1653,8 +1653,8 @@ void intel_crt_init(struct drm_device *dev)
>  
>KMS API Functions
>  !Edrivers/gpu/drm/drm_crtc.c
> +!Iinclude/drm/drm_rect.h
>  !Edrivers/gpu/drm/drm_rect.c
> -!Finclude/drm/drm_rect.h

Shameless bikeshed while at it: Can you move the drm_rect stuff to it's
own sections, like all the other kms helper stuff? Only the things in
drm_crtc.c are really core kms apis.
-Daniel

>  
>
>  
> diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> index 64fa265..9a98321 100644
> --- a/include/drm/drm_rect.h
> +++ b/include/drm/drm_rect.h
> @@ -25,7 +25,7 @@
>  #define DRM_RECT_H
>  
>  /**
> - * drm_rect - two dimensional rectangle
> + * struct drm_rect - two dimensional rectangle
>   * @x1: horizontal starting coordinate (inclusive)
>   * @x2: horizontal ending coordinate (exclusive)
>   * @y1: vertical starting coordinate (inclusive)
> -- 
> 1.8.1.5
> 
> ___
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


[PATCH v2] drm: Add fb_helper->restore_fbdev_mode hook

2013-05-08 Thread Laurent Pinchart
On Wednesday 08 May 2013 16:39:58 ville.syrjala at linux.intel.com wrote:
> From: Ville Syrj?l? 
> 
> Drivers may need to turn off overlay planes, cursors, etc. when
> restoring the fbdev mode. So allow drivers to provide their own
> version of drm_fb_helper_restore_fbdev_mode() that can take care
> of such details.
> 
> Initially just plug in drm_fb_helper_restore_fbdev_mode for all
> drivers.
> 
> v2: Add kernel-doc for the new hook
> 
> Signed-off-by: Ville Syrj?l? 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/ast/ast_fb.c  | 1 +
>  drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
>  drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
>  drivers/gpu/drm/drm_fb_helper.c   | 2 +-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
>  drivers/gpu/drm/gma500/framebuffer.c  | 1 +
>  drivers/gpu/drm/i915/intel_fb.c   | 1 +
>  drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
>  drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
>  drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
>  drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
>  drivers/gpu/drm/radeon/radeon_fb.c| 1 +
>  drivers/gpu/drm/udl/udl_fb.c  | 1 +
>  include/drm/drm_fb_helper.h   | 2 ++
>  14 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
> index 34931fe..2c1f469 100644
> --- a/drivers/gpu/drm/ast/ast_fb.c
> +++ b/drivers/gpu/drm/ast/ast_fb.c
> @@ -254,6 +254,7 @@ static struct drm_fb_helper_funcs ast_fb_helper_funcs =
> { .gamma_set = ast_fb_gamma_set,
>   .gamma_get = ast_fb_gamma_get,
>   .fb_probe = astfb_create,
> + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
>  };
> 
>  static void ast_fbdev_destroy(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index e25afcc..ee48a21 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> @@ -253,6 +253,7 @@ static struct drm_fb_helper_funcs cirrus_fb_helper_funcs
> = { .gamma_set = cirrus_crtc_fb_gamma_set,
>   .gamma_get = cirrus_crtc_fb_gamma_get,
>   .fb_probe = cirrusfb_create,
> + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
>  };
> 
>  int cirrus_fbdev_init(struct cirrus_device *cdev)
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
> b/drivers/gpu/drm/drm_fb_cma_helper.c index 0b5af7d..f011628 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -330,6 +330,7 @@ err_drm_gem_cma_free_object:
> 
>  static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
>   .fb_probe = drm_fbdev_cma_create,
> + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
>  };
> 
>  /**
> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> b/drivers/gpu/drm/drm_fb_helper.c index b78cbe7..02c70b2 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -315,7 +315,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
>   if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)
>   continue;
> 
> - ret = drm_fb_helper_restore_fbdev_mode(helper);
> + ret = helper->funcs->restore_fbdev_mode(helper);
>   if (ret)
>   error = true;
>   }
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 68f0045..6ed4065 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -228,6 +228,7 @@ out:
> 
>  static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
>   .fb_probe = exynos_drm_fbdev_create,
> + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
>  };
> 
>  int exynos_drm_fbdev_init(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/gma500/framebuffer.c
> b/drivers/gpu/drm/gma500/framebuffer.c index 1534e22..8d7f9c0 100644
> --- a/drivers/gpu/drm/gma500/framebuffer.c
> +++ b/drivers/gpu/drm/gma500/framebuffer.c
> @@ -567,6 +567,7 @@ static struct drm_fb_helper_funcs psb_fb_helper_funcs =
> { .gamma_set = psbfb_gamma_set,
>   .gamma_get = psbfb_gamma_get,
>   .fb_probe = psbfb_probe,
> + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
>  };
> 
>  static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev
> *fbdev) diff --git a/drivers/gpu/drm/i915/intel_fb.c
> b/drivers/gpu/drm/i915/intel_fb.c index 0e19e57..a04481f 100644
> --- a/drivers/gpu/drm/i915/intel_fb.c
> +++ b/drivers/gpu/drm/i915/intel_fb.c
> @@ -187,6 +187,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs
> = { .gamma_set = intel_crtc_fb_gamma_set,
>   .gamma_get = intel_crtc_fb_gamma_get,
>   .fb_probe = intelfb_create,
> + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
>  };
> 
>  static void intel_fbdev_destroy(struct drm_device *dev,
> diff --git 

[PATCH v2] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread Laurent Pinchart
On Wednesday 08 May 2013 16:40:54 ville.syrjala at linux.intel.com wrote:
> From: Ville Syrj?l? 
> 
> There's a bunch of unused members inside drm_plane, bloating the size of
> the structure needlessly. Eliminate them.
> 
> v2: Remove all of it from kernel-doc too
> 
> Signed-off-by: Ville Syrj?l? 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/drm_crtc.c |  2 +-
>  include/drm/drm_crtc.h | 11 ---
>  2 files changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index d7c449f..e591914 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void
> *data,
> 
>   plane_resp->plane_id = plane->base.id;
>   plane_resp->possible_crtcs = plane->possible_crtcs;
> - plane_resp->gamma_size = plane->gamma_size;
> + plane_resp->gamma_size = 0;
> 
>   /*
>* This ioctl is called twice, once to determine how much space is
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index adb3f9b..e11c6bc 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -654,11 +654,7 @@ struct drm_plane_funcs {
>   * @format_count: number of formats supported
>   * @crtc: currently bound CRTC
>   * @fb: currently bound fb
> - * @gamma_size: size of gamma table
> - * @gamma_store: gamma correction table
> - * @enabled: enabled flag
>   * @funcs: helper functions
> - * @helper_private: storage for drver layer
>   * @properties: property tracking for this plane
>   */
>  struct drm_plane {
> @@ -674,14 +670,7 @@ struct drm_plane {
>   struct drm_crtc *crtc;
>   struct drm_framebuffer *fb;
> 
> - /* CRTC gamma size for reporting to userspace */
> - uint32_t gamma_size;
> - uint16_t *gamma_store;
> -
> - bool enabled;
> -
>   const struct drm_plane_funcs *funcs;
> - void *helper_private;
> 
>   struct drm_object_properties properties;
>  };
-- 
Regards,

Laurent Pinchart



[PATCH 4/4] drm/mgag200: Fix framebuffer base address programming

2013-05-08 Thread Christopher Harvey
Higher bits of the base address of framebuffers weren't being
programmed properly. This caused framebuffers that didn't happen to be
allocated at a low enough address to not be displayed properly.

Signed-off-by: Christopher Harvey 
Signed-off-by: Mathieu Larouche 
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 27 ---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 6dbf6de..77b8a45 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -654,12 +654,26 @@ static void mga_g200wb_commit(struct drm_crtc *crtc)
WREG_DAC(MGA1064_GEN_IO_DATA, tmp);
 }

-
+/*
+   This is how the framebuffer base address is stored in g200 cards:
+   * Assume @offset is the gpu_addr variable of the framebuffer object
+   * Then addr is the number of _pixels_ (not bytes) from the start of
+ VRAM to the first pixel we want to display. (divided by 2 for 32bit
+ framebuffers)
+   * addr is stored in the CRTCEXT0, CRTCC and CRTCD registers
+   addr<20> -> CRTCEXT0<6>
+   addr<19-16> -> CRTCEXT0<3-0>
+   addr<15-8> -> CRTCC<7-0>
+   addr<7-0> -> CRTCD<7-0>
+   CRTCEXT0 has to be programmed last to trigger an update and make the
+   new addr variable take effect.
+ */
 void mga_set_start_address(struct drm_crtc *crtc, unsigned offset)
 {
struct mga_device *mdev = crtc->dev->dev_private;
u32 addr;
int count;
+   u8 crtcext0;

while (RREG8(0x1fda) & 0x08);
while (!(RREG8(0x1fda) & 0x08));
@@ -667,10 +681,17 @@ void mga_set_start_address(struct drm_crtc *crtc, 
unsigned offset)
count = RREG8(MGAREG_VCOUNT) + 2;
while (RREG8(MGAREG_VCOUNT) < count);

-   addr = offset >> 2;
+   WREG8(MGAREG_CRTCEXT_INDEX, 0);
+   crtcext0 = RREG8(MGAREG_CRTCEXT_DATA);
+   crtcext0 &= 0xB0;
+   addr = offset / 8;
+   /* Can't store addresses any higher than that...
+  but we also don't have more than 16MB of memory, so it should be 
fine. */
+   WARN_ON(addr > 0x1f);
+   crtcext0 |= (!!(addr & (1<<20)))<<6;
WREG_CRT(0x0d, (u8)(addr & 0xff));
WREG_CRT(0x0c, (u8)(addr >> 8) & 0xff);
-   WREG_CRT(0xaf, (u8)(addr >> 16) & 0xf);
+   WREG_ECRT(0x0, ((u8)(addr >> 16) & 0xf) | crtcext0);
 }


-- 
1.8.1.5



[PATCH v2 4/4] drm/mgag200: Fix framebuffer base address programming

2013-05-08 Thread Christopher Harvey
Higher bits of the base address of framebuffers weren't being
programmed properly. This caused framebuffers that didn't happen to be
allocated at a low enough address to not be displayed properly.

Signed-off-by: Christopher Harvey 
Signed-off-by: Mathieu Larouche 
Acked-by: Julia Lemire 
Tested-by: Julia Lemire 
---
 drivers/gpu/drm/mgag200/mgag200_mode.c | 27 ---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c 
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 6dbf6de..77b8a45 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -654,12 +654,26 @@ static void mga_g200wb_commit(struct drm_crtc *crtc)
WREG_DAC(MGA1064_GEN_IO_DATA, tmp);
 }

-
+/*
+   This is how the framebuffer base address is stored in g200 cards:
+   * Assume @offset is the gpu_addr variable of the framebuffer object
+   * Then addr is the number of _pixels_ (not bytes) from the start of
+ VRAM to the first pixel we want to display. (divided by 2 for 32bit
+ framebuffers)
+   * addr is stored in the CRTCEXT0, CRTCC and CRTCD registers
+   addr<20> -> CRTCEXT0<6>
+   addr<19-16> -> CRTCEXT0<3-0>
+   addr<15-8> -> CRTCC<7-0>
+   addr<7-0> -> CRTCD<7-0>
+   CRTCEXT0 has to be programmed last to trigger an update and make the
+   new addr variable take effect.
+ */
 void mga_set_start_address(struct drm_crtc *crtc, unsigned offset)
 {
struct mga_device *mdev = crtc->dev->dev_private;
u32 addr;
int count;
+   u8 crtcext0;

while (RREG8(0x1fda) & 0x08);
while (!(RREG8(0x1fda) & 0x08));
@@ -667,10 +681,17 @@ void mga_set_start_address(struct drm_crtc *crtc, 
unsigned offset)
count = RREG8(MGAREG_VCOUNT) + 2;
while (RREG8(MGAREG_VCOUNT) < count);

-   addr = offset >> 2;
+   WREG8(MGAREG_CRTCEXT_INDEX, 0);
+   crtcext0 = RREG8(MGAREG_CRTCEXT_DATA);
+   crtcext0 &= 0xB0;
+   addr = offset / 8;
+   /* Can't store addresses any higher than that...
+  but we also don't have more than 16MB of memory, so it should be 
fine. */
+   WARN_ON(addr > 0x1f);
+   crtcext0 |= (!!(addr & (1<<20)))<<6;
WREG_CRT(0x0d, (u8)(addr & 0xff));
WREG_CRT(0x0c, (u8)(addr >> 8) & 0xff);
-   WREG_CRT(0xaf, (u8)(addr >> 16) & 0xf);
+   WREG_ECRT(0x0, ((u8)(addr >> 16) & 0xf) | crtcext0);
 }


-- 
1.8.1.5



[PATCH 1/7] drm: Add fb_helper->restore_fbdev_mode hook

2013-05-08 Thread Laurent Pinchart
Hi Ville,

Thank you for the patch.

On Wednesday 08 May 2013 12:55:16 ville.syrjala at linux.intel.com wrote:
> From: Ville Syrj?l? 
> 
> Drivers may need to turn off overlay planes, cursors, etc. when
> restoring the fbdev mode. So allow drivers to provide their own
> version of drm_fb_helper_restore_fbdev_mode() that can take care
> of such details.
> 
> Initially just plug in drm_fb_helper_restore_fbdev_mode for all
> drivers.
> 
> Signed-off-by: Ville Syrj?l? 
> ---
>  drivers/gpu/drm/ast/ast_fb.c  | 1 +
>  drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
>  drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
>  drivers/gpu/drm/drm_fb_helper.c   | 2 +-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
>  drivers/gpu/drm/gma500/framebuffer.c  | 1 +
>  drivers/gpu/drm/i915/intel_fb.c   | 1 +
>  drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
>  drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
>  drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
>  drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
>  drivers/gpu/drm/radeon/radeon_fb.c| 1 +
>  drivers/gpu/drm/udl/udl_fb.c  | 1 +
>  include/drm/drm_fb_helper.h   | 1 +
>  14 files changed, 14 insertions(+), 1 deletion(-)

[snip]

> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> index 8230b46..9f5b9be 100644
> --- a/include/drm/drm_fb_helper.h
> +++ b/include/drm/drm_fb_helper.h
> @@ -72,6 +72,7 @@ struct drm_fb_helper_funcs {
>  struct drm_fb_helper_crtc **crtcs,
>  struct drm_display_mode **modes,
>  bool *enabled, int width, int height);
> + bool (*restore_fbdev_mode)(struct drm_fb_helper *fb_helper);

Could you please document this new function in the struct drm_fb_helper_funcs 
kerneldoc block ?

>  };
> 
>  struct drm_fb_helper_connector {
-- 
Regards,

Laurent Pinchart



[PATCH 7/7] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread Laurent Pinchart
Hi Ville,

Thank you for the patch.

On Wednesday 08 May 2013 12:55:22 ville.syrjala at linux.intel.com wrote:
> From: Ville Syrj?l? 
> 
> There's a bunch of unused members inside drm_plane, bloating the size of
> the structure needlessly. Eliminate them.
> 
> Signed-off-by: Ville Syrj?l? 
> ---
>  drivers/gpu/drm/drm_crtc.c |  2 +-
>  include/drm/drm_crtc.h | 10 --
>  2 files changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index d7c449f..e591914 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void
> *data,
> 
>   plane_resp->plane_id = plane->base.id;
>   plane_resp->possible_crtcs = plane->possible_crtcs;
> - plane_resp->gamma_size = plane->gamma_size;
> + plane_resp->gamma_size = 0;
> 
>   /*
>* This ioctl is called twice, once to determine how much space is
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index adb3f9b..99420c4 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -654,9 +654,6 @@ struct drm_plane_funcs {
>   * @format_count: number of formats supported
>   * @crtc: currently bound CRTC
>   * @fb: currently bound fb
> - * @gamma_size: size of gamma table
> - * @gamma_store: gamma correction table
> - * @enabled: enabled flag
>   * @funcs: helper functions
>   * @helper_private: storage for drver layer

Shouldn't the above line be removed as well ?

>   * @properties: property tracking for this plane
> @@ -674,14 +671,7 @@ struct drm_plane {
>   struct drm_crtc *crtc;
>   struct drm_framebuffer *fb;
> 
> - /* CRTC gamma size for reporting to userspace */
> - uint32_t gamma_size;
> - uint16_t *gamma_store;
> -
> - bool enabled;
> -
>   const struct drm_plane_funcs *funcs;
> - void *helper_private;
> 
>   struct drm_object_properties properties;
>  };

-- 
Regards,

Laurent Pinchart



[PULL] drm-intel-fixes

2013-05-08 Thread Daniel Vetter
On Sat, May 04, 2013 at 08:11:25PM +0200, Daniel Vetter wrote:
> Hi Dave,
> 
> A few intel fixes for smaller issues and one revert for an sdv hack which
> we've wanted to kill anyway. Plus two drm patches included for your
> convenience, both regression fixers for mine own screw-ups.

I've smashed a few more fixes on top, both fixes for stolen mem handling.
-Daniel

The following changes since commit 43b27290dd42b40f3f23f49677a7faa5a4eb1eff:

  drm/i915: correct the calculation of first_pd_entry_in_global_pt (2013-04-27 
14:07:16 +0200)

are available in the git repository at:

  git://people.freedesktop.org/~danvet/drm-intel for-linux-next

for you to fetch changes up to 1ffc5289bfcf7f4c4e4213240bb4be68c48ce603:

  drm/i915: clear the stolen fb before resuming (2013-05-07 22:25:11 +0200)


Ben Widawsky (1):
  Revert "drm/i915: Calculate correct stolen size for GEN7+"

Chris Wilson (1):
  drm/i915: Always normalize return timeout for wait_timeout_ioctl

Daniel Vetter (3):
  drm/mm: fix dump table BUG
  drm: don't check modeset locks in panic handler
  Revert "drm/i915: revert eDP bpp clamping code changes"

Imre Deak (1):
  drm/i915: hsw: fix link training for eDP on port-A

Jani Nikula (1):
  drm/i915: clear the stolen fb before resuming

Ville Syrj?l? (1):
  drm/i915: Fix pipe enabled mask for pipe C in WM calculations

 drivers/gpu/drm/drm_crtc.c  |4 ++
 drivers/gpu/drm/drm_mm.c|   34 
 drivers/gpu/drm/i915/i915_gem.c |8 ++--
 drivers/gpu/drm/i915/i915_gem_gtt.c |   15 +--
 drivers/gpu/drm/i915/i915_reg.h |2 -
 drivers/gpu/drm/i915/intel_ddi.c|5 +++
 drivers/gpu/drm/i915/intel_dp.c |   77 ++-
 drivers/gpu/drm/i915/intel_drv.h|1 +
 drivers/gpu/drm/i915/intel_fb.c |   16 +++-
 drivers/gpu/drm/i915/intel_pm.c |   44 ++--
 10 files changed, 116 insertions(+), 90 deletions(-)
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH 7/7] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

There's a bunch of unused members inside drm_plane, bloating the size of
the structure needlessly. Eliminate them.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/drm_crtc.c |  2 +-
 include/drm/drm_crtc.h | 10 --
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d7c449f..e591914 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,

plane_resp->plane_id = plane->base.id;
plane_resp->possible_crtcs = plane->possible_crtcs;
-   plane_resp->gamma_size = plane->gamma_size;
+   plane_resp->gamma_size = 0;

/*
 * This ioctl is called twice, once to determine how much space is
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index adb3f9b..99420c4 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -654,9 +654,6 @@ struct drm_plane_funcs {
  * @format_count: number of formats supported
  * @crtc: currently bound CRTC
  * @fb: currently bound fb
- * @gamma_size: size of gamma table
- * @gamma_store: gamma correction table
- * @enabled: enabled flag
  * @funcs: helper functions
  * @helper_private: storage for drver layer
  * @properties: property tracking for this plane
@@ -674,14 +671,7 @@ struct drm_plane {
struct drm_crtc *crtc;
struct drm_framebuffer *fb;

-   /* CRTC gamma size for reporting to userspace */
-   uint32_t gamma_size;
-   uint16_t *gamma_store;
-
-   bool enabled;
-
const struct drm_plane_funcs *funcs;
-   void *helper_private;

struct drm_object_properties properties;
 };
-- 
1.8.1.5



[PATCH 6/7] drm/i915: s/drm_i915_private_t/struct drm_i915_private/

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

People don't like typedefs these days. Eliminate their use from intel_fb.c.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/i915/intel_fb.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 1728cd9..53ab710 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -234,7 +234,7 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 int intel_fbdev_init(struct drm_device *dev)
 {
struct intel_fbdev *ifbdev;
-   drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_i915_private *dev_priv = dev->dev_private;
int ret;

ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
@@ -259,7 +259,7 @@ int intel_fbdev_init(struct drm_device *dev)

 void intel_fbdev_initial_config(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_i915_private *dev_priv = dev->dev_private;

/* Due to peculiar init order wrt to hpd handling this is separate. */
drm_fb_helper_initial_config(_priv->fbdev->helper, 32);
@@ -267,7 +267,7 @@ void intel_fbdev_initial_config(struct drm_device *dev)

 void intel_fbdev_fini(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->fbdev)
return;

@@ -278,7 +278,7 @@ void intel_fbdev_fini(struct drm_device *dev)

 void intel_fbdev_set_suspend(struct drm_device *dev, int state)
 {
-   drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_i915_private *dev_priv = dev->dev_private;
if (!dev_priv->fbdev)
return;

@@ -289,13 +289,13 @@ MODULE_LICENSE("GPL and additional rights");

 void intel_fb_output_poll_changed(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_i915_private *dev_priv = dev->dev_private;
drm_fb_helper_hotplug_event(_priv->fbdev->helper);
 }

 void intel_fb_restore_mode(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev->dev_private;
+   struct drm_i915_private *dev_priv = dev->dev_private;

if (INTEL_INFO(dev)->num_pipes == 0)
return;
-- 
1.8.1.5



[PATCH 5/7] drm/i915: Use container_of() in the fbdev code

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Use container_of() instead of a cast to get struct intel_fbdev
from struct drm_fb_helper.

Also populate the fb_info->par correctly with the drm_fb_helper pointer
instead of the intel_fbdev pointer.

There's no actual functional change since the drm_fb_helper happens to
be the first member inside intel_fbdev.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/i915/intel_fb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index a9e9fc0..1728cd9 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -60,8 +60,9 @@ static struct fb_ops intelfb_ops = {
 static int intelfb_create(struct drm_fb_helper *helper,
  struct drm_fb_helper_surface_size *sizes)
 {
-   struct intel_fbdev *ifbdev = (struct intel_fbdev *)helper;
-   struct drm_device *dev = ifbdev->helper.dev;
+   struct intel_fbdev *ifbdev =
+   container_of(helper, struct intel_fbdev, helper);
+   struct drm_device *dev = helper->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct fb_info *info;
struct drm_framebuffer *fb;
@@ -108,7 +109,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
goto out_unpin;
}

-   info->par = ifbdev;
+   info->par = helper;

ret = intel_framebuffer_init(dev, >ifb, _cmd, obj);
if (ret)
-- 
1.8.1.5



[PATCH 4/7] drm/i915: Use a custom restore_fbdev_mode hook

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Disable sprite planes and cursors when restoring the fbdev mode.
This is actually only needed in case the modeset gets optimized into a
set_base, but that's a fairly important case these days.

Should makes oopses more readable if they're not covered by spriteas and
cursors.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/i915/intel_fb.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 57a082c..a9e9fc0 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -183,11 +183,26 @@ out:
return ret;
 }

+static bool intel_fb_restore_fbdev_mode(struct drm_fb_helper *helper)
+{
+   struct drm_device *dev = helper->dev;
+   bool ret;
+
+   ret = drm_fb_helper_restore_fbdev_mode(helper);
+   if (ret)
+   DRM_DEBUG("failed to restore crtc mode\n");
+
+   /* in case we ended up doing just set_base above */
+   intel_disable_cursors_and_sprites(dev);
+
+   return ret;
+}
+
 static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.gamma_set = intel_crtc_fb_gamma_set,
.gamma_get = intel_crtc_fb_gamma_get,
.fb_probe = intelfb_create,
-   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
+   .restore_fbdev_mode = intel_fb_restore_fbdev_mode,
 };

 static void intel_fbdev_destroy(struct drm_device *dev,
@@ -279,7 +294,6 @@ void intel_fb_output_poll_changed(struct drm_device *dev)

 void intel_fb_restore_mode(struct drm_device *dev)
 {
-   int ret;
drm_i915_private_t *dev_priv = dev->dev_private;

if (INTEL_INFO(dev)->num_pipes == 0)
@@ -287,12 +301,7 @@ void intel_fb_restore_mode(struct drm_device *dev)

drm_modeset_lock_all(dev);

-   ret = drm_fb_helper_restore_fbdev_mode(_priv->fbdev->helper);
-   if (ret)
-   DRM_DEBUG("failed to restore crtc mode\n");
-
-   /* in case we ended up doing just set_base above */
-   intel_disable_cursors_and_sprites(dev);
+   intel_fb_restore_fbdev_mode(_priv->fbdev->helper);

drm_modeset_unlock_all(dev);
 }
-- 
1.8.1.5



[PATCH 3/7] drm/i915: Fix fbdev sprite disable code

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

plane->enabled is never set, so this code didn't do anything.

If we end up doing a full modeset, sprites already get disabled. However
if we end up doing a simple set_base, we still need to turn off the sprites
manually.

And do the same for cursors, since we only want to see the primary plane
for fbdev.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/i915/intel_display.c | 14 ++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 drivers/gpu/drm/i915/intel_fb.c  |  8 ++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index cfe2803..cef0bff 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9928,3 +9928,17 @@ intel_display_print_error_state(struct seq_file *m,
}
 }
 #endif
+
+void intel_disable_cursors_and_sprites(struct drm_device *dev)
+{
+   struct drm_crtc *crtc;
+   struct drm_plane *plane;
+
+   list_for_each_entry(crtc, >mode_config.crtc_list, head) {
+   intel_crtc_dpms_overlay(to_intel_crtc(crtc), false);
+   intel_crtc_update_cursor(crtc, false);
+   }
+
+   list_for_each_entry(plane, >mode_config.plane_list, head)
+   intel_plane_disable(plane);
+}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cd1297e..a4e866a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -789,5 +789,6 @@ extern bool intel_set_cpu_fifo_underrun_reporting(struct 
drm_device *dev,
 extern bool intel_set_pch_fifo_underrun_reporting(struct drm_device *dev,
 enum transcoder pch_transcoder,
 bool enable);
+extern void intel_disable_cursors_and_sprites(struct drm_device *dev);

 #endif /* __INTEL_DRV_H__ */
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index a04481f..57a082c 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -281,8 +281,6 @@ void intel_fb_restore_mode(struct drm_device *dev)
 {
int ret;
drm_i915_private_t *dev_priv = dev->dev_private;
-   struct drm_mode_config *config = >mode_config;
-   struct drm_plane *plane;

if (INTEL_INFO(dev)->num_pipes == 0)
return;
@@ -293,10 +291,8 @@ void intel_fb_restore_mode(struct drm_device *dev)
if (ret)
DRM_DEBUG("failed to restore crtc mode\n");

-   /* Be sure to shut off any planes that may be active */
-   list_for_each_entry(plane, >plane_list, head)
-   if (plane->enabled)
-   plane->funcs->disable_plane(plane);
+   /* in case we ended up doing just set_base above */
+   intel_disable_cursors_and_sprites(dev);

drm_modeset_unlock_all(dev);
 }
-- 
1.8.1.5



[PATCH 2/7] drm/i915: Don't enable cursors or sprites for fbdev

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Check if the CRTC framebuffer matches the fbdev helper's framebuffer,
and if it does, doen't enable cursors/sprites.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/i915/intel_display.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 94d6604..cfe2803 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3264,12 +3264,23 @@ static void ironlake_pfit_enable(struct intel_crtc 
*crtc)
}
 }

+static bool fbdev_active_on_crtc(const struct drm_crtc *crtc)
+{
+   const struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+
+   return dev_priv->fbdev && dev_priv->fbdev->helper.fb == crtc->fb;
+}
+
 static void intel_enable_planes(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc->dev;
enum pipe pipe = to_intel_crtc(crtc)->pipe;
struct intel_plane *intel_plane;

+   /* don't enable sprite planes for fbdev */
+   if (fbdev_active_on_crtc(crtc))
+   return;
+
list_for_each_entry(intel_plane, >mode_config.plane_list, 
base.head)
if (intel_plane->pipe == pipe)
intel_plane_restore(_plane->base);
@@ -6522,6 +6533,10 @@ static void intel_crtc_update_cursor(struct drm_crtc 
*crtc,
u32 base, pos;
bool visible;

+   /* don't enable cursors for fbdev */
+   if (on && fbdev_active_on_crtc(crtc))
+   return;
+
pos = 0;

if (on && crtc->enabled && crtc->fb) {
-- 
1.8.1.5



[PATCH 1/7] drm: Add fb_helper->restore_fbdev_mode hook

2013-05-08 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Drivers may need to turn off overlay planes, cursors, etc. when
restoring the fbdev mode. So allow drivers to provide their own
version of drm_fb_helper_restore_fbdev_mode() that can take care
of such details.

Initially just plug in drm_fb_helper_restore_fbdev_mode for all
drivers.

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/ast/ast_fb.c  | 1 +
 drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
 drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
 drivers/gpu/drm/drm_fb_helper.c   | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
 drivers/gpu/drm/gma500/framebuffer.c  | 1 +
 drivers/gpu/drm/i915/intel_fb.c   | 1 +
 drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
 drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
 drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
 drivers/gpu/drm/radeon/radeon_fb.c| 1 +
 drivers/gpu/drm/udl/udl_fb.c  | 1 +
 include/drm/drm_fb_helper.h   | 1 +
 14 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 34931fe..2c1f469 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -254,6 +254,7 @@ static struct drm_fb_helper_funcs ast_fb_helper_funcs = {
.gamma_set = ast_fb_gamma_set,
.gamma_get = ast_fb_gamma_get,
.fb_probe = astfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 static void ast_fbdev_destroy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c 
b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index e25afcc..ee48a21 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -253,6 +253,7 @@ static struct drm_fb_helper_funcs cirrus_fb_helper_funcs = {
.gamma_set = cirrus_crtc_fb_gamma_set,
.gamma_get = cirrus_crtc_fb_gamma_get,
.fb_probe = cirrusfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 int cirrus_fbdev_init(struct cirrus_device *cdev)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0b5af7d..f011628 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -330,6 +330,7 @@ err_drm_gem_cma_free_object:

 static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
.fb_probe = drm_fbdev_cma_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 /**
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b78cbe7..02c70b2 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -315,7 +315,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)
continue;

-   ret = drm_fb_helper_restore_fbdev_mode(helper);
+   ret = helper->funcs->restore_fbdev_mode(helper);
if (ret)
error = true;
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index 68f0045..6ed4065 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -228,6 +228,7 @@ out:

 static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
.fb_probe = exynos_drm_fbdev_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 int exynos_drm_fbdev_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 1534e22..8d7f9c0 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -567,6 +567,7 @@ static struct drm_fb_helper_funcs psb_fb_helper_funcs = {
.gamma_set = psbfb_gamma_set,
.gamma_get = psbfb_gamma_get,
.fb_probe = psbfb_probe,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 0e19e57..a04481f 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -187,6 +187,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.gamma_set = intel_crtc_fb_gamma_set,
.gamma_get = intel_crtc_fb_gamma_get,
.fb_probe = intelfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };

 static void intel_fbdev_destroy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 421beab..23b8de2 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -239,6 +239,7 @@ static struct drm_fb_helper_funcs mga_fb_helper_funcs = {
.gamma_set = 

[PATCH 0/7] drm/i915: fbdev mode restoration improvements

2013-05-08 Thread ville.syrj...@linux.intel.com
This series attempts to make sure we turn off any cursor and sprite
planes when we restore the fbdev mode.

Some of this stuff depends on the other series I just posted:
'[PATCH 0/6] drm/i915: Unfify some modeset sequences'

I also noticed some crap when looking at the code, so I slapped on a
few cleanups to the end


DMA mapping API abuse in exynos-drm

2013-05-08 Thread Marek Szyprowski
Hello,

On 5/6/2013 7:59 AM, Inki Dae wrote:
> 2013/5/5 Tomasz Figa  >
>
> Hi,
>
> Recently I've been working a bit on a DRM driver for the GPU of
> Samsung
> S3C6410 SoCs, which required me to familiarize a bit with
> exynos-drm, as
> it already contains a KMS driver which is compatible with the SoC I'm
> working with, making it a good place to put my driver in.
>
> Reading through exynos_drm_buf.c I stumbled across following (a
> bit long)
> piece of code:
>
> dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, >dma_attrs);
>
> nr_pages = buf->size >> PAGE_SHIFT;
>
> if (!is_drm_iommu_supported(dev)) {
> dma_addr_t start_addr;
> unsigned int i = 0;
>
> buf->pages = kzalloc(sizeof(struct page) * nr_pages,
> GFP_KERNEL);
> if (!buf->pages) {
> DRM_ERROR("failed to allocate pages.\n");
> return -ENOMEM;
> }
>
> buf->kvaddr = dma_alloc_attrs(dev->dev, buf->size,
> >dma_addr, GFP_KERNEL,
> >dma_attrs);
> if (!buf->kvaddr) {
> DRM_ERROR("failed to allocate buffer.\n");
> kfree(buf->pages);
> return -ENOMEM;
> }
>
> start_addr = buf->dma_addr;
> while (i < nr_pages) {
> buf->pages[i] = phys_to_page(start_addr);
> start_addr += PAGE_SIZE;
> i++;
> }
> } else {
>
> buf->pages = dma_alloc_attrs(dev->dev, buf->size,
> >dma_addr, GFP_KERNEL,
> >dma_attrs);
> if (!buf->pages) {
> DRM_ERROR("failed to allocate buffer.\n");
> return -ENOMEM;
> }
> }
>
> buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages);
> if (!buf->sgt) {
> DRM_ERROR("failed to get sg table.\n");
> ret = -ENOMEM;
> goto err_free_attrs;
> }
>
> Notice that the value returned by dma_alloc_attrs() is assumed by this
> code to be either a kernel virtual address (in
> !is_drm_iommu_supported()
> case) or struct pages ** (in is_drm_iommu_supported() case), which
> seemed
> a bit worrying to me, making me do a more in depth research on how
> dma_alloc_attrs works.
>
> This, in turn, led me to following excerpt of Documentation/DMA-
> attributes.txt :
>
> DMA_ATTR_NO_KERNEL_MAPPING
> --
>
> DMA_ATTR_NO_KERNEL_MAPPING lets the platform to avoid creating a
> kernel
> virtual mapping for the allocated buffer. On some architectures
> creating
> such mapping is non-trivial task and consumes very limited resources
> (like kernel virtual address space or dma consistent address space).
> Buffers allocated with this attribute can be only passed to user space
> by calling dma_mmap_attrs(). By using this API, you are guaranteeing
> that you won't dereference the pointer returned by
> dma_alloc_attr(). You
> can threat it as a cookie that must be passed to dma_mmap_attrs() and
> dma_free_attrs(). Make sure that both of these also get this attribute
> set on each call.
>
> of which the following sentence is the most relevant:
>
> By using this API, you are guaranteeing that you won't dereference the
> pointer returned by dma_alloc_attr().
>
> This statement is obviously ignored by buffer allocation code of
> exynos-
> drm.
>
> A simple git blame revealed that this brokenness has been
> introduced by
> commit:
>
> 4744ad2 drm/exynos: use DMA_ATTR_NO_KERNEL_MAPPING attribute
>
>
> and later fixed a bit by following depending patches (because the
> original
> patch apparently broke any allocations without IOMMU):
>
> c704f1b drm/exynos: consider no iommu support to console framebuffer
> 694be45 drm/exynos: consider buffer allocation without iommu
>
>
> Now, the real question is whether my reasoning is incorrect (sorry
> for the
> noise then) or this is really a bug which needs to be fixed?
>
>
> Hi Tomasz,
>
> Your question is reasonable to me. And below is my opinion,
>
> First, also the below attribute says like below,
>
> DMA_ATTR_NO_KERNEL_MAPPING
> --
> ...
> Since it is optional for platforms to implement
> DMA_ATTR_NO_KERNEL_MAPPING, those that do not will simply ignore the
> attribute and exhibit default behavior.
>
>
> In case of ARM SoC, it seems like that it just ignores the attribute
> without iommu: in case of no iommu, 

[PATCH] radeon: Allow disabling UVD

2013-05-08 Thread Christian König
Am 07.05.2013 23:13, schrieb Parag Warudkar:
> On Tue, May 7, 2013 at 4:44 AM, Christian K?nig  
> wrote:
>
>> The patch shouldn't be necessary because just removing the firmware should
>> have pretty much the same effect.
> Soon distros will ship the UVD firmware by default and then users will
> need to manually remove it and then do the same with every update.
> Besides, I just discovered that when UVD is enabled suspend resume
> breaks  - tried 3 times with SUMO_uvd loaded - machine suspends but
> resumes instantly.
> Without SUMO_uvd.bin - suspends fine and only wakes up when I want it to.

Hui? Wait a second, the firmware doesn't work but still causes an 
instant resume on suspend? Very strange.

>> The only case where we indeed seems to have a problem are Macs with
>> integrated cards, and we can always just blacklist those if the problem
>> doesn't seems to be solvable.
> I happen to have the problematic card in my iMac - I'd be glad to
> provide any info or try any patches. Just let me know.
> For now I will remove the firmware - I reboot /suspend-resume often
> and it is a bit annoying to have to go through those mdelays only to
> fail.

Yeah, perfectly understandable.

My best guess is that it has something todo with a different clock 
routing on Macs, but without access to the hardware (or precise 
documentation from Apple what the heck they did different) I don't 
really see a chance to solve that problem.

If you want to hack a bit on it you could try commenting out the calls 
to "radeon_set_uvd_clocks" in radeon_uvd.c. That should give you the 
default clocks of 100Mhz, not enough for usable decoding, but on SUMO 
based UVD blocks a very failsafe default.

Whatever it is, please send me an output of lspci, so I can blacklist 
the offending chip.

Christian.

> Thanks,
> Parag
>



linux-next: manual merge of the drm-intel tree with Linus' tree

2013-05-08 Thread Stephen Rothwell
Hi Daniel,

On Tue, 7 May 2013 10:43:17 +0200 Daniel Vetter  
wrote:
>
> On Tue, May 7, 2013 at 3:27 AM, Stephen Rothwell  
> wrote:
> >
> > Daniel, I assume all this stuff being added to the drm-intel tree is
> > going upstream very soon?
> 
> Oops, no that is stuff for 3.11. Lazy me hoped I could sneak stuff
> through (since we just keep on merging features to
> drm-intel-next-queued to avoid stalls), but that's obviously not what
> you want for linux-next. My apologies for that mess. I've now created
> a for-linux-next branch which will not contain patches heading for
> 3.x+1 while 3.x-rc1 hasn't been released yet.
> 
> Can you please switch over to that branch for inclusion into linux-next?

Done.  Thanks.

-- 
Cheers,
Stephen Rothwellsfr at canb.auug.org.au
-- 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/20130508/41b5b541/attachment.pgp>


[PATCH] drm: refactor call to request_module

2013-05-08 Thread Paul Menzel
Am Dienstag, den 07.05.2013, 12:32 -0700 schrieb Kees Cook:
> This reduces the size of the stack frame when calling request_module().
> Performing the sprintf before the call is not needed.

Good fine. Do you have any hard numbers for the record?

Did you find this just by reading the code or are there any problems
with stack sizes on some systems?

(This patch would be good alone for decreasing the number of code
lines. ;-))

> Signed-off-by: Kees Cook 
> ---
>  drivers/gpu/drm/drm_encoder_slave.c |6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)

Acked-by: Paul Menzel 


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/20130508/5b189bcb/attachment.pgp>


[PATCH] drm: refactor call to request_module

2013-05-08 Thread Kees Cook
On Wed, May 8, 2013 at 12:22 AM, Paul Menzel
 wrote:
> Am Dienstag, den 07.05.2013, 12:32 -0700 schrieb Kees Cook:
>> This reduces the size of the stack frame when calling request_module().
>> Performing the sprintf before the call is not needed.
>
> Good fine. Do you have any hard numbers for the record?
>
> Did you find this just by reading the code or are there any problems
> with stack sizes on some systems?
>
> (This patch would be good alone for decreasing the number of code
> lines. ;-))

No hard numbers; I just saw it while reviewing callers to request_module(). :)

>> Signed-off-by: Kees Cook 
>> ---
>>  drivers/gpu/drm/drm_encoder_slave.c |6 +-
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> Acked-by: Paul Menzel 

Thanks!

-Kees

--
Kees Cook
Chrome OS Security


[Bug 64201] OpenCL usage result segmentation fault on r600g with HD6850.

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

--- Comment #13 from Erdem U. Altinyurt  ---
Oops! LLVM 3.3 is branched today.
I wish this bug vanished from LLVM before release of v3.3 in June

Updated today's mesa and llvm-trunks...
Without "-v1" flag, "bfgminer --benchmark" reports:

[2013-05-08 03:37:54] Error -11: Building Program (clBuildProgram)
[2013-05-08 03:37:54] input.cl:197:7: error: initializing 'uint' (aka 'unsigned
int') with an expression of incompatible type 'unsigned int
__attribute__((ext_ve
ctor_type(2)))'
uint r = rot(W[3].x,25u)^rot(W[3].x,14u)^((W[3].x)>>3U);



@Aaron, could you use pyrit or any other OpenCL tools with yours HD6850 without
lockup?
Regards.

-- 
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/20130508/fcaa2e86/attachment.html>


Re: [PATCH] drm: refactor call to request_module

2013-05-08 Thread Paul Menzel
Am Dienstag, den 07.05.2013, 12:32 -0700 schrieb Kees Cook:
 This reduces the size of the stack frame when calling request_module().
 Performing the sprintf before the call is not needed.

Good fine. Do you have any hard numbers for the record?

Did you find this just by reading the code or are there any problems
with stack sizes on some systems?

(This patch would be good alone for decreasing the number of code
lines. ;-))

 Signed-off-by: Kees Cook keesc...@chromium.org
 ---
  drivers/gpu/drm/drm_encoder_slave.c |6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)

Acked-by: Paul Menzel paulepan...@users.sourceforge.net


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


Re: [PATCH] radeon: Allow disabling UVD

2013-05-08 Thread Christian König

Am 07.05.2013 23:13, schrieb Parag Warudkar:

On Tue, May 7, 2013 at 4:44 AM, Christian König deathsim...@vodafone.de wrote:


The patch shouldn't be necessary because just removing the firmware should
have pretty much the same effect.

Soon distros will ship the UVD firmware by default and then users will
need to manually remove it and then do the same with every update.
Besides, I just discovered that when UVD is enabled suspend resume
breaks  - tried 3 times with SUMO_uvd loaded - machine suspends but
resumes instantly.
Without SUMO_uvd.bin - suspends fine and only wakes up when I want it to.


Hui? Wait a second, the firmware doesn't work but still causes an 
instant resume on suspend? Very strange.



The only case where we indeed seems to have a problem are Macs with
integrated cards, and we can always just blacklist those if the problem
doesn't seems to be solvable.

I happen to have the problematic card in my iMac - I'd be glad to
provide any info or try any patches. Just let me know.
For now I will remove the firmware - I reboot /suspend-resume often
and it is a bit annoying to have to go through those mdelays only to
fail.


Yeah, perfectly understandable.

My best guess is that it has something todo with a different clock 
routing on Macs, but without access to the hardware (or precise 
documentation from Apple what the heck they did different) I don't 
really see a chance to solve that problem.


If you want to hack a bit on it you could try commenting out the calls 
to radeon_set_uvd_clocks in radeon_uvd.c. That should give you the 
default clocks of 100Mhz, not enough for usable decoding, but on SUMO 
based UVD blocks a very failsafe default.


Whatever it is, please send me an output of lspci, so I can blacklist 
the offending chip.


Christian.


Thanks,
Parag



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


[PATCH 0/7] drm/i915: fbdev mode restoration improvements

2013-05-08 Thread ville . syrjala
This series attempts to make sure we turn off any cursor and sprite
planes when we restore the fbdev mode.

Some of this stuff depends on the other series I just posted:
'[PATCH 0/6] drm/i915: Unfify some modeset sequences'

I also noticed some crap when looking at the code, so I slapped on a
few cleanups to the end
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/7] drm/i915: Don't enable cursors or sprites for fbdev

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Check if the CRTC framebuffer matches the fbdev helper's framebuffer,
and if it does, doen't enable cursors/sprites.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_display.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 94d6604..cfe2803 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3264,12 +3264,23 @@ static void ironlake_pfit_enable(struct intel_crtc 
*crtc)
}
 }
 
+static bool fbdev_active_on_crtc(const struct drm_crtc *crtc)
+{
+   const struct drm_i915_private *dev_priv = crtc-dev-dev_private;
+
+   return dev_priv-fbdev  dev_priv-fbdev-helper.fb == crtc-fb;
+}
+
 static void intel_enable_planes(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc-dev;
enum pipe pipe = to_intel_crtc(crtc)-pipe;
struct intel_plane *intel_plane;
 
+   /* don't enable sprite planes for fbdev */
+   if (fbdev_active_on_crtc(crtc))
+   return;
+
list_for_each_entry(intel_plane, dev-mode_config.plane_list, 
base.head)
if (intel_plane-pipe == pipe)
intel_plane_restore(intel_plane-base);
@@ -6522,6 +6533,10 @@ static void intel_crtc_update_cursor(struct drm_crtc 
*crtc,
u32 base, pos;
bool visible;
 
+   /* don't enable cursors for fbdev */
+   if (on  fbdev_active_on_crtc(crtc))
+   return;
+
pos = 0;
 
if (on  crtc-enabled  crtc-fb) {
-- 
1.8.1.5

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


[PATCH 3/7] drm/i915: Fix fbdev sprite disable code

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

plane-enabled is never set, so this code didn't do anything.

If we end up doing a full modeset, sprites already get disabled. However
if we end up doing a simple set_base, we still need to turn off the sprites
manually.

And do the same for cursors, since we only want to see the primary plane
for fbdev.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_display.c | 14 ++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 drivers/gpu/drm/i915/intel_fb.c  |  8 ++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index cfe2803..cef0bff 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9928,3 +9928,17 @@ intel_display_print_error_state(struct seq_file *m,
}
 }
 #endif
+
+void intel_disable_cursors_and_sprites(struct drm_device *dev)
+{
+   struct drm_crtc *crtc;
+   struct drm_plane *plane;
+
+   list_for_each_entry(crtc, dev-mode_config.crtc_list, head) {
+   intel_crtc_dpms_overlay(to_intel_crtc(crtc), false);
+   intel_crtc_update_cursor(crtc, false);
+   }
+
+   list_for_each_entry(plane, dev-mode_config.plane_list, head)
+   intel_plane_disable(plane);
+}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cd1297e..a4e866a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -789,5 +789,6 @@ extern bool intel_set_cpu_fifo_underrun_reporting(struct 
drm_device *dev,
 extern bool intel_set_pch_fifo_underrun_reporting(struct drm_device *dev,
 enum transcoder pch_transcoder,
 bool enable);
+extern void intel_disable_cursors_and_sprites(struct drm_device *dev);
 
 #endif /* __INTEL_DRV_H__ */
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index a04481f..57a082c 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -281,8 +281,6 @@ void intel_fb_restore_mode(struct drm_device *dev)
 {
int ret;
drm_i915_private_t *dev_priv = dev-dev_private;
-   struct drm_mode_config *config = dev-mode_config;
-   struct drm_plane *plane;
 
if (INTEL_INFO(dev)-num_pipes == 0)
return;
@@ -293,10 +291,8 @@ void intel_fb_restore_mode(struct drm_device *dev)
if (ret)
DRM_DEBUG(failed to restore crtc mode\n);
 
-   /* Be sure to shut off any planes that may be active */
-   list_for_each_entry(plane, config-plane_list, head)
-   if (plane-enabled)
-   plane-funcs-disable_plane(plane);
+   /* in case we ended up doing just set_base above */
+   intel_disable_cursors_and_sprites(dev);
 
drm_modeset_unlock_all(dev);
 }
-- 
1.8.1.5

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


[PATCH 1/7] drm: Add fb_helper-restore_fbdev_mode hook

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Drivers may need to turn off overlay planes, cursors, etc. when
restoring the fbdev mode. So allow drivers to provide their own
version of drm_fb_helper_restore_fbdev_mode() that can take care
of such details.

Initially just plug in drm_fb_helper_restore_fbdev_mode for all
drivers.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/ast/ast_fb.c  | 1 +
 drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
 drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
 drivers/gpu/drm/drm_fb_helper.c   | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
 drivers/gpu/drm/gma500/framebuffer.c  | 1 +
 drivers/gpu/drm/i915/intel_fb.c   | 1 +
 drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
 drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
 drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
 drivers/gpu/drm/radeon/radeon_fb.c| 1 +
 drivers/gpu/drm/udl/udl_fb.c  | 1 +
 include/drm/drm_fb_helper.h   | 1 +
 14 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 34931fe..2c1f469 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -254,6 +254,7 @@ static struct drm_fb_helper_funcs ast_fb_helper_funcs = {
.gamma_set = ast_fb_gamma_set,
.gamma_get = ast_fb_gamma_get,
.fb_probe = astfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };
 
 static void ast_fbdev_destroy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c 
b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index e25afcc..ee48a21 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -253,6 +253,7 @@ static struct drm_fb_helper_funcs cirrus_fb_helper_funcs = {
.gamma_set = cirrus_crtc_fb_gamma_set,
.gamma_get = cirrus_crtc_fb_gamma_get,
.fb_probe = cirrusfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };
 
 int cirrus_fbdev_init(struct cirrus_device *cdev)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0b5af7d..f011628 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -330,6 +330,7 @@ err_drm_gem_cma_free_object:
 
 static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
.fb_probe = drm_fbdev_cma_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };
 
 /**
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b78cbe7..02c70b2 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -315,7 +315,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
if (helper-dev-switch_power_state == DRM_SWITCH_POWER_OFF)
continue;
 
-   ret = drm_fb_helper_restore_fbdev_mode(helper);
+   ret = helper-funcs-restore_fbdev_mode(helper);
if (ret)
error = true;
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index 68f0045..6ed4065 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -228,6 +228,7 @@ out:
 
 static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
.fb_probe = exynos_drm_fbdev_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };
 
 int exynos_drm_fbdev_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index 1534e22..8d7f9c0 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -567,6 +567,7 @@ static struct drm_fb_helper_funcs psb_fb_helper_funcs = {
.gamma_set = psbfb_gamma_set,
.gamma_get = psbfb_gamma_get,
.fb_probe = psbfb_probe,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };
 
 static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 0e19e57..a04481f 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -187,6 +187,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.gamma_set = intel_crtc_fb_gamma_set,
.gamma_get = intel_crtc_fb_gamma_get,
.fb_probe = intelfb_create,
+   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
 };
 
 static void intel_fbdev_destroy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 421beab..23b8de2 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -239,6 +239,7 @@ static struct drm_fb_helper_funcs mga_fb_helper_funcs 

[PATCH 4/7] drm/i915: Use a custom restore_fbdev_mode hook

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Disable sprite planes and cursors when restoring the fbdev mode.
This is actually only needed in case the modeset gets optimized into a
set_base, but that's a fairly important case these days.

Should makes oopses more readable if they're not covered by spriteas and
cursors.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_fb.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 57a082c..a9e9fc0 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -183,11 +183,26 @@ out:
return ret;
 }
 
+static bool intel_fb_restore_fbdev_mode(struct drm_fb_helper *helper)
+{
+   struct drm_device *dev = helper-dev;
+   bool ret;
+
+   ret = drm_fb_helper_restore_fbdev_mode(helper);
+   if (ret)
+   DRM_DEBUG(failed to restore crtc mode\n);
+
+   /* in case we ended up doing just set_base above */
+   intel_disable_cursors_and_sprites(dev);
+
+   return ret;
+}
+
 static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.gamma_set = intel_crtc_fb_gamma_set,
.gamma_get = intel_crtc_fb_gamma_get,
.fb_probe = intelfb_create,
-   .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
+   .restore_fbdev_mode = intel_fb_restore_fbdev_mode,
 };
 
 static void intel_fbdev_destroy(struct drm_device *dev,
@@ -279,7 +294,6 @@ void intel_fb_output_poll_changed(struct drm_device *dev)
 
 void intel_fb_restore_mode(struct drm_device *dev)
 {
-   int ret;
drm_i915_private_t *dev_priv = dev-dev_private;
 
if (INTEL_INFO(dev)-num_pipes == 0)
@@ -287,12 +301,7 @@ void intel_fb_restore_mode(struct drm_device *dev)
 
drm_modeset_lock_all(dev);
 
-   ret = drm_fb_helper_restore_fbdev_mode(dev_priv-fbdev-helper);
-   if (ret)
-   DRM_DEBUG(failed to restore crtc mode\n);
-
-   /* in case we ended up doing just set_base above */
-   intel_disable_cursors_and_sprites(dev);
+   intel_fb_restore_fbdev_mode(dev_priv-fbdev-helper);
 
drm_modeset_unlock_all(dev);
 }
-- 
1.8.1.5

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


[PATCH 5/7] drm/i915: Use container_of() in the fbdev code

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Use container_of() instead of a cast to get struct intel_fbdev
from struct drm_fb_helper.

Also populate the fb_info-par correctly with the drm_fb_helper pointer
instead of the intel_fbdev pointer.

There's no actual functional change since the drm_fb_helper happens to
be the first member inside intel_fbdev.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_fb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index a9e9fc0..1728cd9 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -60,8 +60,9 @@ static struct fb_ops intelfb_ops = {
 static int intelfb_create(struct drm_fb_helper *helper,
  struct drm_fb_helper_surface_size *sizes)
 {
-   struct intel_fbdev *ifbdev = (struct intel_fbdev *)helper;
-   struct drm_device *dev = ifbdev-helper.dev;
+   struct intel_fbdev *ifbdev =
+   container_of(helper, struct intel_fbdev, helper);
+   struct drm_device *dev = helper-dev;
struct drm_i915_private *dev_priv = dev-dev_private;
struct fb_info *info;
struct drm_framebuffer *fb;
@@ -108,7 +109,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
goto out_unpin;
}
 
-   info-par = ifbdev;
+   info-par = helper;
 
ret = intel_framebuffer_init(dev, ifbdev-ifb, mode_cmd, obj);
if (ret)
-- 
1.8.1.5

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


[PATCH 6/7] drm/i915: s/drm_i915_private_t/struct drm_i915_private/

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

People don't like typedefs these days. Eliminate their use from intel_fb.c.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/i915/intel_fb.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 1728cd9..53ab710 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -234,7 +234,7 @@ static void intel_fbdev_destroy(struct drm_device *dev,
 int intel_fbdev_init(struct drm_device *dev)
 {
struct intel_fbdev *ifbdev;
-   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_private *dev_priv = dev-dev_private;
int ret;
 
ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
@@ -259,7 +259,7 @@ int intel_fbdev_init(struct drm_device *dev)
 
 void intel_fbdev_initial_config(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_private *dev_priv = dev-dev_private;
 
/* Due to peculiar init order wrt to hpd handling this is separate. */
drm_fb_helper_initial_config(dev_priv-fbdev-helper, 32);
@@ -267,7 +267,7 @@ void intel_fbdev_initial_config(struct drm_device *dev)
 
 void intel_fbdev_fini(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_private *dev_priv = dev-dev_private;
if (!dev_priv-fbdev)
return;
 
@@ -278,7 +278,7 @@ void intel_fbdev_fini(struct drm_device *dev)
 
 void intel_fbdev_set_suspend(struct drm_device *dev, int state)
 {
-   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_private *dev_priv = dev-dev_private;
if (!dev_priv-fbdev)
return;
 
@@ -289,13 +289,13 @@ MODULE_LICENSE(GPL and additional rights);
 
 void intel_fb_output_poll_changed(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_private *dev_priv = dev-dev_private;
drm_fb_helper_hotplug_event(dev_priv-fbdev-helper);
 }
 
 void intel_fb_restore_mode(struct drm_device *dev)
 {
-   drm_i915_private_t *dev_priv = dev-dev_private;
+   struct drm_i915_private *dev_priv = dev-dev_private;
 
if (INTEL_INFO(dev)-num_pipes == 0)
return;
-- 
1.8.1.5

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


[PATCH 7/7] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

There's a bunch of unused members inside drm_plane, bloating the size of
the structure needlessly. Eliminate them.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/drm_crtc.c |  2 +-
 include/drm/drm_crtc.h | 10 --
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d7c449f..e591914 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
 
plane_resp-plane_id = plane-base.id;
plane_resp-possible_crtcs = plane-possible_crtcs;
-   plane_resp-gamma_size = plane-gamma_size;
+   plane_resp-gamma_size = 0;
 
/*
 * This ioctl is called twice, once to determine how much space is
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index adb3f9b..99420c4 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -654,9 +654,6 @@ struct drm_plane_funcs {
  * @format_count: number of formats supported
  * @crtc: currently bound CRTC
  * @fb: currently bound fb
- * @gamma_size: size of gamma table
- * @gamma_store: gamma correction table
- * @enabled: enabled flag
  * @funcs: helper functions
  * @helper_private: storage for drver layer
  * @properties: property tracking for this plane
@@ -674,14 +671,7 @@ struct drm_plane {
struct drm_crtc *crtc;
struct drm_framebuffer *fb;
 
-   /* CRTC gamma size for reporting to userspace */
-   uint32_t gamma_size;
-   uint16_t *gamma_store;
-
-   bool enabled;
-
const struct drm_plane_funcs *funcs;
-   void *helper_private;
 
struct drm_object_properties properties;
 };
-- 
1.8.1.5

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


Re: [PULL] drm-intel-fixes

2013-05-08 Thread Daniel Vetter
On Sat, May 04, 2013 at 08:11:25PM +0200, Daniel Vetter wrote:
 Hi Dave,
 
 A few intel fixes for smaller issues and one revert for an sdv hack which
 we've wanted to kill anyway. Plus two drm patches included for your
 convenience, both regression fixers for mine own screw-ups.

I've smashed a few more fixes on top, both fixes for stolen mem handling.
-Daniel

The following changes since commit 43b27290dd42b40f3f23f49677a7faa5a4eb1eff:

  drm/i915: correct the calculation of first_pd_entry_in_global_pt (2013-04-27 
14:07:16 +0200)

are available in the git repository at:

  git://people.freedesktop.org/~danvet/drm-intel for-linux-next

for you to fetch changes up to 1ffc5289bfcf7f4c4e4213240bb4be68c48ce603:

  drm/i915: clear the stolen fb before resuming (2013-05-07 22:25:11 +0200)


Ben Widawsky (1):
  Revert drm/i915: Calculate correct stolen size for GEN7+

Chris Wilson (1):
  drm/i915: Always normalize return timeout for wait_timeout_ioctl

Daniel Vetter (3):
  drm/mm: fix dump table BUG
  drm: don't check modeset locks in panic handler
  Revert drm/i915: revert eDP bpp clamping code changes

Imre Deak (1):
  drm/i915: hsw: fix link training for eDP on port-A

Jani Nikula (1):
  drm/i915: clear the stolen fb before resuming

Ville Syrjälä (1):
  drm/i915: Fix pipe enabled mask for pipe C in WM calculations

 drivers/gpu/drm/drm_crtc.c  |4 ++
 drivers/gpu/drm/drm_mm.c|   34 
 drivers/gpu/drm/i915/i915_gem.c |8 ++--
 drivers/gpu/drm/i915/i915_gem_gtt.c |   15 +--
 drivers/gpu/drm/i915/i915_reg.h |2 -
 drivers/gpu/drm/i915/intel_ddi.c|5 +++
 drivers/gpu/drm/i915/intel_dp.c |   77 ++-
 drivers/gpu/drm/i915/intel_drv.h|1 +
 drivers/gpu/drm/i915/intel_fb.c |   16 +++-
 drivers/gpu/drm/i915/intel_pm.c |   44 ++--
 10 files changed, 116 insertions(+), 90 deletions(-)
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: DMA mapping API abuse in exynos-drm

2013-05-08 Thread Marek Szyprowski

Hello,

On 5/6/2013 7:59 AM, Inki Dae wrote:
2013/5/5 Tomasz Figa tomasz.f...@gmail.com 
mailto:tomasz.f...@gmail.com


Hi,

Recently I've been working a bit on a DRM driver for the GPU of
Samsung
S3C6410 SoCs, which required me to familiarize a bit with
exynos-drm, as
it already contains a KMS driver which is compatible with the SoC I'm
working with, making it a good place to put my driver in.

Reading through exynos_drm_buf.c I stumbled across following (a
bit long)
piece of code:

dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, buf-dma_attrs);

nr_pages = buf-size  PAGE_SHIFT;

if (!is_drm_iommu_supported(dev)) {
dma_addr_t start_addr;
unsigned int i = 0;

buf-pages = kzalloc(sizeof(struct page) * nr_pages,
GFP_KERNEL);
if (!buf-pages) {
DRM_ERROR(failed to allocate pages.\n);
return -ENOMEM;
}

buf-kvaddr = dma_alloc_attrs(dev-dev, buf-size,
buf-dma_addr, GFP_KERNEL,
buf-dma_attrs);
if (!buf-kvaddr) {
DRM_ERROR(failed to allocate buffer.\n);
kfree(buf-pages);
return -ENOMEM;
}

start_addr = buf-dma_addr;
while (i  nr_pages) {
buf-pages[i] = phys_to_page(start_addr);
start_addr += PAGE_SIZE;
i++;
}
} else {

buf-pages = dma_alloc_attrs(dev-dev, buf-size,
buf-dma_addr, GFP_KERNEL,
buf-dma_attrs);
if (!buf-pages) {
DRM_ERROR(failed to allocate buffer.\n);
return -ENOMEM;
}
}

buf-sgt = drm_prime_pages_to_sg(buf-pages, nr_pages);
if (!buf-sgt) {
DRM_ERROR(failed to get sg table.\n);
ret = -ENOMEM;
goto err_free_attrs;
}

Notice that the value returned by dma_alloc_attrs() is assumed by this
code to be either a kernel virtual address (in
!is_drm_iommu_supported()
case) or struct pages ** (in is_drm_iommu_supported() case), which
seemed
a bit worrying to me, making me do a more in depth research on how
dma_alloc_attrs works.

This, in turn, led me to following excerpt of Documentation/DMA-
attributes.txt :

DMA_ATTR_NO_KERNEL_MAPPING
--

DMA_ATTR_NO_KERNEL_MAPPING lets the platform to avoid creating a
kernel
virtual mapping for the allocated buffer. On some architectures
creating
such mapping is non-trivial task and consumes very limited resources
(like kernel virtual address space or dma consistent address space).
Buffers allocated with this attribute can be only passed to user space
by calling dma_mmap_attrs(). By using this API, you are guaranteeing
that you won't dereference the pointer returned by
dma_alloc_attr(). You
can threat it as a cookie that must be passed to dma_mmap_attrs() and
dma_free_attrs(). Make sure that both of these also get this attribute
set on each call.

of which the following sentence is the most relevant:

By using this API, you are guaranteeing that you won't dereference the
pointer returned by dma_alloc_attr().

This statement is obviously ignored by buffer allocation code of
exynos-
drm.

A simple git blame revealed that this brokenness has been
introduced by
commit:

4744ad2 drm/exynos: use DMA_ATTR_NO_KERNEL_MAPPING attribute


and later fixed a bit by following depending patches (because the
original
patch apparently broke any allocations without IOMMU):

c704f1b drm/exynos: consider no iommu support to console framebuffer
694be45 drm/exynos: consider buffer allocation without iommu


Now, the real question is whether my reasoning is incorrect (sorry
for the
noise then) or this is really a bug which needs to be fixed?


Hi Tomasz,

Your question is reasonable to me. And below is my opinion,

First, also the below attribute says like below,

DMA_ATTR_NO_KERNEL_MAPPING
--
...
Since it is optional for platforms to implement
DMA_ATTR_NO_KERNEL_MAPPING, those that do not will simply ignore the
attribute and exhibit default behavior.


In case of ARM SoC, it seems like that it just ignores the attribute
without iommu: in case of no iommu, dma_alloc_attr() always maps pages
allocated from highmem with kernel space. So I think we make sure that
exynos drm driver sets the attribute only with iommu to avoid such
confusing. For this, will post it soon.


IMHO this case simply 

Re: [PATCH 7/7] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread Laurent Pinchart
Hi Ville,

Thank you for the patch.

On Wednesday 08 May 2013 12:55:22 ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 There's a bunch of unused members inside drm_plane, bloating the size of
 the structure needlessly. Eliminate them.
 
 Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
 ---
  drivers/gpu/drm/drm_crtc.c |  2 +-
  include/drm/drm_crtc.h | 10 --
  2 files changed, 1 insertion(+), 11 deletions(-)
 
 diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
 index d7c449f..e591914 100644
 --- a/drivers/gpu/drm/drm_crtc.c
 +++ b/drivers/gpu/drm/drm_crtc.c
 @@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void
 *data,
 
   plane_resp-plane_id = plane-base.id;
   plane_resp-possible_crtcs = plane-possible_crtcs;
 - plane_resp-gamma_size = plane-gamma_size;
 + plane_resp-gamma_size = 0;
 
   /*
* This ioctl is called twice, once to determine how much space is
 diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
 index adb3f9b..99420c4 100644
 --- a/include/drm/drm_crtc.h
 +++ b/include/drm/drm_crtc.h
 @@ -654,9 +654,6 @@ struct drm_plane_funcs {
   * @format_count: number of formats supported
   * @crtc: currently bound CRTC
   * @fb: currently bound fb
 - * @gamma_size: size of gamma table
 - * @gamma_store: gamma correction table
 - * @enabled: enabled flag
   * @funcs: helper functions
   * @helper_private: storage for drver layer

Shouldn't the above line be removed as well ?

   * @properties: property tracking for this plane
 @@ -674,14 +671,7 @@ struct drm_plane {
   struct drm_crtc *crtc;
   struct drm_framebuffer *fb;
 
 - /* CRTC gamma size for reporting to userspace */
 - uint32_t gamma_size;
 - uint16_t *gamma_store;
 -
 - bool enabled;
 -
   const struct drm_plane_funcs *funcs;
 - void *helper_private;
 
   struct drm_object_properties properties;
  };

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/7] drm: Add fb_helper-restore_fbdev_mode hook

2013-05-08 Thread Laurent Pinchart
Hi Ville,

Thank you for the patch.

On Wednesday 08 May 2013 12:55:16 ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 Drivers may need to turn off overlay planes, cursors, etc. when
 restoring the fbdev mode. So allow drivers to provide their own
 version of drm_fb_helper_restore_fbdev_mode() that can take care
 of such details.
 
 Initially just plug in drm_fb_helper_restore_fbdev_mode for all
 drivers.
 
 Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
 ---
  drivers/gpu/drm/ast/ast_fb.c  | 1 +
  drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
  drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
  drivers/gpu/drm/drm_fb_helper.c   | 2 +-
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
  drivers/gpu/drm/gma500/framebuffer.c  | 1 +
  drivers/gpu/drm/i915/intel_fb.c   | 1 +
  drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
  drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
  drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
  drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
  drivers/gpu/drm/radeon/radeon_fb.c| 1 +
  drivers/gpu/drm/udl/udl_fb.c  | 1 +
  include/drm/drm_fb_helper.h   | 1 +
  14 files changed, 14 insertions(+), 1 deletion(-)

[snip]

 diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
 index 8230b46..9f5b9be 100644
 --- a/include/drm/drm_fb_helper.h
 +++ b/include/drm/drm_fb_helper.h
 @@ -72,6 +72,7 @@ struct drm_fb_helper_funcs {
  struct drm_fb_helper_crtc **crtcs,
  struct drm_display_mode **modes,
  bool *enabled, int width, int height);
 + bool (*restore_fbdev_mode)(struct drm_fb_helper *fb_helper);

Could you please document this new function in the struct drm_fb_helper_funcs 
kerneldoc block ?

  };
 
  struct drm_fb_helper_connector {
-- 
Regards,

Laurent Pinchart

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


[PATCH 0/3] drm: kernel-doc fixes

2013-05-08 Thread ville . syrjala
Just a few misc. kernel-doc fixes I spotted while looking into the
subject matter.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/3] drm: Add kernel-doc for drm_fb_helper_funcs-initial_config

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 include/drm/drm_fb_helper.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 8230b46..61ebd51 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -57,6 +57,7 @@ struct drm_fb_helper_surface_size {
  * @fb_probe: - Driver callback to allocate and initialize the fbdev info
  * structure. Futhermore it also needs to allocate the drm
  * framebuffer used to back the fbdev.
+ * @initial_config: - Setup an initial fbdev display configuration
  *
  * Driver callbacks used by the fbdev emulation helper library.
  */
-- 
1.8.1.5

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


[PATCH 2/3] drm: Remove pointless '-' characters from drm_fb_helper documentation

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 include/drm/drm_fb_helper.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 61ebd51..471f276 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -50,14 +50,14 @@ struct drm_fb_helper_surface_size {
 
 /**
  * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation 
library
- * @gamma_set: - Set the given gamma lut register on the given crtc.
- * @gamma_get: - Read the given gamma lut register on the given crtc, used to
- *  save the current lut when force-restoring the fbdev for e.g.
- *  kdbg.
- * @fb_probe: - Driver callback to allocate and initialize the fbdev info
- * structure. Futhermore it also needs to allocate the drm
- * framebuffer used to back the fbdev.
- * @initial_config: - Setup an initial fbdev display configuration
+ * @gamma_set: Set the given gamma lut register on the given crtc.
+ * @gamma_get: Read the given gamma lut register on the given crtc, used to
+ * save the current lut when force-restoring the fbdev for e.g.
+ * kdbg.
+ * @fb_probe: Driver callback to allocate and initialize the fbdev info
+ *structure. Futhermore it also needs to allocate the drm
+ *framebuffer used to back the fbdev.
+ * @initial_config: Setup an initial fbdev display configuration
  *
  * Driver callbacks used by the fbdev emulation helper library.
  */
-- 
1.8.1.5

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


[PATCH 3/3] drm: Fix drm_rect documentation

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

The 'struct' keyword was missing so struct drm_rect documentation never
ended up in the generated docs.

Also reorder drm_rect.h to become before drm_rect.c so that the struct
documentation appears first in the docs. And change it to use the 'I'
directive instead of 'F' while we're at it.

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 Documentation/DocBook/drm.tmpl | 2 +-
 include/drm/drm_rect.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 7c7af25..89b6faa 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1653,8 +1653,8 @@ void intel_crt_init(struct drm_device *dev)
 sect2
   titleKMS API Functions/title
 !Edrivers/gpu/drm/drm_crtc.c
+!Iinclude/drm/drm_rect.h
 !Edrivers/gpu/drm/drm_rect.c
-!Finclude/drm/drm_rect.h
 /sect2
   /sect1
 
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 64fa265..9a98321 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -25,7 +25,7 @@
 #define DRM_RECT_H
 
 /**
- * drm_rect - two dimensional rectangle
+ * struct drm_rect - two dimensional rectangle
  * @x1: horizontal starting coordinate (inclusive)
  * @x2: horizontal ending coordinate (exclusive)
  * @y1: vertical starting coordinate (inclusive)
-- 
1.8.1.5

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


[PATCH v2] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

There's a bunch of unused members inside drm_plane, bloating the size of
the structure needlessly. Eliminate them.

v2: Remove all of it from kernel-doc too

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 drivers/gpu/drm/drm_crtc.c |  2 +-
 include/drm/drm_crtc.h | 11 ---
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d7c449f..e591914 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
 
plane_resp-plane_id = plane-base.id;
plane_resp-possible_crtcs = plane-possible_crtcs;
-   plane_resp-gamma_size = plane-gamma_size;
+   plane_resp-gamma_size = 0;
 
/*
 * This ioctl is called twice, once to determine how much space is
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index adb3f9b..e11c6bc 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -654,11 +654,7 @@ struct drm_plane_funcs {
  * @format_count: number of formats supported
  * @crtc: currently bound CRTC
  * @fb: currently bound fb
- * @gamma_size: size of gamma table
- * @gamma_store: gamma correction table
- * @enabled: enabled flag
  * @funcs: helper functions
- * @helper_private: storage for drver layer
  * @properties: property tracking for this plane
  */
 struct drm_plane {
@@ -674,14 +670,7 @@ struct drm_plane {
struct drm_crtc *crtc;
struct drm_framebuffer *fb;
 
-   /* CRTC gamma size for reporting to userspace */
-   uint32_t gamma_size;
-   uint16_t *gamma_store;
-
-   bool enabled;
-
const struct drm_plane_funcs *funcs;
-   void *helper_private;
 
struct drm_object_properties properties;
 };
-- 
1.8.1.5

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


Re: [PATCH v2] drm: Add fb_helper-restore_fbdev_mode hook

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 04:39:58PM +0300, ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 Drivers may need to turn off overlay planes, cursors, etc. when
 restoring the fbdev mode. So allow drivers to provide their own
 version of drm_fb_helper_restore_fbdev_mode() that can take care
 of such details.
 
 Initially just plug in drm_fb_helper_restore_fbdev_mode for all
 drivers.
 
 v2: Add kernel-doc for the new hook

And naturally I forgot to mention that this now depends on the
[PATCH 0/3] drm: kernel-doc fixes set I just posted.


-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm: Remove some unused stuff from drm_plane

2013-05-08 Thread Laurent Pinchart
On Wednesday 08 May 2013 16:40:54 ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 There's a bunch of unused members inside drm_plane, bloating the size of
 the structure needlessly. Eliminate them.
 
 v2: Remove all of it from kernel-doc too
 
 Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com

Reviewed-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  drivers/gpu/drm/drm_crtc.c |  2 +-
  include/drm/drm_crtc.h | 11 ---
  2 files changed, 1 insertion(+), 12 deletions(-)
 
 diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
 index d7c449f..e591914 100644
 --- a/drivers/gpu/drm/drm_crtc.c
 +++ b/drivers/gpu/drm/drm_crtc.c
 @@ -1739,7 +1739,7 @@ int drm_mode_getplane(struct drm_device *dev, void
 *data,
 
   plane_resp-plane_id = plane-base.id;
   plane_resp-possible_crtcs = plane-possible_crtcs;
 - plane_resp-gamma_size = plane-gamma_size;
 + plane_resp-gamma_size = 0;
 
   /*
* This ioctl is called twice, once to determine how much space is
 diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
 index adb3f9b..e11c6bc 100644
 --- a/include/drm/drm_crtc.h
 +++ b/include/drm/drm_crtc.h
 @@ -654,11 +654,7 @@ struct drm_plane_funcs {
   * @format_count: number of formats supported
   * @crtc: currently bound CRTC
   * @fb: currently bound fb
 - * @gamma_size: size of gamma table
 - * @gamma_store: gamma correction table
 - * @enabled: enabled flag
   * @funcs: helper functions
 - * @helper_private: storage for drver layer
   * @properties: property tracking for this plane
   */
  struct drm_plane {
 @@ -674,14 +670,7 @@ struct drm_plane {
   struct drm_crtc *crtc;
   struct drm_framebuffer *fb;
 
 - /* CRTC gamma size for reporting to userspace */
 - uint32_t gamma_size;
 - uint16_t *gamma_store;
 -
 - bool enabled;
 -
   const struct drm_plane_funcs *funcs;
 - void *helper_private;
 
   struct drm_object_properties properties;
  };
-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v2] drm: Add fb_helper-restore_fbdev_mode hook

2013-05-08 Thread Laurent Pinchart
On Wednesday 08 May 2013 16:39:58 ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 Drivers may need to turn off overlay planes, cursors, etc. when
 restoring the fbdev mode. So allow drivers to provide their own
 version of drm_fb_helper_restore_fbdev_mode() that can take care
 of such details.
 
 Initially just plug in drm_fb_helper_restore_fbdev_mode for all
 drivers.
 
 v2: Add kernel-doc for the new hook
 
 Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com

Reviewed-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  drivers/gpu/drm/ast/ast_fb.c  | 1 +
  drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
  drivers/gpu/drm/drm_fb_cma_helper.c   | 1 +
  drivers/gpu/drm/drm_fb_helper.c   | 2 +-
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 1 +
  drivers/gpu/drm/gma500/framebuffer.c  | 1 +
  drivers/gpu/drm/i915/intel_fb.c   | 1 +
  drivers/gpu/drm/mgag200/mgag200_fb.c  | 1 +
  drivers/gpu/drm/nouveau/nouveau_fbcon.c   | 1 +
  drivers/gpu/drm/omapdrm/omap_fbdev.c  | 1 +
  drivers/gpu/drm/qxl/qxl_fb.c  | 1 +
  drivers/gpu/drm/radeon/radeon_fb.c| 1 +
  drivers/gpu/drm/udl/udl_fb.c  | 1 +
  include/drm/drm_fb_helper.h   | 2 ++
  14 files changed, 15 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
 index 34931fe..2c1f469 100644
 --- a/drivers/gpu/drm/ast/ast_fb.c
 +++ b/drivers/gpu/drm/ast/ast_fb.c
 @@ -254,6 +254,7 @@ static struct drm_fb_helper_funcs ast_fb_helper_funcs =
 { .gamma_set = ast_fb_gamma_set,
   .gamma_get = ast_fb_gamma_get,
   .fb_probe = astfb_create,
 + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
  };
 
  static void ast_fbdev_destroy(struct drm_device *dev,
 diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
 b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index e25afcc..ee48a21 100644
 --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
 +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
 @@ -253,6 +253,7 @@ static struct drm_fb_helper_funcs cirrus_fb_helper_funcs
 = { .gamma_set = cirrus_crtc_fb_gamma_set,
   .gamma_get = cirrus_crtc_fb_gamma_get,
   .fb_probe = cirrusfb_create,
 + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
  };
 
  int cirrus_fbdev_init(struct cirrus_device *cdev)
 diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c
 b/drivers/gpu/drm/drm_fb_cma_helper.c index 0b5af7d..f011628 100644
 --- a/drivers/gpu/drm/drm_fb_cma_helper.c
 +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
 @@ -330,6 +330,7 @@ err_drm_gem_cma_free_object:
 
  static struct drm_fb_helper_funcs drm_fb_cma_helper_funcs = {
   .fb_probe = drm_fbdev_cma_create,
 + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
  };
 
  /**
 diff --git a/drivers/gpu/drm/drm_fb_helper.c
 b/drivers/gpu/drm/drm_fb_helper.c index b78cbe7..02c70b2 100644
 --- a/drivers/gpu/drm/drm_fb_helper.c
 +++ b/drivers/gpu/drm/drm_fb_helper.c
 @@ -315,7 +315,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
   if (helper-dev-switch_power_state == DRM_SWITCH_POWER_OFF)
   continue;
 
 - ret = drm_fb_helper_restore_fbdev_mode(helper);
 + ret = helper-funcs-restore_fbdev_mode(helper);
   if (ret)
   error = true;
   }
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
 b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 68f0045..6ed4065 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
 @@ -228,6 +228,7 @@ out:
 
  static struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
   .fb_probe = exynos_drm_fbdev_create,
 + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
  };
 
  int exynos_drm_fbdev_init(struct drm_device *dev)
 diff --git a/drivers/gpu/drm/gma500/framebuffer.c
 b/drivers/gpu/drm/gma500/framebuffer.c index 1534e22..8d7f9c0 100644
 --- a/drivers/gpu/drm/gma500/framebuffer.c
 +++ b/drivers/gpu/drm/gma500/framebuffer.c
 @@ -567,6 +567,7 @@ static struct drm_fb_helper_funcs psb_fb_helper_funcs =
 { .gamma_set = psbfb_gamma_set,
   .gamma_get = psbfb_gamma_get,
   .fb_probe = psbfb_probe,
 + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
  };
 
  static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev
 *fbdev) diff --git a/drivers/gpu/drm/i915/intel_fb.c
 b/drivers/gpu/drm/i915/intel_fb.c index 0e19e57..a04481f 100644
 --- a/drivers/gpu/drm/i915/intel_fb.c
 +++ b/drivers/gpu/drm/i915/intel_fb.c
 @@ -187,6 +187,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs
 = { .gamma_set = intel_crtc_fb_gamma_set,
   .gamma_get = intel_crtc_fb_gamma_get,
   .fb_probe = intelfb_create,
 + .restore_fbdev_mode = drm_fb_helper_restore_fbdev_mode,
  };
 
  static void intel_fbdev_destroy(struct drm_device *dev,
 diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c
 

Re: [Intel-gfx] [PATCH 3/3] drm: Fix drm_rect documentation

2013-05-08 Thread Daniel Vetter
On Wed, May 08, 2013 at 04:38:35PM +0300, ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 The 'struct' keyword was missing so struct drm_rect documentation never
 ended up in the generated docs.
 
 Also reorder drm_rect.h to become before drm_rect.c so that the struct
 documentation appears first in the docs. And change it to use the 'I'
 directive instead of 'F' while we're at it.
 
 Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
 ---
  Documentation/DocBook/drm.tmpl | 2 +-
  include/drm/drm_rect.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
 index 7c7af25..89b6faa 100644
 --- a/Documentation/DocBook/drm.tmpl
 +++ b/Documentation/DocBook/drm.tmpl
 @@ -1653,8 +1653,8 @@ void intel_crt_init(struct drm_device *dev)
  sect2
titleKMS API Functions/title
  !Edrivers/gpu/drm/drm_crtc.c
 +!Iinclude/drm/drm_rect.h
  !Edrivers/gpu/drm/drm_rect.c
 -!Finclude/drm/drm_rect.h

Shameless bikeshed while at it: Can you move the drm_rect stuff to it's
own sections, like all the other kms helper stuff? Only the things in
drm_crtc.c are really core kms apis.
-Daniel

  /sect2
/sect1
  
 diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
 index 64fa265..9a98321 100644
 --- a/include/drm/drm_rect.h
 +++ b/include/drm/drm_rect.h
 @@ -25,7 +25,7 @@
  #define DRM_RECT_H
  
  /**
 - * drm_rect - two dimensional rectangle
 + * struct drm_rect - two dimensional rectangle
   * @x1: horizontal starting coordinate (inclusive)
   * @x2: horizontal ending coordinate (exclusive)
   * @y1: vertical starting coordinate (inclusive)
 -- 
 1.8.1.5
 
 ___
 Intel-gfx mailing list
 intel-...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm: Fix drm_rect documentation

2013-05-08 Thread ville . syrjala
From: Ville Syrjälä ville.syrj...@linux.intel.com

The 'struct' keyword was missing so struct drm_rect documentation never
ended up in the generated docs.

Also move the drm_rect documentations to a new section alognside the
various helper functions and add a short description about the intended
purpose of drm_rect.

v2: Move to new section and add general description

Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com
---
 Documentation/DocBook/drm.tmpl | 8 ++--
 include/drm/drm_rect.h | 9 -
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 7c7af25..91ee107 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1653,8 +1653,6 @@ void intel_crt_init(struct drm_device *dev)
 sect2
   titleKMS API Functions/title
 !Edrivers/gpu/drm/drm_crtc.c
-!Edrivers/gpu/drm/drm_rect.c
-!Finclude/drm/drm_rect.h
 /sect2
   /sect1
 
@@ -2163,6 +2161,12 @@ void intel_crt_init(struct drm_device *dev)
   titleEDID Helper Functions Reference/title
 !Edrivers/gpu/drm/drm_edid.c
 /sect2
+sect2
+  titleRectangle Utilities Reference/title
+!Pinclude/drm/drm_rect.h rect utils
+!Iinclude/drm/drm_rect.h
+!Edrivers/gpu/drm/drm_rect.c
+/sect2
   /sect1
 
   !-- Internals: vertical blanking --
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 64fa265..d128629 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -25,7 +25,14 @@
 #define DRM_RECT_H
 
 /**
- * drm_rect - two dimensional rectangle
+ * DOC: rect utils
+ *
+ * Utility functions to help manage rectangular areas for
+ * clipping, scaling, etc. calculations.
+ */
+
+/**
+ * struct drm_rect - two dimensional rectangle
  * @x1: horizontal starting coordinate (inclusive)
  * @x2: horizontal ending coordinate (exclusive)
  * @y1: vertical starting coordinate (inclusive)
-- 
1.8.1.5

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


Re: [PATCH v2] drm: Fix drm_rect documentation

2013-05-08 Thread Daniel Vetter
On Wed, May 08, 2013 at 05:16:45PM +0300, ville.syrj...@linux.intel.com wrote:
 From: Ville Syrjälä ville.syrj...@linux.intel.com
 
 The 'struct' keyword was missing so struct drm_rect documentation never
 ended up in the generated docs.
 
 Also move the drm_rect documentations to a new section alognside the
 various helper functions and add a short description about the intended
 purpose of drm_rect.
 
 v2: Move to new section and add general description
 
 Signed-off-by: Ville Syrjälä ville.syrj...@linux.intel.com

Looks neat! Reviewed-by: Daniel Vetter daniel.vet...@ffwll.ch

 ---
  Documentation/DocBook/drm.tmpl | 8 ++--
  include/drm/drm_rect.h | 9 -
  2 files changed, 14 insertions(+), 3 deletions(-)
 
 diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
 index 7c7af25..91ee107 100644
 --- a/Documentation/DocBook/drm.tmpl
 +++ b/Documentation/DocBook/drm.tmpl
 @@ -1653,8 +1653,6 @@ void intel_crt_init(struct drm_device *dev)
  sect2
titleKMS API Functions/title
  !Edrivers/gpu/drm/drm_crtc.c
 -!Edrivers/gpu/drm/drm_rect.c
 -!Finclude/drm/drm_rect.h
  /sect2
/sect1
  
 @@ -2163,6 +2161,12 @@ void intel_crt_init(struct drm_device *dev)
titleEDID Helper Functions Reference/title
  !Edrivers/gpu/drm/drm_edid.c
  /sect2
 +sect2
 +  titleRectangle Utilities Reference/title
 +!Pinclude/drm/drm_rect.h rect utils
 +!Iinclude/drm/drm_rect.h
 +!Edrivers/gpu/drm/drm_rect.c
 +/sect2
/sect1
  
!-- Internals: vertical blanking --
 diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
 index 64fa265..d128629 100644
 --- a/include/drm/drm_rect.h
 +++ b/include/drm/drm_rect.h
 @@ -25,7 +25,14 @@
  #define DRM_RECT_H
  
  /**
 - * drm_rect - two dimensional rectangle
 + * DOC: rect utils
 + *
 + * Utility functions to help manage rectangular areas for
 + * clipping, scaling, etc. calculations.
 + */
 +
 +/**
 + * struct drm_rect - two dimensional rectangle
   * @x1: horizontal starting coordinate (inclusive)
   * @x2: horizontal ending coordinate (exclusive)
   * @y1: vertical starting coordinate (inclusive)
 -- 
 1.8.1.5
 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Some lost drm patches

2013-05-08 Thread Damien Lespiau
I just collected a few sad patches crying in the dark alley of the Internet
that dri-devel can sometimes be. A few of them even have a r-b tag by
benevolent and fatherly figures. All they want is to find a new home!

-- 
Damien

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


[PATCH 1/5] drm: Add missing break in the command line mode parsing code

2013-05-08 Thread Damien Lespiau
As we parse the string given on the command line one char at a time, it
seems that we do want a break at every case.

Signed-off-by: Damien Lespiau damien.lesp...@intel.com
Reviewed-by: Rodrigo Vivi rodrigo.v...@gmail.com
---
 drivers/gpu/drm/drm_modes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 04fa6f1..b1d4836 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1123,6 +1123,7 @@ bool drm_mode_parse_command_line_for_connector(const char 
*mode_option,
was_digit = false;
} else
goto done;
+   break;
case '0' ... '9':
was_digit = true;
break;
-- 
1.8.1.4

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


[PATCH 2/5] drm: Make the HPD status updates debug logs more readable

2013-05-08 Thread Damien Lespiau
Instead of just printing status updated from 1 to 2, make those enum
numbers immediately readable.

v2: Also patch output_poll_execute() (Daniel Vetter)

Signed-off-by: Damien Lespiau damien.lesp...@intel.com
Reviewed-by: Jesse Barnes jbar...@virtuousgeek.org
---
 drivers/gpu/drm/drm_crtc_helper.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 7b2d378..8976eb6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
 
+static const char *connector_status_str(enum drm_connector_status status)
+{
+   switch (status) {
+   case connector_status_connected:
+   return connected;
+   case connector_status_disconnected:
+   return disconnected;
+   default:
+   return unknown;
+   }
+}
+
 #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
 static void output_poll_execute(struct work_struct *work)
 {
@@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct 
*work)
continue;
 
connector-status = connector-funcs-detect(connector, false);
-   DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %d to 
%d\n,
+   DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %s to 
%s\n,
  connector-base.id,
  drm_get_connector_name(connector),
- old_status, connector-status);
+ connector_status_str(old_status),
+ connector_status_str(connector-status));
if (old_status != connector-status)
changed = true;
}
@@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
old_status = connector-status;
 
connector-status = connector-funcs-detect(connector, false);
-   DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %d to 
%d\n,
+   DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %s to 
%s\n,
  connector-base.id,
  drm_get_connector_name(connector),
- old_status, connector-status);
+ connector_status_str(old_status),
+ connector_status_str(connector-status));
if (old_status != connector-status)
changed = true;
}
-- 
1.8.1.4

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


[PATCH 3/5] drm: Don't prune modes loudly when a connector is disconnected

2013-05-08 Thread Damien Lespiau
drm_helper_probe_single_connector_modes() is responsible for pruning the
previously detected modes on a disconnected connector. We don't really
need to log, again, the full list of modes that used to be valid when
connected.

Signed-off-by: Damien Lespiau damien.lesp...@intel.com
---
 drivers/gpu/drm/drm_crtc_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 8976eb6..4fea4a3 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -121,6 +121,7 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
connector-helper_private;
int count = 0;
int mode_flags = 0;
+   bool verbose_prune = true;
 
DRM_DEBUG_KMS([CONNECTOR:%d:%s]\n, connector-base.id,
drm_get_connector_name(connector));
@@ -149,6 +150,7 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
DRM_DEBUG_KMS([CONNECTOR:%d:%s] disconnected\n,
connector-base.id, drm_get_connector_name(connector));
drm_mode_connector_update_edid_property(connector, NULL);
+   verbose_prune = false;
goto prune;
}
 
@@ -182,7 +184,7 @@ int drm_helper_probe_single_connector_modes(struct 
drm_connector *connector,
}
 
 prune:
-   drm_mode_prune_invalid(dev, connector-modes, true);
+   drm_mode_prune_invalid(dev, connector-modes, verbose_prune);
 
if (list_empty(connector-modes))
return 0;
-- 
1.8.1.4

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


[PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation

2013-05-08 Thread Damien Lespiau
From: Lespiau, Damien damien.lesp...@intel.com

Signed-off-by: Damien Lespiau damien.lesp...@intel.com
---
 include/drm/drm_crtc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e3e0d65..23fb185 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -660,7 +660,7 @@ struct drm_plane_funcs {
  * @gamma_store: gamma correction table
  * @enabled: enabled flag
  * @funcs: helper functions
- * @helper_private: storage for drver layer
+ * @helper_private: storage for driver layer
  * @properties: property tracking for this plane
  */
 struct drm_plane {
-- 
1.8.1.4

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


[PATCH 5/5] drm: Use names of ioctls in debug traces

2013-05-08 Thread Damien Lespiau
From: Chris Cummins christopher.e.cumm...@intel.com

The intention here is to make the output of dmesg with full verbosity a
bit easier for a human to parse. This commit transforms:

[drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
[drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
[drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

into:

[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
[drm:drm_mode_addfb], [FB:32]
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
[drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
[drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
[drm:intel_crtc_set_config], [CRTC:3] [NOFB]

Signed-off-by: Chris Cummins christopher.e.cumm...@intel.com
---
 drivers/gpu/drm/drm_drv.c | 20 +---
 include/drm/drmP.h|  3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 25f91cd..0382f6e 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
   struct drm_file *file_priv);
 
 #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
-   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
.cmd_drv = 0}
+   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
.cmd_drv = 0, .name = #ioctl}
 
 /** Ioctl table */
 static struct drm_ioctl_desc drm_ioctls[] = {
@@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
 {
struct drm_file *file_priv = filp-private_data;
struct drm_device *dev;
-   struct drm_ioctl_desc *ioctl;
+   struct drm_ioctl_desc *ioctl = NULL;
drm_ioctl_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd);
int retcode = -EINVAL;
@@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
atomic_inc(dev-counts[_DRM_STAT_IOCTLS]);
++file_priv-ioctl_count;
 
-   DRM_DEBUG(pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n,
- task_pid_nr(current), cmd, nr,
- (long)old_encode_dev(file_priv-minor-device),
- file_priv-authenticated);
-
if ((nr = DRM_CORE_IOCTL_COUNT) 
((nr  DRM_COMMAND_BASE) || (nr = DRM_COMMAND_END)))
goto err_i1;
@@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
} else
goto err_i1;
 
+   DRM_DEBUG(pid=%d, dev=0x%lx, auth=%d, %s\n,
+ task_pid_nr(current),
+ (long)old_encode_dev(file_priv-minor-device),
+ file_priv-authenticated, ioctl-name);
+
/* Do not trust userspace, use our own definition */
func = ioctl-func;
/* is there a local override? */
@@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
}
 
   err_i1:
+   if (!ioctl)
+   DRM_DEBUG(invalid iotcl: pid=%d, dev=0x%lx, auth=%d, 
cmd=0x%02x, nr=0x%02x\n,
+ task_pid_nr(current),
+ (long)old_encode_dev(file_priv-minor-device),
+ file_priv-authenticated, cmd, nr);
+
if (kdata != stack_kdata)
kfree(kdata);
atomic_dec(dev-ioctl_count);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2d94d74..379787c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -316,6 +316,7 @@ struct drm_ioctl_desc {
int flags;
drm_ioctl_t *func;
unsigned int cmd_drv;
+   const char *name;
 };
 
 /**
@@ -324,7 +325,7 @@ struct drm_ioctl_desc {
  */
 
 #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)\
-   [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, 
.flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl}
+   [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, 
.flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
 
 struct drm_magic_entry {
struct list_head head;
-- 
1.8.1.4

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


Re: [PATCH 2/5] drm: Make the HPD status updates debug logs more readable

2013-05-08 Thread Chris Wilson
On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
 
 Instead of just printing status updated from 1 to 2, make those enum
 numbers immediately readable.
 
 v2: Also patch output_poll_execute() (Daniel Vetter)

For bonus points, only emit the message when it is updated.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel



Re: [PATCH 2/5] drm: Make the HPD status updates debug logs more readable

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 05:03:31PM +0100, Damien Lespiau wrote:
 Instead of just printing status updated from 1 to 2, make those enum
 numbers immediately readable.
 
 v2: Also patch output_poll_execute() (Daniel Vetter)
 
 Signed-off-by: Damien Lespiau damien.lesp...@intel.com
 Reviewed-by: Jesse Barnes jbar...@virtuousgeek.org
 ---
  drivers/gpu/drm/drm_crtc_helper.c | 22 ++
  1 file changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
 b/drivers/gpu/drm/drm_crtc_helper.c
 index 7b2d378..8976eb6 100644
 --- a/drivers/gpu/drm/drm_crtc_helper.c
 +++ b/drivers/gpu/drm/drm_crtc_helper.c
 @@ -968,6 +968,18 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev)
  }
  EXPORT_SYMBOL(drm_kms_helper_hotplug_event);
  
 +static const char *connector_status_str(enum drm_connector_status status)
 +{
 + switch (status) {
 + case connector_status_connected:
 + return connected;
 + case connector_status_disconnected:
 + return disconnected;
 + default:
 + return unknown;
 + }
 +}

drm_get_connector_status_name()

 +
  #define DRM_OUTPUT_POLL_PERIOD (10*HZ)
  static void output_poll_execute(struct work_struct *work)
  {
 @@ -1002,10 +1014,11 @@ static void output_poll_execute(struct work_struct 
 *work)
   continue;
  
   connector-status = connector-funcs-detect(connector, false);
 - DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %d to 
 %d\n,
 + DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %s to 
 %s\n,
 connector-base.id,
 drm_get_connector_name(connector),
 -   old_status, connector-status);
 +   connector_status_str(old_status),
 +   connector_status_str(connector-status));
   if (old_status != connector-status)
   changed = true;
   }
 @@ -1080,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
   old_status = connector-status;
  
   connector-status = connector-funcs-detect(connector, false);
 - DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %d to 
 %d\n,
 + DRM_DEBUG_KMS([CONNECTOR:%d:%s] status updated from %s to 
 %s\n,
 connector-base.id,
 drm_get_connector_name(connector),
 -   old_status, connector-status);
 +   connector_status_str(old_status),
 +   connector_status_str(connector-status));
   if (old_status != connector-status)
   changed = true;
   }
 -- 
 1.8.1.4
 
 ___
 dri-devel mailing list
 dri-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH 4/5] drm: Fix a typo in the struct drm_plane_funcs documentation

2013-05-08 Thread Ville Syrjälä
On Wed, May 08, 2013 at 05:03:33PM +0100, Damien Lespiau wrote:
 From: Lespiau, Damien damien.lesp...@intel.com
 
 Signed-off-by: Damien Lespiau damien.lesp...@intel.com
 ---
  include/drm/drm_crtc.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
 index e3e0d65..23fb185 100644
 --- a/include/drm/drm_crtc.h
 +++ b/include/drm/drm_crtc.h
 @@ -660,7 +660,7 @@ struct drm_plane_funcs {
   * @gamma_store: gamma correction table
   * @enabled: enabled flag
   * @funcs: helper functions
 - * @helper_private: storage for drver layer
 + * @helper_private: storage for driver layer

I just killed this guy. Well, assuming my patch gets accepted.

   * @properties: property tracking for this plane
   */
  struct drm_plane {
 -- 
 1.8.1.4
 
 ___
 Intel-gfx mailing list
 intel-...@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/radeon: fix UPLL_REF_DIV_MASK definition

2013-05-08 Thread Paul Menzel
Dear Christian,


Am Montag, den 29.04.2013, 10:20 +0200 schrieb Christian König:
 From: Christian König christian.koe...@amd.com
 
 Stupid copy  paste error over all generations.

does this fix an error or was this found just by reading the code? Could
please you add such information to commit message in the future? That
would be awesome.

[…]


Thanks,

Paul

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


Re: [PATCH] drm: refactor call to request_module

2013-05-08 Thread Kees Cook
On Wed, May 8, 2013 at 12:22 AM, Paul Menzel
paulepan...@users.sourceforge.net wrote:
 Am Dienstag, den 07.05.2013, 12:32 -0700 schrieb Kees Cook:
 This reduces the size of the stack frame when calling request_module().
 Performing the sprintf before the call is not needed.

 Good fine. Do you have any hard numbers for the record?

 Did you find this just by reading the code or are there any problems
 with stack sizes on some systems?

 (This patch would be good alone for decreasing the number of code
 lines. ;-))

No hard numbers; I just saw it while reviewing callers to request_module(). :)

 Signed-off-by: Kees Cook keesc...@chromium.org
 ---
  drivers/gpu/drm/drm_encoder_slave.c |6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)

 Acked-by: Paul Menzel paulepan...@users.sourceforge.net

Thanks!

-Kees

--
Kees Cook
Chrome OS Security
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 63935] TURKS [drm:r600_uvd_init] *ERROR* UVD not responding, trying to reset the VCPU!!!

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

--- Comment #8 from Benjamin Lee b...@b1c1l1.com ---
I booted in Apple's BIOS emulation mode and found that UVD initializes
successfully, so the problem is limited to EFI booting (like the former video
BIOS issue).

Is there any debugging output I can provide that would help identify what is
different when EFI booting?

-- 
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: [Intel-gfx] [PATCH 5/5] drm: Use names of ioctls in debug traces

2013-05-08 Thread Ben Widawsky
On Wed, May 08, 2013 at 07:55:18PM +0300, Ville Syrjälä wrote:
 On Wed, May 08, 2013 at 05:03:34PM +0100, Damien Lespiau wrote:
  From: Chris Cummins christopher.e.cumm...@intel.com
  
  The intention here is to make the output of dmesg with full verbosity a
  bit easier for a human to parse. This commit transforms:
  
  [drm:drm_ioctl], pid=699, cmd=0x6458, nr=0x58, dev 0xe200, auth=1
  [drm:drm_ioctl], pid=699, cmd=0xc010645b, nr=0x5b, dev 0xe200, auth=1
  [drm:drm_ioctl], pid=699, cmd=0xc0106461, nr=0x61, dev 0xe200, auth=1
  [drm:drm_ioctl], pid=699, cmd=0xc01c64ae, nr=0xae, dev 0xe200, auth=1
  [drm:drm_mode_addfb], [FB:32]
  [drm:drm_ioctl], pid=699, cmd=0xc0106464, nr=0x64, dev 0xe200, auth=1
  [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
  [drm:drm_ioctl], pid=699, cmd=0x400c645f, nr=0x5f, dev 0xe200, auth=1
  [drm:drm_ioctl], pid=699, cmd=0xc00464af, nr=0xaf, dev 0xe200, auth=1
  [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
  
  into:
  
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_THROTTLE
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_CREATE
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_TILING
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, IOCTL_MODE_ADDFB
  [drm:drm_mode_addfb], [FB:32]
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_MMAP_GTT
  [drm:drm_vm_open_locked], 0x7fd9302fe000,0x00a0
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, I915_GEM_SET_DOMAIN
  [drm:drm_ioctl], pid=699, dev=0xe200, auth=1, DRM_IOCTL_MODE_RMFB
  [drm:intel_crtc_set_config], [CRTC:3] [NOFB]
 
 I like it. But I made drm_ioctls const recently so the patch needs a
 small refresh.
 
 BTW am I the only one who hates the DRM_IOCTL_DEF_DRV() macro? Thanks to
 the cpp magic it's difficult to look up the ioctls using cscope. OTOH
 with this patch looking up the numbers does become less important.

You are not the only one who hates it.

 
  Signed-off-by: Chris Cummins christopher.e.cumm...@intel.com
  ---
   drivers/gpu/drm/drm_drv.c | 20 +---
   include/drm/drmP.h|  3 ++-
   2 files changed, 15 insertions(+), 8 deletions(-)
  
  diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
  index 25f91cd..0382f6e 100644
  --- a/drivers/gpu/drm/drm_drv.c
  +++ b/drivers/gpu/drm/drm_drv.c
  @@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data,
 struct drm_file *file_priv);
   
   #define DRM_IOCTL_DEF(ioctl, _func, _flags) \
  -   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
  .cmd_drv = 0}
  +   [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, 
  .cmd_drv = 0, .name = #ioctl}
   
   /** Ioctl table */
   static struct drm_ioctl_desc drm_ioctls[] = {
  @@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp,
   {
  struct drm_file *file_priv = filp-private_data;
  struct drm_device *dev;
  -   struct drm_ioctl_desc *ioctl;
  +   struct drm_ioctl_desc *ioctl = NULL;
  drm_ioctl_t *func;
  unsigned int nr = DRM_IOCTL_NR(cmd);
  int retcode = -EINVAL;
  @@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp,
  atomic_inc(dev-counts[_DRM_STAT_IOCTLS]);
  ++file_priv-ioctl_count;
   
  -   DRM_DEBUG(pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n,
  - task_pid_nr(current), cmd, nr,
  - (long)old_encode_dev(file_priv-minor-device),
  - file_priv-authenticated);
  -
  if ((nr = DRM_CORE_IOCTL_COUNT) 
  ((nr  DRM_COMMAND_BASE) || (nr = DRM_COMMAND_END)))
  goto err_i1;
  @@ -416,6 +411,11 @@ long drm_ioctl(struct file *filp,
  } else
  goto err_i1;
   
  +   DRM_DEBUG(pid=%d, dev=0x%lx, auth=%d, %s\n,
  + task_pid_nr(current),
  + (long)old_encode_dev(file_priv-minor-device),
  + file_priv-authenticated, ioctl-name);
  +
  /* Do not trust userspace, use our own definition */
  func = ioctl-func;
  /* is there a local override? */
  @@ -470,6 +470,12 @@ long drm_ioctl(struct file *filp,
  }
   
 err_i1:
  +   if (!ioctl)
  +   DRM_DEBUG(invalid iotcl: pid=%d, dev=0x%lx, auth=%d, 
  cmd=0x%02x, nr=0x%02x\n,
  + task_pid_nr(current),
  + (long)old_encode_dev(file_priv-minor-device),
  + file_priv-authenticated, cmd, nr);
  +
  if (kdata != stack_kdata)
  kfree(kdata);
  atomic_dec(dev-ioctl_count);
  diff --git a/include/drm/drmP.h b/include/drm/drmP.h
  index 2d94d74..379787c 100644
  --- a/include/drm/drmP.h
  +++ b/include/drm/drmP.h
  @@ -316,6 +316,7 @@ struct drm_ioctl_desc {
  int flags;
  drm_ioctl_t *func;
  unsigned int cmd_drv;
  +   const char *name;
   };
   
   /**
  @@ -324,7 +325,7 @@ struct drm_ioctl_desc {
*/
   
   #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)\
  -   [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, 
  .flags = _flags, 

[Bug 57831] New: radeon fatal error during GPU init (Radeon 5850, KVM GPU passthrough)

2013-05-08 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=57831

   Summary: radeon fatal error during GPU init (Radeon 5850, KVM
GPU passthrough)
   Product: Drivers
   Version: 2.5
Kernel Version: 3.9.0
  Platform: All
OS/Version: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
AssignedTo: drivers_video-...@kernel-bugs.osdl.org
ReportedBy: luke-jr+linuxb...@utopios.org
Regression: No


Booting on a KVM instance tested to work fine with fglrx:
[3.771157] [drm] Initialized drm 1.1.0 20060810
[4.006077] [drm] radeon kernel modesetting enabled.
[4.006350] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11
[4.006714] [drm] initializing kernel modesetting (CYPRESS 0x1002:0x6899
0x1458:0x21E4).
[4.006723] [drm] register mmio base: 0xFEB8
[4.006724] [drm] register mmio size: 131072
[4.006785] radeon :00:05.0: Expecting atombios for evergreen GPU
[4.006786] radeon :00:05.0: Fatal error during GPU init
[4.006789] [drm] radeon: finishing device.
[4.006792] [TTM] Memory type 2 has not been initialized
[4.008077] radeon: probe of :00:05.0 failed with error -22

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] qxl: fix bug with object eviction and update area

2013-05-08 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

if the surface is evicted, this validation will happen
to the wrong place, I noticed this with other work I was
doing, haven't seen it go wrong in practice.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 drivers/gpu/drm/qxl/qxl_ioctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index 04b64f9..6db7370 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -294,6 +294,7 @@ static int qxl_update_area_ioctl(struct drm_device *dev, 
void *data,
goto out;
 
if (!qobj-pin_count) {
+   qxl_ttm_placement_from_domain(qobj, qobj-type);
ret = ttm_bo_validate(qobj-tbo, qobj-placement,
  true, false);
if (unlikely(ret))
-- 
1.8.2.1

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


[Bug 64376] New: radeon fatal error during GPU init (Radeon 5850, KVM GPU passthrough)

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

  Priority: medium
Bug ID: 64376
  Assignee: dri-devel@lists.freedesktop.org
   Summary: radeon fatal error during GPU init (Radeon 5850, KVM
GPU passthrough)
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: luke-jr+freedesktopb...@utopios.org
  Hardware: Other
Status: NEW
   Version: XOrg CVS
 Component: DRM/Radeon
   Product: DRI

Booting on a KVM instance tested to work fine with fglrx:
[3.771157] [drm] Initialized drm 1.1.0 20060810
[4.006077] [drm] radeon kernel modesetting enabled.
[4.006350] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11
[4.006714] [drm] initializing kernel modesetting (CYPRESS 0x1002:0x6899
0x1458:0x21E4).
[4.006723] [drm] register mmio base: 0xFEB8
[4.006724] [drm] register mmio size: 131072
[4.006785] radeon :00:05.0: Expecting atombios for evergreen GPU
[4.006786] radeon :00:05.0: Fatal error during GPU init
[4.006789] [drm] radeon: finishing device.
[4.006792] [TTM] Memory type 2 has not been initialized
[4.008077] radeon: probe of :00:05.0 failed with error -22

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