summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2009-12-11 15:44:47 +0100
committerFrancisco Jerez <currojerez@riseup.net>2009-12-16 12:48:18 +0100
commit963aaeff6b414f371eff3e8ce016f7707c60f7c0 (patch)
treec7709140a254880471fa2e3eb8287f019211a764
parent41d8d511124fcbe83a3cc68aaf22c3ce0fb4eb8a (diff)
exa: Pre-G80 tiling support.
For now, pixmaps will only be tiled if driver pixmaps is being used and we're told to with the NOUVEAU_CREATE_PIXMAP_TILED usage hint. Signed-off-by: Francisco Jerez <currojerez@riseup.net>
-rw-r--r--src/nouveau_exa.c31
-rw-r--r--src/nv50_exa.c6
-rw-r--r--src/nv50_xv.c2
-rw-r--r--src/nv_proto.h2
-rw-r--r--src/nv_type.h1
5 files changed, 26 insertions, 16 deletions
diff --git a/src/nouveau_exa.c b/src/nouveau_exa.c
index 68d1030..157b543 100644
--- a/src/nouveau_exa.c
+++ b/src/nouveau_exa.c
@@ -57,7 +57,7 @@ NVAccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,
unsigned line_len = w * cpp;
unsigned src_pitch = 0, linear = 0;
- if (!nouveau_exa_pixmap_is_tiled(pspix)) {
+ if (!nv50_style_tiled_pixmap(pspix)) {
linear = 1;
src_pitch = exaGetPixmapPitch(pspix);
src_offset += (y * src_pitch) + (x * cpp);
@@ -175,7 +175,7 @@ NVAccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
unsigned line_len = w * cpp;
unsigned dst_pitch = 0, linear = 0;
- if (!nouveau_exa_pixmap_is_tiled(pdpix)) {
+ if (!nv50_style_tiled_pixmap(pdpix)) {
linear = 1;
dst_pitch = exaGetPixmapPitch(pdpix);
dst_offset += (y * dst_pitch) + (x * cpp);
@@ -390,6 +390,7 @@ nouveau_exa_create_pixmap(ScreenPtr pScreen, int width, int height, int depth,
if (cpp) {
flags |= NOUVEAU_BO_VRAM;
+ *new_pitch = width * cpp;
if (pNv->Architecture >= NV_ARCH_50) {
if (height > 32) tile_mode = 4;
@@ -398,15 +399,22 @@ nouveau_exa_create_pixmap(ScreenPtr pScreen, int width, int height, int depth,
else if (height > 4) tile_mode = 1;
else tile_mode = 0;
- if (usage_hint == NOUVEAU_CREATE_PIXMAP_ZETA)
+ if (usage_hint & NOUVEAU_CREATE_PIXMAP_ZETA)
tile_flags = 0x2800;
else
tile_flags = 0x7000;
height = NOUVEAU_ALIGN(height, 1 << (tile_mode + 2));
- }
+ } else {
+ if (usage_hint & NOUVEAU_CREATE_PIXMAP_TILED) {
+ int pitch_align =
+ pNv->NVArch >= 0x40 ? 1024 : 256;
- *new_pitch = width * cpp;
+ *new_pitch = NOUVEAU_ALIGN(*new_pitch,
+ pitch_align);
+ tile_mode = *new_pitch;
+ }
+ }
} else {
*new_pitch = (width * bitsPerPixel + 7) / 8;
}
@@ -446,12 +454,13 @@ nouveau_exa_destroy_pixmap(ScreenPtr pScreen, void *priv)
}
bool
-nouveau_exa_pixmap_is_tiled(PixmapPtr ppix)
+nv50_style_tiled_pixmap(PixmapPtr ppix)
{
- if (!nouveau_pixmap_bo(ppix)->tile_flags)
- return false;
+ ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
+ NVPtr pNv = NVPTR(pScrn);
- return true;
+ return pNv->Architecture == NV_ARCH_50 &&
+ nouveau_pixmap_bo(ppix)->tile_flags;
}
static void *
@@ -462,7 +471,7 @@ nouveau_exa_pixmap_map(PixmapPtr ppix)
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
unsigned delta = nouveau_pixmap_offset(ppix);
- if (bo->tile_flags && !pNv->wfb_enabled) {
+ if (nv50_style_tiled_pixmap(ppix) && !pNv->wfb_enabled) {
struct nouveau_pixmap *nvpix = nouveau_pixmap(ppix);
nvpix->map_refcount++;
@@ -490,7 +499,7 @@ nouveau_exa_pixmap_unmap(PixmapPtr ppix)
NVPtr pNv = NVPTR(pScrn);
struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
- if (bo->tile_flags && !pNv->wfb_enabled) {
+ if (nv50_style_tiled_pixmap(ppix) && !pNv->wfb_enabled) {
struct nouveau_pixmap *nvpix = nouveau_pixmap(ppix);
if (--nvpix->map_refcount)
diff --git a/src/nv50_exa.c b/src/nv50_exa.c
index 7081d72..c7609b3 100644
--- a/src/nv50_exa.c
+++ b/src/nv50_exa.c
@@ -119,7 +119,7 @@ NV50EXAAcquireSurface2D(PixmapPtr ppix, int is_src)
bo_flags = NOUVEAU_BO_VRAM;
bo_flags |= is_src ? NOUVEAU_BO_RD : NOUVEAU_BO_WR;
- if (!nouveau_exa_pixmap_is_tiled(ppix)) {
+ if (!nv50_style_tiled_pixmap(ppix)) {
BEGIN_RING(chan, eng2d, mthd, 2);
OUT_RING (chan, fmt);
OUT_RING (chan, 1);
@@ -465,7 +465,7 @@ NV50EXARenderTarget(PixmapPtr ppix, PicturePtr ppict)
unsigned format;
/*XXX: Scanout buffer not tiled, someone needs to figure it out */
- if (!nouveau_exa_pixmap_is_tiled(ppix))
+ if (!nv50_style_tiled_pixmap(ppix))
NOUVEAU_FALLBACK("pixmap is scanout buffer\n");
switch (ppict->format) {
@@ -553,7 +553,7 @@ NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)
const unsigned tcb_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
/*XXX: Scanout buffer not tiled, someone needs to figure it out */
- if (!nouveau_exa_pixmap_is_tiled(ppix))
+ if (!nv50_style_tiled_pixmap(ppix))
NOUVEAU_FALLBACK("pixmap is scanout buffer\n");
BEGIN_RING(chan, tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
diff --git a/src/nv50_xv.c b/src/nv50_xv.c
index 712626c..daf1a41 100644
--- a/src/nv50_xv.c
+++ b/src/nv50_xv.c
@@ -50,7 +50,7 @@ nv50_xv_check_image_put(PixmapPtr ppix)
return FALSE;
}
- if (!nouveau_exa_pixmap_is_tiled(ppix))
+ if (!nv50_style_tiled_pixmap(ppix))
return FALSE;
return TRUE;
diff --git a/src/nv_proto.h b/src/nv_proto.h
index ceddbee..ee1c8f2 100644
--- a/src/nv_proto.h
+++ b/src/nv_proto.h
@@ -61,7 +61,7 @@ void NVTakedownDma(ScrnInfoPtr pScrn);
/* in nouveau_exa.c */
Bool nouveau_exa_init(ScreenPtr pScreen);
Bool nouveau_exa_pixmap_is_onscreen(PixmapPtr pPixmap);
-bool nouveau_exa_pixmap_is_tiled(PixmapPtr ppix);
+bool nv50_style_tiled_pixmap(PixmapPtr ppix);
/* in nouveau_wfb.c */
void nouveau_wfb_setup_wrap(ReadMemoryProcPtr *, WriteMemoryProcPtr *,
diff --git a/src/nv_type.h b/src/nv_type.h
index 0c13dac..6face1f 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
@@ -279,6 +279,7 @@ typedef struct _NVPortPrivRec {
/* EXA driver-controlled pixmaps */
#define NOUVEAU_CREATE_PIXMAP_ZETA 0x10000000
+#define NOUVEAU_CREATE_PIXMAP_TILED 0x20000000
struct nouveau_pixmap {
struct nouveau_bo *bo;