25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_fb.c,v 1.121 2006/07/08 12:30:02 debug Exp $ |
* $Id: dev_fb.c,v 1.127 2006/10/22 04:20:53 debug Exp $ |
29 |
* |
* |
30 |
* Generic framebuffer device. |
* Generic framebuffer device. |
31 |
* |
* |
32 |
* DECstation VFB01 monochrome framebuffer, 1024x864 |
* DECstation VFB01 monochrome framebuffer, 1024x864 |
33 |
* DECstation VFB02 8-bit color framebuffer, 1024x864 |
* DECstation VFB02 8-bit color framebuffer, 1024x864 |
34 |
* DECstation Maxine, 1024x768 8-bit color |
* DECstation Maxine, 1024x768 8-bit color |
|
* HPC (mips, arm, ..) framebuffer |
|
35 |
* Playstation 2 (24-bit color) |
* Playstation 2 (24-bit color) |
36 |
* Generic (any resolution, several bit depths possible, useful for |
* Generic (any resolution, several bit depths possible, useful for |
37 |
* testmachines) |
* testmachines) |
218 |
} |
} |
219 |
#endif |
#endif |
220 |
|
|
|
if (d->fb_window != NULL) |
|
|
console_set_framebuffer_mouse(cursor_x, cursor_y, |
|
|
d->fb_window->fb_number); |
|
|
|
|
221 |
/* debug("dev_fb_setcursor(%i,%i, size %i,%i, on=%i)\n", |
/* debug("dev_fb_setcursor(%i,%i, size %i,%i, on=%i)\n", |
222 |
cursor_x, cursor_y, cursor_xsize, cursor_ysize, on); */ |
cursor_x, cursor_y, cursor_xsize, cursor_ysize, on); */ |
223 |
} |
} |
230 |
* block copy/fill. |
* block copy/fill. |
231 |
* |
* |
232 |
* If fillflag is non-zero, then fill_[rgb] should contain the color |
* If fillflag is non-zero, then fill_[rgb] should contain the color |
233 |
* with which to fill. |
* with which to fill. (In 8-bit mode, only fill_r is used.) |
234 |
* |
* |
235 |
* If fillflag is zero, copy mode is used, and from_[xy] should contain |
* If fillflag is zero, copy mode is used, and from_[xy] should contain |
236 |
* the offset on the framebuffer where we should copy from. |
* the offset on the framebuffer where we should copy from. |
241 |
int fill_g, int fill_b, int x1, int y1, int x2, int y2, |
int fill_g, int fill_b, int x1, int y1, int x2, int y2, |
242 |
int from_x, int from_y) |
int from_x, int from_y) |
243 |
{ |
{ |
244 |
int y; |
int x, y; |
245 |
long from_ofs, dest_ofs, linelen; |
long from_ofs, dest_ofs, linelen; |
246 |
|
|
247 |
if (fillflag) |
if (fillflag) |
264 |
if (fillflag) { |
if (fillflag) { |
265 |
for (y=y1; y<=y2; y++) { |
for (y=y1; y<=y2; y++) { |
266 |
if (y>=0 && y<d->ysize) { |
if (y>=0 && y<d->ysize) { |
267 |
int x; |
unsigned char *buf = |
268 |
char buf[8192 * 3]; |
d->framebuffer + dest_ofs; |
269 |
if (d->bit_depth == 24) |
|
270 |
|
if (d->bit_depth == 24) { |
271 |
for (x=0; x<linelen && x<sizeof(buf); |
for (x=0; x<linelen && x<sizeof(buf); |
272 |
x += 3) { |
x += 3) { |
273 |
buf[x] = fill_r; |
buf[x] = fill_r; |
274 |
buf[x+1] = fill_g; |
buf[x+1] = fill_g; |
275 |
buf[x+2] = fill_b; |
buf[x+2] = fill_b; |
276 |
} |
} |
277 |
else { |
} else if (d->bit_depth == 8) { |
278 |
fatal("[ fb: TODO: fill for non-24-bit" |
memset(buf, fill_r, linelen); |
279 |
" modes ]\n"); |
} else { |
280 |
|
fatal("Unimplemented bit-depth (%i)" |
281 |
|
" for fb fill\n", d->bit_depth); |
282 |
|
exit(1); |
283 |
} |
} |
|
|
|
|
memmove(d->framebuffer + dest_ofs, buf, |
|
|
linelen); |
|
284 |
} |
} |
285 |
|
|
286 |
dest_ofs += d->bytes_per_line; |
dest_ofs += d->bytes_per_line; |
288 |
} else { |
} else { |
289 |
from_ofs = d->bytes_per_line * from_y + |
from_ofs = d->bytes_per_line * from_y + |
290 |
(d->bit_depth/8) * from_x; |
(d->bit_depth/8) * from_x; |
|
|
|
291 |
for (y=y1; y<=y2; y++) { |
for (y=y1; y<=y2; y++) { |
292 |
if (y>=0 && y<d->ysize) |
if (y >= 0 && y < d->ysize) { |
293 |
memmove(d->framebuffer + dest_ofs, |
if (from_y >= 0 && from_y < d->ysize) |
294 |
d->framebuffer + from_ofs, linelen); |
memmove(d->framebuffer + dest_ofs, |
295 |
|
d->framebuffer + from_ofs, linelen); |
296 |
|
else |
297 |
|
memset(d->framebuffer + dest_ofs, |
298 |
|
0, linelen); |
299 |
|
} |
300 |
|
from_y ++; |
301 |
from_ofs += d->bytes_per_line; |
from_ofs += d->bytes_per_line; |
302 |
dest_ofs += d->bytes_per_line; |
dest_ofs += d->bytes_per_line; |
303 |
} |
} |
408 |
#endif /* WITH_X11 */ |
#endif /* WITH_X11 */ |
409 |
|
|
410 |
|
|
411 |
/* |
DEVICE_TICK(fb) |
|
* dev_fb_tick(): |
|
|
* |
|
|
*/ |
|
|
void dev_fb_tick(struct cpu *cpu, void *extra) |
|
412 |
{ |
{ |
413 |
struct vfb_data *d = extra; |
struct vfb_data *d = extra; |
414 |
#ifdef WITH_X11 |
#ifdef WITH_X11 |
608 |
} |
} |
609 |
|
|
610 |
|
|
|
/* |
|
|
* dev_fb_access(): |
|
|
*/ |
|
611 |
DEVICE_ACCESS(fb) |
DEVICE_ACCESS(fb) |
612 |
{ |
{ |
613 |
struct vfb_data *d = extra; |
struct vfb_data *d = extra; |
732 |
* |
* |
733 |
* VFB_DEC_VFB01, _VFB02, and VFB_DEC_MAXINE are DECstation specific. |
* VFB_DEC_VFB01, _VFB02, and VFB_DEC_MAXINE are DECstation specific. |
734 |
* |
* |
735 |
* If type is VFB_HPC, then color encoding differs from the generic case. |
* VFB_HPC is like generic, but the color encoding is done as on HPCmips |
736 |
|
* and Dreamcast. |
737 |
* |
* |
738 |
* If bit_depth = -15 (note the minus sign), then a special hack is used for |
* If bit_depth = -15 (note the minus sign), then a special hack is used for |
739 |
* the Playstation Portable's 5-bit R, 5-bit G, 5-bit B. |
* the Playstation Portable's 5-bit R, 5-bit G, 5-bit B. |