Re: [Intel-gfx] [PATCH i-g-t 05/43] igt_kms: Add support for setting plane rotation

2014-07-10 Thread Chris Wilson
On Fri, Jul 11, 2014 at 08:40:29AM +0200, Daniel Vetter wrote:
> On Thu, Jul 10, 2014 at 07:00:06PM +0100, Damien Lespiau wrote:
> > +typedef enum {
> > +   /* this maps to the kernel API */
> > +   IGT_ROTATION_0   = 1 << 0,
> > +   IGT_ROTATION_90  = 1 << 1,
> > +   IGT_ROTATION_180 = 1 << 2,
> > +   IGT_ROTATION_270 = 1 << 3,
> > +} igt_rotation_t;
> 
> Should we also add the flip X/Y bits, even if we currently don't support
> this in the kernel?

Presumably there are tests in here to check the kernel rejects
unsupported combination of rotations and unknown reflections? In which,
yes.
-Chris

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


Re: [Intel-gfx] [PATCH i-g-t 05/43] igt_kms: Add support for setting plane rotation

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 07:00:06PM +0100, Damien Lespiau wrote:
> +typedef enum {
> + /* this maps to the kernel API */
> + IGT_ROTATION_0   = 1 << 0,
> + IGT_ROTATION_90  = 1 << 1,
> + IGT_ROTATION_180 = 1 << 2,
> + IGT_ROTATION_270 = 1 << 3,
> +} igt_rotation_t;

Should we also add the flip X/Y bits, even if we currently don't support
this in the kernel?
-Daniel

> +
>  #include "igt_fb.h"
>  
>  struct kmstest_connector_config {
> @@ -116,6 +124,7 @@ typedef struct {
>   unsigned int fb_changed   : 1;
>   unsigned int position_changed : 1;
>   unsigned int panning_changed  : 1;
> + unsigned int rotation_changed : 1;
>   /*
>* drm_plane can be NULL for primary and cursor planes (when not
>* using the atomic modeset API)
> @@ -129,6 +138,7 @@ typedef struct {
>   int crtc_x, crtc_y;
>   /* panning offset within the fb */
>   unsigned int pan_x, pan_y;
> + igt_rotation_t rotation;
>  } igt_plane_t;
>  
>  struct igt_pipe {
> @@ -184,6 +194,7 @@ static inline bool 
> igt_plane_supports_rotation(igt_plane_t *plane)
>  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>  void igt_plane_set_position(igt_plane_t *plane, int x, int y);
>  void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
> +void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
>  
>  void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
>  
> -- 
> 1.8.3.1
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t 05/43] igt_kms: Add support for setting plane rotation

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 07:00:06PM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau 
> ---
>  lib/igt_kms.c | 54 ++
>  lib/igt_kms.h | 11 +++
>  2 files changed, 65 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 87f5109..69f9977 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -537,6 +537,16 @@ get_plane_property(igt_display_t *display, uint32_t 
> plane_id, const char *name,
>   name, prop_id, value);
>  }
>  
> +static void
> +igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
> +{
> + igt_pipe_t *pipe = plane->pipe;
> + igt_display_t *display = pipe->display;
> +
> + drmModeObjectSetProperty(display->drm_fd, plane->drm_plane->plane_id,
> +  DRM_MODE_OBJECT_PLANE, prop_id, value);
> +}

I wonder whether we shouldn't have interfaces using the property names and
maybe for enum properties also the strings and let igt do it's thing. But
as long as this is just an internal function it should be good enough.
-Daniel

> +
>  /*
>   * Walk a plane's property list to determine its type.  If we don't
>   * find a type property, then the kernel doesn't support universal
> @@ -882,6 +892,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
>  
>   igt_assert(plane->drm_plane);
>  
> + /* it's an error to try an unsupported feature */
> + igt_assert(igt_plane_supports_rotation(plane) ||
> +!plane->rotation_changed);
> +
>   fb_id = igt_plane_get_fb_id(plane);
>   crtc_id = output->config.crtc->crtc_id;
>  
> @@ -931,6 +945,14 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
>  
>   plane->fb_changed = false;
>   plane->position_changed = false;
> +
> + if (plane->rotation_changed) {
> + igt_plane_set_property(plane, plane->rotation_property,
> +plane->rotation);
> +
> + plane->rotation_changed = false;
> + }
> +
>   return 0;
>  }
>  
> @@ -1013,6 +1035,9 @@ static int igt_primary_plane_commit_legacy(igt_plane_t 
> *primary,
>   /* Primary planes can't be windowed when using a legacy commit */
>   igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
>  
> + /* nor rotated */
> + igt_assert(!primary->rotation_changed);
> +
>   if (!primary->fb_changed && !primary->position_changed &&
>   !primary->panning_changed)
>   return 0;
> @@ -1304,6 +1329,35 @@ void igt_plane_set_panning(igt_plane_t *plane, int x, 
> int y)
>   plane->panning_changed = true;
>  }
>  
> +static const char *rotation_name(igt_rotation_t rotation)
> +{
> + switch (rotation) {
> + case IGT_ROTATION_0:
> + return "0°";
> + case IGT_ROTATION_90:
> + return "90°";
> + case IGT_ROTATION_180:
> + return "180°";
> + case IGT_ROTATION_270:
> + return "270°";
> + default:
> + igt_assert(0);
> + }
> +}
> +
> +void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
> +{
> + igt_pipe_t *pipe = plane->pipe;
> + igt_display_t *display = pipe->display;
> +
> + LOG(display, "%c.%d: plane_set_rotation(%s)\n", pipe_name(pipe->pipe),
> + plane->index, rotation_name(rotation));
> +
> + plane->rotation = rotation;
> +
> + plane->rotation_changed = true;
> +}
> +
>  void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
>  {
>   drmVBlank wait_vbl;
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 4f3474e..d34bcee 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -71,6 +71,14 @@ enum igt_commit_style {
>   /* We'll add atomic here eventually. */
>  };
>  
> +typedef enum {
> + /* this maps to the kernel API */
> + IGT_ROTATION_0   = 1 << 0,
> + IGT_ROTATION_90  = 1 << 1,
> + IGT_ROTATION_180 = 1 << 2,
> + IGT_ROTATION_270 = 1 << 3,
> +} igt_rotation_t;
> +
>  #include "igt_fb.h"
>  
>  struct kmstest_connector_config {
> @@ -116,6 +124,7 @@ typedef struct {
>   unsigned int fb_changed   : 1;
>   unsigned int position_changed : 1;
>   unsigned int panning_changed  : 1;
> + unsigned int rotation_changed : 1;
>   /*
>* drm_plane can be NULL for primary and cursor planes (when not
>* using the atomic modeset API)
> @@ -129,6 +138,7 @@ typedef struct {
>   int crtc_x, crtc_y;
>   /* panning offset within the fb */
>   unsigned int pan_x, pan_y;
> + igt_rotation_t rotation;
>  } igt_plane_t;
>  
>  struct igt_pipe {
> @@ -184,6 +194,7 @@ static inline bool 
> igt_plane_supports_rotation(igt_plane_t *plane)
>  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>  void igt_plane_set_position(igt_plane_t *plane, int x, int y);
>  void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
> +void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
>  
>  void igt_wa

Re: [Intel-gfx] [PATCH i-g-t 02/43] igt_kms: Make has_universal_planes a bitfield

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 07:00:03PM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau 
> ---
>  lib/igt_kms.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index a079fc2..058114a 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -153,7 +153,7 @@ struct igt_display {
>   unsigned long pipes_in_use;
>   igt_output_t *outputs;
>   igt_pipe_t pipes[I915_MAX_PIPES];
> - bool has_universal_planes;
> + unsigned int has_universal_planes : 1;

tbh I didn't see the point of this and didn't see any follow-up patch
which would explain the motivation ...
-Daniel

>  };
>  
>  /* set vt into graphics mode, required to prevent fbcon from interfering */
> -- 
> 1.8.3.1
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Make the device_info structure __initconst

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 10:47:21PM +0100, Damien Lespiau wrote:
> On Thu, Jul 10, 2014 at 10:25:27PM +0200, Daniel Vetter wrote:
> > On Thu, Jul 10, 2014 at 02:52:42PM +0100, Damien Lespiau wrote:
> > > We don't need them past the module initialization as the correct
> > > structure is copied into dev_priv in ->load(), called from
> > > drm_pci_init(), called from the module init funtion.
> > > 
> > > I'm always hesitant about adding new members to struct intel_device_info
> > > because it will add 30+ * sizeof(member) bytes to the driver. However,
> > > if we can discard those table after init(), it changes everything.
> > > 
> > > After this change, the driver has a new .init.rodata section contains
> > > the structures in question and .rodata has now 2848 fewer bytes.
> > > 
> > > lsmod shows -5425 bytes in its size field between before and after this
> > > change. Not too sure why this (Vs the 2848 bytes lost in .rodata), but
> > > that's enough for me.
> > > 
> > > Signed-off-by: Damien Lespiau 
> > 
> > You want devinintconst which is being phased out afaik ... Currently the
> > driver gets probed synchronously but you kinda never know what the device
> > core people are up to:
> > - init = removed after the module is loaded.
> > - devinit = removed after the driver is initilialized, and never for
> >   CONFIG_HOTPLUG=y.
> > 
> > If we want to trim down the size of our driver, especially on specific
> > platforms we imo should have a) link time optimization b) some
> > heavy-handed macro to return a static device info c) a much more clever
> > gcc since last time I've tried this it failed to kick out large swats of
> > code like all the dvo crap. Despite that it was clearly unreachable :(
> 
> Sigh, I followed the !DRIVER_MODESET code path, I am very sad now.
> 
> I was thinking about having a Kconfig option to select a specific
> platform to compile the driver for and, by trying to make that work, we
> could end up with a nice per-platform split of the code. Would people be
> totally opposed to such a thing?

Not opposed if we're going to sign up the compiler for the resulting dce.
If it'll result in #ifdef hell then no.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [RFC][PATCH] gpu:drm:i915:intel_detect_pch: back to check devfn instead of check class type

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 09:08:24PM +, Tian, Kevin wrote:
> actually I'm curious whether it's still necessary to __detect__ PCH. Could
> we assume a 1:1 mapping between GPU and PCH, e.g. BDW already hard
> code the knowledge:
> 
>   } else if (IS_BROADWELL(dev)) {
>   dev_priv->pch_type = PCH_LPT;
>   dev_priv->pch_id =
>   INTEL_PCH_LPT_LP_DEVICE_ID_TYPE;
>   DRM_DEBUG_KMS("This is Broadwell, assuming "
> "LynxPoint LP PCH\n");
> 
> Or if there is real usage on non-fixed mapping (not majority), could it be a 
> better option to have fixed mapping as a fallback instead of leaving as 
> PCH_NONE? Then even when Qemu doesn't provide a special tweaked PCH,
> the majority case just works.

I guess we can do it, at least I haven't seen any strange combinations in
the wild outside of Intel ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] startx on Fedora died today

2014-07-10 Thread Chris Wilson
On Thu, Jul 10, 2014 at 09:09:31PM -0400, Felix Miata wrote:
> F21 branched off Rawhide over recent hours. On i945G host gx62b I
> cloned first, then upgraded one to current F21 state and the other
> to Rawhide. Before today's upgrade, which moved server from
> 1.15.99.903 to 1.15.99.904 on both, and kernel from rc4git0.1 to
> rc4git2.1, booting first to multi-user, startx was working normally.
> Now it won't[1], though X (KDM/KDE) does work by booting to
> graphical instead of multi-user[2].
> 
> Is this an already known driver problem? Server? Kernel?

The difference being when it crashed it tried to open the logind fd. This
is a server bug - it looks like the recent non-pci platform device
conflicts with the systemd integration.
-Chris
 
> [1] http://fm.no-ip.com/Tmp/Linux/F/Xorg.0.log-fc21-3
> [2] http://fm.no-ip.com/Tmp/Linux/F/Xorg.0.log-fc21-5

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


Re: [Intel-gfx] [PATCH v2] drm/i915/bdw: BDW Software Turbo

2014-07-10 Thread Chris Wilson
On Thu, Jul 10, 2014 at 07:39:32PM -0700, Sun, Daisy wrote:
> 
> This Software turbo will mainly take place of the hardware driven
> interrupt part without touching the boost/idle strategy.
> So gen6_rps_boost and gen6_rps_idle will still function for BDW.

You still are not addressing that your function is either called at a
random time, and more often than not, never. You also disabled the
set_rps paths which would have disabled boost and idle.
-Chris

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


Re: [Intel-gfx] [PATCH v2] drm/i915/bdw: BDW Software Turbo

2014-07-10 Thread Sun, Daisy


This Software turbo will mainly take place of the hardware driven 
interrupt part without touching the boost/idle strategy.

So gen6_rps_boost and gen6_rps_idle will still function for BDW.

I can revise the commit message to clarify.

On 7/10/2014 12:07 PM, Chris Wilson wrote:

On Thu, Jul 10, 2014 at 11:42:59AM -0700, Sun, Daisy wrote:

GT is not going to run at a single frequency all the time actually.
It starts from a single frequency, and then will dynamically adjust
according to the GT utilization, either go up or down.
 From this perspective, SW turbo function the same as the HW turbo.

Urm, read your code again.


For the algorithm, we did go over the design forum before implementation.
What kind of improvement is expected? Please let me know if any
important case is not taken into account. Thanks.

You have no faststart or boost strategy, so typical desktop usage will
feel very laggy. For a large number of use cases you never change
freequency.
-Chris



___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] startx on Fedora died today

2014-07-10 Thread Felix Miata
F21 branched off Rawhide over recent hours. On i945G host gx62b I cloned 
first, then upgraded one to current F21 state and the other to Rawhide. 
Before today's upgrade, which moved server from 1.15.99.903 to 1.15.99.904 on 
both, and kernel from rc4git0.1 to rc4git2.1, booting first to multi-user, 
startx was working normally. Now it won't[1], though X (KDM/KDE) does work by 
booting to graphical instead of multi-user[2].


Is this an already known driver problem? Server? Kernel?

[1] http://fm.no-ip.com/Tmp/Linux/F/Xorg.0.log-fc21-3
[2] http://fm.no-ip.com/Tmp/Linux/F/Xorg.0.log-fc21-5
--
"The wise are known for their understanding, and pleasant
words are persuasive." Proverbs 16:21 (New Living Translation)

 Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata  ***  http://fm.no-ip.com/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Make the device_info structure __initconst

2014-07-10 Thread Damien Lespiau
On Thu, Jul 10, 2014 at 10:25:27PM +0200, Daniel Vetter wrote:
> On Thu, Jul 10, 2014 at 02:52:42PM +0100, Damien Lespiau wrote:
> > We don't need them past the module initialization as the correct
> > structure is copied into dev_priv in ->load(), called from
> > drm_pci_init(), called from the module init funtion.
> > 
> > I'm always hesitant about adding new members to struct intel_device_info
> > because it will add 30+ * sizeof(member) bytes to the driver. However,
> > if we can discard those table after init(), it changes everything.
> > 
> > After this change, the driver has a new .init.rodata section contains
> > the structures in question and .rodata has now 2848 fewer bytes.
> > 
> > lsmod shows -5425 bytes in its size field between before and after this
> > change. Not too sure why this (Vs the 2848 bytes lost in .rodata), but
> > that's enough for me.
> > 
> > Signed-off-by: Damien Lespiau 
> 
> You want devinintconst which is being phased out afaik ... Currently the
> driver gets probed synchronously but you kinda never know what the device
> core people are up to:
> - init = removed after the module is loaded.
> - devinit = removed after the driver is initilialized, and never for
>   CONFIG_HOTPLUG=y.
> 
> If we want to trim down the size of our driver, especially on specific
> platforms we imo should have a) link time optimization b) some
> heavy-handed macro to return a static device info c) a much more clever
> gcc since last time I've tried this it failed to kick out large swats of
> code like all the dvo crap. Despite that it was clearly unreachable :(

Sigh, I followed the !DRIVER_MODESET code path, I am very sad now.

I was thinking about having a Kconfig option to select a specific
platform to compile the driver for and, by trying to make that work, we
could end up with a nice per-platform split of the code. Would people be
totally opposed to such a thing?

-- 
Damien
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [RFC][PATCH] gpu:drm:i915:intel_detect_pch: back to check devfn instead of check class type

2014-07-10 Thread Tian, Kevin
> From: Daniel Vetter
> Sent: Monday, July 07, 2014 11:40 AM
> 
> On Mon, Jul 07, 2014 at 07:58:30PM +0200, Paolo Bonzini wrote:
> > Il 07/07/2014 19:54, Daniel Vetter ha scritto:
> > >On Mon, Jul 07, 2014 at 04:57:45PM +0200, Paolo Bonzini wrote:
> > >>Il 07/07/2014 16:49, Daniel Vetter ha scritto:
> > >>>So the correct fix to forward intel gpus to guests is indeed to somehow
> > >>>fake the pch pci ids since the driver really needs them. Gross design, 
> > >>>but
> > >>>that's how the hardware works.
> > >>
> > >>A way that could work for virtualization is this: if you find the card 
> > >>has a
> > >>magic subsystem vendor id, fetch the subsystem device id and use _that_
> as
> > >>the PCH device id.
> > >>
> > >>Would that work for you?
> > >
> > >I guess for quemu it also depends upon what windows does since we can't
> > >change that. If we care about that part. Another consideration is
> > >supporting older kernels, if that's possible at all.
> >
> > Yes, but right now it's more important to get something that's not too gross
> > for the future, for both Linux and Windows.  Hacks for existing guests can
> > be done separately, especially since they might differ between Linux (check
> > ISA bridge) and Windows (check 1f.0).
> 
> Well old Linux also checked 1f.0, so kinda the same really. As long as
> 1f.0 is an isa bridge. Wrt Windows I don't really expect them to change
> this (they're probably more focuesed on the windows hypervisor or whatever).

discussion is also on-going with Windows driver folks. Add Allen here.

> 
> In the end if the approach is ok for quemu and isn't much worse than what
> we currently have I don't mind at all about the i915.ko code. I just want
> to avoid flip-flopping around on the hack du jour like we seem to do just
> now.
> -Daniel

actually I'm curious whether it's still necessary to __detect__ PCH. Could
we assume a 1:1 mapping between GPU and PCH, e.g. BDW already hard
code the knowledge:

  } else if (IS_BROADWELL(dev)) {
  dev_priv->pch_type = PCH_LPT;
  dev_priv->pch_id =
  INTEL_PCH_LPT_LP_DEVICE_ID_TYPE;
  DRM_DEBUG_KMS("This is Broadwell, assuming "
"LynxPoint LP PCH\n");

Or if there is real usage on non-fixed mapping (not majority), could it be a 
better option to have fixed mapping as a fallback instead of leaving as 
PCH_NONE? Then even when Qemu doesn't provide a special tweaked PCH,
the majority case just works.

Thanks
Kevin
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Make the physical object coherent with GTT

2014-07-10 Thread Daniel Vetter
On Wed, Jun 11, 2014 at 12:59:51PM +0100, Chris Wilson wrote:
> Currently objects for which the hardware needs a contiguous physical
> address are allocated a shadow backing storage to satisfy the contraint.
> This shadow buffer is not wired into the normal obj->pages and so the
> physical object is incoherent with accesses via the GPU, GTT and CPU. By
> setting up the appropriate scatter-gather table, we can allow userspace
> to access the physical object via either a GTT mmaping of or by rendering
> into the GEM bo. However, keeping the CPU mmap of the shmemfs backing
> storage coherent with the contiguous shadow is not yet possible.
> Fortuituously, CPU mmaps of objects requiring physical addresses are not
> expected to be coherent anyway.
> 
> This allows the physical constraint of the GEM object to be transparent
> to userspace and allow it to efficiently render into or update them via
> the GTT and GPU.
> 
> v2: Fix leak of pci handle spotted by Ville
> v3: Remove the now duplicate call to detach_phys_object during free.
> v4: Wait for rendering before pwrite. As this patch makes it possible to
> render into the phys object, we should make it correct as well!
> 
> Signed-off-by: Chris Wilson 
> Cc: Ville Syrjälä 
> Reviewed-by: Ville Syrjälä 

So for the record I'd like to see a test for the wait_rendering in
phys_pwrite:

a) show black screen with black cursor
b) throw busy load on blitter
c) upload white cursor with blitter
d) pwrite black cursor
e) wait for blitter to finish
grab crc for a&e and compare

-Daniel

> ---
>  drivers/gpu/drm/i915/i915_dma.c |   3 +
>  drivers/gpu/drm/i915/i915_drv.h |   6 +-
>  drivers/gpu/drm/i915/i915_gem.c | 206 
> +++-
>  include/uapi/drm/i915_drm.h |   1 +
>  4 files changed, 149 insertions(+), 67 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 59e8ffe230a7..b1f072039865 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1025,6 +1025,9 @@ static int i915_getparam(struct drm_device *dev, void 
> *data,
>   case I915_PARAM_CMD_PARSER_VERSION:
>   value = i915_cmd_parser_get_version();
>   break;
> + case I915_PARAM_HAS_COHERENT_PHYS_GTT:
> + value = 1;
> + break;
>   default:
>   DRM_DEBUG("Unknown parameter %d\n", param->param);
>   return -EINVAL;
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0a9d1b85d529..c80ddcf8aa6f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1715,10 +1715,10 @@ struct drm_i915_gem_object {
>   unsigned long user_pin_count;
>   struct drm_file *pin_filp;
>  
> - /** for phy allocated objects */
> - drm_dma_handle_t *phys_handle;
> -
>   union {
> + /** for phy allocated objects */
> + drm_dma_handle_t *phys_handle;
> +
>   struct i915_gem_userptr {
>   uintptr_t ptr;
>   unsigned read_only :1;
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 25b5063388b2..f9e158261c42 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -209,40 +209,137 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, 
> void *data,
>   return 0;
>  }
>  
> -static void i915_gem_object_detach_phys(struct drm_i915_gem_object *obj)
> +static int
> +i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
>  {
> - drm_dma_handle_t *phys = obj->phys_handle;
> + struct address_space *mapping = file_inode(obj->base.filp)->i_mapping;
> + char *vaddr = obj->phys_handle->vaddr;
> + struct sg_table *st;
> + struct scatterlist *sg;
> + int i;
>  
> - if (!phys)
> - return;
> + if (WARN_ON(i915_gem_object_needs_bit17_swizzle(obj)))
> + return -EINVAL;
> +
> + for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
> + struct page *page;
> + char *src;
> +
> + page = shmem_read_mapping_page(mapping, i);
> + if (IS_ERR(page))
> + return PTR_ERR(page);
> +
> + src = kmap_atomic(page);
> + memcpy(vaddr, src, PAGE_SIZE);
> + drm_clflush_virt_range(vaddr, PAGE_SIZE);
> + kunmap_atomic(src);
> +
> + page_cache_release(page);
> + vaddr += PAGE_SIZE;
> + }
> +
> + i915_gem_chipset_flush(obj->base.dev);
> +
> + st = kmalloc(sizeof(*st), GFP_KERNEL);
> + if (st == NULL)
> + return -ENOMEM;
> +
> + if (sg_alloc_table(st, 1, GFP_KERNEL)) {
> + kfree(st);
> + return -ENOMEM;
> + }
> +
> + sg = st->sgl;
> + sg->offset = 0;
> + sg->length = obj->base.size;
>  
> - if (obj->madv == I915_MADV_WILLNEED) {
> + sg_dma_address(sg) = obj->phys_

[Intel-gfx] [PATCH] drm/i915: Make the physical object coherent with GTT

2014-07-10 Thread Chris Wilson
Currently objects for which the hardware needs a contiguous physical
address are allocated a shadow backing storage to satisfy the contraint.
This shadow buffer is not wired into the normal obj->pages and so the
physical object is incoherent with accesses via the GPU, GTT and CPU. By
setting up the appropriate scatter-gather table, we can allow userspace
to access the physical object via either a GTT mmaping of or by rendering
into the GEM bo. However, keeping the CPU mmap of the shmemfs backing
storage coherent with the contiguous shadow is not yet possible.
Fortuituously, CPU mmaps of objects requiring physical addresses are not
expected to be coherent anyway.

This allows the physical constraint of the GEM object to be transparent
to userspace and allow it to efficiently render into or update them via
the GTT and GPU.

v2: Fix leak of pci handle spotted by Ville
v3: Remove the now duplicate call to detach_phys_object during free.
v4: Wait for rendering before pwrite. As this patch makes it possible to
render into the phys object, we should make it correct as well!

Signed-off-by: Chris Wilson 
Cc: Ville Syrjälä 
Reviewed-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/i915_dma.c |   3 +
 drivers/gpu/drm/i915/i915_drv.h |   6 +-
 drivers/gpu/drm/i915/i915_gem.c | 207 +++-
 include/uapi/drm/i915_drm.h |   1 +
 4 files changed, 150 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 5ae608121f03..1b9798503b77 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1025,6 +1025,9 @@ static int i915_getparam(struct drm_device *dev, void 
*data,
case I915_PARAM_CMD_PARSER_VERSION:
value = i915_cmd_parser_get_version();
break;
+   case I915_PARAM_HAS_COHERENT_PHYS_GTT:
+   value = 1;
+   break;
default:
DRM_DEBUG("Unknown parameter %d\n", param->param);
return -EINVAL;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 211db0653831..f81d787d6b47 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1787,10 +1787,10 @@ struct drm_i915_gem_object {
unsigned long user_pin_count;
struct drm_file *pin_filp;
 
-   /** for phy allocated objects */
-   drm_dma_handle_t *phys_handle;
-
union {
+   /** for phy allocated objects */
+   drm_dma_handle_t *phys_handle;
+
struct i915_gem_userptr {
uintptr_t ptr;
unsigned read_only :1;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 83ccbabdcacf..d083cf5bdbbd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -209,40 +209,137 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void 
*data,
return 0;
 }
 
-static void i915_gem_object_detach_phys(struct drm_i915_gem_object *obj)
+static int
+i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
 {
-   drm_dma_handle_t *phys = obj->phys_handle;
+   struct address_space *mapping = file_inode(obj->base.filp)->i_mapping;
+   char *vaddr = obj->phys_handle->vaddr;
+   struct sg_table *st;
+   struct scatterlist *sg;
+   int i;
 
-   if (!phys)
-   return;
+   if (WARN_ON(i915_gem_object_needs_bit17_swizzle(obj)))
+   return -EINVAL;
+
+   for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
+   struct page *page;
+   char *src;
+
+   page = shmem_read_mapping_page(mapping, i);
+   if (IS_ERR(page))
+   return PTR_ERR(page);
+
+   src = kmap_atomic(page);
+   memcpy(vaddr, src, PAGE_SIZE);
+   drm_clflush_virt_range(vaddr, PAGE_SIZE);
+   kunmap_atomic(src);
+
+   page_cache_release(page);
+   vaddr += PAGE_SIZE;
+   }
+
+   i915_gem_chipset_flush(obj->base.dev);
+
+   st = kmalloc(sizeof(*st), GFP_KERNEL);
+   if (st == NULL)
+   return -ENOMEM;
+
+   if (sg_alloc_table(st, 1, GFP_KERNEL)) {
+   kfree(st);
+   return -ENOMEM;
+   }
+
+   sg = st->sgl;
+   sg->offset = 0;
+   sg->length = obj->base.size;
 
-   if (obj->madv == I915_MADV_WILLNEED) {
+   sg_dma_address(sg) = obj->phys_handle->busaddr;
+   sg_dma_len(sg) = obj->base.size;
+
+   obj->pages = st;
+   obj->has_dma_mapping = true;
+   return 0;
+}
+
+static void
+i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj)
+{
+   int ret;
+
+   BUG_ON(obj->madv == __I915_MADV_PURGED);
+
+   ret = i915_gem_object_set_to_cpu_domain(obj, true);
+   if (ret) {
+   /* In the event of a disaster, abandon all caches and
+* hope for the

Re: [Intel-gfx] [PATCH i-g-t 06/43] igt_kms: Introduce a for_each_pipe() macro

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 07:00:07PM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau 
> ---
>  lib/igt_kms.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index d34bcee..9e7bc2b 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -202,6 +202,9 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
>   for (int i__ = 0;  i__ < (display)->n_outputs; i__++)   \
>   if ((output = &(display)->outputs[i__]), output->valid)
>  
> +#define for_each_pipe(display, pipe) \
> + for (pipe = 0; pipe < igt_display_get_n_pipes(display); pipe++) \
> +

An additional hunk for lib/igt.cocci would be awesome, especially since it
will match a few existing things already.
-Daniel

>  /*
>   * Can be used with igt_output_set_pipe() to mean we don't care about the 
> pipe
>   * that should drive this output
> -- 
> 1.8.3.1
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/7] drm/i915: Make the RPS interrupt generation mask handle the vlv wa

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 08:31:19PM +0100, Chris Wilson wrote:
> We can eliminate a lot of special case code by making the computation of
> the interrupt mask be correct for all callers.
> 
> Signed-off-by: Chris Wilson 
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 5c27065bac17..1302e1bc9136 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3183,6 +3183,9 @@ static u32 gen6_rps_pm_mask(struct drm_i915_private 
> *dev_priv, u8 val)
>   if (val < dev_priv->rps.max_freq_softlimit)
>   mask |= GEN6_PM_RP_UP_THRESHOLD;
>  
> + mask |= dev_priv->pm_rps_events & (GEN6_PM_RP_DOWN_EI_EXPIRED | 
> GEN6_PM_RP_UP_EI_EXPIRED);
> + mask &= dev_priv->pm_rps_events;

Might as well move pm_rps_events to dev_priv->rps, too, next to the work
item. Anyway, first 2 patches merged.
-Daniel

> +
>   /* IVB and SNB hard hangs on looping batchbuffer
>* if GEN6_PM_UP_EI_EXPIRED is masked.
>*/
> @@ -3274,11 +3277,8 @@ static void vlv_set_rps_idle(struct drm_i915_private 
> *dev_priv)
>  
>   vlv_force_gfx_clock(dev_priv, false);
>  
> - if (dev_priv->pm_rps_events & GEN6_PM_RP_UP_EI_EXPIRED)
> - I915_WRITE(GEN6_PMINTRMSK, ~dev_priv->pm_rps_events);
> - else 
> - I915_WRITE(GEN6_PMINTRMSK,
> -gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
> + I915_WRITE(GEN6_PMINTRMSK,
> +gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
>  }
>  
>  void gen6_rps_idle(struct drm_i915_private *dev_priv)
> -- 
> 2.0.1
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Don't cast a pointer to void* unnecessarily

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 04:26:53PM -0300, Paulo Zanoni wrote:
> 2014-07-10 10:52 GMT-03:00 Damien Lespiau :
> > C is super happy to asign anything pointer to void *. Don't pretend
> > otherwise.
> 
> Reviewed-by: Paulo Zanoni 

Queued for -next, thanks for the patch.
-Daniel

> 
> >
> > Signed-off-by: Damien Lespiau 
> > ---
> >  drivers/gpu/drm/i915/i915_dma.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c 
> > b/drivers/gpu/drm/i915/i915_dma.c
> > index ce69185..2c0bad6 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -1596,7 +1596,7 @@ int i915_driver_load(struct drm_device *dev, unsigned 
> > long flags)
> > if (dev_priv == NULL)
> > return -ENOMEM;
> >
> > -   dev->dev_private = (void *)dev_priv;
> > +   dev->dev_private = dev_priv;
> > dev_priv->dev = dev;
> >
> > /* copy initial configuration to dev_priv->info */
> > --
> > 1.8.3.1
> >
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> -- 
> Paulo Zanoni
> ___
> Intel-gfx mailing list
> Intel-gfx@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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 4/4] drm/i915: don't read LVDS regs at compute_config time

2014-07-10 Thread Daniel Vetter
On Fri, Jul 04, 2014 at 01:38:36PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> We may reach this point while the machine is still runtime suspended,
> so we'll hit a WARN. The other encoders also don't touch registers at
> this point, so instead of waking the machine up, write some code to
> keep the register always at the same state, including after we runtime
> suspend/resume.

Excellent catch - we really don't want to touch the hw at all in the
compute stage: Once we have atomic modeset we run this code for the
test-only mode when userspace tries to figure out what's possible. Waking
up the hardware here is really not what we want to do.

> Testcase: igt/pm_rpm
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80463
> Signed-off-by: Paulo Zanoni 

Entire series pulled into dinq, thanks.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_lvds.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c 
> b/drivers/gpu/drm/i915/intel_lvds.c
> index 8aa7973..c511287 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -51,6 +51,7 @@ struct intel_lvds_encoder {
>  
>   bool is_dual_link;
>   u32 reg;
> + u32 a3_power;
>  
>   struct intel_lvds_connector *attached_connector;
>  };
> @@ -170,8 +171,11 @@ static void intel_pre_enable_lvds(struct intel_encoder 
> *encoder)
>  
>   /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
>* appropriately here, but we need to look more thoroughly into how
> -  * panels behave in the two modes.
> +  * panels behave in the two modes. For now, let's just maintain the
> +  * value we got from the BIOS.
>*/
> +  temp &= ~LVDS_A3_POWER_MASK;
> +  temp |= lvds_encoder->a3_power;
>  
>   /* Set the dithering flag on LVDS as needed, note that there is no
>* special lvds dither control bit on pch-split platforms, dithering is
> @@ -269,7 +273,6 @@ static bool intel_lvds_compute_config(struct 
> intel_encoder *intel_encoder,
> struct intel_crtc_config *pipe_config)
>  {
>   struct drm_device *dev = intel_encoder->base.dev;
> - struct drm_i915_private *dev_priv = dev->dev_private;
>   struct intel_lvds_encoder *lvds_encoder =
>   to_lvds_encoder(&intel_encoder->base);
>   struct intel_connector *intel_connector =
> @@ -284,8 +287,7 @@ static bool intel_lvds_compute_config(struct 
> intel_encoder *intel_encoder,
>   return false;
>   }
>  
> - if ((I915_READ(lvds_encoder->reg) & LVDS_A3_POWER_MASK) ==
> - LVDS_A3_POWER_UP)
> + if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
>   lvds_bpp = 8*3;
>   else
>   lvds_bpp = 6*3;
> @@ -1086,6 +1088,9 @@ out:
>   DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
> lvds_encoder->is_dual_link ? "dual" : "single");
>  
> + lvds_encoder->a3_power = I915_READ(lvds_encoder->reg) &
> +  LVDS_A3_POWER_MASK;
> +
>   /*
>* Unlock registers and just
>* leave them unlocked
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@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
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Make the device_info structure __initconst

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 02:52:42PM +0100, Damien Lespiau wrote:
> We don't need them past the module initialization as the correct
> structure is copied into dev_priv in ->load(), called from
> drm_pci_init(), called from the module init funtion.
> 
> I'm always hesitant about adding new members to struct intel_device_info
> because it will add 30+ * sizeof(member) bytes to the driver. However,
> if we can discard those table after init(), it changes everything.
> 
> After this change, the driver has a new .init.rodata section contains
> the structures in question and .rodata has now 2848 fewer bytes.
> 
> lsmod shows -5425 bytes in its size field between before and after this
> change. Not too sure why this (Vs the 2848 bytes lost in .rodata), but
> that's enough for me.
> 
> Signed-off-by: Damien Lespiau 

You want devinintconst which is being phased out afaik ... Currently the
driver gets probed synchronously but you kinda never know what the device
core people are up to:
- init = removed after the module is loaded.
- devinit = removed after the driver is initilialized, and never for
  CONFIG_HOTPLUG=y.

If we want to trim down the size of our driver, especially on specific
platforms we imo should have a) link time optimization b) some
heavy-handed macro to return a static device info c) a much more clever
gcc since last time I've tried this it failed to kick out large swats of
code like all the dvo crap. Despite that it was clearly unreachable :(

Cheers, Daniel
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 60 
> -
>  1 file changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index bc19623..9f75261 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -63,7 +63,7 @@ static struct drm_driver driver;
>  #define IVB_CURSOR_OFFSETS \
>   .cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, 
> IVB_CURSOR_C_OFFSET }
>  
> -static const struct intel_device_info intel_i830_info = {
> +static const struct intel_device_info intel_i830_info __initconst = {
>   .gen = 2, .is_mobile = 1, .cursor_needs_physical = 1, .num_pipes = 2,
>   .has_overlay = 1, .overlay_needs_physical = 1,
>   .ring_mask = RENDER_RING,
> @@ -71,7 +71,7 @@ static const struct intel_device_info intel_i830_info = {
>   CURSOR_OFFSETS,
>  };
>  
> -static const struct intel_device_info intel_845g_info = {
> +static const struct intel_device_info intel_845g_info __initconst = {
>   .gen = 2, .num_pipes = 1,
>   .has_overlay = 1, .overlay_needs_physical = 1,
>   .ring_mask = RENDER_RING,
> @@ -79,7 +79,7 @@ static const struct intel_device_info intel_845g_info = {
>   CURSOR_OFFSETS,
>  };
>  
> -static const struct intel_device_info intel_i85x_info = {
> +static const struct intel_device_info intel_i85x_info __initconst = {
>   .gen = 2, .is_i85x = 1, .is_mobile = 1, .num_pipes = 2,
>   .cursor_needs_physical = 1,
>   .has_overlay = 1, .overlay_needs_physical = 1,
> @@ -89,7 +89,7 @@ static const struct intel_device_info intel_i85x_info = {
>   CURSOR_OFFSETS,
>  };
>  
> -static const struct intel_device_info intel_i865g_info = {
> +static const struct intel_device_info intel_i865g_info __initconst = {
>   .gen = 2, .num_pipes = 1,
>   .has_overlay = 1, .overlay_needs_physical = 1,
>   .ring_mask = RENDER_RING,
> @@ -97,14 +97,14 @@ static const struct intel_device_info intel_i865g_info = {
>   CURSOR_OFFSETS,
>  };
>  
> -static const struct intel_device_info intel_i915g_info = {
> +static const struct intel_device_info intel_i915g_info __initconst = {
>   .gen = 3, .is_i915g = 1, .cursor_needs_physical = 1, .num_pipes = 2,
>   .has_overlay = 1, .overlay_needs_physical = 1,
>   .ring_mask = RENDER_RING,
>   GEN_DEFAULT_PIPEOFFSETS,
>   CURSOR_OFFSETS,
>  };
> -static const struct intel_device_info intel_i915gm_info = {
> +static const struct intel_device_info intel_i915gm_info __initconst = {
>   .gen = 3, .is_mobile = 1, .num_pipes = 2,
>   .cursor_needs_physical = 1,
>   .has_overlay = 1, .overlay_needs_physical = 1,
> @@ -114,14 +114,14 @@ static const struct intel_device_info intel_i915gm_info 
> = {
>   GEN_DEFAULT_PIPEOFFSETS,
>   CURSOR_OFFSETS,
>  };
> -static const struct intel_device_info intel_i945g_info = {
> +static const struct intel_device_info intel_i945g_info __initconst = {
>   .gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1, .num_pipes = 2,
>   .has_overlay = 1, .overlay_needs_physical = 1,
>   .ring_mask = RENDER_RING,
>   GEN_DEFAULT_PIPEOFFSETS,
>   CURSOR_OFFSETS,
>  };
> -static const struct intel_device_info intel_i945gm_info = {
> +static const struct intel_device_info intel_i945gm_info __initconst = {
>   .gen = 3, .is_i945gm = 1, .is_mobile = 1, .num_pipes = 2,
>   .has_hotplug = 1, .cursor_needs_physical = 1,
>   .ha

Re: [Intel-gfx] [PATCH 1/2] drm/i915: Allow overlapping userptr objects

2014-07-10 Thread Daniel Vetter
On Thu, Jul 10, 2014 at 10:21:43AM +0100, Chris Wilson wrote:
> Whilst I strongly advise against doing so for the implicit coherency
> issues between the multiple buffer objects accessing the same backing
> store, it nevertheless is a valid use case, akin to mmaping the same
> file multiple times.
> 
> The reason why we forbade it earlier was that our use of the interval
> tree for fast invalidation upon vma changes excluded overlapping
> objects. So in the case where the user wishes to create such pairs of
> overlapping objects, we degrade the range invalidation to walkin the
> linear list of objects associated with the mm.
> 
> v2: Compile for mmu-notifiers after tweaking
> 
> Signed-off-by: Chris Wilson 
> Cc: "Li, Victor Y" 
> Cc: "Kelley, Sean V" 
> Cc: Tvrtko Ursulin 
> Cc: "Gong, Zhipeng" 
> Cc: Akash Goel 
> Cc: "Volkin, Bradley D" 

The commit message is a bit thin on why we need this. Sounds a bit like
userspace lost its marbles to me ...
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem_userptr.c | 139 
> 
>  1 file changed, 104 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c 
> b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index 21ea928..7c38f50 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -40,19 +40,87 @@ struct i915_mmu_notifier {
>   struct hlist_node node;
>   struct mmu_notifier mn;
>   struct rb_root objects;
> + struct list_head linear;
>   struct drm_device *dev;
>   struct mm_struct *mm;
>   struct work_struct work;
>   unsigned long count;
>   unsigned long serial;
> + bool is_linear;
>  };
>  
>  struct i915_mmu_object {
>   struct i915_mmu_notifier *mmu;
>   struct interval_tree_node it;
> + struct list_head link;
>   struct drm_i915_gem_object *obj;
> + bool is_linear;
>  };
>  
> +static unsigned long cancel_userptr(struct drm_i915_gem_object *obj)
> +{
> + struct drm_device *dev = obj->base.dev;
> + unsigned long end;
> +
> + mutex_lock(&dev->struct_mutex);
> + /* Cancel any active worker and force us to re-evaluate gup */
> + obj->userptr.work = NULL;
> +
> + if (obj->pages != NULL) {
> + struct drm_i915_private *dev_priv = to_i915(dev);
> + struct i915_vma *vma, *tmp;
> + bool was_interruptible;
> +
> + was_interruptible = dev_priv->mm.interruptible;
> + dev_priv->mm.interruptible = false;
> +
> + list_for_each_entry_safe(vma, tmp, &obj->vma_list, vma_link) {
> + int ret = i915_vma_unbind(vma);
> + WARN_ON(ret && ret != -EIO);
> + }
> + WARN_ON(i915_gem_object_put_pages(obj));
> +
> + dev_priv->mm.interruptible = was_interruptible;
> + }
> +
> + end = obj->userptr.ptr + obj->base.size;
> +
> + drm_gem_object_unreference(&obj->base);
> + mutex_unlock(&dev->struct_mutex);
> +
> + return end;
> +}
> +
> +static void invalidate_range__linear(struct i915_mmu_notifier *mn,
> +  struct mm_struct *mm,
> +  unsigned long start,
> +  unsigned long end)
> +{
> + struct i915_mmu_object *mmu;
> + unsigned long serial;
> +
> +restart:
> + serial = mn->serial;
> + list_for_each_entry(mmu, &mn->linear, link) {
> + struct drm_i915_gem_object *obj;
> +
> + if (mmu->it.last < start || mmu->it.start > end)
> + continue;
> +
> + obj = mmu->obj;
> + drm_gem_object_reference(&obj->base);
> + spin_unlock(&mn->lock);
> +
> + cancel_userptr(obj);
> +
> + spin_lock(&mn->lock);
> + if (serial != mn->serial)
> + goto restart;
> + }
> +
> + spin_unlock(&mn->lock);
> +}
> +
>  static void i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier 
> *_mn,
>  struct mm_struct *mm,
>  unsigned long start,
> @@ -60,16 +128,19 @@ static void 
> i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier *_mn,
>  {
>   struct i915_mmu_notifier *mn = container_of(_mn, struct 
> i915_mmu_notifier, mn);
>   struct interval_tree_node *it = NULL;
> + unsigned long next = start;
>   unsigned long serial = 0;
>  
>   end--; /* interval ranges are inclusive, but invalidate range is 
> exclusive */
> - while (start < end) {
> + while (next < end) {
>   struct drm_i915_gem_object *obj;
>  
>   obj = NULL;
>   spin_lock(&mn->lock);
> + if (mn->is_linear)
> + return invalidate_range__linear(mn, mm, start, end);
>   if (serial == mn->serial)
> - it = interval_tree

Re: [Intel-gfx] [PATCH 00/19] ddi: respin of runtime PM for DPMS

2014-07-10 Thread Daniel Vetter
On Tue, Jul 01, 2014 at 06:33:50PM -0300, Paulo Zanoni wrote:
> 2014-06-25 16:01 GMT-03:00 Imre Deak :
> > This is a respin of the unmerged part of Daniel's runtime PM for DPMS
> > patchset [1]. The original one also included a refactoring of the DDI
> > PCH/CRT encoder modesetting path, I left the corresponding patches out
> > from this series. This is because there hasn't been yet an agreement on
> > those parts, but people would like to see the RPM DPMS support already
> > applied.
> >
> > Some patches needed to be updated/rebased because of the above omission,
> > but these weren't anywhere significant so I just marked the fact
> > with my s-o-b line. I also added two minor change to keep the
> > modeset sequence at its current order and collected all the reviewed-by
> > lines.
> >
> > Tested on HSW DP/VGA, with basic DPMS on/off and igt/pm_rpm.
> 
> For patches 2, 4, 5, 6, 7, 19: Reviewed-by: Paulo Zanoni
> 
> 
> However, I tested these patches on a HSW Machine with eDP+HDMI, and
> there are WARNs on dmesg for the dpms-non-lpsp subtest. I found at
> least two problems:
> 1 - Function hsw_ddi_pll_get_hw_state() reads registers while the
> device is suspended.
> 2 - When _intel_set_mode() calls intel_crtc_disable(), it calls
> assert_plane() which reads register 0x71180, which triggers an
> "Unclaimed register" error. I didn't investigate this deeply, so I
> don't have a suggestion for a solution.
> 
> I can reproduce these errors 100% of the time.

Ok, I've pulled in the series (hopefully all of it with all the right
fixup and in the right order), except for the last patch. I'll do that one
once your unclaimed register write fixes are in to avoid regressions.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] Revert "drm/i915: Don't set the 8to6 dither flag when not scaling"

2014-07-10 Thread Hans de Bruin

On 07/09/2014 10:35 PM, Daniel Vetter wrote:

This reverts commit 773875bfb6737982903c42d1ee88cf60af80089c.

It is very much needed and the lack of dithering has been reported by
a large list of people with various gen2/3 hardware.

Also, the original patch was complete non-sense since the WARNING
backtraces in the references bugzilla are about
gmch_pfit.lvds_border_bits mismatch, not at all about the dither bit.
That one seems to work.

Cc: Jiri Kosina 
Cc: Pavel Machek 
Cc: Hans de Bruin 
Cc: sta...@vger.kernel.org
Signed-off-by: Daniel Vetter 


I have applied the patches and al looks well again.

--
Hans
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 4/7] drm/i915: Improved w/a for rps on Baytrail

2014-07-10 Thread Chris Wilson
Rewrite commit 31685c258e0b0ad6aa486c5ec001382cf8a64212
Author: Deepak S 
Date:   Thu Jul 3 17:33:01 2014 -0400

drm/i915/vlv: WA for Turbo and RC6 to work together.

Other than code clarity, the major improvement is to disable the extra
interrupts generated when idle.  However, the reclocking remains rather
slow under the new manual regime, in particular it fails to downclock as
quickly as desired.

Signed-off-by: Chris Wilson 
Cc: Deepak S 
Cc: Ville Syrjälä 
Cc: Rodrigo Vivi 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_irq.c  | 166 ---
 drivers/gpu/drm/i915/i915_reg.h  |   4 +-
 drivers/gpu/drm/i915/intel_display.c |   2 +
 drivers/gpu/drm/i915/intel_drv.h |   2 +
 drivers/gpu/drm/i915/intel_pm.c  |  13 +++
 5 files changed, 73 insertions(+), 114 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 8e19d031c05d..2db5dbb87ced 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1282,129 +1282,72 @@ static void notify_ring(struct drm_device *dev,
i915_queue_hangcheck(dev);
 }
 
-static u32 vlv_c0_residency(struct drm_i915_private *dev_priv,
-   struct intel_rps_ei *rps_ei)
+static void vlv_c0_read(struct drm_i915_private *dev_priv,
+   struct intel_rps_ei *ei)
 {
-   u32 cz_ts, cz_freq_khz;
-   u32 render_count, media_count;
-   u32 elapsed_render, elapsed_media, elapsed_time;
-   u32 residency = 0;
-
-   cz_ts = vlv_punit_read(dev_priv, PUNIT_REG_CZ_TIMESTAMP);
-   cz_freq_khz = DIV_ROUND_CLOSEST(dev_priv->mem_freq * 1000, 4);
-
-   render_count = I915_READ(VLV_RENDER_C0_COUNT_REG);
-   media_count = I915_READ(VLV_MEDIA_C0_COUNT_REG);
-
-   if (rps_ei->cz_clock == 0) {
-   rps_ei->cz_clock = cz_ts;
-   rps_ei->render_c0 = render_count;
-   rps_ei->media_c0 = media_count;
-
-   return dev_priv->rps.cur_freq;
-   }
-
-   elapsed_time = cz_ts - rps_ei->cz_clock;
-   rps_ei->cz_clock = cz_ts;
-
-   elapsed_render = render_count - rps_ei->render_c0;
-   rps_ei->render_c0 = render_count;
-
-   elapsed_media = media_count - rps_ei->media_c0;
-   rps_ei->media_c0 = media_count;
-
-   /* Convert all the counters into common unit of milli sec */
-   elapsed_time /= VLV_CZ_CLOCK_TO_MILLI_SEC;
-   elapsed_render /=  cz_freq_khz;
-   elapsed_media /= cz_freq_khz;
-
-   /*
-* Calculate overall C0 residency percentage
-* only if elapsed time is non zero
-*/
-   if (elapsed_time) {
-   residency =
-   ((max(elapsed_render, elapsed_media) * 100)
-   / elapsed_time);
-   }
-
-   return residency;
+   ei->cz_clock = vlv_punit_read(dev_priv, PUNIT_REG_CZ_TIMESTAMP);
+   ei->render_c0 = I915_READ(VLV_RENDER_C0_COUNT);
+   ei->media_c0 = I915_READ(VLV_MEDIA_C0_COUNT);
 }
 
-/**
- * vlv_calc_delay_from_C0_counters - Increase/Decrease freq based on GPU
- * busy-ness calculated from C0 counters of render & media power wells
- * @dev_priv: DRM device private
- *
- */
-static u32 vlv_calc_delay_from_C0_counters(struct drm_i915_private *dev_priv)
+static bool vlv_c0_above(struct drm_i915_private *dev_priv,
+const struct intel_rps_ei *old,
+const struct intel_rps_ei *now,
+int threshold)
 {
-   u32 residency_C0_up = 0, residency_C0_down = 0;
-   u8 new_delay, adj;
+   u64 time = now->cz_clock - old->cz_clock;
+   u64 c0 = max(now->render_c0 - old->render_c0,
+now->media_c0 - old->media_c0);
 
-   dev_priv->rps.ei_interrupt_count++;
+   c0 *= 100 * VLV_CZ_CLOCK_TO_MILLI_SEC * 4 / 1000;
+   time *= threshold * dev_priv->mem_freq;
+   return c0 >= time;
+}
 
-   WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
+void gen6_rps_reset_ei(struct drm_i915_private *dev_priv)
+{
+   vlv_c0_read(dev_priv, &dev_priv->rps.down_ei);
+   dev_priv->rps.up_ei = dev_priv->rps.down_ei;
+   dev_priv->rps.ei_interrupt_count = 0;
+}
 
+static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir)
+{
+   struct intel_rps_ei now;
+   u32 events = 0;
 
-   if (dev_priv->rps.up_ei.cz_clock == 0) {
-   vlv_c0_residency(dev_priv, &dev_priv->rps.up_ei);
-   vlv_c0_residency(dev_priv, &dev_priv->rps.down_ei);
-   return dev_priv->rps.cur_freq;
-   }
+   if ((pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) == 0)
+   return 0;
 
+   vlv_c0_read(dev_priv, &now);
 
/*
 * To down throttle, C0 residency should be less than down threshold
 * for continous EI intervals. So calculate down EI counters
 * once in VLV_INT_COUNT_FOR_DOWN_EI
 */
-   if (dev_priv->rps.ei_interrupt_count == VLV_INT_COUNT_FOR

[Intel-gfx] [PATCH 7/7] drm/i915: Agressive downclocking on Baytrail

2014-07-10 Thread Chris Wilson
Reuse the same reclocking strategy for Baytail as on its bigger brethren,
Sandybridge and Ivybridge. In particular, this makes the device quicker
to reclock (both up and down) though the tendency now is to downclock
more aggressively to compensate for the RPS boosts.

Signed-off-by: Chris Wilson 
Cc: Deepak S 
Cc: Ville Syrjälä 
Cc: Rodrigo Vivi 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_debugfs.c |  4 ++--
 drivers/gpu/drm/i915/i915_drv.h |  3 +++
 drivers/gpu/drm/i915/i915_irq.c |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h |  2 --
 drivers/gpu/drm/i915/intel_pm.c | 11 ++-
 5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index c1741799d673..0c538bf398e5 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1198,9 +1198,9 @@ static int i915_frequency_info(struct seq_file *m, void 
*unused)
seq_puts(m, "\n");
seq_printf(m, "RP CONTROL: 0x%08x\n", rpmodectl);
seq_printf(m, "RP UP EI: 0x%08x\n", rpupei);
-   seq_printf(m, "RP UP THRESHOLD: 0x%08x\n", rpinclimit);
+   seq_printf(m, "RP UP THRESHOLD: 0x%08x [%d%%]\n", rpinclimit, 
dev_priv->rps.up_threshold);
seq_printf(m, "RP DOWN EI: 0x%08x\n", rpdownei);
-   seq_printf(m, "RP DOWN THRESHOLD: 0x%08x\n", rpdeclimit);
+   seq_printf(m, "RP DOWN THRESHOLD: 0x%08x [%d%%]\n", rpdeclimit, 
dev_priv->rps.down_threshold);
seq_printf(m, "RP CUR UP EI: %dus\n", rpcurupei &
   GEN6_CURICONT_MASK);
seq_printf(m, "RP CUR UP: %dus\n", rpcurup &
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 149015b5cb24..65e440a9a086 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -937,6 +937,9 @@ struct intel_gen6_power_mgmt {
u8 rp1_freq;/* "less than" RP0 power/freqency */
u8 rp0_freq;/* Non-overclocked max frequency. */
 
+   u8 up_threshold; /* Current %busy required to uplock */
+   u8 down_threshold; /* Current %busy required to downclock */
+
int last_adj;
enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 43bd40cc75a6..041aa0b3d7d8 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1323,7 +1323,7 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private 
*dev_priv, u32 pm_iir)
if (pm_iir & GEN6_PM_RP_DOWN_EI_EXPIRED) {
if (!vlv_c0_above(dev_priv,
  &dev_priv->rps.down_ei, &now,
- VLV_RP_DOWN_EI_THRESHOLD))
+ dev_priv->rps.down_threshold))
events |= GEN6_PM_RP_DOWN_THRESHOLD;
dev_priv->rps.down_ei = now;
}
@@ -1331,7 +1331,7 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private 
*dev_priv, u32 pm_iir)
if (pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) {
if (vlv_c0_above(dev_priv,
 &dev_priv->rps.up_ei, &now,
-VLV_RP_UP_EI_THRESHOLD))
+dev_priv->rps.up_threshold))
events |= GEN6_PM_RP_UP_THRESHOLD;
dev_priv->rps.up_ei = now;
}
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 5571f7714f78..dc808b0f6577 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -564,8 +564,6 @@ enum punit_power_well {
 #define   FB_FMAX_VMIN_FREQ_LO_MASK0xf800
 
 #define VLV_CZ_CLOCK_TO_MILLI_SEC  10
-#define VLV_RP_UP_EI_THRESHOLD 90
-#define VLV_RP_DOWN_EI_THRESHOLD   70
 
 /* vlv2 north clock has */
 #define CCK_FUSE_REG   0x8
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 1b1713e37d16..20296e3ea650 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3117,10 +3117,12 @@ static void gen6_set_rps_thresholds(struct 
drm_i915_private *dev_priv, u8 val)
switch (new_power) {
case LOW_POWER:
/* Upclock if more than 95% busy over 16ms */
+   dev_priv->rps.up_threshold = 95;
I915_WRITE(GEN6_RP_UP_EI, 12500);
I915_WRITE(GEN6_RP_UP_THRESHOLD, 11800);
 
/* Downclock if less than 85% busy over 32ms */
+   dev_priv->rps.down_threshold = 85;
I915_WRITE(GEN6_RP_DOWN_EI, 25000);
I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 21250);
 
@@ -3135,10 +3137,12 @@ static void gen6_set_rps_thresholds(struct 
drm_i915_private *dev_priv, u8 val)
 
case BETWEEN:
/* Upclock if mo

[Intel-gfx] [PATCH 1/7] drm/i915: Move RPS evaluation interval counters to i915->rps

2014-07-10 Thread Chris Wilson
Place the RPS counters inside the RPS struct.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_drv.h | 18 +++---
 drivers/gpu/drm/i915/i915_irq.c | 32 
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index fed405d1a7eb..daee71ef201d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -907,10 +907,10 @@ struct vlv_s0ix_state {
u32 clock_gate_dis2;
 };
 
-struct intel_rps_ei_calc {
-   u32 cz_ts_ei;
-   u32 render_ei_c0;
-   u32 media_ei_c0;
+struct intel_rps_ei {
+   u32 cz_clock;
+   u32 render_c0;
+   u32 media_c0;
 };
 
 struct intel_gen6_power_mgmt {
@@ -946,6 +946,9 @@ struct intel_gen6_power_mgmt {
struct delayed_work delayed_resume_work;
struct work_struct boost_work;
 
+   /* manual wa residency calculations */
+   struct intel_rps_ei up_ei, down_ei;
+
/*
 * Protects RPS/RC6 register access and PCU communication.
 * Must be taken after struct_mutex if nested.
@@ -1548,13 +1551,6 @@ struct drm_i915_private {
/* gen6+ rps state */
struct intel_gen6_power_mgmt rps;
 
-   /* rps wa up ei calculation */
-   struct intel_rps_ei_calc rps_up_ei;
-
-   /* rps wa down ei calculation */
-   struct intel_rps_ei_calc rps_down_ei;
-
-
/* ilk-only ips/rps state. Everything in here is protected by the global
 * mchdev_lock in intel_pm.c */
struct intel_ilk_power_mgmt ips;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a2d50980b827..8e19d031c05d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1283,7 +1283,7 @@ static void notify_ring(struct drm_device *dev,
 }
 
 static u32 vlv_c0_residency(struct drm_i915_private *dev_priv,
-   struct  intel_rps_ei_calc *rps_ei)
+   struct intel_rps_ei *rps_ei)
 {
u32 cz_ts, cz_freq_khz;
u32 render_count, media_count;
@@ -1296,22 +1296,22 @@ static u32 vlv_c0_residency(struct drm_i915_private 
*dev_priv,
render_count = I915_READ(VLV_RENDER_C0_COUNT_REG);
media_count = I915_READ(VLV_MEDIA_C0_COUNT_REG);
 
-   if (rps_ei->cz_ts_ei == 0) {
-   rps_ei->cz_ts_ei = cz_ts;
-   rps_ei->render_ei_c0 = render_count;
-   rps_ei->media_ei_c0 = media_count;
+   if (rps_ei->cz_clock == 0) {
+   rps_ei->cz_clock = cz_ts;
+   rps_ei->render_c0 = render_count;
+   rps_ei->media_c0 = media_count;
 
return dev_priv->rps.cur_freq;
}
 
-   elapsed_time = cz_ts - rps_ei->cz_ts_ei;
-   rps_ei->cz_ts_ei = cz_ts;
+   elapsed_time = cz_ts - rps_ei->cz_clock;
+   rps_ei->cz_clock = cz_ts;
 
-   elapsed_render = render_count - rps_ei->render_ei_c0;
-   rps_ei->render_ei_c0 = render_count;
+   elapsed_render = render_count - rps_ei->render_c0;
+   rps_ei->render_c0 = render_count;
 
-   elapsed_media = media_count - rps_ei->media_ei_c0;
-   rps_ei->media_ei_c0 = media_count;
+   elapsed_media = media_count - rps_ei->media_c0;
+   rps_ei->media_c0 = media_count;
 
/* Convert all the counters into common unit of milli sec */
elapsed_time /= VLV_CZ_CLOCK_TO_MILLI_SEC;
@@ -1347,9 +1347,9 @@ static u32 vlv_calc_delay_from_C0_counters(struct 
drm_i915_private *dev_priv)
WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
 
-   if (dev_priv->rps_up_ei.cz_ts_ei == 0) {
-   vlv_c0_residency(dev_priv, &dev_priv->rps_up_ei);
-   vlv_c0_residency(dev_priv, &dev_priv->rps_down_ei);
+   if (dev_priv->rps.up_ei.cz_clock == 0) {
+   vlv_c0_residency(dev_priv, &dev_priv->rps.up_ei);
+   vlv_c0_residency(dev_priv, &dev_priv->rps.down_ei);
return dev_priv->rps.cur_freq;
}
 
@@ -1364,10 +1364,10 @@ static u32 vlv_calc_delay_from_C0_counters(struct 
drm_i915_private *dev_priv)
dev_priv->rps.ei_interrupt_count = 0;
 
residency_C0_down = vlv_c0_residency(dev_priv,
-   &dev_priv->rps_down_ei);
+&dev_priv->rps.down_ei);
} else {
residency_C0_up = vlv_c0_residency(dev_priv,
-   &dev_priv->rps_up_ei);
+  &dev_priv->rps.up_ei);
}
 
new_delay = dev_priv->rps.cur_freq;
-- 
2.0.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/5] drm/i915: don't write powered down IRQ registers on Gen 8

2014-07-10 Thread Paulo Zanoni
2014-07-08 11:58 GMT-03:00 Daniel Vetter :
> On Tue, Jul 08, 2014 at 11:15:03AM -0300, Paulo Zanoni wrote:
>> 2014-07-07 18:23 GMT-03:00 Daniel Vetter :
>> > On Fri, Jul 04, 2014 at 11:50:29AM -0300, Paulo Zanoni wrote:
>> >> From: Paulo Zanoni 
>> >>
>> >> If we enable unclaimed register reporting on Gen 8, we will discover
>> >> that the IRQ registers for pipes B and C are also on the power well,
>> >> so writes to them when the power well is disabled result in unclaimed
>> >> register errors.
>> >>
>> >> Also, hsw_power_well_post_enable() already takes care of re-enabling
>> >> them once the power well is enabled.
>> >>
>> >> Testcase: igt/pm_rpm/rte
>> >> Signed-off-by: Paulo Zanoni 
>> >
>> > Hm, shouldn't we split this into only setting up pipe A here and the pipe
>> > B stuff once we fire up the power well?
>> >
>>
>> No because these functions might be called when the power wells are
>> already enabled.
>
> Hm, where does this still happen? bdw has power well support and chv has a
> different display block ...

At driver init time... If you load i915.ko and the power wells are
already enabled, we have to do it here.

>
> This code changed too often and I have no idea any more what's up and
> what's down here ;-)
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch



-- 
Paulo Zanoni
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 6/7] drm/i915: Improve code clarity of vlv_set_rps_idle()

2014-07-10 Thread Chris Wilson
Use a short local variable to pass around the desired idle frequency.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/intel_pm.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index f29c643c9926..1b1713e37d16 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3246,10 +3246,11 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
 static void vlv_set_rps_idle(struct drm_i915_private *dev_priv)
 {
struct drm_device *dev = dev_priv->dev;
+   u32 val = dev_priv->rps.min_freq_softlimit;
 
/* Latest VLV doesn't need to force the gfx clock */
if (dev->pdev->revision >= 0xd) {
-   valleyview_set_rps(dev_priv->dev, 
dev_priv->rps.min_freq_softlimit);
+   valleyview_set_rps(dev_priv->dev, val);
return;
}
 
@@ -3257,7 +3258,7 @@ static void vlv_set_rps_idle(struct drm_i915_private 
*dev_priv)
 * When we are idle.  Drop to min voltage state.
 */
 
-   if (dev_priv->rps.cur_freq <= dev_priv->rps.min_freq_softlimit)
+   if (dev_priv->rps.cur_freq <= val)
return;
 
/* Mask turbo interrupt so that they will not come in between */
@@ -3265,10 +3266,9 @@ static void vlv_set_rps_idle(struct drm_i915_private 
*dev_priv)
 
vlv_force_gfx_clock(dev_priv, true);
 
-   dev_priv->rps.cur_freq = dev_priv->rps.min_freq_softlimit;
+   dev_priv->rps.cur_freq = val;
 
-   vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ,
-   dev_priv->rps.min_freq_softlimit);
+   vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
 
if (wait_for(((vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS))
& GENFREQSTATUS) == 0, 5))
@@ -3276,8 +3276,7 @@ static void vlv_set_rps_idle(struct drm_i915_private 
*dev_priv)
 
vlv_force_gfx_clock(dev_priv, false);
 
-   I915_WRITE(GEN6_PMINTRMSK,
-  gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
+   I915_WRITE(GEN6_PMINTRMSK, gen6_rps_pm_mask(dev_priv, val));
 }
 
 void gen6_rps_busy(struct drm_i915_private *dev_priv)
-- 
2.0.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 3/7] drm/i915: Include the RPS evalutation metrics in debugfs for Baytrail

2014-07-10 Thread Chris Wilson
Baytail, like Sandybridge+,  also has the RPS registers which are useful
to monitor. In addition, we were missing the evaluation interval
registers so add those to all.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_debugfs.c | 186 ++--
 1 file changed, 94 insertions(+), 92 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index e8c4ddd9369b..c1741799d673 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1081,13 +1081,13 @@ static int i915_frequency_info(struct seq_file *m, void 
*unused)
struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
-   int ret = 0;
 
intel_runtime_pm_get(dev_priv);
 
flush_delayed_work(&dev_priv->rps.delayed_resume_work);
-
-   if (IS_GEN5(dev)) {
+   if (INTEL_INFO(dev)->gen < 5) {
+   seq_puts(m, "no P-state info available\n");
+   } else if (INTEL_INFO(dev)->gen < 6) {
u16 rgvswctl = I915_READ16(MEMSWCTL);
u16 rgvstat = I915_READ16(MEMSTAT_ILK);
 
@@ -1097,124 +1097,126 @@ static int i915_frequency_info(struct seq_file *m, 
void *unused)
   MEMSTAT_VID_SHIFT);
seq_printf(m, "Current P-state: %d\n",
   (rgvstat & MEMSTAT_PSTATE_MASK) >> 
MEMSTAT_PSTATE_SHIFT);
-   } else if (IS_GEN6(dev) || (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) ||
-  IS_BROADWELL(dev)) {
-   u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
-   u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
-   u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
+   } else {
u32 rpmodectl, rpinclimit, rpdeclimit;
-   u32 rpstat, cagf, reqf;
-   u32 rpupei, rpcurup, rpprevup;
-   u32 rpdownei, rpcurdown, rpprevdown;
-   int max_freq;
-
-   /* RPSTAT1 is in the GT power well */
-   ret = mutex_lock_interruptible(&dev->struct_mutex);
-   if (ret)
-   goto out;
+   u32 rpupei, rpcurupei, rpcurup, rpprevup;
+   u32 rpdownei, rpcurdownei, rpcurdown, rpprevdown;
 
gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL);
 
-   reqf = I915_READ(GEN6_RPNSWREQ);
-   reqf &= ~GEN6_TURBO_DISABLE;
-   if (IS_HASWELL(dev) || IS_BROADWELL(dev))
-   reqf >>= 24;
-   else
-   reqf >>= 25;
-   reqf *= GT_FREQUENCY_MULTIPLIER;
+   if (IS_VALLEYVIEW(dev)) {
+   u32 freq_sts, val;
+
+   mutex_lock(&dev_priv->rps.hw_lock);
+   freq_sts = vlv_punit_read(dev_priv, 
PUNIT_REG_GPU_FREQ_STS);
+   seq_printf(m, "PUNIT_REG_GPU_FREQ_STS: 0x%08x\n", 
freq_sts);
+   seq_printf(m, "DDR freq: %d MHz\n", dev_priv->mem_freq);
+
+   val = valleyview_rps_max_freq(dev_priv);
+   seq_printf(m, "max GPU freq: %d MHz\n",
+  vlv_gpu_freq(dev_priv, val));
+
+   val = valleyview_rps_min_freq(dev_priv);
+   seq_printf(m, "min GPU freq: %d MHz\n",
+  vlv_gpu_freq(dev_priv, val));
+
+   seq_printf(m, "current GPU freq: %d MHz\n",
+  vlv_gpu_freq(dev_priv, (freq_sts >> 8) & 
0xff));
+   mutex_unlock(&dev_priv->rps.hw_lock);
+   } else {
+   u32 gt_perf_status;
+   u32 rp_state_limits;
+   u32 rp_state_cap;
+   u32 cagf, reqf;
+   int max_freq;
+
+   gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
+   rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
+   rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
+
+   reqf = I915_READ(GEN6_RPNSWREQ);
+   reqf &= ~GEN6_TURBO_DISABLE;
+   if (IS_HASWELL(dev) || IS_BROADWELL(dev))
+   reqf >>= 24;
+   else
+   reqf >>= 25;
+   reqf *= GT_FREQUENCY_MULTIPLIER;
+
+   cagf = I915_READ(GEN6_RPSTAT1);
+   if (IS_HASWELL(dev) || IS_BROADWELL(dev))
+   cagf = (cagf & HSW_CAGF_MASK) >> HSW_CAGF_SHIFT;
+   else
+   cagf = (cagf & GEN6_CAGF_MASK) >> 
GEN6_CAGF_SHIFT;
+   cagf *= GT_FREQUENCY_MULTIPLIER;
+
+   seq_printf(m, "PM IER=0x%08x IMR=0x%08x ISR=0x%08x

[Intel-gfx] [PATCH 2/7] drm/i915: Make the RPS interrupt generation mask handle the vlv wa

2014-07-10 Thread Chris Wilson
We can eliminate a lot of special case code by making the computation of
the interrupt mask be correct for all callers.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/intel_pm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 5c27065bac17..1302e1bc9136 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3183,6 +3183,9 @@ static u32 gen6_rps_pm_mask(struct drm_i915_private 
*dev_priv, u8 val)
if (val < dev_priv->rps.max_freq_softlimit)
mask |= GEN6_PM_RP_UP_THRESHOLD;
 
+   mask |= dev_priv->pm_rps_events & (GEN6_PM_RP_DOWN_EI_EXPIRED | 
GEN6_PM_RP_UP_EI_EXPIRED);
+   mask &= dev_priv->pm_rps_events;
+
/* IVB and SNB hard hangs on looping batchbuffer
 * if GEN6_PM_UP_EI_EXPIRED is masked.
 */
@@ -3274,11 +3277,8 @@ static void vlv_set_rps_idle(struct drm_i915_private 
*dev_priv)
 
vlv_force_gfx_clock(dev_priv, false);
 
-   if (dev_priv->pm_rps_events & GEN6_PM_RP_UP_EI_EXPIRED)
-   I915_WRITE(GEN6_PMINTRMSK, ~dev_priv->pm_rps_events);
-   else 
-   I915_WRITE(GEN6_PMINTRMSK,
-  gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
+   I915_WRITE(GEN6_PMINTRMSK,
+  gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
 }
 
 void gen6_rps_idle(struct drm_i915_private *dev_priv)
-- 
2.0.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 5/7] drm/i915: Use down ei for manual Baytrail RPS calculations

2014-07-10 Thread Chris Wilson
Use both up/down manual ei calcuations for symmetry and greater
flexibility for reclocking, instead of faking the down interrupt based
on a fixed integer number of up interrupts.

Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_drv.h |  2 --
 drivers/gpu/drm/i915/i915_irq.c | 15 ++-
 drivers/gpu/drm/i915/i915_reg.h |  1 -
 drivers/gpu/drm/i915/intel_pm.c |  5 ++---
 4 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index daee71ef201d..149015b5cb24 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -937,8 +937,6 @@ struct intel_gen6_power_mgmt {
u8 rp1_freq;/* "less than" RP0 power/freqency */
u8 rp0_freq;/* Non-overclocked max frequency. */
 
-   u32 ei_interrupt_count;
-
int last_adj;
enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 2db5dbb87ced..43bd40cc75a6 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1308,7 +1308,6 @@ void gen6_rps_reset_ei(struct drm_i915_private *dev_priv)
 {
vlv_c0_read(dev_priv, &dev_priv->rps.down_ei);
dev_priv->rps.up_ei = dev_priv->rps.down_ei;
-   dev_priv->rps.ei_interrupt_count = 0;
 }
 
 static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir)
@@ -1316,21 +1315,11 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private 
*dev_priv, u32 pm_iir)
struct intel_rps_ei now;
u32 events = 0;
 
-   if ((pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) == 0)
+   if ((pm_iir & (GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_UP_EI_EXPIRED)) 
== 0)
return 0;
 
vlv_c0_read(dev_priv, &now);
 
-   /*
-* To down throttle, C0 residency should be less than down threshold
-* for continous EI intervals. So calculate down EI counters
-* once in VLV_INT_COUNT_FOR_DOWN_EI
-*/
-   if (++dev_priv->rps.ei_interrupt_count >= VLV_INT_COUNT_FOR_DOWN_EI) {
-   pm_iir |= GEN6_PM_RP_DOWN_EI_EXPIRED;
-   dev_priv->rps.ei_interrupt_count = 0;
-   }
-
if (pm_iir & GEN6_PM_RP_DOWN_EI_EXPIRED) {
if (!vlv_c0_above(dev_priv,
  &dev_priv->rps.down_ei, &now,
@@ -4551,7 +4540,7 @@ void intel_irq_init(struct drm_device *dev)
/* Let's track the enabled rps events */
if (IS_VALLEYVIEW(dev))
/* WaGsvRC0ResidenncyMethod:VLV */
-   dev_priv->pm_rps_events = GEN6_PM_RP_UP_EI_EXPIRED;
+   dev_priv->pm_rps_events = GEN6_PM_RP_DOWN_EI_EXPIRED | 
GEN6_PM_RP_UP_EI_EXPIRED;
else
dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 66de6e3e99bf..5571f7714f78 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -566,7 +566,6 @@ enum punit_power_well {
 #define VLV_CZ_CLOCK_TO_MILLI_SEC  10
 #define VLV_RP_UP_EI_THRESHOLD 90
 #define VLV_RP_DOWN_EI_THRESHOLD   70
-#define VLV_INT_COUNT_FOR_DOWN_EI  5
 
 /* vlv2 north clock has */
 #define CCK_FUSE_REG   0x8
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index eb6c54a5b112..f29c643c9926 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3179,11 +3179,10 @@ static u32 gen6_rps_pm_mask(struct drm_i915_private 
*dev_priv, u8 val)
u32 mask = 0;
 
if (val > dev_priv->rps.min_freq_softlimit)
-   mask |= GEN6_PM_RP_DOWN_THRESHOLD | GEN6_PM_RP_DOWN_TIMEOUT;
+   mask |= GEN6_PM_RP_DOWN_EI_EXPIRED | GEN6_PM_RP_DOWN_THRESHOLD 
| GEN6_PM_RP_DOWN_TIMEOUT;
if (val < dev_priv->rps.max_freq_softlimit)
-   mask |= GEN6_PM_RP_UP_THRESHOLD;
+   mask |= GEN6_PM_RP_UP_EI_EXPIRED | GEN6_PM_RP_UP_THRESHOLD;
 
-   mask |= dev_priv->pm_rps_events & (GEN6_PM_RP_DOWN_EI_EXPIRED | 
GEN6_PM_RP_UP_EI_EXPIRED);
mask &= dev_priv->pm_rps_events;
 
/* IVB and SNB hard hangs on looping batchbuffer
-- 
2.0.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Don't cast a pointer to void* unnecessarily

2014-07-10 Thread Paulo Zanoni
2014-07-10 10:52 GMT-03:00 Damien Lespiau :
> C is super happy to asign anything pointer to void *. Don't pretend
> otherwise.

Reviewed-by: Paulo Zanoni 

>
> Signed-off-by: Damien Lespiau 
> ---
>  drivers/gpu/drm/i915/i915_dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index ce69185..2c0bad6 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1596,7 +1596,7 @@ int i915_driver_load(struct drm_device *dev, unsigned 
> long flags)
> if (dev_priv == NULL)
> return -ENOMEM;
>
> -   dev->dev_private = (void *)dev_priv;
> +   dev->dev_private = dev_priv;
> dev_priv->dev = dev;
>
> /* copy initial configuration to dev_priv->info */
> --
> 1.8.3.1
>
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Make the device_info structure __initconst

2014-07-10 Thread Paulo Zanoni
2014-07-10 10:52 GMT-03:00 Damien Lespiau :
> We don't need them past the module initialization as the correct
> structure is copied into dev_priv in ->load(), called from
> drm_pci_init(), called from the module init funtion.
>
> I'm always hesitant about adding new members to struct intel_device_info
> because it will add 30+ * sizeof(member) bytes to the driver. However,
> if we can discard those table after init(), it changes everything.
>
> After this change, the driver has a new .init.rodata section contains
> the structures in question and .rodata has now 2848 fewer bytes.
>
> lsmod shows -5425 bytes in its size field between before and after this
> change. Not too sure why this (Vs the 2848 bytes lost in .rodata), but
> that's enough for me.

I'm not an expert on this area, but it looks correct.
Reviewed-by: Paulo Zanoni 

>
> Signed-off-by: Damien Lespiau 
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 60 
> -
>  1 file changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index bc19623..9f75261 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -63,7 +63,7 @@ static struct drm_driver driver;
>  #define IVB_CURSOR_OFFSETS \
> .cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, 
> IVB_CURSOR_C_OFFSET }
>
> -static const struct intel_device_info intel_i830_info = {
> +static const struct intel_device_info intel_i830_info __initconst = {
> .gen = 2, .is_mobile = 1, .cursor_needs_physical = 1, .num_pipes = 2,
> .has_overlay = 1, .overlay_needs_physical = 1,
> .ring_mask = RENDER_RING,
> @@ -71,7 +71,7 @@ static const struct intel_device_info intel_i830_info = {
> CURSOR_OFFSETS,
>  };
>
> -static const struct intel_device_info intel_845g_info = {
> +static const struct intel_device_info intel_845g_info __initconst = {
> .gen = 2, .num_pipes = 1,
> .has_overlay = 1, .overlay_needs_physical = 1,
> .ring_mask = RENDER_RING,
> @@ -79,7 +79,7 @@ static const struct intel_device_info intel_845g_info = {
> CURSOR_OFFSETS,
>  };
>
> -static const struct intel_device_info intel_i85x_info = {
> +static const struct intel_device_info intel_i85x_info __initconst = {
> .gen = 2, .is_i85x = 1, .is_mobile = 1, .num_pipes = 2,
> .cursor_needs_physical = 1,
> .has_overlay = 1, .overlay_needs_physical = 1,
> @@ -89,7 +89,7 @@ static const struct intel_device_info intel_i85x_info = {
> CURSOR_OFFSETS,
>  };
>
> -static const struct intel_device_info intel_i865g_info = {
> +static const struct intel_device_info intel_i865g_info __initconst = {
> .gen = 2, .num_pipes = 1,
> .has_overlay = 1, .overlay_needs_physical = 1,
> .ring_mask = RENDER_RING,
> @@ -97,14 +97,14 @@ static const struct intel_device_info intel_i865g_info = {
> CURSOR_OFFSETS,
>  };
>
> -static const struct intel_device_info intel_i915g_info = {
> +static const struct intel_device_info intel_i915g_info __initconst = {
> .gen = 3, .is_i915g = 1, .cursor_needs_physical = 1, .num_pipes = 2,
> .has_overlay = 1, .overlay_needs_physical = 1,
> .ring_mask = RENDER_RING,
> GEN_DEFAULT_PIPEOFFSETS,
> CURSOR_OFFSETS,
>  };
> -static const struct intel_device_info intel_i915gm_info = {
> +static const struct intel_device_info intel_i915gm_info __initconst = {
> .gen = 3, .is_mobile = 1, .num_pipes = 2,
> .cursor_needs_physical = 1,
> .has_overlay = 1, .overlay_needs_physical = 1,
> @@ -114,14 +114,14 @@ static const struct intel_device_info intel_i915gm_info 
> = {
> GEN_DEFAULT_PIPEOFFSETS,
> CURSOR_OFFSETS,
>  };
> -static const struct intel_device_info intel_i945g_info = {
> +static const struct intel_device_info intel_i945g_info __initconst = {
> .gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1, .num_pipes = 
> 2,
> .has_overlay = 1, .overlay_needs_physical = 1,
> .ring_mask = RENDER_RING,
> GEN_DEFAULT_PIPEOFFSETS,
> CURSOR_OFFSETS,
>  };
> -static const struct intel_device_info intel_i945gm_info = {
> +static const struct intel_device_info intel_i945gm_info __initconst = {
> .gen = 3, .is_i945gm = 1, .is_mobile = 1, .num_pipes = 2,
> .has_hotplug = 1, .cursor_needs_physical = 1,
> .has_overlay = 1, .overlay_needs_physical = 1,
> @@ -132,7 +132,7 @@ static const struct intel_device_info intel_i945gm_info = 
> {
> CURSOR_OFFSETS,
>  };
>
> -static const struct intel_device_info intel_i965g_info = {
> +static const struct intel_device_info intel_i965g_info __initconst = {
> .gen = 4, .is_broadwater = 1, .num_pipes = 2,
> .has_hotplug = 1,
> .has_overlay = 1,
> @@ -141,7 +141,7 @@ static const struct intel_device_info intel_i965g_info = {
> CURSOR_OFFSETS,
>  };
>
> -static const struct in

Re: [Intel-gfx] [PATCH v2] drm/i915/bdw: BDW Software Turbo

2014-07-10 Thread Chris Wilson
On Thu, Jul 10, 2014 at 11:42:59AM -0700, Sun, Daisy wrote:
> 
> GT is not going to run at a single frequency all the time actually.
> It starts from a single frequency, and then will dynamically adjust
> according to the GT utilization, either go up or down.
> From this perspective, SW turbo function the same as the HW turbo.

Urm, read your code again.

> For the algorithm, we did go over the design forum before implementation.
> What kind of improvement is expected? Please let me know if any
> important case is not taken into account. Thanks.

You have no faststart or boost strategy, so typical desktop usage will
feel very laggy. For a large number of use cases you never change
freequency.
-Chris

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


Re: [Intel-gfx] [PATCH v2] drm/i915/bdw: BDW Software Turbo

2014-07-10 Thread Sun, Daisy


GT is not going to run at a single frequency all the time actually. It 
starts from a single frequency, and then will dynamically adjust 
according to the GT utilization, either go up or down.

From this perspective, SW turbo function the same as the HW turbo.

For the algorithm, we did go over the design forum before implementation.
What kind of improvement is expected? Please let me know if any 
important case is not taken into account. Thanks.


- Daisy
On 7/10/2014 1:32 AM, Chris Wilson wrote:

On Wed, Jul 09, 2014 at 06:00:48PM -0700, Daisy Sun wrote:

BDW supports GT C0 residency reporting in constant time unit. Driver calculates
GT utilization based on C0 residency and adjusts RP frequency up/down
accordingly.

This explanation is a bit thin on the ground for why you want to run
permanently at a single GPU frequency. And the algorithm looks primitive
at best.
-Chris



___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] NEWS: Updates

2014-07-10 Thread Daniel Vetter
Signed-off-by: Daniel Vetter 
---
 NEWS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index 33354f9d5360..1b5ee83ec849 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,12 @@ Release 1.8 (-xx-xx)
 - Added lib/igt.cocci semantic patch to catch often-seen patterns and convert
   them to igt macros/infrastructure.
 
+- Improvements to the documentation build systems (Thomas).
+
+- Small fixes and improvements to the igt infrastructure and helpers all over.
+
+- As usual piles of new tests.
+
 Release 1.7 (2014-06-09)
 
 
-- 
2.0.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] tests: Run igt.cocci

2014-07-10 Thread Daniel Vetter
New stuff caught.

Plus manually simplify the massive igt_fail_on_f(file == NULL, ...) to
a simple igt_assert(file). We already print the errno (if
applicapable) and the condition, which is equally informative.

Cc: Yi Sun 
Cc: Matt Roper 
Cc: Wendy Wang 
Signed-off-by: Daniel Vetter 
---
 tests/kms_plane.c   |  3 +--
 tests/kms_universal_plane.c |  8 +++-
 tests/pm_rc6_residency.c| 11 ---
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index c3c0e5efbca4..93a05bb998b6 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -284,8 +284,7 @@ test_plane_panning_with_output(data_t *data,
drmModeModeInfo *mode;
igt_crc_t crc;
 
-   fprintf(stdout, "Testing connector %s using pipe %c plane %d\n",
-   igt_output_name(output), pipe_name(pipe), plane);
+   igt_info("Testing connector %s using pipe %c plane %d\n", 
igt_output_name(output), pipe_name(pipe), plane);
 
test_init(data, pipe);
 
diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index c64cdbb9d2ca..94d89b87e6c5 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -62,9 +62,8 @@ functional_test_init(functional_test_t *test, igt_output_t 
*output, enum pipe pi
drmModeModeInfo *mode;
 
test->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-   if (!test->pipe_crc)
-   igt_skip("auto crc not supported on this connector with pipe 
%i\n",
-  pipe);
+   igt_skip_on_f(!test->pipe_crc,
+ "auto crc not supported on this connector with pipe 
%i\n", pipe);
 
 
igt_output_set_pipe(output, pipe);
@@ -136,8 +135,7 @@ functional_test_pipe(data_t *data, enum pipe pipe, 
igt_output_t *output)
igt_assert(data->display.has_universal_planes);
igt_skip_on(pipe >= display->n_pipes);
 
-   fprintf(stdout, "Testing connector %s using pipe %c\n",
-   igt_output_name(output), pipe_name(pipe));
+   igt_info("Testing connector %s using pipe %c\n", 
igt_output_name(output), pipe_name(pipe));
 
functional_test_init(&test, output, pipe);
 
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index d364369f8a73..8cf7be392340 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -45,10 +45,7 @@ static unsigned int readit(const char *path)
 
FILE *file;
file = fopen(path, "r");
-   if (file == NULL) {
-   fprintf(stderr, "Couldn't open %s (%d)\n", path, errno);
-   abort();
-   }
+   igt_assert(file);
scanned = fscanf(file, "%u", &ret);
igt_assert(scanned == 1);
 
@@ -113,7 +110,7 @@ static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[
 
if( value [flag + 3] == 0){
tmp_support = 0;
-   printf("This machine doesn't support 
%s\n",name_of_rc6_residency[flag]);
+   igt_info("This machine doesn't support %s\n", 
name_of_rc6_residency[flag]);
}
else
tmp_support = 1;
@@ -125,12 +122,12 @@ static void rc6_residency_counter(int value[],const char 
*name_of_rc6_residency[
flag_support = flag_support << 1;
}
 
-   printf("The residency counter: %f \n", counter_result);
+   igt_info("The residency counter: %f \n", counter_result);
 
igt_skip_on_f(flag_support == 0 , "This machine didn't entry any RC6 
state.\n");
igt_assert_f((flag_counter != 0) && (counter_result <=1) , "Sysfs RC6 
residency counter is inaccurate.\n");
 
-   printf("This machine entry %s state.\n", 
name_of_rc6_residency[(flag_counter / 2) - 1]);
+   igt_info("This machine entry %s state.\n", 
name_of_rc6_residency[(flag_counter / 2) - 1]);
 }
 
 static void rc6_residency_check(int value[])
-- 
2.0.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 42/43] kms_rotation_crc: Remove unnecessary includes

2014-07-10 Thread Damien Lespiau
Turns out we didn't need most of them.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 9aacddd..2005b2a 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -22,15 +22,6 @@
  *
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 
 #include "drmtest.h"
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 43/43] kms_rotation_crc: Use the igt_kms enum to encode the plane rotation

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 2005b2a..5041f90 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -29,11 +29,6 @@
 #include "igt_kms.h"
 #include "igt_core.h"
 
-#define DRM_ROTATE_0   0
-#define DRM_ROTATE_90  1
-#define DRM_ROTATE_180 2
-#define DRM_ROTATE_270 3
-
 typedef struct {
int gfx_fd;
igt_display_t display;
@@ -44,7 +39,7 @@ typedef struct {
 
 static void
 paint_squares(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
- uint32_t rotation)
+ igt_rotation_t rotation)
 {
cairo_t *cr;
int w, h;
@@ -54,7 +49,7 @@ paint_squares(data_t *data, struct igt_fb *fb, 
drmModeModeInfo *mode,
 
cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
 
-   if (rotation == DRM_ROTATE_180) {
+   if (rotation == IGT_ROTATION_180) {
cairo_translate(cr, w, h);
cairo_rotate(cr, M_PI);
}
@@ -98,7 +93,7 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, 
enum pipe pipe,
 
/* Step 1: create a reference CRC for a software-rotated fb */
 
-   paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
+   paint_squares(data, &data->fb, mode, IGT_ROTATION_180);
 
/*
 * XXX: We always set the primary plane to actually enable the pipe as
@@ -121,7 +116,7 @@ static bool prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe,
 * Step 2: prepare the plane with an non-rotated fb let the hw
 * rotate it.
 */
-   paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
+   paint_squares(data, &data->fb, mode, IGT_ROTATION_0);
 
igt_plane_set_fb(plane, &data->fb);
igt_display_commit(display);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 41/43] kms_rotation_crc: Always use the primary plane to compute the reference CRC

2014-07-10 Thread Damien Lespiau
Trying to disable the primary planes isn't exactly working at the
moment. W/A it until it works.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index cb1b00b..9aacddd 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -86,6 +86,7 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, 
enum pipe pipe,
 
igt_output_set_pipe(output, pipe);
 
+
/* create the pipe_crc object for this pipe */
igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
@@ -108,6 +109,18 @@ static bool prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe,
 
paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
 
+   /*
+* XXX: We always set the primary plane to actually enable the pipe as
+* there's no way (that works) to light up a pipe with only a sprite
+* plane enabled at the moment.
+*/
+   if (!plane->is_primary) {
+   igt_plane_t *primary;
+
+   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   igt_plane_set_fb(primary, &data->fb);
+   }
+
igt_plane_set_fb(plane, &data->fb);
igt_display_commit(display);
 
@@ -133,6 +146,15 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output, igt_plane_t *plane)
data->pipe_crc = NULL;
 
igt_remove_fb(data->gfx_fd, &data->fb);
+
+   /* XXX: see the note in prepare_crtc() */
+   if (!plane->is_primary) {
+   igt_plane_t *primary;
+
+   primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   igt_plane_set_fb(primary, NULL);
+   }
+
igt_plane_set_fb(plane, NULL);
igt_output_set_pipe(output, PIPE_ANY);
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 27/43] kms_rotation_crc: Use igt_plane_set_rotation()

2014-07-10 Thread Damien Lespiau
More code we can remove from the test.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 52 +---
 1 file changed, 5 insertions(+), 47 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 308e884..15529c7 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -138,42 +138,6 @@ static bool prepare_crtc(data_t *data, enum pipe pipe)
return true;
 }
 
-static int set_plane_property(data_t *data, int plane_id, const char 
*prop_name, int
-   val, igt_crc_t *crc_output)
-{
-   int i = 0, ret = 0;
-   int drm_fd = data->gfx_fd;
-   uint64_t value;
-   drmModeObjectPropertiesPtr props = NULL;
-
-   value = (uint64_t)val;
-   props = drmModeObjectGetProperties(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE);
-
-   for (i = 0; i < props->count_props; i++) {
-   drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
-   igt_info("\nProp->name=%s: plane_id:%d\n ", prop->name, 
plane_id);
-
-   if (strcmp(prop->name, prop_name) == 0) {
-   ret = drmModeObjectSetProperty(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE,
-   (uint32_t)prop->prop_id, value);
-   if (ret) {
-   igt_info("set_property \"%s\" to %d for plane 
%d is failed, err:%d\n", prop_name, val, plane_id, ret);
-   drmModeFreeProperty(prop);
-   drmModeFreeObjectProperties(props);
-   return ret;
-   } else {
-   /* Collect crc after rotation */
-   igt_pipe_crc_collect_crc(data->pipe_crc, 
crc_output);
-   drmModeFreeProperty(prop);
-   break;
-   }
-   }
-   drmModeFreeProperty(prop);
-   }
-   drmModeFreeObjectProperties(props);
-   return 0;
-}
-
 static void cleanup_crtc(data_t *data, igt_output_t *output)
 {
igt_display_t *display = &data->display;
@@ -193,8 +157,6 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
igt_display_t *display = &data->display;
igt_output_t *output;
int p;
-   int plane_id;
-   int ret;
int valid_tests = 0;
igt_crc_t crc_output;
 
@@ -212,16 +174,12 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
 
igt_require(igt_plane_supports_rotation(data->plane));
 
-   plane_id = data->plane->drm_plane->plane_id;
-   if (plane_id != 0) {
-   igt_info("Setting rotation property for 
plane:%d\n", plane_id);
-   ret = set_plane_property(data, plane_id, 
"rotation", BIT(DRM_ROTATE_180), &crc_output);
-   if (ret < 0) {
-   igt_info("Setting rotation failed!");
-   return;
-   }
-   }
+   igt_plane_set_rotation(data->plane, IGT_ROTATION_180);
+   igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+   igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
igt_assert(igt_crc_equal(&data->ref_crc, &crc_output));
+
sleep(2);
valid_tests++;
cleanup_crtc(data, output);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 35/43] kms_rotation_crc: Allow the sprite test to run even without universal planes

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index d196c7c..d318cd2 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -142,9 +142,12 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane_type)
enum pipe pipe;
int valid_tests = 0;
igt_crc_t crc_output;
+   enum igt_commit_style commit = COMMIT_LEGACY;
 
-   if (plane_type == IGT_PLANE_PRIMARY)
+   if (plane_type == IGT_PLANE_PRIMARY) {
igt_require(data->display.has_universal_planes);
+   commit = COMMIT_UNIVERSAL;
+   }
 
for_each_connected_output(display, output) {
for_each_pipe(display, pipe) {
@@ -159,7 +162,7 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane_type)
continue;
 
igt_plane_set_rotation(plane, IGT_ROTATION_180);
-   igt_display_commit2(display, COMMIT_UNIVERSAL);
+   igt_display_commit2(display, commit);
 
igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
igt_assert(igt_crc_equal(&data->ref_crc, &crc_output));
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 31/43] kms_rotation_crc: Remove 'output' from the state

2014-07-10 Thread Damien Lespiau
This restore the balance between prepare_crtc() and cleanup_crtc(), both
now taking the output as a parameter.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index a68aece..5b195f9 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -46,7 +46,6 @@
 typedef struct {
int gfx_fd;
igt_display_t display;
-   igt_output_t *output;
igt_plane_t *plane;
struct igt_fb fb;
igt_crc_t ref_crc;
@@ -79,7 +78,7 @@ paint_squares(data_t *data, struct igt_fb *fb, 
drmModeModeInfo *mode,
cairo_destroy(cr);
 }
 
-static bool prepare_crtc(data_t *data, enum pipe pipe)
+static bool prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe)
 {
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
@@ -150,9 +149,8 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
igt_require(data->display.has_universal_planes);
 
for_each_connected_output(display, output) {
-   data->output = output;
for_each_pipe(display, pipe) {
-   if (!prepare_crtc(data, pipe))
+   if (!prepare_crtc(data, output, pipe))
continue;
sleep(2);
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 38/43] kms_rotation_crc: Add the test to .gitignore

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/.gitignore b/tests/.gitignore
index da9af6b..985afbd 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -126,6 +126,7 @@ kms_mmio_vs_cs_flip
 kms_pipe_crc_basic
 kms_plane
 kms_render
+kms_rotation_crc
 kms_setmode
 kms_sink_crc_basic
 kms_universal_plane
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 39/43] kms_rotation_crc: Don't compile the test on Android with no cairo support

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/Android.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/Android.mk b/tests/Android.mk
index 663a6b4..22f12ad 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -70,7 +70,8 @@ else
 kms_fence_pin_leak \
 kms_mmio_vs_cs_flip \
 kms_render \
-kms_universal_plane
+kms_universal_plane \
+kms_rotation_crc
 IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
 endif
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 33/43] kms_rotation_crc: Remove plane from the state

2014-07-10 Thread Damien Lespiau
having everythin in the data_t structure makes it hard to understand
what should be set when. Replace that by explicit function parameters.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 31 +--
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 701fa70..75cfff8 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -46,7 +46,6 @@
 typedef struct {
int gfx_fd;
igt_display_t display;
-   igt_plane_t *plane;
struct igt_fb fb;
igt_crc_t ref_crc;
igt_pipe_crc_t *pipe_crc;
@@ -78,7 +77,8 @@ paint_squares(data_t *data, struct igt_fb *fb, 
drmModeModeInfo *mode,
cairo_destroy(cr);
 }
 
-static bool prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe)
+static bool prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
+igt_plane_t *plane)
 {
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
@@ -109,7 +109,7 @@ static bool prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe)
 
paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
 
-   igt_plane_set_fb(data->plane, &data->fb);
+   igt_plane_set_fb(plane, &data->fb);
igt_display_commit(display);
 
/* Collect reference crc */
@@ -117,13 +117,13 @@ static bool prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe)
 
paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
 
-   igt_plane_set_fb(data->plane, &data->fb);
+   igt_plane_set_fb(plane, &data->fb);
igt_display_commit(display);
 
return true;
 }
 
-static void cleanup_crtc(data_t *data, igt_output_t *output)
+static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t 
*plane)
 {
igt_display_t *display = &data->display;
 
@@ -131,13 +131,13 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output)
data->pipe_crc = NULL;
 
igt_remove_fb(data->gfx_fd, &data->fb);
-   igt_plane_set_fb(data->plane, NULL);
+   igt_plane_set_fb(plane, NULL);
igt_output_set_pipe(output, PIPE_ANY);
 
igt_display_commit(display);
 }
 
-static void test_plane_rotation(data_t *data, enum igt_plane plane)
+static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -145,26 +145,29 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
int valid_tests = 0;
igt_crc_t crc_output;
 
-   if (plane == IGT_PLANE_PRIMARY)
+   if (plane_type == IGT_PLANE_PRIMARY)
igt_require(data->display.has_universal_planes);
 
for_each_connected_output(display, output) {
for_each_pipe(display, pipe) {
-   if (!prepare_crtc(data, output, pipe))
-   continue;
+   igt_plane_t *plane;
+
+   igt_output_set_pipe(output, pipe);
 
-   data->plane = igt_output_get_plane(output, plane);
+   plane = igt_output_get_plane(output, plane_type);
+   igt_require(igt_plane_supports_rotation(plane));
 
-   igt_require(igt_plane_supports_rotation(data->plane));
+   if (!prepare_crtc(data, output, pipe, plane))
+   continue;
 
-   igt_plane_set_rotation(data->plane, IGT_ROTATION_180);
+   igt_plane_set_rotation(plane, IGT_ROTATION_180);
igt_display_commit2(display, COMMIT_UNIVERSAL);
 
igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
igt_assert(igt_crc_equal(&data->ref_crc, &crc_output));
 
valid_tests++;
-   cleanup_crtc(data, output);
+   cleanup_crtc(data, output, plane);
}
}
igt_require_f(valid_tests, "no valid crtc/connector combinations 
found\n");
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 36/43] kms_rotation_crc: Don't commit with no fb set up

2014-07-10 Thread Damien Lespiau
prepare_crtc() was trying to commit a display state without any fb to
scan out...

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index d318cd2..5022b99 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -85,7 +85,6 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, 
enum pipe pipe,
int fb_id;
 
igt_output_set_pipe(output, pipe);
-   igt_display_commit(display);
 
/* create the pipe_crc object for this pipe */
igt_pipe_crc_free(data->pipe_crc);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 40/43] kms_rotation_crc: Document the two steps in prepare_crtc()

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5780e40..cb1b00b 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -104,14 +104,19 @@ static bool prepare_crtc(data_t *data, igt_output_t 
*output, enum pipe pipe,
&data->fb);
igt_assert(fb_id);
 
+   /* Step 1: create a reference CRC for a software-rotated fb */
+
paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
 
igt_plane_set_fb(plane, &data->fb);
igt_display_commit(display);
 
-   /* Collect reference crc */
igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
+   /*
+* Step 2: prepare the plane with an non-rotated fb let the hw
+* rotate it.
+*/
paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
 
igt_plane_set_fb(plane, &data->fb);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 34/43] kms_rotation_crc: No need to test for NULL before freeing the pipe CRC object

2014-07-10 Thread Damien Lespiau
igt_pipe_crc_free() does that check already.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 75cfff8..d196c7c 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -88,9 +88,7 @@ static bool prepare_crtc(data_t *data, igt_output_t *output, 
enum pipe pipe,
igt_display_commit(display);
 
/* create the pipe_crc object for this pipe */
-   if (data->pipe_crc)
-   igt_pipe_crc_free(data->pipe_crc);
-
+   igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
if (!data->pipe_crc) {
igt_info("auto crc not supported on this connector with pipe 
%i\n",
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 37/43] kms_rotation_crc: Properly paint the whole frame buffer

2014-07-10 Thread Damien Lespiau
The -1 meant we weren't properly filling the whole fb.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5022b99..5780e40 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -70,9 +70,9 @@ paint_squares(data_t *data, struct igt_fb *fb, 
drmModeModeInfo *mode,
 
/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
igt_paint_color(cr, 0, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
-   igt_paint_color(cr, (w / 2) - 1, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
-   igt_paint_color(cr, 0, (h / 2) - 1, w / 2, h / 2, 0.0, 0.0, 1.0);
-   igt_paint_color(cr, (w / 2) - 1, (h / 2) - 1, w / 2, h / 2, 1.0, 1.0, 
1.0);
+   igt_paint_color(cr, w / 2, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
+   igt_paint_color(cr, 0, h / 2, w / 2, h / 2, 0.0, 0.0, 1.0);
+   igt_paint_color(cr, w / 2, h / 2, w / 2, h / 2, 1.0, 1.0, 1.0);
 
cairo_destroy(cr);
 }
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 26/43] kms_rotation_crc: Don't store 'pipe' in the state

2014-07-10 Thread Damien Lespiau
This variable is only needed for prepare_crtc(), need need to put it in
the test state.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 81d001b..308e884 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -58,7 +58,6 @@ typedef struct {
igt_display_t display;
igt_output_t *output;
igt_plane_t *plane;
-   int pipe;
struct igt_fb fb;
igt_crc_t ref_crc;
igt_pipe_crc_t *pipe_crc;
@@ -90,14 +89,14 @@ paint_squares(data_t *data, struct igt_fb *fb, 
drmModeModeInfo *mode,
cairo_destroy(cr);
 }
 
-static bool prepare_crtc(data_t *data)
+static bool prepare_crtc(data_t *data, enum pipe pipe)
 {
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
igt_output_t *output = data->output;
int fb_id;
 
-   igt_output_set_pipe(output, data->pipe);
+   igt_output_set_pipe(output, pipe);
igt_display_commit(display);
 
if (!data->output->valid)
@@ -107,11 +106,10 @@ static bool prepare_crtc(data_t *data)
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
 
-   data->pipe_crc = igt_pipe_crc_new(data->pipe,
- INTEL_PIPE_CRC_SOURCE_AUTO);
+   data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
if (!data->pipe_crc) {
igt_info("auto crc not supported on this connector with pipe 
%i\n",
-data->pipe);
+pipe);
return false;
}
 
@@ -206,9 +204,7 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
for_each_connected_output(display, output) {
data->output = output;
for (p = 0; p < igt_display_get_n_pipes(display); p++) {
-   data->pipe = p;
-
-   if (!prepare_crtc(data))
+   if (!prepare_crtc(data, p))
continue;
sleep(2);
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 32/43] kms_rotation_crc: Remove the sleep(2)

2014-07-10 Thread Damien Lespiau
One can inspect the output of the igt_kms API by setting
IGT_DISPLAY_WAIT_AT_COMMIT=1.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5b195f9..701fa70 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -152,7 +152,6 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
for_each_pipe(display, pipe) {
if (!prepare_crtc(data, output, pipe))
continue;
-   sleep(2);
 
data->plane = igt_output_get_plane(output, plane);
 
@@ -164,7 +163,6 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
igt_assert(igt_crc_equal(&data->ref_crc, &crc_output));
 
-   sleep(2);
valid_tests++;
cleanup_crtc(data, output);
}
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 23/43] kms_rotation_crc: Unify the two tests

2014-07-10 Thread Damien Lespiau
The only difference is which plane we are talking about. So we really
need one function here with a paramater.

Well, almost. For the primary plane we need to ensure we support
unviversal planes.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 54 ++--
 1 file changed, 6 insertions(+), 48 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 966fd12..0edc6c3 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -193,50 +193,7 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output)
igt_display_commit(display);
 }
 
-static void test_sprite_rotation(data_t *data)
-{
-   igt_display_t *display = &data->display;
-   igt_output_t *output;
-   igt_crc_t crc_output;
-   int p;
-   int plane_id;
-   int ret;
-   int valid_tests = 0;
-
-   for_each_connected_output(display, output) {
-   data->output = output;
-   for (p = 0; p < igt_display_get_n_pipes(display); p++) {
-   data->pipe = p;
-   data->rotate = DRM_ROTATE_180;
-
-   if (!prepare_crtc(data))
-   continue;
-   sleep(2);
-
-   data->plane = igt_output_get_plane(output, IGT_PLANE_2);
-
-   igt_require(igt_plane_supports_rotation(data->plane));
-
-   plane_id = data->plane->drm_plane->plane_id;
-   if (plane_id != 0) {
-   igt_info("Setting rotation property for 
plane:%d\n", plane_id);
-   ret = set_plane_property(data, plane_id, 
"rotation", BIT(data->rotate), &crc_output);
-   if (ret < 0) {
-   igt_info("Setting rotation failed!");
-   return;
-   }
-   }
-   igt_assert(igt_crc_equal(&data->ref_crc, &crc_output));
-   sleep(2);
-   valid_tests++;
-   cleanup_crtc(data, output);
-   }
-   }
-   igt_require_f(valid_tests, "no valid crtc/connector combinations 
found\n");
-}
-
-
-static void test_primary_rotation(data_t *data)
+static void test_plane_rotation(data_t *data, enum igt_plane plane)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -246,7 +203,8 @@ static void test_primary_rotation(data_t *data)
int valid_tests = 0;
igt_crc_t crc_output;
 
-   igt_require(data->display.has_universal_planes);
+   if (plane == IGT_PLANE_PRIMARY)
+   igt_require(data->display.has_universal_planes);
 
for_each_connected_output(display, output) {
data->output = output;
@@ -258,7 +216,7 @@ static void test_primary_rotation(data_t *data)
continue;
sleep(2);
 
-   data->plane = igt_output_get_plane(output, 
IGT_PLANE_PRIMARY);
+   data->plane = igt_output_get_plane(output, plane);
 
igt_require(igt_plane_supports_rotation(data->plane));
 
@@ -297,10 +255,10 @@ igt_main
}
 
igt_subtest_f("primary-rotation")
-   test_primary_rotation(&data);
+   test_plane_rotation(&data, IGT_PLANE_PRIMARY);
 
igt_subtest_f("sprite-rotation")
-   test_sprite_rotation(&data);
+   test_plane_rotation(&data, IGT_PLANE_2);
 
igt_fixture {
igt_display_fini(&data.display);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 14/43] kms_rotation_crc: Fix style issue: '{' at the end of lines

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index db1ad57..9c194ce 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -183,12 +183,10 @@ static bool check_plane_type(int drm_fd, uint32_t 
plane_id, uint32_t type)
 
props = drmModeObjectGetProperties(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE);
 
-   for (i = 0; i < props->count_props; i++)
-   {
+   for (i = 0; i < props->count_props; i++) {
drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
 
-   if (strcmp(prop->name, "type") == 0)
-   {
+   if (strcmp(prop->name, "type") == 0) {
if (props->prop_values[i] == type) {
return true;
}
@@ -250,23 +248,19 @@ static int set_plane_property(data_t *data, int plane_id, 
const char *prop_name,
value = (uint64_t)val;
props = drmModeObjectGetProperties(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE);
 
-   for (i = 0; i < props->count_props; i++)
-   {
+   for (i = 0; i < props->count_props; i++) {
drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
igt_info("\nProp->name=%s: plane_id:%d\n ", prop->name, 
plane_id);
 
-   if (strcmp(prop->name, prop_name) == 0)
-   {
+   if (strcmp(prop->name, prop_name) == 0) {
ret = drmModeObjectSetProperty(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE,
(uint32_t)prop->prop_id, value);
-   if (ret)
-   {
+   if (ret) {
igt_info("set_property \"%s\" to %d for plane 
%d is failed, err:%d\n", prop_name, val, plane_id, ret);
drmModeFreeProperty(prop);
drmModeFreeObjectProperties(props);
return ret;
-   }
-   else {
+   } else {
/* Collect crc after rotation */
igt_pipe_crc_collect_crc(data->pipe_crc, 
crc_output);
drmModeFreeProperty(prop);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 25/43] kms_rotation_crc: Don't store rotate in the test state

2014-07-10 Thread Damien Lespiau
We don't use it anywhere else than the test function.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 30eb227..81d001b 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -62,7 +62,6 @@ typedef struct {
struct igt_fb fb;
igt_crc_t ref_crc;
igt_pipe_crc_t *pipe_crc;
-   int rotate;
 } data_t;
 
 static void
@@ -208,7 +207,6 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
data->output = output;
for (p = 0; p < igt_display_get_n_pipes(display); p++) {
data->pipe = p;
-   data->rotate = DRM_ROTATE_180;
 
if (!prepare_crtc(data))
continue;
@@ -221,7 +219,7 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
plane_id = data->plane->drm_plane->plane_id;
if (plane_id != 0) {
igt_info("Setting rotation property for 
plane:%d\n", plane_id);
-   ret = set_plane_property(data, plane_id, 
"rotation", BIT(data->rotate), &crc_output);
+   ret = set_plane_property(data, plane_id, 
"rotation", BIT(DRM_ROTATE_180), &crc_output);
if (ret < 0) {
igt_info("Setting rotation failed!");
return;
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 28/43] kms_rotation_crc: Remove now unnecessary defines

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 15529c7..58852c2 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -42,16 +42,6 @@
 #define DRM_ROTATE_90  1
 #define DRM_ROTATE_180 2
 #define DRM_ROTATE_270 3
-#define DRM_REFLECT_X  4
-#define DRM_REFLECT_Y  5
-#define DRM_ROTATE_NUM 6
-
-#define BIT(x) (1 << x)
-
-// This will be part of libdrm later. Adding here temporarily
-#define DRM_PLANE_TYPE_OVERLAY 0
-#define DRM_PLANE_TYPE_PRIMARY 1
-#define DRM_PLANE_TYPE_CURSOR  2
 
 typedef struct {
int gfx_fd;
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 22/43] kms_rotation_crc: Just store the igt_plane_t in data

2014-07-10 Thread Damien Lespiau
Now that we're always using an igt_plane_t, we can get rid of ->type to
use ->directly without those switch() or if()/else

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 46 +++---
 1 file changed, 11 insertions(+), 35 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 026c333..966fd12 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -57,7 +57,7 @@ typedef struct {
int gfx_fd;
igt_display_t display;
igt_output_t *output;
-   int type;
+   igt_plane_t *plane;
int pipe;
struct igt_fb fb;
igt_crc_t ref_crc;
@@ -96,7 +96,6 @@ static bool prepare_crtc(data_t *data)
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
igt_output_t *output = data->output;
-   igt_plane_t *plane;
int fb_id;
 
igt_output_set_pipe(output, data->pipe);
@@ -105,19 +104,6 @@ static bool prepare_crtc(data_t *data)
if (!data->output->valid)
return false;
 
-   switch (data->type) {
-   case DRM_PLANE_TYPE_OVERLAY:
-   igt_info("Sprite plane\n");
-   plane = igt_output_get_plane(output, IGT_PLANE_2);
-   break;
-   case DRM_PLANE_TYPE_PRIMARY:
-   igt_info("Primary plane\n");
-   plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-   break;
-   default:
-   return false;
-   }
-
/* create the pipe_crc object for this pipe */
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
@@ -141,7 +127,7 @@ static bool prepare_crtc(data_t *data)
 
paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
 
-   igt_plane_set_fb(plane, &data->fb);
+   igt_plane_set_fb(data->plane, &data->fb);
igt_display_commit(display);
 
/* Collect reference crc */
@@ -149,7 +135,7 @@ static bool prepare_crtc(data_t *data)
 
paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
 
-   igt_plane_set_fb(plane, &data->fb);
+   igt_plane_set_fb(data->plane, &data->fb);
igt_display_commit(display);
 
return true;
@@ -194,20 +180,14 @@ static int set_plane_property(data_t *data, int plane_id, 
const char *prop_name,
 static void cleanup_crtc(data_t *data, igt_output_t *output)
 {
igt_display_t *display = &data->display;
-   igt_plane_t *plane = NULL;
 
igt_pipe_crc_free(data->pipe_crc);
data->pipe_crc = NULL;
 
igt_remove_fb(data->gfx_fd, &data->fb);
 
-   if (data->type == DRM_PLANE_TYPE_PRIMARY)
-   plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-   else if (data->type == DRM_PLANE_TYPE_OVERLAY)
-   plane = igt_output_get_plane(output, IGT_PLANE_2);
-
-   if (plane != NULL)
-   igt_plane_set_fb(plane, NULL);
+   if (data->plane != NULL)
+   igt_plane_set_fb(data->plane, NULL);
 
igt_output_set_pipe(output, PIPE_ANY);
igt_display_commit(display);
@@ -217,7 +197,6 @@ static void test_sprite_rotation(data_t *data)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
-   igt_plane_t *sprite;
igt_crc_t crc_output;
int p;
int plane_id;
@@ -228,18 +207,17 @@ static void test_sprite_rotation(data_t *data)
data->output = output;
for (p = 0; p < igt_display_get_n_pipes(display); p++) {
data->pipe = p;
-   data->type = 0;
data->rotate = DRM_ROTATE_180;
 
if (!prepare_crtc(data))
continue;
sleep(2);
 
-   sprite = igt_output_get_plane(output, IGT_PLANE_2);
+   data->plane = igt_output_get_plane(output, IGT_PLANE_2);
 
-   igt_require(igt_plane_supports_rotation(sprite));
+   igt_require(igt_plane_supports_rotation(data->plane));
 
-   plane_id = sprite->drm_plane->plane_id;
+   plane_id = data->plane->drm_plane->plane_id;
if (plane_id != 0) {
igt_info("Setting rotation property for 
plane:%d\n", plane_id);
ret = set_plane_property(data, plane_id, 
"rotation", BIT(data->rotate), &crc_output);
@@ -262,7 +240,6 @@ static void test_primary_rotation(data_t *data)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
-   igt_plane_t *primary;
int p;
int plane_id;
int ret;
@@ -275,18 +252,17 @@ static void test_primary_rotation(data_t *data)
data->output = output;
for (p = 0; p < igt_display_get_n_pipes(display); p++) {
   

[Intel-gfx] [PATCH i-g-t 13/43] kms_rotation_crc: Require universal planes for the testing primary rotation

2014-07-10 Thread Damien Lespiau
Otherwise the test will fail instead of just skipping.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 1f2953d..db1ad57 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -355,6 +355,8 @@ static void test_primary_rotation(data_t *data)
int valid_tests = 0;
igt_crc_t crc_output;
 
+   igt_require(data->display.has_universal_planes);
+
for_each_connected_output(display, output) {
data->output = output;
for (p = 0; p < igt_display_get_n_pipes(display); p++) {
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 15/43] kms_rotation_crc: Fix style issue: single statement conditionals

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 9c194ce..eb63326 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -187,9 +187,9 @@ static bool check_plane_type(int drm_fd, uint32_t plane_id, 
uint32_t type)
drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
 
if (strcmp(prop->name, "type") == 0) {
-   if (props->prop_values[i] == type) {
+   if (props->prop_values[i] == type)
return true;
-   }
+
igt_info("Didn't find the requested type:%u\n", 
(unsigned int)props->prop_values[i]);
}
}
@@ -283,12 +283,10 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output)
 
igt_remove_fb(data->gfx_fd, &data->fb);
 
-   if (data->type == DRM_PLANE_TYPE_PRIMARY) {
+   if (data->type == DRM_PLANE_TYPE_PRIMARY)
plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-   }
-   else if (data->type == DRM_PLANE_TYPE_OVERLAY) {
+   else if (data->type == DRM_PLANE_TYPE_OVERLAY)
plane = igt_output_get_plane(output, IGT_PLANE_2);
-   }
 
if (plane != NULL)
igt_plane_set_fb(plane, NULL);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 21/43] kms_rotation_crc: Skip the tests if rotation is not supported

2014-07-10 Thread Damien Lespiau
This happens when the kernel lacks the rotation patches.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 341f7bc..026c333 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -236,6 +236,9 @@ static void test_sprite_rotation(data_t *data)
sleep(2);
 
sprite = igt_output_get_plane(output, IGT_PLANE_2);
+
+   igt_require(igt_plane_supports_rotation(sprite));
+
plane_id = sprite->drm_plane->plane_id;
if (plane_id != 0) {
igt_info("Setting rotation property for 
plane:%d\n", plane_id);
@@ -280,6 +283,9 @@ static void test_primary_rotation(data_t *data)
sleep(2);
 
primary = igt_output_get_plane(output, 
IGT_PLANE_PRIMARY);
+
+   igt_require(igt_plane_supports_rotation(primary));
+
plane_id = primary->drm_plane->plane_id;
if (plane_id != 0) {
igt_info("Setting rotation property for 
plane:%d\n", plane_id);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 20/43] kms_rotation_crc: Style issue: binary operators need spaces before and after

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f062b52..341f7bc 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -83,10 +83,10 @@ paint_squares(data_t *data, struct igt_fb *fb, 
drmModeModeInfo *mode,
}
 
/* Paint with 4 squares of Red, Green, White, Blue Clockwise */
-   igt_paint_color(cr, 0, 0, w/2, h/2, 1.0, 0.0, 0.0);
-   igt_paint_color(cr, (w/2)-1, 0, w/2, h/2, 0.0, 1.0, 0.0);
-   igt_paint_color(cr, 0, (h/2)-1, w/2, h/2, 0.0, 0.0, 1.0);
-   igt_paint_color(cr, (w/2)-1, (h/2)-1, w/2, h/2, 1.0, 1.0, 1.0);
+   igt_paint_color(cr, 0, 0, w / 2, h / 2, 1.0, 0.0, 0.0);
+   igt_paint_color(cr, (w / 2) - 1, 0, w / 2, h / 2, 0.0, 1.0, 0.0);
+   igt_paint_color(cr, 0, (h / 2) - 1, w / 2, h / 2, 0.0, 0.0, 1.0);
+   igt_paint_color(cr, (w / 2) - 1, (h / 2) - 1, w / 2, h / 2, 1.0, 1.0, 
1.0);
 
cairo_destroy(cr);
 }
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 24/43] kms_rotation_crc: Always disable the plane in cleanup

2014-07-10 Thread Damien Lespiau
There's no need for this check, always use set_fb(NULL) on the plane.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 0edc6c3..30eb227 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -185,11 +185,9 @@ static void cleanup_crtc(data_t *data, igt_output_t 
*output)
data->pipe_crc = NULL;
 
igt_remove_fb(data->gfx_fd, &data->fb);
-
-   if (data->plane != NULL)
-   igt_plane_set_fb(data->plane, NULL);
-
+   igt_plane_set_fb(data->plane, NULL);
igt_output_set_pipe(output, PIPE_ANY);
+
igt_display_commit(display);
 }
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 16/43] kms_rotation_crc: Factor out the square drawing function

2014-07-10 Thread Damien Lespiau
Making function to the similar things is very common in programming.
Let's do it once again.

Cairo being a drawing library, it can be used to do the rotation!

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 65 ++--
 1 file changed, 35 insertions(+), 30 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index eb63326..5f499d7 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "drmtest.h"
 #include "igt_debugfs.h"
@@ -65,15 +66,39 @@ typedef struct {
int rotate;
 } data_t;
 
+static void
+paint_squares(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
+ uint32_t rotation)
+{
+   cairo_t *cr;
+   int w, h;
+
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
+
+   if (rotation == DRM_ROTATE_180) {
+   cairo_translate(cr, w, h);
+   cairo_rotate(cr, M_PI);
+   }
+
+   /* Paint with 4 squares of Red, Green, White, Blue Clockwise */
+   igt_paint_color(cr, 0, 0, w/2, h/2, 1.0, 0.0, 0.0);
+   igt_paint_color(cr, (w/2)-1, 0, w/2, h/2, 0.0, 1.0, 0.0);
+   igt_paint_color(cr, 0, (h/2)-1, w/2, h/2, 0.0, 0.0, 1.0);
+   igt_paint_color(cr, (w/2)-1, (h/2)-1, w/2, h/2, 1.0, 1.0, 1.0);
+
+   cairo_destroy(cr);
+}
+
 static bool prepare_crtc(data_t *data)
 {
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
igt_output_t *output = data->output;
-   cairo_t *cr;
igt_plane_t *primary, *sprite;
int fb_id;
-   int w, h;
 
igt_output_set_pipe(output, data->pipe);
igt_display_commit(display);
@@ -98,8 +123,6 @@ static bool prepare_crtc(data_t *data)
case DRM_PLANE_TYPE_OVERLAY: /* Sprite */
igt_info("Sprite plane\n");
mode = igt_output_get_mode(output);
-   w = mode->hdisplay;
-   h = mode->vdisplay;
 
fb_id = igt_create_fb(data->gfx_fd,
mode->hdisplay, mode->vdisplay,
@@ -107,13 +130,9 @@ static bool prepare_crtc(data_t *data)
false, /* tiled */
&data->fb);
igt_assert(fb_id);
-   cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
 
-   /* Paint rotated image of 4 colors */
-   igt_paint_color(cr, (w/2)-1, (h/2)-1, w/2, h/2, 1.0, 
0.0, 0.0);
-   igt_paint_color(cr, 0, (h/2)-1, w/2, h/2, 0.0, 1.0, 
0.0);
-   igt_paint_color(cr, (w/2)-1, 0, w/2, h/2, 0.0, 0.0, 
1.0);
-   igt_paint_color(cr, 0, 0, w/2, h/2, 1.0, 1.0, 1.0);
+   paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
+
sprite = igt_output_get_plane(output, IGT_PLANE_2);
igt_plane_set_fb(sprite, &data->fb);
igt_display_commit(display);
@@ -121,12 +140,8 @@ static bool prepare_crtc(data_t *data)
/* Collect reference crc */
igt_pipe_crc_collect_crc(data->pipe_crc, 
&data->ref_crc[1]);
 
-   /* Paint with 4 squares of Red, Green, White, Blue 
Clockwise */
-   igt_paint_color(cr, 0, 0, w/2, h/2, 1.0, 0.0, 0.0);
-   igt_paint_color(cr, (w/2)-1, 0, w/2, h/2, 0.0, 1.0, 
0.0);
-   igt_paint_color(cr, 0, (h/2)-1, w/2, h/2, 0.0, 0.0, 
1.0);
-   igt_paint_color(cr, (w/2)-1, (h/2)-1, w/2, h/2, 1.0, 
1.0, 1.0);
-   cairo_destroy(cr);
+   paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
+
sprite = igt_output_get_plane(output, IGT_PLANE_2);
igt_plane_set_fb(sprite, &data->fb);
igt_display_commit(display);
@@ -135,8 +150,6 @@ static bool prepare_crtc(data_t *data)
case DRM_PLANE_TYPE_PRIMARY: /* Primary */
igt_info("Primary plane\n");
mode = igt_output_get_mode(output);
-   w = mode->hdisplay;
-   h = mode->vdisplay;
 
fb_id = igt_create_fb(data->gfx_fd,
  mode->hdisplay, mode->vdisplay,
@@ -144,13 +157,9 @@ static bool prepare_crtc(data_t *data)
  false, /* tiled */
  &data->fb);
igt_assert(fb_id);
-   cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
 
-   /* Paint rotated image of 4 colors */
-   igt_paint_color

[Intel-gfx] [PATCH i-g-t 18/43] kms_rotation_crc: Remove useless comments

2014-07-10 Thread Damien Lespiau
A typical example of what comments shouldn't be:

 case DRM_PLANE_TYPE_PRIMARY: /* primary */

Well, yes!, it's written just there, PRIMARY!

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index bc11b9c..e4af24d 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -107,11 +107,11 @@ static bool prepare_crtc(data_t *data)
return false;
 
switch (data->type) {
-   case DRM_PLANE_TYPE_OVERLAY: /* Sprite */
+   case DRM_PLANE_TYPE_OVERLAY:
igt_info("Sprite plane\n");
plane = igt_output_get_plane(output, IGT_PLANE_2);
break;
-   case DRM_PLANE_TYPE_PRIMARY: /* Primary */
+   case DRM_PLANE_TYPE_PRIMARY:
igt_info("Primary plane\n");
plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
break;
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 30/43] kms_rotation_crc: Remove the test on output->valid

2014-07-10 Thread Damien Lespiau
This test is already done by the for_each_connected_output() macro.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index ae0ca21..a68aece 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -83,15 +83,11 @@ static bool prepare_crtc(data_t *data, enum pipe pipe)
 {
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
-   igt_output_t *output = data->output;
int fb_id;
 
igt_output_set_pipe(output, pipe);
igt_display_commit(display);
 
-   if (!data->output->valid)
-   return false;
-
/* create the pipe_crc object for this pipe */
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 11/43] kms_rotation_crc: Update the copyright to have this year as well

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 485a6df..f5a569a 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2013 Intel Corporation
+ * Copyright © 2013,2014 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 10/43] kms_rotation_crc: Align a few wrapped lines to the opening brace

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index b079376..485a6df 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -83,10 +83,10 @@ static bool prepare_crtc(data_t *data)
igt_pipe_crc_free(data->pipe_crc);
 
data->pipe_crc = igt_pipe_crc_new(data->pipe,
-   INTEL_PIPE_CRC_SOURCE_AUTO);
+ INTEL_PIPE_CRC_SOURCE_AUTO);
if (!data->pipe_crc) {
igt_info("auto crc not supported on this connector with pipe 
%i\n",
-   data->pipe);
+data->pipe);
return false;
}
 
@@ -143,10 +143,10 @@ static bool prepare_crtc(data_t *data)
h = mode->vdisplay;
 
fb_id = igt_create_fb(data->gfx_fd,
-   mode->hdisplay, mode->vdisplay,
-   DRM_FORMAT_XRGB,
-   false, /* tiled */
-   &data->fb);
+ mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB,
+ false, /* tiled */
+ &data->fb);
igt_assert(fb_id);
cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
 
@@ -218,7 +218,7 @@ static int connector_find_plane(int gfx_fd, uint32_t pipe, 
uint32_t type)
plane_resources = drmModeGetPlaneResources(gfx_fd);
if (!plane_resources) {
igt_info("drmModeGetPlaneResources failed: %s\n",
-   strerror(errno));
+strerror(errno));
return 0;
}
 
@@ -226,7 +226,7 @@ static int connector_find_plane(int gfx_fd, uint32_t pipe, 
uint32_t type)
ovr = drmModeGetPlane(gfx_fd, plane_resources->planes[i]);
if (!ovr) {
igt_info("drmModeGetPlane failed: %s\n",
-   strerror(errno));
+strerror(errno));
continue;
}
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 19/43] kms_rotation_crc: Use drm_plane from igt_plane_t

2014-07-10 Thread Damien Lespiau
So we don't need all that extra code to grab the drm_plane structure for
the primary_plane.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 70 +++-
 1 file changed, 3 insertions(+), 67 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index e4af24d..f062b52 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -52,7 +52,6 @@
 #define DRM_PLANE_TYPE_OVERLAY 0
 #define DRM_PLANE_TYPE_PRIMARY 1
 #define DRM_PLANE_TYPE_CURSOR  2
-#define DRM_CLIENT_CAP_EXPOSE_PRIMARY_PLANES 2
 
 typedef struct {
int gfx_fd;
@@ -156,67 +155,6 @@ static bool prepare_crtc(data_t *data)
return true;
 }
 
-static bool check_plane_type(int drm_fd, uint32_t plane_id, uint32_t type)
-{
-   int i = 0;
-   drmModeObjectPropertiesPtr props = NULL;
-
-   props = drmModeObjectGetProperties(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE);
-
-   for (i = 0; i < props->count_props; i++) {
-   drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
-
-   if (strcmp(prop->name, "type") == 0) {
-   if (props->prop_values[i] == type)
-   return true;
-
-   igt_info("Didn't find the requested type:%u\n", 
(unsigned int)props->prop_values[i]);
-   }
-   }
-   return false;
-}
-
-static int connector_find_plane(int gfx_fd, uint32_t pipe, uint32_t type)
-{
-   drmModePlaneRes *plane_resources;
-   drmModePlane *ovr;
-   uint32_t id = 0;
-   int i, ret = 0;
-
-   ret = drmSetClientCap(gfx_fd, DRM_CLIENT_CAP_EXPOSE_PRIMARY_PLANES, 1);
-   if (ret < 0) {
-   igt_info("Failed to set client cap:%d\n", ret);
-   return 0;
-   }
-
-   plane_resources = drmModeGetPlaneResources(gfx_fd);
-   if (!plane_resources) {
-   igt_info("drmModeGetPlaneResources failed: %s\n",
-strerror(errno));
-   return 0;
-   }
-
-   for (i = 0; i < plane_resources->count_planes; i++) {
-   ovr = drmModeGetPlane(gfx_fd, plane_resources->planes[i]);
-   if (!ovr) {
-   igt_info("drmModeGetPlane failed: %s\n",
-strerror(errno));
-   continue;
-   }
-
-   if (ovr->possible_crtcs & (1 << pipe)) {
-   id = ovr->plane_id;
-   if (check_plane_type(gfx_fd, id, type)) {
-   drmModeFreePlane(ovr);
-   return id;
-   }
-   }
-   drmModeFreePlane(ovr);
-   }
-
-   return 0;
-}
-
 static int set_plane_property(data_t *data, int plane_id, const char 
*prop_name, int
val, igt_crc_t *crc_output)
 {
@@ -321,6 +259,7 @@ static void test_primary_rotation(data_t *data)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
+   igt_plane_t *primary;
int p;
int plane_id;
int ret;
@@ -340,11 +279,8 @@ static void test_primary_rotation(data_t *data)
continue;
sleep(2);
 
-   /* Find primary plane. Currently igt_plane_t returned 
from
-* igt_output_get_plane has NULL drm_plane which is 
needed to get
-* the plane_id. So finding the primary plane by 
checking the "type"
-* property of the plane */
-   plane_id = connector_find_plane(data->gfx_fd, 
data->pipe, data->type);
+   primary = igt_output_get_plane(output, 
IGT_PLANE_PRIMARY);
+   plane_id = primary->drm_plane->plane_id;
if (plane_id != 0) {
igt_info("Setting rotation property for 
plane:%d\n", plane_id);
ret = set_plane_property(data, plane_id, 
"rotation", BIT(data->rotate), &crc_output);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 07/43] tests/kms_rotation_crc: IGT for 180 degree HW rotation

2014-07-10 Thread Damien Lespiau
From: Sonika Jindal 

Testcase for 180 degree HW rotation

Cc: sagar.a.kam...@intel.com

Signed-off-by: Sonika Jindal 
---
 tests/Makefile.sources   |   1 +
 tests/kms_rotation_crc.c | 427 +++
 2 files changed, 428 insertions(+)
 create mode 100644 tests/kms_rotation_crc.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 1ebbac5..cb8c3d4 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -71,6 +71,7 @@ TESTS_progs_M = \
kms_plane \
kms_psr_sink_crc \
kms_render \
+   kms_rotation_crc \
kms_setmode \
kms_universal_plane \
pm_lpsp \
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
new file mode 100644
index 000..74a52cd
--- /dev/null
+++ b/tests/kms_rotation_crc.c
@@ -0,0 +1,427 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+#include "igt_kms.h"
+#include "igt_core.h"
+
+#define DRM_ROTATE_0   0
+#define DRM_ROTATE_90  1
+#define DRM_ROTATE_180 2
+#define DRM_ROTATE_270 3
+#define DRM_REFLECT_X  4
+#define DRM_REFLECT_Y  5
+#define DRM_ROTATE_NUM 6
+
+#define BIT(x) (1 << x)
+
+// This will be part of libdrm later. Adding here temporarily
+#define DRM_PLANE_TYPE_OVERLAY 0
+#define DRM_PLANE_TYPE_PRIMARY 1
+#define DRM_PLANE_TYPE_CURSOR  2
+#define DRM_CLIENT_CAP_EXPOSE_PRIMARY_PLANES 2
+
+typedef struct {
+   int gfx_fd;
+   igt_display_t display;
+   igt_output_t *output;
+   int type;
+   int pipe;
+   struct igt_fb fb;
+   igt_crc_t ref_crc[2];
+   igt_pipe_crc_t *pipe_crc;
+   int rotate;
+} data_t;
+
+bool check_plane_type(int drm_fd, uint32_t plane_id, uint32_t type);
+int set_plane_property(data_t *data, int plane_id, const char *prop_name, int
+   val, igt_crc_t *crc_output);
+void test_sprite_rotation(data_t *data);
+void test_primary_rotation(data_t *data);
+bool prepare_crtc(data_t *data);
+
+bool prepare_crtc(data_t *data)
+{
+   drmModeModeInfo *mode;
+   igt_display_t *display = &data->display;
+   igt_output_t *output = data->output;
+   cairo_t *cr;
+   igt_plane_t *primary, *sprite;
+   int fb_id;
+   int w, h;
+
+   igt_output_set_pipe(output, data->pipe);
+   igt_display_commit(display);
+
+   /* create the pipe_crc object for this pipe */
+   if (data->pipe_crc)
+   igt_pipe_crc_free(data->pipe_crc);
+
+   data->pipe_crc = igt_pipe_crc_new(data->pipe,
+   INTEL_PIPE_CRC_SOURCE_AUTO);
+   if (!data->pipe_crc) {
+   igt_info("auto crc not supported on this connector with pipe 
%i\n",
+   data->pipe);
+   return false;
+   }
+
+
+   if (!data->output->valid) {
+   igt_output_set_pipe(output, PIPE_ANY);
+   igt_display_commit(display);
+   return false;
+   }
+
+   switch (data->type) {
+
+   case DRM_PLANE_TYPE_OVERLAY: /* Sprite */
+   igt_info("Sprite plane\n");
+   mode = igt_output_get_mode(output);
+   w = mode->hdisplay;
+   h = mode->vdisplay;
+
+   fb_id = igt_create_fb(data->gfx_fd,
+   mode->hdisplay, mode->vdisplay,
+   DRM_FORMAT_XRGB,
+   false, /* tiled */
+   &data->fb);
+   igt_assert(fb_id);
+   cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
+
+   /* Paint rotated image of 4 colors */
+   igt_pa

[Intel-gfx] [PATCH i-g-t 29/43] kms_rotation_crc: Use for_each_pipe()

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 58852c2..ae0ca21 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -146,7 +146,7 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
-   int p;
+   enum pipe pipe;
int valid_tests = 0;
igt_crc_t crc_output;
 
@@ -155,8 +155,8 @@ static void test_plane_rotation(data_t *data, enum 
igt_plane plane)
 
for_each_connected_output(display, output) {
data->output = output;
-   for (p = 0; p < igt_display_get_n_pipes(display); p++) {
-   if (!prepare_crtc(data, p))
+   for_each_pipe(display, pipe) {
+   if (!prepare_crtc(data, pipe))
continue;
sleep(2);
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 17/43] kms_rotation_crc: Factor out common primary/sprite code in prepare_crtc()

2014-07-10 Thread Damien Lespiau
This results in less code, always a good thing. Also, we only really
need one reference CRC.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 89 +---
 1 file changed, 32 insertions(+), 57 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 5f499d7..bc11b9c 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -61,7 +61,7 @@ typedef struct {
int type;
int pipe;
struct igt_fb fb;
-   igt_crc_t ref_crc[2];
+   igt_crc_t ref_crc;
igt_pipe_crc_t *pipe_crc;
int rotate;
 } data_t;
@@ -97,7 +97,7 @@ static bool prepare_crtc(data_t *data)
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
igt_output_t *output = data->output;
-   igt_plane_t *primary, *sprite;
+   igt_plane_t *plane;
int fb_id;
 
igt_output_set_pipe(output, data->pipe);
@@ -106,6 +106,19 @@ static bool prepare_crtc(data_t *data)
if (!data->output->valid)
return false;
 
+   switch (data->type) {
+   case DRM_PLANE_TYPE_OVERLAY: /* Sprite */
+   igt_info("Sprite plane\n");
+   plane = igt_output_get_plane(output, IGT_PLANE_2);
+   break;
+   case DRM_PLANE_TYPE_PRIMARY: /* Primary */
+   igt_info("Primary plane\n");
+   plane = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+   break;
+   default:
+   return false;
+   }
+
/* create the pipe_crc object for this pipe */
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
@@ -118,65 +131,27 @@ static bool prepare_crtc(data_t *data)
return false;
}
 
-   switch (data->type) {
-
-   case DRM_PLANE_TYPE_OVERLAY: /* Sprite */
-   igt_info("Sprite plane\n");
-   mode = igt_output_get_mode(output);
-
-   fb_id = igt_create_fb(data->gfx_fd,
-   mode->hdisplay, mode->vdisplay,
-   DRM_FORMAT_XRGB,
-   false, /* tiled */
-   &data->fb);
-   igt_assert(fb_id);
-
-   paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
-
-   sprite = igt_output_get_plane(output, IGT_PLANE_2);
-   igt_plane_set_fb(sprite, &data->fb);
-   igt_display_commit(display);
-
-   /* Collect reference crc */
-   igt_pipe_crc_collect_crc(data->pipe_crc, 
&data->ref_crc[1]);
-
-   paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
-
-   sprite = igt_output_get_plane(output, IGT_PLANE_2);
-   igt_plane_set_fb(sprite, &data->fb);
-   igt_display_commit(display);
-
-   break;
-   case DRM_PLANE_TYPE_PRIMARY: /* Primary */
-   igt_info("Primary plane\n");
-   mode = igt_output_get_mode(output);
-
-   fb_id = igt_create_fb(data->gfx_fd,
- mode->hdisplay, mode->vdisplay,
- DRM_FORMAT_XRGB,
- false, /* tiled */
- &data->fb);
-   igt_assert(fb_id);
-
-   paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
-
-   primary = igt_output_get_plane(output, 
IGT_PLANE_PRIMARY);
-   igt_plane_set_fb(primary, &data->fb);
-   igt_display_commit(display);
+   mode = igt_output_get_mode(output);
 
-   /* Collect reference crc */
-   igt_pipe_crc_collect_crc(data->pipe_crc, 
&data->ref_crc[0]);
+   fb_id = igt_create_fb(data->gfx_fd,
+   mode->hdisplay, mode->vdisplay,
+   DRM_FORMAT_XRGB,
+   false, /* tiled */
+   &data->fb);
+   igt_assert(fb_id);
 
-   paint_squares(data, &data->fb, mode, DRM_ROTATE_0);
+   paint_squares(data, &data->fb, mode, DRM_ROTATE_180);
 
-   primary = igt_output_get_plane(output, 
IGT_PLANE_PRIMARY);
-   igt_plane_set_fb(primary, &data->fb);
-   igt_display_commit(display);
+   igt_plane_set_fb(plane, &data->fb);
+   igt_display_commit(display);
 
-   break;
+   /* Collect reference crc */
+   igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
+   paint_squares(data, &data->fb, mode, DRM_

[Intel-gfx] [PATCH i-g-t 03/43] igt_kms: Provide a get_plane_property() shorthand

2014-07-10 Thread Damien Lespiau
So one doesn't have to write the plane type all the time.

Signed-off-by: Damien Lespiau 
---
 lib/igt_kms.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 666b0d0..5c8a3cc 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -529,6 +529,14 @@ out:
return found;
 }
 
+static bool
+get_plane_property(igt_display_t *display, uint32_t plane_id, const char *name,
+  uint32_t *prop_id /* out */, uint64_t *value /* out */)
+{
+   return get_property(display, plane_id, DRM_MODE_OBJECT_PLANE,
+   name, prop_id, value);
+}
+
 /*
  * Walk a plane's property list to determine its type.  If we don't
  * find a type property, then the kernel doesn't support universal
@@ -539,8 +547,8 @@ static int get_drm_plane_type(igt_display_t *display, 
uint32_t plane_id)
uint64_t value;
bool has_prop;
 
-   has_prop = get_property(display, plane_id, DRM_MODE_OBJECT_PLANE,
-   "type", NULL /* prop_id */, &value);
+   has_prop = get_plane_property(display, plane_id, "type",
+ NULL /* prop_id */, &value);
if (has_prop)
return (int)value;
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 06/43] igt_kms: Introduce a for_each_pipe() macro

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 lib/igt_kms.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index d34bcee..9e7bc2b 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -202,6 +202,9 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
for (int i__ = 0;  i__ < (display)->n_outputs; i__++)   \
if ((output = &(display)->outputs[i__]), output->valid)
 
+#define for_each_pipe(display, pipe)   \
+   for (pipe = 0; pipe < igt_display_get_n_pipes(display); pipe++) \
+
 /*
  * Can be used with igt_output_set_pipe() to mean we don't care about the pipe
  * that should drive this output
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 12/43] kms_rotation_crc: Test the validity of the output first

2014-07-10 Thread Damien Lespiau
So we don't need code to unwind what we just did.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index f5a569a..1f2953d 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -78,6 +78,9 @@ static bool prepare_crtc(data_t *data)
igt_output_set_pipe(output, data->pipe);
igt_display_commit(display);
 
+   if (!data->output->valid)
+   return false;
+
/* create the pipe_crc object for this pipe */
if (data->pipe_crc)
igt_pipe_crc_free(data->pipe_crc);
@@ -90,13 +93,6 @@ static bool prepare_crtc(data_t *data)
return false;
}
 
-
-   if (!data->output->valid) {
-   igt_output_set_pipe(output, PIPE_ANY);
-   igt_display_commit(display);
-   return false;
-   }
-
switch (data->type) {
 
case DRM_PLANE_TYPE_OVERLAY: /* Sprite */
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 05/43] igt_kms: Add support for setting plane rotation

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 lib/igt_kms.c | 54 ++
 lib/igt_kms.h | 11 +++
 2 files changed, 65 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 87f5109..69f9977 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -537,6 +537,16 @@ get_plane_property(igt_display_t *display, uint32_t 
plane_id, const char *name,
name, prop_id, value);
 }
 
+static void
+igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
+{
+   igt_pipe_t *pipe = plane->pipe;
+   igt_display_t *display = pipe->display;
+
+   drmModeObjectSetProperty(display->drm_fd, plane->drm_plane->plane_id,
+DRM_MODE_OBJECT_PLANE, prop_id, value);
+}
+
 /*
  * Walk a plane's property list to determine its type.  If we don't
  * find a type property, then the kernel doesn't support universal
@@ -882,6 +892,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 
igt_assert(plane->drm_plane);
 
+   /* it's an error to try an unsupported feature */
+   igt_assert(igt_plane_supports_rotation(plane) ||
+  !plane->rotation_changed);
+
fb_id = igt_plane_get_fb_id(plane);
crtc_id = output->config.crtc->crtc_id;
 
@@ -931,6 +945,14 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
 
plane->fb_changed = false;
plane->position_changed = false;
+
+   if (plane->rotation_changed) {
+   igt_plane_set_property(plane, plane->rotation_property,
+  plane->rotation);
+
+   plane->rotation_changed = false;
+   }
+
return 0;
 }
 
@@ -1013,6 +1035,9 @@ static int igt_primary_plane_commit_legacy(igt_plane_t 
*primary,
/* Primary planes can't be windowed when using a legacy commit */
igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
 
+   /* nor rotated */
+   igt_assert(!primary->rotation_changed);
+
if (!primary->fb_changed && !primary->position_changed &&
!primary->panning_changed)
return 0;
@@ -1304,6 +1329,35 @@ void igt_plane_set_panning(igt_plane_t *plane, int x, 
int y)
plane->panning_changed = true;
 }
 
+static const char *rotation_name(igt_rotation_t rotation)
+{
+   switch (rotation) {
+   case IGT_ROTATION_0:
+   return "0°";
+   case IGT_ROTATION_90:
+   return "90°";
+   case IGT_ROTATION_180:
+   return "180°";
+   case IGT_ROTATION_270:
+   return "270°";
+   default:
+   igt_assert(0);
+   }
+}
+
+void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
+{
+   igt_pipe_t *pipe = plane->pipe;
+   igt_display_t *display = pipe->display;
+
+   LOG(display, "%c.%d: plane_set_rotation(%s)\n", pipe_name(pipe->pipe),
+   plane->index, rotation_name(rotation));
+
+   plane->rotation = rotation;
+
+   plane->rotation_changed = true;
+}
+
 void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
 {
drmVBlank wait_vbl;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 4f3474e..d34bcee 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -71,6 +71,14 @@ enum igt_commit_style {
/* We'll add atomic here eventually. */
 };
 
+typedef enum {
+   /* this maps to the kernel API */
+   IGT_ROTATION_0   = 1 << 0,
+   IGT_ROTATION_90  = 1 << 1,
+   IGT_ROTATION_180 = 1 << 2,
+   IGT_ROTATION_270 = 1 << 3,
+} igt_rotation_t;
+
 #include "igt_fb.h"
 
 struct kmstest_connector_config {
@@ -116,6 +124,7 @@ typedef struct {
unsigned int fb_changed   : 1;
unsigned int position_changed : 1;
unsigned int panning_changed  : 1;
+   unsigned int rotation_changed : 1;
/*
 * drm_plane can be NULL for primary and cursor planes (when not
 * using the atomic modeset API)
@@ -129,6 +138,7 @@ typedef struct {
int crtc_x, crtc_y;
/* panning offset within the fb */
unsigned int pan_x, pan_y;
+   igt_rotation_t rotation;
 } igt_plane_t;
 
 struct igt_pipe {
@@ -184,6 +194,7 @@ static inline bool igt_plane_supports_rotation(igt_plane_t 
*plane)
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
 void igt_plane_set_position(igt_plane_t *plane, int x, int y);
 void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
+void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
 
 void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 09/43] kms_rotation_crc: Make more functions static

2014-07-10 Thread Damien Lespiau
More of the same. This time no need to move code around, just adding
static.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 6249e0f..b079376 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -65,13 +65,7 @@ typedef struct {
int rotate;
 } data_t;
 
-int set_plane_property(data_t *data, int plane_id, const char *prop_name, int
-   val, igt_crc_t *crc_output);
-void test_sprite_rotation(data_t *data);
-void test_primary_rotation(data_t *data);
-bool prepare_crtc(data_t *data);
-
-bool prepare_crtc(data_t *data)
+static bool prepare_crtc(data_t *data)
 {
drmModeModeInfo *mode;
igt_display_t *display = &data->display;
@@ -249,7 +243,7 @@ static int connector_find_plane(int gfx_fd, uint32_t pipe, 
uint32_t type)
return 0;
 }
 
-int set_plane_property(data_t *data, int plane_id, const char *prop_name, int
+static int set_plane_property(data_t *data, int plane_id, const char 
*prop_name, int
val, igt_crc_t *crc_output)
 {
int i = 0, ret = 0;
@@ -313,7 +307,7 @@ static void cleanup_crtc(data_t *data, igt_output_t *output)
igt_display_commit(display);
 }
 
-void test_sprite_rotation(data_t *data)
+static void test_sprite_rotation(data_t *data)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
@@ -355,7 +349,7 @@ void test_sprite_rotation(data_t *data)
 }
 
 
-void test_primary_rotation(data_t *data)
+static void test_primary_rotation(data_t *data)
 {
igt_display_t *display = &data->display;
igt_output_t *output;
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 02/43] igt_kms: Make has_universal_planes a bitfield

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 lib/igt_kms.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index a079fc2..058114a 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -153,7 +153,7 @@ struct igt_display {
unsigned long pipes_in_use;
igt_output_t *outputs;
igt_pipe_t pipes[I915_MAX_PIPES];
-   bool has_universal_planes;
+   unsigned int has_universal_planes : 1;
 };
 
 /* set vt into graphics mode, required to prevent fbcon from interfering */
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 08/43] kms_rotation_crc: Make check_plane_type() static

2014-07-10 Thread Damien Lespiau
Clearly, someone tried to solve the following warning:
  kms_rotation_crc.c:189:6: warning: no previous prototype for 
‘check_plane_type’ [-Wmissing-prototypes]

Without really understanding what was the warning about. Make
check_plane_type() static and move it before its user to get rid of the forward
declaration.

Signed-off-by: Damien Lespiau 
---
 tests/kms_rotation_crc.c | 45 ++---
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 74a52cd..6249e0f 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -65,7 +65,6 @@ typedef struct {
int rotate;
 } data_t;
 
-bool check_plane_type(int drm_fd, uint32_t plane_id, uint32_t type);
 int set_plane_property(data_t *data, int plane_id, const char *prop_name, int
val, igt_crc_t *crc_output);
 void test_sprite_rotation(data_t *data);
@@ -187,6 +186,28 @@ bool prepare_crtc(data_t *data)
return true;
 }
 
+static bool check_plane_type(int drm_fd, uint32_t plane_id, uint32_t type)
+{
+   int i = 0;
+   drmModeObjectPropertiesPtr props = NULL;
+
+   props = drmModeObjectGetProperties(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE);
+
+   for (i = 0; i < props->count_props; i++)
+   {
+   drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
+
+   if (strcmp(prop->name, "type") == 0)
+   {
+   if (props->prop_values[i] == type) {
+   return true;
+   }
+   igt_info("Didn't find the requested type:%u\n", 
(unsigned int)props->prop_values[i]);
+   }
+   }
+   return false;
+}
+
 static int connector_find_plane(int gfx_fd, uint32_t pipe, uint32_t type)
 {
drmModePlaneRes *plane_resources;
@@ -228,28 +249,6 @@ static int connector_find_plane(int gfx_fd, uint32_t pipe, 
uint32_t type)
return 0;
 }
 
-bool check_plane_type(int drm_fd, uint32_t plane_id, uint32_t type)
-{
-   int i = 0;
-   drmModeObjectPropertiesPtr props = NULL;
-
-   props = drmModeObjectGetProperties(drm_fd, plane_id, 
DRM_MODE_OBJECT_PLANE);
-
-   for (i = 0; i < props->count_props; i++)
-   {
-   drmModePropertyPtr prop = drmModeGetProperty(drm_fd, 
props->props[i]);
-
-   if (strcmp(prop->name, "type") == 0)
-   {
-   if (props->prop_values[i] == type) {
-   return true;
-   }
-   igt_info("Didn't find the requested type:%u\n", 
(unsigned int)props->prop_values[i]);
-   }
-   }
-   return false;
-}
-
 int set_plane_property(data_t *data, int plane_id, const char *prop_name, int
val, igt_crc_t *crc_output)
 {
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 04/43] igt_kms: Add a way to query of the plane supports rotation

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 lib/igt_kms.c |  7 +++
 lib/igt_kms.h | 10 ++
 2 files changed, 17 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5c8a3cc..87f5109 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -592,6 +592,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
/* add the planes that can be used with that pipe */
for (j = 0; j < plane_resources->count_planes; j++) {
drmModePlane *drm_plane;
+   uint64_t prop_value;
 
drm_plane = drmModeGetPlane(display->drm_fd,
plane_resources->planes[j]);
@@ -632,6 +633,12 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 
plane->pipe = pipe;
plane->drm_plane = drm_plane;
+
+   get_plane_property(display, drm_plane->plane_id,
+  "rotation",
+  &plane->rotation_property,
+  &prop_value);
+   plane->rotation = (igt_rotation_t)prop_value;
}
 
if (display->has_universal_planes) {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 058114a..4f3474e 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -109,8 +109,10 @@ typedef struct {
/*< private >*/
igt_pipe_t *pipe;
int index;
+   /* capabilities */
unsigned int is_primary   : 1;
unsigned int is_cursor: 1;
+   /* state tracking */
unsigned int fb_changed   : 1;
unsigned int position_changed : 1;
unsigned int panning_changed  : 1;
@@ -120,6 +122,9 @@ typedef struct {
 */
drmModePlane *drm_plane;
struct igt_fb *fb;
+
+   uint32_t rotation_property;
+
/* position within pipe_src_w x pipe_src_h */
int crtc_x, crtc_y;
/* panning offset within the fb */
@@ -171,6 +176,11 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
 igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane);
 
+static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
+{
+   return plane->rotation_property != 0;
+}
+
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
 void igt_plane_set_position(igt_plane_t *plane, int x, int y);
 void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 01/43] igt_kms: Factor out a generic get_property() out of get_drm_plane_type()

2014-07-10 Thread Damien Lespiau
Signed-off-by: Damien Lespiau 
---
 lib/igt_kms.c | 45 -
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 4a8c394..666b0d0 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -495,37 +495,56 @@ static void igt_output_refresh(igt_output_t *output)
display->pipes_in_use |= 1 << output->config.pipe;
 }
 
-/*
- * Walk a plane's property list to determine its type.  If we don't
- * find a type property, then the kernel doesn't support universal
- * planes and we know the plane is an overlay/sprite.
- */
-static int get_drm_plane_type(igt_display_t *display, uint32_t plane_id)
+static bool
+get_property(igt_display_t *display,
+uint32_t object_id, uint32_t object_type, const char *name,
+uint32_t *prop_id /* out */, uint64_t *value /* out */)
 {
drmModeObjectPropertiesPtr proplist;
drmModePropertyPtr prop = NULL;
-   int type = DRM_PLANE_TYPE_OVERLAY;
+   bool found = false;
int i;
 
proplist = drmModeObjectGetProperties(display->drm_fd,
- plane_id,
- DRM_MODE_OBJECT_PLANE);
+ object_id, object_type);
for (i = 0; i < proplist->count_props; i++) {
drmModeFreeProperty(prop);
prop = drmModeGetProperty(display->drm_fd, proplist->props[i]);
if (!prop)
continue;
 
-   if (strcmp(prop->name, "type") == 0) {
-   type = proplist->prop_values[i];
-   break;
+   if (strcmp(prop->name, name) == 0) {
+   found = true;
+   if (prop_id)
+   *prop_id = proplist->props[i];
+   if (value)
+   *value = proplist->prop_values[i];
+   goto out;
}
}
 
+out:
drmModeFreeProperty(prop);
drmModeFreeObjectProperties(proplist);
+   return found;
+}
+
+/*
+ * Walk a plane's property list to determine its type.  If we don't
+ * find a type property, then the kernel doesn't support universal
+ * planes and we know the plane is an overlay/sprite.
+ */
+static int get_drm_plane_type(igt_display_t *display, uint32_t plane_id)
+{
+   uint64_t value;
+   bool has_prop;
+
+   has_prop = get_property(display, plane_id, DRM_MODE_OBJECT_PLANE,
+   "type", NULL /* prop_id */, &value);
+   if (has_prop)
+   return (int)value;
 
-   return type;
+   return DRM_PLANE_TYPE_OVERLAY;
 }
 
 void igt_display_init(igt_display_t *display, int drm_fd)
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 00/43] Rotation test

2014-07-10 Thread Damien Lespiau
I've taken the current rotation test to test the kernel patches and improved it
a bit along the way. It's a bit like a detailed review, but with patches
instead of comments.

With the rotation kernel patches and an IVB machine, that test now passes.

Part of the motivation has been to augment the igt_kms framework to deal with
properties.  Another reason include the number of lines we need to write for a
test. This series brings down that number from 325 to 129, something I can live
with.

HTH,

-- 
Damien

Damien Lespiau (42):
  igt_kms: Factor out a generic get_property() out of
get_drm_plane_type()
  igt_kms: Make has_universal_planes a bitfield
  igt_kms: Provide a get_plane_property() shorthand
  igt_kms: Add a way to query of the plane supports rotation
  igt_kms: Add support for setting plane rotation
  igt_kms: Introduce a for_each_pipe() macro
  kms_rotation_crc: Make check_plane_type() static
  kms_rotation_crc: Make more functions static
  kms_rotation_crc: Align a few wrapped lines to the opening brace
  kms_rotation_crc: Update the copyright to have this year as well
  kms_rotation_crc: Test the validity of the output first
  kms_rotation_crc: Require universal planes for the testing primary
rotation
  kms_rotation_crc: Fix style issue: '{' at the end of lines
  kms_rotation_crc: Fix style issue: single statement conditionals
  kms_rotation_crc: Factor out the square drawing function
  kms_rotation_crc: Factor out common primary/sprite code in
prepare_crtc()
  kms_rotation_crc: Remove useless comments
  kms_rotation_crc: Use drm_plane from igt_plane_t
  kms_rotation_crc: Style issue: binary operators need spaces before and
after
  kms_rotation_crc: Skip the tests if rotation is not supported
  kms_rotation_crc: Just store the igt_plane_t in data
  kms_rotation_crc: Unify the two tests
  kms_rotation_crc: Always disable the plane in cleanup
  kms_rotation_crc: Don't store rotate in the test state
  kms_rotation_crc: Don't store 'pipe' in the state
  kms_rotation_crc: Use igt_plane_set_rotation()
  kms_rotation_crc: Remove now unnecessary defines
  kms_rotation_crc: Use for_each_pipe()
  kms_rotation_crc: Remove the test on output->valid
  kms_rotation_crc: Remove 'output' from the state
  kms_rotation_crc: Remove the sleep(2)
  kms_rotation_crc: Remove plane from the state
  kms_rotation_crc: No need to test for NULL before freeing the pipe CRC
object
  kms_rotation_crc: Allow the sprite test to run even without universal
planes
  kms_rotation_crc: Don't commit with no fb set up
  kms_rotation_crc: Properly paint the whole frame buffer
  kms_rotation_crc: Add the test to .gitignore
  kms_rotation_crc: Don't compile the test on Android with no cairo
support
  kms_rotation_crc: Document the two steps in prepare_crtc()
  kms_rotation_crc: Always use the primary plane to compute the
reference CRC
  kms_rotation_crc: Remove unnecessary includes
  kms_rotation_crc: Use the igt_kms enum to encode the plane rotation

Sonika Jindal (1):
  tests/kms_rotation_crc: IGT for 180 degree HW rotation

 lib/igt_kms.c| 114 ++---
 lib/igt_kms.h|  26 +-
 tests/.gitignore |   1 +
 tests/Android.mk |   3 +-
 tests/Makefile.sources   |   1 +
 tests/kms_rotation_crc.c | 214 +++
 6 files changed, 344 insertions(+), 15 deletions(-)
 create mode 100644 tests/kms_rotation_crc.c

-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drv_module_reload: Unbind the right console driver

2014-07-10 Thread Daniel Vetter
We want to unbind fbcon, but only fbcon and only if it's there.

This was broken by the recent patch in 3.16-rc to kick out the vgacon
driver. I've forgotten to push out the relevant fix from the machine
used to create the kick vgacon patches.

Reported-by: Damien Lespiau 
Cc: Damien Lespiau 
Signed-off-by: Daniel Vetter 
---
 tests/drv_module_reload | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/drv_module_reload b/tests/drv_module_reload
index 66cd6bbb4545..5cbff891c2e9 100755
--- a/tests/drv_module_reload
+++ b/tests/drv_module_reload
@@ -10,13 +10,13 @@ SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 
 # no other drm service should be running, so we can just unbind
 
-# vtcon0 is vga, vtcon1 fbcon and let's pray that won't change due to boot load
-# time changes
-if ! echo 0 > /sys/class/vtconsole/vtcon1/bind ; then
-   echo -e "no kms unload support"
-   echo "please enable CONFIG_VT_HW_CONSOLE_BINDING in the kernel"
-   exit 77
-fi
+# we must kick away fbcon (but only fbcon)
+for vtcon in /sys/class/vtconsole/vtcon*/ ; do
+   if grep "frame buffer device" $vtcon/name > /dev/null ; then
+   echo unbinding $vtcon: `cat $vtcon/name`
+   echo 0 > $vtcon/bind
+   fi
+done
 
 # The sound driver uses our power well
 pkill alsactl
-- 
1.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 4/4] drm/i915: don't read LVDS regs at compute_config time

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 01:38:36PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> We may reach this point while the machine is still runtime suspended,
> so we'll hit a WARN. The other encoders also don't touch registers at
> this point, so instead of waking the machine up, write some code to
> keep the register always at the same state, including after we runtime
> suspend/resume.
> 
> Testcase: igt/pm_rpm
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80463
> Signed-off-by: Paulo Zanoni 

I would store lvds_bpp directly in the encoder structure, have the logic
around A3 power in the _init() function and don't bother re-writing the
A3,B3 control. But anyway, this looks correct to me.

Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_lvds.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c 
> b/drivers/gpu/drm/i915/intel_lvds.c
> index 8aa7973..c511287 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -51,6 +51,7 @@ struct intel_lvds_encoder {
>  
>   bool is_dual_link;
>   u32 reg;
> + u32 a3_power;
>  
>   struct intel_lvds_connector *attached_connector;
>  };
> @@ -170,8 +171,11 @@ static void intel_pre_enable_lvds(struct intel_encoder 
> *encoder)
>  
>   /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
>* appropriately here, but we need to look more thoroughly into how
> -  * panels behave in the two modes.
> +  * panels behave in the two modes. For now, let's just maintain the
> +  * value we got from the BIOS.
>*/
> +  temp &= ~LVDS_A3_POWER_MASK;
> +  temp |= lvds_encoder->a3_power;


I guess we actually don't need this as we'll be just preserving what we
read earlier.

>  
>   /* Set the dithering flag on LVDS as needed, note that there is no
>* special lvds dither control bit on pch-split platforms, dithering is
> @@ -269,7 +273,6 @@ static bool intel_lvds_compute_config(struct 
> intel_encoder *intel_encoder,
> struct intel_crtc_config *pipe_config)
>  {
>   struct drm_device *dev = intel_encoder->base.dev;
> - struct drm_i915_private *dev_priv = dev->dev_private;
>   struct intel_lvds_encoder *lvds_encoder =
>   to_lvds_encoder(&intel_encoder->base);
>   struct intel_connector *intel_connector =
> @@ -284,8 +287,7 @@ static bool intel_lvds_compute_config(struct 
> intel_encoder *intel_encoder,
>   return false;
>   }
>  
> - if ((I915_READ(lvds_encoder->reg) & LVDS_A3_POWER_MASK) ==
> - LVDS_A3_POWER_UP)
> + if (lvds_encoder->a3_power == LVDS_A3_POWER_UP)
>   lvds_bpp = 8*3;
>   else
>   lvds_bpp = 6*3;
> @@ -1086,6 +1088,9 @@ out:
>   DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
> lvds_encoder->is_dual_link ? "dual" : "single");
>  
> + lvds_encoder->a3_power = I915_READ(lvds_encoder->reg) &
> +  LVDS_A3_POWER_MASK;
> +
>   /*
>* Unlock registers and just
>* leave them unlocked
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] lib/gen6_render: removed duplicate defines

2014-07-10 Thread Mika Kuoppala
Damien Lespiau  writes:

> On Thu, Jul 10, 2014 at 03:47:55PM +0300, Mika Kuoppala wrote:
>> Textually the same so no harm was done and no warnings
>> from compiler either.
>> 
>> Signed-off-by: Mika Kuoppala 
>
> Ship it!

Will do.

> (is there a patch 2/2?)

Not for public consumption, not yet. Just my fail with format-patch.
-Mika
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] lib/gen6_render: removed duplicate defines

2014-07-10 Thread Damien Lespiau
On Thu, Jul 10, 2014 at 03:47:55PM +0300, Mika Kuoppala wrote:
> Textually the same so no harm was done and no warnings
> from compiler either.
> 
> Signed-off-by: Mika Kuoppala 

Ship it!

(is there a patch 2/2?)

-- 
Damien
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 20/19] drm/i915: don't skip shared DPLL assertion on LPT

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 11:30:28AM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> Since we now have support for shared DPLLS.
> 
> Signed-off-by: Paulo Zanoni 

Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 -
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index d5861bf..5187341 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1094,11 +1094,6 @@ void assert_shared_dpll(struct drm_i915_private 
> *dev_priv,
>   bool cur_state;
>   struct intel_dpll_hw_state hw_state;
>  
> - if (HAS_PCH_LPT(dev_priv->dev)) {
> - DRM_DEBUG_DRIVER("LPT detected: skipping PCH PLL test\n");
> - return;
> - }
> -
>   if (WARN (!pll,
> "asserting DPLL %s with no DPLL\n", state_string(state)))
>   return;
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 14/19] drm/i915: State readout support for WRPLLs

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 11:27:39AM -0300, Paulo Zanoni wrote:
> From: Daniel Vetter 
> 
> Still tacked onto the side, but slowly getting there.
> 
> v2: Don't forget the debugfs file.
> 
> v3 (from Paulo): Don't forget to check the power domains.
> 
> Signed-off-by: Daniel Vetter 
> Reviewed-by: Damien Lespiau 
> Signed-off-by: Paulo Zanoni 

As always, there's nothing replacing testing:

for v3: Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c  |  1 +
>  drivers/gpu/drm/i915/i915_drv.h  |  1 +
>  drivers/gpu/drm/i915/i915_reg.h  |  1 +
>  drivers/gpu/drm/i915/intel_ddi.c | 19 +++
>  drivers/gpu/drm/i915/intel_display.c |  9 +
>  5 files changed, 31 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index e79ddbf..7d72768 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2409,6 +2409,7 @@ static int i915_shared_dplls_info(struct seq_file *m, 
> void *unused)
>   seq_printf(m, " dpll_md: 0x%08x\n", pll->hw_state.dpll_md);
>   seq_printf(m, " fp0: 0x%08x\n", pll->hw_state.fp0);
>   seq_printf(m, " fp1: 0x%08x\n", pll->hw_state.fp1);
> + seq_printf(m, " wrpll:   0x%08x\n", pll->hw_state.wrpll);
>   }
>   drm_modeset_unlock_all(dev);
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 2ec7cb6..c1fa561 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -197,6 +197,7 @@ struct intel_dpll_hw_state {
>   uint32_t dpll_md;
>   uint32_t fp0;
>   uint32_t fp1;
> + uint32_t wrpll;
>  };
>  
>  struct intel_shared_dpll {
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 3d61a53..654417e 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5900,6 +5900,7 @@ enum punit_power_well {
>  /* WRPLL */
>  #define WRPLL_CTL1   0x46040
>  #define WRPLL_CTL2   0x46060
> +#define WRPLL_CTL(pll)   (pll == 0 ? WRPLL_CTL1 : 
> WRPLL_CTL2)
>  #define  WRPLL_PLL_ENABLE(1<<31)
>  #define  WRPLL_PLL_SSC   (1<<28)
>  #define  WRPLL_PLL_NON_SSC   (2<<28)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> b/drivers/gpu/drm/i915/intel_ddi.c
> index fae73d3..79cbb5e 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -790,6 +790,8 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
>   intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL2;
>   intel_crtc->config.shared_dpll = DPLL_ID_WRPLL2;
>   }
> +
> + intel_crtc->config.dpll_hw_state.wrpll = val;
>   }
>  
>   return true;
> @@ -1315,6 +1317,21 @@ int intel_ddi_get_cdclk_freq(struct drm_i915_private 
> *dev_priv)
>   }
>  }
>  
> +static bool hsw_ddi_pll_get_hw_state(struct drm_i915_private *dev_priv,
> +  struct intel_shared_dpll *pll,
> +  struct intel_dpll_hw_state *hw_state)
> +{
> + uint32_t val;
> +
> + if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PLLS))
> + return false;
> +
> + val = I915_READ(WRPLL_CTL(pll->id));
> + hw_state->wrpll = val;
> +
> + return val & WRPLL_PLL_ENABLE;
> +}
> +
>  static char *hsw_ddi_pll_names[] = {
>   "WRPLL 1",
>   "WRPLL 2",
> @@ -1333,6 +1350,8 @@ void intel_ddi_pll_init(struct drm_device *dev)
>   for (i = 0; i < 2; i++) {
>   dev_priv->shared_dplls[i].id = i;
>   dev_priv->shared_dplls[i].name = hsw_ddi_pll_names[i];
> + dev_priv->shared_dplls[i].get_hw_state =
> + hsw_ddi_pll_get_hw_state;
>   }
>  
>   /* The LCPLL register should be turned on by the BIOS. For now let's
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 1d919ae..594a49f 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -7587,6 +7587,7 @@ static void haswell_get_ddi_port_state(struct 
> intel_crtc *crtc,
>  {
>   struct drm_device *dev = crtc->base.dev;
>   struct drm_i915_private *dev_priv = dev->dev_private;
> + struct intel_shared_dpll *pll;
>   enum port port;
>   uint32_t tmp;
>  
> @@ -7605,6 +7606,13 @@ static void haswell_get_ddi_port_state(struct 
> intel_crtc *crtc,
>   break;
>   }
>  
> + if (pipe_config->shared_dpll >= 0) {
> + pll = &dev_priv->shared_dplls[pipe_config->shared_dpll];
> +
> + WARN_ON(!pll->get_hw_state(dev_priv, pll,
> +&pipe_config->dpll_hw_state));
> + }
> +
>   /*
>* Haswell has only FDI/PCH transcoder A. It is which i

Re: [Intel-gfx] [PATCH 13.5/19] drm/i915: add POWER_DOMAIN_PLLS

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 11:27:38AM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> And get/put it when needed. The special thing about this commit is
> that it will now return false in ibx_pch_dpll_get_hw_state() in case
> the power domain is not enabled. This will fix some WARNs we have when
> we run pm_rpm on SNB.
> 
> Testcase: igt/pm_rpm
> Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=80463
> Signed-off-by: Paulo Zanoni 

(already reviewed this on in the SNB series, but might as well do it
here again):

Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c  |  2 ++
>  drivers/gpu/drm/i915/i915_drv.h  |  1 +
>  drivers/gpu/drm/i915/intel_display.c | 10 ++
>  drivers/gpu/drm/i915/intel_pm.c  |  1 +
>  4 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index a89cc7a..e79ddbf 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2134,6 +2134,8 @@ static const char *power_domain_str(enum 
> intel_display_power_domain domain)
>   return "VGA";
>   case POWER_DOMAIN_AUDIO:
>   return "AUDIO";
> + case POWER_DOMAIN_PLLS:
> + return "PLLS";
>   case POWER_DOMAIN_INIT:
>   return "INIT";
>   default:
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b1f1518..2ec7cb6 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -129,6 +129,7 @@ enum intel_display_power_domain {
>   POWER_DOMAIN_PORT_OTHER,
>   POWER_DOMAIN_VGA,
>   POWER_DOMAIN_AUDIO,
> + POWER_DOMAIN_PLLS,
>   POWER_DOMAIN_INIT,
>  
>   POWER_DOMAIN_NUM,
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 3bbc798..1d919ae 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1837,6 +1837,8 @@ static void intel_enable_shared_dpll(struct intel_crtc 
> *crtc)
>   }
>   WARN_ON(pll->on);
>  
> + intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
> +
>   DRM_DEBUG_KMS("enabling %s\n", pll->name);
>   pll->enable(dev_priv, pll);
>   pll->on = true;
> @@ -1873,6 +1875,8 @@ static void intel_disable_shared_dpll(struct intel_crtc 
> *crtc)
>   DRM_DEBUG_KMS("disabling %s\n", pll->name);
>   pll->disable(dev_priv, pll);
>   pll->on = false;
> +
> + intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
>  }
>  
>  static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
> @@ -11298,6 +11302,9 @@ static bool ibx_pch_dpll_get_hw_state(struct 
> drm_i915_private *dev_priv,
>  {
>   uint32_t val;
>  
> + if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PLLS))
> + return false;
> +
>   val = I915_READ(PCH_DPLL(pll->id));
>   hw_state->dpll = val;
>   hw_state->fp0 = I915_READ(PCH_FP0(pll->id));
> @@ -12864,6 +12871,9 @@ static void intel_modeset_readout_hw_state(struct 
> drm_device *dev)
>  
>   DRM_DEBUG_KMS("%s hw state readout: refcount %i, on %i\n",
> pll->name, pll->refcount, pll->on);
> +
> + if (pll->refcount)
> + intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
>   }
>  
>   list_for_each_entry(encoder, &dev->mode_config.encoder_list,
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 31ae2b4..cf4c521 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -6310,6 +6310,7 @@ EXPORT_SYMBOL_GPL(i915_release_power_well);
>   BIT(POWER_DOMAIN_PORT_DDI_D_2_LANES) |  \
>   BIT(POWER_DOMAIN_PORT_DDI_D_4_LANES) |  \
>   BIT(POWER_DOMAIN_PORT_CRT) |\
> + BIT(POWER_DOMAIN_PLLS) |\
>   BIT(POWER_DOMAIN_INIT))
>  #define HSW_DISPLAY_POWER_DOMAINS (  \
>   (POWER_DOMAIN_MASK & ~HSW_ALWAYS_ON_POWER_DOMAINS) |\
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/4] drm/i915: check the power domains in intel_lvds_get_hw_state()

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 01:38:35PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> Just like we do for the other encoders. This should fix some WARNs
> when running pm_rpm on SNB.
> 
> Testcase: igt/pm_rpm
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80463
> Signed-off-by: Paulo Zanoni 

Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_lvds.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c 
> b/drivers/gpu/drm/i915/intel_lvds.c
> index 4d29a83..8aa7973 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -71,8 +71,13 @@ static bool intel_lvds_get_hw_state(struct intel_encoder 
> *encoder,
>   struct drm_device *dev = encoder->base.dev;
>   struct drm_i915_private *dev_priv = dev->dev_private;
>   struct intel_lvds_encoder *lvds_encoder = 
> to_lvds_encoder(&encoder->base);
> + enum intel_display_power_domain power_domain;
>   u32 tmp;
>  
> + power_domain = intel_display_port_power_domain(encoder);
> + if (!intel_display_power_enabled(dev_priv, power_domain))
> + return false;
> +
>   tmp = I915_READ(lvds_encoder->reg);
>  
>   if (!(tmp & LVDS_PORT_EN))
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/4] drm/i915: check the power domains in ironlake_get_pipe_config()

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 01:38:34PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> Just like we already do in haswell_get_pipe_config(). This should
> prevent some WARNs when we run pm_rpm on SNB.
> 
> Testcase: igt/pm_rpm
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80463
> Signed-off-by: Paulo Zanoni 

Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_display.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 3d69097..0e6217a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -7261,6 +7261,10 @@ static bool ironlake_get_pipe_config(struct intel_crtc 
> *crtc,
>   struct drm_i915_private *dev_priv = dev->dev_private;
>   uint32_t tmp;
>  
> + if (!intel_display_power_enabled(dev_priv,
> +  POWER_DOMAIN_PIPE(crtc->pipe)))
> + return false;
> +
>   pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe;
>   pipe_config->shared_dpll = DPLL_ID_PRIVATE;
>  
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/4] drm/i915: add POWER_DOMAIN_PLLS

2014-07-10 Thread Damien Lespiau
On Fri, Jul 04, 2014 at 01:38:33PM -0300, Paulo Zanoni wrote:
> From: Paulo Zanoni 
> 
> And get/put it when needed. The special thing about this commit is
> that it will now return false in ibx_pch_dpll_get_hw_state() in case
> the power domain is not enabled. This will fix some WARNs we have when
> we run pm_rpm on SNB.
> 
> Testcase: igt/pm_rpm
> Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=80463
> Signed-off-by: Paulo Zanoni 

Reviewed-by: Damien Lespiau 

-- 
Damien

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c  |  2 ++
>  drivers/gpu/drm/i915/i915_drv.h  |  1 +
>  drivers/gpu/drm/i915/intel_display.c | 10 ++
>  drivers/gpu/drm/i915/intel_pm.c  |  1 +
>  4 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index 8da9985..18d4f9e 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2134,6 +2134,8 @@ static const char *power_domain_str(enum 
> intel_display_power_domain domain)
>   return "VGA";
>   case POWER_DOMAIN_AUDIO:
>   return "AUDIO";
> + case POWER_DOMAIN_PLLS:
> + return "PLLS";
>   case POWER_DOMAIN_INIT:
>   return "INIT";
>   default:
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ac06c0f..1cc1b8f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -129,6 +129,7 @@ enum intel_display_power_domain {
>   POWER_DOMAIN_PORT_OTHER,
>   POWER_DOMAIN_VGA,
>   POWER_DOMAIN_AUDIO,
> + POWER_DOMAIN_PLLS,
>   POWER_DOMAIN_INIT,
>  
>   POWER_DOMAIN_NUM,
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index c12a5da..3d69097 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1837,6 +1837,8 @@ static void intel_enable_shared_dpll(struct intel_crtc 
> *crtc)
>   }
>   WARN_ON(pll->on);
>  
> + intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
> +
>   DRM_DEBUG_KMS("enabling %s\n", pll->name);
>   pll->enable(dev_priv, pll);
>   pll->on = true;
> @@ -1873,6 +1875,8 @@ static void intel_disable_shared_dpll(struct intel_crtc 
> *crtc)
>   DRM_DEBUG_KMS("disabling %s\n", pll->name);
>   pll->disable(dev_priv, pll);
>   pll->on = false;
> +
> + intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
>  }
>  
>  static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
> @@ -11280,6 +11284,9 @@ static bool ibx_pch_dpll_get_hw_state(struct 
> drm_i915_private *dev_priv,
>  {
>   uint32_t val;
>  
> + if (!intel_display_power_enabled(dev_priv, POWER_DOMAIN_PLLS))
> + return false;
> +
>   val = I915_READ(PCH_DPLL(pll->id));
>   hw_state->dpll = val;
>   hw_state->fp0 = I915_READ(PCH_FP0(pll->id));
> @@ -12845,6 +12852,9 @@ static void intel_modeset_readout_hw_state(struct 
> drm_device *dev)
>  
>   DRM_DEBUG_KMS("%s hw state readout: refcount %i, on %i\n",
> pll->name, pll->refcount, pll->on);
> +
> + if (pll->refcount)
> + intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
>   }
>  
>   list_for_each_entry(encoder, &dev->mode_config.encoder_list,
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 31ae2b4..cf4c521 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -6310,6 +6310,7 @@ EXPORT_SYMBOL_GPL(i915_release_power_well);
>   BIT(POWER_DOMAIN_PORT_DDI_D_2_LANES) |  \
>   BIT(POWER_DOMAIN_PORT_DDI_D_4_LANES) |  \
>   BIT(POWER_DOMAIN_PORT_CRT) |\
> + BIT(POWER_DOMAIN_PLLS) |\
>   BIT(POWER_DOMAIN_INIT))
>  #define HSW_DISPLAY_POWER_DOMAINS (  \
>   (POWER_DOMAIN_MASK & ~HSW_ALWAYS_ON_POWER_DOMAINS) |\
> -- 
> 2.0.0
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] drm/i915: Don't cast a pointer to void* unnecessarily

2014-07-10 Thread Damien Lespiau
C is super happy to asign anything pointer to void *. Don't pretend
otherwise.

Signed-off-by: Damien Lespiau 
---
 drivers/gpu/drm/i915/i915_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index ce69185..2c0bad6 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1596,7 +1596,7 @@ int i915_driver_load(struct drm_device *dev, unsigned 
long flags)
if (dev_priv == NULL)
return -ENOMEM;
 
-   dev->dev_private = (void *)dev_priv;
+   dev->dev_private = dev_priv;
dev_priv->dev = dev;
 
/* copy initial configuration to dev_priv->info */
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/2] drm/i915: Make the device_info structure __initconst

2014-07-10 Thread Damien Lespiau
We don't need them past the module initialization as the correct
structure is copied into dev_priv in ->load(), called from
drm_pci_init(), called from the module init funtion.

I'm always hesitant about adding new members to struct intel_device_info
because it will add 30+ * sizeof(member) bytes to the driver. However,
if we can discard those table after init(), it changes everything.

After this change, the driver has a new .init.rodata section contains
the structures in question and .rodata has now 2848 fewer bytes.

lsmod shows -5425 bytes in its size field between before and after this
change. Not too sure why this (Vs the 2848 bytes lost in .rodata), but
that's enough for me.

Signed-off-by: Damien Lespiau 
---
 drivers/gpu/drm/i915/i915_drv.c | 60 -
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index bc19623..9f75261 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -63,7 +63,7 @@ static struct drm_driver driver;
 #define IVB_CURSOR_OFFSETS \
.cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, 
IVB_CURSOR_C_OFFSET }
 
-static const struct intel_device_info intel_i830_info = {
+static const struct intel_device_info intel_i830_info __initconst = {
.gen = 2, .is_mobile = 1, .cursor_needs_physical = 1, .num_pipes = 2,
.has_overlay = 1, .overlay_needs_physical = 1,
.ring_mask = RENDER_RING,
@@ -71,7 +71,7 @@ static const struct intel_device_info intel_i830_info = {
CURSOR_OFFSETS,
 };
 
-static const struct intel_device_info intel_845g_info = {
+static const struct intel_device_info intel_845g_info __initconst = {
.gen = 2, .num_pipes = 1,
.has_overlay = 1, .overlay_needs_physical = 1,
.ring_mask = RENDER_RING,
@@ -79,7 +79,7 @@ static const struct intel_device_info intel_845g_info = {
CURSOR_OFFSETS,
 };
 
-static const struct intel_device_info intel_i85x_info = {
+static const struct intel_device_info intel_i85x_info __initconst = {
.gen = 2, .is_i85x = 1, .is_mobile = 1, .num_pipes = 2,
.cursor_needs_physical = 1,
.has_overlay = 1, .overlay_needs_physical = 1,
@@ -89,7 +89,7 @@ static const struct intel_device_info intel_i85x_info = {
CURSOR_OFFSETS,
 };
 
-static const struct intel_device_info intel_i865g_info = {
+static const struct intel_device_info intel_i865g_info __initconst = {
.gen = 2, .num_pipes = 1,
.has_overlay = 1, .overlay_needs_physical = 1,
.ring_mask = RENDER_RING,
@@ -97,14 +97,14 @@ static const struct intel_device_info intel_i865g_info = {
CURSOR_OFFSETS,
 };
 
-static const struct intel_device_info intel_i915g_info = {
+static const struct intel_device_info intel_i915g_info __initconst = {
.gen = 3, .is_i915g = 1, .cursor_needs_physical = 1, .num_pipes = 2,
.has_overlay = 1, .overlay_needs_physical = 1,
.ring_mask = RENDER_RING,
GEN_DEFAULT_PIPEOFFSETS,
CURSOR_OFFSETS,
 };
-static const struct intel_device_info intel_i915gm_info = {
+static const struct intel_device_info intel_i915gm_info __initconst = {
.gen = 3, .is_mobile = 1, .num_pipes = 2,
.cursor_needs_physical = 1,
.has_overlay = 1, .overlay_needs_physical = 1,
@@ -114,14 +114,14 @@ static const struct intel_device_info intel_i915gm_info = 
{
GEN_DEFAULT_PIPEOFFSETS,
CURSOR_OFFSETS,
 };
-static const struct intel_device_info intel_i945g_info = {
+static const struct intel_device_info intel_i945g_info __initconst = {
.gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1, .num_pipes = 2,
.has_overlay = 1, .overlay_needs_physical = 1,
.ring_mask = RENDER_RING,
GEN_DEFAULT_PIPEOFFSETS,
CURSOR_OFFSETS,
 };
-static const struct intel_device_info intel_i945gm_info = {
+static const struct intel_device_info intel_i945gm_info __initconst = {
.gen = 3, .is_i945gm = 1, .is_mobile = 1, .num_pipes = 2,
.has_hotplug = 1, .cursor_needs_physical = 1,
.has_overlay = 1, .overlay_needs_physical = 1,
@@ -132,7 +132,7 @@ static const struct intel_device_info intel_i945gm_info = {
CURSOR_OFFSETS,
 };
 
-static const struct intel_device_info intel_i965g_info = {
+static const struct intel_device_info intel_i965g_info __initconst = {
.gen = 4, .is_broadwater = 1, .num_pipes = 2,
.has_hotplug = 1,
.has_overlay = 1,
@@ -141,7 +141,7 @@ static const struct intel_device_info intel_i965g_info = {
CURSOR_OFFSETS,
 };
 
-static const struct intel_device_info intel_i965gm_info = {
+static const struct intel_device_info intel_i965gm_info __initconst = {
.gen = 4, .is_crestline = 1, .num_pipes = 2,
.is_mobile = 1, .has_fbc = 1, .has_hotplug = 1,
.has_overlay = 1,
@@ -151,7 +151,7 @@ static const struct intel_device_info intel_i965gm_info = {
CUR

Re: [Intel-gfx] [PATCH i-g-t 2/2] drv_module_reload: For some reason, vtcon0 has been seen as being fbcon

2014-07-10 Thread Damien Lespiau
On Thu, Jul 10, 2014 at 02:17:43PM +0100, Damien Lespiau wrote:
> Not sure if this was ABI, I vote for no, so just unbind everyone.
> 
> Signed-off-by: Damien Lespiau 

Meh, this is very wrong, don't look at it.

> ---
>  tests/drv_module_reload | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/drv_module_reload b/tests/drv_module_reload
> index 66cd6bb..0e729d3 100755
> --- a/tests/drv_module_reload
> +++ b/tests/drv_module_reload
> @@ -5,14 +5,17 @@
>  # ... we've broken this way too often :(
>  #
>  
> +set -x
> +
>  SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
>  . $SOURCE_DIR/drm_lib.sh
>  
>  # no other drm service should be running, so we can just unbind
>  
>  # vtcon0 is vga, vtcon1 fbcon and let's pray that won't change due to boot 
> load
> -# time changes
> -if ! echo 0 > /sys/class/vtconsole/vtcon1/bind ; then
> +# time changes. It just did here!, unbind everything, like a boss.
> +if ! echo 0 > /sys/class/vtconsole/vtcon0/bind && \
> + echo 0 > /sys/class/vtconsole/vtcon1/bind; then
>   echo -e "no kms unload support"
>   echo "please enable CONFIG_VT_HW_CONSOLE_BINDING in the kernel"
>   exit 77
> -- 
> 1.8.3.1
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 2/2] drv_module_reload: For some reason, vtcon0 has been seen as being fbcon

2014-07-10 Thread Damien Lespiau
Not sure if this was ABI, I vote for no, so just unbind everyone.

Signed-off-by: Damien Lespiau 
---
 tests/drv_module_reload | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/drv_module_reload b/tests/drv_module_reload
index 66cd6bb..0e729d3 100755
--- a/tests/drv_module_reload
+++ b/tests/drv_module_reload
@@ -5,14 +5,17 @@
 # ... we've broken this way too often :(
 #
 
+set -x
+
 SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )"
 . $SOURCE_DIR/drm_lib.sh
 
 # no other drm service should be running, so we can just unbind
 
 # vtcon0 is vga, vtcon1 fbcon and let's pray that won't change due to boot load
-# time changes
-if ! echo 0 > /sys/class/vtconsole/vtcon1/bind ; then
+# time changes. It just did here!, unbind everything, like a boss.
+if ! echo 0 > /sys/class/vtconsole/vtcon0/bind && \
+ echo 0 > /sys/class/vtconsole/vtcon1/bind; then
echo -e "no kms unload support"
echo "please enable CONFIG_VT_HW_CONSOLE_BINDING in the kernel"
exit 77
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 1/2] drv_module_reload: Don't declare success when failing

2014-07-10 Thread Damien Lespiau
We weren't returning straight away when failing to unload the driver, so
the test happilly executed gem_suspend and printed ""module successfully
loaded again".

Signed-off-by: Damien Lespiau 
---
 tests/drv_module_reload | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/drv_module_reload b/tests/drv_module_reload
index c1fd395..66cd6bb 100755
--- a/tests/drv_module_reload
+++ b/tests/drv_module_reload
@@ -33,10 +33,9 @@ rmmod drm &> /dev/null
 
 if lsmod | grep i915 &> /dev/null ; then
echo WARNING: i915.ko still loaded!
-   exitcode=1
+   exit 1
 else
echo module successfully unloaded
-   exitcode=0
 fi
 
 modprobe i915
@@ -47,4 +46,4 @@ modprobe snd_hda_intel
 # try to run something
 $SOURCE_DIR/gem_exec_nop > /dev/null && echo "module successfully loaded again"
 
-exit $exitcode
+exit 0
-- 
1.8.3.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/2] lib/gen6_render: removed duplicate defines

2014-07-10 Thread Mika Kuoppala
Textually the same so no harm was done and no warnings
from compiler either.

Signed-off-by: Mika Kuoppala 
---
 lib/gen6_render.h |   38 --
 1 file changed, 38 deletions(-)

diff --git a/lib/gen6_render.h b/lib/gen6_render.h
index 495cc2e..58d511f 100644
--- a/lib/gen6_render.h
+++ b/lib/gen6_render.h
@@ -303,44 +303,6 @@
 #define GEN6_EU_ATT_CLR_1 0x8834
 #define GEN6_EU_RDATA 0x8840
 
-#define GEN6_3D(Pipeline,Opcode,Subopcode) ((3 << 29) | \
-  ((Pipeline) << 27) | \
-  ((Opcode) << 24) | \
-  ((Subopcode) << 16))
-
-#define GEN6_STATE_BASE_ADDRESSGEN6_3D(0, 1, 1)
-#define GEN6_STATE_SIP GEN6_3D(0, 1, 2)
-
-#define GEN6_PIPELINE_SELECT   GEN6_3D(1, 1, 4)
-
-#define GEN6_MEDIA_STATE_POINTERS  GEN6_3D(2, 0, 0)
-#define GEN6_MEDIA_OBJECT  GEN6_3D(2, 1, 0)
-
-#define GEN6_3DSTATE_BINDING_TABLE_POINTERSGEN6_3D(3, 0, 1)
-# define GEN6_3DSTATE_BINDING_TABLE_MODIFY_PS  (1 << 12)/* for GEN6 */
-# define GEN6_3DSTATE_BINDING_TABLE_MODIFY_GS  (1 << 9) /* for GEN6 */
-# define GEN6_3DSTATE_BINDING_TABLE_MODIFY_VS  (1 << 8) /* for GEN6 */
-
-#define GEN6_3DSTATE_VERTEX_BUFFERSGEN6_3D(3, 0, 8)
-#define GEN6_3DSTATE_VERTEX_ELEMENTS   GEN6_3D(3, 0, 9)
-#define GEN6_3DSTATE_INDEX_BUFFER  GEN6_3D(3, 0, 0xa)
-#define GEN6_3DSTATE_VF_STATISTICS GEN6_3D(3, 0, 0xb)
-
-#define GEN6_3DSTATE_DRAWING_RECTANGLE GEN6_3D(3, 1, 0)
-#define GEN6_3DSTATE_CONSTANT_COLORGEN6_3D(3, 1, 1)
-#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD  GEN6_3D(3, 1, 2)
-#define GEN6_3DSTATE_CHROMA_KEYGEN6_3D(3, 1, 4)
-#define GEN6_3DSTATE_DEPTH_BUFFER  GEN6_3D(3, 1, 5)
-# define GEN6_3DSTATE_DEPTH_BUFFER_TYPE_SHIFT  29
-# define GEN6_3DSTATE_DEPTH_BUFFER_FORMAT_SHIFT18
-
-#define GEN6_3DSTATE_POLY_STIPPLE_OFFSET   GEN6_3D(3, 1, 6)
-#define GEN6_3DSTATE_POLY_STIPPLE_PATTERN  GEN6_3D(3, 1, 7)
-#define GEN6_3DSTATE_LINE_STIPPLE  GEN6_3D(3, 1, 8)
-#define GEN6_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP GEN6_3D(3, 1, 9)
-/* These two are BLC and CTG only, not BW or CL */
-#define GEN6_3DSTATE_AA_LINE_PARAMSGEN6_3D(3, 1, 0xa)
-#define GEN6_3DSTATE_GS_SVB_INDEX  GEN6_3D(3, 1, 0xb)
 
 #define GEN6_PIPE_CONTROL  GEN6_3D(3, 2, 0)
 
-- 
1.7.9.5

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Allow overlapping userptr objects

2014-07-10 Thread Chris Wilson
On Thu, Jul 10, 2014 at 01:26:53PM +0100, Tvrtko Ursulin wrote:
> Too bad that on first overlapping object the whole process goes into
> "slow mode". I wonder what would benchmarking say to that.
> 
> Perhaps we could still use interval tree but add another layer of
> indirection where ranges would be merged for overlapping objects and
> contain a linear list of them only there?

I balked at the thought of having to do the merger of neighbouring
intervals when a new larger object is created.

Flipping between a simple linear list and the interval-tree is tricky
enough, so I'll wait until someone complains about the performance after
using an overlapping pair.
-Chris

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


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Serialise userptr gup with mmu-notifier

2014-07-10 Thread Tvrtko Ursulin


On 07/10/2014 10:21 AM, Chris Wilson wrote:

Jerome Glisse pointed out that get_user_pages() does not synchronize
with concurrent invalidations of the VMA. As such if the backing vma is
changed whilst the pages for the object are being grabbed for use by the
GPU, we may end up with a random mixture of page references being held.
Worse still as the mmu-notifier will believe that the VMA invalidation
was complete and the old page references dropped.

In order to serialise gup with mmu-notifier, we use a seqlock to detect
when an invalidation has occurred in parallel to our gup and if so cancel
the gup. The detection is a little coarse, but hopefully we never see
contention here!


Looks good to me, but as we discussed on IRC all get_user_pages users 
have this "problem" and I don't understand why it matters to us? How 
would someone hit/exploit the race? By one thread manically modifying 
mappings while another is creating userptr objects? Is there some other 
legitimate way of it happening?


Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/2] drm/i915: Allow overlapping userptr objects

2014-07-10 Thread Tvrtko Ursulin


On 07/10/2014 10:21 AM, Chris Wilson wrote:

Whilst I strongly advise against doing so for the implicit coherency
issues between the multiple buffer objects accessing the same backing
store, it nevertheless is a valid use case, akin to mmaping the same
file multiple times.

The reason why we forbade it earlier was that our use of the interval
tree for fast invalidation upon vma changes excluded overlapping
objects. So in the case where the user wishes to create such pairs of
overlapping objects, we degrade the range invalidation to walkin the
linear list of objects associated with the mm.

v2: Compile for mmu-notifiers after tweaking


[snip]


+static void invalidate_range__linear(struct i915_mmu_notifier *mn,
+struct mm_struct *mm,
+unsigned long start,
+unsigned long end)
+{
+   struct i915_mmu_object *mmu;
+   unsigned long serial;
+
+restart:
+   serial = mn->serial;
+   list_for_each_entry(mmu, &mn->linear, link) {
+   struct drm_i915_gem_object *obj;
+
+   if (mmu->it.last < start || mmu->it.start > end)
+   continue;
+
+   obj = mmu->obj;
+   drm_gem_object_reference(&obj->base);
+   spin_unlock(&mn->lock);
+
+   cancel_userptr(obj);
+
+   spin_lock(&mn->lock);
+   if (serial != mn->serial)
+   goto restart;
+   }
+
+   spin_unlock(&mn->lock);
+}
+
  static void i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier 
*_mn,
   struct mm_struct *mm,
   unsigned long start,
@@ -60,16 +128,19 @@ static void 
i915_gem_userptr_mn_invalidate_range_start(struct mmu_notifier *_mn,
  {
struct i915_mmu_notifier *mn = container_of(_mn, struct 
i915_mmu_notifier, mn);
struct interval_tree_node *it = NULL;
+   unsigned long next = start;
unsigned long serial = 0;

end--; /* interval ranges are inclusive, but invalidate range is 
exclusive */
-   while (start < end) {
+   while (next < end) {
struct drm_i915_gem_object *obj;

obj = NULL;
spin_lock(&mn->lock);
+   if (mn->is_linear)
+   return invalidate_range__linear(mn, mm, start, end);


Too bad that on first overlapping object the whole process goes into 
"slow mode". I wonder what would benchmarking say to that.


Perhaps we could still use interval tree but add another layer of 
indirection where ranges would be merged for overlapping objects and 
contain a linear list of them only there?


Tvrtko
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Serialise userptr gup with mmu-notifier

2014-07-10 Thread Chris Wilson
On Thu, Jul 10, 2014 at 10:21:44AM +0100, Chris Wilson wrote:
> Jerome Glisse pointed out that get_user_pages() does not synchronize
> with concurrent invalidations of the VMA. As such if the backing vma is
> changed whilst the pages for the object are being grabbed for use by the
> GPU, we may end up with a random mixture of page references being held.
> Worse still as the mmu-notifier will believe that the VMA invalidation
> was complete and the old page references dropped.
> 
> In order to serialise gup with mmu-notifier, we use a seqlock to detect
> when an invalidation has occurred in parallel to our gup and if so cancel
> the gup. The detection is a little coarse, but hopefully we never see
> contention here!

Hmm. This is bogus. I thought the gup_fast path was racy, but is
serialised correctly with invalidate-range.
-Chris

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


  1   2   >