GitHub/moto-9609/android_kernel_motorola_exynos9610.git
9 years agodrm: omapdrm: if omap_plane_atomic_update fails, disable plane
Tomi Valkeinen [Fri, 29 May 2015 08:06:07 +0000 (11:06 +0300)]
drm: omapdrm: if omap_plane_atomic_update fails, disable plane

omap_plane_atomic_update() calls dispc_ovl_setup(), which can fail (but
shouldn't). To make the code a bit more robust, make sure the plane gets
disabled if dispc_ovl_setup() fails, as otherwise we might get illegal
HW configuration leading to error interrupts.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: inline omap_plane_setup into update/disable
Tomi Valkeinen [Fri, 29 May 2015 08:05:37 +0000 (11:05 +0300)]
drm: omapdrm: inline omap_plane_setup into update/disable

At the moment we have omap_plane_setup() function which handles both
enabling (and configuring) and disabling the plane. With atomic
modesetting we have separate hooks for plane enable/config and disable.

This patch moves the code from omap_plane_setup() to
omap_plane_atomic_update() and omap_plane_atomic_disable().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: omap_plane_setup() cannot fail, use WARN
Tomi Valkeinen [Fri, 29 May 2015 08:03:15 +0000 (11:03 +0300)]
drm: omapdrm: omap_plane_setup() cannot fail, use WARN

With atomic modesetting, omap_plane_setup()'s return value is ignored as
the functions using it cannot fail. dispc_ovl_setup(), called by
omap_plane_setup(), can fail (but shouldn't).

Instead of returning an error from omap_plane_setup() which gets
ignored, return void and use WARN if dispc_ovl_setup() fails.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm: omapdrm: Don't setup planes manually from CRTC .enable()/.disable()
Laurent Pinchart [Wed, 27 May 2015 17:53:57 +0000 (20:53 +0300)]
drm: omapdrm: Don't setup planes manually from CRTC .enable()/.disable()

Planes setup is handled by the DRM core through the atomic helpers,
there's no need to duplicate the code in the CRTC .enable() and
.disable() operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Don't flush CRTC when enabling or disabling it
Laurent Pinchart [Wed, 27 May 2015 23:39:35 +0000 (02:39 +0300)]
drm: omapdrm: Don't flush CRTC when enabling or disabling it

The omap_crtc_flush() call in omap_crtc_enable() and omap_crtc_disable()
is a no-op, as the display manager is always disabled at this point. Just
remove the function call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Move encoder setup to encoder operations
Laurent Pinchart [Wed, 27 May 2015 23:34:05 +0000 (02:34 +0300)]
drm: omapdrm: Move encoder setup to encoder operations

Now that the driver is fully converted to atomic operations, and that
the atomic helpers call the operations in the right order, we can move
encoder setup to where it belongs, in the encoder operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Simplify DSS power management
Laurent Pinchart [Wed, 27 May 2015 23:09:56 +0000 (02:09 +0300)]
drm: omapdrm: Simplify DSS power management

Instead of sprinkling dispc_runtime_get() and dispc_runtime_put() calls
in various CRTC operations, move all power management code to the atomic
commit function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Remove nested PM get/sync when configuring encoders
Laurent Pinchart [Wed, 27 May 2015 22:58:02 +0000 (01:58 +0300)]
drm: omapdrm: Remove nested PM get/sync when configuring encoders

The omap_crtc_encoder_setup() function is always called with the DSS
enabled. Remove the dispc_runtime_get() and dispc_runtime_put() calls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Support unlinking page flip events prematurely
Laurent Pinchart [Thu, 16 Apr 2015 19:35:20 +0000 (22:35 +0300)]
drm: omapdrm: Support unlinking page flip events prematurely

DRM page flip vblank events requested by page flips or atomic commits
are created by the DRM core and then passed to driver through CRTC
states (for atomic commit) or directly to the page flip handler (for
legacy page flips). The events are then kept aside until the page flip
completes, at which point drivers queue them for delivery with a call to
drm_send_vblank_event().

When a DRM file handle is closed events pending for delivery are cleaned
up automatically by the DRM core. Events that have been passed to the
driver but haven't completed yet, however, are not handled by the DRM
core. Drivers are responsible for destroying them and must not attempt
to queue them for delivery. This is usually handled by drivers'
preclose() handlers that cancel and destroy page flip events that
reference the file handle being closed.

With asynchronous atomic updates the story becomes more complex. Several
asynchronous atomic updates can be pending, each of them carrying
per-CRTC events. As the atomic_commit() operation doesn't receive a file
handle context, drivers can't know which file handle a pending update
refers to, making it difficult to cancel or wait for completion of
updates related to the file handle being closed.

It should be noted that cancelling page flips or waiting for atomic
updates completion isn't required by the DRM core when closing a file
handle. The only requirement is that no event gets queued for delivery
after the preclose() operation returns. This can easily be achieved by
storing events for atomic commits in a list, unlinking events from the
file handle being closed by setting the file_priv field to NULL, and
skipping delivery of unlinked events.

This logic replaces the page flip cancellation completely.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: omap_crtc_flush() isn't called with modeset locked
Laurent Pinchart [Wed, 15 Apr 2015 19:47:45 +0000 (22:47 +0300)]
drm: omapdrm: omap_crtc_flush() isn't called with modeset locked

When performing asynchronous atomic updates the modeset lock isn't taken
around the callers of omap_crtc_flush(). This isn't an issue though, as
access to the CRTC is properly serialized. Just drop the warning.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Don't get/put dispc in omap_crtc_flush()
Laurent Pinchart [Wed, 15 Apr 2015 18:51:45 +0000 (21:51 +0300)]
drm: omapdrm: Don't get/put dispc in omap_crtc_flush()

The omap_crtc_flush() function is always called with a reference to the
dispc held. Remove unnecessary calls to dispc_runtime_get() and
dispc_runtime_put().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Make the omap_crtc_flush function static
Laurent Pinchart [Wed, 15 Apr 2015 18:47:34 +0000 (21:47 +0300)]
drm: omapdrm: Make the omap_crtc_flush function static

The function isn't used outside of its compilation unit, make it static.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Remove omap_plane enabled field
Laurent Pinchart [Fri, 6 Mar 2015 17:18:56 +0000 (19:18 +0200)]
drm: omapdrm: Remove omap_plane enabled field

The field tracks the plane state to avoid double-enable or -disable.
This isn't required anymore, as

- the DRM atomic core guarantees that the plane atomic_update and
  atomic_disable functions will never be called on an enabled/disabled
  plane

- the CRTC enable/disable operations that enable/disable the plane are
  already guarded against double enable/disable

We can thus remove the enabled field completely. The
omap_plane_set_enable() function then becomes a wrapper around
omap_plane_setup() which can be called directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Remove omap_crtc enabled field
Laurent Pinchart [Wed, 15 Apr 2015 15:55:27 +0000 (18:55 +0300)]
drm: omapdrm: Remove omap_crtc enabled field

The field tracks the CRTC state to avoid double-enable or -disable. As
the DRM atomic core guarantees that the CRTC enable and disable
functions won't be called on an already enabled or disabled CRTC, such
tracking isn't needed. Remove the enabled field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Move crtc info out of the crtc structure
Laurent Pinchart [Fri, 6 Mar 2015 17:00:18 +0000 (19:00 +0200)]
drm: omapdrm: Move crtc info out of the crtc structure

The crtc info structure is only used to setup the crtc through the DSS
API. Move it from the crtc structure to local variables in
omap_crtc_dss_enable().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Move plane info and win out of the plane structure
Laurent Pinchart [Fri, 6 Mar 2015 17:00:18 +0000 (19:00 +0200)]
drm: omapdrm: Move plane info and win out of the plane structure

The plane info and win structures are only used to setup the plane
through the DSS API. Move them from the plane structure to local
variables in omap_plane_setup().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch crtc and plane set_property to atomic helpers
Laurent Pinchart [Fri, 6 Mar 2015 16:35:16 +0000 (18:35 +0200)]
drm: omapdrm: Switch crtc and plane set_property to atomic helpers

Allow setting up plane properties atomically using the plane
set_property atomic helper. The properties are now stored in the plane
state (requiring subclassing it) and applied when updating the planes.

The CRTC exposes the properties of its primary plane for legacy reason.
We can't get rid of that API, so simply delegate it to the primary
plane.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Drop manual framebuffer pin handling
Laurent Pinchart [Thu, 5 Mar 2015 16:49:37 +0000 (18:49 +0200)]
drm: omapdrm: Drop manual framebuffer pin handling

Since the removal of omap_plane_mode_set(), framebuffers are now pinned
exclusively through the plane .prepare_fb() and .cleanup_fb() operations
as the remaining callers of omap_plane_setup() don't modify the
framebuffer. Remove the manual pin/unpin infrastructure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch page flip to atomic helpers
Laurent Pinchart [Fri, 6 Mar 2015 14:01:53 +0000 (16:01 +0200)]
drm: omapdrm: Switch page flip to atomic helpers

The atomic page flip helper implements the page flip operation using
asynchronous commits.

As the legacy page flip was the last caller of omap_plane_mode_set(),
remove the function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Implement asynchronous commit support
Laurent Pinchart [Thu, 5 Mar 2015 21:42:39 +0000 (23:42 +0200)]
drm: omapdrm: Implement asynchronous commit support

Implement a custom .atomic_commit() handler that supports asynchronous
commits using a work queue. This can be used for userspace-driven
asynchronous commits, as well as for an atomic page flip implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Replace encoder mode_fixup with atomic_check
Laurent Pinchart [Thu, 5 Mar 2015 21:04:30 +0000 (23:04 +0200)]
drm: omapdrm: Replace encoder mode_fixup with atomic_check

The encoder .mode_fixup() operation is legacy, atomic updates uses the
new .atomic_check() operation. Convert the encoder driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch connector DPMS to atomic helpers
Laurent Pinchart [Thu, 5 Mar 2015 20:50:51 +0000 (22:50 +0200)]
drm: omapdrm: Switch connector DPMS to atomic helpers

The atomic connector DPMS helper implements the connector DPMS operation
using atomic commit, removing the need for DPMS helper operations on
CRTCs and encoders.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch mode config to atomic helpers
Laurent Pinchart [Thu, 5 Mar 2015 19:54:54 +0000 (21:54 +0200)]
drm: omapdrm: Switch mode config to atomic helpers

This removes the legacy mode config code. The CRTC and encoder prepare
and commit operations are not used anymore, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Switch plane update to atomic helpers
Laurent Pinchart [Thu, 5 Mar 2015 19:50:00 +0000 (21:50 +0200)]
drm: omapdrm: Switch plane update to atomic helpers

This removes the legacy plane update code. Wire up the default atomic
check and atomic commit mode config helpers as needed by the plane
update atomic helpers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Handle primary plane config through atomic plane ops
Laurent Pinchart [Thu, 5 Mar 2015 11:45:14 +0000 (13:45 +0200)]
drm: omapdrm: Handle primary plane config through atomic plane ops

Use the new CRTC atomic transitional helpers drm_helper_crtc_mode_set()
and drm_helper_crtc_mode_set_base() to implement the CRTC .mode_set and
.mode_set_base operations. This delegates primary plane configuration to
the plane .atomic_update and .atomic_disable operations, removing
duplicate code from the CRTC implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Implement planes atomic operations
Laurent Pinchart [Thu, 5 Mar 2015 11:39:56 +0000 (13:39 +0200)]
drm: omapdrm: Implement planes atomic operations

Implement the CRTC .atomic_begin() and .atomic_flush() operations, the
plane .atomic_check(), .atomic_update() and operations, and use the
transitional atomic helpers to implement the plane update and disable
operations on top of the new atomic operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Wire up atomic state object scaffolding
Laurent Pinchart [Thu, 5 Mar 2015 19:38:16 +0000 (21:38 +0200)]
drm: omapdrm: Wire up atomic state object scaffolding

Hook up the default .reset(), .atomic_duplicate_state() and
.atomic_free_state() helpers to ensure that state objects are properly
created and destroyed, and call drm_mode_config_reset() at init time to
create the initial state objects.

Framebuffer reference count also gets maintained automatically by the
transitional helpers except for the legacy page flip operation. Maintain
it explicitly there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Implement encoder .disable() and .enable() operations
Laurent Pinchart [Fri, 6 Mar 2015 22:22:39 +0000 (00:22 +0200)]
drm: omapdrm: Implement encoder .disable() and .enable() operations

The operations are required by the atomic helpers, implement them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rework CRTC enable/disable for atomic updates
Laurent Pinchart [Thu, 5 Mar 2015 20:13:22 +0000 (22:13 +0200)]
drm: omapdrm: Rework CRTC enable/disable for atomic updates

When using atomic updates the CRTC .enable() and .disable() helper
operations are preferred over the (then legacy) .prepare() and .commit()
operations. Implement .enable() and rework .disable() to not depend on
DPMS, easing DPMS removal later on.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rename CRTC DSS operations with an omap_crtc_dss_ prefix
Laurent Pinchart [Thu, 5 Mar 2015 20:01:02 +0000 (22:01 +0200)]
drm: omapdrm: Rename CRTC DSS operations with an omap_crtc_dss_ prefix

The omap_crtc_enable() and omap_crtc_disable() DSS operations functions
will clash with the new CRTC enable and disable helpers. Rename them to
omap_crtc_dss_*, as well as the other DSS operations for consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Clean up #include's
Laurent Pinchart [Thu, 5 Mar 2015 19:31:37 +0000 (21:31 +0200)]
drm: omapdrm: Clean up #include's

Use the <...> include style instead of "..." for DRM headers and sort
the headers alphabetically to ease detection of duplicates.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Fix page flip race with CRTC disable
Laurent Pinchart [Wed, 4 Mar 2015 16:24:18 +0000 (18:24 +0200)]
drm: omapdrm: Fix page flip race with CRTC disable

We can't rely on crtc->primary->fb in the page flip worker, as a racing
CRTC disable (due for instance to an explicit framebuffer deletion from
userspace) would set that field to NULL before the worker gets a change
to run. Store the framebuffer queued for page flip in a new field of
omap_crtc instead, and hold a reference to it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Turn vblank on/off when enabling/disabling CRTC
Laurent Pinchart [Sun, 25 Jan 2015 20:42:30 +0000 (22:42 +0200)]
drm: omapdrm: Turn vblank on/off when enabling/disabling CRTC

The DRM core vblank handling mechanism requires drivers to forcefully
turn vblank reporting off when disabling the CRTC, and to restore the
vblank reporting status when enabling the CRTC.

Implement this using the drm_crtc_vblank_on/off helpers. When disabling
vblank we must first wait for page flips to complete, so implement page
flip completion wait as well.

Finally, drm_crtc_vblank_off() must be called at startup to synchronize
the state of the vblank core code with the hardware, which is initially
disabled. An interesting side effect is that the .disable_vblank()
operation will now be called for the first time with the CRTC disabled
and the DISPC runtime suspended. The dispc_runtime_get() call in
.disable_vblank() is supposed to take care of that, but the operation is
called with a spinlock held, which prevents it from sleeping.

To fix that move DISPC runtime PM handling out of the vblank operations
to the CRTC code, ensuring that the display controller will always be
powered when enabling or disabling vblank interrupts.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rework page flip handling
Laurent Pinchart [Sun, 25 Jan 2015 20:42:30 +0000 (22:42 +0200)]
drm: omapdrm: Rework page flip handling

To implement proper vblank control the driver will need to wait for page
flip completion before disabling the vblank interrupt. This is made
complex by the page flip implementation which queues and submits page
flips to the hardware in two separate steps between which DRM locks are
released. We thus need to avoid waiting on a page flip that has been
queued but not submitted as submission and wait are covered by the same
lock.

Rework page flip handling as a first step by splitting the flip_pending
boolean variable into an enumerated state and moving between states
based on flip queue, submission and completion. The CANCELLED state will
be used in a second step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Cancel pending page flips when closing device
Laurent Pinchart [Sun, 18 Jan 2015 14:57:36 +0000 (16:57 +0200)]
drm: omapdrm: Cancel pending page flips when closing device

Pending page flips must be cancelled when closing the device, otherwise
their completion at next vblank will result in nasty effects, including
possible oopses due to resources required to complete the page flip
being freed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Simplify IRQ registration
Laurent Pinchart [Sun, 25 Jan 2015 20:06:45 +0000 (22:06 +0200)]
drm: omapdrm: Simplify IRQ registration

The omapdrm can't use drm_irq_install() and drm_irq_uninstall() as it
delegates IRQ handling to the omapdss driver. However, the code still
declares IRQ-related operations used by the DRM IRQ helpers, and calls
them indirectly.

Simplify the implementation by calling the functions directly or
inlining them. The irq_enabled checks can then also be simplified as
the call stacks guarantees that omap_drm_irq_install() and
omap_drm_irq_uninstall() will never run concurrently.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rename omap_crtc page flip-related fields
Laurent Pinchart [Mon, 26 Jan 2015 00:58:51 +0000 (02:58 +0200)]
drm: omapdrm: Rename omap_crtc page flip-related fields

The old_fb field is only used to indicate whether a page flip is
pending. Turn it into a bool named flip_pending. Rename event and
page_flip_work to flip_event and flip_work for consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Rename omap_crtc_page_flip_locked to omap_crtc_page_flip
Laurent Pinchart [Sun, 18 Jan 2015 14:36:19 +0000 (16:36 +0200)]
drm: omapdrm: Rename omap_crtc_page_flip_locked to omap_crtc_page_flip

The operation is called page_flip, rename its implementation
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Apply settings synchronously
Laurent Pinchart [Sat, 17 Jan 2015 17:09:26 +0000 (19:09 +0200)]
drm: omapdrm: Apply settings synchronously

The omapdrm driver implements a mechanism to apply new settings (due to
plane update, plane disable, plane property set, CRTC mode set or CRTC
DPMS) asynchronously. While this improves performance, it adds a level
of complexity that makes transition to the atomic update API close to
impossible. Furthermore the atomic update API requires part of the apply
operations to be synchronous (such as pinning the framebuffers), so the
current implementation needs to be changed.

Simplify the CRTC and plane code by making updates synchronous to
prepare for the switch to the atomic update API. Asynchronous update
will be implemented in a second step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: Store the rotation property in dev->mode_config
Laurent Pinchart [Fri, 6 Mar 2015 15:16:43 +0000 (17:16 +0200)]
drm: omapdrm: Store the rotation property in dev->mode_config

Rotation is a standard property, store it in
dev->mode_config.rotation_property. While at it, extract the properties
initialization code to a separate function instead of running it for
every plane.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agoMerge tag 'drm-intel-next-fixes-2015-06-11' of git://anongit.freedesktop.org/drm...
Dave Airlie [Fri, 12 Jun 2015 00:16:36 +0000 (10:16 +1000)]
Merge tag 'drm-intel-next-fixes-2015-06-11' of git://anongit.freedesktop.org/drm-intel into drm-next

firmware name fix

* tag 'drm-intel-next-fixes-2015-06-11' of git://anongit.freedesktop.org/drm-intel:
  drm/i915/skl: Fix DMC API version in firmware file name

9 years agoMerge tag 'drm-amdkfd-next-fixes-2015-06-10' of git://people.freedesktop.org/~gabbayo...
Dave Airlie [Fri, 12 Jun 2015 00:14:20 +0000 (10:14 +1000)]
Merge tag 'drm-amdkfd-next-fixes-2015-06-10' of git://people.freedesktop.org/~gabbayo/linux into drm-next

- Make the reset wavefronts action be per process per device instead of
  per process, because one device can be stuck but the other one won't be

- Add some missing properties to the CZ device_info structure

- Rename symbols to not have CONFIG_ prefix

- Some more cleanups and debug prints

* tag 'drm-amdkfd-next-fixes-2015-06-10' of git://people.freedesktop.org/~gabbayo/linux:
  drm/amdkfd: remove not used defines from cik_regs.h
  drm/amdkfd: Add missing properties to CZ device info
  drm/amdkfd: make reset wavefronts per process per device
  drm/amdkfd: add debug print to kfd_events.c
  drm/amdkfd: avoid CONFIG_ prefix for non-Kconfig symbols

9 years agoMerge branch '2015-06-08-st-drm-next' of http://git.linaro.org/people/benjamin.gaigna...
Dave Airlie [Fri, 12 Jun 2015 00:14:00 +0000 (10:14 +1000)]
Merge branch '2015-06-08-st-drm-next' of git.linaro.org/people/benjamin.gaignard/kernel into drm-next

Mainly it is fixing timing on HDMI to be compliant with CEA-861E spec.

* '2015-06-08-st-drm-next' of http://git.linaro.org/people/benjamin.gaignard/kernel:
  drm/sti: vtg fix CEA-861E video format timing error
  drm/sti: hdmi fix CEA-861E video format timing error
  drm/sti: VTG interrupt names are badly displayed
  drm/sti: missing first pixel column on HDMI display
  drm/sti: correctly test devm_ioremap() return

9 years agodrm/virtio: remove some dead code
Dan Carpenter [Wed, 10 Jun 2015 19:27:51 +0000 (22:27 +0300)]
drm/virtio: remove some dead code

The goto is correct, and we never reach the return statement so just
delete the dead code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/virtio: checking for NULL instead of IS_ERR
Dan Carpenter [Wed, 10 Jun 2015 19:27:11 +0000 (22:27 +0300)]
drm/virtio: checking for NULL instead of IS_ERR

virtio_gpu_alloc_object() returns an error pointer, it never returns
NULL.

Fixes: dc5698e80cf7 ('Add virtio gpu driver.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoMerge branch 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Thu, 11 Jun 2015 03:04:07 +0000 (13:04 +1000)]
Merge branch 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux into drm-next

More fixes for amdgpu for 4.2.  We've integrated Jerome's comments
about the interface among other things.  I'll be on vacation next week
so Christian will be handling any updates next week.

* 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux: (23 commits)
  drm/amdgpu: fix a amdgpu_dpm=0 bug
  drm/amdgpu: don't enable/disable display twice on suspend/resume
  drm/amdgpu: fix UVD/VCE VM emulation
  drm/amdgpu: enable vce powergating
  drm/amdgpu/iceland: don't call smu_init on resume
  drm/amdgpu/tonga: don't call smu_init on resume
  drm/amdgpu/cz: don't call smu_init on resume
  drm/amdgpu: update to latest gfx8 golden register settings
  drm/amdgpu: whitespace cleanup in gmc8 golden regs
  drm/admgpu: move XDMA golden registers to dce code
  drm/amdgpu: fix the build on big endian
  drm/amdgpu: cleanup UAPI comments
  drm/amdgpu: remove AMDGPU_CTX_OP_STATE_RUNNING
  drm/amdgpu: remove the VI hardware semaphore in ring sync
  drm/amdgpu: set the gfx config properly for all CZ variants (v2)
  drm/amdgpu: also print the pci revision when printing the pci ids
  drm/amdgpu: cleanup VA IOCTL
  drm/amdgpu: fix saddr handling in amdgpu_vm_bo_unmap
  drm/amdgpu: fix amdgpu_vm_bo_map
  drm/amdgpu: remove unused AMDGPU_IB_FLAG_GDS
  ...

9 years agodrm/amdgpu: fix a amdgpu_dpm=0 bug
Sonny Jiang [Wed, 10 Jun 2015 17:46:36 +0000 (13:46 -0400)]
drm/amdgpu: fix a amdgpu_dpm=0 bug

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: don't enable/disable display twice on suspend/resume
Alex Deucher [Wed, 10 Jun 2015 15:52:00 +0000 (11:52 -0400)]
drm/amdgpu: don't enable/disable display twice on suspend/resume

We were doing it in the common code and in the IP specific code.
Remove the IP specific code.  The common code handles the
ordering properly.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix UVD/VCE VM emulation
Christian König [Wed, 10 Jun 2015 15:20:11 +0000 (17:20 +0200)]
drm/amdgpu: fix UVD/VCE VM emulation

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: enable vce powergating
Sonny Jiang [Thu, 28 May 2015 19:47:53 +0000 (15:47 -0400)]
drm/amdgpu: enable vce powergating

Enable VCE dpm and powergating. VCE dpm dynamically scales the VCE clocks on
demand.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu/iceland: don't call smu_init on resume
Alex Deucher [Tue, 9 Jun 2015 21:46:30 +0000 (17:46 -0400)]
drm/amdgpu/iceland: don't call smu_init on resume

smu_init allocates buffers and initializes them.  It does not
touch the hw.  There is no need to do it again on resume.  It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu/tonga: don't call smu_init on resume
Alex Deucher [Tue, 9 Jun 2015 21:42:10 +0000 (17:42 -0400)]
drm/amdgpu/tonga: don't call smu_init on resume

smu_init allocates buffers and initializes them.  It does not
touch the hw.  There is no need to do it again on resume.  It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu/cz: don't call smu_init on resume
Alex Deucher [Tue, 9 Jun 2015 21:32:53 +0000 (17:32 -0400)]
drm/amdgpu/cz: don't call smu_init on resume

smu_init allocates buffers and initializes them.  It does not
touch the hw.  There is no need to do it again on resume.  It
should really be part of sw_init (and smu_fini should be part
of sw_fini), but we need the firmware sizes from the other IPs
for firmware loading so we have to wait until sw init is done
for all other IPs.

Reviewed-by: Sonny Jiang <Sonny.Jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: update to latest gfx8 golden register settings
Alex Deucher [Tue, 9 Jun 2015 18:33:03 +0000 (14:33 -0400)]
drm/amdgpu: update to latest gfx8 golden register settings

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: whitespace cleanup in gmc8 golden regs
Alex Deucher [Tue, 9 Jun 2015 18:06:18 +0000 (14:06 -0400)]
drm/amdgpu: whitespace cleanup in gmc8 golden regs

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/admgpu: move XDMA golden registers to dce code
Alex Deucher [Tue, 9 Jun 2015 17:51:25 +0000 (13:51 -0400)]
drm/admgpu: move XDMA golden registers to dce code

Already moved other display registers.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix the build on big endian
Alex Deucher [Tue, 9 Jun 2015 13:58:23 +0000 (09:58 -0400)]
drm/amdgpu: fix the build on big endian

Some leftover copy and pastes from radeon that never
got updated.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: cleanup UAPI comments
Christian König [Tue, 9 Jun 2015 13:54:37 +0000 (15:54 +0200)]
drm/amdgpu: cleanup UAPI comments

No functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: remove AMDGPU_CTX_OP_STATE_RUNNING
Christian König [Tue, 9 Jun 2015 13:21:35 +0000 (15:21 +0200)]
drm/amdgpu: remove AMDGPU_CTX_OP_STATE_RUNNING

Not used.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: remove the VI hardware semaphore in ring sync
David Zhang [Wed, 10 Jun 2015 18:28:56 +0000 (02:28 +0800)]
drm/amdgpu: remove the VI hardware semaphore in ring sync

Signed-off-by: David Zhang <david1.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: set the gfx config properly for all CZ variants (v2)
Alex Deucher [Fri, 5 Jun 2015 18:34:19 +0000 (14:34 -0400)]
drm/amdgpu: set the gfx config properly for all CZ variants (v2)

Need to adjust the number of CUs and RBs.

v2: get proper values

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Samuel Li <samuel.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: also print the pci revision when printing the pci ids
Alex Deucher [Fri, 5 Jun 2015 19:04:33 +0000 (15:04 -0400)]
drm/amdgpu: also print the pci revision when printing the pci ids

The driver makes use of this information so print if to aid in
debugging.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Samuel Li <samuel.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: cleanup VA IOCTL
Christian König [Mon, 8 Jun 2015 13:03:00 +0000 (15:03 +0200)]
drm/amdgpu: cleanup VA IOCTL

Remove the unnecessary returned status and make the IOCTL write only.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix saddr handling in amdgpu_vm_bo_unmap
Christian König [Fri, 5 Jun 2015 18:56:17 +0000 (20:56 +0200)]
drm/amdgpu: fix saddr handling in amdgpu_vm_bo_unmap

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix amdgpu_vm_bo_map
Christian König [Fri, 5 Jun 2015 08:06:04 +0000 (10:06 +0200)]
drm/amdgpu: fix amdgpu_vm_bo_map

We need to reset the bo_va address, otherwise new mappings
wouldn't be updated in the page table.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/sti: vtg fix CEA-861E video format timing error
Vincent Abriou [Thu, 4 Jun 2015 11:59:02 +0000 (13:59 +0200)]
drm/sti: vtg fix CEA-861E video format timing error

HDMI analyzer tests showed that Vsync and Hsync signal were not
compliant with the HDMI protocol.

HDMI_DELAY should be taken into account in the VTG Vsync
programming to reflect the 6 pixels shift introduced in the VTG
Hsync programming.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
9 years agodrm/sti: hdmi fix CEA-861E video format timing error
Vincent Abriou [Fri, 5 Jun 2015 08:24:43 +0000 (10:24 +0200)]
drm/sti: hdmi fix CEA-861E video format timing error

HDMI analyzer tests showed that Vsync and Hsync signal were not
compliant with the HDMI protocol.

The first active pixel of a line is defined by HDMI_ACTIVE_VID_XMIN.
The last active pixel of a line is defined by HDMI_ACTIVE_VID_XMAX.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
9 years agodrm/sti: VTG interrupt names are badly displayed
Vincent Abriou [Thu, 4 Jun 2015 08:42:22 +0000 (10:42 +0200)]
drm/sti: VTG interrupt names are badly displayed

VTG interrupt names are badly displayed using "cat /proc/interrupts".
Simply use the VTG device name while registering the VTG interrupts
to fix it.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
9 years agodrm/sti: missing first pixel column on HDMI display
Vincent Abriou [Fri, 5 Jun 2015 09:47:49 +0000 (11:47 +0200)]
drm/sti: missing first pixel column on HDMI display

VTG programing updated to fix the shift of one column observed
on HDMI display.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
9 years agodrm/sti: correctly test devm_ioremap() return
Wei Yongjun [Mon, 8 Jun 2015 13:25:52 +0000 (15:25 +0200)]
drm/sti: correctly test devm_ioremap() return

In case of error, the function devm_ioremap_nocache() returns NULL
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
9 years agodrm/amdkfd: remove not used defines from cik_regs.h
Oded Gabbay [Sat, 6 Jun 2015 19:17:44 +0000 (22:17 +0300)]
drm/amdkfd: remove not used defines from cik_regs.h

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
9 years agodrm/amdkfd: Add missing properties to CZ device info
Oded Gabbay [Sat, 6 Jun 2015 18:45:43 +0000 (21:45 +0300)]
drm/amdkfd: Add missing properties to CZ device info

This patch adds two missing properties initializations to the device
info structure of CZ.

As we don't have CZ support yet, it isn't critical, but its important to
fix this now instead of forgetting about it later.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
9 years agodrm/amdkfd: make reset wavefronts per process per device
Ben Goz [Wed, 25 Mar 2015 11:12:20 +0000 (13:12 +0200)]
drm/amdkfd: make reset wavefronts per process per device

This commit moves the reset wavefront flag to per process per device
data structure, so we can support multiple devices.

Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
9 years agodrm/amdkfd: add debug print to kfd_events.c
Oded Gabbay [Thu, 30 Apr 2015 15:05:36 +0000 (18:05 +0300)]
drm/amdkfd: add debug print to kfd_events.c

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
9 years agodrm/amdkfd: avoid CONFIG_ prefix for non-Kconfig symbols
Valentin Rothberg [Fri, 5 Jun 2015 08:27:43 +0000 (10:27 +0200)]
drm/amdkfd: avoid CONFIG_ prefix for non-Kconfig symbols

The CONFIG_ prefix is reserved for Kconfig options in Make and CPP
syntax.  Various static analysis tools rely on this naming convention
and check if CONFIG_ prefixed symbols are defined Kconfig.  Hence add
yet another prefix AMD_ to CONFIG_REG_{BASE,END,SISE} to apply to this
convention and make static analysis tools happy.

Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
9 years agodrm/amdgpu: remove unused AMDGPU_IB_FLAG_GDS
Jammy Zhou [Fri, 5 Jun 2015 20:49:22 +0000 (04:49 +0800)]
drm/amdgpu: remove unused AMDGPU_IB_FLAG_GDS

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: disable user fence interrupt (v2)
Chunming Zhou [Mon, 1 Jun 2015 06:35:03 +0000 (14:35 +0800)]
drm/amdgpu: disable user fence interrupt (v2)

amdgpu submits both kernel and user fences, but just need one interrupt,
disable user fence interrupt and don't effect user fence.

v2: fix merge error

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/amdgpu: fix user ptr race condition
Christian König [Wed, 3 Jun 2015 19:31:20 +0000 (21:31 +0200)]
drm/amdgpu: fix user ptr race condition

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: monk liu <monk.liu@amd.com>
9 years agodrm/amdgpu: add zero timeout check in amdgpu_fence_wait_seq_timeout
Jack Xiao [Thu, 4 Jun 2015 04:18:27 +0000 (12:18 +0800)]
drm/amdgpu: add zero timeout check in amdgpu_fence_wait_seq_timeout

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/i915/skl: Fix DMC API version in firmware file name
Rodrigo Vivi [Wed, 3 Jun 2015 23:50:19 +0000 (16:50 -0700)]
drm/i915/skl: Fix DMC API version in firmware file name

04 is the minor version. API version is ver1.
So let's follow same scheme used on published version at 01.org.

If really needed the minor version a follow-up updated will be
done. But for now we need to move fwd and unblock end users.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
9 years agovirtgpu: include linux/types.h to avoid warning.
Dave Airlie [Fri, 5 Jun 2015 02:31:12 +0000 (12:31 +1000)]
virtgpu: include linux/types.h to avoid warning.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoMerge branch 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux into...
Dave Airlie [Fri, 5 Jun 2015 01:14:18 +0000 (11:14 +1000)]
Merge branch 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux into drm-next

This is the big pull request for amdgpu, the new driver for VI+ AMD
asics.  I currently supports Tonga, Iceland, and Carrizo and also
contains a Kconfig option to build support for CI parts for testing.

All major functionality is supported (displays, gfx, compute, dma,
video decode/encode, etc.).  Power management is working on Carrizo,
but is still being worked on for Tonga and Iceland.

* 'drm-next-4.2-amdgpu' of git://people.freedesktop.org/~agd5f/linux: (106 commits)
  drm/amdgpu: only support IBs in the buffer list (v2)
  drm/amdgpu: add vram_type and vram_bit_width for interface query (v2)
  drm/amdgpu: add ib_size/start_alignment interface query
  drm/amdgpu: add me/ce/pfp_feature_version interface query
  drm/amdgpu add ce_ram_size for interface query
  drm/amdgpu add max_memory_clock for interface query (v2)
  drm/amdgpu: add hdp flush for gfx8 compute ring
  drm/amdgpu: fix no hdp flush for compute ring
  drm/amdgpu: add HEVC/H.265 UVD support
  drm/amdgpu: stop loading firmware with pm.mutex locked
  drm/amdgpu: remove mclk_lock
  drm/amdgpu: fix description of vm_size module parameter (v2)
  drm/amdgpu: remove all sh mem register modification in vm flush
  drm/amdgpu: rename GEM_OP_SET_INITIAL_DOMAIN -> GEM_OP_SET_PLACEMENT
  drm/amdgpu: fence should be added to shared slot
  drm/amdgpu: sync fence of clear_invalids (v2)
  drm/amdgpu: max_pde_used usage should be under protect
  drm/amdgpu: fix bug of vm_bo_map (v2)
  drm/amdgpu: implement the allocation range (v3)
  drm/amdgpu: rename amdgpu_ip_funcs to amd_ip_funcs (v2)
  ...

9 years agodrm/qxl: Propagate correctly errors from qxlhw_handle_to_bo
Frediano Ziglio [Wed, 3 Jun 2015 11:09:19 +0000 (12:09 +0100)]
drm/qxl: Propagate correctly errors from qxlhw_handle_to_bo

This function could return a NULL pointer in case of handle not
present and in case of out of memory conditions however caller
function always returned EINVAL error hiding a possible ENOMEM.
This patch change the function to return the error instead to
be able to propagate the error instead of assuming EINVAL.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Simplify cleaning qxl processing command
Frediano Ziglio [Wed, 3 Jun 2015 11:09:18 +0000 (12:09 +0100)]
drm/qxl: Simplify cleaning qxl processing command

In qxlhw_handle_to_bo we incremented counters twice, one time for release object
and one for reloc_info.
In the main function however reloc_info references was drop much earlier than
release so keeping the pointer only on release is safe and make cleaning
process easier.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Move main reference counter to GEM object instead of TTM ones
Frediano Ziglio [Wed, 3 Jun 2015 11:09:17 +0000 (12:09 +0100)]
drm/qxl: Move main reference counter to GEM object instead of TTM ones

qxl_bo structure has two reference counters, one in the GEM object and
another in the TTM object. The GEM object keep a counter to the TTM object
so when GEM counter reached zero the TTM counter (using qxl_bo_unref) was
decremented. The qxl object is fully freed (both GEM and TTM part are cleaned)
when the TTM counter reach zero.
One issue was that surface idr structure has no owning on qxl_bo objects however
it contains a pointer to qxl_bo object. This caused some nasty race condition
for instance qxl_bo object was reaped even after counter was already zero.
This patch fix these races moving main counter (the one used by qxl_bo_(un)ref)
to GEM object which cleanup routine (qxl_gem_object_free) remove the idr pointer
(using qxl_surface_evict) when the counters are still valid.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Remove format string errors
Frediano Ziglio [Wed, 3 Jun 2015 11:09:16 +0000 (12:09 +0100)]
drm/qxl: Remove format string errors

Enable format string checks for qxl_io_log and remove resulting warnings
which could lead to memory errors on different platform or just printing
wrong information.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Handle correctly failures in qxl_alloc_relase_reserved
Frediano Ziglio [Wed, 3 Jun 2015 11:09:15 +0000 (12:09 +0100)]
drm/qxl: Handle correctly failures in qxl_alloc_relase_reserved

Free resources correctly if function fails

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Fix return for qxl_release_alloc
Frediano Ziglio [Wed, 3 Jun 2015 11:09:14 +0000 (12:09 +0100)]
drm/qxl: Fix return for qxl_release_alloc

This function return handle to allocated release object which is an int.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Handle all errors in qxl_surface_evict
Frediano Ziglio [Wed, 3 Jun 2015 11:09:13 +0000 (12:09 +0100)]
drm/qxl: Handle all errors in qxl_surface_evict

Only EBUSY error was handled. This could cause code to believe
reserve was successful while it failed.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Avoid double free on error
Frediano Ziglio [Wed, 3 Jun 2015 11:09:12 +0000 (12:09 +0100)]
drm/qxl: Avoid double free on error

Is we are not able to get source bo object from handle we free
destination bo object and call cleanup code however destination
object was already inserted in reloc_info array (num_relocs was
already incremented) so on cleanup we free destination again.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Fix print statement not using uninitialized variable
Frediano Ziglio [Wed, 3 Jun 2015 11:09:11 +0000 (12:09 +0100)]
drm/qxl: Fix print statement not using uninitialized variable

reloc_info[i] is not still initialized in the print statement.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Do not leak memory if qxl_release_list_add fails
Frediano Ziglio [Wed, 3 Jun 2015 11:09:10 +0000 (12:09 +0100)]
drm/qxl: Do not leak memory if qxl_release_list_add fails

If the function fails reference counter to the object is not decremented
causing leaks.
This is hard to spot as it happens only on very low memory situations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/qxl: Do not cause spice-server to clean our objects
Frediano Ziglio [Wed, 3 Jun 2015 11:09:09 +0000 (12:09 +0100)]
drm/qxl: Do not cause spice-server to clean our objects

If objects are moved back from system memory to VRAM (and spice id
created again) memory is already initialized so we need to set flag
to not clear memory.
If you don't do it after a while using desktop many images turns to
black or transparents.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodrm/amdgpu: only support IBs in the buffer list (v2)
Marek Olšák [Tue, 2 Jun 2015 15:44:49 +0000 (17:44 +0200)]
drm/amdgpu: only support IBs in the buffer list (v2)

amdgpu_cs_find_mapping doesn't work without all buffers being validated,
so the TTM validation must be done first.

v2: only use amdgpu_cs_find_mapping for UVD/VCE VM emulation

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agodrm/amdgpu: add vram_type and vram_bit_width for interface query (v2)
Ken Wang [Wed, 3 Jun 2015 13:02:01 +0000 (21:02 +0800)]
drm/amdgpu: add vram_type and vram_bit_width for interface query (v2)

Track the type of vram on the board and provide a query for it.
User mode drivers and tools want this information for determining
bandwidth information and form informational purposes.

v2: fix build when CI support is not enabled

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add ib_size/start_alignment interface query
Ken Wang [Thu, 4 Jun 2015 13:26:57 +0000 (21:26 +0800)]
drm/amdgpu: add ib_size/start_alignment interface query

Query the IB alignment requirements from the kernel rather
than hardcoding them in the user mode drivers.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add me/ce/pfp_feature_version interface query
Ken Wang [Wed, 3 Jun 2015 11:52:06 +0000 (19:52 +0800)]
drm/amdgpu: add me/ce/pfp_feature_version interface query

Provide this information to usermode drivers.  We were previously
missing this info.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu add ce_ram_size for interface query
Ken Wang [Wed, 3 Jun 2015 09:47:54 +0000 (17:47 +0800)]
drm/amdgpu add ce_ram_size for interface query

Add a query for the CE ram size.  User mode drivers
will want to use this to determine how much size
of the cache on the CE.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewd-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu add max_memory_clock for interface query (v2)
Ken Wang [Wed, 3 Jun 2015 09:36:54 +0000 (17:36 +0800)]
drm/amdgpu add max_memory_clock for interface query (v2)

Add a query for the max memory clock.

v2: handle the dpm enabled case properly

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewd-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agodrm/amdgpu: add hdp flush for gfx8 compute ring
monk.liu [Wed, 3 Jun 2015 08:32:49 +0000 (16:32 +0800)]
drm/amdgpu: add hdp flush for gfx8 compute ring

We had forgotten to register the callback.

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: jammy zhou <jammy.zhou@amd.com>