public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] supprt for qvfb
@ 2005-05-23 21:47 Alexander Neundorf
  0 siblings, 0 replies; only message in thread
From: Alexander Neundorf @ 2005-05-23 21:47 UTC (permalink / raw)
  To: ecos-devel

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

Hi,

attached you can find a package for the ecos synthetic target which adds 
support for the virtual framebuffer provided by qvfb 
(http://doc.trolltech.com/3.3/emb-qvfb.html)

Please add it to cvs or let me know what you'd like to have changed.

Bye
Alex
-- 
Work: alexander.neundorf@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org                - http://www.kde.org
      alex@neundorf.net               - http://www.neundorf.net

[-- Attachment #2: qvfb.diff.c --]
[-- Type: text/x-csrc, Size: 15824 bytes --]

diff -Nrbup packages/ecos.db /usr/src/ecos.qvfb/packages/ecos.db
--- packages/ecos.db	2005-05-23 23:34:05.000000000 +0200
+++ /usr/src/ecos.qvfb/packages/ecos.db	2005-05-23 23:15:22.000000000 +0200
@@ -2353,6 +2353,16 @@ package CYGPKG_MICROWINDOWS {
         description     "Microwindows."
 }
 
+package CYGPKG_QVFB {
+        alias           { "Synthetic target framebuffer support via QVFB" qvfb }
+        directory       services/gfx/qvfb
+        script          qvfb.cdl
+        description "
+This package provides support for a framebuffer for the synthetic target via
+accessing the Qt QVFB virtual framebuffer."
+}  
+
+
 package CYGPKG_HAL_SH_SH7750_DREAMCAST {
 	alias		{ "SEGA Dreamcast" hal_sh_dreamcast sh_dreamcast_hal }
 	directory	hal/sh/dreamcast
diff -Nrbup packages/services/gfx/qvfb/current/ChangeLog /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/ChangeLog
--- packages/services/gfx/qvfb/current/ChangeLog	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/ChangeLog	2005-05-23 22:44:47.000000000 +0200
@@ -0,0 +1,40 @@
+2005-05-23  Alexander Neundorf  <neundorf@kde.org>
+
+	* Initial import of the qvfb package, featuring support
+          for the virtual framebuffer provided by QVFB for the synthetic
+          target.
+
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 Alexander Neundorf
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
diff -Nrbup packages/services/gfx/qvfb/current/cdl/qvfb.cdl /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/cdl/qvfb.cdl
--- packages/services/gfx/qvfb/current/cdl/qvfb.cdl	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/cdl/qvfb.cdl	2005-05-23 22:10:01.000000000 +0200
@@ -0,0 +1,82 @@
+# ====================================================================
+#
+#      qvfb.cdl
+#
+#      Synthetic target Qt virtual frame buffer package.
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 2005 Alexander Neundorf
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+
+cdl_package CYGPKG_QVFB {
+    display     "Synthetic target framebuffer support via QVFB"
+    
+    requires CYGPKG_HAL_SYNTH
+
+    compile     -library=libextras.a qvfb.c
+
+    description "
+      This package provides support for a graphics framebuffer for the 
+      synthetic target. This is done by accessing the virtual framebuffer
+      provided by the QVfb server (coming with the Qt toolkit by Trolltech).
+      You can use it to simulate framebuffers with arbitrary sizes and 
+      1/4/8/12/16/32 bpp color depth." 
+
+        
+    cdl_component CYGPKG_QVFB_OPTIONS {
+    	display     "Build options"
+	    flavor      none
+	    description "
+	        Package-specific build options including control over compiler
+	        flags used only in building this package."
+
+	    cdl_option CYGPKG_QVFB_CFLAGS_ADD {
+            display "Additional compiler flags"
+            flavor  data
+            no_define
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are used in addition
+                to the set of global flags."
+	    }
+        cdl_option CYGPKG_QVFB_CFLAGS_REMOVE {
+            display "Suppressed compiler flags"
+            flavor  data
+            no_define
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are removed from
+                the set of global flags if present."
+        }
+    }
+}
diff -Nrbup packages/services/gfx/qvfb/current/doc/qvfb.txt /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/doc/qvfb.txt
--- packages/services/gfx/qvfb/current/doc/qvfb.txt	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/doc/qvfb.txt	2005-05-23 23:01:28.000000000 +0200
@@ -0,0 +1,48 @@
+The QVFB packages provides support for using the virtual framebuffer
+provided by the QVFB tool, which comes with the Qt toolkit by
+Trolltech (http://www.trolltech.com). With QVFB you can simulate
+a framebuffer device under X11.
+Visit http://doc.trolltech.com/3.3/emb-qvfb.html for more details about the
+QVFB server. To build the Qt QVFB server, enter <your_qt_sources>/tools/qvfb/ 
+and enter make. Do this in your normal Qt build tree, not in a Qt/Embedded build tree,
+since the QVFB server is a normal Qt application.
+In the QVFB server you can adjust the resolution and bit depth of the framebuffer.
+It supports standard and custom resolutions and 1/4/8/12/16/32 bpp color depths.
+
+Here comes a very simple and boring example:
+
+#include <qvfb.h>
+
+int draw_something()
+{
+   char* fb=qvfb_connect(0x62062182);
+   if (data==0)
+      return -1;
+   
+   int bpp=qvfb_depth();
+    
+   int width=qvfb_width();
+   int height=qvfb_height();
+   
+   int linestep=qvfb_linestep();
+   
+   //set the whole framebuffer to 0, i.e. black
+   memset(fb, 0, width*height*(bpp/8));
+
+   //draw some very boring white lines
+   for (int i=0; i<height; i+=10)
+   {
+      //set a line to 0xff, i.e. white
+      memset(fb+(linestep*i), 0xff, width*(bpp/8));
+   }
+
+   //force an update of thwe whole screen
+   qvfb_update();
+
+   qvfb_disconnect();
+   
+   return 0;
+}
+
+Alexander Neundorf, neundorf@kde.org
+
diff -Nrbup packages/services/gfx/qvfb/current/include/qvfb.h /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/include/qvfb.h
--- packages/services/gfx/qvfb/current/include/qvfb.h	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/include/qvfb.h	2005-02-19 20:04:42.000000000 +0100
@@ -0,0 +1,81 @@
+//==========================================================================
+//
+//      qvfb.h
+//
+//      Qt Virtual frame buffer driver for the synthetic target
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 Alexander Neundorf.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+
+#ifndef ECOS_SYNTH_QVFB_H
+#define ECOS_SYNTH_QVFB_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/**Connect to the qvfb frame buffer, which is implemented using a 
+shared memory segment. ipckey is the shared memory key of the 
+qvfb frame buffer. You can get it e.g. using ipcs.
+Returns NULL if it didn't succeed.
+*/
+char* qvfb_connect(unsigned int ipckey);
+
+/// Disconnect from shared memory segment again.
+void qvfb_disconnect();
+
+///Update the complete display
+void qvfb_update();
+
+///Update the specified region of the display
+void qvfb_update_rect(int x1, int y1, int x2, int y2);
+
+///Return the width of the display, or -1 if not connected
+int qvfb_width();
+
+///Return the height of the display, or -1 if not connected
+int qvfb_height();
+
+///Return the bitdepth of the display, or -1 if not connected
+int qvfb_depth();
+
+///Return the offset in bytes between the start of two consecutive lines, or -1 if not connected
+int qvfb_linestep();
+    
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+
+
diff -Nrbup packages/services/gfx/qvfb/current/src/qvfb.c /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/src/qvfb.c
--- packages/services/gfx/qvfb/current/src/qvfb.c	1970-01-01 01:00:00.000000000 +0100
+++ /usr/src/ecos.qvfb/packages/services/gfx/qvfb/current/src/qvfb.c	2005-02-19 20:04:27.000000000 +0100
@@ -0,0 +1,132 @@
+//==========================================================================
+//
+//      qvfb.c
+//
+//      Qt Virtual frame buffer driver for the synthetic target
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2005 Alexander Neundorf.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+
+#include <cyg/hal/hal_io.h>
+
+#include "qvfb.h"
+
+struct QVFbHeader
+{
+   int width;
+   int height;
+   int depth;
+   int linestep;
+   int dataoffset;
+   int update_x1;
+   int update_y1;
+   int update_x2;
+   int update_y2;
+   char dirty;
+   int  numcols;
+};
+
+struct QVFbHeader* qvfb_header=NULL;
+    
+char* qvfb_connect(unsigned int ipckey)
+{
+   int sid=0;
+   if (qvfb_header)
+      return qvfb_header;
+   sid=cyg_hal_sys_shmget(ipckey, 0, 0);
+   if (sid<0)
+      return NULL;
+   char* qvfb_buf=(char*)cyg_hal_sys_shmat(sid, 0, 0);
+   if (!qvfb_buf)
+      return NULL;
+   
+   qvfb_header=(struct QVFbHeader*)qvfb_buf;
+   return qvfb_buf+qvfb_header->dataoffset;
+}
+
+void qvfb_update()
+{
+   if (!qvfb_header)
+      return;
+   qvfb_header->update_x1=0;
+   qvfb_header->update_y1=0;
+   qvfb_header->update_x2=qvfb_header->width;
+   qvfb_header->update_y2=qvfb_header->height;
+   qvfb_header->dirty=0xff;
+}
+
+void qvfb_update_rect(int x1, int y1, int x2, int y2)
+{
+   if (!qvfb_header)
+      return;
+   qvfb_header->update_x1=x1;
+   qvfb_header->update_y1=y1;
+   qvfb_header->update_x2=x2;
+   qvfb_header->update_y2=y2;
+   qvfb_header->dirty=0xff;
+}
+
+void qvfb_disconnect()
+{
+   if (!qvfb_header)
+      return;
+   cyg_hal_sys_shmdt(qvfb_header);
+   qvfb_header=NULL;
+}
+
+int qvfb_width()
+{
+   if (!qvfb_header)
+      return -1;
+   return qvfb_header->width;
+}
+
+int qvfb_height()
+{
+   if (!qvfb_header)
+      return -1;
+   return qvfb_header->height;
+}
+
+int qvfb_depth()
+{
+   if (!qvfb_header)
+      return -1;
+   return qvfb_header->depth;
+}
+
+int qvfb_linestep()
+{
+   if (!qvfb_header)
+      return -1;
+   return qvfb_header->linestep;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-23 21:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-23 21:47 [PATCH] supprt for qvfb Alexander Neundorf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).