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

xserver-xorg-video-intel: Changes to 'ubuntu'



 debian/changelog                     |   13 
 debian/patches/revert-dpms-fix.patch |   28 -
 man/intel.man                        |   26 +
 src/i915_pciids.h                    |   36 +
 src/intel_module.c                   |    6 
 src/intel_options.c                  |    2 
 src/intel_options.h                  |    2 
 src/sna/gen3_render.c                |   38 --
 src/sna/gen4_render.c                |   33 -
 src/sna/gen5_render.c                |   35 -
 src/sna/gen6_render.c                |   35 -
 src/sna/gen7_render.c                |   38 --
 src/sna/gen8_render.c                |   36 -
 src/sna/kgem.c                       |  173 +++++----
 src/sna/kgem.h                       |    2 
 src/sna/sna.h                        |    1 
 src/sna/sna_accel.c                  |   10 
 src/sna/sna_display.c                |  631 ++++++++++++++++++++++++++---------
 src/sna/sna_dri2.c                   |   29 +
 src/sna/sna_driver.c                 |    5 
 src/sna/sna_video_textured.c         |    6 
 src/uxa/intel_driver.c               |    2 
 22 files changed, 751 insertions(+), 436 deletions(-)

New commits:
commit 1e788671761ec32a00e0930d86ae00db955000fe
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Thu Dec 17 15:43:23 2015 +0200

    release to xenial

diff --git a/debian/changelog b/debian/changelog
index 165bd83..2349f6c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,9 @@
-xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1ubuntu1) UNRELEASED; urgency=medium
+xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1ubuntu1) xenial; urgency=medium
 
   * Merge from debian.
   * Refresh revert-dpms-fix.patch.
 
- -- Timo Aaltonen <tjaalton@debian.org>  Thu, 17 Dec 2015 15:37:31 +0200
+ -- Timo Aaltonen <tjaalton@debian.org>  Thu, 17 Dec 2015 15:43:05 +0200
 
 xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1) experimental; urgency=medium
 

commit 917c09efcd79c80612b5660be037e3fba05f6fb3
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Thu Dec 17 15:43:02 2015 +0200

    refresh patch

diff --git a/debian/changelog b/debian/changelog
index eb0a803..165bd83 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1ubuntu1) UNRELEASED; urgency=medium
+
+  * Merge from debian.
+  * Refresh revert-dpms-fix.patch.
+
+ -- Timo Aaltonen <tjaalton@debian.org>  Thu, 17 Dec 2015 15:37:31 +0200
+
 xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1) experimental; urgency=medium
 
   * New upstream snapshot.
diff --git a/debian/patches/revert-dpms-fix.patch b/debian/patches/revert-dpms-fix.patch
index 283c1f3..d642ba2 100644
--- a/debian/patches/revert-dpms-fix.patch
+++ b/debian/patches/revert-dpms-fix.patch
@@ -9,11 +9,9 @@ This reverts commit 7d9a74622e5a936e4860fcef8358619bf59adae8.
  src/sna/sna_display.c | 41 ++++++++++++++---------------------------
  1 file changed, 14 insertions(+), 27 deletions(-)
 
-Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
-===================================================================
---- xserver-xorg-video-intel-2.99.917+git20150808.orig/src/sna/sna_display.c
-+++ xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
-@@ -222,7 +222,7 @@ struct sna_output {
+--- a/src/sna/sna_display.c
++++ b/src/sna/sna_display.c
+@@ -262,7 +262,7 @@ struct sna_output {
  	int panel_vdisplay;
  
  	uint32_t dpms_id;
@@ -22,7 +20,7 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  	struct backlight backlight;
  	int backlight_active_level;
  
-@@ -260,7 +260,6 @@ enum { /* XXX copied from hw/xfree86/mod
+@@ -300,7 +300,6 @@ enum { /* XXX copied from hw/xfree86/mod
  	OPTION_DEFAULT_MODES,
  };
  
@@ -30,16 +28,16 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  static void sna_crtc_disable_cursor(struct sna *sna, struct sna_crtc *crtc);
  
  static bool is_zaphod(ScrnInfoPtr scrn)
-@@ -969,7 +968,7 @@ sna_crtc_force_outputs_on(xf86CrtcPtr cr
+@@ -1099,7 +1098,7 @@ sna_crtc_force_outputs_on(xf86CrtcPtr cr
  		if (output->crtc != crtc)
  			continue;
  
 -		__sna_output_dpms(output, DPMSModeOn, false);
 +		output->funcs->dpms(output, DPMSModeOn);
- 		to_sna_output(output)->last_detect = now;
+ 		if (to_sna_output(output)->last_detect)
+ 			to_sna_output(output)->last_detect = now;
  	}
- 
-@@ -999,7 +998,7 @@ sna_crtc_force_outputs_off(xf86CrtcPtr c
+@@ -1131,7 +1130,7 @@ sna_crtc_force_outputs_off(xf86CrtcPtr c
  		if (output->crtc != crtc)
  			continue;
  
@@ -48,7 +46,7 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  	}
  }
  
-@@ -1135,7 +1134,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
+@@ -1356,7 +1355,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
  		 * and we lose track of the user settings.
  		 */
  		if (output->crtc == NULL)
@@ -57,7 +55,7 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  
  		if (output->crtc != crtc)
  			continue;
-@@ -3650,7 +3649,7 @@ sna_output_destroy(xf86OutputPtr output)
+@@ -3907,7 +3906,7 @@ sna_output_destroy(xf86OutputPtr output)
  }
  
  static void
@@ -66,7 +64,7 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  {
  	struct sna *sna = to_sna(output->scrn);
  	struct sna_output *sna_output = output->driver_private;
-@@ -3677,9 +3676,8 @@ __sna_output_dpms(xf86OutputPtr output,
+@@ -3934,9 +3933,8 @@ __sna_output_dpms(xf86OutputPtr output,
  	if (sna_output->backlight.iface && dpms != DPMSModeOn) {
  		if (old_dpms == DPMSModeOn) {
  			sna_output->backlight_active_level = sna_output_backlight_get(output);
@@ -78,7 +76,7 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  		}
  		sna_output->dpms_mode = dpms;
  		sna_output_backlight_off(sna_output);
-@@ -3689,31 +3687,18 @@ __sna_output_dpms(xf86OutputPtr output,
+@@ -3946,31 +3944,18 @@ __sna_output_dpms(xf86OutputPtr output,
  	    drmModeConnectorSetProperty(sna->kgem.fd,
  					sna_output->id,
  					sna_output->dpms_id,
@@ -114,7 +112,7 @@ Index: xserver-xorg-video-intel-2.99.917+git20150808/src/sna/sna_display.c
  static bool
  sna_property_ignore(drmModePropertyPtr prop)
  {
-@@ -4638,8 +4623,10 @@ reset:
+@@ -4836,8 +4821,10 @@ reset:
  		sna_output->dpms_mode = sna_output->prop_values[i];
  		DBG(("%s: found 'DPMS' (idx=%d, id=%d), initial value=%d\n",
  		     __FUNCTION__, i, sna_output->dpms_id, sna_output->dpms_mode));

commit 116f9e95c34b0a1724e6c99a1c14214b44dcdf25
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Thu Dec 17 15:10:21 2015 +0200

    release to experimental

diff --git a/debian/changelog b/debian/changelog
index 8965b8f..e9c81e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,8 @@
-xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1) UNRELEASED; urgency=medium
+xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1) experimental; urgency=medium
 
   * New upstream snapshot.
 
- -- Timo Aaltonen <tjaalton@debian.org>  Thu, 17 Dec 2015 15:07:27 +0200
+ -- Timo Aaltonen <tjaalton@debian.org>  Thu, 17 Dec 2015 15:10:01 +0200
 
 xserver-xorg-video-intel (2:2.99.917+git20151019-1~exp1) experimental; urgency=medium
 

commit 9fd307f4b926230fcc275c53086f974ef8293ac7
Author: Timo Aaltonen <tjaalton@debian.org>
Date:   Thu Dec 17 15:07:56 2015 +0200

    update the changelog

diff --git a/debian/changelog b/debian/changelog
index 9bcf66e..8965b8f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xserver-xorg-video-intel (2:2.99.917+git20151217-1~exp1) UNRELEASED; urgency=medium
+
+  * New upstream snapshot.
+
+ -- Timo Aaltonen <tjaalton@debian.org>  Thu, 17 Dec 2015 15:07:27 +0200
+
 xserver-xorg-video-intel (2:2.99.917+git20151019-1~exp1) experimental; urgency=medium
 
   * New upstream snapshot.

commit 82293901da23d79fd074e5255fda5c95405d52de
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 15 17:56:32 2015 +0000

    sna: Need function definitions as well
    
    Oops, accidentally only commited the function declaration and not the
    function definition for the non-debug path.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 3de232b..1b39f20 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1306,8 +1306,8 @@ static void kmsg_close(struct kmsg *k, int dump)
 }
 #else
 struct kmsg { int unused; };
-static void kmsg_open(struct kmsg *k);
-static void kmsg_close(struct kmsg *k, int dump);
+static void kmsg_open(struct kmsg *k) {}
+static void kmsg_close(struct kmsg *k, int dump) {}
 #endif
 
 static bool

commit f458e8c41112cf56a132ac42cc9e6a4be893ff2c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 15 16:46:47 2015 +0000

    sna: Dump kernel debug messages for KMS failures
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index cc1c258..3de232b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1235,6 +1235,81 @@ bool sna_crtc_set_sprite_rotation(xf86CrtcPtr crtc, uint32_t rotation)
 			    rotation_reduce(&to_sna_crtc(crtc)->sprite, rotation));
 }
 
+#if HAS_DEBUG_FULL
+struct kmsg {
+	int fd;
+	int saved_loglevel;
+};
+
+static int kmsg_get_debug(void)
+{
+	FILE *file;
+	int v = -1;
+
+	file = fopen("/sys/module/drm/parameters/debug", "r");
+	if (file) {
+		fscanf(file, "%d", &v);
+		fclose(file);
+	}
+
+	return v;
+}
+
+static void kmsg_set_debug(int v)
+{
+	FILE *file;
+
+	file = fopen("/sys/module/drm/parameters/debug", "w");
+	if (file) {
+		fprintf(file, "%d\n", v);
+		fclose(file);
+	}
+}
+
+static void kmsg_open(struct kmsg *k)
+{
+	k->saved_loglevel = kmsg_get_debug();
+	if (k->saved_loglevel != -1)
+		kmsg_set_debug(0xff);
+
+	k->fd = open("/dev/kmsg", O_RDONLY | O_NONBLOCK);
+	if (k->fd != -1)
+		lseek(k->fd, 0, SEEK_END);
+}
+
+static void kmsg_close(struct kmsg *k, int dump)
+{
+	FILE *file;
+
+	file = NULL;
+	if (k->fd != -1 && dump)
+		file = fdopen(k->fd, "r");
+	if (file) {
+		size_t len = 0;
+		char *line = NULL;
+
+		while (getline(&line, &len, file) != -1) {
+			char *start = strchr(line, ';');
+			if (start)
+				LogF("KMSG: %s", start + 1);
+		}
+
+		free(line);
+		fclose(file);
+	}
+
+	if (k->fd != -1)
+		close(k->fd);
+
+	if (k->saved_loglevel != -1)
+		kmsg_set_debug(k->saved_loglevel);
+}
+#else
+struct kmsg { int unused; };
+static void kmsg_open(struct kmsg *k);
+static void kmsg_close(struct kmsg *k, int dump);
+#endif
+
 static bool
 sna_crtc_apply(xf86CrtcPtr crtc)
 {
@@ -1245,6 +1320,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
 	uint32_t output_ids[32];
 	int output_count = 0;
 	int sigio, i;
+	struct kmsg kmsg;
 	bool ret = false;
 
 	DBG(("%s CRTC:%d [pipe=%d], handle=%d\n", __FUNCTION__,
@@ -1257,6 +1333,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
 	}
 
 	sigio = sigio_block();
+	kmsg_open(&kmsg);
 
 	assert(sna->mode.num_real_output < ARRAY_SIZE(output_ids));
 	sna_crtc_disable_cursor(sna, sna_crtc);
@@ -1348,6 +1425,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
 		sna_crtc_force_outputs_on(crtc);
 	}
 unblock:
+	kmsg_close(&kmsg, !ret);
 	sigio_unblock(sigio);
 	return ret;
 }

commit 6c4ffba39acb114cbbbfa3359a8c1ba7dfcc7df6
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 10 16:19:21 2015 +0000

    sna: Don't disable the native backlight around modesets
    
    The kernel can handle the native 'intel_backlight' automagically around
    modesets, so let it.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 67a626b..cc1c258 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -849,9 +849,22 @@ sna_output_backlight_set(struct sna_output *sna_output, int level)
 	return ret;
 }
 
+static bool
+has_native_backlight(struct sna_output *sna_output)
+{
+	return sna_output->backlight.type == BL_RAW;
+}
+
 static void
 sna_output_backlight_off(struct sna_output *sna_output)
 {
+	/* Trust the kernel to turn the native backlight off. However, we
+	 * do explicitly turn the backlight back on (when we wake the output)
+	 * just in case a third party turns it off!
+	 */
+	if (has_native_backlight(sna_output))
+		return;
+
 	DBG(("%s(%s)\n", __FUNCTION__, sna_output->base->name));
 	backlight_off(&sna_output->backlight);
 	sna_output_backlight_set(sna_output, 0);

commit c4565979572b61cf7fc0b931333c032c88b259f1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Dec 2 10:06:46 2015 +0000

    sna/dri2: Emit the outstanding signal when eliding a swap
    
    When we do the exchange for the next swap, we should emit any pending
    completion signal for the previous buffer.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index c093024..33cf3d9 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -2791,6 +2791,7 @@ sna_dri2_flip_continue(struct sna_dri2_event *info)
 	       info->sna->dri2.flip_pending == info);
 	info->sna->dri2.flip_pending = info;
 	info->queued = true;
+	info->signal = info->type == FLIP_THROTTLE;
 
 	return true;
 }
@@ -3062,17 +3063,18 @@ sna_dri2_schedule_flip(ClientPtr client, DrawablePtr draw, xf86CrtcPtr crtc,
 			}
 			DBG(("%s: executing xchg of pending flip: flip_continue=%d, keepalive=%d, chain?=%d\n", __FUNCTION__, info->flip_continue, info->keepalive, current_msc < *target_msc));
 			sna_dri2_xchg(draw, front, back);
-			info->flip_continue = FLIP_COMPLETE;
 			info->keepalive = KEEPALIVE;
-			signal = info->signal;
-			info->signal = true;
 			if (xorg_can_triple_buffer() &&
 			    current_msc < *target_msc) {
 				DBG(("%s: chaining flip\n", __FUNCTION__));
-				info->type = FLIP_THROTTLE;
+				info->flip_continue = FLIP_THROTTLE;
 				goto out;
-			} else
+			} else {
+				info->flip_continue = FLIP_COMPLETE;
+				signal = info->signal;
+				info->signal = true;
 				goto new_back;
+			}
 		}
 
 		info = sna_dri2_add_event(sna, draw, client, crtc);

commit da9ad388a0657b85fcf9a5f78ae1e75d0052dc52
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Nov 26 16:03:07 2015 +0000

    sna: Add DBG for small_copy()
    
    Emit a DBG when we decide that the region is small and pass that hint to
    the backends.
    
    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 3341851..71a6207 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1087,8 +1087,12 @@ sna_pixmap_create_scratch(ScreenPtr screen,
 
 static unsigned small_copy(const RegionRec *region)
 {
-	if ((region->extents.x2 - region->extents.x1)*(region->extents.y2 - region->extents.y1) < 1024)
+	if ((region->extents.x2 - region->extents.x1)*(region->extents.y2 - region->extents.y1) < 1024) {
+		DBG(("%s: region:%dx%d\n", __FUNCTION__,
+		     (region->extents.x2 - region->extents.x1),
+		     (region->extents.y2 - region->extents.y1)));
 		return COPY_SMALL;
+	}
 
 	return 0;
 }

commit d4aa7ca6f8e554b8de218216fd7e61e4b2df8763
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Nov 19 14:31:11 2015 +0000

    sna: Disable secondary planes on taking over VT
    
    Sometimes the kernel may leave other planes enabled on our VT. So, just
    as we validate that the CRTC state is as we expect when we take over the
    VT, make sure all secondary planes on the CRTCs are also disabled.
    
    Note to self: Xv needs to restore its planes.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index be7dfa5..67a626b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -128,6 +128,42 @@ struct local_mode_obj_get_properties {
 };
 #define LOCAL_MODE_OBJECT_PLANE 0xeeeeeeee
 
+struct local_mode_set_plane {
+	uint32_t plane_id;
+	uint32_t crtc_id;
+	uint32_t fb_id; /* fb object contains surface format type */
+	uint32_t flags;
+
+	/* Signed dest location allows it to be partially off screen */
+	int32_t crtc_x, crtc_y;
+	uint32_t crtc_w, crtc_h;
+
+	/* Source values are 16.16 fixed point */
+	uint32_t src_x, src_y;
+	uint32_t src_h, src_w;
+};
+#define LOCAL_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct local_mode_set_plane)
+
+struct local_mode_get_plane {
+	uint32_t plane_id;
+
+	uint32_t crtc_id;
+	uint32_t fb_id;
+
+	uint32_t possible_crtcs;
+	uint32_t gamma_size;
+
+	uint32_t count_format_types;
+	uint64_t format_type_ptr;
+};
+#define LOCAL_IOCTL_MODE_GETPLANE DRM_IOWR(0xb6, struct local_mode_get_plane)
+
+struct local_mode_get_plane_res {
+	uint64_t plane_id_ptr;
+	uint64_t count_planes;
+};
+#define LOCAL_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xb5, struct local_mode_get_plane_res)
+
 #if 0
 #define __DBG DBG
 #else
@@ -2982,16 +3018,11 @@ static void
 sna_crtc_find_planes(struct sna *sna, struct sna_crtc *crtc)
 {
 #define LOCAL_IOCTL_SET_CAP	DRM_IOWR(0x0d, struct local_set_cap)
-#define LOCAL_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xb5, struct local_mode_get_plane_res)
-#define LOCAL_IOCTL_MODE_GETPLANE DRM_IOWR(0xb6, struct local_mode_get_plane)
 	struct local_set_cap {
 		uint64_t name;
 		uint64_t value;
 	} cap;
-	struct local_mode_get_plane_res {
-		uint64_t plane_id_ptr;
-		uint64_t count_planes;
-	} r;
+	struct local_mode_get_plane_res r;
 	uint32_t stack_planes[32];
 	uint32_t *planes = stack_planes;
 	int i;
@@ -3024,18 +3055,7 @@ sna_crtc_find_planes(struct sna *sna, struct sna_crtc *crtc)
 	VG(VALGRIND_MAKE_MEM_DEFINED(planes, sizeof(uint32_t)*r.count_planes));
 
 	for (i = 0; i < r.count_planes; i++) {
-		struct local_mode_get_plane {
-			uint32_t plane_id;
-
-			uint32_t crtc_id;
-			uint32_t fb_id;
-
-			uint32_t possible_crtcs;
-			uint32_t gamma_size;
-
-			uint32_t count_format_types;
-			uint64_t format_type_ptr;
-		} p;
+		struct local_mode_get_plane p;
 		struct plane details;
 
 		VG_CLEAR(p);
@@ -7538,10 +7558,184 @@ sna_wait_for_scanline(struct sna *sna,
 	return ret;
 }
 
-void sna_mode_check(struct sna *sna)
+static bool sna_mode_shutdown_crtc(xf86CrtcPtr crtc)
+{
+	struct sna *sna = to_sna(crtc->scrn);
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+	bool disabled = false;
+	int o;
+
+	xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+		   "%s: invalid state found on pipe %d, disabling CRTC:%d\n",
+		   __FUNCTION__,
+		   __sna_crtc_pipe(to_sna_crtc(crtc)),
+		   __sna_crtc_id(to_sna_crtc(crtc)));
+	sna_crtc_disable(crtc, true);
+#if XF86_CRTC_VERSION >= 3
+	crtc->active = FALSE;
+#endif
+	if (crtc->enabled) {
+		crtc->enabled = FALSE;
+		disabled = true;
+	}
+
+	for (o = 0; o < sna->mode.num_real_output; o++) {
+		xf86OutputPtr output = config->output[o];
+
+		if (output->crtc != crtc)
+			continue;
+
+		output->funcs->dpms(output, DPMSModeOff);
+		output->crtc = NULL;
+	}
+
+	return disabled;
+}
+
+static xf86CrtcPtr
+lookup_crtc_by_id(struct sna *sna, int id)
 {
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+	int c;
+
+	for (c = 0; c < sna->mode.num_real_crtc; c++) {
+		xf86CrtcPtr crtc = config->crtc[c];
+		if (__sna_crtc_id(to_sna_crtc(crtc)) == id)
+			return crtc;
+	}
+
+	return NULL;
+}
+
+static int plane_type(struct sna *sna, int id)
+{
+	struct local_mode_obj_get_properties arg;
+	uint64_t stack_props[24];
+	uint32_t *props = (uint32_t *)stack_props;
+	uint64_t *values = stack_props + 8;
+	int i, type = -1;
+
+	memset(&arg, 0, sizeof(struct local_mode_obj_get_properties));
+	arg.obj_id = id;
+	arg.obj_type = LOCAL_MODE_OBJECT_PLANE;
+
+	arg.props_ptr = (uintptr_t)props;
+	arg.prop_values_ptr = (uintptr_t)values;
+	arg.count_props = 16;
+
+	if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_OBJ_GETPROPERTIES, &arg))
+		return -1;
+
+	DBG(("%s: object %d (type %x) has %d props\n", __FUNCTION__,
+	     id, LOCAL_MODE_OBJECT_PLANE, arg.count_props));
+
+	if (arg.count_props > 16) {
+		props = malloc(2*sizeof(uint64_t)*arg.count_props);
+		if (props == NULL)
+			return -1;
+
+		values = (uint64_t *)props + arg.count_props;
+
+		arg.props_ptr = (uintptr_t)props;
+		arg.prop_values_ptr = (uintptr_t)values;
+
+		if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_OBJ_GETPROPERTIES, &arg))
+			arg.count_props = 0;
+	}
+	VG(VALGRIND_MAKE_MEM_DEFINED(arg.props_ptr, sizeof(uint32_t)*arg.count_props));
+	VG(VALGRIND_MAKE_MEM_DEFINED(arg.prop_values_ptr, sizeof(uint64_t)*arg.count_props));
+
+	for (i = 0; i < arg.count_props; i++) {
+		struct drm_mode_get_property prop;
+
+		memset(&prop, 0, sizeof(prop));
+		prop.prop_id = props[i];
+		if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETPROPERTY, &prop)) {
+			ERR(("%s: prop[%d].id=%d GETPROPERTY failed with errno=%d\n",
+			     __FUNCTION__, i, props[i], errno));
+			continue;
+		}
+
+		DBG(("%s: prop[%d] .id=%ld, .name=%s, .flags=%x, .value=%ld\n", __FUNCTION__, i,
+		     (long)props[i], prop.name, (unsigned)prop.flags, (long)values[i]));
+
+		if (strcmp(prop.name, "type") == 0) {
+			type = values[i];
+			break;
+		}
+	}
+
+	if (props != (uint32_t *)stack_props)
+		free(props);
+
+	return type;
+}
+
+static bool
+sna_mode_disable_secondary_planes(struct sna *sna)
+{
+	struct local_mode_get_plane_res r;
+	uint32_t stack_planes[64];
+	uint32_t *planes = stack_planes;
 	bool disabled = false;
+	int i;
+
+	VG_CLEAR(r);
+	r.plane_id_ptr = (uintptr_t)planes;
+	r.count_planes = ARRAY_SIZE(stack_planes);
+	if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_GETPLANERESOURCES, &r))
+		return false;
+
+	DBG(("%s: %d planes\n", __FUNCTION__, (int)r.count_planes));
+
+	if (r.count_planes > ARRAY_SIZE(stack_planes)) {
+		planes = malloc(sizeof(uint32_t)*r.count_planes);
+		if (planes == NULL)
+			return false;
+
+		r.plane_id_ptr = (uintptr_t)planes;
+		if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_GETPLANERESOURCES, &r))
+			r.count_planes = 0;
+	}
+
+	VG(VALGRIND_MAKE_MEM_DEFINED(planes, sizeof(uint32_t)*r.count_planes));
+
+	for (i = 0; i < r.count_planes; i++) {
+		struct local_mode_get_plane p;
+		struct local_mode_set_plane s;
+
+		VG_CLEAR(p);
+		p.plane_id = planes[i];
+		p.count_format_types = 0;
+		if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_GETPLANE, &p))
+			continue;
+
+		if (p.fb_id == 0 || p.crtc_id == 0)
+			continue;
+
+		if (plane_type(sna, p.plane_id) == DRM_PLANE_TYPE_PRIMARY)
+			continue;
+
+		memset(&s, 0, sizeof(s));
+		s.plane_id = p.plane_id;
+		s.crtc_id = p.crtc_id;
+		if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s)) {
+			xf86CrtcPtr crtc = lookup_crtc_by_id(sna, p.crtc_id);
+			if (crtc)
+				disabled |= sna_mode_shutdown_crtc(crtc);
+		}
+	}
+
+	if (planes != stack_planes)
+		free(planes);
+
+	return disabled;
+}
+
+void sna_mode_check(struct sna *sna)
+{
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+	bool disabled;
 	int c, o;
 
 	if (sna->flags & SNA_IS_HOSTED)
@@ -7551,6 +7745,8 @@ void sna_mode_check(struct sna *sna)
 	if (sna->mode.hidden)
 		return;
 
+	disabled = sna_mode_disable_secondary_planes(sna);
+
 	/* Validate CRTC attachments and force consistency upon the kernel */
 	for (c = 0; c < sna->mode.num_real_crtc; c++) {
 		xf86CrtcPtr crtc = config->crtc[c];
@@ -7576,29 +7772,8 @@ void sna_mode_check(struct sna *sna)
 		     mode.crtc_id, mode.mode_valid,
 		     mode.fb_id, expected[0], expected[1]));
 
-		if (mode.fb_id != expected[0] && mode.fb_id != expected[1]) {
-			xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
-				   "%s: invalid state found on pipe %d, disabling CRTC:%d\n",
-				   __FUNCTION__, __sna_crtc_pipe(sna_crtc), __sna_crtc_id(sna_crtc));
-			sna_crtc_disable(crtc, true);
-#if XF86_CRTC_VERSION >= 3
-			crtc->active = FALSE;
-#endif
-			if (crtc->enabled) {
-				crtc->enabled = FALSE;
-				disabled = true;
-			}
-
-			for (o = 0; o < sna->mode.num_real_output; o++) {
-				xf86OutputPtr output = config->output[o];
-
-				if (output->crtc != crtc)
-					continue;
-
-				output->funcs->dpms(output, DPMSModeOff);
-				output->crtc = NULL;
-			}
-		}
+		if (mode.fb_id != expected[0] && mode.fb_id != expected[1])
+			disabled |= sna_mode_shutdown_crtc(crtc);
 	}
 
 	for (o = 0; o < config->num_output; o++) {
@@ -7624,21 +7799,7 @@ void sna_mode_check(struct sna *sna)
 static bool
 sna_crtc_hide_planes(struct sna *sna, struct sna_crtc *crtc)
 {
-#define LOCAL_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct local_mode_set_plane)
-	struct local_mode_set_plane {
-		uint32_t plane_id;
-		uint32_t crtc_id;
-		uint32_t fb_id; /* fb object contains surface format type */
-		uint32_t flags;
-
-		/* Signed dest location allows it to be partially off screen */
-		int32_t crtc_x, crtc_y;
-		uint32_t crtc_w, crtc_h;
-
-		/* Source values are 16.16 fixed point */
-		uint32_t src_x, src_y;
-		uint32_t src_h, src_w;
-	} s;
+	struct local_mode_set_plane s;
 
 	if (crtc->primary.id == 0)
 		return false;
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 8cbabb0..14ec2f6 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -779,10 +779,9 @@ sna_handle_uevents(int fd, void *closure)
 		DBG(("%s: hotplug event (vtSema?=%d)\n",
 		     __FUNCTION__, sna->scrn->vtSema));
 
-		if (sna->scrn->vtSema) {
+		if (sna->scrn->vtSema)
 			sna_mode_discover(sna, true);
-			sna_mode_check(sna);
-		} else
+		else
 			sna->flags |= SNA_REPROBE;
 	}
 }

commit 0995ad221d0bab03e4b4f9c1c36849fda2a51339
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Nov 22 17:59:34 2015 +0000

    sna: Remove obsolete assertion
    
    Once upon a time we only flagged th bo->purged when calling madvise and
    being told by the kernel that the bo was truncated. However, we now also
    preemptively set the flag on buffers we decide cannot be CPU mapped,
    invalidating the assertion.
    
    Reported-by: Jiri Slaby <jirislaby@gmail.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c64

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 9e32c7a..fefa475 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -870,27 +870,21 @@ static uint32_t gem_create(int fd, int num_pages)
 	return create.handle;
 }
 
-static bool
+static void
 kgem_bo_set_purgeable(struct kgem *kgem, struct kgem_bo *bo)
 {
-#if DBG_NO_MADV
-	return true;
-#else
+#if !DBG_NO_MADV
 	struct drm_i915_gem_madvise madv;
 
 	assert(bo->exec == NULL);
-	assert(!bo->purged);
 
 	VG_CLEAR(madv);
 	madv.handle = bo->handle;
 	madv.madv = I915_MADV_DONTNEED;
 	if (do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_MADVISE, &madv) == 0) {
-		bo->purged = 1;
+		bo->purged = true;
 		kgem->need_purge |= !madv.retained && bo->domain != DOMAIN_CPU;
-		return madv.retained;
 	}
-
-	return true;
 #endif
 }
 

commit f6e9316ed44ff491e26a7f43db71a4883147ca5b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Nov 19 23:20:07 2015 +0000

    Re-enable acceleration!
    
    Double negatives are most confusing before coffee. In removing the
    double negation from the xorg.conf, I inverted the option in the code
    but didn't invert the test. As a result, acceleration was now disabled
    unless you explicitly asked for NoAccel.
    
    Reported-by: Jan Steffens
    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 7e20715..3341851 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -17985,7 +17985,7 @@ static bool sna_option_accel_none(struct sna *sna)
 	if (wedged(sna))
 		return true;
 
-	if (xf86ReturnOptValBool(sna->Options, OPTION_ACCEL_ENABLE, TRUE))
+	if (!xf86ReturnOptValBool(sna->Options, OPTION_ACCEL_ENABLE, TRUE))
 		return true;
 
 	if (sna->kgem.gen >= 0120)
diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c
index 70bce84..8f76b34 100644
--- a/src/uxa/intel_driver.c
+++ b/src/uxa/intel_driver.c
@@ -364,7 +364,7 @@ static Bool can_accelerate_blt(struct intel_screen_private *intel)
 	if (INTEL_INFO(intel)->gen == -1)
 		return FALSE;
 
-	if (xf86ReturnOptValBool(intel->Options, OPTION_ACCEL_ENABLE, TRUE) ||
+	if (!xf86ReturnOptValBool(intel->Options, OPTION_ACCEL_ENABLE, TRUE) ||
 	    !intel_option_cast_to_bool(intel->Options, OPTION_ACCEL_METHOD, TRUE)) {
 		xf86DrvMsg(intel->scrn->scrnIndex, X_CONFIG,
 			   "Disabling hardware acceleration.\n");

commit c446a7ccc783e3ca00b4b15d017c6e3af66dc646
Author: Wayne Boyer <wayne.boyer@intel.com>
Date:   Wed Nov 18 10:39:42 2015 -0800

    Add Kabylake PCI IDs
    
    Add the Kabylake PCI IDs based on the following kernel patches:
    
    commit d97044b661d0d56b2a2ae9b2b95ab0b359b417dc
    Author: Deepak S <deepak.s@intel.com>
    Date:   Wed Oct 28 12:19:51 2015 -0700
    
        drm/i915/kbl: Add Kabylake PCI ID
    
    commit 8b10c0cf21ec84618d4bf02c73c0543500ece68d
    Author: Deepak S <deepak.s@intel.com>
    Date:   Wed Oct 28 12:21:12 2015 -0700
    
        drm/i915/kbl: Add Kabylake GT4 PCI ID
    
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Wayne Boyer <wayne.boyer@intel.com>
    [ickle: Copy across the real i915_pciids.h from the kernel]

diff --git a/src/i915_pciids.h b/src/i915_pciids.h
index 17c4456..f1a113e 100644
--- a/src/i915_pciids.h
+++ b/src/i915_pciids.h
@@ -291,4 +291,40 @@
 	INTEL_VGA_DEVICE(0x1A84, info), \
 	INTEL_VGA_DEVICE(0x5A84, info)
 
+#define INTEL_KBL_GT1_IDS(info)	\
+	INTEL_VGA_DEVICE(0x5913, info), /* ULT GT1.5 */ \
+	INTEL_VGA_DEVICE(0x5915, info), /* ULX GT1.5 */ \
+	INTEL_VGA_DEVICE(0x5917, info), /* DT  GT1.5 */ \
+	INTEL_VGA_DEVICE(0x5906, info), /* ULT GT1 */ \
+	INTEL_VGA_DEVICE(0x590E, info), /* ULX GT1 */ \
+	INTEL_VGA_DEVICE(0x5902, info), /* DT  GT1 */ \
+	INTEL_VGA_DEVICE(0x590B, info), /* Halo GT1 */ \
+	INTEL_VGA_DEVICE(0x590A, info) /* SRV GT1 */
+
+#define INTEL_KBL_GT2_IDS(info)	\
+	INTEL_VGA_DEVICE(0x5916, info), /* ULT GT2 */ \
+	INTEL_VGA_DEVICE(0x5921, info), /* ULT GT2F */ \
+	INTEL_VGA_DEVICE(0x591E, info), /* ULX GT2 */ \
+	INTEL_VGA_DEVICE(0x5912, info), /* DT  GT2 */ \
+	INTEL_VGA_DEVICE(0x591B, info), /* Halo GT2 */ \
+	INTEL_VGA_DEVICE(0x591A, info), /* SRV GT2 */ \
+	INTEL_VGA_DEVICE(0x591D, info) /* WKS GT2 */
+
+#define INTEL_KBL_GT3_IDS(info) \
+	INTEL_VGA_DEVICE(0x5926, info), /* ULT GT3 */ \
+	INTEL_VGA_DEVICE(0x592B, info), /* Halo GT3 */ \
+	INTEL_VGA_DEVICE(0x592A, info) /* SRV GT3 */
+
+#define INTEL_KBL_GT4_IDS(info) \
+	INTEL_VGA_DEVICE(0x5932, info), /* DT  GT4 */ \
+	INTEL_VGA_DEVICE(0x593B, info), /* Halo GT4 */ \
+	INTEL_VGA_DEVICE(0x593A, info), /* SRV GT4 */ \
+	INTEL_VGA_DEVICE(0x593D, info)  /* WKS GT4 */
+
+#define INTEL_KBL_IDS(info) \
+	INTEL_KBL_GT1_IDS(info), \
+	INTEL_KBL_GT2_IDS(info), \
+	INTEL_KBL_GT3_IDS(info), \
+	INTEL_KBL_GT4_IDS(info)
+
 #endif /* _I915_PCIIDS_H */
diff --git a/src/intel_module.c b/src/intel_module.c


Reply to: