Commit 67e9e9f6 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fb: split tile and compression region handling

This is in preparation for extending the support to the remaining
chipsets, to allow for sharing more functions.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent de2b8b8b
...@@ -84,6 +84,8 @@ struct nouveau_fb { ...@@ -84,6 +84,8 @@ struct nouveau_fb {
int regions; int regions;
void (*init)(struct nouveau_fb *, int i, u32 addr, u32 size, void (*init)(struct nouveau_fb *, int i, u32 addr, u32 size,
u32 pitch, u32 flags, struct nouveau_fb_tile *); u32 pitch, u32 flags, struct nouveau_fb_tile *);
void (*comp)(struct nouveau_fb *, int i, u32 size, u32 flags,
struct nouveau_fb_tile *);
void (*fini)(struct nouveau_fb *, int i, void (*fini)(struct nouveau_fb *, int i,
struct nouveau_fb_tile *); struct nouveau_fb_tile *);
void (*prog)(struct nouveau_fb *, int i, void (*prog)(struct nouveau_fb *, int i,
......
...@@ -34,19 +34,28 @@ static void ...@@ -34,19 +34,28 @@ static void
nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch, nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
u32 flags, struct nouveau_fb_tile *tile) u32 flags, struct nouveau_fb_tile *tile)
{ {
struct nouveau_device *device = nv_device(pfb);
int bpp = (flags & 2) ? 32 : 16;
tile->addr = 0x00000001 | addr; tile->addr = 0x00000001 | addr;
tile->limit = max(1u, addr + size) - 1; tile->limit = max(1u, addr + size) - 1;
tile->pitch = pitch; tile->pitch = pitch;
if (flags & 4) {
pfb->tile.comp(pfb, i, size, flags, tile);
tile->addr |= 2;
}
}
static void
nv20_fb_tile_comp(struct nouveau_fb *pfb, int i, u32 size, u32 flags,
struct nouveau_fb_tile *tile)
{
struct nouveau_device *device = nv_device(pfb);
int bpp = (flags & 2) ? 32 : 16;
/* Allocate some of the on-die tag memory, used to store Z /* Allocate some of the on-die tag memory, used to store Z
* compression meta-data (most likely just a bitmap determining * compression meta-data (most likely just a bitmap determining
* if a given tile is compressed or not). * if a given tile is compressed or not).
*/ */
size /= 256; size /= 256;
if (flags & 4) {
if (!nouveau_mm_head(&pfb->tags, 1, size, size, 1, &tile->tag)) { if (!nouveau_mm_head(&pfb->tags, 1, size, size, 1, &tile->tag)) {
/* Enable Z compression */ /* Enable Z compression */
tile->zcomp = tile->tag->offset; tile->zcomp = tile->tag->offset;
...@@ -61,9 +70,6 @@ nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch, ...@@ -61,9 +70,6 @@ nv20_fb_tile_init(struct nouveau_fb *pfb, int i, u32 addr, u32 size, u32 pitch,
tile->zcomp |= 0x04000000; tile->zcomp |= 0x04000000;
} }
} }
tile->addr |= 2;
}
} }
static void static void
...@@ -119,6 +125,7 @@ nv20_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -119,6 +125,7 @@ nv20_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
priv->base.memtype_valid = nv04_fb_memtype_valid; priv->base.memtype_valid = nv04_fb_memtype_valid;
priv->base.tile.regions = 8; priv->base.tile.regions = 8;
priv->base.tile.init = nv20_fb_tile_init; priv->base.tile.init = nv20_fb_tile_init;
priv->base.tile.comp = nv20_fb_tile_comp;
priv->base.tile.fini = nv20_fb_tile_fini; priv->base.tile.fini = nv20_fb_tile_fini;
priv->base.tile.prog = nv20_fb_tile_prog; priv->base.tile.prog = nv20_fb_tile_prog;
return nouveau_fb_created(&priv->base); return nouveau_fb_created(&priv->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment