summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/g3dvl/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/g3dvl/tests')
-rw-r--r--src/gallium/state_trackers/g3dvl/tests/.gitignore2
-rw-r--r--src/gallium/state_trackers/g3dvl/tests/Makefile7
-rw-r--r--src/gallium/state_trackers/g3dvl/tests/test_pf_rendering.c214
3 files changed, 220 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/g3dvl/tests/.gitignore b/src/gallium/state_trackers/g3dvl/tests/.gitignore
index 939666da9a..9b1ec4e212 100644
--- a/src/gallium/state_trackers/g3dvl/tests/.gitignore
+++ b/src/gallium/state_trackers/g3dvl/tests/.gitignore
@@ -2,5 +2,5 @@ test_context
test_surface
test_i_rendering
test_p_rendering
+test_pf_rendering
test_b_rendering
-
diff --git a/src/gallium/state_trackers/g3dvl/tests/Makefile b/src/gallium/state_trackers/g3dvl/tests/Makefile
index 8f983593c3..45cefa2e57 100644
--- a/src/gallium/state_trackers/g3dvl/tests/Makefile
+++ b/src/gallium/state_trackers/g3dvl/tests/Makefile
@@ -20,7 +20,7 @@ LIBS += -lg3dvl -lsoftpipe -ldraw -ltgsi -ltranslate -lrtasm -lcso_cache -lutil
.PHONY = all clean
-all: test_context test_surface test_i_rendering test_p_rendering test_b_rendering
+all: test_context test_surface test_i_rendering test_p_rendering test_pf_rendering test_b_rendering
test_context: test_context.o ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
$(CC) ${LDFLAGS} -o $@ $^ ${LIBS}
@@ -34,9 +34,12 @@ test_i_rendering: test_i_rendering.o ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
test_p_rendering: test_p_rendering.o ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
$(CC) ${LDFLAGS} -o $@ $^ ${LIBS}
+test_pf_rendering: test_pf_rendering.o ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
+ $(CC) ${LDFLAGS} -o $@ $^ ${LIBS}
+
test_b_rendering: test_b_rendering.o ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
$(CC) ${LDFLAGS} -o $@ $^ ${LIBS}
clean:
- rm -rf *.o test_context test_surface test_i_rendering test_p_rendering test_b_rendering
+ rm -rf *.o test_context test_surface test_i_rendering test_p_rendering test_pf_rendering test_b_rendering
diff --git a/src/gallium/state_trackers/g3dvl/tests/test_pf_rendering.c b/src/gallium/state_trackers/g3dvl/tests/test_pf_rendering.c
new file mode 100644
index 0000000000..43586fc553
--- /dev/null
+++ b/src/gallium/state_trackers/g3dvl/tests/test_pf_rendering.c
@@ -0,0 +1,214 @@
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <vl_context.h>
+#include <vl_surface.h>
+#include <xsp_winsys.h>
+
+static const unsigned short ycbcr16x16_420[8*8*6] =
+{
+ 0x00A5,0x00A5,0x00A5,0x0072,0x00A5,0x0072,0x0072,0x0072,
+ 0x0072,0x00A5,0x0072,0x0072,0x00A5,0x0072,0x0072,0x0072,
+ 0x0072,0x00A5,0x0072,0x0072,0x00A5,0x00A5,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x00A5,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x00A5,0x00A5,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x00A5,0x00A5,0x00A5,
+ 0x0072,0x0072,0x0072,0x0072,0x00A5,0x00A5,0x00A5,0x00A5,
+
+ 0x004F,0x004F,0x004F,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x004F,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x004F,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x004F,0x004F,
+
+ 0x003E,0x003E,0x003E,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x003E,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x003E,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x003E,0x003E
+};
+
+static const signed short ycbcr16x16_420_2[8*8*6] =
+{
+ 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, 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, 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, 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,
+ 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, 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, 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, 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,
+ 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, 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, 0, 0, 0, 0
+};
+
+int main(int argc, char **argv)
+{
+ const unsigned int video_width = 32, video_height = 32;
+ const unsigned int window_width = video_width * 2, window_height = video_height * 2;
+ int quit = 0;
+ Display *display;
+ Window root, window;
+ Pixmap framebuffer;
+ XEvent event;
+ struct pipe_context *pipe;
+ struct VL_CONTEXT *ctx;
+ struct VL_SURFACE *sfc, *ref_sfc;
+ struct VL_MOTION_VECTOR motion_vector =
+ {
+ {0, 0}, {32, 32}
+ };
+
+ display = XOpenDisplay(NULL);
+ root = XDefaultRootWindow(display);
+ window = XCreateSimpleWindow(display, root, 0, 0, window_width, window_height, 0, 0, 0);
+ framebuffer = XCreatePixmap(display, root, window_width, window_height, 24);
+
+ XSelectInput(display, window, ExposureMask | KeyPressMask);
+ XMapWindow(display, window);
+ XSync(display, 0);
+
+ pipe = create_pipe_context(display);
+ vlCreateContext(display, pipe, video_width, video_height, VL_FORMAT_YCBCR_420, &ctx);
+ vlCreateSurface(ctx, &sfc);
+ vlCreateSurface(ctx, &ref_sfc);
+
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 0, 0, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, ref_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 1, 0, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, ref_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 0, 1, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, ref_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 1, 1, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, ref_sfc);
+ vlRenderPMacroBlock
+ (
+ VL_FRAME_PICTURE,
+ VL_FIELD_FIRST,
+ 0,
+ 0,
+ VL_FIELD_MC,
+ &motion_vector,
+ 0x3F,
+ VL_DCT_FRAME_CODED,
+ (short*)ycbcr16x16_420_2,
+ ref_sfc,
+ sfc
+ );
+ vlPutSurface(sfc, framebuffer, 0, 0, video_width, video_height, 0, 0, window_width, window_height, VL_FRAME_PICTURE);
+
+ puts("Press any key to continue...");
+
+ while (!quit)
+ {
+ XNextEvent(display, &event);
+ switch (event.type)
+ {
+ case Expose:
+ {
+ XCopyArea
+ (
+ display,
+ framebuffer,
+ window,
+ XDefaultGC(display, XDefaultScreen(display)),
+ 0,
+ 0,
+ window_width,
+ window_height,
+ 0,
+ 0
+ );
+ break;
+ }
+ case KeyPress:
+ {
+ quit = 1;
+ break;
+ }
+ }
+ }
+
+ vlDestroySurface(sfc);
+ vlDestroySurface(ref_sfc);
+ vlDestroyContext(ctx);
+
+ XFreePixmap(display, framebuffer);
+ XDestroyWindow(display, window);
+ XCloseDisplay(display);
+
+ return 0;
+}
+