annotate vidix/kernelhelper/test.c @ 25317:7f3cb5408f28

Fixed VIDIX color bug that was introduced when Radeon VIDIX driver was synchronized with vidix.sf.net. The red color was saturating. Corrected value fixes the issue and restore the color to the level it used to have before synchronization. Meaning of the value remains unknow but was retrieved from register's value of a Radeon 9000 card, so it may need further testing. Patch by Guillaume Lecerf (foxcore at gmail dot com)
author ben
date Mon, 10 Dec 2007 19:27:46 +0000
parents a9e111b88c4a
children 502f04b67653
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
1 #include <string.h>
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
2 #include <stdio.h>
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
3 #include <sys/ioctl.h>
4470
2d28c737ed13 initial
alex
parents:
diff changeset
4 #include <unistd.h>
2d28c737ed13 initial
alex
parents:
diff changeset
5 #include <errno.h>
2d28c737ed13 initial
alex
parents:
diff changeset
6 #include <fcntl.h>
2d28c737ed13 initial
alex
parents:
diff changeset
7 #include <sys/mman.h>
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
8
4470
2d28c737ed13 initial
alex
parents:
diff changeset
9 #include "dhahelper.h"
2d28c737ed13 initial
alex
parents:
diff changeset
10
2d28c737ed13 initial
alex
parents:
diff changeset
11 int main(int argc, char *argv[])
2d28c737ed13 initial
alex
parents:
diff changeset
12 {
2d28c737ed13 initial
alex
parents:
diff changeset
13 int fd;
2d28c737ed13 initial
alex
parents:
diff changeset
14 int ret;
2d28c737ed13 initial
alex
parents:
diff changeset
15
2d28c737ed13 initial
alex
parents:
diff changeset
16 fd = open("/dev/dhahelper", O_RDWR);
2d28c737ed13 initial
alex
parents:
diff changeset
17
2d28c737ed13 initial
alex
parents:
diff changeset
18 ioctl(fd, DHAHELPER_GET_VERSION, &ret);
2d28c737ed13 initial
alex
parents:
diff changeset
19
2d28c737ed13 initial
alex
parents:
diff changeset
20 printf("api version: %d\n", ret);
2d28c737ed13 initial
alex
parents:
diff changeset
21 if (ret != API_VERSION)
2d28c737ed13 initial
alex
parents:
diff changeset
22 printf("incompatible api!\n");
2d28c737ed13 initial
alex
parents:
diff changeset
23
2d28c737ed13 initial
alex
parents:
diff changeset
24 {
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
25 dhahelper_memory_t mem;
4470
2d28c737ed13 initial
alex
parents:
diff changeset
26
2d28c737ed13 initial
alex
parents:
diff changeset
27 mem.operation = MEMORY_OP_MAP;
2d28c737ed13 initial
alex
parents:
diff changeset
28 //mem.start = 0xe0000000;
2d28c737ed13 initial
alex
parents:
diff changeset
29 mem.start = 0xe4000008;
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
30 mem.offset = 0;
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
31 mem.size = 0x4000;
4470
2d28c737ed13 initial
alex
parents:
diff changeset
32 mem.ret = 0;
2d28c737ed13 initial
alex
parents:
diff changeset
33
2d28c737ed13 initial
alex
parents:
diff changeset
34 ret = ioctl(fd, DHAHELPER_MEMORY, &mem);
2d28c737ed13 initial
alex
parents:
diff changeset
35
2d28c737ed13 initial
alex
parents:
diff changeset
36 printf("ret: %s\n", strerror(errno));
2d28c737ed13 initial
alex
parents:
diff changeset
37
2d28c737ed13 initial
alex
parents:
diff changeset
38 mem.ret = (int)mmap(NULL, (size_t)mem.size, PROT_READ, MAP_SHARED, fd, (off_t)0);
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
39 printf("allocated to %x\n", mem.ret);
4470
2d28c737ed13 initial
alex
parents:
diff changeset
40
2d28c737ed13 initial
alex
parents:
diff changeset
41 if (argc > 1)
2d28c737ed13 initial
alex
parents:
diff changeset
42 if (mem.ret != 0)
2d28c737ed13 initial
alex
parents:
diff changeset
43 {
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
44 int i;
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
45
4470
2d28c737ed13 initial
alex
parents:
diff changeset
46 for (i = 0; i < 256; i++)
2d28c737ed13 initial
alex
parents:
diff changeset
47 printf("[%x] ", *(int *)(mem.ret+i));
2d28c737ed13 initial
alex
parents:
diff changeset
48 printf("\n");
2d28c737ed13 initial
alex
parents:
diff changeset
49 }
2d28c737ed13 initial
alex
parents:
diff changeset
50
2d28c737ed13 initial
alex
parents:
diff changeset
51 munmap((void *)mem.ret, mem.size);
2d28c737ed13 initial
alex
parents:
diff changeset
52
2d28c737ed13 initial
alex
parents:
diff changeset
53 mem.operation = MEMORY_OP_UNMAP;
2d28c737ed13 initial
alex
parents:
diff changeset
54 mem.start = mem.ret;
2d28c737ed13 initial
alex
parents:
diff changeset
55
2d28c737ed13 initial
alex
parents:
diff changeset
56 ioctl(fd, DHAHELPER_MEMORY, &mem);
2d28c737ed13 initial
alex
parents:
diff changeset
57 }
4471
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
58
f04a9bc331a5 added proper includes
alex
parents: 4470
diff changeset
59 return(0);
4470
2d28c737ed13 initial
alex
parents:
diff changeset
60 }