From ad7a3702c2c5f641c9fe1e9fb2855b34221c83cd Mon Sep 17 00:00:00 2001 From: glevand Date: Fri, 16 Nov 2012 20:56:40 +0000 Subject: [PATCH] use memset32; remove usleep before destroying gpu context --- display_buffer.c | 4 +--- gart_dma.c | 12 ++---------- inline.c | 10 +--------- solid.c | 10 +--------- util.h | 7 +++++++ vram_dma.c | 12 ++---------- 6 files changed, 14 insertions(+), 41 deletions(-) diff --git a/display_buffer.c b/display_buffer.c index 6c63198..2bc1bf7 100644 --- a/display_buffer.c +++ b/display_buffer.c @@ -229,7 +229,7 @@ main(int argc, char **argv) goto done; } - memset32(db[0], 0x0000ff00, DISPLAY_HEIGHT * DISPLAY_WIDTH); + memset32(db[0], 0xff00ff00, DISPLAY_HEIGHT * DISPLAY_WIDTH); memory_allocate.context_id = context_id; memory_allocate.type = PS3GPU_CTL_MEMORY_TYPE_VIDEO; @@ -333,8 +333,6 @@ main(int argc, char **argv) printf("FIFO put 0x%08x get 0x%08x ref 0x%08x\n", control[0x10], control[0x11], control[0x12]); - usleep(3000000); - /* Destroy GPU context */ context_free.context_id = context_id; diff --git a/gart_dma.c b/gart_dma.c index 3f33652..fda60d4 100644 --- a/gart_dma.c +++ b/gart_dma.c @@ -219,7 +219,7 @@ main(int argc, char **argv) goto done; } - memset(vram, 0x40, memory_allocate.size); + memset32(vram, 0xff404040, DISPLAY_HEIGHT * DISPLAY_WIDTH); /* Flip */ @@ -281,7 +281,7 @@ main(int argc, char **argv) for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (y < (h / 2)) - gart[y * w + x] = 0x0000ff00; + gart[y * w + x] = 0xff00ff00; else gart[y * w + x] = 0xffffff00; } @@ -322,16 +322,8 @@ main(int argc, char **argv) printf("FIFO put 0x%08x get 0x%08x ref 0x%08x\n", control[0x10], control[0x11], control[0x12]); - /* - * convert -depth 8 -size 1920x1080 rgba:image.argb \ - * -color-matrix "0 1 0 0, 0 0 1 0, 0 0 0 1, 1 0 0 0" \ - * -alpha off -background black -flatten image.jpg - */ - save_image("image.argb", (const char *) vram, DISPLAY_PITCH * DISPLAY_HEIGHT); - usleep(5000000); - /* Destroy GPU context */ context_free.context_id = context_id; diff --git a/inline.c b/inline.c index 79ee55e..33be0fb 100644 --- a/inline.c +++ b/inline.c @@ -220,7 +220,7 @@ main(int argc, char **argv) goto done; } - memset(vram, 0x40, memory_allocate.size); + memset32(vram, 0xff404040, DISPLAY_HEIGHT * DISPLAY_WIDTH); /* Flip */ @@ -293,16 +293,8 @@ main(int argc, char **argv) printf("FIFO put 0x%08x get 0x%08x ref 0x%08x\n", control[0x10], control[0x11], control[0x12]); - /* - * convert -depth 8 -size 1920x1080 rgba:image.argb \ - * -color-matrix "0 1 0 0, 0 0 1 0, 0 0 0 1, 1 0 0 0" \ - * -alpha off -background black -flatten image.jpg - */ - save_image("image.argb", (const char *) vram, DISPLAY_PITCH * DISPLAY_HEIGHT); - usleep(5000000); - /* Destroy GPU context */ context_free.context_id = context_id; diff --git a/solid.c b/solid.c index 595c3f8..ec0dff1 100644 --- a/solid.c +++ b/solid.c @@ -217,7 +217,7 @@ main(int argc, char **argv) goto done; } - memset(vram, 0x40, memory_allocate.size); + memset32(vram, 0xff404040, DISPLAY_HEIGHT * DISPLAY_WIDTH); /* Flip */ @@ -298,16 +298,8 @@ main(int argc, char **argv) printf("FIFO put 0x%08x get 0x%08x ref 0x%08x\n", control[0x10], control[0x11], control[0x12]); - /* - * convert -depth 8 -size 1920x1080 rgba:image.argb \ - * -color-matrix "0 1 0 0, 0 0 1 0, 0 0 0 1, 1 0 0 0" \ - * -alpha off -background black -flatten image.jpg - */ - save_image("image.argb", (const char *) vram, DISPLAY_PITCH * DISPLAY_HEIGHT); - usleep(2000000); - /* Destroy GPU context */ context_free.context_id = context_id; diff --git a/util.h b/util.h index c5c96ee..11680e5 100644 --- a/util.h +++ b/util.h @@ -44,6 +44,13 @@ get_channel_id(const volatile void *driver_info) return (*(uint32_t *) ((uint8_t *) driver_info + 0xc)); } +/* + * How to convert image to JPG format: + * + * convert -depth 8 -size 1920x1080 rgba:image.argb \ + * -color-matrix "0 1 0 0, 0 0 1 0, 0 0 0 1, 1 0 0 0" \ + * -alpha off -background black -flatten image.jpg + */ int save_image(const char *filename, const char *buf, int len); int transfer_data(uint32_t *fifo, uint32_t src, uint32_t dst, diff --git a/vram_dma.c b/vram_dma.c index 7f8fd89..8aef2f6 100644 --- a/vram_dma.c +++ b/vram_dma.c @@ -219,7 +219,7 @@ main(int argc, char **argv) goto done; } - memset(vram, 0x40, memory_allocate.size); + memset32(vram, 0xff404040, DISPLAY_HEIGHT * DISPLAY_WIDTH); /* Flip */ @@ -255,7 +255,7 @@ main(int argc, char **argv) for (y = y2; y < y2 + h; y++) { for (x = x2; x < x2 + w; x++) { if (y < (y2 + h / 2)) - vram[y * DISPLAY_WIDTH + x] = 0x0000ff00; + vram[y * DISPLAY_WIDTH + x] = 0xff00ff00; else vram[y * DISPLAY_WIDTH + x] = 0xffffff00; } @@ -321,16 +321,8 @@ main(int argc, char **argv) printf("FIFO put 0x%08x get 0x%08x ref 0x%08x\n", control[0x10], control[0x11], control[0x12]); - /* - * convert -depth 8 -size 1920x1080 rgba:image.argb \ - * -color-matrix "0 1 0 0, 0 0 1 0, 0 0 0 1, 1 0 0 0" \ - * -alpha off -background black -flatten image.jpg - */ - save_image("image.argb", (const char *) vram, DISPLAY_PITCH * DISPLAY_HEIGHT); - usleep(5000000); - /* Destroy GPU context */ context_free.context_id = context_id; -- 2.11.4.GIT