kernel/kernel-mfld-blackbay.git
12 years agodrv: tc35876x: add a named module parameter for register write debug.
Oliver McFadden [Thu, 23 Feb 2012 21:15:59 +0000 (23:15 +0200)]
drv: tc35876x: add a named module parameter for register write debug.

Otherwise the output on the serial console is far too verbose.

Issue: GRA-19
Signed-off-by: Oliver McFadden <oliver.mcfadden@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrv: tc35876x: set the brightness only when the panel is turned on.
Oliver McFadden [Fri, 17 Feb 2012 12:52:29 +0000 (14:52 +0200)]
drv: tc35876x: set the brightness only when the panel is turned on.

Attempting to set the brightness when the panel is off would result in
several failed i2c writes; cache the value and write it when bringing
the panel turned on.

Issue: GRA-28
Signed-off-by: Oliver McFadden <oliver.mcfadden@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrv: tc35876x: pass the DRM device to all tc35876x functions.
Oliver McFadden [Fri, 17 Feb 2012 12:52:28 +0000 (14:52 +0200)]
drv: tc35876x: pass the DRM device to all tc35876x functions.

This patch is required for further patches in this series; no functional
changes.

Signed-off-by: Oliver McFadden <oliver.mcfadden@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoLack of MTX_CMDID_NULL causes topaz fence to timeout
Naeem M. Afzal [Thu, 16 Feb 2012 17:04:07 +0000 (09:04 -0800)]
Lack of MTX_CMDID_NULL causes topaz fence to timeout

this timeout results in reset the hardware for every
jpeg frame encode. vaSyncSurface will not complete until
the timeout occurs, since it is still waiting for
MTX_CMID_NULL. This shows up as slow performance
(we have to wait for timeout).

Issue: ANDROID-1633

Signed-off-by: naeem.m.afzal@intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoAdd DVI interoperability support for HDMI.
asaggi [Tue, 14 Feb 2012 22:06:55 +0000 (14:06 -0800)]
Add DVI interoperability support for HDMI.

Kernel changes to add interoperability support for DVI. We do not want to send
NULL packets for DVI mode. This change depends on Android frameworks change to
actually make the decision of NOT routing audio to DVI.

ISSUE: ANDROID-1482
ISSUE: ANDROID-1519
Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoHDMI Audio PHY should be disabled if HDMI plane is disabled.
asaggi [Tue, 14 Feb 2012 22:06:53 +0000 (14:06 -0800)]
HDMI Audio PHY should be disabled if HDMI plane is disabled.

Disable audio Phy in DPMS when unplugging HDMI cable physically
and in cases like: deep sleep, etc., which was previously missing.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoEnable HDMI audio routing and signaling to user-space and HDMI audio driver.
Arun Kannan [Tue, 14 Feb 2012 22:06:52 +0000 (14:06 -0800)]
Enable HDMI audio routing and signaling to user-space and HDMI audio driver.

We use the Android switch class driver to signal an HDMI state change to frameworks.
It is also important to notify the state change to HDMI audio driver.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoEnable HDMI Audio callbacks from HDMI driver.
Sanjay Rama Reddy [Tue, 14 Feb 2012 22:06:50 +0000 (14:06 -0800)]
Enable HDMI Audio callbacks from HDMI driver.

HDMI audio driver needs to register itself with the HDMI display
driver in order to be notified of HDMI events.

This patch will register the audio driver during boot-up and callback
HDMI audio driver functions when an event like PLUG/UNPLUG occurs.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoDuring page flip, update the fb_helper->fbdev to that in the swapped fb.
Hu Tiger Chen [Tue, 14 Feb 2012 22:06:49 +0000 (14:06 -0800)]
During page flip, update the fb_helper->fbdev to that in the swapped fb.

This fixes the bug of system crash if unplug the HDMI cable after play video
with overlay enabled.
It is because fb_helper->fbdev points to the old value in the last fb, which
is cleaned up after video playback. And in hotplug sequence, segmentation fault
happens when walking through fb_helper->fbdev content.

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoIn encoder dpms power on display island before accessing HDMI registers
Sanjay Rama Reddy [Tue, 14 Feb 2012 22:06:48 +0000 (14:06 -0800)]
In encoder dpms power on display island before accessing HDMI registers

In mdfld encoder dpms function, before accessing the registers notify
Power Management module not to power down the display island and once done notify
the module about that access to registers is no longer needed.

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoChange HDMI I2C adapter from 3 to 8.
Mohan Kandra [Tue, 14 Feb 2012 22:06:46 +0000 (14:06 -0800)]
Change HDMI I2C adapter from 3 to 8.

I2C adapter 3 on Medfield has known issues with reliably reading EDIDs
and especially reading 4-block EDID. We change the i2c adapter for HDMI
to adapter 8 to enable EDID extension block read (4 blocks EDID).

OTM_HDMI: r2954

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoMUST_REVERT: Set overlay clip region for HDMI to be same as MIPI.
Mohan Kandra [Tue, 14 Feb 2012 22:06:43 +0000 (14:06 -0800)]
MUST_REVERT: Set overlay clip region for HDMI to be same as MIPI.

Since the same FB is used between MIPI and HDMI, in video clone mode,
the clip region for HDMI that overlay configures should be same as MIPI.

OTM_HDMI: r3079
ISSUE: ANDROID-1462

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoMark some unused functions in code to avoid warnings.
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:42 +0000 (14:06 -0800)]
Mark some unused functions in code to avoid warnings.

Some currently unused functions are annotated. These will get used in the
near future and will be enabled as required.

OTM_HDMI: r3068

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoCleanup of some hardcoded values in OTM HDMI driver.
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:41 +0000 (14:06 -0800)]
Cleanup of some hardcoded values in OTM HDMI driver.

Removed some hardcode values and replace with meaningful macros.

OTM_HDMI: r3001

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoPort Panel fitting changes for HDMI from Gingerbread.
Mohan Kandra [Tue, 14 Feb 2012 22:06:40 +0000 (14:06 -0800)]
Port Panel fitting changes for HDMI from Gingerbread.

Panel fit hardware configuration dependent on required output HDMI mode.

OTM_HDMI: r2979

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoFix more build warnings found in OTM HDMI driver.
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:39 +0000 (14:06 -0800)]
Fix more build warnings found in OTM HDMI driver.

Some more build warning fixes for OTM HDMI driver.

OTM_HDMI: r2971

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoCorrect the compile condition for command line interface code
Mohan Kandra [Tue, 14 Feb 2012 22:06:38 +0000 (14:06 -0800)]
Correct the compile condition for command line interface code

Command line interface code needs to be within OTM_HDMI_UNIT_TEST condition.

OTM_HDMI: r2967

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoFix compilation warnings in OTM HDMI driver.
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:37 +0000 (14:06 -0800)]
Fix compilation warnings in OTM HDMI driver.

Fixes multiple compilation warnings/sparse warnings in OTM HDMI driver.

OTM_HDMI: r2964

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoFix SPARSE issues found in OTM HDMI driver.
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:36 +0000 (14:06 -0800)]
Fix SPARSE issues found in OTM HDMI driver.

Patch fixes multiple issues found by SPARSE in OTM HDMI driver.

OTM_HDMI: r2947

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoCleanup of hooking OTM HDMI driver into mrst/Makefile
Mohan Kandra [Tue, 14 Feb 2012 22:06:35 +0000 (14:06 -0800)]
Cleanup of hooking OTM HDMI driver into mrst/Makefile

mrst/Makefile changes corresponding to the new OTM HDMI
Makefile where the OTM HDMI Makefile is now independent
of mrst/Makefile inclusions, definitions etc.

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoCleanup of OTM HDMI Makefile.
Mohan Kandra [Tue, 14 Feb 2012 22:06:34 +0000 (14:06 -0800)]
Cleanup of OTM HDMI Makefile.

Removing uncessary CFLAGS and include dirs from Makefile and making is simpler.

OTM_HDMI: r2919

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoFix SMATCH issues found in OTM HDMI driver.
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:33 +0000 (14:06 -0800)]
Fix SMATCH issues found in OTM HDMI driver.

Fixes for multiple SMATCH issues inside OTM HDMI driver.

OTM_HDMI: r2913

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoStatic Analysis fixes for OTM HDMI driver
Gandhimathi Anand [Tue, 14 Feb 2012 22:06:32 +0000 (14:06 -0800)]
Static Analysis fixes for OTM HDMI driver

This patch comprises of multiple issues found by static analysis tools.

OTM_HDMI: r2897

Signed-off-by: Arun Kannan <arun.kannan@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Warn if mode_config.mutex is not locked in GTT code
Ville Syrjälä [Wed, 15 Feb 2012 13:02:52 +0000 (15:02 +0200)]
gfx: drv: Warn if mode_config.mutex is not locked in GTT code

The GTT ref counting relies on mode_config.mutex for protection. Print a
warning if the code is called without holding the mutex.

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: Kill psb_bo_offset()
Ville Syrjälä [Wed, 15 Feb 2012 13:02:51 +0000 (15:02 +0200)]
gfx: drv: Kill psb_bo_offset()

.bo_offset() is the only function in struct psb_intel_mode_device
which takes psb_framebuffer as a parameter, whereas the others take a
pvr mem info. Also .bo_offset() is only called from
mdfld__intel_pipe_set_base() whereas the other functions are only called
from the hardware cursor code.

Eliminate this incosistency by removing the .bo_offset() function
pointer completely and just dereference the psb_framebuffer pointer
directly in mdfld__intel_pipe_set_base().

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: Reference count cursor BOs
Ville Syrjälä [Wed, 15 Feb 2012 13:02:50 +0000 (15:02 +0200)]
gfx: drv: Reference count cursor BOs

Refrence count cursor BOs the same way as FB BOs.

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: Increase mem info ref count safely
Ville Syrjälä [Wed, 15 Feb 2012 13:02:49 +0000 (15:02 +0200)]
gfx: drv: Increase mem info ref count safely

gPVRSRVLock must be held when looking up the mem info based on the
handle. Also increase the ref count on the mem info before releasing
the  lock. Otherwise some other thread could destroy the mem info
after we've looked it up, but before we've increased the ref count.

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: Add WARN_ON(1) to psb_gtt_{map, unmap}_meminfo_ioctl
Ville Syrjälä [Wed, 15 Feb 2012 13:02:48 +0000 (15:02 +0200)]
gfx: drv: Add WARN_ON(1) to psb_gtt_{map, unmap}_meminfo_ioctl

psb_gtt_map_meminfo_ioctl() and psb_gtt_unmap_meminfo_ioctl() should not
be used by anyone. Add a WARN_ON(1) to both to catch anyone using them.

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: Fix locking in psb_gtt_{map, unmap}_meminfo_ioctl
Ville Syrjälä [Wed, 15 Feb 2012 13:02:47 +0000 (15:02 +0200)]
gfx: drv: Fix locking in psb_gtt_{map, unmap}_meminfo_ioctl

mode_config.mutex is needed to protect the GTT reference counting, and
gPVRSRVLock is needed to protect the pvr data structures during these
ioctls. With locking properly handled in the code we can make both
ioctls DRM_UNLOCKED.

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: Kill psbfb_vdc_reg()
Ville Syrjälä [Wed, 15 Feb 2012 13:02:46 +0000 (15:02 +0200)]
gfx: drv: Kill psbfb_vdc_reg()

psbfb_vdc_reg() is not used anywhere, kill it.

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: Free the correct pointer in psb_framebuffer_destroy()
Ville Syrjälä [Wed, 15 Feb 2012 13:02:45 +0000 (15:02 +0200)]
gfx: drv: Free the correct pointer in psb_framebuffer_destroy()

Pass the pointer to the psb_framebuffer structure to kfree(), not
the pointer to the embedded drm_framebuffer structure.

Luckily in this case the drm_framebuffer is embedded as the first
member inside psb_framebuffer, so the incorrect code didn't
manage to make a mess of things.

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: Use need_gtt() in psb_fb_gtt_ref()/unref()
Ville Syrjälä [Wed, 15 Feb 2012 13:02:44 +0000 (15:02 +0200)]
gfx: drv: Use need_gtt() in psb_fb_gtt_ref()/unref()

Make sure the mem info needs a GTT mapping before trying to take a
reference to one.

Also swap the order of psb_fb_ref() and psb_gtt_map_meminfo() in
psb_gtt_fb_ref() to be consistent with the rest of the code.

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: Clean up error handling during fb creation
Ville Syrjälä [Wed, 15 Feb 2012 13:02:43 +0000 (15:02 +0200)]
gfx: drv: Clean up error handling during fb creation

Try to handle errors during user framebuffer creation. Also use
psb_fb_ref()/unref() to take the reference to the mem info, in order
to get a reference to the per process data as well.

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: Keep a reference to pvr per process data
Ville Syrjälä [Wed, 15 Feb 2012 13:02:42 +0000 (15:02 +0200)]
gfx: drv: Keep a reference to pvr per process data

While we have a reference to the pvr mem info, we also must keep a
reference to the per process data for the owner. Freeing the mem
info will access data structures whose lifetime is tied to the per
process data, such as the context. So if we don't keep a reference
to the per process data, and the process exits before we unref the
mem info, the kernel could oops or some assertions could fail in
the pvr code.

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 agodrm: disconnect plane from fb/crtc when disabled
Rob Clark [Wed, 15 Feb 2012 13:02:41 +0000 (15:02 +0200)]
drm: disconnect plane from fb/crtc when disabled

Since plane->fb and plane->crtc are set in drm_mode_setplane()
after update_plane(), They should be cleared after disable().

Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: overlay: Optimize filter coefficient load with sychronized flips
Ville Syrjälä [Wed, 15 Feb 2012 13:02:40 +0000 (15:02 +0200)]
gfx: overlay: Optimize filter coefficient load with sychronized flips

Without synchronized flips the driver can instruct the hardware to stop
re-loading the filter coefficients from memory once they've been loaded
by the hardware at leas once.

Bring the same optimization over to synchronized flips. To do that the
dirty state tracking must be split into software and hardware variants
due to the asynchronous nature of the synchronized flip code.

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: Move flip trace commands into psb_fb
Ville Syrjälä [Wed, 15 Feb 2012 13:02:39 +0000 (15:02 +0200)]
gfx: drv: Move flip trace commands into psb_fb

The overlay code also manipulates sync object counters these days.
Instead of duplicating the same tracing code in two places, move
the code to the place where the sync counters are actually
manipulated.

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: overlay: Synchronize overlay updates with CRTC page flips
Ville Syrjälä [Wed, 15 Feb 2012 13:02:38 +0000 (15:02 +0200)]
gfx: overlay: Synchronize overlay updates with CRTC page flips

Tie the overlay updates to the CRTC page flips. Whenever the overlay is
updated, we simply "arm" the overlay, and when the next page flip happens
on the associated CRTC, we push the page flip and the pending overlay
updates to the hardware simultaneosly.

This will guarantee that the page flip and overlay updates happen on the
same vblank, and are thus perfectly synchronized with each other.

Issue: ANDROID-1574
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 agoHACK: gfx: display: Double the tc35876x pixel clock
Ville Syrjälä [Wed, 15 Feb 2012 13:02:37 +0000 (15:02 +0200)]
HACK: gfx: display: Double the tc35876x pixel clock

The pixel clock and vertical refresh values the driver reports for the
internal display are wrong. The page flip logic needs accurate clock
information to convert time intervals to scanline intervals.

Double the pixel clock in the tc35876x driver so that the values are
at least a little closer to reality.

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: Avoid page flipping while too close to vblank start
Ville Syrjälä [Wed, 15 Feb 2012 13:02:36 +0000 (15:02 +0200)]
gfx: drv: Avoid page flipping while too close to vblank start

The hardware doesn't have proper facilities to indicate when a specific
page flip has occured. We can deduce that information from the frame
counter and scanline counter, but only if we know on which side of the
vblank start the flip was programmed. So if we're too close to the
vblank start to be able make that determination, wait until the vblank
start has passed before programming the flip into the hardware.

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: Rewrite the CRTC page flipping code to use the new drm_flip mechanism
Ville Syrjälä [Wed, 15 Feb 2012 13:02:35 +0000 (15:02 +0200)]
gfx: drv: Rewrite the CRTC page flipping code to use the new drm_flip mechanism

The drm_flip mechanism allows us to track page flip progess, and thus
maintain proper reference counts on the backing memory and GTT mappings
while the buffers are being scanned out.

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: Introduce drm_flip helper class
Ville Syrjälä [Wed, 15 Feb 2012 13:02:34 +0000 (15:02 +0200)]
gfx: drv: Introduce drm_flip helper class

The drm_flip mechanism can be used to implement robust page flipping
support, and also to synchronize the flips on multiple hardware scanout
engines (eg. CRTCs and overlays).

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: Add some helper function to manipulate fb refcounts
Ville Syrjälä [Wed, 15 Feb 2012 13:02:33 +0000 (15:02 +0200)]
gfx: drv: Add some helper function to manipulate fb refcounts

Upcoming page flip logic will need to maintain extra references
to the pvr mem_info, and the GTT mapping. Add some functions to
make that easier.

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: Move read ops sync counter functions into psb_fb.c
Ville Syrjälä [Wed, 15 Feb 2012 13:02:32 +0000 (15:02 +0200)]
gfx: drv: Move read ops sync counter functions into psb_fb.c

The overlay code will want to manipulate sync counters as well, so move
the code to a more appropriate 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: Check fb bpp before doing irreversible changes to state
Ville Syrjälä [Wed, 15 Feb 2012 13:02:31 +0000 (15:02 +0200)]
gfx: drv: Check fb bpp before doing irreversible changes to state

When the fb uses an unsupported bpp layout, the current code messes with
the hardware state before checking whether it can actually use the
provided framebuffer. This could leave the hardware in some weird state.
So check the framebuffer bpp before touching the hardware state.

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: gtt: Support unmapping from arbitrary context
Ville Syrjälä [Wed, 15 Feb 2012 13:02:30 +0000 (15:02 +0200)]
gfx: gtt: Support unmapping from arbitrary context

Pass the 'tgid' down from the caller of psb_gtt_unmap_meminfo(). This
will allow unmapping from eg. workqueues. This will be used to keep
references to the GTT mapping possibly after the drm_framebuffer has
been destroyed.

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: ossync: Indicate whether sync callback is called from MISR
Ville Syrjälä [Wed, 15 Feb 2012 13:02:29 +0000 (15:02 +0200)]
gfx: pvr: ossync: Indicate whether sync callback is called from MISR

The callee may want to do some extra locking when the sync callback is
called from MISR (as opposed to being called directly). Add a boolean
parameter to the sync callback which indicates this.

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: Add PIPE DSL regs
Ville Syrjälä [Wed, 15 Feb 2012 13:02:28 +0000 (15:02 +0200)]
gfx: drv: Add PIPE DSL regs

Add defines for display scanline counter registers.

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: 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>