2 * (C) GraÅžvydas "notaz" Ignotas, 2011
4 * This work is licensed under the terms of any of these licenses
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
13 #include "../../frontend/plugin_lib.h"
15 static const struct rearmed_cbs *cbs;
16 static void *screen_buf;
28 static void check_mode_change(void)
30 static uint32_t old_status;
33 // width|rgb24 change?
34 if ((gpu.status.reg ^ old_status) & ((7<<16)|(1<<21)) || gpu.screen.h != old_h)
36 old_status = gpu.status.reg;
38 screen_buf = cbs->pl_vout_set_mode(gpu.screen.hres,
39 gpu.screen.h, gpu.status.rgb24 ? 24 : 16);
43 static void blit(void)
45 int x = gpu.screen.x & ~1; // alignment needed by blitter
49 uint16_t *vram = gpu.vram;
50 int stride = gpu.screen.hres;
54 fb_offs = y * 1024 + x;
55 dest = (uint8_t *)screen_buf;
57 // only do centering, at least for now
58 doffs = (stride - w) / 2 & ~1;
63 dest += (doffs / 8) * 24;
64 for (; h-- > 0; dest += stride * 3, fb_offs += 1024)
66 fb_offs &= 1024*512-1;
67 bgr888_to_rgb888(dest, vram + fb_offs, w * 3);
71 for (; h-- > 0; dest += stride * 2, fb_offs += 1024)
73 fb_offs &= 1024*512-1;
74 bgr888_to_rgb565(dest, vram + fb_offs, w * 3);
81 for (; h-- > 0; dest += stride * 2, fb_offs += 1024)
83 fb_offs &= 1024*512-1;
84 bgr555_to_rgb565(dest, vram + fb_offs, w * 2);
88 screen_buf = cbs->pl_vout_flip();
91 void vout_update(void)
94 if (cbs->pl_vout_raw_flip)
95 cbs->pl_vout_raw_flip(gpu.screen.x, gpu.screen.y);
100 long GPUopen(void **unused)
102 gpu.frameskip.active = 0;
103 gpu.frameskip.frame_ready = 1;
106 screen_buf = cbs->pl_vout_flip();
112 cbs->pl_vout_close();
116 void vout_set_config(const struct rearmed_cbs *cbs_)
121 // vim:shiftwidth=2:expandtab