summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-02-28 13:02:14 -0500
committerZhigang Gong <zhigang.gong@gmail.com>2014-03-13 21:52:25 +0800
commit50b31c4d0bd51c91f14a821383e466967d2cdc12 (patch)
treed20b3159d768a1c5815332b81039d7c50045f47e
parent6546108f9689e771b91d5cdd6bd461b7dbd6bd50 (diff)
glamor: Replace some goofy enum-likes with a real enum.
This unpacks the bitfield into an int size, but my experience has been that packing bitfields doesn't matter for performance. Ported from Eric's xserver glamor tree. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/glamor_fbo.c2
-rw-r--r--src/glamor_priv.h25
2 files changed, 17 insertions, 10 deletions
diff --git a/src/glamor_fbo.c b/src/glamor_fbo.c
index 111d36c..f59c944 100644
--- a/src/glamor_fbo.c
+++ b/src/glamor_fbo.c
@@ -515,7 +515,7 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
case GLAMOR_TEXTURE_LARGE:
case GLAMOR_TEXTURE_ONLY:
case GLAMOR_TEXTURE_DRM:
- pixmap_priv->base.gl_fbo = 1;
+ pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
if (fbo->tex != 0)
pixmap_priv->base.gl_tex = 1;
else {
diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index 35c6ce2..621709a 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -306,8 +306,21 @@ typedef enum glamor_access {
GLAMOR_ACCESS_WO,
} glamor_access_t;
-#define GLAMOR_FBO_NORMAL 1
-#define GLAMOR_FBO_DOWNLOADED 2
+enum glamor_fbo_state {
+ /** There is no storage attached to the pixmap. */
+ GLAMOR_FBO_UNATTACHED,
+ /**
+ * The pixmap has FBO storage attached, but devPrivate.ptr doesn't
+ * point at anything.
+ */
+ GLAMOR_FBO_NORMAL,
+ /**
+ * The FBO is present and can be accessed as a linear memory
+ * mapping through devPrivate.ptr.
+ */
+ GLAMOR_FBO_DOWNLOADED,
+};
+
/* glamor_pixmap_fbo:
* @list: to be used to link to the cache pool list.
* @expire: when push to cache pool list, set a expire count.
@@ -339,12 +352,6 @@ typedef struct glamor_pixmap_fbo {
/*
* glamor_pixmap_private - glamor pixmap's private structure.
- * @gl_fbo:
- * 0 - The pixmap doesn't has a fbo attached to it.
- * GLAMOR_FBO_NORMAL - The pixmap has a fbo and can be accessed normally.
- * GLAMOR_FBO_DOWNLOADED - The pixmap has a fbo and already downloaded to
- * CPU, so it can only be treated as a in-memory pixmap
- * if this bit is set.
* @gl_tex: The pixmap is in a gl texture originally.
* @is_picture: The drawable is attached to a picture.
* @pict_format: the corresponding picture's format.
@@ -418,7 +425,7 @@ typedef struct glamor_pixmap_clipped_regions{
typedef struct glamor_pixmap_private_base {
glamor_pixmap_type_t type;
- unsigned char gl_fbo:2;
+ enum glamor_fbo_state gl_fbo;
unsigned char is_picture:1;
unsigned char gl_tex:1;
glamor_pixmap_fbo *fbo;