Commit b1e839f3 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fb/gf100: clear comptags at allocation time rather than mmu map

We probably don't want to destroy compression data when doing multiple
mappings of a memory object.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent af793b8c
...@@ -25,7 +25,7 @@ struct nvkm_ltc { ...@@ -25,7 +25,7 @@ struct nvkm_ltc {
int nvkm_ltc_tags_alloc(struct nvkm_ltc *, u32 count, struct nvkm_mm_node **); int nvkm_ltc_tags_alloc(struct nvkm_ltc *, u32 count, struct nvkm_mm_node **);
void nvkm_ltc_tags_free(struct nvkm_ltc *, struct nvkm_mm_node **); void nvkm_ltc_tags_free(struct nvkm_ltc *, struct nvkm_mm_node **);
void nvkm_ltc_tags_clear(struct nvkm_ltc *, u32 first, u32 count); void nvkm_ltc_tags_clear(struct nvkm_device *, u32 first, u32 count);
int nvkm_ltc_zbc_color_get(struct nvkm_ltc *, int index, const u32[4]); int nvkm_ltc_zbc_color_get(struct nvkm_ltc *, int index, const u32[4]);
int nvkm_ltc_zbc_depth_get(struct nvkm_ltc *, int index, const u32); int nvkm_ltc_zbc_depth_get(struct nvkm_ltc *, int index, const u32);
......
...@@ -443,6 +443,7 @@ int ...@@ -443,6 +443,7 @@ int
gf100_ram_get(struct nvkm_ram *ram, u64 size, u32 align, u32 ncmin, gf100_ram_get(struct nvkm_ram *ram, u64 size, u32 align, u32 ncmin,
u32 memtype, struct nvkm_mem **pmem) u32 memtype, struct nvkm_mem **pmem)
{ {
struct nvkm_device *device = ram->fb->subdev.device;
struct nvkm_ltc *ltc = ram->fb->subdev.device->ltc; struct nvkm_ltc *ltc = ram->fb->subdev.device->ltc;
struct nvkm_mm *mm = &ram->vram; struct nvkm_mm *mm = &ram->vram;
struct nvkm_mm_node **node, *r; struct nvkm_mm_node **node, *r;
...@@ -469,7 +470,10 @@ gf100_ram_get(struct nvkm_ram *ram, u64 size, u32 align, u32 ncmin, ...@@ -469,7 +470,10 @@ gf100_ram_get(struct nvkm_ram *ram, u64 size, u32 align, u32 ncmin,
/* compression only works with lpages */ /* compression only works with lpages */
if (align == (1 << (17 - NVKM_RAM_MM_SHIFT))) { if (align == (1 << (17 - NVKM_RAM_MM_SHIFT))) {
int n = size >> 5; int n = size >> 5;
nvkm_ltc_tags_alloc(ltc, n, &mem->tag); if (!nvkm_ltc_tags_alloc(ltc, n, &mem->tag)) {
nvkm_ltc_tags_clear(device, mem->tag->offset,
mem->tag->length);
}
} }
if (unlikely(!mem->tag)) if (unlikely(!mem->tag))
......
...@@ -41,8 +41,9 @@ nvkm_ltc_tags_free(struct nvkm_ltc *ltc, struct nvkm_mm_node **pnode) ...@@ -41,8 +41,9 @@ nvkm_ltc_tags_free(struct nvkm_ltc *ltc, struct nvkm_mm_node **pnode)
} }
void void
nvkm_ltc_tags_clear(struct nvkm_ltc *ltc, u32 first, u32 count) nvkm_ltc_tags_clear(struct nvkm_device *device, u32 first, u32 count)
{ {
struct nvkm_ltc *ltc = device->ltc;
const u32 limit = first + count - 1; const u32 limit = first + count - 1;
BUG_ON((first > limit) || (limit >= ltc->num_tags)); BUG_ON((first > limit) || (limit >= ltc->num_tags));
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "priv.h" #include "priv.h"
#include <subdev/fb.h> #include <subdev/fb.h>
#include <subdev/ltc.h>
#include <subdev/timer.h> #include <subdev/timer.h>
#include <core/gpuobj.h> #include <core/gpuobj.h>
...@@ -109,11 +108,9 @@ gf100_vm_map(struct nvkm_vma *vma, struct nvkm_memory *pgt, ...@@ -109,11 +108,9 @@ gf100_vm_map(struct nvkm_vma *vma, struct nvkm_memory *pgt,
pte <<= 3; pte <<= 3;
if (mem->tag) { if (mem->tag) {
struct nvkm_ltc *ltc = vma->vm->mmu->subdev.device->ltc;
u32 tag = mem->tag->offset + (delta >> 17); u32 tag = mem->tag->offset + (delta >> 17);
phys |= (u64)tag << (32 + 12); phys |= (u64)tag << (32 + 12);
next |= (u64)1 << (32 + 12); next |= (u64)1 << (32 + 12);
nvkm_ltc_tags_clear(ltc, tag, cnt);
} }
nvkm_kmap(pgt); nvkm_kmap(pgt);
......
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