kernel/kernel-mfld-blackbay.git
12 years agogfx: pvr: Lock gPVRSRVLock in PVRSRVMISR()
Ville Syrjälä [Wed, 15 Feb 2012 13:02:27 +0000 (15:02 +0200)]
gfx: pvr: Lock gPVRSRVLock in PVRSRVMISR()

It's totally unclear how various data are protected in the driver.
Currently the MISR work is exectuted without holding the gPVRSRVLock
mutex, which is held across bridge ioctls. To play things safe,
take the same lock in MISR work.

Signed-off-by: Ville Syrjälä <ville.syrjala@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: Lock gPVRSRVLock mutex before touching the meminfo/bm ref counts
Ville Syrjälä [Wed, 15 Feb 2012 13:02:26 +0000 (15:02 +0200)]
gfx: drv: Lock gPVRSRVLock mutex before touching the meminfo/bm ref counts

The pvr mem ref counts are not modified using atomic operations, so we
need to protect them against simultaneous RMW access. Additionally it's
not at all clear how the related data structures are protected in the
pvr code. Use gPVRSRVLock as that's always locked around bridge ioctls.

Signed-off-by: Ville Syrjälä <ville.syrjala@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: pvr: Remove most of the display class code
Ville Syrjälä [Wed, 15 Feb 2012 13:02:25 +0000 (15:02 +0200)]
gfx: pvr: Remove most of the display class code

The display class swap chain code calls into the psb_fb driver
which causes KMS mode_config mutex to be locked after gPVRSRVLock.
To avoid problems with non-atomic reference counts, a later patch
will take the gPVRSRVLock inside code sections where mode_config
mutex is already locked. That could lead to dead locks, so the simple
solution is to eliminate the DC swap chain code altogether. We don't
want to use it anyway.

Unfortunately the DC driver can't be removed completely, since the
current userspace code requires a DC device to be registered. So
leave a minimal DC driver in place.

Signed-off-by: Ville Syrjälä <ville.syrjala@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: update meminfo reference count when creating/destroying fbs
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:24 +0000 (15:02 +0200)]
gfx: drv: update meminfo reference count when creating/destroying fbs

The fbs may outlive the mem info if the client frees the memory before
removing the fb so make sure the memory backing the fb lives as long
as the fb itself.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add an interface for inc/dec meminfo ref count
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:23 +0000 (15:02 +0200)]
gfx: pvr: add an interface for inc/dec meminfo ref count

The drm part of the pvr driver stores pointers to mem infos but those
may be freed by the clients. If the reference counts aren't increased
properly, those mem infos may be freed while the kernel still
references them.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: support creating fb's from mapped memory
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:22 +0000 (15:02 +0200)]
gfx: drv: support creating fb's from mapped memory

If a client passes a handle to a mapped memory to drmModeAddFB, the
ioctl will fail since the gtt mapping code will fail to get its page
list. Fix that by using a reference to the original meminfo instead
of the mapped one.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add a way of getting the src meminfo backing a mapped one
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:21 +0000 (15:02 +0200)]
gfx: pvr: add a way of getting the src meminfo backing a mapped one

This will be used to implement on the drm side support for creating
a drm fb from a mapped memory handle.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: unifdef RES_MAN_EXTEND
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:20 +0000 (15:02 +0200)]
gfx: pvr: unifdef RES_MAN_EXTEND

The PVRSRVGetResData function will be used in a follow up patches to
implement support for creating drm fb's from mapped exported memory.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: don't store meminfo handle on psbfb
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:19 +0000 (15:02 +0200)]
gfx: drv: don't store meminfo handle on psbfb

The handle has no reference count and might be freed by the client
before the psbfb is destroyed.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: use psbfb->pvrBO instead of hKernelMemInfo on page flip code
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:18 +0000 (15:02 +0200)]
gfx: drv: use psbfb->pvrBO instead of hKernelMemInfo on page flip code

The meminfo is already stored on psbfb. Remove the extra indirection
through psb_get_meminfo_by_handle.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: pass meminfo instead of handle to psb_gtt_{unmap, map}_meminfo
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:17 +0000 (15:02 +0200)]
gfx: drv: pass meminfo instead of handle to psb_gtt_{unmap, map}_meminfo

The handles are process specific and may be freed while the kernel is
still using the meminfo.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: gtt: refcount gtt mappings
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:16 +0000 (15:02 +0200)]
gfx: gtt: refcount gtt mappings

Currently psb_gtt_map_* can handle multiple calls with the same
handle but will remove the pages from gtt as soon as one call to
psb_gtt_unmap_* is made. Since multiple drm_fb's can be added with
the same handle and the driver will cal psb_gtt_map_meminfo for each
one of them, this could lead to unmapping memory that is still being
used.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: gtt: refactor gtt mapping code
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:15 +0000 (15:02 +0200)]
gfx: gtt: refactor gtt mapping code

Make room for inserting reference counting in the psb_gtt_mem_mapping
objects by refactoring the map and unmap code so that lower level
objects are allocated in lower level functions.

There is a hash table per process that holds a psb_gtt_mem_mapping
object which in turn holds a drm_mm_node object. The current
implementation allocs a drm_mm_node object in the psb_gtt_map_*
functions and then uses helper functions to wrap this node inside
a mapping object. When freeing this object, the drm_mm_node has to
be passed to the psb_gtt_unmap_* functions so that it can be freed.

This patch changes this logic so that the psb_gtt_map_* functions
allocate the mapping object through a helper function
(psb_gtt_add_mapping) that in turns allocates the node object. When
freeing, the psb_gtt_unmap_* functions will call psb_gtt_remove_mapping
which in will in turn free the node object.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: fix resource leak in psb_gtt_map_meminfo
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:14 +0000 (15:02 +0200)]
gfx: drv: fix resource leak in psb_gtt_map_meminfo

If psb_gtt_map_meminfo was called with an already mapped handle a node
would be allocated with drm_mm_get_block_atomic in psb_gtt_mm_alloc_mem.
Later, on psb_gtt_mm_alloc_insert_mem_mapping (called by
psb_gtt_add_node), the reference to the allocated node would be
replaced by the node previously allocated for the handle, so the former
was never free'd.

This commit changes psb_gtt_map_meminfo to check for an existing node
before allocating a new one.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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/psb_gtt.c: add spaces around comments
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:13 +0000 (15:02 +0200)]
gfx: drv/psb_gtt.c: add spaces around comments

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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/psb_gtt.c: replace printk with DRM_DEBUG
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:12 +0000 (15:02 +0200)]
gfx: drv/psb_gtt.c: replace printk with DRM_DEBUG

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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/psb_gtt.c: improve readability by using ERR_PTR
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:11 +0000 (15:02 +0200)]
gfx: drv/psb_gtt.c: improve readability by using ERR_PTR

A lot of functions in this file return a value through a parameter
and use the return value for returning an error value. Using ERR_PTR
makes the code a bit more readable.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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/psb_gtt.c: make function calls take as few lines as possible
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:10 +0000 (15:02 +0200)]
gfx: drv/psb_gtt.c: make function calls take as few lines as possible

Comestic fix. No code changes.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: change psb_gtt_insert_* to remove casting
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:09 +0000 (15:02 +0200)]
gfx: drv: change psb_gtt_insert_* to remove casting

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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/psb_gtt.c: remove unnecessary casting of psb_get_tgid() to u32
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:08 +0000 (15:02 +0200)]
gfx: drv/psb_gtt.c: remove unnecessary casting of psb_get_tgid() to u32

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: fix psb_gtt_{map, unmap}_pvr_memory interface
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:07 +0000 (15:02 +0200)]
gfx: drv: fix psb_gtt_{map, unmap}_pvr_memory interface

Change data types to avoid unnecessary casting.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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/psb_gtt.h: fix indentation
Ander Conselvan de Oliveira [Wed, 15 Feb 2012 13:02:06 +0000 (15:02 +0200)]
gfx: drv/psb_gtt.h: fix indentation

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@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: Do not kfree() pvr buffer's page list
Ville Syrjälä [Wed, 15 Feb 2012 13:02:05 +0000 (15:02 +0200)]
gfx: drv: Do not kfree() pvr buffer's page list

psb_get_pages_by_mem_handle() doesn't allocate a new page list. Instead
it simply returns a reference to the pvr buffer's page list. Do not
kfree() said list in the caller.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrv: psb: check crtc pointer before calling in DPMS and mode set.
Oliver McFadden [Thu, 9 Feb 2012 14:55:28 +0000 (16:55 +0200)]
drv: psb: check crtc pointer before calling in DPMS and mode set.

Avoid the possibility of oops-ing the kernel by running the
test-opengl-fillrate test (and others) which bypass DRM_MASTER
authentication.

Typically the test will execute succesfully, however when
unblanking/un-suspending we NULL deref in gfx_late_resume()

Signed-off-by: Oliver McFadden <oliver.mcfadden@intel.com>
Reviewed-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 panel_desc field and defines
Jani Nikula [Tue, 7 Feb 2012 13:08:31 +0000 (15:08 +0200)]
gfx: display: remove unused panel_desc field and defines

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: cleanup ospm_power_suspend()
Jani Nikula [Tue, 7 Feb 2012 13:08:30 +0000 (15:08 +0200)]
gfx: display: cleanup ospm_power_suspend()

No functional changes, just a stylistic cleanup to make the function easier
to follow.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove useless gb{Suspend,Resume}InProgress flags
Jani Nikula [Tue, 7 Feb 2012 13:08:29 +0000 (15:08 +0200)]
gfx: display: remove useless gb{Suspend,Resume}InProgress flags

The gbSuspendInProgress and gbResumeInProgress flags are only ever true
when the g_ospm_mutex is held. The locking should be in order without
these.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove redundant code in ospm_power_using_hw_begin()
Jani Nikula [Tue, 7 Feb 2012 13:08:28 +0000 (15:08 +0200)]
gfx: display: remove redundant code in ospm_power_using_hw_begin()

The display island should already be on at this point, and the power up
status for video enc/dec islands has already been checked some lines
earlier.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: drop redundant ospm_resume_pci() in ospm_power_using_hw_begin()
Jani Nikula [Tue, 7 Feb 2012 13:08:27 +0000 (15:08 +0200)]
gfx: display: drop redundant ospm_resume_pci() in ospm_power_using_hw_begin()

The runtime resume through pm_runtime_get_sync() should already have taken
care of ospm_resume_pci(). No need to repeat here.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: ospm_power_using_hw_begin() rewrite
Jani Nikula [Tue, 7 Feb 2012 13:08:26 +0000 (15:08 +0200)]
gfx: display: ospm_power_using_hw_begin() rewrite

ospm_power_using_hw_begin() had gotten overly complicated with a plethora
of variables and code paths. The code can be simplified considerably by
making the observation that the function is never called with force_on in
atomic context, i.e. if the power island is off, it will not be switched on
in atomic context.

Split the function into ospm_power_using_hw_begin() and
ospm_power_using_hw_begin_atomic(), of which only the latter may be called
in an atomic context. Clean up and simplify the code with the new
assumptions that can be made.

There is still plenty of strangeness left, but this is a big step forward
in making the code possible to understand.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove no-op assignments in ospm_power_using_hw_begin()
Jani Nikula [Tue, 7 Feb 2012 13:08:25 +0000 (15:08 +0200)]
gfx: display: remove no-op assignments in ospm_power_using_hw_begin()

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: switch to the power island management code in the PMU driver
Jani Nikula [Tue, 7 Feb 2012 13:08:24 +0000 (15:08 +0200)]
gfx: display: switch to the power island management code in the PMU driver

Both the GFX and ISP drivers need to switch on and off the relevant power
islands through PUnit. If a centralized driver with proper locking is not
used, they may stomp on each others' toes accessing the PUnit registers.

Obviously, this also reduces code duplication, and the power island
management code is of better quality in the PMU driver anyway.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: use a bool parameter for force in ospm_power_using_hw_begin()
Jani Nikula [Tue, 7 Feb 2012 13:08:23 +0000 (15:08 +0200)]
gfx: display: use a bool parameter for force in ospm_power_using_hw_begin()

Remove an unnecessary level of abstraction from what is a simple thing.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv/pvr: cmd trace: show both old and new flip req buffers
Imre Deak [Wed, 1 Feb 2012 15:30:42 +0000 (17:30 +0200)]
gfx: drv/pvr: cmd trace: show both old and new flip req buffers

For flip request commands the trace output showed only information on
one buffer: the DC flip code showed the new buffer while the DRM
specific flip code showed the old buffer. This in itself is
inconsistent, besides we want to get information on both buffers. So
show both buffers.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
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>