xf86-video-intel: src/sna/sna_accel.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Sep 2 02:16:06 PDT 2012
src/sna/sna_accel.c | 46 +++++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 13 deletions(-)
New commits:
commit 62e7e69d88f7e5c8b0f0931fe887ee0c3bddb43f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Sep 2 09:55:07 2012 +0100
sna: Tweak placement rules if we already have a CPU bo
If we have a CPU bo, consider if it may be quicker to render to it then
create a GPU bo.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 7c598f1..bb7cda2 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2427,23 +2427,43 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
goto use_cpu_bo;
}
- if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo)) {
- DBG(("%s: already using CPU bo, will not force allocation\n",
- __FUNCTION__));
- goto use_cpu_bo;
- }
+ if ((flags & IGNORE_CPU) == 0) {
+ if (priv->cpu_bo) {
+ if (to_sna_from_pixmap(pixmap)->kgem.can_blt_cpu) {
+ if (kgem_bo_is_busy(priv->cpu_bo)) {
+ DBG(("%s: already using CPU bo, will not force allocation\n",
+ __FUNCTION__));
+ goto use_cpu_bo;
+ }
- if (priv->cpu_damage && flags == 0) {
- DBG(("%s: prefer cpu", __FUNCTION__));
- goto use_cpu_bo;
- }
+ if ((flags & RENDER_GPU) == 0) {
+ DBG(("%s: prefer cpu", __FUNCTION__));
+ goto use_cpu_bo;
+ }
+ } else {
+ if (kgem_bo_is_busy(priv->cpu_bo)) {
+ DBG(("%s: CPU bo active, must force allocation\n",
+ __FUNCTION__));
+ goto create_gpu_bo;
+ }
+ }
+ }
- if (priv->cpu_damage && !box_inplace(pixmap, box)) {
- DBG(("%s: damaged with a small operation, will not force allocation\n",
- __FUNCTION__));
- goto use_cpu_bo;
+ if (priv->cpu_damage) {
+ if ((flags & (PREFER_GPU | FORCE_GPU)) == 0) {
+ DBG(("%s: prefer cpu", __FUNCTION__));
+ goto use_cpu_bo;
+ }
+
+ if (!box_inplace(pixmap, box)) {
+ DBG(("%s: damaged with a small operation, will not force allocation\n",
+ __FUNCTION__));
+ goto use_cpu_bo;
+ }
+ }
}
+create_gpu_bo:
move = MOVE_WRITE | MOVE_READ;
if (flags & FORCE_GPU)
move |= __MOVE_FORCE;
More information about the xorg-commit
mailing list