From patchwork Wed Aug 17 22:09:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryce Lanham X-Patchwork-Id: 110434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EA932B6F94 for ; Thu, 18 Aug 2011 08:56:07 +1000 (EST) Received: from localhost ([::1]:35052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtoJH-0007b3-03 for incoming@patchwork.ozlabs.org; Wed, 17 Aug 2011 18:10:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtoIv-0006cc-PP for qemu-devel@nongnu.org; Wed, 17 Aug 2011 18:09:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtoIu-0008NO-2W for qemu-devel@nongnu.org; Wed, 17 Aug 2011 18:09:41 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:33574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtoIt-0008LM-Si for qemu-devel@nongnu.org; Wed, 17 Aug 2011 18:09:40 -0400 Received: by mail-gy0-f173.google.com with SMTP id 12so1281803gyd.4 for ; Wed, 17 Aug 2011 15:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=yyRmPRC4ITJ9ZzGWFGIKfRp21jf9XxYTegpQ41koxkc=; b=XEvok2gTOsOD6KMED1fmjTqw4B8gtpIzgYxH3odKHUrYaXkCpvcF5G65ORxdnat0MB hiYVRyamd4hDpi6ShNz2PBHKaUNLdiE4QwAu24QqGliXOH2K/S7IXQkqr2LRCP4I3ypF 7GAgCT9uUnJVoQ0Ue1/CrUtW/5d06ETvg3EZU= Received: by 10.236.191.101 with SMTP id f65mr5383757yhn.9.1313618979668; Wed, 17 Aug 2011 15:09:39 -0700 (PDT) Received: from localhost.localdomain (betelgeuse.cs.uchicago.edu [128.135.24.226]) by mx.google.com with ESMTPS id c63sm445841yhe.46.2011.08.17.15.09.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 15:09:38 -0700 (PDT) From: Bryce Lanham To: qemu-devel@nongnu.org Date: Wed, 17 Aug 2011 17:09:07 -0500 Message-Id: <1313618952-14774-5-git-send-email-blanham@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1313618952-14774-1-git-send-email-blanham@gmail.com> References: <1313618952-14774-1-git-send-email-blanham@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.173 Cc: Bryce Lanham Subject: [Qemu-devel] [PATCH 3/8] next framebuffer driver, very basic, only supports running under 32 bit color at the moment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Bryce Lanham --- 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);