glamor: Add helper functions to walk pixmap tiling
This adds a few helper functions to make pixmap fbo access symmetrical between the single fbo and tiled cases. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
209d004469
commit
0ca7223742
|
@ -471,6 +471,52 @@ typedef struct glamor_pixmap_private {
|
||||||
};
|
};
|
||||||
} glamor_pixmap_private;
|
} glamor_pixmap_private;
|
||||||
|
|
||||||
|
static inline glamor_pixmap_fbo *
|
||||||
|
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
|
||||||
|
{
|
||||||
|
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||||
|
assert(x < priv->large.block_wcnt);
|
||||||
|
assert(y < priv->large.block_hcnt);
|
||||||
|
return priv->large.fbo_array[y * priv->large.block_wcnt + x];
|
||||||
|
}
|
||||||
|
assert (x == 0);
|
||||||
|
assert (y == 0);
|
||||||
|
return priv->base.fbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline BoxPtr
|
||||||
|
glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
|
||||||
|
{
|
||||||
|
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||||
|
assert(x < priv->large.block_wcnt);
|
||||||
|
assert(y < priv->large.block_hcnt);
|
||||||
|
return &priv->large.box_array[y * priv->large.block_wcnt + x];
|
||||||
|
}
|
||||||
|
assert (x == 0);
|
||||||
|
assert (y == 0);
|
||||||
|
return &priv->base.box;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
glamor_pixmap_wcnt(glamor_pixmap_private *priv)
|
||||||
|
{
|
||||||
|
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
||||||
|
return priv->large.block_wcnt;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
glamor_pixmap_hcnt(glamor_pixmap_private *priv)
|
||||||
|
{
|
||||||
|
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
||||||
|
return priv->large.block_hcnt;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define glamor_pixmap_loop(priv, x, y) \
|
||||||
|
for (y = 0; y < glamor_pixmap_hcnt(priv); y++) \
|
||||||
|
for (x = 0; x < glamor_pixmap_wcnt(priv); x++)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pixmap dynamic status, used by dynamic upload feature.
|
* Pixmap dynamic status, used by dynamic upload feature.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user