summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/dri/nouveau/nv50_surface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/dri/nouveau/nv50_surface.c')
-rw-r--r--src/gallium/winsys/dri/nouveau/nv50_surface.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/gallium/winsys/dri/nouveau/nv50_surface.c b/src/gallium/winsys/dri/nouveau/nv50_surface.c
index d6da116b77..cf76d76cf5 100644
--- a/src/gallium/winsys/dri/nouveau/nv50_surface.c
+++ b/src/gallium/winsys/dri/nouveau/nv50_surface.c
@@ -1,15 +1,21 @@
#include "pipe/p_context.h"
+#include "pipe/p_format.h"
#include "nouveau_context.h"
static INLINE int
-nv50_format(int cpp)
+nv50_format(enum pipe_format format)
{
- switch (cpp) {
- case 4: return NV50_2D_DST_FORMAT_32BPP;
- case 3: return NV50_2D_DST_FORMAT_24BPP;
- case 2: return NV50_2D_DST_FORMAT_16BPP;
- case 1: return NV50_2D_DST_FORMAT_8BPP;
+ switch (format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_Z24S8_UNORM:
+ return NV50_2D_DST_FORMAT_32BPP;
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ return NV50_2D_DST_FORMAT_24BPP;
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ return NV50_2D_DST_FORMAT_16BPP;
+ case PIPE_FORMAT_A8_UNORM:
+ return NV50_2D_DST_FORMAT_8BPP;
default:
return -1;
}
@@ -23,9 +29,9 @@ nv50_surface_copy_prep(struct nouveau_context *nv,
struct nouveau_grobj *eng2d = nv->nvc->Nv2D;
int surf_format;
- assert(src->cpp == dst->cpp);
+ assert(src->format == dst->format);
- surf_format = nv50_format(dst->cpp);
+ surf_format = nv50_format(dst->format);
assert(surf_format >= 0);
BEGIN_RING(chan, eng2d, NV50_2D_DMA_IN_MEMORY0, 2);
@@ -38,8 +44,8 @@ nv50_surface_copy_prep(struct nouveau_context *nv,
OUT_RING (chan, surf_format);
OUT_RING (chan, 1);
BEGIN_RING(chan, eng2d, NV50_2D_DST_PITCH, 5);
- OUT_RING (chan, dst->pitch * dst->cpp);
- OUT_RING (chan, dst->pitch);
+ OUT_RING (chan, dst->stride);
+ OUT_RING (chan, dst->width);
OUT_RING (chan, dst->height);
OUT_RELOCh(chan, nouveau_buffer(dst->buffer)->bo, dst->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -48,15 +54,15 @@ nv50_surface_copy_prep(struct nouveau_context *nv,
BEGIN_RING(chan, eng2d, NV50_2D_CLIP_X, 4);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- OUT_RING (chan, dst->pitch);
+ OUT_RING (chan, dst->width);
OUT_RING (chan, dst->height);
BEGIN_RING(chan, eng2d, NV50_2D_SRC_FORMAT, 2);
OUT_RING (chan, surf_format);
OUT_RING (chan, 1);
BEGIN_RING(chan, eng2d, NV50_2D_SRC_PITCH, 5);
- OUT_RING (chan, src->pitch * src->cpp);
- OUT_RING (chan, src->pitch);
+ OUT_RING (chan, src->stride);
+ OUT_RING (chan, src->width);
OUT_RING (chan, src->height);
OUT_RELOCh(chan, nouveau_buffer(src->buffer)->bo, src->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
@@ -105,11 +111,11 @@ nv50_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
struct nouveau_grobj *eng2d = nv->nvc->Nv2D;
int surf_format, rect_format;
- surf_format = nv50_format(dst->cpp);
+ surf_format = nv50_format(dst->format);
if (surf_format < 0)
return 1;
- rect_format = nv50_format(dst->cpp);
+ rect_format = nv50_format(dst->format);
if (rect_format < 0)
return 1;
@@ -120,8 +126,8 @@ nv50_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
OUT_RING (chan, surf_format);
OUT_RING (chan, 1);
BEGIN_RING(chan, eng2d, NV50_2D_DST_PITCH, 5);
- OUT_RING (chan, dst->pitch * dst->cpp);
- OUT_RING (chan, dst->pitch);
+ OUT_RING (chan, dst->stride);
+ OUT_RING (chan, dst->width);
OUT_RING (chan, dst->height);
OUT_RELOCh(chan, nouveau_buffer(dst->buffer)->bo, dst->offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -130,7 +136,7 @@ nv50_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
BEGIN_RING(chan, eng2d, NV50_2D_CLIP_X, 4);
OUT_RING (chan, 0);
OUT_RING (chan, 0);
- OUT_RING (chan, dst->pitch);
+ OUT_RING (chan, dst->width);
OUT_RING (chan, dst->height);
BEGIN_RING(chan, eng2d, 0x0580, 3);