[OpenBIOS] [commit] r1141 - in trunk/openbios-devel: include/libopenbios include/packages libopenbios packages

repository service svn at openbios.org
Sun Jun 9 14:25:00 CEST 2013


Author: mcayland
Date: Sun Jun  9 14:24:59 2013
New Revision: 1141
URL: http://tracker.coreboot.org/trac/openbios/changeset/1141

Log:
video: Create new video_common.c file for shared video primitive routines.

Start by moving the get_color() and set_color() functions into the library.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Added:
   trunk/openbios-devel/include/libopenbios/video.h
   trunk/openbios-devel/libopenbios/video_common.c
Modified:
   trunk/openbios-devel/include/packages/video.h
   trunk/openbios-devel/libopenbios/build.xml
   trunk/openbios-devel/libopenbios/console_common.c
   trunk/openbios-devel/packages/video.c

Added: trunk/openbios-devel/include/libopenbios/video.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/openbios-devel/include/libopenbios/video.h	Sun Jun  9 14:24:59 2013	(r1141)
@@ -0,0 +1,16 @@
+
+unsigned long get_color(int col_ind);
+void set_color(int ind, unsigned long color);
+void video_mask_blit(void);
+
+typedef struct osi_fb_info {
+    unsigned long mphys;
+    unsigned long mvirt;
+    int rb, w, h, depth;
+} osi_fb_info_t;
+
+extern struct video_info {
+    int has_video;
+    osi_fb_info_t fb;
+    unsigned long *pal;    /* 256 elements */
+} video;

Modified: trunk/openbios-devel/include/packages/video.h
==============================================================================
--- trunk/openbios-devel/include/packages/video.h	Sun Jun  9 14:24:57 2013	(r1140)
+++ trunk/openbios-devel/include/packages/video.h	Sun Jun  9 14:24:59 2013	(r1141)
@@ -4,7 +4,6 @@
 /* packages/video.c */
 int video_get_res(int *w, int *h);
 void draw_pixel(int x, int y, int colind);
-void set_color(int ind, unsigned long color);
 void video_scroll(int height);
 void init_video(unsigned long fb, int width, int height, int depth, int rb);
 

Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml	Sun Jun  9 14:24:57 2013	(r1140)
+++ trunk/openbios-devel/libopenbios/build.xml	Sun Jun  9 14:24:59 2013	(r1141)
@@ -20,6 +20,7 @@
   <object source="linuxbios_info.c" condition="LINUXBIOS"/>
   <object source="ofmem_common.c" condition="OFMEM"/>
   <object source="xcoff_load.c" condition="LOADER_XCOFF"/>
+  <object source="video_common.c"/>
  </library>
 
  <dictionary name="openbios" target="forth">

Modified: trunk/openbios-devel/libopenbios/console_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/console_common.c	Sun Jun  9 14:24:57 2013	(r1140)
+++ trunk/openbios-devel/libopenbios/console_common.c	Sun Jun  9 14:24:59 2013	(r1141)
@@ -16,6 +16,7 @@
 #include "libopenbios/bindings.h"
 #include "libopenbios/fontdata.h"
 #include "libopenbios/console.h"
+#include "libopenbios/video.h"
 #include "packages/video.h"
 
 #define FONT_ADJ_HEIGHT	 (FONT_HEIGHT + 2)

Added: trunk/openbios-devel/libopenbios/video_common.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/openbios-devel/libopenbios/video_common.c	Sun Jun  9 14:24:59 2013	(r1141)
@@ -0,0 +1,65 @@
+/*
+ *   Creation Date: <2002/10/23 20:26:40 samuel>
+ *   Time-stamp: <2004/01/07 19:39:15 samuel>
+ *
+ *     <video_common.c>
+ *
+ *     Shared video routines
+ *
+ *   Copyright (C) 2002, 2003, 2004 Samuel Rydh (samuel at ibrium.se)
+ *
+ *   This program 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
+ *
+ */
+
+#include "config.h"
+#include "libopenbios/bindings.h"
+#include "libopenbios/video.h"
+#include "packages/video.h"
+#include "drivers/vga.h"
+
+struct video_info video;
+
+unsigned long
+get_color( int col_ind )
+{
+	unsigned long col;
+	if( !video.has_video || col_ind < 0 || col_ind > 255 )
+		return 0;
+	if( video.fb.depth == 8 )
+		return col_ind;
+	col = video.pal[col_ind];
+	if( video.fb.depth == 24 || video.fb.depth == 32 )
+		return col;
+	if( video.fb.depth == 15 )
+		return ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f);
+	return 0;
+}
+
+void
+set_color( int ind, unsigned long color )
+{
+	if( !video.has_video || ind < 0 || ind > 255 )
+		return;
+	video.pal[ind] = color;
+
+#ifdef CONFIG_MOL
+	if( video.fb.depth == 8 )
+		OSI_SetColor( ind, color );
+#elif defined(CONFIG_SPARC32)
+#if defined(CONFIG_DEBUG_CONSOLE_VIDEO)
+	if( video.fb.depth == 8 ) {
+            dac[0] = ind << 24;
+            dac[1] = ((color >> 16) & 0xff) << 24; // Red
+            dac[1] = ((color >> 8) & 0xff) << 24; // Green
+            dac[1] = (color & 0xff) << 24; // Blue
+        }
+#endif
+#else
+	vga_set_color(ind, ((color >> 16) & 0xff),
+			   ((color >> 8) & 0xff),
+			   (color & 0xff));
+#endif
+}

Modified: trunk/openbios-devel/packages/video.c
==============================================================================
--- trunk/openbios-devel/packages/video.c	Sun Jun  9 14:24:57 2013	(r1140)
+++ trunk/openbios-devel/packages/video.c	Sun Jun  9 14:24:59 2013	(r1141)
@@ -20,21 +20,10 @@
 #include "libopenbios/ofmem.h"
 #include "drivers/drivers.h"
 #include "packages/video.h"
+#include "libopenbios/video.h"
 #include "libopenbios/console.h"
 #include "drivers/vga.h"
 
-typedef struct osi_fb_info {
-    unsigned long mphys;
-    unsigned long mvirt;
-    int rb, w, h, depth;
-} osi_fb_info_t;
-
-static struct {
-	int		has_video;
-	osi_fb_info_t	fb;
-	unsigned long		*pal;		/* 256 elements */
-} video;
-
 
 int
 video_get_res( int *w, int *h )
@@ -103,22 +92,6 @@
 #endif
 }
 
-static unsigned long
-get_color( int col_ind )
-{
-	unsigned long col;
-	if( !video.has_video || col_ind < 0 || col_ind > 255 )
-		return 0;
-	if( video.fb.depth == 8 )
-		return col_ind;
-	col = video.pal[col_ind];
-	if( video.fb.depth == 24 || video.fb.depth == 32 )
-		return col;
-	if( video.fb.depth == 15 )
-		return ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f);
-	return 0;
-}
-
 void
 draw_pixel( int x, int y, int colind )
 {
@@ -176,32 +149,6 @@
 #endif
 }
 
-void
-set_color( int ind, unsigned long color )
-{
-	if( !video.has_video || ind < 0 || ind > 255 )
-		return;
-	video.pal[ind] = color;
-
-#ifdef CONFIG_MOL
-	if( video.fb.depth == 8 )
-		OSI_SetColor( ind, color );
-#elif defined(CONFIG_SPARC32)
-#if defined(CONFIG_DEBUG_CONSOLE_VIDEO)
-	if( video.fb.depth == 8 ) {
-            dac[0] = ind << 24;
-            dac[1] = ((color >> 16) & 0xff) << 24; // Red
-            dac[1] = ((color >> 8) & 0xff) << 24; // Green
-            dac[1] = (color & 0xff) << 24; // Blue
-        }
-#endif
-#else
-	vga_set_color(ind, ((color >> 16) & 0xff),
-			   ((color >> 8) & 0xff),
-			   (color & 0xff));
-#endif
-}
-
 void
 video_scroll( int height )
 {



More information about the OpenBIOS mailing list