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@chris-wilson.co.uk>
This commit is contained in:
parent
47657e5355
commit
0b116a1d02
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue