History log of /external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
78222e63630280b96488de0d51d1b2578e26f814 30-Jan-2013 Jerome Glisse <jglisse@redhat.com> r600g: add cs memory usage accounting and limit it v3 (backport for mesa 9.0)

We are now seing cs that can go over the vram+gtt size to avoid
failing flush early cs that goes over 70% (gtt+vram) usage. 70%
is use to allow some fragmentation.

The idea is to compute a gross estimate of memory requirement of
each draw call. After each draw call, memory will be precisely
accounted. So the uncertainty is only on the current draw call.
In practice this gave very good estimate (+/- 10% of the target
memory limit).

v2: Remove left over from testing version, remove useless NULL
checking. Improve commit message.
v3: Add comment to code on memory accounting precision

This version is a backport for mesa 9.0

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
f6a66a33f7ba52e36242db9346573bf477efa04e 19-Sep-2012 Vadim Girlin <vadimgirlin@gmail.com> winsys/radeon: fix relocs caching

Don't cache pointers to elements of reallocatable array.
In some circumstances it caused false cache hits resulting in incorrect
command stream and gpu lockup.

Note: This is a candidate for the stable branches.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
(cherry picked from commit 9aa8bac98b823e8783bc3a06a6e5b23fbf8d87fb)
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
a7f4d3b740d4c85b0dc2b006c30c2bc4a3ed8597 04-Aug-2012 Marek Olšák <maraeo@gmail.com> winsys/radeon: print error if CS is overflowed

and don't submit the CS to the kernel.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
92af184690995d3b16731518f7becfaac3538edb 21-May-2012 Christian König <deathsimple@vodafone.de> winsys/radeon: enable IB submission to compute rings v2

This allows to submit things to the compute only
rings on cayman+

v2: rebased on current master and actually make use
of the new flag in evergreen_compute.c

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
6bb0151f1fd87b4e15f177c7122fc28fea29497e 22-May-2012 Maarten Lankhorst <m.b.lankhorst@gmail.com> winsys/radeon: Remove unnecessary pipe_thread_destroy in radeon_drm_cs_destroy

Fixes crash bug introduced with 210ddf0819b5 fd.o #49198
pthread_detach after a pthread_join is unneeded.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
29e55bc5f1b6d7375b6a86e24ca4ae58e399011e 26-Feb-2012 Marek Olšák <maraeo@gmail.com> winsys/radeon: add usage parameter to cs_is_buffer_referenced

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
bb1f0cf3508630a9a93512c79badf8c493c46743 02-Dec-2011 Jerome Glisse <jglisse@redhat.com> r600g: add support for virtual address space on cayman v11

Virtual address space put the userspace in charge of their GPU
address space. It's up to userspace to bind bo into the virtual
address space. Command stream can them be executed using the
IB_VM chunck.

This patch add support for this configuration. It doesn't remove
the 64K ib size limit thought this limit can be extanded up to
1M for IB_VM chunk.

v2: fix rendering
v3: fix rendering when using index buffer
v4: make vm conditional on kernel support add basic va management
v5: catch the case when we already have va for a bo
v6: agd5f: update on top of ioctl changes
v7: agd5f: further ioctl updates
v8: indentation cleanup + fix non cayman
v9: rebase against lastest mesa + improvement from Marek & Michel
v10: fix cut/paste bug
v11: don't rely on updated radeon_drm.h

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
93f4e3cb6c1ca303ee1f5c2a2491a8eff33f2633 24-Dec-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: move managing GEM domains back to drivers

This partially reverts commit 363ff844753c46ac9c13866627e096b091ea81f8.

It caused severe performance drops in Nexuiz. Reported by Phoronix.

Tested by me on r300g and by IRC people on r600g.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
41b75dc92c921c078e64962f47b3d51b1e4f7b5a 25-Oct-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: add flush option not to rewrite tiling flags in registers

Not used yet.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
363ff844753c46ac9c13866627e096b091ea81f8 27-Sep-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: move GEM domains out of the drivers into winsys

The drivers don't need to care about the domains. All they need to set
are the bind and usage flags. This simplifies the winsys too.

This also fixes on r600g:
- fbo-depth-GL_DEPTH_COMPONENT32F-copypixels
- fbo-depth-GL_DEPTH_COMPONENT16-copypixels
- fbo-depth-GL_DEPTH_COMPONENT24-copypixels
- fbo-depth-GL_DEPTH_COMPONENT32-copypixels
- fbo-depth-GL_DEPTH24_STENCIL8-copypixels
I can't explain it.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
a3cd2c6c9b3724dbc3aa565dab98968c46bde963 27-Sep-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: remove redundant member radeon_bo::size

It's part of pb_buffer already.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
798ebc91ebe383a702faf597ffbf2033dc467f50 27-Sep-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: simplify updating GEM domains for relocations
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
210ddf0819b5acf87a614214b6d4b02193aafa4a 27-Aug-2011 Maarten Lankhorst <m.b.lankhorst@gmail.com> winsys/radeon: Create async thread only once

I noticed that a thread was created for every time async flush was called, so I moved it and used some semaphores to synch.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
296b8990956fcbd7ce47902d7c108a5973db9397 07-Aug-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: remove broken bo-is-busy-for-write guessing

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
e2e1dc9e66ff348caa97b7b35e558d75c6cc6899 04-Aug-2011 Marek Olšák <maraeo@gmail.com> r600g: set the flush callback in radeon_winsys

I have also renamed the winsys function.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
03b25ad8ffd72f1f88b6c80a2ebfe3cf6e8a6390 04-Aug-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: consolidate the add_reloc function

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
e6fb62594fca714883af9bba9795be8838c16900 04-Aug-2011 Marek Olšák <maraeo@gmail.com> r600g: emit CS using radeon_winsys

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
638d75185e66727faaba5dc2df1b6e14c7c0c075 03-Aug-2011 Marek Olšák <maraeo@gmail.com> r600g: let radeon_winsys maintain the list of relocations

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
5b005ecc2b624a0ffb577ab760abacf069694f8d 03-Aug-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: do the CS cleanup in the CS ioctl thread
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
64ab39b035f755510a644643b96451431bbe5f27 03-Aug-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: fix space checking

We should remove the relocations which caused a validation failure
from the list, so that the kernel receives only the validated ones.

NOTE: This is a candidate for the 7.11 branch.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
28a336dc38c478b809544e7404c4d1fddd873333 22-Jul-2011 Marek Olšák <maraeo@gmail.com> winsys/radeon: simplify how value queries work

This drops the get_value query and adds a function query_info, which returns
all the values in one nice structure.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
d35aeff4bb0b03450b2c3c08bd7f84db5bf43283 18-Apr-2011 Marek Olšák <maraeo@gmail.com> r300g/winsys: rename r300->radeon and do a little cleanup

Renaming a few files, types, and functions.
Also make the winsys independent of r300g.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
aac4bae98651c928ce298aecf158b0aa1a7fabce 08-Apr-2011 Marek Olšák <maraeo@gmail.com> r300g: fix crash when adding a new relocation

No idea why it's so hard to reproduce.
Broken with: c35572352e3e92683988ee8d151b47f4190d62f9

Thanks to Toni Spets for assistance.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
9d5de0fcb6ced7a4da85a09ad25dcbc2b21bfdf9 07-Apr-2011 Marek Olšák <maraeo@gmail.com> r300g: add 'radeon: ' prefix to error messages in winsys
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
6caac3ecb8bc32d92c35fdb1f0a67541ffa8af29 03-Apr-2011 Marek Olšák <maraeo@gmail.com> r300g: do not wait for a busy BO if neither GPU nor CPU is changing it

Improves frame rate in apps with at least one user vertex buffer and
a hw index buffer.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
c35572352e3e92683988ee8d151b47f4190d62f9 03-Apr-2011 Marek Olšák <maraeo@gmail.com> r300g: remove the redundant reference counter in radeon_bo

We already have pb_buffer::reference::count.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
5650a719f0c69c00954e47bd7a7b3e9433cb551d 08-Mar-2011 Marek Olšák <maraeo@gmail.com> r300g: decide whether a flush should be asynchronous when calling it

Thread offloading is not sometimes desirable, e.g. when mapping a buffer.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
f6dbcb92bf4a3597c7b3da890ffafc84951f25df 02-Mar-2011 Marek Olšák <maraeo@gmail.com> r300g: do not use ioctl thread offloading on single-core machines
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
e9e5380f22c230ea1276208baa40c3fe6482b296 19-Feb-2011 Marek Olšák <maraeo@gmail.com> r300g: fix invalid dereference in winsys

radeon_bo_unref may destroy the buffer, so call it after p_atomic_dec, not before.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
fa3f1348e49feeac511dbe5b22bbddc47f56ba81 16-Feb-2011 Marek Olšák <maraeo@gmail.com> r300g: fix a race between CS and SET_TILING ioctls
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
b9e2cde6006b557a3a23a82384899f4d5a5ac7b8 15-Feb-2011 Marek Olšák <maraeo@gmail.com> r300g: offload the CS ioctl to another thread

This is a multi-threading optimization which hides the kernel overhead
behind a thread. It improves performance in CPU-limited apps by 2-15%.
Of course you must have at least 2 cores for it to make any difference.

It can be disabled with:

export RADEON_THREAD=0
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
df54b53b7d12a3bca5867b6649cb308feb36f0da 11-Feb-2011 Marek Olšák <maraeo@gmail.com> r300g: improve function radeon_bo_is_referenced_by_cs

This should prevent calling into radeon_get_reloc when there's
only one context.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
6ccab620a0e7364ab6c0d902b3ddf58ee988f7fa 23-Dec-2010 Marek Olšák <maraeo@gmail.com> r300g: import the last bits of libdrm and cleanup the whole thing

Based on Dave's branch.

The majority of this commit is a cleanup, mainly renaming things.
There wasn't much code to import, just ioctl calls.

Also done:
- implemented unsynchronized bo_map (important optimization!)
- radeon_bo_is_referenced_by_cs is no longer a refcount hack
- dropped the libdrm_radeon dependency

I'm surprised that this has resulted in less code in the end.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
1f0348c4a2ba4f8ca812a2daccf3b01c3f984ef1 04-Dec-2010 Marek Olšák <maraeo@gmail.com> r300g: rework command submission and resource space checking

The motivation behind this rework is to get some speed by reducing
CPU overhead. The performance increase depends on many factors,
but it's measurable (I think it's about 10% increase in Torcs).

This commit replaces libdrm's radeon_cs_gem with our own implemention.
It's optimized specifically for r300g, but r600g could use it as well.
Reloc writes and space checking are faster and simpler than their
counterparts in libdrm (the time complexity of all the functions
is O(1) in nearly all scenarios, thanks to hashing).
(libdrm's radeon_bo_gem is still being used in the driver.)

It works like this:

cs_add_reloc(cs, buf, read_domain, write_domain) adds a new relocation and
also adds the size of 'buf' to the used_gart and used_vram winsys variables
based on the domains, which are simply or'd for the accounting purposes.
The adding is skipped if the reloc is already present in the list, but it
accounts any newly-referenced domains.

cs_validate is then called, which just checks:
used_vram/gart < vram/gart_size * 0.8
The 0.8 number allows for some memory fragmentation. If the validation
fails, the pipe driver flushes CS and tries do the validation again,
i.e. it validates only that one operation. If it fails again, it drops
the operation on the floor and prints some nasty message to stderr.

cs_write_reloc(cs, buf) just writes a reloc that has been added using
cs_add_reloc. The read_domain and write_domain parameters have been removed,
because we already specify them in cs_add_reloc.

The space checking has been tested by putting small values in vram/gart_size
variables.
/external/mesa3d/src/gallium/winsys/radeon/drm/radeon_drm_cs.c