xf86-video-intel: src/sna/compiler.h src/sna/sna_accel.c src/sna/sna_dri.c src/sna/sna.h

Chris Wilson ickle at kemper.freedesktop.org
Mon Feb 11 04:40:30 PST 2013


 src/sna/compiler.h  |    2 ++
 src/sna/sna.h       |   10 +++++-----
 src/sna/sna_accel.c |    4 ++--
 src/sna/sna_dri.c   |    4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 0b116a1d023ad7cc148d91f268dbf71452dbd9dd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Feb 11 12:36:43 2013 +0000

    sna: Fix inaccurate use of __attribute__((const))
    
    'const' is only allowed to use the function parameters and not allowed
    to access global memory - that includes not allowed to deference its
    arguments...
    
    Thanks to Jiri Slaby for spotting my mistake.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/compiler.h b/src/sna/compiler.h
index b985f2b..1d50118 100644
--- a/src/sna/compiler.h
+++ b/src/sna/compiler.h
@@ -36,6 +36,7 @@
 #define fastcall __attribute__((regparm(3)))
 #define must_check __attribute__((warn_unused_result))
 #define constant __attribute__((const))
+#define pure __attribute__((pure))
 #define __packed__ __attribute__((__packed__))
 #else
 #define likely(expr) (expr)
@@ -45,6 +46,7 @@
 #define fastcall
 #define must_check
 #define constant
+#define pure
 #define __packed__
 #endif
 
diff --git a/src/sna/sna.h b/src/sna/sna.h
index a51e6a1..f6e89ec 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -164,7 +164,7 @@ static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
 
 extern DevPrivateKeyRec sna_pixmap_key;
 
-constant static inline struct sna_pixmap *sna_pixmap(PixmapPtr pixmap)
+pure static inline struct sna_pixmap *sna_pixmap(PixmapPtr pixmap)
 {
 	return ((void **)__get_private(pixmap, sna_pixmap_key))[1];
 }
@@ -307,25 +307,25 @@ extern int sna_page_flip(struct sna *sna,
 			 void *data,
 			 int ref_crtc_hw_id);
 
-constant static inline struct sna *
+pure static inline struct sna *
 to_sna(ScrnInfoPtr scrn)
 {
 	return (struct sna *)(scrn->driverPrivate);
 }
 
-constant static inline struct sna *
+pure static inline struct sna *
 to_sna_from_screen(ScreenPtr screen)
 {
 	return to_sna(xf86ScreenToScrn(screen));
 }
 
-constant static inline struct sna *
+pure static inline struct sna *
 to_sna_from_pixmap(PixmapPtr pixmap)
 {
 	return ((void **)__get_private(pixmap, sna_pixmap_key))[0];
 }
 
-constant static inline struct sna *
+pure static inline struct sna *
 to_sna_from_drawable(DrawablePtr drawable)
 {
 	return to_sna_from_screen(drawable->pScreen);
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index d571b91..839db66 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -543,8 +543,8 @@ static inline uint32_t default_tiling(PixmapPtr pixmap,
 	return tiling;
 }
 
-constant static uint32_t sna_pixmap_choose_tiling(PixmapPtr pixmap,
-						  uint32_t tiling)
+pure static uint32_t sna_pixmap_choose_tiling(PixmapPtr pixmap,
+					      uint32_t tiling)
 {
 	struct sna *sna = to_sna_from_pixmap(pixmap);
 	uint32_t bit;
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index c0caab1..82cb2b4 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -189,7 +189,7 @@ static struct kgem_bo *sna_pixmap_set_dri(struct sna *sna,
 	return priv->gpu_bo;
 }
 
-constant static inline void *sna_pixmap_get_buffer(PixmapPtr pixmap)
+pure static inline void *sna_pixmap_get_buffer(PixmapPtr pixmap)
 {
 	assert(pixmap->refcnt);
 	return ((void **)__get_private(pixmap, sna_pixmap_key))[2];
@@ -375,7 +375,7 @@ sna_dri_create_buffer(DrawablePtr draw,
 		assert(sna_pixmap_get_buffer(pixmap) == NULL);
 
 		sna_pixmap_set_buffer(pixmap, buffer);
-		//assert(sna_pixmap_get_buffer(pixmap) == buffer);
+		assert(sna_pixmap_get_buffer(pixmap) == buffer);
 		pixmap->refcnt++;
 
 		priv = sna_pixmap(pixmap);


More information about the xorg-commit mailing list