kernel/kernel-mfld-blackbay.git
12 years agogfx: drv: add helper to wait for HW flag becoming set/clear
Imre Deak [Tue, 6 Mar 2012 19:17:27 +0000 (21:17 +0200)]
gfx: drv: add helper to wait for HW flag becoming set/clear

Signed-off-by: Imre Deak <imre.deak@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: fix exiting DSI ULPS mode during resume
Imre Deak [Tue, 6 Mar 2012 19:17:26 +0000 (21:17 +0200)]
gfx: drv: fix exiting DSI ULPS mode during resume

The DEVICE_READY_REG register used during resume to exit the ULPS mode
is pipe specific and we should use the already available
MIPI_DEVICE_READY_REG(pipe) macro to access it.

The current resume code calls mdfld_restore_display_registers for pipe A
and C, but due to the above bug will incorrectly exit ULPS mode in both
cases for pipe A. Fix this by exiting ULPS only on pipe A. For now this
works ok for tablets and for other devices the code was broken in the
first place anyway. Later we'll add a more generic solution to handle
ULPS state that works for other devices too.

Thanks for Jani Nikula for pointing this out.

Signed-off-by: Imre Deak <imre.deak@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 old dsp/palette reg macros
Imre Deak [Tue, 6 Mar 2012 19:17:22 +0000 (21:17 +0200)]
gfx: drv: remove old dsp/palette reg macros

Signed-off-by: Imre Deak <imre.deak@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 up the save/restore of the palette regs
Imre Deak [Tue, 6 Mar 2012 19:17:25 +0000 (21:17 +0200)]
gfx: drv: clean up the save/restore of the palette regs

We have the same set of palette regs for each pipe, so store them to an
appropriate array instead of separate variables named after the pipe.

No functional change.

Signed-off-by: Imre Deak <imre.deak@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 up the save/restore of the dspcntr/pipeconf regs
Imre Deak [Tue, 6 Mar 2012 19:17:24 +0000 (21:17 +0200)]
gfx: drv: clean up the save/restore of the dspcntr/pipeconf regs

We have the same set of the dspcntr/pipeconf regs for each pipe, so
store them to an appropriate array instead of separate variables named
after the pipe.

Signed-off-by: Imre Deak <imre.deak@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: save pipe specific panel timing regs to an array
Imre Deak [Tue, 6 Mar 2012 19:17:23 +0000 (21:17 +0200)]
gfx: drv: save pipe specific panel timing regs to an array

We have the same set of panel timing regs for each pipe, so store them
to an appropriate array instead of separate variables named after the
pipe.

The CNTR, CONF, DPLL, PALETTE, MIPI registers are handled specially
during restore, so the parts related to those are cleaned up separately
in the upcoming patches.

The only functional change of this patch is that the CNTR register is
saved now before all the above generic registers, but as reading these
registers don't have a side-effect this shouldn't be a problem.

Signed-off-by: Imre Deak <imre.deak@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: use pipe specific macros to access the palette regs
Imre Deak [Tue, 6 Mar 2012 19:17:21 +0000 (21:17 +0200)]
gfx: drv: use pipe specific macros to access the palette regs

Use the new pipe specific macros to access the palette registers. This
will also fix accessing the palette registers for PIPE C.

Signed-off-by: Imre Deak <imre.deak@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: use pipe specific macros to access the dsp regs
Imre Deak [Tue, 6 Mar 2012 19:17:20 +0000 (21:17 +0200)]
gfx: drv: use pipe specific macros to access the dsp regs

Use the pipe specific macros to access these registers.

Signed-off-by: Imre Deak <imre.deak@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: use pipe specific macros to access dsp regs in psb_page_flip.c
Imre Deak [Tue, 6 Mar 2012 19:17:19 +0000 (21:17 +0200)]
gfx: drv: use pipe specific macros to access dsp regs in psb_page_flip.c

Use the pipe specific macros to access these registers.

Signed-off-by: Imre Deak <imre.deak@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: add pipe specific macros to access the dsp/palette regs
Imre Deak [Tue, 6 Mar 2012 19:17:18 +0000 (21:17 +0200)]
gfx: drv: add pipe specific macros to access the dsp/palette regs

The registers are pipe specific, so add helpers to properly access them.
The actual register accesses will be fixed up by an upcoming patch.

Signed-off-by: Imre Deak <imre.deak@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 old panel timing register macros
Imre Deak [Tue, 6 Mar 2012 19:17:17 +0000 (21:17 +0200)]
gfx: drv: remove old panel timing register macros

Signed-off-by: Imre Deak <imre.deak@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: use pipe specific macros to access panel timing regs
Imre Deak [Tue, 6 Mar 2012 19:17:16 +0000 (21:17 +0200)]
gfx: drv: use pipe specific macros to access panel timing regs

Use the new pipe specific macros to access these registers.

Signed-off-by: Imre Deak <imre.deak@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: add pipe specific macros to access panel timing regs
Imre Deak [Tue, 6 Mar 2012 19:17:15 +0000 (21:17 +0200)]
gfx: drv: add pipe specific macros to access panel timing regs

The registers are pipe specific, so add helpers to properly access them.
The actual register references will be fixed up by an upcoming patch.

Signed-off-by: Imre Deak <imre.deak@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: move macro to check pipe validity to psb_intel_reg.h
Imre Deak [Tue, 6 Mar 2012 19:17:14 +0000 (21:17 +0200)]
gfx: drv: move macro to check pipe validity to psb_intel_reg.h

This will be needed by the next patch converting other pipe specific
register definitions in psb_intel_reg.h to use this macro.

Signed-off-by: Imre Deak <imre.deak@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 mdfld_wait_for_PIPEA_DISABLE
Imre Deak [Tue, 6 Mar 2012 19:17:13 +0000 (21:17 +0200)]
gfx: drv: remove unused mdfld_wait_for_PIPEA_DISABLE

Signed-off-by: Imre Deak <imre.deak@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 state save/restore functions
Imre Deak [Tue, 6 Mar 2012 19:17:12 +0000 (21:17 +0200)]
gfx: drv: remove unused state save/restore functions

Signed-off-by: Imre Deak <imre.deak@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: Fix race between SGX and page flip
Pauli Nieminen [Thu, 1 Mar 2012 22:40:36 +0000 (00:40 +0200)]
gfx: drv: Fix race between SGX and page flip

There is possible race condition where SGX might have parallel leads
happening while page flip is processing. There is small race condition
open where software managed sync object completion may block SGX from
completing rendering.

The deadlock situation would cause complete system deadlock which isn't
simple to recover from.

Issue: ANDROID-1661
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: Expose helper macro to compare synchronization values
Pauli Nieminen [Thu, 1 Mar 2012 22:40:35 +0000 (00:40 +0200)]
gfx: pvr: Expose helper macro to compare synchronization values

To make it simpler to compare synchronization values safetily expose the
helper macro in a header.

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 an extended sync callback API
Pauli Nieminen [Thu, 1 Mar 2012 22:40:34 +0000 (00:40 +0200)]
gfx: pvr: Add an extended sync callback API

To allow advanced wait for specific pending value that isn't the lates
one caller needs more control for sync callback state. Giving full
control for caller what is in sync struct gives complete control to
caller what is waited for.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Fix unlikely race condition
Pauli Nieminen [Thu, 1 Mar 2012 22:40:33 +0000 (00:40 +0200)]
gfx: drv: Fix unlikely race condition

Checking operation completeness before taking the lock may result to
state where IRQ work is run between checking for completion and before
the callback is added to the list. In practice that race will require
premption because time between microkernel modifying synchronization
object and kernel work check for status is many microseconds.

That could block the last page flip in the animation until next GPU
rendering is pushed from userspace. The missing frame in end of
animation could be extremy visible in some cases.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoFix invalid pointer reference in BUFER_UNDERRUN callback for HDMI Audio.
Anand Saggi [Wed, 29 Feb 2012 14:18:32 +0000 (06:18 -0800)]
Fix invalid pointer reference in BUFER_UNDERRUN callback for HDMI Audio.

A Null pointer was being passed in the buffer underrun event, causing
tablet to crash as the hdmi audio data pointer is expected.

The scenario is reproducible when we plug HDMI during suspended mode
when audio is playing and try to wake up.
This patch will fix the above described issue.

ISSUE: HSD-206962

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoenable parsing detailed timings for EDID rev1.3
Gandhimathi Anand [Wed, 29 Feb 2012 14:18:30 +0000 (06:18 -0800)]
enable parsing detailed timings for EDID rev1.3

Few Detailed Descriptor Timings were missing.
This fix parses through the EDID block 1 for detailed timing
descriptor for EDID revision 1.3. Earlier code was handling
for EDID revision 1.1

ISSUE: HSD-206749

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoPatch to mitigate HDMI Suspend/Resume crash/noise during Audio Playback.
Anand Saggi [Wed, 29 Feb 2012 14:18:29 +0000 (06:18 -0800)]
Patch to mitigate HDMI Suspend/Resume crash/noise during Audio Playback.

We were sending HAD DRM_DPMS_ON event when resuming from sleep state
in gfx_late_resume. Which was causing the HAD HOT_PLUG sequence to
run again causing:
 1. Audio Noise
 2. Random crash.

With this patch, we handle the situation by checking if audio stream
is busy in resume sequence. If yes, we don't send DRM_DPMS_ON in
gfx_late_resume to both Local MIPI and HDMI as we never send
DRM_DPMS_OFF in case HDMI audio is busy becasue of a known JIRA
issue - ANDROID-1553. Otherwise we turn them ON.
After the Jira issue is resolved, we can turn the local MIPI
sequence independent of HDMI Audio state.

Refer JIRA: ANDROID-1553 for more details.

ISSUE: HSD-206943

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoMUST REVERT: Fix the video slowness issue when unplug HDMI.
Hu Tiger Chen [Wed, 29 Feb 2012 14:18:28 +0000 (06:18 -0800)]
MUST REVERT: Fix the video slowness issue when unplug HDMI.

This is caused by the pending flips left in psb_intel_crtc.
After HDMI unplug, vblank interrupt will never be triggered,
where actually pending flips are handled. The solution is to
handle the HDMI pending flips in vblank handler of local display.

ISSUE: ANDROID-1463

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoResume HDMI audio after suspend
Anand Saggi [Wed, 29 Feb 2012 14:18:27 +0000 (06:18 -0800)]
Resume HDMI audio after suspend

HDMI Audio was not getting resumed after suspend. This was
because of changes in early_suspend which was not checking if HDMI
audio is busy and calling DPMS_OFF.

Also there was no check for HDMI busy status check in
psb_runtime_idle, but in psb_runtime_suspend itself.

There is a JIRA BUG: ANDROID-1553 for local MIPI fails to turn back
on from a DPMS off/on cycle if HDMI audio returns busy to disallow
system suspend. Once ANDROID-1553 is fixed, the expectation is to
turn off MIPI but keep display island on if there is active audio
playback over HDMI.
Refer Jira bug# Android-1553 for more details.

There is still HDMI Audio noise during suspend/resume, which
is a known issue.

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoCorrect the VHDMI values inline to OTM HDMI values
Mohan Kandra [Wed, 29 Feb 2012 14:18:25 +0000 (06:18 -0800)]
Correct the VHDMI values inline to OTM HDMI values

Change the VHDMI values as these values in psb are not
inline to OTM HDMI. This will change MSIC VHDMI switch
off time to 0ms, and keeps VHDMI always on. This
is needed as HDMI HPD cannot be pulled up for some HDMI displays.

Signed-off-by: Mohan Kandra <mohan.b.kandra@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: initialize backlight PWM frequency
Jani Nikula [Thu, 1 Mar 2012 14:49:25 +0000 (16:49 +0200)]
gfx: display: initialize backlight PWM frequency

Some DV1s, and DV1.5s and later use I2C to adjust the backlight. We have
PWM based backlight control enabled for compatibility with older, non-CABC
devices. The PWM clock divider was not initialized, causing the PWM signal
to run at the base clock frequency of 19.2 MHz.

Initialize the clock divider, setting the PWM frequency to 9600 Hz. The
panel specification has no recommendation on the frequency, but the bug
ANDROID-1342 has this experimental value.

Issue: ANDROID-1342
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrv: psb: print useful values in the PSB IRQ debug macros.
Oliver McFadden [Tue, 28 Feb 2012 19:39:11 +0000 (21:39 +0200)]
drv: psb: print useful values in the PSB IRQ debug macros.

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 agogfx: drv: avoid NULL deref when enabling PSB debug output.
Oliver McFadden [Thu, 23 Feb 2012 23:07:19 +0000 (01:07 +0200)]
gfx: drv: avoid NULL deref when enabling PSB debug output.

Issue: GRA-43
Signed-off-by: Oliver McFadden <oliver.mcfadden@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrv: gfx: do not use KERN_ALERT for debug messages.
Oliver McFadden [Thu, 23 Feb 2012 21:16:00 +0000 (23:16 +0200)]
drv: gfx: do not use KERN_ALERT for debug messages.

Issue: GRA-39
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: 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>