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

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



 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 
 20 files changed, 725 insertions(+), 421 deletions(-)

New commits:
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
index d3dca83..60835b9 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -130,6 +130,10 @@ static const struct intel_device_info intel_broxton_info = {
 	.gen = 0111,
 };
 
+static const struct intel_device_info intel_kabylake_info = {
+	.gen = 0112,
+};
+
 static const SymTabRec intel_chipsets[] = {
 	{PCI_CHIP_I810,				"i810"},
 	{PCI_CHIP_I810_DC100,			"i810-dc100"},
@@ -329,6 +333,8 @@ static const struct pci_id_match intel_device_match[] = {
 
 	INTEL_BXT_IDS(&intel_broxton_info),
 
+	INTEL_KBL_IDS(&intel_kabylake_info),
+
 	INTEL_VGA_DEVICE(PCI_MATCH_ANY, &intel_generic_info),
 #endif
 

commit 3cdc1780e3fbd789c40487fed4fb2272002784ab
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Nov 19 10:37:42 2015 +0000

    Rename Option "NoAccel" to "Accel"
    
    Totally cribbed from xf86-video-amdgpu/-radeon:
    
    commit 560b7fe6dc66405762020f00e9a05918a36f3a17
    Author: Michel Dänzer <michel.daenzer@amd.com>
    Date:   Wed Nov 11 17:31:34 2015 +0900
    
        Rename Option "NoAccel" to "Accel"
    
    Renaming the option removes the need for a double negation when forcing
    acceleration on and is backwards compatible as the option parser
    automagically handles the 'No' prefix.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/man/intel.man b/man/intel.man
index 318a5b7..8da496e 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -112,8 +112,8 @@ The default is 8192 if AGP allocable memory is < 128 MB, 16384 if < 192 MB,
 24576 if higher. DRI require at least a value of 16384. Higher values may give
 better 3D performance, at expense of available system memory.
 .TP
-.BI "Option \*qNoAccel\*q \*q" boolean \*q
-Disable or enable acceleration.
+.BI "Option \*qAccel\*q \*q" boolean \*q
+Enable or disable acceleration.
 .IP
 Default: acceleration is enabled.
 
@@ -122,8 +122,8 @@ The following driver
 .B Options
 are supported for the 830M and later chipsets:
 .TP
-.BI "Option \*qNoAccel\*q \*q" boolean \*q
-Disable or enable acceleration.
+.BI "Option \*qAccel\*q \*q" boolean \*q
+Enable or disable acceleration.
 .IP
 Default: acceleration is enabled.
 .TP
diff --git a/src/intel_options.c b/src/intel_options.c
index d19736b..7f253ac 100644
--- a/src/intel_options.c
+++ b/src/intel_options.c
@@ -9,7 +9,7 @@
 #include "intel_options.h"
 
 const OptionInfoRec intel_options[] = {
-	{OPTION_ACCEL_DISABLE,	"NoAccel",	OPTV_BOOLEAN,	{0},	0},
+	{OPTION_ACCEL_ENABLE,	"Accel",	OPTV_BOOLEAN,	{0},	0},
 	{OPTION_ACCEL_METHOD,	"AccelMethod",	OPTV_STRING,	{0},	0},
 	{OPTION_BACKLIGHT,	"Backlight",	OPTV_STRING,	{0},	0},
 	{OPTION_EDID,		"CustomEDID",	OPTV_STRING,	{0},	0},
diff --git a/src/intel_options.h b/src/intel_options.h
index a831c55..43635f1 100644
--- a/src/intel_options.h
+++ b/src/intel_options.h
@@ -12,7 +12,7 @@
  */
 
 enum intel_options {
-	OPTION_ACCEL_DISABLE,
+	OPTION_ACCEL_ENABLE,
 	OPTION_ACCEL_METHOD,
 	OPTION_BACKLIGHT,
 	OPTION_EDID,
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 7d7731b..7e20715 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_DISABLE, FALSE))
+	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 8e685bd..70bce84 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_DISABLE, FALSE) ||
+	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 666f25baf00ac3f04096655c4022ec7a2d17247b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Nov 18 11:08:37 2015 +0000

    sna: Only reap the VMA if tiling actually changes
    
    We only need to recreate the GTT mmap iff we need a new fence, so
    preserve the old mmaping when we can.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index b6a2ef1..9e32c7a 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -5262,6 +5262,14 @@ static void __kgem_bo_make_scanout(struct kgem *kgem,
 	}
 }
 
+static bool tiling_changed(struct kgem_bo *bo, int tiling, int pitch)
+{
+	if (tiling != bo->tiling)
+		return true;
+
+	return tiling != I915_TILING_NONE && pitch != bo->pitch;
+}
+
 static void set_gpu_tiling(struct kgem *kgem,
 			   struct kgem_bo *bo,
 			   int tiling, int pitch)
@@ -5271,10 +5279,7 @@ static void set_gpu_tiling(struct kgem *kgem,
 
 	assert(!kgem->can_fence);
 
-	bo->tiling = tiling;
-	bo->pitch = pitch;
-
-	if (tiling && bo->map__gtt) {
+	if (tiling_changed(bo, tiling, pitch) && bo->map__gtt) {
 		if (!list_is_empty(&bo->vma)) {
 			list_del(&bo->vma);
 			kgem->vma[0].count--;
@@ -5282,6 +5287,9 @@ static void set_gpu_tiling(struct kgem *kgem,
 		munmap(bo->map__gtt, bytes(bo));
 		bo->map__gtt = NULL;
 	}
+
+	bo->tiling = tiling;
+	bo->pitch = pitch;
 }
 
 struct kgem_bo *kgem_create_2d(struct kgem *kgem,

commit 4ef8dd65e1b533191c234ff8de56e1965a7d58b8
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Nov 18 10:59:41 2015 +0000

    sna: Add some DBG around tiling changes
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>


Reply to: