summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-07-07 17:21:55 -0700
committerEric Anholt <eric@anholt.net>2015-07-10 09:42:57 -0700
commit80b6652c9fb9cdff91e92fa16c07e2cc63b06f44 (patch)
tree126b8a408eea89df3ec9d25584faa414d5a6bd50
parenta2a2f6e34bd49e7ae31779274d52e800595660bc (diff)
glamor: Drop a bunch of glamor_priv == NULL checks.
Now that it's always non-null when the pixmap is non-null, we don't need so much of this. glamor_get_pixmap_private() itself still accepts a NULL pixmap and returns NULL, because of glamor_render.c Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--glamor/glamor.c17
-rw-r--r--glamor/glamor_core.c3
-rw-r--r--glamor/glamor_egl.c4
-rw-r--r--glamor/glamor_picture.c9
-rw-r--r--glamor/glamor_priv.h12
-rw-r--r--glamor/glamor_utils.h4
6 files changed, 17 insertions, 32 deletions
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 2470a8d38..04c548d75 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -207,13 +207,10 @@ void
glamor_destroy_textured_pixmap(PixmapPtr pixmap)
{
if (pixmap->refcnt == 1) {
- glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv != NULL) {
#if GLAMOR_HAS_GBM
- glamor_egl_destroy_pixmap_image(pixmap);
+ glamor_egl_destroy_pixmap_image(pixmap);
#endif
- glamor_pixmap_destroy_fbo(pixmap);
- }
+ glamor_pixmap_destroy_fbo(pixmap);
}
}
@@ -761,12 +758,11 @@ _X_EXPORT int
glamor_fd_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
{
- glamor_pixmap_private *pixmap_priv;
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
- pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
+ if (!glamor_priv->dri3_enabled)
return -1;
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
@@ -786,12 +782,11 @@ glamor_fd_from_pixmap(ScreenPtr screen,
int
glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
{
- glamor_pixmap_private *pixmap_priv;
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
- pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
+ if (!glamor_priv->dri3_enabled)
return -1;
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 79f5981b1..0104b8885 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -42,8 +42,7 @@ glamor_get_drawable_location(const DrawablePtr drawable)
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(drawable->pScreen);
- if (pixmap_priv == NULL ||
- pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
+ if (pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
return 'm';
if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
return 's';
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index e01f723fc..753fb34a4 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -452,7 +452,7 @@ glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap)
glamor_get_pixmap_private(pixmap);
pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
+ if (!glamor_priv->dri3_enabled)
return NULL;
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
@@ -604,7 +604,7 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
struct glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
- if (pixmap_priv && pixmap_priv->image) {
+ if (pixmap_priv->image) {
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn);
diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c
index 53b032c89..20b9de29f 100644
--- a/glamor/glamor_picture.c
+++ b/glamor/glamor_picture.c
@@ -61,15 +61,6 @@ glamor_create_picture(PicturePtr picture)
pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
pixmap_priv = glamor_get_pixmap_private(pixmap);
- if (!pixmap_priv) {
- /* We must create a pixmap priv to track the picture format even
- * if the pixmap is a pure in memory pixmap. The reason is that
- * we may need to upload this pixmap to a texture on the fly. During
- * the uploading, we need to know the picture format. */
- glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
- pixmap_priv = glamor_get_pixmap_private(pixmap);
- }
-
pixmap_priv->is_picture = 1;
pixmap_priv->picture = picture;
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index fe65d9b79..d085ff258 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -419,7 +419,7 @@ glamor_pixmap_drm_only(PixmapPtr pixmap)
{
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
- return priv && priv->type == GLAMOR_DRM_ONLY;
+ return priv->type == GLAMOR_DRM_ONLY;
}
/*
@@ -430,7 +430,7 @@ glamor_pixmap_is_memory(PixmapPtr pixmap)
{
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
- return !priv || priv->type == GLAMOR_MEMORY;
+ return priv->type == GLAMOR_MEMORY;
}
/*
@@ -439,13 +439,13 @@ glamor_pixmap_is_memory(PixmapPtr pixmap)
static inline Bool
glamor_pixmap_priv_is_large(glamor_pixmap_private *priv)
{
- return priv && (priv->block_wcnt > 1 || priv->block_hcnt > 1);
+ return priv->block_wcnt > 1 || priv->block_hcnt > 1;
}
static inline Bool
glamor_pixmap_priv_is_small(glamor_pixmap_private *priv)
{
- return priv && priv->block_wcnt <= 1 && priv->block_hcnt <= 1;
+ return priv->block_wcnt <= 1 && priv->block_hcnt <= 1;
}
static inline Bool
@@ -453,7 +453,7 @@ glamor_pixmap_is_large(PixmapPtr pixmap)
{
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
- return priv && glamor_pixmap_priv_is_large(priv);
+ return glamor_pixmap_priv_is_large(priv);
}
/*
* Returns TRUE if pixmap has an FBO
@@ -463,7 +463,7 @@ glamor_pixmap_has_fbo(PixmapPtr pixmap)
{
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
- return priv && priv->gl_fbo == GLAMOR_FBO_NORMAL;
+ return priv->gl_fbo == GLAMOR_FBO_NORMAL;
}
static inline void
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 0a7de82ab..a923b7a9d 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -756,8 +756,8 @@ glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy)
|| _depth_ == 30 \
|| _depth_ == 32)
-#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
-#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
+#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv->is_picture == 1)
+#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
/**
* Borrow from uxa.