annotate vidix/drivers/genfb_vid.c @ 6579:6850df500b8c

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