xf86-video-intel: 4 commits - src/sna/sna_accel.c src/sna/sna_display.c src/sna/sna_display_fake.c src/sna/sna_driver.c src/sna/sna.h tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Nov 30 23:55:23 UTC 2016


 src/sna/sna.h              |    3 +++
 src/sna/sna_accel.c        |   32 +++++++++++++++++---------------
 src/sna/sna_display.c      |    7 ++++++-
 src/sna/sna_display_fake.c |   10 ++--------
 src/sna/sna_driver.c       |    6 ++++--
 tools/virtual.c            |   24 +++++++++++++++++++-----
 6 files changed, 51 insertions(+), 31 deletions(-)

New commits:
commit 9ac7a3370ab265d4cbdbbf3dc588af88c37048e1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 29 22:01:21 2016 +0000

    sna: Handle xf86Randr12 gamma changes in xorg-xserver-1.19
    
    commit 17213b74fd7fc4c4e2fe7a3781e7422dd482a0ab
    Author: Michel Dänzer <michel.daenzer at amd.com>
    Date:   Tue Jun 21 16:44:20 2016 +0900
    
        xfree86/modes: Remove xf86RandR12CrtcGetGamma
    
    removed the randr_crtc->palettes allocation and initialisation causing a
    later dereference of the gamma table to crash. Looks like that was just
    ABI misuse.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=98855
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display_fake.c b/src/sna/sna_display_fake.c
index f0bdea6..fa26bda 100644
--- a/src/sna/sna_display_fake.c
+++ b/src/sna/sna_display_fake.c
@@ -96,12 +96,6 @@ sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 }
 
 static void
-sna_crtc_gamma_set(xf86CrtcPtr crtc,
-		       CARD16 *red, CARD16 *green, CARD16 *blue, int size)
-{
-}
-
-static void
 sna_crtc_destroy(xf86CrtcPtr crtc)
 {
 }
@@ -109,7 +103,6 @@ sna_crtc_destroy(xf86CrtcPtr crtc)
 static const xf86CrtcFuncsRec sna_crtc_funcs = {
 	.dpms = sna_crtc_dpms,
 	.set_mode_major = sna_crtc_set_mode_major,
-	.gamma_set = sna_crtc_gamma_set,
 	.destroy = sna_crtc_destroy,
 };
 
@@ -298,7 +291,8 @@ static bool add_fake_output(struct sna *sna, bool late)
 
 		RRCrtcSetRotations(crtc->randr_crtc,
 				   RR_Rotate_All | RR_Reflect_All);
-		RRCrtcGammaGet(crtc->randr_crtc);
+		if (!RRCrtcGammaSetSize(crtc->randr_crtc, 256))
+			goto err;
 	}
 
 	sna->mode.num_fake++;
commit f2901dd34d371113cb9ebe70ef91f700f45f7729
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 30 18:53:22 2016 +0000

    sna: Always ask the client to reprobe after userspace
    
    This doesn't guarrantee that the client does, but the kernel insists.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 1b89cfd..1d31d00 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -5369,6 +5369,7 @@ void sna_mode_discover(struct sna *sna, bool tell)
 {
 	ScreenPtr screen = xf86ScrnToScreen(sna->scrn);
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+	bool force = sna->flags & SNA_REPROBE;
 	struct drm_mode_card_res res;
 	uint32_t connectors[32], now;
 	unsigned changed = 0;
@@ -5402,7 +5403,11 @@ void sna_mode_discover(struct sna *sna, bool tell)
 	if (serial == 0)
 		serial = ++sna->mode.serial;
 
-	now = GetTimeInMillis();
+	if (force) {
+		changed = 4;
+		now = 0;
+	} else
+		now = GetTimeInMillis();
 	for (i = 0; i < res.count_connectors; i++) {
 		DBG(("%s: connector[%d] = %d\n", __FUNCTION__, i, connectors[i]));
 		for (j = 0; j < sna->mode.num_real_output; j++) {
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 5170439..1b4015d 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -806,10 +806,12 @@ sna_handle_uevents(int fd, void *closure)
 			str = udev_device_get_property_value(dev, "HOTPLUG");
 			if (str && atoi(str) == 1) {
 				str = udev_device_get_property_value(dev, "CONNECTOR");
-				if (str)
+				if (str) {
 					hotplug |= sna_mode_find_hotplug_connector(sna, atoi(str));
-				else
+				} else {
+					sna->flags |= SNA_REPROBE;
 					hotplug = true;
+				}
 			}
 		}
 
commit 35473dd9c9455238721a090021b4665fd9259c0c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 30 23:39:05 2016 +0000

    sna: Prevent switching to GPU rendering when given a SHM pixmap
    
    If we have a SHM pixmap, we only track rendering via the CPU bo for
    synchronisation with the client.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 072c34f..7861110 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -1367,6 +1367,9 @@ static inline void add_shm_flush(struct sna *sna, struct sna_pixmap *priv)
 	if (!priv->shm)
 		return;
 
+	DBG(("%s: marking handle=%d for SHM flush\n",
+	     __FUNCTION__, priv->cpu_bo->handle));
+
 	assert(!priv->flush);
 	sna_add_flush_pixmap(sna, priv, priv->cpu_bo);
 	sna->needs_shm_flush = true;
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9fe09ff..5d72c0e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4044,26 +4044,28 @@ prefer_gpu_bo:
 			goto move_to_gpu;
 		}
 
-		if ((priv->cpu_damage == NULL || flags & IGNORE_DAMAGE)) {
-			if (priv->gpu_bo && priv->gpu_bo->tiling) {
-				DBG(("%s: prefer to use GPU bo for rendering large pixmaps\n", __FUNCTION__));
-				goto prefer_gpu_bo;
+		if (!priv->shm) {
+			if ((priv->cpu_damage == NULL || flags & IGNORE_DAMAGE)) {
+				if (priv->gpu_bo && priv->gpu_bo->tiling) {
+					DBG(("%s: prefer to use GPU bo for rendering large pixmaps\n", __FUNCTION__));
+					goto prefer_gpu_bo;
+				}
+
+				if (priv->cpu_bo->pitch >= 4096) {
+					DBG(("%s: prefer to use GPU bo for rendering wide pixmaps\n", __FUNCTION__));
+					goto prefer_gpu_bo;
+				}
 			}
 
-			if (priv->cpu_bo->pitch >= 4096) {
-				DBG(("%s: prefer to use GPU bo for rendering wide pixmaps\n", __FUNCTION__));
+			if ((flags & IGNORE_DAMAGE) == 0 && priv->cpu_bo->snoop) {
+				DBG(("%s: prefer to use GPU bo for reading from snooped target bo\n", __FUNCTION__));
 				goto prefer_gpu_bo;
 			}
-		}
-
-		if ((flags & IGNORE_DAMAGE) == 0 && priv->cpu_bo->snoop) {
-			DBG(("%s: prefer to use GPU bo for reading from snooped target bo\n", __FUNCTION__));
-			goto prefer_gpu_bo;
-		}
 
-		if (!sna->kgem.can_blt_cpu) {
-			DBG(("%s: can't render to CPU bo, try to use GPU bo\n", __FUNCTION__));
-			goto prefer_gpu_bo;
+			if (!sna->kgem.can_blt_cpu) {
+				DBG(("%s: can't render to CPU bo, try to use GPU bo\n", __FUNCTION__));
+				goto prefer_gpu_bo;
+			}
 		}
 	}
 
commit cdd06717643f4d110a0d9c2b72851f9cb2c64b81
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 30 23:40:14 2016 +0000

    tools/intel-virtual-output: Check for pending events before blocking
    
    If the xlib/xcb library has pulled events from the fd, then a poll on
    that fd will block until new events arrive. If none do, we fail to
    process the currently waiting events in a timely fashion.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index 77e6a58..fc8db2b 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -3392,6 +3392,7 @@ int main(int argc, char **argv)
 	uint64_t count;
 	int daemonize = 1, bumblebee = 0, siblings = 0, singleton = 1;
 	int i, ret, open, fail;
+	int idle;
 
 	signal(SIGPIPE, SIG_IGN);
 
@@ -3572,21 +3573,30 @@ int main(int argc, char **argv)
 
 	ctx.command_continuation = 0;
 	update_cursor_image(&ctx);
+
+	idle = 0;
 	while (!done) {
 		XEvent e;
 		int reconfigure = 0;
 		int rr_update = 0;
 
-		DBG(POLL, ("polling - enable timer? %d, nfd=%d, ndisplay=%d\n", ctx.timer_active, ctx.nfd, ctx.ndisplay));
-		ret = poll(ctx.pfd + !ctx.timer_active, ctx.nfd - !ctx.timer_active, -1);
-		if (ret <= 0)
-			break;
+		if (idle) {
+			DBG(POLL, ("polling - enable timer? %d, nfd=%d, ndisplay=%d\n", ctx.timer_active, ctx.nfd, ctx.ndisplay));
+			ret = poll(ctx.pfd + !ctx.timer_active, ctx.nfd - !ctx.timer_active, -1);
+			if (ret <= 0)
+				break;
+
+			DBG(POLL, ("poll reports %d fd awake\n", ret));
+		}
+		idle = 1;
 
 		/* pfd[0] is the timer, pfd[1] is the local display, pfd[2] is the mouse, pfd[3+] are the remotes */
 
-		DBG(POLL, ("poll reports %d fd awake\n", ret));
 		if (ctx.pfd[1].revents || XPending(ctx.display[0].dpy)) {
 			DBG(POLL,("%s woken up\n", DisplayString(ctx.display[0].dpy)));
+			ctx.pfd[1].revents = 0;
+			idle = 0;
+
 			do {
 				XNextEvent(ctx.display->dpy, &e);
 
@@ -3663,6 +3673,9 @@ int main(int argc, char **argv)
 			if (ctx.pfd[i+2].revents == 0 && !XPending(ctx.display[i].dpy))
 				continue;
 
+			ctx.pfd[i+2].revents = 0;
+			idle = 0;
+
 			DBG(POLL, ("%s woken up\n", DisplayString(ctx.display[i].dpy)));
 			do {
 				XNextEvent(ctx.display[i].dpy, &e);
@@ -3742,6 +3755,7 @@ int main(int argc, char **argv)
 
 			DBG(TIMER, ("%s timer still active? %d\n", DisplayString(ctx.display->dpy), ret != 0));
 			ctx.timer_active = ret != 0;
+			idle = 0;
 		}
 	}
 


More information about the xorg-commit mailing list