4127
|
1 #include <errno.h>
|
|
2 #include <stdio.h>
|
|
3 #include <stdlib.h>
|
|
4 #include <string.h>
|
|
5 #include <math.h>
|
|
6 #include <inttypes.h>
|
|
7 #include <fcntl.h>
|
|
8
|
|
9 #include "../vidix.h"
|
|
10 #include "../fourcc.h"
|
|
11 #include "../../libdha/libdha.h"
|
|
12 #include "../../libdha/pci_ids.h"
|
|
13
|
4191
|
14 #define DEMO_DRIVER 1
|
|
15
|
4127
|
16 static int fd;
|
|
17
|
|
18 static void *mmio_base = 0;
|
|
19 static void *mem_base = 0;
|
|
20 static int32_t overlay_offset = 0;
|
|
21 static uint32_t ram_size = 0;
|
|
22
|
|
23 static int probed = 0;
|
|
24
|
|
25 /* VIDIX exports */
|
|
26
|
|
27 static vidix_capability_t genfb_cap =
|
|
28 {
|
|
29 "General Framebuffer",
|
4325
|
30 "alex",
|
4127
|
31 TYPE_OUTPUT,
|
4191
|
32 { 0, 0, 0, 0 },
|
4325
|
33 2048,
|
|
34 2048,
|
4127
|
35 4,
|
|
36 4,
|
|
37 -1,
|
|
38 FLAG_UPSCALER|FLAG_DOWNSCALER,
|
|
39 -1,
|
|
40 -1,
|
|
41 { 0, 0, 0, 0 }
|
|
42 };
|
|
43
|
|
44 unsigned int vixGetVersion(void)
|
|
45 {
|
|
46 return(VIDIX_VERSION);
|
|
47 }
|
|
48
|
4191
|
49 int vixProbe(int verbose,int force)
|
4127
|
50 {
|
|
51 int err = 0;
|
4191
|
52 #ifdef DEMO_DRIVER
|
|
53 err = ENOSYS;
|
|
54 #endif
|
4127
|
55
|
|
56 printf("[genfb] probe\n");
|
|
57
|
|
58 fd = open("/dev/fb0", O_RDWR);
|
|
59 if (fd < 0)
|
|
60 {
|
|
61 printf("Error occured durint open: %s\n", strerror(errno));
|
|
62 err = errno;
|
|
63 }
|
|
64
|
|
65 probed = 1;
|
|
66
|
|
67 return(err);
|
|
68 }
|
|
69
|
|
70 int vixInit(void)
|
|
71 {
|
|
72 printf("[genfb] init\n");
|
|
73
|
|
74 if (!probed)
|
|
75 {
|
|
76 printf("Driver was not probed but is being initialized\n");
|
|
77 return(EINTR);
|
|
78 }
|
|
79
|
|
80 return(0);
|
|
81 }
|
|
82
|
|
83 void vixDestroy(void)
|
|
84 {
|
|
85 printf("[genfb] destory\n");
|
|
86 return;
|
|
87 }
|
|
88
|
|
89 int vixGetCapability(vidix_capability_t *to)
|
|
90 {
|
|
91 memcpy(to, &genfb_cap, sizeof(vidix_capability_t));
|
|
92 return(0);
|
|
93 }
|
|
94
|
|
95 int vixQueryFourcc(vidix_fourcc_t *to)
|
|
96 {
|
|
97 printf("[genfb] query fourcc (%x)\n", to->fourcc);
|
|
98
|
|
99 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
|
|
100 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
|
|
101 VID_DEPTH_12BPP | VID_DEPTH_15BPP |
|
|
102 VID_DEPTH_16BPP | VID_DEPTH_24BPP |
|
|
103 VID_DEPTH_32BPP;
|
|
104
|
|
105 to->flags = 0;
|
|
106 return(0);
|
|
107 }
|
|
108
|
|
109 int vixConfigPlayback(vidix_playback_t *info)
|
|
110 {
|
|
111 printf("[genfb] config playback\n");
|
|
112
|
|
113 info->num_frames = 2;
|
|
114 info->frame_size = info->src.w*info->src.h+(info->src.w*info->src.h)/2;
|
4325
|
115 info->dest.pitch.y = 32;
|
|
116 info->dest.pitch.u = info->dest.pitch.v = 16;
|
|
117 info->offsets[0] = 0;
|
|
118 info->offsets[1] = info->frame_size;
|
|
119 info->offset.y = 0;
|
|
120 info->offset.v = ((info->src.w+31) & ~31) * info->src.h;
|
|
121 info->offset.u = info->offset.v+((info->src.w+31) & ~31) * info->src.h/4;
|
4127
|
122 info->dga_addr = malloc(info->num_frames*info->frame_size);
|
|
123 printf("[genfb] frame_size: %d, dga_addr: %x\n",
|
|
124 info->frame_size, info->dga_addr);
|
|
125
|
|
126 return(0);
|
|
127 }
|
|
128
|
|
129 int vixPlaybackOn(void)
|
|
130 {
|
|
131 printf("[genfb] playback on\n");
|
|
132 return(0);
|
|
133 }
|
|
134
|
|
135 int vixPlaybackOff(void)
|
|
136 {
|
|
137 printf("[genfb] playback off\n");
|
|
138 return(0);
|
|
139 }
|
|
140
|
|
141 int vixPlaybackFrameSelect(unsigned int frame)
|
|
142 {
|
4325
|
143 printf("[genfb] frameselect: %d\n", frame);
|
4127
|
144 return(0);
|
|
145 }
|