xf86-video-intel: 2 commits - src/sna/kgem.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jul 17 06:25:46 PDT 2013


 src/sna/kgem.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 08cacc265da8c1213d8bf1107168e37d38a3641d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 17 14:22:16 2013 +0100

    sna: Guard cpuid for use only with gcc-4.4 and later
    
    Since __cpuid_count() was only introduced into gcc-4.4, we obviously
    cannot use it with earlier versions or with compilers that do not
    provide compatible interfaces.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 18ce676..8c69265 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -38,7 +38,6 @@
 #include <time.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <cpuid.h>
 
 #include <xf86drm.h>
 
@@ -697,6 +696,9 @@ total_ram_size(void)
 	return 0;
 }
 
+#if HAS_GCC(4, 4) /* for __cpuid_count() */
+#include <cpuid.h>
+
 static unsigned
 cpu_cache_size__cpuid4(void)
 {
@@ -740,6 +742,14 @@ cpu_cache_size__cpuid4(void)
 	 return llc_size;
 }
 
+#else
+static unsigned
+cpu_cache_size__cpuid4(void)
+{
+	return 0;
+}
+#endif
+
 static unsigned
 cpu_cache_size(void)
 {
commit aa5f14b3400614531aa88eb6b70b64bd1f47974d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 17 14:12:29 2013 +0100

    sna: Ensure that buffer_size is a power-of-two for use in ALIGN
    
    ALIGN() expects it alignment argument to be a power of two. As buffer
    size depended upon cache_size, which is not always a power of two,
    issues could arise with unexpected buffer sizes.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 0054cdf..18ce676 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1273,6 +1273,7 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen)
 		kgem->buffer_size *= 2;
 	if (kgem->buffer_size >> 12 > kgem->half_cpu_cache_pages)
 		kgem->buffer_size = kgem->half_cpu_cache_pages << 12;
+	kgem->buffer_size = 1 << __fls(kgem->buffer_size);
 	DBG(("%s: buffer size=%d [%d KiB]\n", __FUNCTION__,
 	     kgem->buffer_size, kgem->buffer_size / 1024));
 	assert(kgem->buffer_size);


More information about the xorg-commit mailing list