kernel/kernel-mfld-blackbay.git
12 years agogfx: pvr: cmd trace: rename flip request syncobj names
Imre Deak [Wed, 1 Feb 2012 15:30:41 +0000 (17:30 +0200)]
gfx: pvr: cmd trace: rename flip request syncobj names

The flip request command has an old and a new buffer (and the
corresponding sync objects) as a parameter. Rename the relevant
entries in the trace output to make this clearer.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: check the size of SGX_READ_HWPERF IOCTL parameters
Imre Deak [Fri, 27 Jan 2012 16:27:32 +0000 (18:27 +0200)]
gfx: pvr: check the size of SGX_READ_HWPERF IOCTL parameters

We need to add a separate size check for this IOCTL's parameters, since
they are passed by a pointer in the IOCTL's input structure. We do check
the size for all IOCTL's input structure already, but we need to cover
such derefenced objects separately.

Increase the driver's minor version too. This will still let the current
user space libraries work, except for this IOCTL, which was broken
before anyway. A related user space library fix will be submitted to
make the IOCTL work.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Tested-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: fix SGX_READ_HWPERF IOCTL according to v1.7 ABI
Imre Deak [Fri, 27 Jan 2012 16:27:31 +0000 (18:27 +0200)]
gfx: pvr: fix SGX_READ_HWPERF IOCTL according to v1.7 ABI

There has been a change in the parameters for this IOCTL in v1.7 of the
driver. While the userspace library was updated accordingly we didn't do
this on the kernel side. We missed the difference since the size of the
structure wasn't checked against the user space version. The next patch
will add this check to avoid similar problems in the future.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Tested-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopvr_debugfs: Fix inline function declaration
Andrew Boie [Thu, 2 Feb 2012 00:30:52 +0000 (16:30 -0800)]
pvr_debugfs: Fix inline function declaration

This fixes a compilation error if CONFIG_DEBUG_FS isn't enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Add support for CABC
Antti Koskipaa [Tue, 31 Jan 2012 15:12:39 +0000 (17:12 +0200)]
gfx: drv: Add support for CABC

CABC (Content Adaptive Backlight Control) is a power saving technique
that is supported by the mfld tablet LCD panel.

Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Fix panel poweron sleep value
Antti Koskipaa [Tue, 31 Jan 2012 15:12:38 +0000 (17:12 +0200)]
gfx: drv: Fix panel poweron sleep value

Panel spec says t1+t2+t5 = 260 ms. It's more complicated than that
but the driver is not flexible enough to handle all the cases. This
should be good enough, and is the absolute minimum.

Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Move stuff around
Antti Koskipaa [Tue, 31 Jan 2012 15:12:37 +0000 (17:12 +0200)]
gfx: drv: Move stuff around

Move a function to where it belongs so that panel register definitions
need not to be declared globally.

Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Add register definitions for Chimei Innolux panel
Antti Koskipaa [Tue, 31 Jan 2012 15:12:36 +0000 (17:12 +0200)]
gfx: drv: Add register definitions for Chimei Innolux panel

Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoFix intermittent hotplug lost issue because of page flip.
Hu Tiger Chen [Mon, 30 Jan 2012 22:17:20 +0000 (00:17 +0200)]
Fix intermittent hotplug lost issue because of page flip.

Since the DRM page flip mechanism keeps updatign the crtc->fb member
with the current fb to be flipped, this gets out-of-sync with the
psb_fb_helper->fb member. In the event of a HDMI hotplug, this mismatch
causes the HDMI hotplug event to be deferred and never handled. Ensure
that we are keeping both the members in sync always during flip.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agomode management changes between local and external display.
Sanjay Rama Reddy [Mon, 30 Jan 2012 22:17:19 +0000 (00:17 +0200)]
mode management changes between local and external display.

- Defining our policy of setting the FB and surface dimensions
  of frame buffer equal to local display dimensions and choosing
  panel fitting for external display when needed. This is required since
  Medfield hardware supports panel fitting only for HDMI pipe.
- Also, remove the modes selection limitations at drm during hdmi hotplug.
  During drm_fb_helper_hotplug_event, the max_width and max_height are
  reseted to the size of available framebuffer (which is equal to local
  display), and thus removes all the hdmi modes that are greater than this
  limit thus not allowing modes like 1080P to get selected for HDMI.
  Hence changed the reset logic.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoEnable suspend/resume support for HDMI.
Hu Tiger Chen [Mon, 30 Jan 2012 22:17:18 +0000 (00:17 +0200)]
Enable suspend/resume support for HDMI.

Enable the suspend/resume hooks for OTM HDMI.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoMUST_REVERT: Avoid calling mode set for MIPI during HDMI hotplug.
Hu Tiger Chen [Mon, 30 Jan 2012 22:17:17 +0000 (00:17 +0200)]
MUST_REVERT: Avoid calling mode set for MIPI during HDMI hotplug.

Currently, during HDMI hotplug/unplug, the MIPI mode set is invoked along
with HDMI mode set. The MIPI mode set during HDMI hotplug causes the system to hang
due to an i2c transaction failure for MIPI. Till the local display issue is fixed, we
avoid calling the MIPI mode set on every HDMI hotplug event.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoEnable hotplug kernel handler.
Hu Tiger Chen [Mon, 30 Jan 2012 22:17:16 +0000 (00:17 +0200)]
Enable hotplug kernel handler.

Enable the OTM HDMI hotplug handler for handling HDMI
connection/disconnection events.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoEnable the OTM HDMI driver on ICS.
Hu Tiger Chen [Mon, 30 Jan 2012 22:17:15 +0000 (00:17 +0200)]
Enable the OTM HDMI driver on ICS.

Enable the OTM HDMI driver to be called from display driver and remove
older HDMI related code.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoAddition of the OTM HDMI driver for Medfield.
Arun Kannan [Mon, 30 Jan 2012 22:17:14 +0000 (00:17 +0200)]
Addition of the OTM HDMI driver for Medfield.

This is a modular, reusable driver for HDMI used across platforms.
This driver has already achieved HDMI certification on the Greenridge platform,
and was also reused on the Medfield honeycomb stack.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoimgv: Fix video bind page management
Pauli Nieminen [Mon, 30 Jan 2012 17:17:27 +0000 (19:17 +0200)]
imgv: Fix video bind page management

Shared pages has to be reference count and free by kernel if userspace
fails to free them.

To have bind ioctl manage memory correctly use existing fiex pages
infrastructure to bind and unbind pages. Fixed pages already include ttm
backed functions to free pages correctly when application process
terminates.

Based on Robin Mathew's "Fix TTM Leaking on SIGKILL" patch.

Issue: Android-926
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Acked-by: Imre Deak <imre.deak@intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopvr: increase source sync object limit
Haitao Huang [Fri, 20 Jan 2012 12:51:10 +0000 (06:51 -0600)]
pvr: increase source sync object limit

Issue: ANDROID-372
Signed-off-by: Haitao Huang <haitao.huang@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: do not spam tc35876x_brightness_control notifications.
Oliver McFadden [Tue, 24 Jan 2012 05:27:00 +0000 (07:27 +0200)]
gfx: display: do not spam tc35876x_brightness_control notifications.

These are very annoying and often get in the way when trying to read a
backtrace. If you really need them, you may turn on PSB debugging.

Signed-off-by: Oliver McFadden <oliver.mcfadden@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoMake psb driver interface files not world writable
ken lierman [Fri, 20 Jan 2012 20:20:06 +0000 (12:20 -0800)]
Make psb driver interface files not world writable

Androids CTS test doesn't allow there to be world writable /sys files.

Signed-off-by: ken lierman <ken.lierman@windriver.com>
Signed-off-by: Kwanhong Lee <kwanhong.lee@windriver.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoHACK: gfx: drv: when resuming make sure power is on
Pauli Nieminen [Fri, 20 Jan 2012 12:59:36 +0000 (14:59 +0200)]
HACK: gfx: drv: when resuming make sure power is on

The PVR driver expects ospm_power_using_hw_begin to return only when
power is already on. But at the moment that function will only call
pm_runtime_get which is asynchronous. This can lead to the PVR driver
accessing its HW registers before the HW is powered and cause a CPU
fabric error hung.

To work around this call the sync version of pm_runtime_get if we are
not in atomic context. In fact I can't see any reason to call it
atomically, since then power on can't be guaranteed on return anyway.
But to clean up that we should check all call-sites for correctness.

Jani Nikula is currently reworking ospm_power_using_hw_begin() and
related parts that will give us a clean solution. Until that's done we'd
like this hack applied to let us resolve other PM related issues that
are currently hidden by this bug.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: optimize clearing sync counter trace info struct
Imre Deak [Wed, 11 Jan 2012 14:07:49 +0000 (16:07 +0200)]
gfx: pvr: optimize clearing sync counter trace info struct

Clearing this struct is necessary to suppress tracing for a given sync
counter. But for this we don't need to bzero the whole sync counter info
struct it's enough to set the address to zero.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Tested-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: fix corrupted command trace for SGX transfer command
Imre Deak [Wed, 11 Jan 2012 14:07:48 +0000 (16:07 +0200)]
gfx: pvr: fix corrupted command trace for SGX transfer command

When the transfer command is called with the SGXMKIF_TQFLAGS_KEEPPENDING
source and destination sync counters were not zeroed in the
corresponding trace record, leading to a corrupted trace output.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Tested-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Add trace events for powermanagement
Pauli Nieminen [Wed, 11 Jan 2012 15:06:54 +0000 (17:06 +0200)]
gfx: drv: Add trace events for powermanagement

SGX may lockup because of incorrectly timed or missing power state
trasition for SGX or display controller.

To make future debugging simpler for these cases add command trace
entries for realeted power management changes.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Add command trace points to flip
Pauli Nieminen [Wed, 11 Jan 2012 15:06:53 +0000 (17:06 +0200)]
gfx: drv: Add command trace points to flip

To make easier to debug SGX lockups with page flip code we need command
trace to have page flip events. There already exists API to add trace
events for flip chain. We can use same API for drm mode page flips.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: overlay: Set CC_OUT bit in OCONFIG
Ville Syrjälä [Wed, 11 Jan 2012 16:27:15 +0000 (18:27 +0200)]
gfx: drv: overlay: Set CC_OUT bit in OCONFIG

Unfortunately the docs aren't exactly clear on when the bit should be set.
However all user space solutions I've seen set the bit, so let's follow suit.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: overlay: More thorough fix for SWIDTHSW issues
Ville Syrjälä [Wed, 11 Jan 2012 16:27:14 +0000 (18:27 +0200)]
gfx: drv: overlay: More thorough fix for SWIDTHSW issues

The current code can still misprogram SWIDTHSW if fb->offsets[] is
suitably misaligned. Simply limit SWIDTHSW to 2k pixels in such cases.

Change the SWIDTHSW alignment code to be more readable, and align the
width to 32 bytes (SWORD), instead of 64 bytes.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoMUST_REVERT: drm: psb: Added gralloc buffer support for video
Naeem M. Afzal [Wed, 11 Jan 2012 19:53:50 +0000 (11:53 -0800)]
MUST_REVERT: drm: psb: Added gralloc buffer support for video

Gralloc buffers are created and bound to
TTM buffers independent of the BCD module.

This patch has received many change requests from Pauli and Jani.
Jani Nacked it. However, Sean believes the requests are not critical.
Pierre said that we have to take this patch because it is urgent,
and improve it later. This is why it is marked as MUST_REVERT. Sean is
supposed to send the new version which should be taken instead of this
one, and this commit message should be removed.

Signed-off-by: Naeem M Afzal <naeem.m.afzal@intel.com>
Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com>
12 years agoMUST_REVERT: gfx: drm: explicitly authenticate for Android
Sean V. Kelley [Wed, 11 Jan 2012 19:53:49 +0000 (11:53 -0800)]
MUST_REVERT: gfx: drm: explicitly authenticate for Android

Added as an interim measure to proper client authentication using
DRM_AUTH IOCTLs in user space.  Applied to drm_fops.c:drm_open_helper
where there is already a similar hack.  Shall be removed upon
userspace implementaiton.

Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com>
12 years agogfx: drv: overlay: Fix NV12 chroma SWIDTHSW
Ville Syrjälä [Fri, 6 Jan 2012 04:17:40 +0000 (06:17 +0200)]
gfx: drv: overlay: Fix NV12 chroma SWIDTHSW

NV12 chroma SWIDTHSW must be calculated in a somewhat bizarre way.

Also fix an off-by-one error for other pixel formats.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: remove the outdated README
Jani Nikula [Thu, 5 Jan 2012 13:35:45 +0000 (15:35 +0200)]
gfx: remove the outdated README

The README is outdated, and this information is better shared outside of
the kernel tree anyway.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove unused uopt (user options)
Jani Nikula [Thu, 5 Jan 2012 13:35:44 +0000 (15:35 +0200)]
gfx: display: remove unused uopt (user options)

Remove unused code for uopt, user options.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: remove unused code in intel-linux directories
Jani Nikula [Thu, 5 Jan 2012 13:35:43 +0000 (15:35 +0200)]
gfx: pvr: remove unused code in intel-linux directories

The directories pvr/services4/{include,srvkm}/env/linux-intel are not used
for anything. Remove.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoRevert "drm: Protect drm/drm_os_linux.h inclusion with #ifdef"
Jani Nikula [Thu, 5 Jan 2012 13:35:42 +0000 (15:35 +0200)]
Revert "drm: Protect drm/drm_os_linux.h inclusion with #ifdef"

This reverts commit "drm: Protect drm/drm_os_linux.h inclusion with #ifdef"
to minimize gfx related diff outside drivers/staging/mrst. The header file
<drm/drm_os_linux.h> is not supposed to be included directly anyway.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: remove redundant #include <drm/drm_os_linux.h>
Jani Nikula [Thu, 5 Jan 2012 13:35:41 +0000 (15:35 +0200)]
gfx: imgv: remove redundant #include <drm/drm_os_linux.h>

The header file <drm/drm_os_linux.h> is not supposed to be included
directly, it does not have #ifdef protection for multiple inclusion, and
it's included through <drm/drmP.h> anyway. Remove the #include.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: remove obsolete .gitignore
Jani Nikula [Thu, 5 Jan 2012 13:35:40 +0000 (15:35 +0200)]
gfx: remove obsolete .gitignore

The .gitignore is no longer relevant with Medfield only build.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: make tc35876x independent of tmd vid driver
Jani Nikula [Thu, 5 Jan 2012 13:35:39 +0000 (15:35 +0200)]
gfx: display: make tc35876x independent of tmd vid driver

The TC35876X driver used to be bolted on the TMD panel driver with some
ifs. Make it a more independent driver instead.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove redundant dpi_panel_on setting
Jani Nikula [Thu, 5 Jan 2012 13:35:38 +0000 (15:35 +0200)]
gfx: display: remove redundant dpi_panel_on setting

dpi_panel_on is false at init time, no need to set it again.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopvr: unifdef pvr power management code for improved readability
Jani Nikula [Thu, 5 Jan 2012 13:35:37 +0000 (15:35 +0200)]
pvr: unifdef pvr power management code for improved readability

The PVR power management code is difficult to read due to excess #ifdef 1
and #ifdef 0. Remove them.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: allow powering down GL3 cache regardless of GL3 config
Jani Nikula [Thu, 5 Jan 2012 13:35:36 +0000 (15:35 +0200)]
gfx: display: allow powering down GL3 cache regardless of GL3 config

The commit "psb_video: remove OSPM_GL3_CACHE_ISLAND when not enabled" made
it impossible to power down the GL3 cache island when
CONFIG_MDFD_GL3=n. It's powered on at boot (likely by firmware) so allow
powering down regardless of config.

This fixes the following situation in /sys/kernel/debug/mid_pmu_states when
display is off:

pci 8086 0130 0000:00:02.0             pvrsrvkm:
                      |------->             GFX                   D0i3
                      |------->   Video Decoder                   D0i3
                      |------->   Video Encoder                   D0i3
                      |------->       GL3 Cache                   D0
                      |------->       Display A                   D0i3
                      |------->       Display B                   D0i3
                      |------->       Display C                   D0i3
                      |------->        MIPI-DSI                   D0i3

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove another redundant panel state variable gbdispstatus
Jani Nikula [Thu, 5 Jan 2012 13:35:35 +0000 (15:35 +0200)]
gfx: display: remove another redundant panel state variable gbdispstatus

The dev_priv->dpi_panel_on{,2} fields already track panel state. Use those
instead of gbdispstatus.

The old implementation could not have worked any better for DBI panels than
this one, but leave a comment to revisit this.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: refactor psb_runtime_{idle,suspend}
Jani Nikula [Thu, 5 Jan 2012 13:35:34 +0000 (15:35 +0200)]
gfx: display: refactor psb_runtime_{idle,suspend}

Reuse psb_runtime_idle for checking whether runtime suspend is possible in
psb_runtime_suspend, making the conditions the same for both. Do HDMI audio
suspend in suspend, not idle.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: tc35876x: remove redundant switching of dpi_panel_on state
Jani Nikula [Thu, 5 Jan 2012 13:35:33 +0000 (15:35 +0200)]
gfx: display: tc35876x: remove redundant switching of dpi_panel_on state

The dev_priv->dpi_panel_on{,2} state is flipped accordingly, and on the
correct pipe, by the caller of mdfld_dsi_configure_{up,down}, so don't do
it again.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: tc35876x: make mdfld_dsi_configure_{up,down} more pipe aware
Jani Nikula [Thu, 5 Jan 2012 13:35:32 +0000 (15:35 +0200)]
gfx: display: tc35876x: make mdfld_dsi_configure_{up,down} more pipe aware

This does not fix everything about pipes in mdfld_dsi_configure_{up,down},
but is a step in the right direction.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: tc35876x: remove extra dsi_device_ready state variable
Jani Nikula [Thu, 5 Jan 2012 13:35:31 +0000 (15:35 +0200)]
gfx: display: tc35876x: remove extra dsi_device_ready state variable

The driver is full of display state variables. Remove dsi_device_ready used
by the tc35876x, and use the existing dev_priv->dpi_panel_on instead.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Clear links when freeing head of list
Pauli Nieminen [Wed, 4 Jan 2012 14:07:33 +0000 (16:07 +0200)]
gfx: drv: Clear links when freeing head of list

Linked list is freed in psb_cleanup_pending_events is called just before
head of linked list is freed. All list entries needs to be initialized
to be empty lists to avoid accessing freed memory if logic changes in
future.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: Fix SGX failing to complete queued rendering
Pauli Nieminen [Wed, 4 Jan 2012 12:57:35 +0000 (14:57 +0200)]
gfx: pvr: Fix SGX failing to complete queued rendering

SGXCommandComplete wakeups SGX to render when blocking external
operation completes. If blocking operation completes in IRQ handler
driver only sets flag to wakeup hardware but doesn't schedule the work
to handle wakeup operation.

Issue: ANDROID-529
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Clean pending page flip events when device is closed
Pauli Nieminen [Tue, 3 Jan 2012 15:36:44 +0000 (17:36 +0200)]
gfx: drv: Clean pending page flip events when device is closed

If userspace closes the device node with pending page flips driver keeps
a pointer to file private that is already freed. Following backtrace
shows the oops happening.

[ 643.828884] BUG: unable to handle kernel paging request at 6b6b6b6b
[ 643.835082] IP: [<c1224b6e>] __list_add+0x2a/0x5c
[ 643.888465] EIP is at __list_add+0x2a/0x5c
[ 643.943931] Call Trace:
[ 643.946376] [<c139c0d8>] psb_intel_flip_complete+0x71/0xcb
[ 643.951937] [<c139c1c8>] sync_callback+0x96/0x9f
[ 643.956631] [<c1371310>] PVRSRVCallbackOnSync+0x37/0xb7
[ 643.961934] [<c139c132>] ? psb_intel_flip_complete+0xcb/0xcb
[ 643.967673] [<c139c049>] psb_intel_crtc_page_flip+0xa1/0xbf
[ 643.973324] [<c1282f5d>] drm_mode_page_flip_ioctl+0x13f/0x190
[ 643.979151] [<c12778bf>] drm_ioctl+0x276/0x332

To cleanup pending events driver has to keep linked list of pending
flips in file private. When file is closed all events in pending flips
for the file are cleared.

To avoid race conditions dev->event_lock is used to protect pending
flips lists from parallel access.

Issue: KER-47
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
CC: Rahul Verman <rahul.verma@intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Fix page flip lockup when requesting vblank fails
Pauli Nieminen [Tue, 3 Jan 2012 16:43:51 +0000 (18:43 +0200)]
gfx: drv: Fix page flip lockup when requesting vblank fails

drm_vblank_get may fail if specified pipe is off. In that case we won't
get vblank even and can't call drm_vblank_put. But driver still has to
complete page flip to send required completion event to userspace.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Remove useless global variable
Pauli Nieminen [Tue, 3 Jan 2012 15:36:42 +0000 (17:36 +0200)]
gfx: drv: Remove useless global variable

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: ttm: Fix clearing of highmem pages
Pauli Nieminen [Tue, 3 Jan 2012 15:36:41 +0000 (17:36 +0200)]
drm: ttm: Fix clearing of highmem pages

ttm might allocate highmem pages for GPU usage. But page_address works
only for normal pages. clear_highpage can be used to clear both type of
pages.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reported-and-tested-by: Daniel Charles <daniel.charles@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Move NULL check outside spin lock
Pauli Nieminen [Mon, 2 Jan 2012 14:24:31 +0000 (16:24 +0200)]
gfx: drv: Move NULL check outside spin lock

pending_flip->event is owned by single kernel thread at a time so it can
be checked outside of the spin lock. Spin lock is only protecting the
linked list where the event is added.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: Dereference a pointer after null check
Pauli Nieminen [Mon, 2 Jan 2012 14:24:30 +0000 (16:24 +0200)]
gfx: pvr: Dereference a pointer after null check

Dereferencing a pointer may only happen after NULL check to avoid crash
if the pointer is NULL.

[pvr/services4/srvkm/common/buffer_manager.c:1152]: (error) Possible
null pointer dereference: psBMHeap - otherwise it is redundant to check
if psBMHeap is null at line 1156

Reported-by: Olev Kartau <olev.kartau@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: Dereference a pointer after null check
Pauli Nieminen [Mon, 2 Jan 2012 14:24:29 +0000 (16:24 +0200)]
gfx: imgv: Dereference a pointer after null check

Dereferencing a pointer may only happen after NULL check to avoid crash
if the pointer is NULL.

[imgv/psb_fence.c:33]: (error) Possible null pointer dereference:
dev_priv - otherwise it is redundant to check if dev_priv is null at
line 36

Reported-by: Olev Kartau <olev.kartau@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Remove unused variable
Pauli Nieminen [Mon, 2 Jan 2012 14:24:28 +0000 (16:24 +0200)]
gfx: drv: Remove unused variable

Remove unused stack variable which would crash -O0 optimised kernel.

[drv/psb_page_flip.c:61]: (error) Uninitialized variable: e

Reported-by: Olev Kartau <olev.kartau@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: add support for wrapping a pvr buffer as ttm buffer
Imre Deak [Thu, 22 Dec 2011 20:48:33 +0000 (22:48 +0200)]
gfx: imgv: add support for wrapping a pvr buffer as ttm buffer

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: refactor the placement allocator ioctls
Imre Deak [Thu, 22 Dec 2011 20:48:32 +0000 (22:48 +0200)]
gfx: imgv: refactor the placement allocator ioctls

Refactoring is done for better code reuse and to prepare for the next
patch.

Also while at it:
- get rid of unnecessary unlikely() annotations
- treat only negative return values as error instead of any non-zero
  values

Other than the above no functional changes.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: add memory backend support for fixed pages
Imre Deak [Thu, 22 Dec 2011 20:48:31 +0000 (22:48 +0200)]
gfx: imgv: add memory backend support for fixed pages

Needed by the upcoming patch adding support for wrapping a pvr buffers
as ttm buffer.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add helper function to lookup a pvr buf by id
Imre Deak [Thu, 22 Dec 2011 20:48:30 +0000 (22:48 +0200)]
gfx: pvr: add helper function to lookup a pvr buf by id

Needed by the upcoming patch adding support for wrapping a pvr buffer
as ttm buffer.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: refactor the checking of buffer placement
Imre Deak [Thu, 22 Dec 2011 20:48:29 +0000 (22:48 +0200)]
gfx: imgv: refactor the checking of buffer placement

The driver checks whether a client process has enough permission to
set/clear TTM_PL_FLAG_NO_EVICT. For busy placements we don't need to do
this every time a related IOCTL is called, since those placements never
change and they don't include this flag. So remove the check for busy
placements.

An addition in a later patch will want to check the final flags value
besides the set/clear values, so add support for it now.

While at it, also normalize the cacheability flags in
ttm_pl_setstatus_ioctl similarly to what the buffer creation IOCTLs do.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: imgv: fix parameter checking for exec cmd IOCTL
Imre Deak [Thu, 22 Dec 2011 20:48:28 +0000 (22:48 +0200)]
gfx: imgv: fix parameter checking for exec cmd IOCTL

As the comment in code suggests the IOCTL accepts only flags specifying
a GPU read or write operation, for all other flags we should return
-EINVAL. The call to psb_ttm_bo_check_placement that would seemingly
check this is actually a no-op in this case. Replace it with an actual
check. While at it, also clean up the preceeding check.

This is also needed by an upcoming patch getting rid of
psb_ttm_bo_check_placement.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drm: ttm: add support for non-swappable buffers
Imre Deak [Thu, 22 Dec 2011 20:48:27 +0000 (22:48 +0200)]
gfx: drm: ttm: add support for non-swappable buffers

Needed by buffers that can move in GPU address space, but are not
swappable. An example is a wrapped PVR buffer, added by an upcoming
patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drm: add missing header
Imre Deak [Thu, 22 Dec 2011 20:48:26 +0000 (22:48 +0200)]
gfx: drm: add missing header

Fix struct undefined error for struct drm_mode_modeinfo when drm_mode.h
is not included explicitly. Needed by an upcoming patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: fix uninitialized var bug on error path
Imre Deak [Thu, 22 Dec 2011 23:08:18 +0000 (01:08 +0200)]
gfx: pvr: fix uninitialized var bug on error path

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopsb_video: implement reset function by power up/down MSVDX
Binglin Chen [Thu, 22 Dec 2011 19:41:13 +0000 (11:41 -0800)]
psb_video: implement reset function by power up/down MSVDX

When MSVDX FW uploading is done by PUNIT, just after
MSVDX power up operation, In order to reset HW, driver need to
do one power off and power on, and wait for PUNIT re-upload FW
again.
This patch will enable driver to reset HW when there is a request.

Signed-off-by: Binglin Chen <binglin.chen@intel.com>
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopsb_video: remove MSVDX firmware uploading from driver for PNW D0
Binglin Chen [Thu, 22 Dec 2011 19:41:11 +0000 (11:41 -0800)]
psb_video: remove MSVDX firmware uploading from driver for PNW D0

For PNW C0 and older steppings, MSVDX(Video Decoder) firmware is
uploaded by driver. In PNW D0 silicon, MSVDX uploading is done by PUNIT
so video driver needs to remove firmware uploading functionality
and add adaption codes to work with PUNIT on firmware uploading,
verification, and MTX initialization.

Signed-off-by: Binglin Chen <binglin.chen@intel.com>
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopsb_video: remove OSPM_GL3_CACHE_ISLAND when not enabled
Daniel Charles [Thu, 22 Dec 2011 19:41:10 +0000 (11:41 -0800)]
psb_video: remove OSPM_GL3_CACHE_ISLAND when not enabled

When setting the island up for OSPM_GL3_CACHE_ISLAND the code was not
protected when the config is not enabled

Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Reviewed-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Fix BUG_ON() triggering in drm_vblank_put()
Ville Syrjälä [Thu, 22 Dec 2011 17:06:20 +0000 (19:06 +0200)]
staging: mrst: Fix BUG_ON() triggering in drm_vblank_put()

We're calling drm_vblank_get() too late. It must be done before the
xchg() to avoid psb_flip_complete() from calling drm_vblank_put() before
drm_vblank_get(). This could trigger a a BUG_ON() in drm_vblank_get().

Earlier the pvr sync callbacks were usually executed with interrupts
disabled, which made the problem extremely unlikely to happen.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Make sync_list and sync_lock static
Ville Syrjälä [Thu, 22 Dec 2011 16:37:21 +0000 (18:37 +0200)]
staging: mrst: ossync: Make sync_list and sync_lock static

drivers/staging/mrst/pvr/services4/srvkm/env/linux/ossync.c:30:1: warning: symbol 'sync_lock' was not declared. Should it be static?
drivers/staging/mrst/pvr/services4/srvkm/env/linux/ossync.c:31:1: warning: symbol 'sync_list' was not declared. Should it be static?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Remove an unused variable
Ville Syrjälä [Thu, 22 Dec 2011 16:37:20 +0000 (18:37 +0200)]
staging: mrst: Remove an unused variable

drivers/staging/mrst/drv/psb_page_flip.c: In function 'psb_intel_crtc_page_flip':
drivers/staging/mrst/drv/psb_page_flip.c:193: warning: unused variable 'ret'

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: psb_gtt: Fix smatch warnings
Ville Syrjälä [Thu, 22 Dec 2011 15:19:47 +0000 (17:19 +0200)]
staging: mrst: psb_gtt: Fix smatch warnings

drivers/staging/mrst/drv/psb_gtt.c:54 psb_gtt_takedown(4) warn: variable dereferenced before check 'pg' (see line 52) (smatch)
drivers/staging/mrst/drv/psb_gtt.c:343 psb_gtt_mm_init(10) warn: variable dereferenced before check 'pg' (see line 336) (smatch)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Silence a compiler warning
Ville Syrjälä [Thu, 22 Dec 2011 15:19:46 +0000 (17:19 +0200)]
staging: mrst: Silence a compiler warning

drivers/staging/mrst/drv/psb_page_flip.c: In function 'sync_callback':
drivers/staging/mrst/drv/psb_page_flip.c:102: warning: 'reg_offset' may be used uninitialized in this function

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Avoid double kmalloc()
Ville Syrjälä [Thu, 22 Dec 2011 15:19:45 +0000 (17:19 +0200)]
staging: mrst: ossync: Avoid double kmalloc()

Allow the user to embed the pending_sync structure inside its own
structure, and use container_of() in the callback.

This means we can now get by with one kmalloc() per flip, instead
of two.

As PVRSRVCallbackOnSync() can no longer fail, change the return
type to void.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Execute sync callbacks outside the spinlock
Ville Syrjälä [Thu, 22 Dec 2011 15:19:44 +0000 (17:19 +0200)]
staging: mrst: ossync: Execute sync callbacks outside the spinlock

No need to hold the spinlock while executing the sync callbacks.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Use spin_lock_irq() in PVRSRVCallbackOnSync()
Ville Syrjälä [Thu, 22 Dec 2011 15:19:43 +0000 (17:19 +0200)]
staging: mrst: ossync: Use spin_lock_irq() in PVRSRVCallbackOnSync()

The code already calls kmalloc(..., GFP_KERNEL), so interrupts can't be
off anyway.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Make flags parameter to PVRSRVCallbackOnSync() unsigned
Ville Syrjälä [Thu, 22 Dec 2011 15:19:42 +0000 (17:19 +0200)]
staging: mrst: ossync: Make flags parameter to PVRSRVCallbackOnSync() unsigned

It's a bitmask, so it should be unsigned.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Rewrite sync counter comparisons
Ville Syrjälä [Thu, 22 Dec 2011 15:19:41 +0000 (17:19 +0200)]
staging: mrst: ossync: Rewrite sync counter comparisons

Make the sync counter comparisons handle wraparound. Also reorganize
the code a bit to make it more readable.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use msleep(1) in ovl_wait()
Ville Syrjälä [Wed, 21 Dec 2011 00:01:38 +0000 (02:01 +0200)]
staging: mrst: overlay: Use msleep(1) in ovl_wait()

Having ovl_wait() react immediately to hardware state changes is not
critical, so use msleep(1) instead of cpu_relax().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use double buffering for overlay registers and add suspend...
Ville Syrjälä [Wed, 21 Dec 2011 00:01:37 +0000 (02:01 +0200)]
staging: mrst: overlay: Use double buffering for overlay registers and add suspend/resume hooks

The existing suspend/resume code that fiddles with the OVADD registers
simply does not work. Replace it with something sensible.

Allocate two pages for the registers and ping-pong between them. This
allows update_plane() to do its thing without waiting for the previous
update to complete. The previous update, if not completed, will simply
be overwritten by a new update.

If the hardware is powered down when update_plane() is called we can
simply skip programming OVADD, and instead wait for the reusme hook
to do it next time the hardware is woken up. It's also theoretically
possible that the hardware gets woken up just after we've pointed the
driver to the new register page, in which case we can simply skip
programming OVADD in update_plane(), since we know the resume hook
already did it for us.

There is a slight concern whether the hardware fetches the register
contents from memory in an atomic fashion wrt. the OVADD register
writes. That is, if the hardware can still be fetching the registers
from the old page after OVADD is pointed to the new page, there
might be trouble. So far I did not observe any ill effects. The
hardware really lacks any kind of sensible status + atomic flip
registers, so if it turns out there are problems we may need to
poll the pipe scanline counter to avoid updating OVADD too close
to the time when the hardware fetches the registers from memory.
But so far that doesn't seem necessary.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Flush posted writes to the OVADD registers
Ville Syrjälä [Wed, 21 Dec 2011 00:01:36 +0000 (02:01 +0200)]
staging: mrst: overlay: Flush posted writes to the OVADD registers

We generally want the overlay update to happen without much delay, so
read the register back to make sure posted writes are flushed.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use jiffies based timeout in ovl_wait()
Ville Syrjälä [Wed, 21 Dec 2011 00:01:35 +0000 (02:01 +0200)]
staging: mrst: overlay: Use jiffies based timeout in ovl_wait()

Wait at most 100 ms for overlay updates.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use set_memory_wc() instead of vmap()
Ville Syrjälä [Wed, 21 Dec 2011 00:01:34 +0000 (02:01 +0200)]
staging: mrst: overlay: Use set_memory_wc() instead of vmap()

x86 has set_memory_*() API so no need to vmap(). Also change from UC
to WC to make register updates, coeff tables in particular, more
efficient. There's a wmb() already in the code, and AFAICS that
should be enough to flush the WC buffers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: psb_gtt: Remove the rw semaphore
Ville Syrjälä [Wed, 21 Dec 2011 00:01:33 +0000 (02:01 +0200)]
staging: mrst: psb_gtt: Remove the rw semaphore

The read/write semaphore is only taken in read mode, so it
doesn't actually do anything meaningful. Remove it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Remove dead code
Ville Syrjälä [Wed, 21 Dec 2011 00:01:32 +0000 (02:01 +0200)]
staging: mrst: Remove dead code

Nuke a big chunk if #if 0'ed code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Fix error handling in psbfb_create
Ville Syrjälä [Wed, 21 Dec 2011 00:01:31 +0000 (02:01 +0200)]
staging: mrst: Fix error handling in psbfb_create

The two goto labels for unwinding on error were inverted. Swap them
around.

Fixes a smatch error:
drivers/staging/mrst/drv/psb_fb.c:421 psbfb_create(82) error: we previously assumed 'fb' could be null (see line 368) (smatch)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agodrm: Fix __user sparse warnings
Ville Syrjälä [Wed, 21 Dec 2011 00:01:30 +0000 (02:01 +0200)]
drm: Fix __user sparse warnings

Several pointers and casts were missing __user annotations.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agodrm: plane: mutex_unlock() was missing
Ville Syrjälä [Fri, 16 Dec 2011 13:35:02 +0000 (15:35 +0200)]
drm: plane: mutex_unlock() was missing

Unlock the mode_config mutex if drm_plane_init() fails.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Install drm_fourcc.h
Ville Syrjälä [Wed, 14 Dec 2011 22:12:11 +0000 (00:12 +0200)]
drm: Install drm_fourcc.h

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Fix zorder handling while overlay updates are pending
Ville Syrjälä [Wed, 14 Dec 2011 22:12:10 +0000 (00:12 +0200)]
staging: mrst: Fix zorder handling while overlay updates are pending

Configuring the Z order may potentially need to touch both overlays
simultaneosly. So ovl_wait() needs to be performed for both overlays.
Do that before touching any state to allow set_plane_opts() to fail
in a clean fashion.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Need to wait for overlay in set_plane_opts()
Ville Syrjälä [Wed, 14 Dec 2011 22:12:09 +0000 (00:12 +0200)]
staging: mrst: Need to wait for overlay in set_plane_opts()

Touching the overlay register memory while the overlay is fetching (or
primed to) the data. Do an ovl_wait() to make sure no updates are
pending.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay Z order support
Ville Syrjälä [Wed, 14 Dec 2011 22:12:08 +0000 (00:12 +0200)]
staging: mrst: Add overlay Z order support

Allow the Z order of the overlay to be selected.

Note that there is something strange going on though. It seems changing
the Z order also affects destination color keying. When Z order is
configured one way destination color keying works, but when the Z order
is flipped destination color keying no longer is effective.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay color keying and constant alpha
Ville Syrjälä [Wed, 14 Dec 2011 22:12:07 +0000 (00:12 +0200)]
staging: mrst: Add overlay color keying and constant alpha

Both source and destination color keying can be enabled for the
overlays.

Also the overlay constant alpha blending factor can be changed.
Note that the overlay constant alpha isn't all that useful, though.
What you usually want is to control graphics alpha. That will need
to be handled through the CRTC somehow (a new ioctl possibly) until
such time when the scanout functionality can be ripped out of the
CRTC object. When that happens the graphics plane would be just another
drm plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay CSC matrix and chroma siting settings
Ville Syrjälä [Wed, 14 Dec 2011 22:12:06 +0000 (00:12 +0200)]
staging: mrst: Add overlay CSC matrix and chroma siting settings

The used color space conversion matrix can be toggled between BT.601 and
BT.709 versions. Also the siting of chroma samples can now be selected.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay color correction settings
Ville Syrjälä [Wed, 14 Dec 2011 22:12:05 +0000 (00:12 +0200)]
staging: mrst: Add overlay color correction settings

Allow the overlay brightness, contrast, hue and saturation to be
adjusted. Also allows one to select the input range (JPEG vs. MPEG)
for the color space conversion.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add support for Medfield video overlays
Ville Syrjälä [Wed, 14 Dec 2011 22:12:04 +0000 (00:12 +0200)]
staging: mrst: Add support for Medfield video overlays

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Use drm_framebuffer_check()
Ville Syrjälä [Wed, 14 Dec 2011 22:12:03 +0000 (00:12 +0200)]
staging: mrst: Use drm_framebuffer_check()

Call drm_framebuffer_check() to verify that the requested fb layout is
sane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add alignment argument to psb_gtt_map_pvr_memory()
Ville Syrjälä [Wed, 14 Dec 2011 22:12:02 +0000 (00:12 +0200)]
staging: mrst: Add alignment argument to psb_gtt_map_pvr_memory()

The video overlay register block must be aligned on a 64K boundary.
Allow the caller of psb_gtt_map_pvr_memory() to specify the desired
alignment.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_chroma_phase_offsets() utility function
Ville Syrjälä [Wed, 14 Dec 2011 22:12:01 +0000 (00:12 +0200)]
drm: Add drm_chroma_phase_offsets() utility function

This function is is there to help driver writers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Add plane options ioctl
Ville Syrjälä [Wed, 14 Dec 2011 22:12:00 +0000 (00:12 +0200)]
drm: plane: Add plane options ioctl

Add a new ioctl DRM_IOCTL_MODE_PLANE_OPTS which is used to configure
various settings for the plane.

I left out gamma correction thinking that it could be added using a
separate ioctl, since there's already a gamma ioctl for CRTCs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_calc_{hscale, vscale}() utility functions
Ville Syrjälä [Wed, 14 Dec 2011 22:11:59 +0000 (00:11 +0200)]
drm: Add drm_calc_{hscale, vscale}() utility functions

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add struct drm_region and assorted utility functions
Ville Syrjälä [Wed, 14 Dec 2011 22:11:58 +0000 (00:11 +0200)]
drm: Add struct drm_region and assorted utility functions

struct drm_region represents a two dimensional region. The utility
functions are there to help driver writers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>