Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5e2f076 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nvc0: allow creation of buffers with any non-compressed memtype



This adds a table of known nvc0 memtypes, and modifies the validity check
to allow any non-compressed type.  Support for Z compression will come at
a later point.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3425df48
Loading
Loading
Loading
Loading
+25 −11
Original line number Original line Diff line number Diff line
@@ -26,20 +26,34 @@
#include "nouveau_drv.h"
#include "nouveau_drv.h"
#include "nouveau_mm.h"
#include "nouveau_mm.h"


/* 0 = unsupported
 * 1 = non-compressed
 * 3 = compressed
 */
static const u8 types[256] = {
	1, 1, 3, 3, 3, 3, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0,
	0, 1, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3,
	3, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 1, 1, 1, 1, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 3, 3, 3, 3, 1, 1, 1, 1, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
	3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3,
	3, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 3,
	3, 0, 3, 3, 3, 3, 3, 0, 0, 3, 0, 3, 0, 3, 3, 0,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 1, 1, 0
};

bool
bool
nvc0_vram_flags_valid(struct drm_device *dev, u32 tile_flags)
nvc0_vram_flags_valid(struct drm_device *dev, u32 tile_flags)
{
{
	switch (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) {
	u8 memtype = (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) >> 8;
	case 0x0000:
	return likely((types[memtype] == 1));
	case 0xfe00:
	case 0xdb00:
	case 0x1100:
		return true;
	default:
		break;
	}

	return false;
}
}


int
int