xf86-video-intel: 5 commits - src/intel_device.c src/intel_module.c src/sna/sna_blt.c src/sna/sna_composite.c src/sna/sna_glyphs.c src/sna/sna_render_inline.h src/sna/sna_threads.c src/sna/sna_trapezoids_boxes.c src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Mar 10 15:20:03 PDT 2014


 src/intel_device.c             |   54 ++++++++++++++++++++++++++++-------------
 src/intel_module.c             |    6 ++++
 src/sna/sna_blt.c              |    2 -
 src/sna/sna_composite.c        |    3 +-
 src/sna/sna_glyphs.c           |   18 +++++--------
 src/sna/sna_render_inline.h    |   28 ++++++++++++++++++---
 src/sna/sna_threads.c          |    2 -
 src/sna/sna_trapezoids.c       |    8 +++---
 src/sna/sna_trapezoids_boxes.c |    2 -
 9 files changed, 84 insertions(+), 39 deletions(-)

New commits:
commit d10a5abcbd7c751adc08e24d9f4bdc33596b6f12
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Mar 7 19:44:07 2014 +0000

    intel: Supply a fallback guess for the device path
    
    If for some reason we have an fd, but no device path, use the likely
    default path (derived from and validated against the major/minor of the
    open device fd).
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_device.c b/src/intel_device.c
index 38b57e2..bd66ae6 100644
--- a/src/intel_device.c
+++ b/src/intel_device.c
@@ -190,6 +190,26 @@ static int __intel_open_device(const struct pci_device *pci, char **path)
 	return fd;
 }
 
+static char *find_master_node(int fd)
+{
+	struct stat st, master;
+	char buf[128];
+
+	if (fstat(fd, &st))
+		return NULL;
+
+	if (!S_ISCHR(st.st_mode))
+		return NULL;
+
+	sprintf(buf, "/dev/dri/card%d", (int)(st.st_rdev & 0x7f));
+	if (stat(buf, &master) == 0 &&
+	    st.st_mode == master.st_mode &&
+	    (st.st_rdev & 0x7f) == master.st_rdev)
+		return strdup(buf);
+
+	return NULL;
+}
+
 static char *find_render_node(int fd)
 {
 #if defined(USE_RENDERNODE)
@@ -283,6 +303,12 @@ int intel_open_device(int entity_num,
 		master_count = 0;
 	}
 
+	if (local_path == NULL) {
+		local_path = find_master_node(fd);
+		if (local_path == NULL)
+			goto err_close;
+	}
+
 	if (!__intel_check_device(fd))
 		goto err_close;
 
commit 28cab948f50b1d67468edbd9c8e10d3d696155f5
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Mar 7 14:13:38 2014 +0100

    intel: Add support for server managed fds
    
    In the post-modern world, the platform device nodes are handed to a
    non-privileged Xserver by systemd/logind. We can then query the core for
    our assigned fd rather than try to open the device for ourselves (which
    would fail when trying to obtain DRM_MASTER status). A consequence is
    that we then do not directly control DRM_MASTER status and must act as a
    delegate of systemd.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/src/intel_device.c b/src/intel_device.c
index d0c8092..38b57e2 100644
--- a/src/intel_device.c
+++ b/src/intel_device.c
@@ -240,19 +240,10 @@ static char *get_path(struct xf86_platform_device *dev)
 #endif
 
 
-#if defined(ODEV_ATTRIB_FD) && 0
+#if defined(ODEV_ATTRIB_FD)
 static int get_fd(struct xf86_platform_device *dev)
 {
-	const char *str;
-
-	if (dev == NULL)
-		return -1;
-
-	str = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_FD);
-	if (str == NULL)
-		return -1;
-
-	return atoi(str);
+	return xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
 }
 
 #else
@@ -261,7 +252,6 @@ static int get_fd(struct xf86_platform_device *dev)
 {
 	return -1;
 }
-
 #endif
 
 int intel_open_device(int entity_num,
@@ -270,7 +260,7 @@ int intel_open_device(int entity_num,
 {
 	struct intel_device *dev;
 	char *local_path;
-	int fd;
+	int fd, master_count;
 
 	if (intel_device_key == -1)
 		intel_device_key = xf86AllocateEntityPrivateIndex();
@@ -283,11 +273,15 @@ int intel_open_device(int entity_num,
 
 	local_path = get_path(platform);
 
+	master_count = 1; /* DRM_MASTER is managed by Xserver */
 	fd = get_fd(platform);
-	if (fd == -1)
+	if (fd == -1) {
 		fd = __intel_open_device(pci, &local_path);
-	if (fd == -1)
-		goto err_path;
+		if (fd == -1)
+			goto err_path;
+
+		master_count = 0;
+	}
 
 	if (!__intel_check_device(fd))
 		goto err_close;
@@ -298,7 +292,7 @@ int intel_open_device(int entity_num,
 
 	dev->fd = fd;
 	dev->open_count = 0;
-	dev->master_count = 0;
+	dev->master_count = master_count;
 	dev->master_node = local_path;
 	dev->render_node = find_render_node(fd);
 	if (dev->render_node == NULL)
diff --git a/src/intel_module.c b/src/intel_module.c
index 51de62a..75860be 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -419,6 +419,12 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn,
 #endif
 
 		return TRUE;
+
+#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(1,15,99,902,0)
+	case SUPPORTS_SERVER_FDS:
+		return TRUE;
+#endif
+
 	default:
 		/* Unknown or deprecated function */
 		return FALSE;
commit e5f8118bdbc4655d987ab1c52e0a46fa85cc92c4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 10 22:12:39 2014 +0000

    sna: DBG compilation fixups
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 26a0944..d1d5ccd 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -2883,7 +2883,7 @@ fastcall static void sna_blt_fill_op_points(struct sna *sna,
 	const struct sna_blt_state *blt = &op->base.u.blt;
 	struct kgem *kgem = &sna->kgem;
 
-	DBG(("%s: %08x x %d\n", __FUNCTION__, blt->pixel, npoints));
+	DBG(("%s: %08x x %d\n", __FUNCTION__, blt->pixel, n));
 
 	if (sna->blt_state.fill_bo != op->base.u.blt.bo[0]->unique_id) {
 		sna_blt_fill_begin(sna, blt);
diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index 52fa405..c56f3bc 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -214,7 +214,7 @@ void sna_threads_wait(void)
 		}
 
 		if (threads[n].arg != NULL) {
-			DBG(("%s: thread[%d] died from signal %d\n", __func__, n, (int)threads[n].arg));
+			DBG(("%s: thread[%d] died from signal %d\n", __func__, n, (int)(intptr_t)threads[n].arg));
 			sna_threads_kill();
 			return;
 		}
commit 6ed8570f6aa01fdd4edc3df7585f01083b4a9778
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 10 16:39:50 2014 +0000

    sna: Pass render hints for migration based on source location
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index d5c229c..74dfc9e 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -676,7 +676,8 @@ sna_composite(CARD8 op,
 	}
 
 	if (use_cpu(pixmap, priv, op, width, height) &&
-	    !picture_is_gpu(sna, src) && !picture_is_gpu(sna, mask)) {
+	    !picture_is_gpu(sna, src, PREFER_GPU_RENDER) &&
+	    !picture_is_gpu(sna, mask, PREFER_GPU_RENDER)) {
 		DBG(("%s: fallback, dst pixmap=%ld is too small (or completely damaged)\n",
 		     __FUNCTION__, pixmap->drawable.serialNumber));
 		goto fallback;
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index eca0df0..8b44f1f 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -1915,7 +1915,7 @@ sna_glyphs(CARD8 op,
 	}
 
 	if ((too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) &&
-	    !picture_is_gpu(sna, src)) {
+	    !picture_is_gpu(sna, src, 0)) {
 		DBG(("%s: fallback -- too small (%dx%d)\n",
 		     __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height));
 		goto fallback;
@@ -2244,7 +2244,7 @@ sna_glyphs__shared(CARD8 op,
 	}
 
 	if ((too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) &&
-	    !picture_is_gpu(sna, src)) {
+	    !picture_is_gpu(sna, src, 0)) {
 		DBG(("%s: fallback -- too small (%dx%d)\n",
 		     __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height));
 		goto fallback;
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index 3f74341..e292949 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -117,11 +117,33 @@ unattached(DrawablePtr drawable)
 }
 
 static inline bool
-picture_is_gpu(struct sna *sna, PicturePtr picture)
+picture_is_gpu(struct sna *sna, PicturePtr picture, unsigned flags)
 {
-	if (!picture || !picture->pDrawable)
+	if (!picture)
 		return false;
-	return is_gpu(sna, picture->pDrawable, PREFER_GPU_RENDER);
+
+	if (!picture->pDrawable) {
+		switch (flags) {
+		case PREFER_GPU_RENDER:
+			switch (picture->pSourcePict->type) {
+			case SourcePictTypeSolidFill:
+			case SourcePictTypeLinear:
+				return false;
+			default:
+				return true;
+			}
+		case PREFER_GPU_SPANS:
+			return true;
+		default:
+			return false;
+		}
+	} else {
+		if (picture->repeat &&
+		    (picture->pDrawable->width | picture->pDrawable->height) == 1)
+			return flags == PREFER_GPU_SPANS;
+	}
+
+	return is_gpu(sna, picture->pDrawable, flags);
 }
 
 static inline bool
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index c42053d..4ad61bf 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -318,7 +318,7 @@ trapezoids_fallback(struct sna *sna,
 		DBG(("%s: mask (%dx%d) depth=%d, format=%08x\n",
 		     __FUNCTION__, width, height, depth, format));
 		if (is_gpu(sna, dst->pDrawable, PREFER_GPU_RENDER) ||
-		    picture_is_gpu(sna, src)) {
+		    picture_is_gpu(sna, src, PREFER_GPU_RENDER)) {
 			int num_threads;
 
 			scratch = sna_pixmap_create_upload(screen,
@@ -487,7 +487,7 @@ trapezoid_spans_maybe_inplace(struct sna *sna,
 
 	case PICT_x8r8g8b8:
 	case PICT_a8r8g8b8:
-		if (picture_is_gpu(sna, src))
+		if (picture_is_gpu(sna, src, 0))
 			return false;
 
 		switch (op) {
@@ -596,11 +596,11 @@ sna_composite_trapezoids(CARD8 op,
 
 	if (FORCE_FALLBACK == 0 &&
 	    (too_small(priv) || DAMAGE_IS_ALL(priv->cpu_damage)) &&
-	    !picture_is_gpu(sna, src) && untransformed(src)) {
+	    !picture_is_gpu(sna, src, 0) && untransformed(src)) {
 		DBG(("%s: force fallbacks -- (too small, %dx%d? %d || all-cpu? %d) && (src-is-cpu? %d && untransformed? %d)\n",
 		     __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height,
 		     too_small(priv), (int)DAMAGE_IS_ALL(priv->cpu_damage),
-		     !picture_is_gpu(sna, src), untransformed(src)));
+		     !picture_is_gpu(sna, src, 0), untransformed(src)));
 
 force_fallback:
 		force_fallback = true;
diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c
index 2a476dc..898efb5 100644
--- a/src/sna/sna_trapezoids_boxes.c
+++ b/src/sna/sna_trapezoids_boxes.c
@@ -1057,7 +1057,7 @@ composite_unaligned_boxes_inplace(struct sna *sna,
 {
 	if (!force_fallback &&
 	    (is_gpu(sna, dst->pDrawable, PREFER_GPU_SPANS) ||
-	     picture_is_gpu(sna, src))) {
+	     picture_is_gpu(sna, src, PREFER_GPU_SPANS))) {
 		DBG(("%s: fallback -- not forcing\n", __FUNCTION__));
 		return false;
 	}
commit 955b5de4ba103fb115ec0b45f9b59eb2628ca3dd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Mar 10 16:38:54 2014 +0000

    sna/glyph: Release the pixman glyph cache along the error paths
    
    If we lock the glyph cache and then hit an error, we must make sure we
    release our lock. An easy way would be not to lock when we may err.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index c72c5e5..eca0df0 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -1147,14 +1147,11 @@ glyphs_via_mask(struct sna *sna,
 		memset(pixmap->devPrivate.ptr, 0, pixmap->devKind*height);
 #if HAS_PIXMAN_GLYPHS
 		if (sna->render.glyph_cache) {
+			pixman_glyph_cache_t *cache = sna->render.glyph_cache;
 			pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
 			pixman_glyph_t *pglyphs = stack_glyphs;
-			pixman_glyph_cache_t *cache;
 			int count, n;
 
-			cache = sna->render.glyph_cache;
-			pixman_glyph_cache_freeze(cache);
-
 			count = 0;
 			for (n = 0; n < nlist; ++n)
 				count += list[n].len;
@@ -1164,6 +1161,7 @@ glyphs_via_mask(struct sna *sna,
 					goto err_pixmap;
 			}
 
+			pixman_glyph_cache_freeze(cache);
 			count = 0;
 			do {
 				n = list->len;
@@ -2053,23 +2051,21 @@ glyphs_via_image(struct sna *sna,
 	memset(pixmap->devPrivate.ptr, 0, pixmap->devKind*height);
 #if HAS_PIXMAN_GLYPHS
 	if (sna->render.glyph_cache) {
+		pixman_glyph_cache_t *cache = sna->render.glyph_cache;
 		pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
 		pixman_glyph_t *pglyphs = stack_glyphs;
-		pixman_glyph_cache_t *cache;
 		int count, n;
 
-		cache = sna->render.glyph_cache;
-		pixman_glyph_cache_freeze(cache);
-
 		count = 0;
 		for (n = 0; n < nlist; ++n)
 			count += list[n].len;
 		if (count > N_STACK_GLYPHS) {
-			pglyphs = malloc (count * sizeof(pixman_glyph_t));
+			pglyphs = malloc(count * sizeof(pixman_glyph_t));
 			if (pglyphs == NULL)
 				goto err_pixmap;
 		}
 
+		pixman_glyph_cache_freeze(cache);
 		count = 0;
 		do {
 			n = list->len;


More information about the xorg-commit mailing list