mirror of https://gitee.com/openkylin/linux.git
drm/nouveau/fb: move comptags mm into nvkm_fb
We're moving towards having a central place to handle comptag allocation, and as some GPUs don't have a ram submodule (ie. Tegra), we need to move the mm somewhere else. It probably never belonged in ram anyways. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
b7e1f3f1ba
commit
7ef44bee64
|
@ -44,6 +44,7 @@ struct nvkm_fb {
|
|||
struct nvkm_subdev subdev;
|
||||
|
||||
struct nvkm_ram *ram;
|
||||
struct nvkm_mm tags;
|
||||
|
||||
struct {
|
||||
struct nvkm_fb_tile region[16];
|
||||
|
@ -128,7 +129,6 @@ struct nvkm_ram {
|
|||
#define NVKM_RAM_MM_NOMAP (NVKM_MM_HEAP_ANY + 2)
|
||||
#define NVKM_RAM_MM_MIXED (NVKM_MM_HEAP_ANY + 3)
|
||||
struct nvkm_mm vram;
|
||||
struct nvkm_mm tags;
|
||||
u64 stolen;
|
||||
|
||||
int ranks;
|
||||
|
|
|
@ -159,6 +159,7 @@ nvkm_fb_dtor(struct nvkm_subdev *subdev)
|
|||
for (i = 0; i < fb->tile.regions; i++)
|
||||
fb->func->tile.fini(fb, i, &fb->tile.region[i]);
|
||||
|
||||
nvkm_mm_fini(&fb->tags);
|
||||
nvkm_ram_del(&fb->ram);
|
||||
|
||||
if (fb->func->dtor)
|
||||
|
|
|
@ -45,7 +45,7 @@ nv20_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
|
|||
{
|
||||
u32 tiles = DIV_ROUND_UP(size, 0x40);
|
||||
u32 tags = round_up(tiles / fb->ram->parts, 0x40);
|
||||
if (!nvkm_mm_head(&fb->ram->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!nvkm_mm_head(&fb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!(flags & 2)) tile->zcomp = 0x00000000; /* Z16 */
|
||||
else tile->zcomp = 0x04000000; /* Z24S8 */
|
||||
tile->zcomp |= tile->tag->offset;
|
||||
|
@ -63,7 +63,7 @@ nv20_fb_tile_fini(struct nvkm_fb *fb, int i, struct nvkm_fb_tile *tile)
|
|||
tile->limit = 0;
|
||||
tile->pitch = 0;
|
||||
tile->zcomp = 0;
|
||||
nvkm_mm_free(&fb->ram->tags, &tile->tag);
|
||||
nvkm_mm_free(&fb->tags, &tile->tag);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -32,7 +32,7 @@ nv25_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
|
|||
{
|
||||
u32 tiles = DIV_ROUND_UP(size, 0x40);
|
||||
u32 tags = round_up(tiles / fb->ram->parts, 0x40);
|
||||
if (!nvkm_mm_head(&fb->ram->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!nvkm_mm_head(&fb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!(flags & 2)) tile->zcomp = 0x00100000; /* Z16 */
|
||||
else tile->zcomp = 0x00200000; /* Z24S8 */
|
||||
tile->zcomp |= tile->tag->offset;
|
||||
|
|
|
@ -51,7 +51,7 @@ nv30_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
|
|||
{
|
||||
u32 tiles = DIV_ROUND_UP(size, 0x40);
|
||||
u32 tags = round_up(tiles / fb->ram->parts, 0x40);
|
||||
if (!nvkm_mm_head(&fb->ram->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!nvkm_mm_head(&fb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (flags & 2) tile->zcomp |= 0x01000000; /* Z16 */
|
||||
else tile->zcomp |= 0x02000000; /* Z24S8 */
|
||||
tile->zcomp |= ((tile->tag->offset ) >> 6);
|
||||
|
|
|
@ -32,7 +32,7 @@ nv35_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
|
|||
{
|
||||
u32 tiles = DIV_ROUND_UP(size, 0x40);
|
||||
u32 tags = round_up(tiles / fb->ram->parts, 0x40);
|
||||
if (!nvkm_mm_head(&fb->ram->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!nvkm_mm_head(&fb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (flags & 2) tile->zcomp |= 0x04000000; /* Z16 */
|
||||
else tile->zcomp |= 0x08000000; /* Z24S8 */
|
||||
tile->zcomp |= ((tile->tag->offset ) >> 6);
|
||||
|
|
|
@ -32,7 +32,7 @@ nv36_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
|
|||
{
|
||||
u32 tiles = DIV_ROUND_UP(size, 0x40);
|
||||
u32 tags = round_up(tiles / fb->ram->parts, 0x40);
|
||||
if (!nvkm_mm_head(&fb->ram->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (!nvkm_mm_head(&fb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
if (flags & 2) tile->zcomp |= 0x10000000; /* Z16 */
|
||||
else tile->zcomp |= 0x20000000; /* Z24S8 */
|
||||
tile->zcomp |= ((tile->tag->offset ) >> 6);
|
||||
|
|
|
@ -33,7 +33,7 @@ nv40_fb_tile_comp(struct nvkm_fb *fb, int i, u32 size, u32 flags,
|
|||
u32 tiles = DIV_ROUND_UP(size, 0x80);
|
||||
u32 tags = round_up(tiles / fb->ram->parts, 0x100);
|
||||
if ( (flags & 2) &&
|
||||
!nvkm_mm_head(&fb->ram->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
!nvkm_mm_head(&fb->tags, 0, 1, tags, tags, 1, &tile->tag)) {
|
||||
tile->zcomp = 0x28000000; /* Z24S8_SPLIT_GRAD */
|
||||
tile->zcomp |= ((tile->tag->offset ) >> 8);
|
||||
tile->zcomp |= ((tile->tag->offset + tags - 1) >> 8) << 13;
|
||||
|
|
|
@ -38,7 +38,6 @@ nvkm_ram_del(struct nvkm_ram **pram)
|
|||
if (ram && !WARN_ON(!ram->func)) {
|
||||
if (ram->func->dtor)
|
||||
*pram = ram->func->dtor(ram);
|
||||
nvkm_mm_fini(&ram->tags);
|
||||
nvkm_mm_fini(&ram->vram);
|
||||
kfree(*pram);
|
||||
*pram = NULL;
|
||||
|
@ -79,8 +78,8 @@ nvkm_ram_ctor(const struct nvkm_ram_func *func, struct nvkm_fb *fb,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (!nvkm_mm_initialised(&ram->tags)) {
|
||||
ret = nvkm_mm_init(&ram->tags, 0, 0, tags ? ++tags : 0, 1);
|
||||
if (!nvkm_mm_initialised(&fb->tags)) {
|
||||
ret = nvkm_mm_init(&fb->tags, 0, 0, tags ? ++tags : 0, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -502,7 +502,7 @@ __nv50_ram_put(struct nvkm_ram *ram, struct nvkm_mem *mem)
|
|||
next = node->next;
|
||||
nvkm_mm_free(&ram->vram, &node);
|
||||
}
|
||||
nvkm_mm_free(&ram->tags, &mem->tag);
|
||||
nvkm_mm_free(&ram->fb->tags, &mem->tag);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -526,7 +526,7 @@ nv50_ram_get(struct nvkm_ram *ram, u64 size, u32 align, u32 ncmin,
|
|||
u32 memtype, struct nvkm_mem **pmem)
|
||||
{
|
||||
struct nvkm_mm *heap = &ram->vram;
|
||||
struct nvkm_mm *tags = &ram->tags;
|
||||
struct nvkm_mm *tags = &ram->fb->tags;
|
||||
struct nvkm_mm_node **node, *r;
|
||||
struct nvkm_mem *mem;
|
||||
int comp = (memtype & 0x300) >> 8;
|
||||
|
|
Loading…
Reference in New Issue