xf86-video-intel: 2 commits - src/sna/gen6_render.c src/sna/gen7_render.c src/sna/kgem.c src/sna/kgem.h src/sna/sna_dri.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Jan 2 08:43:09 PST 2013
src/sna/gen6_render.c | 26 ++++++++++++++------------
src/sna/gen7_render.c | 26 ++++++++++++++------------
src/sna/kgem.c | 9 +++++++++
src/sna/kgem.h | 5 +++++
src/sna/sna_dri.c | 6 +-----
5 files changed, 43 insertions(+), 29 deletions(-)
New commits:
commit fc702cdf534a4694a64408428e8933497a7fc06e
Author: Matt Turner <mattst88 at gmail.com>
Date: Wed Jan 2 16:07:54 2013 +0000
sna: Rewrite __fls without dependence upon x86 assembly
The asm() prevents SNA from compiling on ia64.
Fixes https://bugs.gentoo.org/show_bug.cgi?id=448570
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 3cc79d3..80f25b8 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -516,10 +516,19 @@ static void gem_close(int fd, uint32_t handle)
constant inline static unsigned long __fls(unsigned long word)
{
+#if defined(__GNUC__) && (defined(__x86__) || defined(__x86_64__))
asm("bsr %1,%0"
: "=r" (word)
: "rm" (word));
return word;
+#else
+ unsigned int v = 1;
+
+ while (word >>= 1)
+ v++;
+
+ return v;
+#endif
}
constant inline static int cache_bucket(int num_pages)
commit bc67bdcec832f4302951f2789456666dee2f496c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Jan 2 13:47:51 2013 +0000
sna/gen6+: Fine tune placement of DRI copies
Avoid offsetting the overhead of the render copy only to be penalised by
the overhead of the semaphore. So compromise.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 77bd853..a4b5746 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1772,7 +1772,8 @@ gen6_composite_set_target(struct sna *sna,
}
inline static bool can_switch_to_blt(struct sna *sna,
- struct kgem_bo *bo)
+ struct kgem_bo *bo,
+ unsigned flags)
{
if (sna->kgem.ring != KGEM_RENDER)
return true;
@@ -1783,6 +1784,9 @@ inline static bool can_switch_to_blt(struct sna *sna,
if (!sna->kgem.has_semaphores)
return false;
+ if (flags & COPY_LAST)
+ return true;
+
if (bo && RQ_IS_BLT(bo->rq))
return true;
@@ -1803,9 +1807,10 @@ static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo)
}
inline static bool prefer_blt_ring(struct sna *sna,
- struct kgem_bo *bo)
+ struct kgem_bo *bo,
+ unsigned flags)
{
- return can_switch_to_blt(sna, bo);
+ return can_switch_to_blt(sna, bo, flags);
}
static bool
@@ -1824,7 +1829,7 @@ try_blt(struct sna *sna,
return true;
}
- if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL))
+ if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
return true;
return false;
@@ -2045,7 +2050,7 @@ prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
untiled_tlb_miss(tmp->src.bo))
return true;
- if (!prefer_blt_ring(sna, tmp->dst.bo))
+ if (!prefer_blt_ring(sna, tmp->dst.bo, 0))
return false;
return (prefer_blt_bo(sna, tmp->dst.bo) | prefer_blt_bo(sna, tmp->src.bo)) > 0;
@@ -2454,17 +2459,14 @@ static inline bool prefer_blt_copy(struct sna *sna,
if (sna->kgem.ring == KGEM_BLT)
return true;
- if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo))
- return true;
-
- if ((flags & COPY_LAST && sna->kgem.ring != KGEM_RENDER))
+ if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo, flags))
return true;
if (untiled_tlb_miss(src_bo) ||
untiled_tlb_miss(dst_bo))
return true;
- if (!prefer_blt_ring(sna, dst_bo))
+ if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
return (prefer_blt_bo(sna, src_bo) >= 0 &&
@@ -2549,7 +2551,7 @@ fallback_blt:
if (too_large(extents.x2-extents.x1, extents.y2-extents.y1))
goto fallback_blt;
- if ((flags & COPY_LAST || can_switch_to_blt(sna, dst_bo)) &&
+ if (can_switch_to_blt(sna, dst_bo, flags) &&
sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
@@ -2877,7 +2879,7 @@ static inline bool prefer_blt_fill(struct sna *sna,
if (untiled_tlb_miss(bo))
return true;
- return prefer_blt_ring(sna, bo) || prefer_blt_bo(sna, bo) >= 0;
+ return prefer_blt_ring(sna, bo, 0) || prefer_blt_bo(sna, bo) >= 0;
}
static bool
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 478a252..badce91 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1896,7 +1896,8 @@ gen7_composite_set_target(struct sna *sna,
}
inline static bool can_switch_to_blt(struct sna *sna,
- struct kgem_bo *bo)
+ struct kgem_bo *bo,
+ unsigned flags)
{
if (sna->kgem.ring != KGEM_RENDER)
return true;
@@ -1907,6 +1908,9 @@ inline static bool can_switch_to_blt(struct sna *sna,
if (!sna->kgem.has_semaphores)
return false;
+ if (flags & COPY_LAST)
+ return true;
+
if (bo && RQ_IS_BLT(bo->rq))
return true;
@@ -1927,9 +1931,10 @@ static int prefer_blt_bo(struct sna *sna, struct kgem_bo *bo)
}
inline static bool prefer_blt_ring(struct sna *sna,
- struct kgem_bo *bo)
+ struct kgem_bo *bo,
+ unsigned flags)
{
- return can_switch_to_blt(sna, bo);
+ return can_switch_to_blt(sna, bo, flags);
}
static bool
@@ -1948,7 +1953,7 @@ try_blt(struct sna *sna,
return true;
}
- if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL))
+ if (sna_picture_is_solid(src, NULL) && can_switch_to_blt(sna, NULL, 0))
return true;
return false;
@@ -2169,7 +2174,7 @@ prefer_blt_composite(struct sna *sna, struct sna_composite_op *tmp)
untiled_tlb_miss(tmp->src.bo))
return true;
- if (!prefer_blt_ring(sna, tmp->dst.bo))
+ if (!prefer_blt_ring(sna, tmp->dst.bo, 0))
return false;
return (prefer_blt_bo(sna, tmp->dst.bo) | prefer_blt_bo(sna, tmp->src.bo)) > 0;
@@ -2555,17 +2560,14 @@ static inline bool prefer_blt_copy(struct sna *sna,
if (sna->kgem.ring == KGEM_BLT)
return true;
- if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo))
- return true;
-
- if ((flags & COPY_LAST && sna->kgem.ring != KGEM_RENDER))
+ if (src_bo == dst_bo && can_switch_to_blt(sna, dst_bo, flags))
return true;
if (untiled_tlb_miss(src_bo) ||
untiled_tlb_miss(dst_bo))
return true;
- if (!prefer_blt_ring(sna, dst_bo))
+ if (!prefer_blt_ring(sna, dst_bo, flags))
return false;
return (prefer_blt_bo(sna, src_bo) >= 0 &&
@@ -2650,7 +2652,7 @@ fallback_blt:
if (too_large(extents.x2-extents.x1, extents.y2-extents.y1))
goto fallback_blt;
- if ((flags & COPY_LAST || can_switch_to_blt(sna, dst_bo)) &&
+ if (can_switch_to_blt(sna, dst_bo, flags) &&
sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
sna_blt_copy_boxes(sna, alu,
src_bo, src_dx, src_dy,
@@ -2967,7 +2969,7 @@ static inline bool prefer_blt_fill(struct sna *sna,
if (untiled_tlb_miss(bo))
return true;
- return prefer_blt_ring(sna, bo) || prefer_blt_bo(sna, bo) >= 0;
+ return prefer_blt_ring(sna, bo, 0) || prefer_blt_bo(sna, bo) >= 0;
}
static bool
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index eed4132..9152cc0 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -562,6 +562,11 @@ static inline bool kgem_bo_is_snoop(struct kgem_bo *bo)
return bo->snoop;
}
+static inline void kgem_bo_mark_busy(struct kgem_bo *bo, int ring)
+{
+ bo->rq = (struct kgem_request *)((uintptr_t)bo->rq | ring);
+}
+
static inline bool kgem_bo_is_busy(struct kgem_bo *bo)
{
DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 503e53b..b5ae051 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -521,11 +521,6 @@ static void sna_dri_select_mode(struct sna *sna, struct kgem_bo *dst, struct kge
return;
}
- if (sna->kgem.has_semaphores) {
- DBG(("%s: have sempahores, prefering defaults\n", __FUNCTION__));
- return;
- }
-
VG_CLEAR(busy);
busy.handle = src->handle;
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_BUSY, &busy))
@@ -561,6 +556,7 @@ static void sna_dri_select_mode(struct sna *sna, struct kgem_bo *dst, struct kge
mode = KGEM_RENDER;
if (busy.busy & (1 << 17))
mode = KGEM_BLT;
+ kgem_bo_mark_busy(dst, mode);
_kgem_set_mode(&sna->kgem, mode);
}
More information about the xorg-commit
mailing list