diff options
author | Patrice Mandin <pmandin@caramail.com> | 2008-08-23 22:27:36 +0200 |
---|---|---|
committer | Patrice Mandin <pmandin@caramail.com> | 2008-08-23 22:27:36 +0200 |
commit | d291f134b93e30ed7948b22f98d601c3049ddd95 (patch) | |
tree | 6f2b6f49734e029b605cd7ad16090ad89d896802 | |
parent | 25ec6f6e96996d1f23cef9eb478209c8b8e286ad (diff) |
Add image blit setup
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | imageblit.c | 44 | ||||
-rw-r--r-- | imageblit.h | 7 | ||||
-rw-r--r-- | main.c | 19 | ||||
-rw-r--r-- | object.c | 11 | ||||
-rw-r--r-- | object.h | 11 |
6 files changed, 80 insertions, 17 deletions
@@ -1,7 +1,8 @@ SOURCES = main.c screen.c fifo.c object.c test_nops.c \ - tcl_init.c tcl_triangle.c + tcl_init.c tcl_triangle.c imageblit.c HEADERS = screen.h fifo.h object.h test_nops.h \ - tcl_init.h tcl_triangle.h nv30_fpinst.h + tcl_init.h tcl_triangle.h imageblit.h \ + nv30_fpinst.h OBJECTS = $(SOURCES:%.c=%.o) diff --git a/imageblit.c b/imageblit.c new file mode 100644 index 0000000..af8d54a --- /dev/null +++ b/imageblit.c @@ -0,0 +1,44 @@ +#include <stdio.h> + +#include "screen.h" +#include "object.h" +#include "fifo.h" +#include "nouveau_class.h" + +void imageblit_init(void) +{ + printf("--ImageBlit, init\n"); + + SetSubchannel(NvSubImageBlit, NvImageBlit); + + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_SURFACE, 1); + OUT_RING(NvCtxSurf2D); + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_CLIP_RECTANGLE, 1); + OUT_RING(NvClipRect); + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_PATTERN, 1); + OUT_RING(NvImagePattern); + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_ROP, 1); + OUT_RING(NvRasterOp); + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_OPERATION, 1); + OUT_RING(NV04_IMAGE_BLIT_OPERATION_SRCCOPY); + + FIRE_RING(); +} + +void imageblit_copy(int sx,int sy, int dx,int dy, int w,int h) +{ + SetSubchannel(NvSubImageBlit, NvImageBlit); + + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_SURFACE, 1); + OUT_RING (NvCtxSurf2D); + + BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_OPERATION, 1); + OUT_RING (NV04_IMAGE_BLIT_OPERATION_SRCCOPY); + + BEGIN_RING(NvSubImageBlit, NV01_IMAGE_BLIT_POINT_IN, 3); + OUT_RING ((sy<<16)|sx); + OUT_RING ((dy<<16)|dx); + OUT_RING ((h<<16)|w); + + FIRE_RING(); +} diff --git a/imageblit.h b/imageblit.h new file mode 100644 index 0000000..9f1c471 --- /dev/null +++ b/imageblit.h @@ -0,0 +1,7 @@ +#ifndef IMAGEBLIT_H +#define IMAGEBLIT_H + +void imageblit_init(void); +void imageblit_copy(int sx,int sy, int dx,int dy, int w,int h); + +#endif @@ -7,6 +7,7 @@ #include "nouveau_class.h" #include "test_nops.h" +#include "imageblit.h" #include "tcl_init.h" #include "tcl_triangle.h" @@ -20,33 +21,27 @@ int main(int argc, char **argv) if (screen_open(2960, 1050, 32)!=0) { return -1; } - fflush(stdout); if (fifo_open()!=0) { screen_close(); return -1; } - fflush(stdout); if (object_list_create(CLASS_3D)!=0) { screen_close(); return -1; } - fflush(stdout); - /*test_nops(); - fflush(stdout);*/ + /*test_nops();*/ + + imageblit_init(); + /*imageblit_copy(16,16, 100,100, 64, 64);*/ tcl_init(); - fflush(stdout); - tcl_clear(); - fflush(stdout); + /*tcl_clear();*/ tcl_triangle_fixed(); - fflush(stdout); - - /*tcl_triangle_vtxattr(); - fflush(stdout);*/ + /*tcl_triangle_vtxattr();*/ printf("coincoin\n"); @@ -29,11 +29,20 @@ int object_list_create(int class_3d) if (object_create(Nv3D, class_3d)!=0) { return 1; } - if (object_create(NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D)!=0) { + if (object_create(NvCtxSurf2D, NV30_CONTEXT_SURFACES_2D)!=0) { return 1; } if (object_create(NvImageBlit, NV12_IMAGE_BLIT)!=0) { return 1; } + if (object_create(NvImagePattern, NV04_IMAGE_PATTERN)!=0) { + return 1; + } + if (object_create(NvRasterOp, NV03_CONTEXT_ROP)!=0) { + return 1; + } + if (object_create(NvClipRect, NV01_CONTEXT_CLIP_RECTANGLE)!=0) { + return 1; + } return 0; } @@ -1,4 +1,5 @@ #ifndef OBJECT_H +#define OBJECT_H /* Defines */ @@ -7,13 +8,19 @@ enum Objects { NvDmaTT = 0xD0AA0001, Nv3D = 0x80970001, NvImageBlit = 0x809F0001, - NvCtxSurf2D = 0x80620001 + NvCtxSurf2D = 0x80620001, + NvRasterOp = 0x80430001, + NvClipRect = 0x80190001, + NvImagePattern = 0x80440001 }; enum Subchannels { NvSubCtxSurf2D = 0, NvSubImageBlit = 1, - NvSub3D = 2 + NvSub3D = 2, + NvSubRasterOp = 3, + NvSubClipRect = 4, + NvSubImagePattern = 5 }; /* Functions */ |