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>
This commit is contained in:
parent
a2a2f6e34b
commit
80b6652c9f
|
@ -207,13 +207,10 @@ void
|
||||||
glamor_destroy_textured_pixmap(PixmapPtr pixmap)
|
glamor_destroy_textured_pixmap(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
if (pixmap->refcnt == 1) {
|
if (pixmap->refcnt == 1) {
|
||||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
|
||||||
if (pixmap_priv != NULL) {
|
|
||||||
#if GLAMOR_HAS_GBM
|
#if GLAMOR_HAS_GBM
|
||||||
glamor_egl_destroy_pixmap_image(pixmap);
|
glamor_egl_destroy_pixmap_image(pixmap);
|
||||||
#endif
|
#endif
|
||||||
glamor_pixmap_destroy_fbo(pixmap);
|
glamor_pixmap_destroy_fbo(pixmap);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,12 +758,11 @@ _X_EXPORT int
|
||||||
glamor_fd_from_pixmap(ScreenPtr screen,
|
glamor_fd_from_pixmap(ScreenPtr screen,
|
||||||
PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
|
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_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
if (!glamor_priv->dri3_enabled)
|
||||||
if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
|
|
||||||
return -1;
|
return -1;
|
||||||
switch (pixmap_priv->type) {
|
switch (pixmap_priv->type) {
|
||||||
case GLAMOR_TEXTURE_DRM:
|
case GLAMOR_TEXTURE_DRM:
|
||||||
|
@ -786,12 +782,11 @@ glamor_fd_from_pixmap(ScreenPtr screen,
|
||||||
int
|
int
|
||||||
glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
|
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_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
if (!glamor_priv->dri3_enabled)
|
||||||
if (pixmap_priv == NULL || !glamor_priv->dri3_enabled)
|
|
||||||
return -1;
|
return -1;
|
||||||
switch (pixmap_priv->type) {
|
switch (pixmap_priv->type) {
|
||||||
case GLAMOR_TEXTURE_DRM:
|
case GLAMOR_TEXTURE_DRM:
|
||||||
|
|
|
@ -42,8 +42,7 @@ glamor_get_drawable_location(const DrawablePtr drawable)
|
||||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(drawable->pScreen);
|
glamor_get_screen_private(drawable->pScreen);
|
||||||
if (pixmap_priv == NULL ||
|
if (pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
|
||||||
pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
|
|
||||||
return 'm';
|
return 'm';
|
||||||
if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
|
if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
|
||||||
return 's';
|
return 's';
|
||||||
|
|
|
@ -452,7 +452,7 @@ glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap)
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
pixmap_priv = 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;
|
return NULL;
|
||||||
switch (pixmap_priv->type) {
|
switch (pixmap_priv->type) {
|
||||||
case GLAMOR_TEXTURE_DRM:
|
case GLAMOR_TEXTURE_DRM:
|
||||||
|
@ -604,7 +604,7 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
|
||||||
struct glamor_pixmap_private *pixmap_priv =
|
struct glamor_pixmap_private *pixmap_priv =
|
||||||
glamor_get_pixmap_private(pixmap);
|
glamor_get_pixmap_private(pixmap);
|
||||||
|
|
||||||
if (pixmap_priv && pixmap_priv->image) {
|
if (pixmap_priv->image) {
|
||||||
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
|
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
|
||||||
struct glamor_egl_screen_private *glamor_egl =
|
struct glamor_egl_screen_private *glamor_egl =
|
||||||
glamor_egl_get_screen_private(scrn);
|
glamor_egl_get_screen_private(scrn);
|
||||||
|
|
|
@ -61,15 +61,6 @@ glamor_create_picture(PicturePtr picture)
|
||||||
|
|
||||||
pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
|
pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
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->is_picture = 1;
|
||||||
pixmap_priv->picture = picture;
|
pixmap_priv->picture = picture;
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ glamor_pixmap_drm_only(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(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);
|
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
|
static inline Bool
|
||||||
glamor_pixmap_priv_is_large(glamor_pixmap_private *priv)
|
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
|
static inline Bool
|
||||||
glamor_pixmap_priv_is_small(glamor_pixmap_private *priv)
|
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
|
static inline Bool
|
||||||
|
@ -453,7 +453,7 @@ glamor_pixmap_is_large(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(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
|
* 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);
|
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
|
static inline void
|
||||||
|
|
|
@ -756,8 +756,8 @@ glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy)
|
||||||
|| _depth_ == 30 \
|
|| _depth_ == 30 \
|
||||||
|| _depth_ == 32)
|
|| _depth_ == 32)
|
||||||
|
|
||||||
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
|
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(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_HAS_FBO(pixmap_priv) (pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Borrow from uxa.
|
* Borrow from uxa.
|
||||||
|
|
Loading…
Reference in New Issue