glamor: Directly reference the private key records
There's no reason to use a pointer here, it just wastes time. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
15e4d14dfa
commit
0e08a79599
|
@ -35,10 +35,8 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
static DevPrivateKeyRec glamor_screen_private_key_index;
|
||||
DevPrivateKey glamor_screen_private_key = &glamor_screen_private_key_index;
|
||||
static DevPrivateKeyRec glamor_pixmap_private_key_index;
|
||||
DevPrivateKey glamor_pixmap_private_key = &glamor_pixmap_private_key_index;
|
||||
DevPrivateKeyRec glamor_screen_private_key;
|
||||
DevPrivateKeyRec glamor_pixmap_private_key;
|
||||
|
||||
/**
|
||||
* glamor_get_drawable_pixmap() returns a backing pixmap for a given drawable.
|
||||
|
@ -68,7 +66,7 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
|
|||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
|
||||
pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||
glamor_pixmap_private_key);
|
||||
&glamor_pixmap_private_key);
|
||||
if (pixmap_priv == NULL) {
|
||||
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
|
||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||
|
@ -335,7 +333,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
else
|
||||
glamor_priv->yInverted = FALSE;
|
||||
|
||||
if (!dixRegisterPrivateKey(glamor_screen_private_key, PRIVATE_SCREEN, 0)) {
|
||||
if (!dixRegisterPrivateKey(&glamor_screen_private_key, PRIVATE_SCREEN, 0)) {
|
||||
LogMessage(X_WARNING,
|
||||
"glamor%d: Failed to allocate screen private\n",
|
||||
screen->myNum);
|
||||
|
@ -344,7 +342,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
|
||||
glamor_set_screen_private(screen, glamor_priv);
|
||||
|
||||
if (!dixRegisterPrivateKey(glamor_pixmap_private_key, PRIVATE_PIXMAP, 0)) {
|
||||
if (!dixRegisterPrivateKey(&glamor_pixmap_private_key, PRIVATE_PIXMAP, 0)) {
|
||||
LogMessage(X_WARNING,
|
||||
"glamor%d: Failed to allocate pixmap private\n",
|
||||
screen->myNum);
|
||||
|
@ -559,7 +557,7 @@ glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
|
|||
glamor_pixmap_private *old_priv;
|
||||
glamor_pixmap_fbo *fbo;
|
||||
|
||||
old_priv = dixGetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key);
|
||||
old_priv = dixGetPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
|
||||
|
||||
if (priv) {
|
||||
assert(old_priv == NULL);
|
||||
|
@ -572,7 +570,7 @@ glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
|
|||
free(old_priv);
|
||||
}
|
||||
|
||||
dixSetPrivate(&pixmap->devPrivates, glamor_pixmap_private_key, priv);
|
||||
dixSetPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key, priv);
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
@ -548,19 +548,20 @@ typedef enum glamor_pixmap_status {
|
|||
GLAMOR_UPLOAD_FAILED
|
||||
} glamor_pixmap_status_t;
|
||||
|
||||
extern DevPrivateKey glamor_screen_private_key;
|
||||
extern DevPrivateKey glamor_pixmap_private_key;
|
||||
extern DevPrivateKeyRec glamor_screen_private_key;
|
||||
extern DevPrivateKeyRec glamor_pixmap_private_key;
|
||||
|
||||
static inline glamor_screen_private *
|
||||
glamor_get_screen_private(ScreenPtr screen)
|
||||
{
|
||||
return (glamor_screen_private *)
|
||||
dixLookupPrivate(&screen->devPrivates, glamor_screen_private_key);
|
||||
dixLookupPrivate(&screen->devPrivates, &glamor_screen_private_key);
|
||||
}
|
||||
|
||||
static inline void
|
||||
glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv)
|
||||
{
|
||||
dixSetPrivate(&screen->devPrivates, glamor_screen_private_key, priv);
|
||||
dixSetPrivate(&screen->devPrivates, &glamor_screen_private_key, priv);
|
||||
}
|
||||
|
||||
static inline glamor_pixmap_private *
|
||||
|
@ -568,11 +569,11 @@ glamor_get_pixmap_private(PixmapPtr pixmap)
|
|||
{
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates, glamor_pixmap_private_key);
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
|
||||
if (!priv) {
|
||||
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||
glamor_pixmap_private_key);
|
||||
&glamor_pixmap_private_key);
|
||||
}
|
||||
return priv;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue