[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/8] next framebuffer driver, very basic, only suppo
From: |
Bryce Lanham |
Subject: |
[Qemu-devel] [PATCH 3/8] next framebuffer driver, very basic, only supports running under 32 bit color at the moment |
Date: |
Wed, 17 Aug 2011 17:09:07 -0500 |
Signed-off-by: Bryce Lanham <address@hidden>
---
hw/next-fb.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/next-fb.h | 14 ++++++++
2 files changed, 116 insertions(+), 0 deletions(-)
create mode 100644 hw/next-fb.c
create mode 100644 hw/next-fb.h
diff --git a/hw/next-fb.c b/hw/next-fb.c
new file mode 100644
index 0000000..0cccae3
--- /dev/null
+++ b/hw/next-fb.c
@@ -0,0 +1,102 @@
+/*
+ * NeXT Cube/Staion Framebuffer Emulation
+ *
+ * Copyright (c) 2011 Bryce Lanham
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "hw.h"
+#include "loader.h"
+#include "console.h"
+#include "framebuffer.h"
+#define BITS 8
+#include "pixel_ops.h"
+#include "next-fb.h"
+/*
+typedef struct NextVGAState {
+ VGACommonState vga;
+ target_phys_addr_t vram_base;
+ };*/
+//need a function to register the mm i/o for fb and to register vram
+
+void nextfb_draw_line(void *opaque, uint8_t *d, const uint8_t *s, int width,
int pitch)
+{
+ uint32_t pal[4] = {0xFFFFFFFF, 0xFFAAAAAA, 0xFF555555,0xFF000000};
+ uint32_t*buf = qemu_malloc(1120*4);
+ int i = 0;
+ for(;i<280; i++)
+ {
+ int j=i*4;
+ uint8_t src = s[i];
+ buf[j+3]= pal[src & 0x3];
+ src >>=2;
+ buf[j+2]= pal[src & 0x3];
+ src >>=2;
+ buf[j+1]= pal[src & 0x3];
+ src >>=2;
+ buf[j+0]= pal[src & 0x3];
+ }
+
+ memcpy(d,buf,1120*4);
+ free(buf);
+}
+
+
+static void nextfb_update(void * opaque)
+{
+ next_state_t *s = (next_state_t *)opaque;
+ DisplaySurface *info = s->ds->surface;
+
+
+
+ int dest_width = 4;
+ int src_width;
+ int first = 0;
+ int last = 0;
+ src_width = s->cols = 1120;
+ src_width = 288;
+ dest_width = 1120;
+ dest_width = info->linesize;
+ framebuffer_update_display(s->ds,
+ 0xB000000,1120,832,
+ src_width,dest_width, 0,
+ 1,
+ nextfb_draw_line,
+ NULL,
+ &first, &last);
+
+ dpy_update(s->ds,0,0,1120,832);
+}
+
+static void nextfb_invalidate(void *opaque)
+{
+}
+
+void nextfb_init(next_state_t *s)
+{
+ s->ds = graphic_console_init(nextfb_update,nextfb_invalidate, NULL, NULL,
s);
+ qemu_console_resize(s->ds,1120,832);
+ s->cols = 1120;
+ s->rows = 832;
+ s->invalidate = 1;
+
+ cpu_register_physical_memory(0xB000000, 0x1CB100,
+ qemu_ram_alloc(NULL,"next-vram.ram",0x1CB100) | IO_MEM_RAM);
+
+}
diff --git a/hw/next-fb.h b/hw/next-fb.h
new file mode 100644
index 0000000..9d2b547
--- /dev/null
+++ b/hw/next-fb.h
@@ -0,0 +1,14 @@
+typedef struct {
+ DisplayState *ds;
+ uint32_t base;
+ uint32_t pitch;
+ uint32_t cols;
+ uint32_t rows;
+ int invalidate;
+
+
+} next_state_t;
+
+void nextfb_draw_line(void *opaque, uint8_t *d, const uint8_t *s, int width,
int pitch);
+
+void nextfb_init(next_state_t *s);
--
1.7.2.3
- [Qemu-devel] [RFC][PATCH 0/8] NeXT black hardware support, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 0/8] *** SUBJECT HERE ***, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 1/8] added next source files to Makefile.target, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 3/8] next framebuffer driver, very basic, only supports running under 32 bit color at the moment,
Bryce Lanham <=
- [Qemu-devel] [PATCH 4/8] next keyboard driver, only supports a subset of modifier keys, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 2/8] main next driver, needs a bit of cleanup, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 5/8] partially working network driver, needs more comparison with real hardware before it can be made fully working, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 6/8] adds SFC, DFC, MMU TC, access control register, and user stack pointer acces to movec_to/from, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 7/8] added move16, cinva, pflush instructions, and disabled abort on execution of frestore/fsave, Bryce Lanham, 2011/08/17
- [Qemu-devel] [PATCH 8/8] added mmu tc, sfc, dfc, and access control registers to the cpu header, Bryce Lanham, 2011/08/17