[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-intel: Changes to 'debian-experimental'



 NEWS                               |   73 +++++
 configure.ac                       |   23 +
 debian/changelog                   |    6 
 src/intel_device.c                 |    4 
 src/intel_module.c                 |    8 
 src/sna/fb/fb.h                    |    5 
 src/sna/fb/fbpush.c                |    2 
 src/sna/gen2_render.c              |   59 ++--
 src/sna/gen3_render.c              |   50 ++--
 src/sna/gen4_render.c              |  150 ++++++++----
 src/sna/gen4_vertex.c              |    2 
 src/sna/gen5_render.c              |   22 +
 src/sna/gen6_render.c              |   24 +
 src/sna/gen7_render.c              |   24 +
 src/sna/gen8_render.c              |   24 +
 src/sna/gen8_vertex.c              |    2 
 src/sna/kgem.c                     |  462 +++++++++++++++++++++++--------------
 src/sna/kgem.h                     |    5 
 src/sna/sna.h                      |   28 +-
 src/sna/sna_accel.c                |  425 ++++++++++++++++++++--------------
 src/sna/sna_blt.c                  |   97 ++++---
 src/sna/sna_composite.c            |   13 -
 src/sna/sna_damage.c               |  447 +++++++++++++++++++----------------
 src/sna/sna_display.c              |  314 +++++++++++++++----------
 src/sna/sna_dri.c                  |   82 ++++--
 src/sna/sna_driver.c               |   35 ++
 src/sna/sna_glyphs.c               |   21 -
 src/sna/sna_render.c               |    5 
 src/sna/sna_render.h               |    7 
 src/sna/sna_tiling.c               |    2 
 src/sna/sna_trapezoids.c           |    6 
 src/sna/sna_trapezoids_boxes.c     |   19 -
 src/sna/sna_trapezoids_imprecise.c |   13 -
 src/sna/sna_trapezoids_mono.c      |   38 +--
 src/sna/sna_trapezoids_precise.c   |   13 -
 src/uxa/intel_display.c            |   10 
 src/uxa/intel_dri.c                |   10 
 src/uxa/intel_glamor.c             |   16 +
 src/uxa/intel_glamor.h             |    4 
 src/uxa/intel_video.c              |   13 -
 tools/virtual.c                    |   46 +++
 41 files changed, 1626 insertions(+), 983 deletions(-)

New commits:
commit bb9a196da407280b75efcb175f373df3753e3ef4
Author: Timo Aaltonen <tjaalton@ubuntu.com>
Date:   Sun Feb 2 09:07:26 2014 +0200

    bump the version

diff --git a/debian/changelog b/debian/changelog
index 3f4a883..9e4af6a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,5 @@
-xserver-xorg-video-intel (2:2.99.907-1) UNRELEASED; urgency=low
+xserver-xorg-video-intel (2:2.99.909-1) UNRELEASED; urgency=low
 
-  [ Timo Aaltonen ]
-  * New upstream prerelease.
-
-  [ Maarten Lankhorst ]
   * New upstream prerelease.
 
  -- Timo Aaltonen <tjaalton@ubuntu.com>  Tue, 01 Oct 2013 14:07:22 +0300

commit 2c4b2ed558bec3b71077fb12cc4e008cccc819fa
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Feb 1 17:59:29 2014 +0000

    2.99.909 snapshot

diff --git a/NEWS b/NEWS
index 83bf809..63655d3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+Snapshot 2.99.909 (2013-02-01)
+==============================
+Pass the brown paper bag. Ridiculously stupid bug in last minute coding.
+
+  * Add Xv support using glamor acceleration in addition to adaptors
+    provided by the UXA backend.
+
+  * Fix overeager discarding of CPU damage
+    Regression in 2.99.908 :(
+    https://bugs.freedesktop.org/show_bug.cgi?id=74327
+
+
 Snapshot 2.99.908 (2013-01-31)
 ==============================
 A couple of regressions dashed the hopes that .907 was to be the final
diff --git a/configure.ac b/configure.ac
index 4e93f95..f7a6d32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.99.908],
+        [2.99.909],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 495bf89496a96eff0b2c5b6a95aa29df8d7fbc81
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Feb 1 18:57:06 2014 +0000

    sna: Apply drawable offsets to partial CPU damage being replaced
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 1fbbddc..aecae51 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2424,6 +2424,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		    priv->cpu_bo && !priv->cpu_bo->flush &&
 		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
 			if (!region_subsumes_pixmap(region, pixmap)) {
+				if (get_drawable_deltas(drawable, pixmap, &dx, &dy))
+					RegionTranslate(region, dx, dy);
+
 				sna_damage_subtract(&priv->cpu_damage, region);
 				if (sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
 					sna_pixmap_free_cpu(sna, priv, false);

commit 2ba8d40bf7e4d3e8fa541c001f82aa65f26bed3a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Feb 1 18:13:04 2014 +0000

    sna: Don't discard the GPU prior to using it for stashing CPU damage
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 7d219a4..1fbbddc 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2412,30 +2412,31 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 	if (sna_damage_is_all(&priv->cpu_damage,
 			      pixmap->drawable.width,
 			      pixmap->drawable.height)) {
+		bool discard_gpu = priv->cpu;
+
 		DBG(("%s: pixmap=%ld all damaged on CPU\n",
 		     __FUNCTION__, pixmap->drawable.serialNumber));
 		assert(!priv->clear);
 
 		sna_damage_destroy(&priv->gpu_damage);
 
-		if (flags & MOVE_WRITE)
-			sna_pixmap_free_gpu(sna, priv);
-
 		if ((flags & MOVE_READ) == 0 &&
 		    priv->cpu_bo && !priv->cpu_bo->flush &&
 		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
 			if (!region_subsumes_pixmap(region, pixmap)) {
-				if (priv->gpu_bo) {
-					sna_damage_subtract(&priv->cpu_damage, region);
-					if (sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
-						sna_pixmap_free_cpu(sna, priv, false);
-						sna_damage_add(&priv->cpu_damage, region);
-					}
+				sna_damage_subtract(&priv->cpu_damage, region);
+				if (sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
+					sna_pixmap_free_cpu(sna, priv, false);
+					sna_damage_add(&priv->cpu_damage, region);
+					discard_gpu = false;
 				}
 			} else
 				sna_pixmap_free_cpu(sna, priv, false);
 		}
 
+		if (flags & MOVE_WRITE && discard_gpu)
+			sna_pixmap_free_gpu(sna, priv);
+
 		sna_pixmap_unmap(pixmap, priv);
 		assert(priv->mapped == MAPPED_NONE);
 		if (pixmap->devPrivate.ptr == NULL &&

commit 534f19dc5a302828fe60d0f4747ad0dc9617e1a9
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Feb 1 17:56:58 2014 +0000

    sna: Remark the region as damaged after uploading the rest to the GPU
    
    If we upload outside of the replaced region to the GPU, we need to
    remark the region of operation as dirty.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index f91ca29..7d219a4 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2424,17 +2424,15 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		if ((flags & MOVE_READ) == 0 &&
 		    priv->cpu_bo && !priv->cpu_bo->flush &&
 		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
-			bool free_cpu = false;
-
 			if (!region_subsumes_pixmap(region, pixmap)) {
 				if (priv->gpu_bo) {
 					sna_damage_subtract(&priv->cpu_damage, region);
-					free_cpu = sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT);
+					if (sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
+						sna_pixmap_free_cpu(sna, priv, false);
+						sna_damage_add(&priv->cpu_damage, region);
+					}
 				}
 			} else
-				free_cpu = true;
-
-			if (free_cpu)
 				sna_pixmap_free_cpu(sna, priv, false);
 		}
 

commit 2814748b91c80c8935ea2f366e954a80bef69bb0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Feb 1 17:37:42 2014 +0000

    sna: Only discard CPU damage for an replacing region
    
    When considering move-region-to-cpu, we need to take into account that
    the region may not replace the whole drawable, in which case we cannot
    simply dispose of an active CPU bo.
    
    Reported-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
    Reported-by: Conley Moorhous <conleymoorhous@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74327
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index ff8b27d..7833095 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -637,6 +637,16 @@ region_subsumes_drawable(RegionPtr region, DrawablePtr drawable)
 }
 
 static inline bool
+region_subsumes_pixmap(RegionPtr region, PixmapPtr pixmap)
+{
+	if (region->data)
+		return false;
+
+	return (region->extents.x2 - region->extents.x1 >= pixmap->drawable.width &&
+		region->extents.y2 - region->extents.y1 >= pixmap->drawable.height);
+}
+
+static inline bool
 region_subsumes_damage(const RegionRec *region, struct sna_damage *damage)
 {
 	const BoxRec *re, *de;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 613b9c7..f91ca29 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -546,9 +546,6 @@ static void __sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv)
 
 static void sna_pixmap_free_cpu(struct sna *sna, struct sna_pixmap *priv, bool active)
 {
-	assert(priv->cpu_damage == NULL);
-	assert(list_is_empty(&priv->flush_list));
-
 	if (active)
 		return;
 
@@ -2426,8 +2423,20 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 
 		if ((flags & MOVE_READ) == 0 &&
 		    priv->cpu_bo && !priv->cpu_bo->flush &&
-		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo))
-			sna_pixmap_free_cpu(sna, priv, false);
+		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
+			bool free_cpu = false;
+
+			if (!region_subsumes_pixmap(region, pixmap)) {
+				if (priv->gpu_bo) {
+					sna_damage_subtract(&priv->cpu_damage, region);
+					free_cpu = sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT);
+				}
+			} else
+				free_cpu = true;
+
+			if (free_cpu)
+				sna_pixmap_free_cpu(sna, priv, false);
+		}
 
 		sna_pixmap_unmap(pixmap, priv);
 		assert(priv->mapped == MAPPED_NONE);

commit 3e784832a52686cd29d62bdeac7b1c539c640c5b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Feb 1 16:55:32 2014 +0000

    glamor: Enable Xv support
    
    In addition to the UXA texture paths (which in theory support VSync) and
    direct overlay support, create a textured video paths that utilize the
    glamor acceleration code.
    
    Requested-by: Fabio Pedretti <fabio.ped@libero.it>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74311
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index 03134a0..4e93f95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -322,7 +322,7 @@ if test "x$GLAMOR" != "xno"; then
 	if test "x$UXA" != "xyes"; then
 		AC_MSG_ERROR([Glamor acceleration requested but UXA is not enabled])
 	fi
-	PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.3.1])
+	PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.6.0])
 	PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
 	AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
 fi
diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c
index 4d1c767..e1e2a74 100644
--- a/src/uxa/intel_glamor.c
+++ b/src/uxa/intel_glamor.c
@@ -52,6 +52,17 @@ intel_glamor_exchange_buffers(struct intel_screen_private *intel,
 	glamor_egl_exchange_buffers(src, dst);
 }
 
+XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports)
+{
+	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+
+	if ((intel->uxa_flags & UXA_USE_GLAMOR) == 0)
+		return NULL;
+
+	return glamor_xv_init(screen, num_ports);
+}
+
 Bool
 intel_glamor_create_screen_resources(ScreenPtr screen)
 {
diff --git a/src/uxa/intel_glamor.h b/src/uxa/intel_glamor.h
index 46692bc..2e305fc 100644
--- a/src/uxa/intel_glamor.h
+++ b/src/uxa/intel_glamor.h
@@ -30,6 +30,8 @@
 #ifndef INTEL_GLAMOR_H
 #define INTEL_GLAMOR_H
 
+#include <xf86xv.h>
+
 #ifdef USE_GLAMOR
 
 Bool intel_glamor_pre_init(ScrnInfoPtr scrn);
@@ -45,6 +47,7 @@ void intel_glamor_destroy_pixmap(PixmapPtr pixmap);
 PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
 				     int depth, unsigned int usage);
 void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst);
+XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports);
 #else
 
 static inline Bool intel_glamor_pre_init(ScrnInfoPtr scrn) { return TRUE; }
@@ -62,6 +65,7 @@ static inline PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int
 						   int depth, unsigned int usage) { return NULL; }
 
 static inline void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst) {}
+static inline XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports) { return NULL; }
 #endif
 
 #endif /* INTEL_GLAMOR_H */
diff --git a/src/uxa/intel_video.c b/src/uxa/intel_video.c
index 238cd47..d1b98d4 100644
--- a/src/uxa/intel_video.c
+++ b/src/uxa/intel_video.c
@@ -78,6 +78,7 @@
 #define _INTEL_XVMC_SERVER_
 #include "intel_xvmc.h"
 #endif
+#include "intel_glamor.h"
 
 #define OFF_DELAY	250	/* milliseconds */
 
@@ -331,13 +332,13 @@ void I830InitVideo(ScreenPtr screen)
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	XF86VideoAdaptorPtr *adaptors = NULL, *newAdaptors = NULL;
-	XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL;
+	XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL, glamorAdaptor = NULL;
 	int num_adaptors = xf86XVListGenericAdaptors(scrn, &adaptors);
 	/* Give our adaptor list enough space for the overlay and/or texture video
 	 * adaptors.
 	 */
 	newAdaptors = realloc(adaptors,
-			      (num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr));
+			      (num_adaptors + 3) * sizeof(XF86VideoAdaptorPtr));
 	if (newAdaptors == NULL) {
 		free(adaptors);
 		return;
@@ -378,12 +379,20 @@ void I830InitVideo(ScreenPtr screen)
 		}
 	}
 
+	glamorAdaptor = intel_glamor_xv_init(screen, 16);
+	if (glamorAdaptor != NULL)
+		xf86DrvMsg(scrn->scrnIndex, X_INFO,
+			   "Set up textured video using glamor\n");
+
 	if (overlayAdaptor && intel->XvPreferOverlay)
 		adaptors[num_adaptors++] = overlayAdaptor;
 
 	if (texturedAdaptor)
 		adaptors[num_adaptors++] = texturedAdaptor;
 
+	if (glamorAdaptor)
+		adaptors[num_adaptors++] = glamorAdaptor;
+
 	if (overlayAdaptor && !intel->XvPreferOverlay)
 		adaptors[num_adaptors++] = overlayAdaptor;
 

commit 3f2e199b6b4ce86ba3922f9f2dea5f6cba053453
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 31 17:59:30 2014 +0000

    2.99.908 snapshot

diff --git a/NEWS b/NEWS
index 7bef0bc..83bf809 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,64 @@
+Snapshot 2.99.908 (2013-01-31)
+==============================
+A couple of regressions dashed the hopes that .907 was to be the final
+release candidate, so time to start the cycle again after applying a few
+more bugfixes.
+
+  * Fix invalid pageflipping of GLXPixmaps by UXA.
+    https://bugs.freedesktop.org/show_bug.cgi?id=73282
+
+  * Consistently treat DPMS Suspend/Standy as Off, otherwise we may
+    incorrectly restore the backlight in UXA.
+
+  * Fix disabling the backlight in UXA when querying the value whilst off
+    https://bugs.freedesktop.org/show_bug.cgi?id=73181.
+
+  * Invalidate between every operation if rendering into the source or mask.
+    Fixes regression in 2.99.907 on Ivybridge (seen in KDE)
+    https://bugs.freedesktop.org/show_bug.cgi?id=73208
+
+  * Check for available batch buffer state before restoring state on gen4,
+    otherwise we overwrite surface state with commands and cause a GPU hang.
+    https://bugs.freedesktop.org/show_bug.cgi?id=73348
+
+  * Prevent an invalid free by TearFree
+    https://bugs.freedesktop.org/show_bug.cgi?id=73469
+
+  * Fix confusion in TearFree when it tried to pageflip to a stale bo
+    https://bugs.freedesktop.org/show_bug.cgi?id=70905
+
+  * Initialise TearFree contents with the current frontbuffer upon creation,
+    otherwise old content may be visible for significant fractions of a
+    second after resume or DPMS on
+    https://bugs.freedesktop.org/show_bug.cgi?id=73842
+
+  * Nullify the old pointer into a CPU mmapping of the bo when promoting it
+    on the GPU. Eventually that old pointer becomes invalid and will cause
+    the Xserver to crash.
+    Fixes regression in 2.99.906
+    https://bugs.freedesktop.org/show_bug.cgi?id=73351
+
+  * Restore the serialNumber on the GC correctly after falling back to
+    software. This was seen to cause corruption with Wine.
+    https://bugs.freedesktop.org/show_bug.cgi?id=73856
+
+  * Do not ignore CPU damage on a pixmap unless the Composite operation
+    will completely overwrite it. This was observed in xfce4.
+    https://bugs.freedesktop.org/show_bug.cgi?id=69528
+
+  * Skip fake outputs during initial probe as they can cause a NULL pointer
+    dereference.
+    https://bugs.freedesktop.org/show_bug.cgi?id=73981
+
+  * Fix rendering of dashed zero-width lines onto 24bit buffers
+    https://bugzilla.redhat.com/show_bug.cgi?id=1059152
+
+  * Cap the freed Pixmap cache and reuse it more often
+    Fixes a regression in 2.99.907 that caused the memory used by X to
+    grow until it was cleaned up during server regreneration
+    https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1272338
+
+
 Snapshot 2.99.907 (2013-12-30)
 ==============================
 The highlight here is that things seem to be quietening down on the bug
diff --git a/configure.ac b/configure.ac
index ce4822f..03134a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.99.907],
+        [2.99.908],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 1f9a6156e9240a1efa8785ab5bca0a3b1757d08e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 31 20:02:44 2014 +0000

    sna: remove short-circuit for move-to-CPU when damage covers region
    
    The short-circuit path missed translating the damage from drawable space
    into the pixmap (for Composite setups) which may have resulted in
    corruption. The path was also failing to consider the impact of reusing
    an active CPU bo when it could be discarding the unwanted damage and
    reallocating.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index c903385..613b9c7 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2424,17 +2424,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
 		if (flags & MOVE_WRITE)
 			sna_pixmap_free_gpu(sna, priv);
 
-		goto contains_damage;
-	}
-
-	if (priv->cpu &&
-	    priv->cpu_damage &&
-	    sna_damage_contains_box__no_reduce(priv->cpu_damage,
-					       &region->extents)) {
-		DBG(("%s: pixmap=%ld CPU damage contains region\n",
-		     __FUNCTION__, pixmap->drawable.serialNumber));
+		if ((flags & MOVE_READ) == 0 &&
+		    priv->cpu_bo && !priv->cpu_bo->flush &&
+		    __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo))
+			sna_pixmap_free_cpu(sna, priv, false);
 
-contains_damage:
 		sna_pixmap_unmap(pixmap, priv);
 		assert(priv->mapped == MAPPED_NONE);
 		if (pixmap->devPrivate.ptr == NULL &&

commit 539b749416b275d84e05e2a5b62d946903aa3d29
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 31 18:02:51 2014 +0000

    sna: Use 24bpp rendering by default for gen2 again
    
    Too many users where unhappy that their software was broken. Too bad the
    same software is also broken at high bit depths as well.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=73877
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index fd0d3bd..4ecef3c 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -447,7 +447,6 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 	char buf[1024];
 	rgb defaultWeight = { 0, 0, 0 };
 	EntityInfoPtr pEnt;
-	int preferred_depth;
 	Gamma zeros = { 0.0, 0.0, 0.0 };
 	int fd;
 
@@ -513,11 +512,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
 	xf86DrvMsg(scrn->scrnIndex, X_PROBED, "CPU: %s\n",
 		   sna_cpu_features_to_string(sna->cpu_features, buf));
 
-	preferred_depth = sna->info->gen < 030 ? 15 : 24;
-	if (!fb_supports_depth(fd, preferred_depth))
-		preferred_depth = 24;
-
-	if (!xf86SetDepthBpp(scrn, preferred_depth, 0, 0,
+	if (!xf86SetDepthBpp(scrn, 24, 0, 0,
 			     Support32bppFb |
 			     SupportConvert24to32 | PreferConvert24to32))
 		goto cleanup;

commit bdb1a62ce21f3eb5e27e411b78f13ad2aea963a4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 31 16:42:46 2014 +0000

    sna: Balance memory accounting for buffer objects
    
    A couple bugs ended up with CPU bo gradually accumulating whilst the
    overall number of bo vanished.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index b3d3c4b..f7404df 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -228,7 +228,6 @@ static void debug_alloc__bo(struct kgem *kgem, struct kgem_bo *bo)
 	debug_alloc(kgem, bytes(bo));
 }
 #else
-#define debug_alloc(k, b)
 #define debug_alloc__bo(k, b)
 #endif
 
@@ -4696,10 +4695,9 @@ create:
 		bo->pitch = pitch;
 	} else {
 		if (flags & CREATE_EXACT) {
-			if (bo->pitch != pitch || bo->tiling != tiling) {
-				kgem_bo_free(kgem, bo);
-				return NULL;
-			}
+			gem_close(kgem->fd, handle);
+			free(bo);
+			return NULL;
 		}
 	}
 
@@ -5949,8 +5947,8 @@ create_snoopable_buffer(struct kgem *kgem, unsigned alloc)
 				return NULL;
 			}
 
-			debug_alloc(kgem, alloc);
 			__kgem_bo_init(&bo->base, handle, alloc);
+			debug_alloc__bo(kgem, &bo->base);
 			DBG(("%s: created CPU (LLC) handle=%d for buffer, size %d\n",
 			     __FUNCTION__, bo->base.handle, alloc));
 		}
@@ -5985,8 +5983,8 @@ create_snoopable_buffer(struct kgem *kgem, unsigned alloc)
 				return NULL;
 			}
 
-			debug_alloc(kgem, alloc);
 			__kgem_bo_init(&bo->base, handle, alloc);
+			debug_alloc__bo(kgem, &bo->base);
 			DBG(("%s: created CPU handle=%d for buffer, size %d\n",
 			     __FUNCTION__, bo->base.handle, alloc));
 		}
@@ -6029,8 +6027,8 @@ free_caching:
 			return NULL;
 		}
 
-		debug_alloc(kgem, alloc);
 		__kgem_bo_init(&bo->base, handle, alloc);
+		debug_alloc__bo(kgem, &bo->base);
 		DBG(("%s: created snoop handle=%d for buffer\n",
 		     __FUNCTION__, bo->base.handle));
 
@@ -6200,10 +6198,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
 				goto skip_llc;
 			}
 			__kgem_bo_init(&bo->base, handle, alloc);
+			debug_alloc__bo(kgem, &bo->base);
 			DBG(("%s: created LLC handle=%d for buffer\n",
 			     __FUNCTION__, bo->base.handle));
-
-			debug_alloc(kgem, alloc);
 		}
 
 		assert(bo->mmapped);
@@ -6366,7 +6363,7 @@ skip_llc:
 			     __FUNCTION__, handle));
 
 			__kgem_bo_init(&bo->base, handle, alloc);
-			debug_alloc(kgem, alloc * PAGE_SIZE);
+			debug_alloc__bo(kgem, &bo->base);
 		}
 
 		assert(bo->mmapped);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index bbb6e2b..c903385 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3863,6 +3863,10 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
 			    kgem_bo_convert_to_gpu(&sna->kgem, priv->cpu_bo)) {
 				assert(!priv->mapped);
 				assert(!IS_STATIC_PTR(priv->ptr));
+#ifdef DEBUG_MEMORY
+				sna->debug_memory.cpu_bo_allocs--;
+				sna->debug_memory.cpu_bo_bytes -= kgem_bo_size(priv->cpu_bo);
+#endif
 				priv->gpu_bo = priv->cpu_bo;
 				priv->cpu_bo = NULL;
 				priv->ptr = NULL;

commit f934ee78a000815e14e36bd0caa279cb35d07bfe
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 31 15:39:23 2014 +0000

    sna: Reorder assignments vs DBG
    
    It helps reading the debug log if what we print is correct.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 3a7592a..bbb6e2b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -909,17 +909,17 @@ fallback:
 		}
 	}
 
+	pixmap->drawable.width = width;
+	pixmap->drawable.height = height;
+	pixmap->drawable.depth = depth;
+	pixmap->drawable.bitsPerPixel = bpp;
+
 	DBG(("%s: serial=%ld, %dx%d\n",
 	     __FUNCTION__,
 	     pixmap->drawable.serialNumber,
 	     pixmap->drawable.width,
 	     pixmap->drawable.height));
 
-	pixmap->drawable.width = width;
-	pixmap->drawable.height = height;
-	pixmap->drawable.depth = depth;
-	pixmap->drawable.bitsPerPixel = bpp;
-
 	priv->cpu_bo = kgem_create_map(&sna->kgem, addr, pitch*height, false);
 	if (priv->cpu_bo == NULL) {
 		priv->header = true;
@@ -997,6 +997,12 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 		}
 	}
 
+	pixmap->drawable.width = width;
+	pixmap->drawable.height = height;
+	pixmap->drawable.depth = depth;
+	pixmap->drawable.bitsPerPixel = bpp;
+	pixmap->devPrivate.ptr = NULL;
+
 	DBG(("%s: serial=%ld, usage=%d, %dx%d\n",
 	     __FUNCTION__,
 	     pixmap->drawable.serialNumber,
@@ -1004,12 +1010,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 	     pixmap->drawable.width,
 	     pixmap->drawable.height));
 
-	pixmap->drawable.width = width;
-	pixmap->drawable.height = height;
-	pixmap->drawable.depth = depth;
-	pixmap->drawable.bitsPerPixel = bpp;
-	pixmap->devPrivate.ptr = NULL;
-
 	priv->stride = PixmapBytePad(width, depth);
 	priv->header = true;
 

commit bdbb928ea38977bd2784f454f35db2ac2c13c34c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jan 31 15:03:43 2014 +0000

    sna: Actually reuse pixmap headers for ordinary pixmaps
    
    commit 3dbf17f00e200e864818b0b8ca762183cff9085f [2.99.907]
    Author: Chris Wilson <chris@chris-wilson.co.uk>
    Date:   Tue Dec 3 12:10:01 2013 +0000
    
        sna: Mark up an ordinary pixmap for reuse
    
    started to put the frequently allocated pixmaps into the object cache -
    but as those frequent allocations themselves did not use the cache, the
    cache kept growing.
    
    Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1272338
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 42d5fd9..3a7592a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -896,29 +896,12 @@ fallback:
 
 	if (sna->freed_pixmap) {
 		pixmap = create_pixmap_hdr(sna, 0);
-
-		pixmap->drawable.width = width;
-		pixmap->drawable.height = height;
-		pixmap->drawable.depth = depth;
-		pixmap->drawable.bitsPerPixel = bpp;
-
-		DBG(("%s: serial=%ld, %dx%d\n",
-		     __FUNCTION__,
-		     pixmap->drawable.serialNumber,
-		     pixmap->drawable.width,
-		     pixmap->drawable.height));
-
 		priv = _sna_pixmap_reset(pixmap);
 	} else {
 		pixmap = create_pixmap(sna, screen, 0, 0, depth, 0);
 		if (pixmap == NullPixmap)
 			return NullPixmap;
 
-		pixmap->drawable.width = width;
-		pixmap->drawable.height = height;
-		pixmap->drawable.depth = depth;
-		pixmap->drawable.bitsPerPixel = bpp;
-
 		priv = sna_pixmap_attach(pixmap);
 		if (!priv) {
 			FreePixmap(pixmap);
@@ -926,6 +909,17 @@ fallback:
 		}
 	}
 
+	DBG(("%s: serial=%ld, %dx%d\n",
+	     __FUNCTION__,
+	     pixmap->drawable.serialNumber,
+	     pixmap->drawable.width,
+	     pixmap->drawable.height));
+
+	pixmap->drawable.width = width;
+	pixmap->drawable.height = height;
+	pixmap->drawable.depth = depth;
+	pixmap->drawable.bitsPerPixel = bpp;
+
 	priv->cpu_bo = kgem_create_map(&sna->kgem, addr, pitch*height, false);
 	if (priv->cpu_bo == NULL) {
 		priv->header = true;
@@ -940,6 +934,7 @@ fallback:
 	sna->debug_memory.cpu_bo_bytes += kgem_bo_size(priv->cpu_bo);
 #endif
 
+	/* Be wary as we cannot cache SHM Pixmap in our freed cache */
 	priv->cpu = true;
 	priv->shm = true;
 	priv->stride = pitch;
@@ -988,19 +983,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 	/* you promise never to access this via the cpu... */
 	if (sna->freed_pixmap) {
 		pixmap = create_pixmap_hdr(sna, CREATE_PIXMAP_USAGE_SCRATCH);
-
-		pixmap->drawable.width = width;
-		pixmap->drawable.height = height;
-		pixmap->drawable.depth = depth;
-		pixmap->drawable.bitsPerPixel = bpp;
-
-		DBG(("%s: serial=%ld, usage=%d, %dx%d\n",
-		     __FUNCTION__,
-		     pixmap->drawable.serialNumber,
-		     pixmap->usage_hint,
-		     pixmap->drawable.width,
-		     pixmap->drawable.height));
-
 		priv = _sna_pixmap_reset(pixmap);
 	} else {
 		pixmap = create_pixmap(sna, screen, 0, 0, depth,
@@ -1008,11 +990,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 		if (pixmap == NullPixmap)
 			return NullPixmap;
 
-		pixmap->drawable.width = width;
-		pixmap->drawable.height = height;
-		pixmap->drawable.depth = depth;
-		pixmap->drawable.bitsPerPixel = bpp;
-
 		priv = sna_pixmap_attach(pixmap);
 		if (!priv) {
 			FreePixmap(pixmap);
@@ -1020,9 +997,22 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 		}
 	}
 
-	priv->stride = PixmapBytePad(width, depth);
+	DBG(("%s: serial=%ld, usage=%d, %dx%d\n",
+	     __FUNCTION__,
+	     pixmap->drawable.serialNumber,
+	     pixmap->usage_hint,
+	     pixmap->drawable.width,
+	     pixmap->drawable.height));
+
+	pixmap->drawable.width = width;
+	pixmap->drawable.height = height;
+	pixmap->drawable.depth = depth;
+	pixmap->drawable.bitsPerPixel = bpp;
 	pixmap->devPrivate.ptr = NULL;
 
+	priv->stride = PixmapBytePad(width, depth);
+	priv->header = true;
+
 	priv->gpu_bo = kgem_create_2d(&sna->kgem,
 				      width, height, bpp, tiling,
 				      CREATE_TEMPORARY);
@@ -1032,7 +1022,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 		return NullPixmap;
 	}
 
-	priv->header = true;
 	sna_damage_all(&priv->gpu_damage, width, height);
 
 	assert(to_sna_from_pixmap(pixmap) == sna);
@@ -1320,32 +1309,52 @@ static PixmapPtr sna_create_pixmap(ScreenPtr screen,
 		ptr = MAKE_STATIC_PTR(pixmap->devPrivate.ptr);
 		pad = pixmap->devKind;
 		flags &= ~(KGEM_CAN_CREATE_GPU | KGEM_CAN_CREATE_CPU);
+
+		priv = sna_pixmap_attach(pixmap);
+		if (priv == NULL) {
+			free(pixmap);
+			goto fallback;
+		}
 	} else {
 		DBG(("%s: creating GPU pixmap %dx%d, stride=%d, flags=%x\n",
 		     __FUNCTION__, width, height, pad, flags));
 
-		pixmap = create_pixmap(sna, screen, 0, 0, depth, usage);
-		if (pixmap == NullPixmap)
-			return NullPixmap;
+		if (sna->freed_pixmap) {
+			pixmap = create_pixmap_hdr(sna, CREATE_PIXMAP_USAGE_SCRATCH);
+			priv = _sna_pixmap_reset(pixmap);
+		} else {
+			pixmap = create_pixmap(sna, screen, 0, 0, depth, usage);
+			if (pixmap == NullPixmap)
+				return NullPixmap;
+
+			priv = sna_pixmap_attach(pixmap);
+			if (priv == NULL) {
+				free(pixmap);
+				goto fallback;
+			}
+		}
+
+		DBG(("%s: serial=%ld, usage=%d, %dx%d\n",
+		     __FUNCTION__,
+		     pixmap->drawable.serialNumber,
+		     pixmap->usage_hint,
+		     pixmap->drawable.width,
+		     pixmap->drawable.height));
 
 		pixmap->drawable.width = width;
 		pixmap->drawable.height = height;
+		pixmap->drawable.depth = depth;
+		pixmap->drawable.bitsPerPixel = bits_per_pixel(depth);
 		pixmap->devKind = pad;
 		pixmap->devPrivate.ptr = NULL;
 
+		priv->header = true;
 		ptr = NULL;
 	}
 
-	priv = sna_pixmap_attach(pixmap);
-	if (priv == NULL) {
-		free(pixmap);
-		goto fallback;
-	}
-
 	priv->stride = pad;
 	priv->create = flags;
 	priv->ptr = ptr;
-	priv->header = ptr == NULL;
 
 	assert(to_sna_from_pixmap(pixmap) == sna);
 	assert(pixmap->drawable.pScreen == screen);
@@ -3708,19 +3717,18 @@ sna_pixmap_create_upload(ScreenPtr screen,
 
 	if (sna->freed_pixmap) {
 		pixmap = create_pixmap_hdr(sna, CREATE_PIXMAP_USAGE_SCRATCH);
+		priv = _sna_pixmap_reset(pixmap);
 	} else {
 		pixmap = create_pixmap(sna, screen, 0, 0, depth,
 				       CREATE_PIXMAP_USAGE_SCRATCH);
 		if (!pixmap)
 			return NullPixmap;
 
-		priv = malloc(sizeof(*priv));
+		priv = sna_pixmap_attach(pixmap);
 		if (!priv) {
 			FreePixmap(pixmap);
 			return NullPixmap;
 		}
-
-		sna_set_pixmap(pixmap, priv);
 	}
 
 	pixmap->drawable.width = width;
@@ -3728,9 +3736,6 @@ sna_pixmap_create_upload(ScreenPtr screen,
 	pixmap->drawable.depth = depth;
 	pixmap->drawable.bitsPerPixel = bits_per_pixel(depth);
 
-	priv = _sna_pixmap_reset(pixmap);
-	priv->header = true;
-
 	priv->gpu_bo = kgem_create_buffer_2d(&sna->kgem,
 					     width, height,
 					     pixmap->drawable.bitsPerPixel,
@@ -3752,6 +3757,7 @@ sna_pixmap_create_upload(ScreenPtr screen,
 	pixmap->devPrivate.ptr = ptr;
 	priv->ptr = MAKE_STATIC_PTR(ptr);


Reply to: