openwrt/staging/blogic.git
11 years agodrm/ttm: Fix memory type compatibility check
Thomas Hellstrom [Mon, 28 Oct 2013 09:02:19 +0000 (02:02 -0700)]
drm/ttm: Fix memory type compatibility check

Also check the busy placements before deciding to move a buffer object.
Failing to do this may result in a completely unneccessary move within a
single memory type.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
11 years agodrm/ttm: Fix ttm_bo_move_memcpy
Thomas Hellstrom [Wed, 30 Oct 2013 10:29:50 +0000 (03:29 -0700)]
drm/ttm: Fix ttm_bo_move_memcpy

All error paths will want to keep the mm node, so handle this at the
function exit. This fixes an ioremap failure error path.
Also add some comments to make the function a bit easier to understand.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
11 years agodrm/ttm: Handle in-memory region copies
Jakob Bornecrantz [Wed, 30 Oct 2013 09:46:56 +0000 (02:46 -0700)]
drm/ttm: Handle in-memory region copies

Fix the case where the ttm pointer may be NULL causing
a NULL pointer dereference.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellström <thellstrom@vmware.com>
Cc: stable@vger.kernel.org
11 years agodrm/ttm: Make NO_EVICT bos available to shrinkers pending destruction
Thomas Hellstrom [Thu, 10 Oct 2013 18:09:03 +0000 (11:09 -0700)]
drm/ttm: Make NO_EVICT bos available to shrinkers pending destruction

NO_EVICT bos that are not idle when all references are dropped are put on
the delayed destroy list. However, since they are not on LRU lists, they
are not available to shrinkers at that point, and buffers on the delayed
destroy list are not checked very often for idle.

So when these buffers are put on the delayed destroy list, clear the
NO_EVICT flag and put them on the right LRU list. This way they are
immediately available for eviction or shrinkers and will not cause false
OOMS.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agodrm/ttm: Allow vm fault retries
Thomas Hellstrom [Wed, 9 Oct 2013 10:18:07 +0000 (03:18 -0700)]
drm/ttm: Allow vm fault retries

Make use of the FAULT_FLAG_ALLOW_RETRY flag to allow dropping the
mmap_sem while waiting for bo idle.

FAULT_FLAG_ALLOW_RETRY appears to be primarily designed for disk waits
but should work just as fine for GPU waits..

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
11 years agoqxl: add a connector property to denote hotplug should rescan modes.
Dave Airlie [Fri, 11 Oct 2013 01:05:00 +0000 (11:05 +1000)]
qxl: add a connector property to denote hotplug should rescan modes.

So GNOME userspace has an issue with when it rescans for modes on hotplug
events, if the monitor has no EDID it assumes that nothing has changed on
EDID as with real hw we'd never have new modes without a new EDID, and they
kind off rely on the behaviour now, however with virtual GPUs we would
like to rescan the modes and get a new preferred mode on hotplug events
to handle dynamic guest resizing (where you resize the host window and the
guest resizes with it).

This is a simple property we can make userspace watch for to trigger new
behaviour based on it, and can be used to replaced EDID hacks in virtual
drivers.

Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com> (on irc)
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: delay minor destruction to drm_dev_free()
David Herrmann [Sun, 20 Oct 2013 16:55:45 +0000 (18:55 +0200)]
drm: delay minor destruction to drm_dev_free()

Instead of freeing minors in drm_dev_unregister(), we only unplug them and
delay the free to drm_dev_free(). Note that if drm_dev_register() has
never been called, minors are NULL and this has no effect.

This change is needed to allow early device unregistration. If we want to
call drm_dev_unregister() on live devices, we need to guarantee that
minors are still valid (but unplugged). This way, any open file can still
access file_priv->minor->dev to get the DRM device. However, the minor is
unplugged so no new users can occur.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: remove minor-id during unplug
David Herrmann [Sun, 20 Oct 2013 16:55:44 +0000 (18:55 +0200)]
drm: remove minor-id during unplug

Don't delay minor removal to drm_put_minor(). Otherwise, user-space can
still open the minor and cause the kernel to oops. Instead, remove the
minor during unplug so any new open() will fail to access this minor.

Note that open() and drm_unplug_minor() are both protected by the global
DRM mutex so we're fine.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: cleanup debugfs in drm_unplug_minor()
David Herrmann [Sun, 20 Oct 2013 16:55:43 +0000 (18:55 +0200)]
drm: cleanup debugfs in drm_unplug_minor()

There is no reason to delay debugfs-cleanup to drm_put_minor(). We should
forbid any access to debugfs files once the device is dead. Chances they
oops once a card was unplugged are very high, anyway.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: make drm_get_minor() static
David Herrmann [Sun, 20 Oct 2013 16:55:42 +0000 (18:55 +0200)]
drm: make drm_get_minor() static

drm_get_minor() is only used in one file. Make it static and add a
kernel-doc comment which documents the current semantics.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: simplify drm_put_minor()
David Herrmann [Sun, 20 Oct 2013 16:55:41 +0000 (18:55 +0200)]
drm: simplify drm_put_minor()

Allow passing NULL as minor to simplify DRM destruction paths. Also remove
the double-pointer reset as it is no longer needed. drm_put_minor() is
only called when the underlying object is destroyed. Hence, resetting
minors to NULL is not necessary.

As drm_put_minor() is no longer used by other DRM files, we can make it
static, too.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: call drm_unplug_minor() from drm_put_minor()
David Herrmann [Sun, 20 Oct 2013 16:55:40 +0000 (18:55 +0200)]
drm: call drm_unplug_minor() from drm_put_minor()

This protects drm_unplug_minor() against repeated calls so we can use it
in drm_put_minor(). This allows us to further simplify it in follow-ups as
we no longer do minor-destruction in both functions but only in
drm_unplug_minor().
Also add kernel-doc comments about what these calls do.

[airlied: fixup for changes to kdev stuff]
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: eliminate bit-copy restoration of crtc
Ilija Hadzic [Tue, 29 Oct 2013 15:09:46 +0000 (11:09 -0400)]
drm: eliminate bit-copy restoration of crtc

Bit-copying restoration of CRTC structure in failure-recovery
path of drm_crtc_helper_set_config function evokes a
subtle and rare, but very dangerous, corruption of
CRTC mutex structure.

Namely, if drm_crtc_helper_set_config takes the path under
'fail:' label *and* some other process has attempted to
grab the crtc mutex (and got blocked), restoring the CRTC
structure by bit-copying it will overwrite the CRTC mutex
state and the waiters list pointer within the mutex structure.
Consequently the blocked process will never be scheduled.

This patch fixes the issue by eliminating the bit-copy
restoration. The elimination is possible because previous
patches have cleaned up the resoration path so that only
the fields touched by the drm_crtc_helper_set_config function
are saved and restored if necessary.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: do not set crtc enabled field twice
Ilija Hadzic [Tue, 29 Oct 2013 15:09:45 +0000 (11:09 -0400)]
drm: do not set crtc enabled field twice

There is no need to set crtc->enabled field in
drm_crtc_helper_set_config. This is already done (and
properly restored in case of failure) in
drm_crtc_helper_set_mode that is called by
drm_crtc_helper_set_config. Doing it at only one
place makes restoration in case of failure easier.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: fix error recovery path in drm_crtc_helper_set_mode
Ilija Hadzic [Tue, 29 Oct 2013 15:09:44 +0000 (11:09 -0400)]
drm: fix error recovery path in drm_crtc_helper_set_mode

There is no need to save or restore hwmode field, because by
the time this function sets this field, it cannot fail any more.
However, we should save old enabled field because if
the function fails, we want to return with unchanged CRTC.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: restore crtc origin if mode_set_base fails
Ilija Hadzic [Tue, 29 Oct 2013 15:09:43 +0000 (11:09 -0400)]
drm: restore crtc origin if mode_set_base fails

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: eliminate old_fb from drm_crtc_helper_set_config
Ilija Hadzic [Tue, 29 Oct 2013 15:09:42 +0000 (11:09 -0400)]
drm: eliminate old_fb from drm_crtc_helper_set_config

Old framebuffer is stored in save_set.fb and it is
the same value that is later stored in old_fb.
This makes old_fb redundant so we can replace
it with save_set.fb.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: remove redundant if statement
Ilija Hadzic [Tue, 29 Oct 2013 15:09:41 +0000 (11:09 -0400)]
drm: remove redundant if statement

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Compact booleans within struct drm_file
Chris Wilson [Tue, 29 Oct 2013 08:55:58 +0000 (08:55 +0000)]
drm: Compact booleans within struct drm_file

Replace the sparse array of booleans with a bitfield.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Do not drop root privileges for a fancier younger process
Chris Wilson [Tue, 29 Oct 2013 08:55:57 +0000 (08:55 +0000)]
drm: Do not drop root privileges for a fancier younger process

When a second process opens the device and master transferrence is
complete, we walk the list of open devices and remove their
authentication. This also revokes our root privilege. Instead of simply
dropping the authentication, this patch reverts the authenticated state
back to its original value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agonouveau: drop interrupt busy setting.
Dave Airlie [Wed, 6 Nov 2013 03:48:16 +0000 (13:48 +1000)]
nouveau: drop interrupt busy setting.

This causes problems with never going busy due to ptherm polling,
and after talking to Ben I can't see it being required.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/sysfs: Remove stale comments about calling drm_sysfs_connector_add() multiple...
Ville Syrjälä [Mon, 4 Nov 2013 19:18:46 +0000 (21:18 +0200)]
drm/sysfs: Remove stale comments about calling drm_sysfs_connector_add() multiple times

drm_connector_sysfs_add() explicitly checks if connector->kdev
is already populated and returns success. So it clearly now allows
being called multiple times. Remove some stale comments to the contrary.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: fix radeon_fence_wait_empty_locked
Christian König [Tue, 5 Nov 2013 13:09:54 +0000 (14:09 +0100)]
drm/radeon: fix radeon_fence_wait_empty_locked

Don't block forever if there is nothing to wait for.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Rafa? Mi?ecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: add some surface memory logging
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:11 +0000 (10:01 +0200)]
drm/qxl: add some surface memory logging

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: support 64bit surface bar
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:10 +0000 (10:01 +0200)]
drm/qxl: support 64bit surface bar

qxl devices can have a 64bit surface bar, which is quite handy if
you need a bit more surface memory.  So try to use it if it is
present.  Note that this bar might be mapped above 4g.

QEMU command line to check that out:

    qemu-system-x86_64 -m 4g \
        -vga qxl -global qxl-vga.vram64_size_mb=512 \
        $otheroptions

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/cirrus: use drm_set_preferred_mode
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:09 +0000 (10:01 +0200)]
drm/cirrus: use drm_set_preferred_mode

Explicitly set 1024x768 as default mode, so the display doesn't come up
with the largest supported mode.

While being at it drop first three drm_add_modes_noedid calls.  As
drm_add_modes_noedid fills the mode list with modes from the database
*up to* the specified size it is pretty pointless to call it multiple
times with different sizes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: add drm_set_preferred_mode
Gerd Hoffmann [Fri, 11 Oct 2013 08:01:08 +0000 (10:01 +0200)]
drm: add drm_set_preferred_mode

New helper function to set the preferred video mode.  Can be called
after drm_add_modes_noedid if you don't want the largest supported
video mode be used by default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Pretty print pixel format in drm_fb_get_bpp_depth() and format_check()
Ville Syrjälä [Tue, 15 Oct 2013 18:06:51 +0000 (21:06 +0300)]
drm: Pretty print pixel format in drm_fb_get_bpp_depth() and format_check()

drm_fb_get_bpp_depth() likes to complain about unsupported pixel formats
but doesn't bother telling us what the format was. Also format_check()
just returns an error when it encouters an invalid format, leaving the
user scratching his head trying to figure out why addfb failed. Make
life a bit easier by using drm_get_format_name() in both places.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/edid: Yank a helpful comment about EST modes from xf86EdidModes.c
Ville Syrjälä [Mon, 14 Oct 2013 13:44:27 +0000 (16:44 +0300)]
drm/edid: Yank a helpful comment about EST modes from xf86EdidModes.c

I got very confused when I tried to compare the EST modes with the spec.
Bring over a comment from xf86EdidModes.c that actually describes some
of history where these things came from.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/edid: Don't skip every eighth EST III mode
Ville Syrjälä [Mon, 14 Oct 2013 13:44:26 +0000 (16:44 +0300)]
drm/edid: Don't skip every eighth EST III mode

Also check the est3 modes whose presence is indicated by bit 0.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/edid: Fix the 1792x1344-75 EST III mode
Ville Syrjälä [Mon, 14 Oct 2013 13:44:25 +0000 (16:44 +0300)]
drm/edid: Fix the 1792x1344-75 EST III mode

The correct refresh rate for this mode is 75, not 85.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/vmwgfx: Return -ENOENT when a framebuffer can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:06 +0000 (13:35 +0300)]
drm/vmwgfx: Return -ENOENT when a framebuffer can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/vmwgfx: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:05 +0000 (13:35 +0300)]
drm/vmwgfx: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:04 +0000 (13:35 +0300)]
drm/radeon: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/i915: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:03 +0000 (13:35 +0300)]
drm/i915: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/gma500: Return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:02 +0000 (13:35 +0300)]
drm/gma500: Return -ENOENT when a mode object can't be found

Let's be a bit more consistent with our error values.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Return -ENOENT when a framebuffer can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:01 +0000 (13:35 +0300)]
drm: Return -ENOENT when a framebuffer can't be found

Return -ENOENT for framebuffers like we do for other mode objects that
can't be found.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Consistently return -ENOENT when a mode object can't be found
Ville Syrjälä [Thu, 17 Oct 2013 10:35:00 +0000 (13:35 +0300)]
drm: Consistently return -ENOENT when a mode object can't be found

We tend to return -EINVAL for everything. Let's try to help poor
userland developers a bit by at least returning -ENONET for missing
objects.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Pass pointers to virt_to_page()
Ben Hutchings [Sun, 27 Oct 2013 21:52:39 +0000 (21:52 +0000)]
drm: Pass pointers to virt_to_page()

Most architectures define virt_to_page() as a macro that casts its
argument such that an argument of type unsigned long will be accepted
without complaint.  However, the proper type is void *, and passing
unsigned long results in a warning on MIPS.

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Do not include page offset in argument to virt_to_page()
Ben Hutchings [Sun, 27 Oct 2013 21:52:17 +0000 (21:52 +0000)]
drm: Do not include page offset in argument to virt_to_page()

By definition, the page offset will not affect the result.

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: delete unconsumed pending event list in drm_events_release
YoungJun Cho [Tue, 29 Oct 2013 11:30:26 +0000 (20:30 +0900)]
drm: delete unconsumed pending event list in drm_events_release

When there are unconsumed pending events, the events are
destroyed by calling destroy callback, but the events list
are remained, because there is no list_del().

It is possible that the page flip request is handled after
drm_events_release() is called and before drm_fb_release().
In this case a drm_pending_event is remained not freed.
So exynos driver checks again to remove it in its post
close routine. But the file_priv->event_list contains
undeleted ones, this can make oops for accessing invalid
memory.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/i915: Make the debugfs structures const
Lespiau, Damien [Thu, 17 Oct 2013 18:09:56 +0000 (19:09 +0100)]
drm/i915: Make the debugfs structures const

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Make drm_debugfs_list const
Lespiau, Damien [Thu, 17 Oct 2013 18:09:55 +0000 (19:09 +0100)]
drm: Make drm_debugfs_list const

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Remove drm_debugfs_node and drm_debugfs_list
Lespiau, Damien [Thu, 17 Oct 2013 18:09:54 +0000 (19:09 +0100)]
drm: Remove drm_debugfs_node and drm_debugfs_list

Those structures are not used anywhere.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Constify struct drm_info_list * arguments
Lespiau, Damien [Thu, 17 Oct 2013 18:09:53 +0000 (19:09 +0100)]
drm: Constify struct drm_info_list * arguments

Those functions are just reading data from those pointers.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoDRM: Armada: convert to use simple_open()
Duan Jiong [Fri, 1 Nov 2013 05:45:05 +0000 (13:45 +0800)]
DRM: Armada: convert to use simple_open()

This removes an open coded simple_open() function and replaces file
operations references to the function with simple_open() instead.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: shmobile: Add dependency on BACKLIGHT_CLASS_DEVICE
Laurent Pinchart [Tue, 29 Oct 2013 17:20:58 +0000 (18:20 +0100)]
drm: shmobile: Add dependency on BACKLIGHT_CLASS_DEVICE

The driver registers a backlight device and thus requires
BACKLIGHT_CLASS_DEVICE to be selected to avoid compilation breakages.

Cc: stable@vger.kernel.org
Reported-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/intel: Push get_scanout_position() timestamping into kms driver.
Mario Kleiner [Wed, 30 Oct 2013 04:13:08 +0000 (05:13 +0100)]
drm/intel: Push get_scanout_position() timestamping into kms driver.

Move the ktime_get() clock readouts and potential preempt_disable()
calls from drm core into kms driver to make it compatible with the
api changes in the drm core.

The intel-kms driver needs to take the uncore.lock inside
i915_get_crtc_scanoutpos() and intel_pipe_in_vblank().
This is incompatible with the preempt_disable() on a
PREEMPT_RT patched kernel, as regular spin locks must not
be taken within a preempt_disable'd section. Lock contention
on the uncore.lock also introduced too much uncertainty in vblank
timestamps.

Push the ktime_get() timestamping for scanoutpos queries and
potential preempt_disable_rt() into i915_get_crtc_scanoutpos(),
so these problems can be avoided:

1. First lock the uncore.lock (might sleep on a PREEMPT_RT kernel).
2. preempt_disable_rt() (will be added by the rt-linux folks).
3. ktime_get() a timestamp before scanout pos query.
4. Do all mmio reads as fast as possible without grabbing any new locks!
5. ktime_get() a post-query timestamp.
6. preempt_enable_rt()
7. Unlock the uncore.lock.

This reduces timestamp uncertainty on a low-end HP Atom Mini netbook
with Intel GMA-950 nicely:

Before: 3-8 usecs with spikes > 20 usecs, triggering query retries.
After : Typically 1 usec (98% of all samples), occassionally 2 usecs
        (2% of all samples), with maximum of 3 usecs (a handful).

v2: Fix formatting of new multi-line code comments.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: Push get_scanout_position() timestamping into kms driver.
Mario Kleiner [Wed, 30 Oct 2013 04:13:07 +0000 (05:13 +0100)]
drm/radeon: Push get_scanout_position() timestamping into kms driver.

Move the ktime_get() clock readouts and potential preempt_disable()
calls from drm core into kms driver to make it compatible with the
api changes in the drm core.

This should not introduce any change in functionality or behaviour
in radeon-kms, just a reshuffling of code.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Push latency sensitive bits of vblank scanoutpos timestamping into kms drivers.
Mario Kleiner [Wed, 30 Oct 2013 04:13:06 +0000 (05:13 +0100)]
drm: Push latency sensitive bits of vblank scanoutpos timestamping into kms drivers.

A change in locking of some kms drivers (currently intel-kms) make
the old approach too inaccurate and also incompatible with the
PREEMPT_RT realtime kernel patchset.

The driver->get_scanout_position() method of intel-kms now needs
to aquire a spinlock, which clashes badly with the former
preempt_disable() calls in the drm, and it also introduces larger
delays and timing uncertainty on a contended lock than acceptable.

This patch changes the prototype of driver->get_scanout_position()
to require/allow kms drivers to perform the ktime_get() system time
queries which go along with actual scanout position readout in a way
that provides maximum precision and to return those timestamps to
the drm. kms drivers implementations of get_scanout_position() are
asked to implement timestamping and scanoutpos readout in a way
that is as precise as possible and compatible with preempt_disable()
on a PREMPT_RT kernel. A driver should follow this pattern in
get_scanout_position() for precision and compatibility:

spin_lock...(...);
preempt_disable_rt(); // On a PREEMPT_RT kernel, otherwise omit.
if (stime) *stime = ktime_get();
... Minimum amount of MMIO register reads to get scanout position ...
... no taking of locks allowed here! ...
if (etime) *etime = ktime_get();
preempt_enable_rt(); // On PREEMPT_RT kernel, otherwise omit.
spin_unlock...(...);

v2: Fix formatting of new multi-line code comments.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: Remove preempt_disable() from vblank timestamping code.
Mario Kleiner [Wed, 30 Oct 2013 04:13:05 +0000 (05:13 +0100)]
drm: Remove preempt_disable() from vblank timestamping code.

Preemption handling will get pushed into the kms
drivers in followup patches, to make timestamping
more robust and PREEMPT_RT friendly.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoMerge branch 'drm-next-3.13' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Tue, 5 Nov 2013 06:22:08 +0000 (16:22 +1000)]
Merge branch 'drm-next-3.13' of git://people.freedesktop.org/~agd5f/linux into drm-next

Initial pull request for radeon drm-next 3.13.  Highlights:
- Enable DPM on a number of asics by default
- Enable audio by default
- Dynamically power down dGPUs on PowerXpress systems
- Lots of bug fixes
* 'drm-next-3.13' of git://people.freedesktop.org/~agd5f/linux: (36 commits)
  drm/radeon: don't share PPLLs on DCE4.1
  drm/radeon/dpm: fix typo in setting smc flag
  drm/radeon: fixup locking inversion between, mmap_sem and reservations
  drm/radeon: clear the page directory using the DMA
  drm/radeon: initially clear page tables
  drm/radeon: drop CP page table updates & cleanup v2
  drm/radeon: add vm_set_page tracepoint
  drm/radeon: rework and fix reset detection v2
  drm/radeon: don't use PACKET2 on CIK
  drm/radeon: fix UVD destroy IB size
  drm/radeon: activate UVD clocks before sending the destroy msg
  drm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL
  drm/radeon: fix endian handling in rlc buffer setup
  drm/radeon/dpm: retain user selected performance level across state changes
  drm/radeon: disable force performance state when thermal state is active
  drm/radeon: enable DPM by default on r7xx asics
  drm/radeon: enable DPM by default on evergreen asics
  drm/radeon: enable DPM by default on BTC asics
  drm/radeon: enable DPM by default on SI asics
  drm/radeon: enable DPM by default on SUMO/PALM APUs
  ...

11 years agoMerge tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux into drm...
Dave Airlie [Tue, 5 Nov 2013 06:21:00 +0000 (16:21 +1000)]
Merge tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v3.13-rc1

The biggest part of the changes is the decoupling of the host1x and DRM
drivers followed by the move of Tegra DRM back to drivers/gpu/drm/tegra
from whence it came. There is a lot of cleanup as well, and the drivers
can now be properly unloaded and reloaded.

HDMI support for the Tegra114 SoC was contributed by Mikko Perttunen.

gr2d support was extended to Tegra114 and the gr3d driver that has been
in the works for quite some time finally made it in. All pieces to run
an OpenGL driver on top of an upstream kernel are now available.

Support for syncpoint bases was added by Arto Merilainen. This is useful
for synchronizing between command streams from different engines such as
gr2d and gr3d.

Erik Faye-Lund and Wei Yongjun contributed various small fixes. Thanks!

* tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux: (45 commits)
  drm/tegra: Reserve syncpoint base for gr3d
  drm/tegra: Reserve base for gr2d
  drm/tegra: Deliver syncpoint base to user space
  gpu: host1x: Add syncpoint base support
  gpu: host1x: Add 'flags' field to syncpt request
  drm/tegra: Disable clock on probe failure
  gpu: host1x: Disable clock on probe failure
  drm/tegra: Support bottom-up buffer objects
  drm/tegra: Add support for tiled buffer objects
  drm/tegra: Add 3D support
  drm/tegra: Introduce tegra_drm_submit()
  drm/tegra: Use symbolic names for gr2d registers
  drm/tegra: Start connectors with correct DPMS mode
  drm/tegra: hdmi: Enable VDD earlier for hotplug/DDC
  drm/tegra: hdmi: Fix build warnings
  drm/tegra: hdmi: Detect DVI-only displays
  drm/tegra: Add Tegra114 HDMI support
  drm/tegra: hdmi: Parameterize based on compatible property
  drm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30}
  gpu: host1x: Add support for Tegra114
  ...

11 years agoqxl: avoid an oops in the deferred io code.
Dave Airlie [Mon, 4 Nov 2013 06:38:08 +0000 (16:38 +1000)]
qxl: avoid an oops in the deferred io code.

If we are using deferred io due to plymouth or X.org fbdev driver
we will oops in memcpy due to this pointless multiply here,

removing it fixes fbdev to start and not oops.

Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: don't share PPLLs on DCE4.1
Alex Deucher [Thu, 31 Oct 2013 20:43:27 +0000 (16:43 -0400)]
drm/radeon: don't share PPLLs on DCE4.1

Sharing PPLLs seems to cause problems on some boards.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=45334

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon/dpm: fix typo in setting smc flag
Alex Deucher [Fri, 1 Nov 2013 17:30:55 +0000 (13:30 -0400)]
drm/radeon/dpm: fix typo in setting smc flag

PPSMC_EXTRAFLAGS_AC2DC_GPIO5_POLARITY_HIGH should be
set in extraFlags, not systemFlags.

Noticed-by: Sylvain BERTRAND <sylware@legeek.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fixup locking inversion between, mmap_sem and reservations
Maarten Lankhorst [Wed, 9 Oct 2013 12:36:57 +0000 (14:36 +0200)]
drm/radeon: fixup locking inversion between, mmap_sem and reservations

op 08-10-13 18:58, Thomas Hellstrom schreef:
> On 10/08/2013 06:47 PM, Jerome Glisse wrote:
>> On Tue, Oct 08, 2013 at 06:29:35PM +0200, Thomas Hellstrom wrote:
>>> On 10/08/2013 04:55 PM, Jerome Glisse wrote:
>>>> On Tue, Oct 08, 2013 at 04:45:18PM +0200, Christian König wrote:
>>>>> Am 08.10.2013 16:33, schrieb Jerome Glisse:
>>>>>> On Tue, Oct 08, 2013 at 04:14:40PM +0200, Maarten Lankhorst wrote:
>>>>>>> Allocate and copy all kernel memory before doing reservations. This prevents a locking
>>>>>>> inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
>>>>>>> in ttm_bo_vm_fault without upsetting lockdep.
>>>>>>>
>>>>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
>>>>>> I would say NAK. Current code only allocate temporary page in AGP case.
>>>>>> So AGP case is userspace -> temp page -> cs checker -> radeon ib.
>>>>>>
>>>>>> Non AGP is directly memcpy to radeon IB.
>>>>>>
>>>>>> Your patch allocate memory memcpy userspace to it and it will then be
>>>>>> memcpy to IB. Which means you introduce an extra memcpy in the process
>>>>>> not something we want.
>>>>> Totally agree. Additional to that there is no good reason to provide
>>>>> anything else than anonymous system memory to the CS ioctl, so the
>>>>> dependency between the mmap_sem and reservations are not really
>>>>> clear to me.
>>>>>
>>>>> Christian.
>>>> I think is that in other code path you take mmap_sem first then reserve
>>>> bo. But here we reserve bo and then we take mmap_sem because of copy
>>> >from user.
>>>> Cheers,
>>>> Jerome
>>>>
>>> Actually the log message is a little confusing. I think the mmap_sem
>>> locking inversion problem is orthogonal to what's being fixed here.
>>>
>>> This patch fixes the possible recursive bo::reserve caused by
>>> malicious user-space handing a pointer to ttm memory so that the ttm
>>> fault handler is called when bos are already reserved. That may
>>> cause a (possibly interruptible) livelock.
>>>
>>> Once that is fixed, we are free to choose the mmap_sem ->
>>> bo::reserve locking order. Currently it's bo::reserve->mmap_sem(),
>>> but the hack required in the ttm fault handler is admittedly a bit
>>> ugly.  The plan is to change the locking order to
>>> mmap_sem->bo::reserve
>>>
>>> I'm not sure if it applies to this particular case, but it should be
>>> possible to make sure that copy_from_user_inatomic() will always
>>> succeed, by making sure the pages are present using
>>> get_user_pages(), and release the pages after
>>> copy_from_user_inatomic() is done. That way there's no need for a
>>> double memcpy slowpath, but if the copied data is very fragmented I
>>> guess the resulting code may look ugly. The get_user_pages()
>>> function will return an error if it hits TTM pages.
>>>
>>> /Thomas
>> get_user_pages + copy_from_user_inatomic is overkill. We should just
>> do get_user_pages which fails with ttm memory and then use copy_highpage
>> helper.
>>
>> Cheers,
>> Jerome
> Yeah, it may well be that that's the preferred solution.
>
> /Thomas
>
I still disagree, and shuffled radeon_ib_get around to be called sooner.

How does the patch below look?
8<-------
Allocate and copy all kernel memory before doing reservations. This prevents a locking
inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
in ttm_bo_vm_fault without upsetting lockdep.

Changes since v1:
- Kill extra memcpy for !AGP case.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: clear the page directory using the DMA
Christian König [Tue, 29 Oct 2013 19:14:51 +0000 (20:14 +0100)]
drm/radeon: clear the page directory using the DMA

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: initially clear page tables
Christian König [Tue, 29 Oct 2013 19:14:50 +0000 (20:14 +0100)]
drm/radeon: initially clear page tables

Clear page tables after allocating them in case
we don't completely fill them later.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: drop CP page table updates & cleanup v2
Christian König [Wed, 30 Oct 2013 15:51:09 +0000 (11:51 -0400)]
drm/radeon: drop CP page table updates & cleanup v2

The DMA ring seems to be stable now.

v2: remove pt_ring_index as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add vm_set_page tracepoint
Christian König [Tue, 29 Oct 2013 19:14:48 +0000 (20:14 +0100)]
drm/radeon: add vm_set_page tracepoint

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: rework and fix reset detection v2
Christian König [Tue, 29 Oct 2013 19:14:47 +0000 (20:14 +0100)]
drm/radeon: rework and fix reset detection v2

Stop fiddling with jiffies, always wait for RADEON_FENCE_JIFFIES_TIMEOUT.
Consolidate the two wait sequence implementations into just one function.
Activate all waiters and remember if the reset was already done instead of
trying to reset from only one thread.

v2: clear reset flag earlier to avoid timeout in IB test

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: don't use PACKET2 on CIK
Marek Olšák [Wed, 30 Oct 2013 13:41:35 +0000 (14:41 +0100)]
drm/radeon: don't use PACKET2 on CIK

It is said to cause hangs.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix UVD destroy IB size
Christian König [Wed, 30 Oct 2013 11:56:05 +0000 (12:56 +0100)]
drm/radeon: fix UVD destroy IB size

The parameter is in bytes not dwords.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: activate UVD clocks before sending the destroy msg
Christian König [Wed, 30 Oct 2013 11:56:04 +0000 (12:56 +0100)]
drm/radeon: activate UVD clocks before sending the destroy msg

Make sure the UVD clocks are still active before sending
the destroy message, otherwise the hw might hang.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL
Alex Deucher [Mon, 28 Oct 2013 14:56:23 +0000 (10:56 -0400)]
drm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL

Typo in the register offset.

Noticed-by: Sylvain BERTRAND <sylware@legeek.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: fix endian handling in rlc buffer setup
Alex Deucher [Wed, 23 Oct 2013 22:27:10 +0000 (18:27 -0400)]
drm/radeon: fix endian handling in rlc buffer setup

The buffers needs to be in little endian format.

Noticed-by: Sylvain BERTRAND <sylware@legeek.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: retain user selected performance level across state changes
Alex Deucher [Wed, 23 Oct 2013 21:31:42 +0000 (17:31 -0400)]
drm/radeon/dpm: retain user selected performance level across state changes

If the user has forced the state high or low, retain that preference
even when we switch power states.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=70654

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: disable force performance state when thermal state is active
Alex Deucher [Wed, 23 Oct 2013 21:22:29 +0000 (17:22 -0400)]
drm/radeon: disable force performance state when thermal state is active

If the thermal state is active, we are in the lowest performance level
to cool down the chip.  Don't let the user force it higher.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on r7xx asics
Alex Deucher [Fri, 1 Nov 2013 19:16:02 +0000 (15:16 -0400)]
drm/radeon: enable DPM by default on r7xx asics

Seems to be stable on them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on evergreen asics
Alex Deucher [Fri, 1 Nov 2013 19:11:34 +0000 (15:11 -0400)]
drm/radeon: enable DPM by default on evergreen asics

Seems to be stable on them.  There are still some issues
with the performance states staying in the highest levels
on certain cards when multiple monitors are attached, but
being that the the cards are always in their highest power
state at boot up anyway, this doesn't really change anything
and improves things in all other cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on BTC asics
Alex Deucher [Wed, 30 Oct 2013 14:18:37 +0000 (10:18 -0400)]
drm/radeon: enable DPM by default on BTC asics

Seems to be stable on them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on SI asics
Alex Deucher [Wed, 23 Oct 2013 21:14:06 +0000 (17:14 -0400)]
drm/radeon: enable DPM by default on SI asics

Seems to be stable on them and improves peformance
as most SI asics have very low boot clocks.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on SUMO/PALM APUs
Alex Deucher [Wed, 23 Oct 2013 21:11:06 +0000 (17:11 -0400)]
drm/radeon: enable DPM by default on SUMO/PALM APUs

DPM seems to be stable on these asics and it drastically
improves performance depending on the boot clocks.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: only print dpm debugging messages when radeon_dpm=1
Alex Deucher [Wed, 23 Oct 2013 22:35:43 +0000 (18:35 -0400)]
drm/radeon/dpm: only print dpm debugging messages when radeon_dpm=1

Avoids spamming the system log for chips where dpm is enabled by
default, but prints then messages when users force it on for other
asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: Implement radeon_pci_shutdown
Markus Trippelsdorf [Wed, 23 Oct 2013 21:07:30 +0000 (17:07 -0400)]
drm/radeon: Implement radeon_pci_shutdown

Currently radeon devices are not properly shutdown during kexec. This
causes a varity of issues, e.g. dpm initialization failures.
Fix this by implementing a radeon_pci_shutdown function, that unloads
the driver cleanly.

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/audio: write audio/video latency info for DCE6/8
Alex Deucher [Thu, 10 Oct 2013 22:03:06 +0000 (18:03 -0400)]
drm/radeon/audio: write audio/video latency info for DCE6/8

Needed by the hda driver to properly set up synchronization
on the audio side.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agodrm/radeon/audio: write audio/video latency info for DCE4/5
Alex Deucher [Thu, 10 Oct 2013 21:54:51 +0000 (17:54 -0400)]
drm/radeon/audio: write audio/video latency info for DCE4/5

Needed by the hda driver to properly set up synchronization
on the audio side.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agodrm/radeon/audio: break out of loops once we match connector
Alex Deucher [Thu, 10 Oct 2013 21:58:27 +0000 (17:58 -0400)]
drm/radeon/audio: break out of loops once we match connector

No need to continue with the loops once we've matched
the appropriate connector.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE4.x
Alex Deucher [Thu, 10 Oct 2013 20:59:49 +0000 (16:59 -0400)]
drm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE4.x

The plain [EN|DIS]ABLE functions do the same thing and more
and aren't broken on some systems like [EN|DIS]ABLE_OUTPUT.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE3.x
Alex Deucher [Wed, 23 Oct 2013 20:29:04 +0000 (16:29 -0400)]
drm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE3.x

The plain [EN|DIS]ABLE functions do the same thing and more
and aren't broken on some systems like [EN|DIS]ABLE_OUTPUT.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: tell dpm there is a display connected
Alex Deucher [Thu, 10 Oct 2013 16:31:43 +0000 (12:31 -0400)]
drm/radeon/si: tell dpm there is a display connected

On SI asics, the SMC will automatically force the performance
level to the lowest level if there are no displays active.  This
prevents automatic performance scaling on PowerXpress systems or
for offscreen rendering or compute when displays are disabled.

Going forward, it would be best to dynamically change this, but
for now leave scaling enabled.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=69395

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: implement blit copy callback for CIK
Alex Deucher [Tue, 1 Oct 2013 20:36:51 +0000 (16:36 -0400)]
drm/radeon: implement blit copy callback for CIK

Uses the CP ring rather than the DMA ring.  Useful
for debugging and benchmarking.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: cleanup a type issue with rv6xx_clocks_per_unit()
Dan Carpenter [Tue, 2 Jul 2013 06:22:55 +0000 (09:22 +0300)]
drm/radeon/dpm: cleanup a type issue with rv6xx_clocks_per_unit()

The rv6xx_clocks_per_unit() function pretends it can set flags in a u64
bitfield but really because "1" is an int it doesn't work for more than
32 bits.  The only caller truncates the high bits away anyway.  I've
just changed it to be a u32.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: plug in blit copy routine for SI
Alex Deucher [Tue, 1 Oct 2013 20:17:14 +0000 (16:17 -0400)]
drm/radeon: plug in blit copy routine for SI

Uses CP DMA packet just like previous asics.
Useful for debugging and benchmarking.  Uses
same packet format as prior asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable hdmi audio by default
Alex Deucher [Thu, 26 Sep 2013 17:11:18 +0000 (13:11 -0400)]
drm/radeon: enable hdmi audio by default

Seems to be stable enough for the majority of users.
It can be disabled on the fly via connector attributes.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add runtime PM support (v2)
Dave Airlie [Mon, 17 Sep 2012 04:40:31 +0000 (14:40 +1000)]
drm/radeon: add runtime PM support (v2)

This hooks radeon up to the runtime PM system to enable
dynamic power management for secondary GPUs in switchable
and powerxpress laptops.

v2: agd5f: clean up, add module parameter

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: convert to pmops
Dave Airlie [Thu, 13 Sep 2012 02:02:30 +0000 (12:02 +1000)]
drm/radeon: convert to pmops

This is a pre-requisite for runtime pm on powerxpress systems.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add a connector property for dither
Alex Deucher [Tue, 24 Sep 2013 21:26:26 +0000 (17:26 -0400)]
drm/radeon: add a connector property for dither

Allows you to enable dither in the display hardware
when the monitor supports lower a lower bpc than the
current framebuffer format.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: Add support for programming the FMT blocks
Alex Deucher [Mon, 23 Sep 2013 16:22:11 +0000 (12:22 -0400)]
drm/radeon: Add support for programming the FMT blocks

The FMT blocks control how data is sent from the backend
of the display pipe to to monitor.  Proper set up of the
FMT blocks are required for 30bpp formats.  Additionally,
dithering can be enabled on for better display with 18 and
24bpp displays.  The exception is LVDS/eDP which atom
takes care of in the SelectCRTC_Source table.  For now
just enable truncation until we test dithering more.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/tegra: Reserve syncpoint base for gr3d
Thierry Reding [Mon, 28 Oct 2013 09:23:11 +0000 (10:23 +0100)]
drm/tegra: Reserve syncpoint base for gr3d

Request a syncpoint base to be associated with the gr3d syncpoint.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Reserve base for gr2d
Arto Merilainen [Mon, 14 Oct 2013 12:21:55 +0000 (15:21 +0300)]
drm/tegra: Reserve base for gr2d

This patch modifies the gr2d to reserve a base for syncpoint.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Deliver syncpoint base to user space
Arto Merilainen [Mon, 14 Oct 2013 12:21:54 +0000 (15:21 +0300)]
drm/tegra: Deliver syncpoint base to user space

This patch adds a separate ioctl for delivering syncpoint base number
to user space. If the syncpoint does not have an associated base, the
function returns -ENXIO.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Add syncpoint base support
Arto Merilainen [Mon, 14 Oct 2013 12:21:53 +0000 (15:21 +0300)]
gpu: host1x: Add syncpoint base support

This patch adds support for hardware syncpoint bases. This creates
a simple mechanism to stall the command FIFO until an operation is
completed.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Add 'flags' field to syncpt request
Arto Merilainen [Mon, 14 Oct 2013 12:21:52 +0000 (15:21 +0300)]
gpu: host1x: Add 'flags' field to syncpt request

Functions host1x_syncpt_request() and _host1x_syncpt_alloc() have
been taking a separate boolean flag ('client_managed') for indicating
if the syncpoint value should be tracked by the host1x driver.

This patch converts the field into generic 'flags' field so that
we can easily add more information while requesting a syncpoint.
Clients are adapted to use the new interface accordingly.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Disable clock on probe failure
Wei Yongjun [Mon, 21 Oct 2013 05:38:34 +0000 (13:38 +0800)]
drm/tegra: Disable clock on probe failure

Add a missing clk_disable_unprepare() before returning from the driver's
.probe() function on error.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Disable clock on probe failure
Wei Yongjun [Mon, 21 Oct 2013 05:37:31 +0000 (13:37 +0800)]
gpu: host1x: Disable clock on probe failure

Add a missing clk_disable_unprepare() before returning from the driver's
.probe() function on error.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Support bottom-up buffer objects
Thierry Reding [Mon, 7 Oct 2013 07:47:58 +0000 (09:47 +0200)]
drm/tegra: Support bottom-up buffer objects

The gr3d engine renders images bottom-up. Allow buffers that are used
for 3D content to be marked as such and implement support in the display
controller to present them properly.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Add support for tiled buffer objects
Thierry Reding [Fri, 4 Oct 2013 20:34:01 +0000 (22:34 +0200)]
drm/tegra: Add support for tiled buffer objects

The gr2d and gr3d engines work more efficiently on buffers with a tiled
memory layout. Allow created buffers to be marked as tiled so that the
display controller can scan them out properly.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Add 3D support
Thierry Reding [Thu, 28 Feb 2013 07:08:01 +0000 (08:08 +0100)]
drm/tegra: Add 3D support

Initialize and power the 3D unit on Tegra20, Tegra30 and Tegra114 and
register a channel with the Tegra DRM driver so that the unit can be
used from userspace.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>