openwrt/staging/blogic.git
10 years agodrm/i915: make fbdev initialization asynchronous v2
Jesse Barnes [Wed, 28 May 2014 21:39:03 +0000 (14:39 -0700)]
drm/i915: make fbdev initialization asynchronous v2

This gets us out of our init code and out to userspace quite a bit
faster, but does open us up to some bugs given the state of our init
time locking.

v2: switch to async_schedule (Chris)
    check with lockdep, seems happy (Jesse)
    move hotplug enable flag set to fbdev_initial_config (Jesse)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Rebase on top of the dev_priv->enable_hotplug_processing
removal.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Init some CHV workarounds via LRIs in ring->init_context()
Ville Syrjälä [Wed, 27 Aug 2014 14:33:12 +0000 (17:33 +0300)]
drm/i915: Init some CHV workarounds via LRIs in ring->init_context()

Follow the BDW example and apply the workarounds touching registers
which are saved in the context image through LRIs in the new
ring->init_context() hook.

This makes Mesa much happier and eg. glxgears doesn't hang after
the first frame.

Cc: Arun Siluvery <arun.siluvery@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Add missing wa table initialization to avoid a functional
conflict with Arun's wa table debugfs support.]
Reviewed-by: "Barbalho, Rafael" <rafael.barbalho@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: trivial: remove unneed set to NULL
Gustavo Padovan [Thu, 28 Aug 2014 17:40:06 +0000 (14:40 -0300)]
drm/i915: trivial: remove unneed set to NULL

At this point of the code the obj var is already NULL, so we don't
need to set it again to NULL.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Warn about odd rps values on CHV
Ville Syrjälä [Mon, 18 Aug 2014 11:42:43 +0000 (14:42 +0300)]
drm/i915: Warn about odd rps values on CHV

CHV wants even rps opcodes so print a warning of the
min/max/rpe/rp1 values are odd, and warn if an odd value
slips through to valleyview_set_rps() and truncate it to
an even value.

Also add a comment to chv_freq_opcode() to make sure no one
changes the code without considering this requirement.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Deepak S <deepak.s@linux.intel.com>
[danvet: Help git along in applying the patch, somehow it silently
ended up in the vlv init_gt_powersave function.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoMAINTAINERS: Update Daniel Vetter's email address
Daniel Vetter [Thu, 28 Aug 2014 10:17:42 +0000 (12:17 +0200)]
MAINTAINERS: Update Daniel Vetter's email address

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agodrm/i915/bdw: Render state init for Execlists
Oscar Mateo [Thu, 21 Aug 2014 10:40:54 +0000 (11:40 +0100)]
drm/i915/bdw: Render state init for Execlists

The batchbuffer that sets the render context state is submitted
in a different way, and from different places.

We needed to make both the render state preparation and free functions
outside accesible, and namespace accordingly. This mess is so that all
LR, LRC and Execlists functionality can go together in intel_lrc.c: we
can fix all of this later on, once the interfaces are clear.

v2: Create a separate ctx->rcs_initialized for the Execlists case, as
suggested by Chris Wilson.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
v3: Setup ring status page in lr_context_deferred_create when the
default context is being created. This means that the render state
init for the default context is no longer a special case.  Execute
deferred creation of the default context at the end of
logical_ring_init to allow the render state commands to be submitted.
Fix style errors reported by checkpatch. Rebased.

Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: BDW Software Turbo
Daisy Sun [Mon, 11 Aug 2014 18:08:38 +0000 (11:08 -0700)]
drm/i915/bdw: BDW Software Turbo

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. For offscreen workload specificly,
set frequency to RP0.

Offscreen task is not restricted by frame rate, it can be
executed as soon as possible. Transcoding and serilized workload
between CPU and GPU both need high GT performance, RP0 is a good
option in this case. RC6 will kick in to compensate power
consumption when GT is not active.

v2: Rebase on recent drm-intel-nightly
v3: Add flip timerout monitor, when no flip is deteced within
100ms, set frequency to RP0.

Signed-off-by: Daisy Sun <daisy.sun@intel.com>
[torourke: rebased on latest and resolved conflict]
Signed-off-by: Tom O'Rourke <Tom.O'Rourke@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Populate mem_freq in init_gt_powerwave()
Ville Syrjälä [Mon, 18 Aug 2014 11:42:44 +0000 (14:42 +0300)]
drm/i915: Populate mem_freq in init_gt_powerwave()

init_clock_gating() is too late to read out the mem_freq. We already
want to print out the GPU MHz numbers before it's called. Move the
mem_freq setup to init_gt_powersave().

v2: Also kill the CHV_CZ_CLOCK_FREQ_MODE_* defines

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Deepak S <deepak.s@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: s, fb->bits_per_pixel/8, pixel_size, in primary plane code
Ville Syrjälä [Wed, 27 Aug 2014 13:51:22 +0000 (16:51 +0300)]
drm/i915: s, fb->bits_per_pixel/8, pixel_size, in primary plane code

Use the pixel_size we got from drm_format_plane_cpp() instead of
fb->bits_per_pixel/8 when computing the primary plane page/linear
offsets. Avoids a few divs and makes the code more future proof
against funky pixel formats where bits_per_pixel isn't well defined.
This is what we already did in the sprite code.

Note that the relevant sprite patch was

commit ca320ac456099c29290568353d924157e626ede9
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Dec 19 12:14:22 2012 +0000

    drm/i915: Use pixel size for computing linear offsets into a sprite

This change was required on sprites because they support yuv formats
which have fb->bits_per_pixel undefined.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Add Chris' software archeology as a note to the commit
message.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Don't dereference fb when disabling primary plane
Ville Syrjälä [Wed, 27 Aug 2014 14:48:41 +0000 (17:48 +0300)]
drm/i915: Don't dereference fb when disabling primary plane

During driver init we may not have a valid framebuffer for the primary
plane even though the plane is enabled due to failed BIOS fb takeover.
This means we have to avoid dereferencing the fb in
.update_primary_plane() when disabling the plane.

The introduction of the primary plane rotation in

 commit d91a2cb8e5104233c02bbde539bd4ee455ec12ac
 Author: Sonika Jindal <sonika.jindal@intel.com>
 Date:   Fri Aug 22 14:06:04 2014 +0530

    drm/i915: Add 180 degree primary plane rotation support

caused a regression by trying to look up the pixel format before we can
be sure there's a valid fb available. This isn't entirely unsurprising
since the rotation patches originally predate the change to the primary
plane code that calls .update_primary_plane() also when disabling the
plane:

 commit fdd508a6419217cce28213f3c9bd27c02a0d4c71
 Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
 Date:   Fri Aug 8 21:51:11 2014 +0300

    drm/i915: Call .update_primary_plane in intel_{enable,
    disable}_primary_hw_plane()

v2: Warn but don't blow up when trying to enable a plane w/o an fb (Chris)

Cc: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Export workaround data to debugfs
Arun Siluvery [Tue, 26 Aug 2014 13:44:51 +0000 (14:44 +0100)]
drm/i915/bdw: Export workaround data to debugfs

The workarounds that are applied are exported to a debugfs file;
this is used to verify their state after the test case (reset or
suspend/resume etc). This patch is only required to support i-g-t.

Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Apply workarounds in render ring init function
Arun Siluvery [Tue, 26 Aug 2014 13:44:50 +0000 (14:44 +0100)]
drm/i915/bdw: Apply workarounds in render ring init function

For BDW workarounds are currently initialized in init_clock_gating() but
they are lost during reset, suspend/resume etc; this patch moves the WAs
that are part of register state context to render ring init fn otherwise
default context ends up with incorrect values as they don't get initialized
until init_clock_gating fn.

v2: Add workarounds to golden render state
This method has its own issues, first of all this is different for
each gen and it is generated using a tool so adding new workaround
and mainitaining them across gens is not a straightforward process.

v3: Use LRIs to emit these workarounds (Ville)
Instead of modifying the golden render state the same LRIs are
emitted from within the driver.

v4: Use abstract name when exporting gen specific routines (Chris)

For: VIZ-4092
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: FBC flush nuke for BDW
Rodrigo Vivi [Mon, 4 Aug 2014 10:51:38 +0000 (03:51 -0700)]
drm/i915: FBC flush nuke for BDW

According to spec FBC on BDW and HSW are identical without any gaps.
So let's copy the nuke and let FBC really start compressing stuff.

Without this patch we can verify with false color that nothing is being
compressed. With the nuke in place and false color it is possible
to see false color debugs.

Unfortunatelly on some rings like BCS on BDW we have to avoid Bits 22:18 on
LRIs due to a high risk of hung. So, when using Blt ring for frontbuffer rend
cache would never been cleaned and FBC would stop compressing buffer.
One alternative is to cache clean on software frontbuffer tracking.

v2: Fix rebase conflict.
v3: Do not clean cache on BCS ring. Instead use sw frontbuffer tracking.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/ddi: use struct for ddi buf translation tables
Jani Nikula [Wed, 27 Aug 2014 13:27:30 +0000 (16:27 +0300)]
drm/i915/ddi: use struct for ddi buf translation tables

Try to avoid confusion with ARRAY_SIZE()/2 and hdmi_level*2.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
[danvet: Resolve silent patch conflict (didn't even fail to build)
with with Sonika's preceding patch to use the
hsw_ddi_translations_fdi table to driver the fdi link training
iteration loop. Also drop the double-write loop Damien spotted.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Rename defines for selection of ddi buffer translation slot
Sonika Jindal [Mon, 11 Aug 2014 03:27:36 +0000 (08:57 +0530)]
drm/i915: Rename defines for selection of ddi buffer translation slot

Renaming the HSW-specific macros for ddi buffer translation slot to denote the
slot and not the vswing/pre-emph values as they are platform-dependent.

This patch is based on top of the patch series for renaming the DP training
vswing/pre-emph defines:
http://lists.freedesktop.org/archives/intel-gfx/2014-August/050407.html

v2: Creating single macro with argument for slot number (Damien)
v3: Adding macro for num of translation entries (Damien)

Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/dp: debug log whether backlight is being enabled or disabled
Jani Nikula [Wed, 27 Aug 2014 11:08:43 +0000 (14:08 +0300)]
drm/i915/dp: debug log whether backlight is being enabled or disabled

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Let the memory controller do all the swizzling
Damien Lespiau [Wed, 27 Aug 2014 11:24:51 +0000 (13:24 +0200)]
drm/i915/bdw: Let the memory controller do all the swizzling

Previously, it was possible for the GPU memory accesses to be swizzled
to try to optimize the fetches for tiled buffers. This swizzling was on
top of what the memory controller in the uncore already does.

With broadwell, we drop that GPU side swizzling, and the corresponding
initialization in 3 units (GAM, GT, DE). All those bits are reserved, as
specs put it:

  Before Gen8, there was a historical configuration control field to
  swizzle address bit[6] for in X/Y tiling modes. This was set in three
  different places: TILECTL[1:0], ARB_MODE[5:4], and
  DISP_ARB_CTL[14:13]"

  For Gen8 the swizzle fields are all reserved, and the CPU's memory
  controller performs all address swizzling modifications.

This also means that user space doesn't have to manually swizzle when
accessing tiled buffers from the CPU, and so we always return
I915_BIT_6_SWIZZLE_NONE from i915_gem_detect_bit_6_swizzle(), which
short-circuits the initialization of the registers mentionned above in
i915_gem_init_swizzling().

v2: Refine the explanation a bit more (Daniel)
v3: Make it BDW+ specific (Steve)

Cc: Steve Aarnio <steve.j.aarnio@linux.intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
[danvet: Keep the actual code to set the tiling bits for now, in case
some bios escaped to the wild that uses this - we'd need it for
fastboot.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Add "Intel Corporation" as module author
Damien Lespiau [Wed, 27 Aug 2014 10:30:21 +0000 (11:30 +0100)]
drm/i915: Add "Intel Corporation" as module author

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Don't use a define when it's clearer to just put the value
Damien Lespiau [Wed, 27 Aug 2014 10:30:20 +0000 (11:30 +0100)]
drm/i915: Don't use a define when it's clearer to just put the value

Instead of going through hoops, just put the driver author directly as
DRM_AUTHOR() argument. This will also make it consistent when we add
Intel to the list.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: improve assert_panel_unlocked
Jani Nikula [Fri, 22 Aug 2014 12:04:13 +0000 (15:04 +0300)]
drm/i915: improve assert_panel_unlocked

Fix assert_panel_unlocked for vlv/chv, and improve it a bit for
non-LVDS. Also don't pretend it works for DDI. There's still work to do
to get this right for eDP on PCH platforms, but this is a start.

v2: WARN_ON(HAS_DDI)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Add BDW support in the i915 debugfs entry
Vedang Patel [Tue, 26 Aug 2014 17:42:51 +0000 (10:42 -0700)]
drm/i915/bdw: Add BDW support in the i915 debugfs entry

The patch introduces fixes for the debugfs attributes emitted by
the i915 driver for GEN8. Currently, it is not emitting the correct
 attributes which include the status of RC6 states.

Change-Id: Ib2068a0cac9a5wq3f228e547fa1a097ad369d242df
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Differentiate between LLC or snooped for the user
Chris Wilson [Fri, 22 Aug 2014 13:41:39 +0000 (14:41 +0100)]
drm/i915: Differentiate between LLC or snooped for the user

Rather than describing an object as either "snooped or LLC", we can do
better as we should know what machine we are running on!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: send PCI_D3hot adapter opregion message on BDW RPM suspend
Paulo Zanoni [Thu, 21 Aug 2014 20:09:38 +0000 (17:09 -0300)]
drm/i915: send PCI_D3hot adapter opregion message on BDW RPM suspend

On BDW we're seeing a problem that after we runtime resume, the
outputs connected to DDI C are not detected: they don't appear in the
SDEISR register and GMBUS transactions don't work. They stop working
at the moment we call intel_opregion_notify_adapter() during runtime
suspend, but they don't go back to work when we call the same function
during runtime resume. They only work after we do a modeset and call
intel_opregion_notify_encoder(), but this point is already too late.

While debugging, I tried to pass PCI_D3hot which is the value that
matches the spec, and it seems to have solved the problem. I couldn't
find any explanation of why this solves the problem, but there's also
no documented explanation - besides our code and git log - of why
Haswell should use PCI_D1, so keep this for now in order to keep BDW
runtime PM working.

Also add a comment to point the fact that there's no spec documenting
all the weirdness involved here.

Cc: kristen.c.accardi@intel.com
Testcase: igt/pm_rpm/drm-resources-equal
Testcase: igt/pm_rpm/i2c
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: rename gen8_init_clock_gating to broadwell_init_clock_gating
Paulo Zanoni [Thu, 21 Aug 2014 20:09:37 +0000 (17:09 -0300)]
drm/i915: rename gen8_init_clock_gating to broadwell_init_clock_gating

Because CHV uses cherryview_init_clock_gating instead of
gen8_init_clock_gating.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: call lpt_init_clock_gating on BDW too
Paulo Zanoni [Thu, 21 Aug 2014 20:09:36 +0000 (17:09 -0300)]
drm/i915: call lpt_init_clock_gating on BDW too

Because BDW has WPT, which is equivalent to LPT. This is just like the
CPT/PPT case.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: fix panel unlock register mask
Jani Nikula [Thu, 21 Aug 2014 12:06:25 +0000 (15:06 +0300)]
drm/i915: fix panel unlock register mask

Use the correct mask for the unlock bits. In theory this could have lead
to incorrect asserts but this is unlikely in practise.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Don't execute context reset and switch with Execlists
Thomas Daniel [Wed, 20 Aug 2014 15:29:24 +0000 (16:29 +0100)]
drm/i915/bdw: Don't execute context reset and switch with Execlists

These two functions make no sense in an Logical Ring Context & Execlists
world.

v2: We got rid of lrc_enabled and centralized everything in the sanitized
i915.enable_execlists instead.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
v3: Rebased.  Corrected a typo in comment for i915_switch_context and
added a comment that it should not be called in execlist mode. Added
WARN_ON if i915_switch_context is called in execlist mode. Moved check
for execlist mode out of i915_switch_context and into callers. Added
comment in context_reset explaining why nothing is done in execlist
mode.

Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
[danvet: Simplify the patch subject so I can understand it.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Fix to Enable GT/PM Interrupts
Deepak S [Fri, 22 Aug 2014 03:02:40 +0000 (08:32 +0530)]
drm/i915: Fix to Enable GT/PM Interrupts

Programing GT IER interrupts was fumbled while enabling Interrupts for
gen8

We forgot to program PM IER interrupt in gen8_gt_irq_postinstall based
on the new  re-worked interrupt routines.

v2: Kill the loop and init GT interrupts individually (Ville)

Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Adjust commit message as per discussion with Deepak.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Do not initialize PPGTT in the legacy way for execlists
Thomas Daniel [Wed, 20 Aug 2014 15:24:50 +0000 (16:24 +0100)]
drm/i915/bdw: Do not initialize PPGTT in the legacy way for execlists

A pending commit removes synchronous mode from switch_mm.  This breaks
execlists because switch_mm will always try to write to the legacy ring
buffer.

Return immediately from i915_ppgtt_init_gw in execlists mode.
No longer check for execlists mode in gen8_ppgtt_enable() because this
will no longer be called in execlists mode.

Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Make wait-for-pending-flips more defensive
Chris Wilson [Wed, 20 Aug 2014 12:13:34 +0000 (13:13 +0100)]
drm/i915: Make wait-for-pending-flips more defensive

Be sure to always flush a stuck pageflip even if we couldn't possibly
expect one to be there.

References: https://bugs.freedesktop.org/show_bug.cgi?id=82612
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Handle i915_ppgtt_put correctly
Michel Thierry [Tue, 19 Aug 2014 14:49:41 +0000 (15:49 +0100)]
drm/i915: Handle i915_ppgtt_put correctly

Unfortunately, the gem_obj/vma relationship is not symmetrical; a gem_obj
can look up for the same vma more than once (where the ppgtt refcount is
incremented), but will free the vma only once (i915_gem_free_object).

This difference in refcount get/put means that the ppgtt is not removed
after the context and vma are destroyed, because sometimes the refcount
will never go back to zero.

v2: Just move the ppgtt refcount into vma_create.

OTC-Jira: VIZ-3719
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Flatten intel_edp_panel_vdd_on()
Ville Syrjälä [Mon, 18 Aug 2014 19:16:03 +0000 (22:16 +0300)]
drm/i915: Flatten intel_edp_panel_vdd_on()

Less pointless indentation is always nice. There will be a bit more
code in this function once the power sequencer locking is fixed.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Warn about want_panel_vdd in edp_panel_vdd_off_sync()
Ville Syrjälä [Mon, 18 Aug 2014 19:16:02 +0000 (22:16 +0300)]
drm/i915: Warn about want_panel_vdd in edp_panel_vdd_off_sync()

If we force vdd off warn if someone is still using it. With this
change the delayed vdd off work needs to check want_panel_vdd
itself to make sure it doesn't try to turn vdd off when someone
is using it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Replace big nested if block with early return
Ville Syrjälä [Mon, 18 Aug 2014 19:16:01 +0000 (22:16 +0300)]
drm/i915: Replace big nested if block with early return

Looks nicer.

Not functional change.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
[danvet: Add "No functional change" as requested by Jani.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Add a note explaining vdd on/off handling in intel_dp_aux_ch()
Ville Syrjälä [Mon, 18 Aug 2014 19:16:00 +0000 (22:16 +0300)]
drm/i915: Add a note explaining vdd on/off handling in intel_dp_aux_ch()

Add a comment to explain why we care about the current want_panel_vdd
state in intel_dp_aux_ch().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Rename edp vdd funcs for consistency
Ville Syrjälä [Tue, 19 Aug 2014 10:24:25 +0000 (13:24 +0300)]
drm/i915: Rename edp vdd funcs for consistency

edp_* are now the lower level functions and intel_edp_* the higher level
ones. One should use them in pairs.

v2: Don't return void (Jani)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Use intel_edp_panel_vdd_on() in intel_dp_probe_mst()
Ville Syrjälä [Mon, 18 Aug 2014 19:15:58 +0000 (22:15 +0300)]
drm/i915: Use intel_edp_panel_vdd_on() in intel_dp_probe_mst()

We want to use the higher level vdd on func here. Not a big deal
yet (we'd just get the warn when things go awry) but when the
locking gets fixed this becomes more important.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Parametrize PANEL_PORT_SELECT_VLV
Ville Syrjälä [Mon, 18 Aug 2014 19:15:56 +0000 (22:15 +0300)]
drm/i915: Parametrize PANEL_PORT_SELECT_VLV

Passing the port as a parameter to PANEL_PORT_SELECT_VLV results in
neater code. Sadly the PCH port select bits aren't suitable for the
same treatment and the resulting macro would be much uglier, so
leave those defines as is.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Populate lrc with aliasing ppgtt if required
Thomas Daniel [Tue, 19 Aug 2014 09:13:36 +0000 (10:13 +0100)]
drm/i915/bdw: Populate lrc with aliasing ppgtt if required

A previous commit broke aliasing PPGTT for lrc, resulting in a kernel oops
on boot. Add a check so that is full PPGTT is not in use the context is
populated with the aliasing PPGTT.

Issue: VIZ-4278
Signed-off-by: Thomas Daniel <thomas.daniel@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: honour forced connector modes
Chris Wilson [Mon, 18 Aug 2014 17:35:29 +0000 (10:35 -0700)]
drm/i915: honour forced connector modes

In the move over to use BIOS connector configs, we lost the ability to
force a specific set of connectors on or off.  Try to remedy that by
dropping back to the old behavior if we detect a hard coded connector
config that tries to enable a connector (disabling is easy!).

Based on earlier patches by Jesse Barnes.

v2: Remove Jesse's patch

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Don't save/restore RS when not used
Ben Widawsky [Mon, 18 Aug 2014 17:35:28 +0000 (10:35 -0700)]
drm/i915: Don't save/restore RS when not used

v2: fix conflict on rebase.

Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Bring UP Power Wells before disabling RC6.
Deepak S [Mon, 18 Aug 2014 17:35:27 +0000 (10:35 -0700)]
drm/i915: Bring UP Power Wells before disabling RC6.

We need do forcewake before Disabling RC6, This is what the BIOS
expects while going into suspend.

v2: updated commit message. (Daniel)

Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Deepak S <deepak.s@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Print the pipe on which the vblank wait times out
Damien Lespiau [Mon, 18 Aug 2014 12:51:00 +0000 (13:51 +0100)]
drm/i915: Print the pipe on which the vblank wait times out

Improve the debug message that tells us we've been waiting for a vblank
that never arrived. Printing the pipe could lead a "doh!" moment where
we've been waiting for a vblank on a pipe that was off for instance.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Thomas Wood <thomas.wood@intel.com>
[danvet: Polish commit message a bit.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Use dev_priv as first argument of for_each_pipe()
Damien Lespiau [Mon, 18 Aug 2014 12:49:10 +0000 (13:49 +0100)]
drm/i915: Use dev_priv as first argument of for_each_pipe()

Chris has decided that enough is enough. It's time to fixup dev Vs
dev_priv. This is a modest contribution to the crusade.

v2: Still use INTEL_INFO(), for the (mythical!) case we want to hardcode
    the info struct with defines (Chris)
    Rename the macro argument from 'dev' to 'dev_priv' (Jani)

v3: Use names unlikely to be used as macro arguments (Chris)

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: don't check for i830 in vlv specific code
Jani Nikula [Fri, 22 Aug 2014 12:06:35 +0000 (15:06 +0300)]
drm/i915: don't check for i830 in vlv specific code

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/bdw: Make sure error capture keeps working with Execlists
Oscar Mateo [Thu, 24 Jul 2014 16:04:43 +0000 (17:04 +0100)]
drm/i915/bdw: Make sure error capture keeps working with Execlists

Since the ringbuffer does not belong per engine anymore, we have to
make sure that we are always recording the correct ringbuffer.

TODO: This is only a small fix to keep basic error capture working, but
we need to add more information for it to be useful (e.g. dump the
context being executed).

v2: Reorder how the ringbuffer is chosen to clarify the change and
rename the variable, both changes suggested by Chris Wilson. Also,
add the TODO comment to the code, as suggested by Daniel.

Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Suppress a WARN on reading an object back for a GPU hang
Chris Wilson [Tue, 12 Aug 2014 19:05:50 +0000 (20:05 +0100)]
drm/i915: Suppress a WARN on reading an object back for a GPU hang

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Remove num_pages parameter to i915_error_object_create()
Chris Wilson [Tue, 12 Aug 2014 19:05:49 +0000 (20:05 +0100)]
drm/i915: Remove num_pages parameter to i915_error_object_create()

For cleanliness, i915_error_object_create() was written to handle the
NULL pointer in a central location. The macro that wrapped it and passed
it a num_pages to use, was not safe. As we now never limit the num_pages
to use (we did so at one point to only capture the first page of the
context), we can remove the redundant macro and be NULL safe again.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Do not access stolen memory directly by the CPU, even for error capture
Chris Wilson [Tue, 12 Aug 2014 19:05:48 +0000 (20:05 +0100)]
drm/i915: Do not access stolen memory directly by the CPU, even for error capture

For stolen pages, since it is verboten to access them directly on many
architectures, we have to read them through the GTT aperture. If they
are not accessible through the aperture, then we have to abort.

This was complicated by

commit 8b6124a633d8095b0c8364f585edff9c59568a96
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jan 30 14:38:16 2014 +0000

    drm/i915: Don't access snooped pages through the GTT (even for error capture)

and the desire to use stolen memory for ringbuffers, contexts and
batches in the future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: switch off backlight for backlight class 0 brightness
Jani Nikula [Tue, 12 Aug 2014 14:11:42 +0000 (17:11 +0300)]
drm/i915: switch off backlight for backlight class 0 brightness

Make backlight class sysfs brightness 0 value switch off the backlight
for connectors that have the backlight_power callback defined. For eDP,
this has the similar caveats regarding power savings as bl_power as only
the power sequencer backlight control is switched off.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/dp: make backlight bl_power control power sequencer backlight
Jani Nikula [Tue, 12 Aug 2014 14:11:41 +0000 (17:11 +0300)]
drm/i915/dp: make backlight bl_power control power sequencer backlight

This lets the userspace switch off the backlight using the backlight
class sysfs bl_power file. The switch is done using the power sequencer;
the backlight PWM, and everything else, remains enabled. The display
backlight won't draw power, but for maximum power savings the encoder
needs to be switched off.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Tested_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: add some framework for backlight bl_power support
Jani Nikula [Wed, 13 Aug 2014 09:10:12 +0000 (12:10 +0300)]
drm/i915: add some framework for backlight bl_power support

Make backlight class sysfs bl_power a sub-state of backlight enabled, if
a backlight power connector callback is defined. It's up to the
connector callback to handle the sub-state, typically in a way that
respects panel power sequencing.

v2: Post the version that does not oops. *facepalm*.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Tested_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915/dp: split up panel power control from backlight pwm control
Jani Nikula [Tue, 12 Aug 2014 14:11:39 +0000 (17:11 +0300)]
drm/i915/dp: split up panel power control from backlight pwm control

Make it possible to change panel power control backlight state without
touching the PWM. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Tested_by: Clinton Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: fix i915_frequency_info on BDW
Paulo Zanoni [Fri, 1 Aug 2014 21:14:48 +0000 (18:14 -0300)]
drm/i915: fix i915_frequency_info on BDW

The GEN6_PM* registers don't exist on BDW anymore, so when we read
this file we trigger unclaimed register errors. The equivalent BDW
register for PMs is GEN8_GT_I*R(2), so use it.

Testcase: igt/pm_rpm/debugfs-read
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Add 180 degree primary plane rotation support
Sonika Jindal [Fri, 22 Aug 2014 08:36:04 +0000 (14:06 +0530)]
drm/i915: Add 180 degree primary plane rotation support

Primary planes support 180 degree rotation. Expose the feature
through rotation drm property.

v2: Calculating linear/tiled offsets based on pipe source width and
height. Added 180 degree rotation support in ironlake_update_plane.

v3: Checking if CRTC is active before issueing update_plane. Added
wait for vblank to make sure we dont overtake page flips. Disabling
FBC since it does not work with rotated planes.

v4: Updated rotation checks for pending flips, fbc disable. Creating
rotation property only for Gen4 onwards. Property resetting as part
of lastclose.

v5: Resetting property in i915_driver_lastclose properly for planes
and crtcs. Fixed linear offset calculation that was off by 1 w.r.t
width in i9xx_update_plane and ironlake_update_plane. Removed tab
based indentation and unnecessary braces in intel_crtc_set_property
and intel_update_fbc. FBC and flip related checks should be done only
for valid crtcs.

v6: Minor nits in FBC disable checks for comments in intel_crtc_set_property
and positioning the disable code in intel_update_fbc.

v7: In case rotation property on inactive crtc is updated, we return
successfully printing debug log as crtc is inactive and only property change
is preserved.

v8: update_plane is changed to update_primary_plane, crtc->fb is changed to
crtc->primary->fb  and return value of update_primary_plane is ignored.

v9: added rotation property to primary plane instead of crtc. Removing reset
of rotation property from lastclose. rotation_property is moved to
drm_mode_config, so drm layer will take care of resetting. Adding updation of
fbc when rotation is set to 0. Allowing rotation only if value is
different than old one.

v10: Calling intel_primary_plane_setplane instead of update_primary_plane in
set_property(Daniel).

v11: Using same set_property function for both primary and sprite, Adding
primary plane specific code in the same function (Matt).

v12: Removing disabling/ enabling of fbc from set_property because it is done
from intel_pipe_set_base. Other formatting

v13: we need to call disable_fbc before changing the rotation to 180,
disable_fbc from intel_pipe_set_base gets called very late, that will
be used to re-enable fbc if rotation is set to 0 (Ville).

Testcase: igt/kms_rotation_crc

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Sagar Kamble <sagar.a.kamble@intel.com>
Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
[danvet: Add FIXME to explain why we need the open-coded update_fbc
hunk to disable fbc when rotated 180 degree. And make checkpatch
happier.]
Acked-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Updating plane parameters for primary plane in setplane
Sonika Jindal [Thu, 21 Aug 2014 06:14:39 +0000 (11:44 +0530)]
drm/i915: Updating plane parameters for primary plane in setplane

This unifies how the primary plane functions work with how the sprite
functions works, which allows us to reuse them to update primary plane
properties.

v2: Moving setting of plane members in the end to take care of failure cases and
not-visible cases (Matt).

Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
Acked-by: Matt Roper <matthew.d.roper@intel.com>
[danvet: Add a real commit message.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/i915: Rework GPU reset sequence to match driver load & thaw
McAulay, Alistair [Fri, 15 Aug 2014 17:51:35 +0000 (18:51 +0100)]
drm/i915: Rework GPU reset sequence to match driver load & thaw

This patch is to address Daniels concerns over different code during reset:

http://lists.freedesktop.org/archives/intel-gfx/2014-June/047758.html

"The reason for aiming as hard as possible to use the exact same code for
driver load, gpu reset and runtime pm/system resume is that we've simply
seen too many bugs due to slight variations and unintended omissions."

Tested using igt drv_hangman.

V2: Cleaner way of preventing check_wedge returning -EAGAIN
V3: Clean the last_context during reset, to ensure do_switch() does the MI_SET_CONTEXT. As per review.
Signed-off-by: McAulay, Alistair <alistair.mcaulay@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
[danvet: Rebase over ctx->ppgtt rework and extend the comment in
check_wedge a bit.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm/qxl: enables gem prime helpers for qxl using dummy driver callbacks
Andreas Pokorny [Fri, 8 Aug 2014 08:40:56 +0000 (10:40 +0200)]
drm/qxl: enables gem prime helpers for qxl using dummy driver callbacks

As there should not be any other virtual device that might share buffers,
the callbacks remain empty stubs. Still prime can be used to transfer buffers
between processes that use qxl.

Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/qxl: simple crtc page flipping emulated using buffer copy
Andreas Pokorny [Fri, 8 Aug 2014 08:40:55 +0000 (10:40 +0200)]
drm/qxl: simple crtc page flipping emulated using buffer copy

Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'for-airlied-next' of git://people.freedesktop.org/~mlankhorst/linux...
Dave Airlie [Wed, 3 Sep 2014 00:12:24 +0000 (10:12 +1000)]
Merge branch 'for-airlied-next' of git://people.freedesktop.org/~mlankhorst/linux into drm-next

Merge the move to generic fences for TTM using drivers.

* 'for-airlied-next' of git://people.freedesktop.org/~mlankhorst/linux:
  drm/nouveau: use shared fences for readable objects
  drm/nouveau: Keep only a single list for validation.
  drm/ttm: use rcu in core ttm
  drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab
  drm/radeon: use rcu waits in some ioctls
  drm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep
  drm/ttm: flip the switch, and convert to dma_fence
  drm/qxl: rework to new fence interface
  drm/nouveau: rework to new fence interface
  drm/vmwgfx: rework to new fence interface, v2
  drm/vmwgfx: get rid of different types of fence_flags entirely
  drm/radeon: use common fence implementation for fences, v4
  drm/ttm: kill off some members to ttm_validate_buffer
  drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers
  drm/ttm: kill fence_lock
  drm/ttm: call ttm_bo_wait while inside a reservation
  drm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence
  drm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep

10 years agoMerge tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Tue, 2 Sep 2014 22:30:48 +0000 (08:30 +1000)]
Merge tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel into drm-next

drm-intel-next-2014-08-22:
- basic code for execlist, which is the fancy new cmd submission on gen8. Still
  disabled by default (Ben, Oscar Mateo, Thomas Daniel et al)
- remove the useless usage of console_lock for I915_FBDEV=n (Chris)
- clean up relations between ctx and ppgtt
- clean up ppgtt lifetime handling (Michel Thierry)
- various cursor code improvements from Ville
- execbuffer code cleanups and secure batch fixes (Chris)
- prep work for dev -> dev_priv transition (Chris)
- some of the prep patches for the seqno -> request object transition (Chris)
- various small improvements all over

* tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel: (86 commits)
  drm/i915: fix suspend/resume for GENs w/o runtime PM support
  drm/i915: Update DRIVER_DATE to 20140822
  drm: fix plane rotation when restoring fbdev configuration
  drm/i915/bdw: Disable execlists by default
  drm/i915/bdw: Enable Logical Ring Contexts (hence, Execlists)
  drm/i915/bdw: Document Logical Rings, LR contexts and Execlists
  drm/i915/bdw: Print context state in debugfs
  drm/i915/bdw: Display context backing obj & ringbuffer info in debugfs
  drm/i915/bdw: Display execlists info in debugfs
  drm/i915/bdw: Disable semaphores for Execlists
  drm/i915/bdw: Make sure gpu reset still works with Execlists
  drm/i915/bdw: Don't write PDP in the legacy way when using LRCs
  drm/i915: Track cursor changes as frontbuffer tracking flushes
  drm/i915/bdw: Help out the ctx switch interrupt handler
  drm/i915/bdw: Avoid non-lite-restore preemptions
  drm/i915/bdw: Handle context switch events
  drm/i915/bdw: Two-stage execlist submit process
  drm/i915/bdw: Write the tail pointer, LRC style
  drm/i915/bdw: Implement context switching (somewhat)
  drm/i915/bdw: Emission of requests with logical rings
  ...

Conflicts:
drivers/gpu/drm/i915/i915_drv.c

10 years agodrm/nouveau: use shared fences for readable objects
Maarten Lankhorst [Wed, 9 Apr 2014 14:19:30 +0000 (16:19 +0200)]
drm/nouveau: use shared fences for readable objects

nouveau keeps track in userspace whether a buffer is being
written to or being read, but it doesn't use that information.

Change this to allow multiple readers on the same bo.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Keep only a single list for validation.
Maarten Lankhorst [Wed, 9 Apr 2014 14:18:58 +0000 (16:18 +0200)]
drm/nouveau: Keep only a single list for validation.

Maintain the original order to handle VRAM/GART/mixed correctly for <nv50,
it's likely not as important on newer cards.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/ttm: use rcu in core ttm
Maarten Lankhorst [Wed, 14 May 2014 13:42:29 +0000 (15:42 +0200)]
drm/ttm: use rcu in core ttm

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab
Maarten Lankhorst [Wed, 14 May 2014 13:41:49 +0000 (15:41 +0200)]
drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/radeon: use rcu waits in some ioctls
Maarten Lankhorst [Wed, 14 May 2014 13:40:49 +0000 (15:40 +0200)]
drm/radeon: use rcu waits in some ioctls

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agodrm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep
Maarten Lankhorst [Wed, 14 May 2014 13:38:23 +0000 (15:38 +0200)]
drm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep

With the conversion to the reservation api this should be safe.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/ttm: flip the switch, and convert to dma_fence
Maarten Lankhorst [Wed, 2 Apr 2014 15:14:48 +0000 (17:14 +0200)]
drm/ttm: flip the switch, and convert to dma_fence

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/qxl: rework to new fence interface
Maarten Lankhorst [Wed, 2 Apr 2014 10:40:05 +0000 (12:40 +0200)]
drm/qxl: rework to new fence interface

Final driver! \o/

This is not a proper dma_fence because the hardware may never signal
anything, so don't use dma-buf with qxl, ever.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/nouveau: rework to new fence interface
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:11 +0000 (11:03 +0100)]
drm/nouveau: rework to new fence interface

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/vmwgfx: rework to new fence interface, v2
Maarten Lankhorst [Wed, 26 Mar 2014 13:07:44 +0000 (14:07 +0100)]
drm/vmwgfx: rework to new fence interface, v2

Use the new fence interface on vmwgfx too.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---
Changes since v1:
Fix a sleeping function called from invalid context in enable_signaling.

10 years agodrm/vmwgfx: get rid of different types of fence_flags entirely
Maarten Lankhorst [Wed, 26 Mar 2014 12:06:24 +0000 (13:06 +0100)]
drm/vmwgfx: get rid of different types of fence_flags entirely

Only one type was ever used. This is needed to simplify the fence
support in the next commit.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/radeon: use common fence implementation for fences, v4
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:12 +0000 (11:03 +0100)]
drm/radeon: use common fence implementation for fences, v4

Changes since v1:
- Kill the sw interrupt dance, add and use
  radeon_irq_kms_sw_irq_get_delayed instead.
- Change custom wait function, lockdep complained about it.
  Holding exclusive_lock in the wait function might cause deadlocks.
  Instead do all the processing in .enable_signaling, and wait
  on the global fence_queue to pick up gpu resets.
- Process all fences in radeon_gpu_reset after reset to close a race
  with the trylock in enable_signaling.
Changes since v2:
- Small changes to work with the rewritten lockup recovery patches.
Changes since v3:
- Call radeon_fence_schedule_check when exclusive_lock cannot be
  acquired to always cause a wake up.
- Reset irqs from hangup check.
- Drop reading seqno in the callback, use cached value.
- Fix indentation in radeon_fence_default_wait
- Add a radeon_test_signaled function, drop a few test_bit calls.
- Make to_radeon_fence global.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agodrm/ttm: kill off some members to ttm_validate_buffer
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:08 +0000 (11:03 +0100)]
drm/ttm: kill off some members to ttm_validate_buffer

This reorders the list to keep track of what buffers are reserved,
so previous members are always unreserved.

This gets rid of some bookkeeping that's no longer needed,
while simplifying the code some.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/ttm: add interruptible parameter to ttm_eu_reserve_buffers
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:08 +0000 (11:03 +0100)]
drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers

It seems some drivers really want this as a parameter,
like vmwgfx.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/ttm: kill fence_lock
Maarten Lankhorst [Tue, 21 Jan 2014 12:07:31 +0000 (13:07 +0100)]
drm/ttm: kill fence_lock

No users are left, kill it off! :D
Conversion to the reservation api is next on the list, after
that the functionality can be restored with rcu.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/ttm: call ttm_bo_wait while inside a reservation
Maarten Lankhorst [Tue, 21 Jan 2014 12:07:01 +0000 (13:07 +0100)]
drm/ttm: call ttm_bo_wait while inside a reservation

This is the last remaining function that doesn't use the reservation
lock completely to fence off access to a buffer.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence
Maarten Lankhorst [Tue, 21 Jan 2014 12:02:14 +0000 (13:02 +0100)]
drm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence

This will ensure we always hold the required lock when calling those functions.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep
Maarten Lankhorst [Tue, 21 Jan 2014 12:00:24 +0000 (13:00 +0100)]
drm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep

Apart from some code inside ttm itself and nouveau_bo_vma_del,
this is the only place where ttm_bo_wait is used without a reservation.
Fix this so we can remove the fence_lock later on.

After the switch to rcu the reservation lock will be
removed again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoMerge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 28 Aug 2014 03:45:45 +0000 (13:45 +1000)]
Merge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm-next

Just clearing out my -next queue before I go on vacation.  Two UVD
improvements that depend on the ttm change you just merged.

* 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: preallocate mem for UVD create/destroy msg
  drm/radeon: allow UVD to use a second 256MB segment

10 years agodrm/radeon: preallocate mem for UVD create/destroy msg
Christian König [Fri, 22 Aug 2014 12:25:55 +0000 (14:25 +0200)]
drm/radeon: preallocate mem for UVD create/destroy msg

llocating memory for UVD create and destroy messages can fail, which is
rather annoying when this happens in the middle of a GPU reset. Try to
avoid this condition by preallocating a page for those dummy messages.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: allow UVD to use a second 256MB segment
Christian König [Thu, 21 Aug 2014 10:18:12 +0000 (12:18 +0200)]
drm/radeon: allow UVD to use a second 256MB segment

This improves concurrent stream decoding.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agoMerge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 28 Aug 2014 01:39:11 +0000 (11:39 +1000)]
Merge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm-next

More radeon changes for drm-next.  Highlights:
- UVD support for older asics
- Reset rework in preparation for Maarten's fence patches
I have a few more patches which depend on Christian's ttm changes,
I'll send them out separately once you've merged the ttm changes.

* 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: drop doing resets in a work item
  drm/radeon: drop RADEON_FENCE_SIGNALED_SEQ v2
  drm/radeon: add timeout argument to radeon_fence_wait_seq v2
  drm/radeon: handle lockup in delayed work, v5
  drm/radeon: take exclusive_lock in read mode during ring tests, v5
  drm/radeon: force fence completion only on problematic rings (v2)
  drm/radeon: wake up all fences on manual reset
  drm/radeon: add UVD fw names for older asic
  drm/radeon: enable RB_ARB before resetting the VCPU
  drm/radeon: 760G/780V/880V don't have UVD
  drm/radeon: implement UVD hw workarounds for R6xx v3
  drm/radeon: add UVD support for older asics v4
  drm/radeon: add set_uvd_clocks callback for r6xx v4
  drm/radeon: properly init UVD MC bits on R600
  drm/radeon: force UVD buffers into VRAM on RS[78]80 v2
  drm/radeon: move the IB test after the AGP fallback

10 years agoMerge branch 'ttm_pfn' of git://people.freedesktop.org/~deathsimple/linux into drm...
Dave Airlie [Thu, 28 Aug 2014 01:34:48 +0000 (11:34 +1000)]
Merge branch 'ttm_pfn' of git://people.freedesktop.org/~deathsimple/linux into drm-next

pull in placement changes radeon requires.

* 'ttm_pfn' of git://people.freedesktop.org/~deathsimple/linux:
  drm/ttm: move fpfn and lpfn into each placement v2

10 years agodrm/radeon: drop doing resets in a work item
Christian König [Wed, 27 Aug 2014 13:22:01 +0000 (15:22 +0200)]
drm/radeon: drop doing resets in a work item

Blocking completely innocent processes with a GPU reset is
a pretty bad idea. Just set needs_reset and let the next
command submission or fence wait do the job.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: drop RADEON_FENCE_SIGNALED_SEQ v2
Christian König [Wed, 27 Aug 2014 13:22:00 +0000 (15:22 +0200)]
drm/radeon: drop RADEON_FENCE_SIGNALED_SEQ v2

It's causing issues with VMID handling and comparing the
fence value two times actually doesn't make handling faster.

v2: rebased on reset changes

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add timeout argument to radeon_fence_wait_seq v2
Maarten Lankhorst [Wed, 27 Aug 2014 13:21:59 +0000 (15:21 +0200)]
drm/radeon: add timeout argument to radeon_fence_wait_seq v2

This makes it possible to wait for a specific amount of time,
rather than wait until infinity.

v2 (chk): rebased on other changes

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: handle lockup in delayed work, v5
Christian König [Wed, 27 Aug 2014 13:21:58 +0000 (15:21 +0200)]
drm/radeon: handle lockup in delayed work, v5

v5 (chk): complete rework, start when the first fence is emitted,
          stop when the last fence is signalled, make it work
          correctly with GPU resets, cleanup radeon_fence_wait_seq

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: take exclusive_lock in read mode during ring tests, v5
Maarten Lankhorst [Wed, 27 Aug 2014 20:45:18 +0000 (16:45 -0400)]
drm/radeon: take exclusive_lock in read mode during ring tests, v5

This is needed for the next commit, because the lockup detection
will need the read lock to run.

v4 (chk): split out forced fence completion, remove unrelated changes,
          add and handle in_reset flag
v5 (agd5f): rebase fix

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: force fence completion only on problematic rings (v2)
Christian König [Wed, 27 Aug 2014 13:21:56 +0000 (15:21 +0200)]
drm/radeon: force fence completion only on problematic rings (v2)

Instead of resetting all fence numbers, only reset the
number of the problematic ring. Split out from a patch
from Maarten Lankhorst <maarten.lankhorst@canonical.com>

v2 (agd5f): rebase build fix

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: wake up all fences on manual reset
Christian König [Wed, 27 Aug 2014 13:21:53 +0000 (15:21 +0200)]
drm/radeon: wake up all fences on manual reset

Wake up all fences when we manually trigger a reset.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add UVD fw names for older asic
Christian König [Tue, 16 Apr 2013 20:11:37 +0000 (22:11 +0200)]
drm/radeon: add UVD fw names for older asic

Activating the UVD support.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: enable RB_ARB before resetting the VCPU
Christian König [Wed, 27 Aug 2014 07:59:45 +0000 (09:59 +0200)]
drm/radeon: enable RB_ARB before resetting the VCPU

This fixes "UVD not responding, trying to reset the VCPU"
messages on earlier ASICs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: 760G/780V/880V don't have UVD
Alex Deucher [Tue, 26 Aug 2014 17:11:36 +0000 (13:11 -0400)]
drm/radeon: 760G/780V/880V don't have UVD

Don't enable UVD on these asics as they don't have
UVD hardware.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: implement UVD hw workarounds for R6xx v3
Christian König [Thu, 25 Apr 2013 07:02:14 +0000 (09:02 +0200)]
drm/radeon: implement UVD hw workarounds for R6xx v3

Only the essentials, cause this hw generation is really buggy.

v2: start supporting RV670,RV620 and RV635 as well
v3: activate more workarounds

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add UVD support for older asics v4
Christian König [Tue, 16 Apr 2013 20:11:22 +0000 (22:11 +0200)]
drm/radeon: add UVD support for older asics v4

v2: cleanup R600 support
v3: rebased on current drm-fixes-3.12
v4: rebased on drm-next-3.14

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add set_uvd_clocks callback for r6xx v4
Alex Deucher [Wed, 28 Nov 2012 21:55:21 +0000 (16:55 -0500)]
drm/radeon: add set_uvd_clocks callback for r6xx v4

v2: wake up PLL, set [VD]CLK_SRC, cleanup code
v3: handle RV670,RV635,RV620 as well
v4: merge rv6xx and rs780/rs880 code, fix ref divider mask

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agodrm/radeon: properly init UVD MC bits on R600
Christian König [Thu, 25 Apr 2013 16:54:07 +0000 (18:54 +0200)]
drm/radeon: properly init UVD MC bits on R600

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: force UVD buffers into VRAM on RS[78]80 v2
Christian König [Tue, 16 Apr 2013 13:41:25 +0000 (15:41 +0200)]
drm/radeon: force UVD buffers into VRAM on RS[78]80 v2

v2: only necessary on RS[78]80

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: move the IB test after the AGP fallback
Christian König [Sun, 24 Aug 2014 12:52:46 +0000 (14:52 +0200)]
drm/radeon: move the IB test after the AGP fallback

Otherwise we won't test if the fallback to PCIe GART really worked.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>