sgx.git
9 years agofixes for bc_cat master nokia
Grazvydas Ignotas [Thu, 3 Jul 2014 21:47:08 +0000 (00:47 +0300)]
fixes for bc_cat

9 years agoport bc_cat to this driver
Grazvydas Ignotas [Thu, 3 Jul 2014 21:47:08 +0000 (00:47 +0300)]
port bc_cat to this driver

9 years agoadd bc_cat from TI
Grazvydas Ignotas [Thu, 3 Jul 2014 21:47:08 +0000 (00:47 +0300)]
add bc_cat from TI

11 years agoupdate for newer kernel DMA code
Grazvydas Ignotas [Sat, 2 Mar 2013 01:06:46 +0000 (03:06 +0200)]
update for newer kernel DMA code

11 years agostop removing nonexistent proc entry
Grazvydas Ignotas [Tue, 22 May 2012 23:34:10 +0000 (02:34 +0300)]
stop removing nonexistent proc entry

11 years agosupport multibuffering with panning
Grazvydas Ignotas [Sun, 20 May 2012 16:51:23 +0000 (19:51 +0300)]
support multibuffering with panning

it seems performance goes down to ~50% for some things without
multibuffering, weird..

11 years agotry to make ABI compatible with TI 1.4.14.2616/4_00_00_01 release
Grazvydas Ignotas [Sat, 19 May 2012 23:36:56 +0000 (02:36 +0300)]
try to make ABI compatible with TI 1.4.14.2616/4_00_00_01 release

11 years agoRevert "gpu: pvr: remove build time ABI dependency on the EDM trace option"
Grazvydas Ignotas [Sun, 20 May 2012 21:46:11 +0000 (00:46 +0300)]
Revert "gpu: pvr: remove build time ABI dependency on the EDM trace option"

This reverts commit 07595a8ba9f04efa1ff92e5cc7f3b386a34fc510.

11 years agofix out-of-tree build and new kernel support
Grazvydas Ignotas [Sat, 19 May 2012 19:55:34 +0000 (22:55 +0300)]
fix out-of-tree build and new kernel support

11 years agoremove use of features missing in mainline
Grazvydas Ignotas [Sat, 19 May 2012 19:52:27 +0000 (22:52 +0300)]
remove use of features missing in mainline

11 years agomake driver standalone again
Grazvydas Ignotas [Sat, 19 May 2012 19:51:26 +0000 (22:51 +0300)]
make driver standalone again

11 years agomerge in sgx-util.h from n900 tree
Grazvydas Ignotas [Sat, 19 May 2012 15:07:57 +0000 (18:07 +0300)]
merge in sgx-util.h from n900 tree

11 years agogpu: pvr: kick: check for duplicate src syncs
Luc Verhaegen [Wed, 18 May 2011 08:01:40 +0000 (10:01 +0200)]
gpu: pvr: kick: check for duplicate src syncs

When duplicate syncs are present, we deadlock; so check and throw an error
message. Was already fixed in userspace as part of #253237, this now shores
up the kernel too.

Fixes: NB#254225

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: V2: Find and fix all incorrect sync counter completion checks
Alex Crowther [Mon, 23 May 2011 11:46:17 +0000 (12:46 +0100)]
gpu: pvr: V2: Find and fix all incorrect sync counter completion checks

Bugfix for a very rare buffer wrap issue on sync counters
though the use of the wrap safe sync_cnt_after_eq function

Fixes: NB#233069
Signed-off-by: Alex Crowther <alex.crowther@imgtec.com>
11 years agogpu: pvr: fix missing return value warning when CONFIG_BUG=n
Imre Deak [Tue, 19 Apr 2011 16:57:42 +0000 (19:57 +0300)]
gpu: pvr: fix missing return value warning when CONFIG_BUG=n

Although the behaviour after these functions return in a BUG() condition
is undefined, we could still make things somewhat more predictable by
returning the same value every time. Also this way we get rid of the
warning.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix pdumpfs_stream_buffer_clear
Luc Verhaegen [Fri, 1 Apr 2011 11:50:10 +0000 (13:50 +0200)]
gpu: pvr: fix pdumpfs_stream_buffer_clear

Fix tmp[] filling loop so that size == sizeof(tmp) also functions
correctly.

Spotted-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: hwrec: fix hwrec_mem_pages type change warnings
Luc Verhaegen [Fri, 1 Apr 2011 11:47:59 +0000 (13:47 +0200)]
gpu: pvr: hwrec: fix hwrec_mem_pages type change warnings

Last minute change of hwrec_mem_pages, from u32 to unsigned long, was not
build tested due to hwrec_mem dumping now only happening inside
CONFIG_PVR_DEBUG, which was not given a spin before submission.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: debugfs: add registers file
Luc Verhaegen [Fri, 1 Apr 2011 11:45:08 +0000 (13:45 +0200)]
gpu: pvr: debugfs: add registers file

Switches to power state D0 before capturing all registers on open.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: move pdump ioctls to its own range at 192
Luc Verhaegen [Tue, 5 Apr 2011 12:41:26 +0000 (14:41 +0200)]
gpu: pvr: move pdump ioctls to its own range at 192

This removes the shifting of ioctls when enabling pdump builds.

Fixes: NB#247418 - PVR kernel driver IOCTL IDs depend on build configuration

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix init script handling for pdump/non-pdump
Luc Verhaegen [Tue, 5 Apr 2011 12:41:25 +0000 (14:41 +0200)]
gpu: pvr: fix init script handling for pdump/non-pdump

A PDUMP enabled build has SGX_INIT_OP_HALT shift one up in the enum, as its
former position is replaced with SGX_INIT_OP_PDUMP_HW_REG. When kernel and
userspace are out of sync, this leads to rather interesting results since
the init script is run _before_ userspace build options are compared with the
kernel build options.

By moving SGX_INIT_OP_PDUMP_HW_REG, and not masking it behind #ifdef PDUMP,
we get around this issue for good, without in anyway altering the behavior
of a current non-pdump build.

Some extra checking of the init script is now also included to catch and warn
about all possible cases of kernel and userspace being out of sync, with
respect to pdump support (and the new difference in OP_PDUMP_HW_REG). This
way, even if we do not make it to the build option checking, we still know
what went wrong.

This patch requires matching userspace, but only when pdump is enabled.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: move ioctl checking error messagess to pr_err()
Luc Verhaegen [Tue, 5 Apr 2011 12:41:24 +0000 (14:41 +0200)]
gpu: pvr: move ioctl checking error messagess to pr_err()

This way, we get to actually see ioctls failing.

Also, a pointless check is removed: the switch statement that follows
will take care of unhandled cases for us anyway (and now complain about
them verbosely).

Fixes: NB#251136 - PVR: fix IOCTL command ID range checking

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove CommonBridgeInit()
Luc Verhaegen [Tue, 5 Apr 2011 12:41:22 +0000 (14:41 +0200)]
gpu: pvr: remove CommonBridgeInit()

By dynamically assigning the function names in the BridgeDispatchTable, an
extra layer of potential errors (when CommonBridgeInit or
SetSGXDispatchTableEntry is not in full sync with the switch statement in
bridged_ioctl()) is removed.

/proc/pvr/bridge_stats now no longer shows IOCTL names and the function
they are supposed to be mapped to. It now shows actual IOCTL numbers, and
the functions called for them (when called at all). It can debated which is
more useful, but the removal of the extra layer of potential errors wins.

Crucially though, we stop caring about "holes" in IOCTL assignment, which
makes it much easier for me to move pdump ioctls to their own range.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: report IOCTL failures
Imre Deak [Tue, 12 Apr 2011 14:54:26 +0000 (17:54 +0300)]
gpu: pvr: report IOCTL failures

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix memory context refcount problem leading to leaked handle
Imre Deak [Mon, 11 Apr 2011 12:36:31 +0000 (15:36 +0300)]
gpu: pvr: fix memory context refcount problem leading to leaked handle

Although there is an IOCTL interface for creating memory contexts, in
reality processes can create only a single context. Subsequent create
commands will return the same context _and_ the same handle, so this
resembles more of an 'open' command, except the somewhat orthodox way of
returning the same handle.

In addition there can be kernel only users of the context accounted for
by the current reference count of the context (ui32RefCount).

Removing the user handle should happen when the last process opening
(creating) the context calls the close (destroy) command on the handle.
At the moment the handle is removed only if there are no kernel side or
user space users of the context, which can lead to the handle being
leaked in the following case:

1. create memory context -> ctx_handle created, ctx_refcount=1
2. create buffer -> ctx_refcount=2
3. destroy memory context -> ctx_refcount=1, ctx_handle not removed
4. destroy buffer -> ctx_refcount=0, ctx_handle not removed

To avoid this add a counter tracking the number of opens, so we know
when to remove the handle.

Fixes: NB#245525 - Return value of pvr_put_ctx is not checked

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: print the command trace to syslog during HWrec
Imre Deak [Fri, 1 Apr 2011 15:19:04 +0000 (18:19 +0300)]
gpu: pvr: print the command trace to syslog during HWrec

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: add debugfs interface for the command trace
Imre Deak [Fri, 1 Apr 2011 15:18:24 +0000 (18:18 +0300)]
gpu: pvr: add debugfs interface for the command trace

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: add tracing for PVR events
Imre Deak [Fri, 1 Apr 2011 15:17:42 +0000 (18:17 +0300)]
gpu: pvr: add tracing for PVR events

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: add tracing to the SGX queryblits command
Imre Deak [Fri, 1 Apr 2011 15:16:07 +0000 (18:16 +0300)]
gpu: pvr: add tracing to the SGX queryblits command

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: add tracing to the SGX kick and transfer commands
Imre Deak [Fri, 1 Apr 2011 15:23:30 +0000 (18:23 +0300)]
gpu: pvr: add tracing to the SGX kick and transfer commands

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: pass proc info to sgxkick and sgxtransfer
Imre Deak [Fri, 1 Apr 2011 15:13:11 +0000 (18:13 +0300)]
gpu: pvr: pass proc info to sgxkick and sgxtransfer

Needed by the next patch adding tracing to these commands.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: add command tracing support
Imre Deak [Fri, 1 Apr 2011 15:10:36 +0000 (18:10 +0300)]
gpu: pvr: add command tracing support

Add a lightweight tracer to track commands submitted by clients. This
can help for example to debug dead-lock situations where command
synchronization counters form a circular dependency.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: use already existing proc name in pr_err_process info
Imre Deak [Fri, 1 Apr 2011 15:07:33 +0000 (18:07 +0300)]
gpu: pvr: use already existing proc name in pr_err_process info

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: get proc name during process attach time
Imre Deak [Fri, 1 Apr 2011 15:05:39 +0000 (18:05 +0300)]
gpu: pvr: get proc name during process attach time

This will be needed by the upcoming patches where we need a cheap way
to get to the current process name.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: add missing headers to osfunc.h
Imre Deak [Fri, 1 Apr 2011 15:03:46 +0000 (18:03 +0300)]
gpu: pvr: add missing headers to osfunc.h

Headers should include all type info used within the header.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: get rid of unnecessary hash lookups for the proc object
Imre Deak [Fri, 1 Apr 2011 14:59:41 +0000 (17:59 +0300)]
gpu: pvr: get rid of unnecessary hash lookups for the proc object

We already are passed a pointer to the process specific data, so no
need to do an extra hash lookup just for this purpose.

Note that this lookup overhead was incured in each IOCTL command.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <libv@codethink.co.uk>
11 years agogpu: pvr: remove dead code from the PVRSRVGetFBStatsKM code path
Imre Deak [Wed, 30 Mar 2011 12:06:21 +0000 (15:06 +0300)]
gpu: pvr: remove dead code from the PVRSRVGetFBStatsKM code path

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix error path in SysInitialise
Imre Deak [Wed, 30 Mar 2011 11:36:09 +0000 (14:36 +0300)]
gpu: pvr: fix error path in SysInitialise

Add missing check for the mem allocation result.

Fixes: NB#241787 - missing check of return value of OSReservePhys()

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix state buffer validation
Imre Deak [Tue, 29 Mar 2011 17:30:47 +0000 (20:30 +0300)]
gpu: pvr: fix state buffer validation

The incorrect comparison size could cause a corrupted buffer info to be
regarded as valid.

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix error path in MMU_Initialise
Imre Deak [Tue, 29 Mar 2011 17:29:44 +0000 (20:29 +0300)]
gpu: pvr: fix error path in MMU_Initialise

Add missing frees / unmapping at various failure points.

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: optimize mem clear in hash _Resize
Imre Deak [Wed, 30 Mar 2011 11:33:14 +0000 (14:33 +0300)]
gpu: pvr: optimize mem clear in hash _Resize

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix error path in hash _Resize
Imre Deak [Tue, 29 Mar 2011 17:29:12 +0000 (20:29 +0300)]
gpu: pvr: fix error path in hash _Resize

Add missing free in case of _Rehash fails.

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix PVRSRVWrapExtMemoryKM for user provided physical pages
Imre Deak [Tue, 29 Mar 2011 17:26:54 +0000 (20:26 +0300)]
gpu: pvr: fix PVRSRVWrapExtMemoryKM for user provided physical pages

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix error path in PVRSRVOpenDCDeviceKM
Imre Deak [Tue, 29 Mar 2011 17:25:08 +0000 (20:25 +0300)]
gpu: pvr: fix error path in PVRSRVOpenDCDeviceKM

Add missing free.

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: refactor error path in PVRSRVOpenDCDeviceKM
Imre Deak [Tue, 29 Mar 2011 17:25:08 +0000 (20:25 +0300)]
gpu: pvr: refactor error path in PVRSRVOpenDCDeviceKM

Needed by the next patch fixing the error path.

No functional change.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix error path in PVRSRVOpenBCDeviceKM
Imre Deak [Wed, 30 Mar 2011 12:37:04 +0000 (15:37 +0300)]
gpu: pvr: fix error path in PVRSRVOpenBCDeviceKM

Add missing frees / ref count rollback.

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix incorrect free size in PVRSRVOpenBCDeviceKM
Imre Deak [Wed, 30 Mar 2011 12:45:07 +0000 (15:45 +0300)]
gpu: pvr: fix incorrect free size in PVRSRVOpenBCDeviceKM

Also remove the always true condition.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: refactor error path in PVRSRVOpenBCDeviceKM
Imre Deak [Wed, 30 Mar 2011 12:13:08 +0000 (15:13 +0300)]
gpu: pvr: refactor error path in PVRSRVOpenBCDeviceKM

Needed by the next 2 patches fixing the error path.

No functional change.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: fix error path in PVRSRVRegisterBCDeviceKM
Imre Deak [Tue, 29 Mar 2011 17:18:27 +0000 (20:18 +0300)]
gpu: pvr: fix error path in PVRSRVRegisterBCDeviceKM

Fixing a free with incorrect size and converting another one to use
free(p, sizeof(*p)) instead of free(p, sizeof(typeof(*p)).

Reported-by: Coverity
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
11 years agogpu: pvr: reinstate dumping EDM trace to syslog
Imre Deak [Tue, 22 Mar 2011 14:57:04 +0000 (16:57 +0200)]
gpu: pvr: reinstate dumping EDM trace to syslog

Since at the moment we don't have any other means to get the EDM trace
for core-matic reports, dump the trace to syslog, which will be picked
up by the core-matic report generating tool.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: change snprintf to scnprintf
Imre Deak [Tue, 22 Mar 2011 14:18:20 +0000 (16:18 +0200)]
gpu: pvr: change snprintf to scnprintf

snprintf returns how many characters _would_ have been written if there
had been enough space, whereas scnprintf returns the actual numer of
written characters. The latter fits better our use case.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: fix for imgtec simulator
Luc Verhaegen [Fri, 11 Mar 2011 14:02:55 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: fix for imgtec simulator

When full dumping is enabled through init, the simulator throws in the
towel on the dumped CCB wait at the end of initialisation.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add stream_frames debugfs entry
Luc Verhaegen [Fri, 11 Mar 2011 14:02:54 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add stream_frames debugfs entry

A mechanism to read out this data reliably is put in place. And data
is only lost when the stream is no longer being read or when a hard
limit of 1024 frames has been reached when the stream is still open.
In case of missing data, the buffer is padded with "..." to make
up for the missing bytes and to clear mark them.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add stream offset tracking
Luc Verhaegen [Fri, 11 Mar 2011 14:02:53 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add stream offset tracking

Track the size of the stored data, this is split in start and end,
so that the next commit can use the start and end to read out the
stream correctly, even with vanishing frames (where the missing
data can be clearly marked).

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add debugfs entries for the current frame
Luc Verhaegen [Fri, 11 Mar 2011 14:02:52 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add debugfs entries for the current frame

We keep another pointer to the current_frame around, so that the
data in our debugfs files is predictable.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add initial frame handling and debugfs support
Luc Verhaegen [Fri, 11 Mar 2011 14:02:51 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add initial frame handling and debugfs support

This adds the separate handling of the initial frame, and adds
debugfs support for this initial frame.

The initial frame is the frame started when the driver is initialised.
Once userspace flags the first frame, the initial frame is ended, and
a new frame started, but the initial frame is not part of the stream
list. The initial frame therefor does not get culled as part of
standard frame culling and is kept around for the life of the driver.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: start storing pdump data
Luc Verhaegen [Fri, 11 Mar 2011 14:02:50 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: start storing pdump data

Page based allocation, with built in copy_from_user to minimise buffer
copies. Up to 2040 pages of data are kept per frame, if this amount is
exceeded, an error message is printed, and a new frame is created
automatically.

Parameter data is stored inside the same stream as script data, but
is encapsulated in "BIN %08X:"..."-- BIN END".

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: make frame_count_max configurable
Luc Verhaegen [Fri, 11 Mar 2011 14:02:49 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: make frame_count_max configurable

Both through a Kconfig option and through debugfs.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add frame struct and initial frame handling code
Luc Verhaegen [Fri, 11 Mar 2011 14:02:48 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add frame struct and initial frame handling code

Now we are tracking frames correctly, but we are not accepting any data
yet. frame_current is the last of frame_stream, and the frame that we
would be writing to.

New frames are created when userspace flags the start of a new frame
with PDumpSetFrameKM. This is also where we deliberately change the
pdump content by adding two comments. One for flagging the end of the
previous frame, one for the start of the new frame.

We keep at most frame_count_max frames around, older frames will be
removed by frame_cull() which gets called when a new frame gets
created.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add Kconfig and debugfs pdump mode handling
Luc Verhaegen [Fri, 11 Mar 2011 14:02:47 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add Kconfig and debugfs pdump mode handling

This adds the pvr/pdump debugfs subdirectory, and adds two files there:
mode and modes_possible. The modes_possible file is read-only and
lists the different modes (disabled, standard, full). The mode file
is where we read and set the current mode.

Kconfig now provides an option to select the initial mode pdump
is in.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdumpfs: add pdumpfs_mutex
Luc Verhaegen [Fri, 11 Mar 2011 14:02:46 +0000 (15:02 +0100)]
gpu: pvr: pdumpfs: add pdumpfs_mutex

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: move empty back-end into pvr_pdumpfs.[ch]
Luc Verhaegen [Fri, 11 Mar 2011 14:02:45 +0000 (15:02 +0100)]
gpu: pvr: pdump: move empty back-end into pvr_pdumpfs.[ch]

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: silence sparse warnings in sgx_bridge pdump code
Luc Verhaegen [Fri, 11 Mar 2011 14:02:44 +0000 (15:02 +0100)]
gpu: pvr: pdump: silence sparse warnings in sgx_bridge pdump code

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: rename PDumpMem2KM to PDumpPageTableKM
Luc Verhaegen [Fri, 11 Mar 2011 14:02:43 +0000 (15:02 +0100)]
gpu: pvr: pdump: rename PDumpMem2KM to PDumpPageTableKM

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove unused arguments
Luc Verhaegen [Fri, 11 Mar 2011 14:02:42 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove unused arguments

The eDeviceType passed to SysCpuPAddrToDevPAddr is not used by
SysCpuPAddrToDevPAddr at all. So stop passing eDeviceType to pdump
functions.

In the other cases, hUniqueTag is very unique indeed.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: move pdump.c and pdump_km.h to pvr_pdump.[ch]
Luc Verhaegen [Fri, 11 Mar 2011 14:02:41 +0000 (15:02 +0100)]
gpu: pvr: pdump: move pdump.c and pdump_km.h to pvr_pdump.[ch]

Also make pvr_pdump.c build fully conditional.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: rewrite PDumpMemUM()
Luc Verhaegen [Fri, 11 Mar 2011 14:02:40 +0000 (15:02 +0100)]
gpu: pvr: pdump: rewrite PDumpMemUM()

Now that we have cleared up the streams, we can delay the copy_from_user()
until copying into the streams. This makes PDumpMemUM highly similar to
PDumpMemKM.

So, split out the printing part from PDumpMemKM, and handle parameter
stream dumping separately for PDumpMemKM and PDumpMemUM.

In turn, this allows the removal of the separate buffer which was the
heart of pdump_common.c, which is removed as well.

No functional change.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: sanitise stream handling
Luc Verhaegen [Fri, 11 Mar 2011 14:02:39 +0000 (15:02 +0100)]
gpu: pvr: pdump: sanitise stream handling

Upper level pdump calls now have pdump_print and pdump_dump to their
disposal. The former dumps strings, the second dumps raw data to
the pdump stream.

This commit also sanitises debug mode handling to have disabled,
standard and full modes only.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove page offset juggling
Luc Verhaegen [Fri, 11 Mar 2011 14:02:38 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove page offset juggling

The offset from the start of the page never changes when changing
address spaces, just the page address changes.

If an out of place assert is removed, (as all it could change is
the address printed in an error message), then BM_GetPhysPageAddr()
takes any address, and returns the physical address of the page.
It can deal with an offset, and will return the page address
without offset.

These two facts were used to reduce the address wrangling logic even
further.

An obviously wrong masking was fixed in PDumpMem2KM.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: clean up logic across pdump.c
Luc Verhaegen [Fri, 11 Mar 2011 14:02:37 +0000 (15:02 +0100)]
gpu: pvr: pdump: clean up logic across pdump.c

This patch is the least obvious of the set. It removes useless
variables, superfluous calculations, cleans up loops, and makes a few
functions wrap others instead of copying them.

Should be no functional change, but as said, very non-obvious.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: assume that SGX_MMU_PAGE_SIZE equals PAGE_SIZE
Luc Verhaegen [Fri, 11 Mar 2011 14:02:36 +0000 (15:02 +0100)]
gpu: pvr: pdump: assume that SGX_MMU_PAGE_SIZE equals PAGE_SIZE

This way, the address mangling code becomes a lot clearer.

The following changes are made:
SGX_MMU_PAGE_SIZE -> PAGE_SIZE.
SGX_MMU_PDE_ADDR_MASK -> PAGE_MASK
~(PAGE_SIZE - 1) -> PAGE_MASK
(Address >> SGX_MMU_PAGE_SHIFT) * PAGE_SIZE -> Address & PAGE_MASK

A few functions which get SGX_MMU_PAGE_SIZE passed lose this
argument and use PAGE_SIZE internally.

No functional changes on machines where PAGE_SIZE is the same for
the host as for the sgx.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: review use of PDumpSuspended
Luc Verhaegen [Fri, 11 Mar 2011 14:02:35 +0000 (15:02 +0100)]
gpu: pvr: pdump: review use of PDumpSuspended

PDumpSuspended is handled by pdump_write() now.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove param offset handling
Luc Verhaegen [Fri, 11 Mar 2011 14:02:34 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove param offset handling

Currently, we are not storing any data, but in future, we will be
storing both script and param to the same stream. This removes the
need to reference the param stream from the script stream, and the
logical issues that arise from this, especially in light of frame
based storage, with frame culling happening.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: rewrite PDumpCommentKM
Luc Verhaegen [Fri, 11 Mar 2011 14:02:33 +0000 (15:02 +0100)]
gpu: pvr: pdump: rewrite PDumpCommentKM

And turn some standard printing where the strings starts with "--"
into comments.

No functional change.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: rewrite PDumpWriteString2() to pdump_print()
Luc Verhaegen [Fri, 11 Mar 2011 14:02:32 +0000 (15:02 +0100)]
gpu: pvr: pdump: rewrite PDumpWriteString2() to pdump_print()

Making pdump_print accept variable arguments directly significantly
simplifies string printing to script, throughout the whole of pdump.c

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: reduce error propagation from pdump to userspace
Luc Verhaegen [Fri, 11 Mar 2011 14:02:31 +0000 (15:02 +0100)]
gpu: pvr: pdump: reduce error propagation from pdump to userspace

When pdump logging fails, the driver should, as much as possible,
continue working. Bad arguments should however be flagged.

This allows for a rewrite of DbgWrite()/PdumpWriteILock() to pdump_write().

Also remove the parameter write in PDumpPDDevPAddrKM, this parameter data
is simply not referenced and the data sent to the script anyway.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: move functions around to better reflect dependencies
Luc Verhaegen [Fri, 11 Mar 2011 14:02:30 +0000 (15:02 +0100)]
gpu: pvr: pdump: move functions around to better reflect dependencies

This way, no prototypes have to be provided, and the use of PDUMP
macros is also avoided.

No functional changes.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove pdump marker code
Luc Verhaegen [Fri, 11 Mar 2011 14:02:29 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove pdump marker code

This was used to signal to the userspace tool that the parameter stream
has grown beyond 1GB. We can handle files bigger than that in our world.

No functional change, as far as the services module is concerned.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove wrapping of globals in pdump.c
Luc Verhaegen [Fri, 11 Mar 2011 14:02:28 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove wrapping of globals in pdump.c

The gsDBGPdumpState struct just clutters up the place.

No functional change.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove dbgdrv
Luc Verhaegen [Fri, 11 Mar 2011 14:02:27 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove dbgdrv

Remove now unused dbgdrv files, and set the pdump Kconfig option to bool.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: stop depending on dbgdrvif.h
Luc Verhaegen [Fri, 11 Mar 2011 14:02:26 +0000 (15:02 +0100)]
gpu: pvr: pdump: stop depending on dbgdrvif.h

Stop including dbgdrvif.h in pdump.c and add empty skeleton for
former dbgdrv functionality.

So replace the pointer with callbacks with locally defined, mostly
empty, functions. Provide stripped down struct DBG_STREAM and define
the still referenced flags inside pdump.c.

Only functional change is that the dbgdrv module and the pdump
userspace utility are now completely useless.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove lastframe support
Luc Verhaegen [Fri, 11 Mar 2011 14:02:25 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove lastframe support

Userspace does not use this, so no functional change.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove unused pdump functions
Luc Verhaegen [Fri, 11 Mar 2011 14:02:24 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove unused pdump functions

Checked symbols and defines in pdump_km.h, and removed them when unused.
sparse then flagged the unused functions in pdump.c and pdump_common.c

No functional change.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: remove unused bridge calls
Luc Verhaegen [Fri, 11 Mar 2011 14:02:23 +0000 (15:02 +0100)]
gpu: pvr: pdump: remove unused bridge calls

Userspace never calls _PDUMP_DRIVERINFO, _PDUMP_DUMPREADREG,
_PDUMP_STARTINITPHASE, or _PDUMP_STOPINITPHASE. So remove the
respective handlers and the pdump code.

No functional change.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: consolidate some code inside PDUMP defines
Luc Verhaegen [Fri, 11 Mar 2011 14:02:22 +0000 (15:02 +0100)]
gpu: pvr: pdump: consolidate some code inside PDUMP defines

No functional changes.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pdump: SYS_DATA::bPowerUpPDumped is unused
Luc Verhaegen [Fri, 11 Mar 2011 14:02:21 +0000 (15:02 +0100)]
gpu: pvr: pdump: SYS_DATA::bPowerUpPDumped is unused

Nothing in the graphics stack uses this.

Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: debugfs: add hwrec status buffer dumping
Luc Verhaegen [Tue, 22 Mar 2011 11:38:38 +0000 (12:38 +0100)]
gpu: pvr: debugfs: add hwrec status buffer dumping

Move code over from sgxinit.c, and dump status buffers in binary format
to a debugfs file instead of sending it as %08X's to syslog.

Shares process info from the top level now, instead of acquiring this
information several times. This now also prints the caller of the
HWRecovery routine.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: debugfs: add hwrec edm trace
Luc Verhaegen [Tue, 22 Mar 2011 11:38:37 +0000 (12:38 +0100)]
gpu: pvr: debugfs: add hwrec edm trace

And move all edm trace printing code to pvr_debugfs.c; since now only
debugfs/pvr/edm_trace and debugfs/pvr/hwrec_edm use it.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: debugfs: add hwrec context dump
Luc Verhaegen [Tue, 22 Mar 2011 11:38:36 +0000 (12:38 +0100)]
gpu: pvr: debugfs: add hwrec context dump

A full context is now provided through hwrec_mem. This includes
page directory, page tables and all mapped pages.

This code is only built when debugfs is enabled, and when build type
is "Debug".

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: debugfs: add hwrec register dump
Luc Verhaegen [Tue, 22 Mar 2011 11:38:35 +0000 (12:38 +0100)]
gpu: pvr: debugfs: add hwrec register dump

Full register dump available after hwrec event in the file hwrec_regs.

The full register page is read out, except [0xA08,0xA50] as this range
results in a SIGBUS.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: debugfs: add initial hwrec dumping infrastructure
Luc Verhaegen [Tue, 22 Mar 2011 11:38:34 +0000 (12:38 +0100)]
gpu: pvr: debugfs: add initial hwrec dumping infrastructure

Currently contains hwrec_event and hwrec_time.

hwrec_event blocks the reader until a hwrec event happens. This allows
a simple shell application to sleep until a hwrec happens.

hwrec_time contains a timestamp to enable a simple shell application
to create unique dumps.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: move debugfs infrastructure to its own files
Luc Verhaegen [Tue, 22 Mar 2011 11:38:33 +0000 (12:38 +0100)]
gpu: pvr: move debugfs infrastructure to its own files

pvr_debug.* originally only provided some contrived code (which needs
sanitation) to do debug printing.

Future HW Recovery code will also be using debugfs and it makes sense
to lump all of them together in pvr_debugfs.*

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix error path during SGX device initialization
Imre Deak [Mon, 14 Mar 2011 16:12:24 +0000 (18:12 +0200)]
gpu: pvr: fix error path during SGX device initialization

This also fixes some coverity reports.

Fixes: NB#233667 - Dereferencing possibly NULL pointer in sgxinit.c

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: disable sgx active power management while pvrtune is running
Alex Crowther [Mon, 7 Mar 2011 13:14:06 +0000 (13:14 +0000)]
gpu: pvr: disable sgx active power management while pvrtune is running

Disable sgx active power management while sgxPerfServer is running.
This enables pvrtune to run correctly without data loss.

Signed-off-by: Alex Crowther <alex.crowther@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: improve per process procfs entry/dir handling
Luc Verhaegen [Mon, 21 Feb 2011 12:07:26 +0000 (13:07 +0100)]
gpu: pvr: improve per process procfs entry/dir handling

When building with full debug, a lot of "Resource Arena" (ra) data is
being made available in the rather painful procfs, including per process
ra info, kept in process specific subdirectories.

Adding and removing process specific entries from procfs took the PID of
the currently running process; which sometimes failed during cleanup,
when the current process might no longer be anything tracked by the
driver. This then resulted in some strange behaviour, where it was
impossible to cleanup a process specific procfs directory, resulting
in an endless loop.

Since process specific procfs entries are only created in the RA code,
we now track the pid in the RA struct. When we pass this pid to
both the procfs entry creation and removal functions, we now do
reliably clean up the procfs entries.

Signed-off-by: Luc Verhaegen <libv@codethink.co.uk>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: dump render status buffers during SGX HW recovery
Imre Deak [Wed, 9 Feb 2011 15:17:55 +0000 (17:17 +0200)]
gpu: pvr: dump render status buffers during SGX HW recovery

To aid debugging, dump any status buffers that are provided by the
ogles user space library for the rendering context that was active
at the time of recovery. At the moment the USSE final patched
versions of vertex and fragment shaders that were bound within the
frame causing the HWRec are provided, but later on more types can be
added.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: refactor dump_process_info
Imre Deak [Wed, 9 Feb 2011 07:58:13 +0000 (09:58 +0200)]
gpu: pvr: refactor dump_process_info

Split out from the function the part getting the process data based on
the current SHX HW memory context. This functionality will be needed by
an upcoming patch.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove ABI compatibility hack from SGXKick IOCTL
Imre Deak [Wed, 9 Feb 2011 23:50:49 +0000 (01:50 +0200)]
gpu: pvr: remove ABI compatibility hack from SGXKick IOCTL

By now everyone should have a recent enough kernel/user space library,
so this isn't needed.

This will revert the compatibility fixup parts of the following commit:
99baad807: Increase the max number of 3D TA status vals in kick reque

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove ABI compatibility hack from SGXInitPart2 IOCTL
Imre Deak [Wed, 9 Feb 2011 23:43:50 +0000 (01:43 +0200)]
gpu: pvr: remove ABI compatibility hack from SGXInitPart2 IOCTL

By now everyone should have a recent enough kernel/user space library,
so this isn't needed.

This reverts commit 743ccd092b08b1e033c0a95648033afa057887d8.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: print some init failure messages in release mode too
Imre Deak [Mon, 13 Dec 2010 17:40:38 +0000 (19:40 +0200)]
gpu: pvr: print some init failure messages in release mode too

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: add debugfs entry to read the EDM trace
Imre Deak [Tue, 14 Dec 2010 00:54:24 +0000 (02:54 +0200)]
gpu: pvr: add debugfs entry to read the EDM trace

Signed-off-by: Imre Deak <imre.deak@nokia.com>