changeset 1147:82bbd3ee8ce7

hacked osd working on yv12
author al3x
date Sun, 17 Jun 2001 18:32:14 +0000
parents a84610bb5476
children 93a9a0ca5fb0
files libvo/vo_ggi.c
diffstat 1 files changed, 49 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_ggi.c	Sun Jun 17 17:44:56 2001 +0000
+++ b/libvo/vo_ggi.c	Sun Jun 17 18:32:14 2001 +0000
@@ -52,7 +52,7 @@
 static ggi_pixel black;
 #endif
 
-static int ggi_setmode(uint32_t d_width, uint32_t d_height, int d_depth, int format)
+static int ggi_setmode(uint32_t d_width, uint32_t d_height, int d_depth)
 {
     ggi_mode mode =
     {
@@ -109,12 +109,22 @@
 	return(-1);
     }
     
+    if (ggiGetMode(ggi_vis, &mode) != 0)
+    {
+	printf("ggi-setmode: unable to get mode\n");
+	ggiClose(ggi_vis);
+	ggiExit();
+	return(-1);
+    }
+    
     virt_width = mode.virt.x;
     virt_height = mode.virt.y;
     vo_screenwidth = mode.visible.x;
     vo_screenheight = mode.visible.y;
     vo_depthonscreen = d_depth;
-    ggi_bpp = d_depth; /* why ? */
+//    vo_depthonscreen = GT_DEPTH(mode.graphtype);
+//    ggi_bpp = GT_SIZE(mode.graphtype);
+    ggi_bpp = vo_depthonscreen;
 
 #ifdef get_db_info
     {
@@ -135,9 +145,9 @@
     }
 
     if (verbose)
-	printf("ggi-setmode: %dx%d (virt: %dx%d) screen depth: %d, bpp: %d, format: %s\n",
+	printf("ggi-setmode: %dx%d (virt: %dx%d) screen depth: %d, bpp: %d\n",
 	    vo_screenwidth, vo_screenheight, virt_width, virt_height,
-	    vo_depthonscreen, ggi_bpp, vo_format_name(ggi_format));
+	    vo_depthonscreen, ggi_bpp);
 
     ggi_bppmul = ggi_bpp/8;
 
@@ -149,7 +159,6 @@
     uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
 {
     vo_depthonscreen = 32;
-
     printf("ggi-init: This driver has got bugs, if you can, fix them.\n");
 
     if (ggiInit() != 0)
@@ -203,7 +212,7 @@
 	    break;
 	case IMGFMT_YV12: /* rgb, 24bit */
 	    ggi_bpp = 16;
-	    yuv2rgb_init(vo_depthonscreen, MODE_RGB);
+	    yuv2rgb_init(32/*vo_depthonscreen*/, MODE_RGB);
 	    break;
 	default:
 	    printf("ggi-init: no suitable image format found (requested: %s)\n",
@@ -212,14 +221,17 @@
     }
     ggi_format = format;
 
-    ggiSetFlags(ggi_vis, GGIFLAG_ASYNC);
-
-    if (ggi_setmode(d_width, d_height, vo_depthonscreen, ggi_format) != 0)
+    if (ggi_setmode(d_width, d_height, vo_depthonscreen) != 0)
     {
 	printf("ggi-init: setmode returned with error\n");
 	return(-1);
     }    
 
+    printf("ggi-init: input: %d bpp %s - screen depth: %d\n", ggi_bpp,
+	vo_format_name(ggi_format), vo_depthonscreen);
+
+    ggiSetFlags(ggi_vis, GGIFLAG_ASYNC);
+
     ggi_buffer = (ggi_directbuffer *)ggiDBGetBuffer(ggi_vis, 0);
 
     if (ggi_buffer == NULL)
@@ -294,9 +306,28 @@
 	case IMGFMT_YV12:
 	case IMGFMT_I420:
 	case IMGFMT_IYUV:
-	    vo_draw_alpha_yv12(w, h, src, srca, stride,
-		ggi_buffer->write+(virt_width*y0+x0),
-		virt_width);
+	    switch (vo_depthonscreen)
+	    {
+		case 32:
+        	    vo_draw_alpha_rgb32(w, h, src, srca, stride, 
+			ggi_buffer->write+4*(virt_width*y0+x0), 4*virt_width);
+		    break;
+		case 24:
+        	    vo_draw_alpha_rgb24(w, h, src, srca, stride, 
+	    		ggi_buffer->write+3*(virt_width*y0+x0), 3*virt_width);
+		    break;
+		case 16:
+        	    vo_draw_alpha_rgb16(w, h, src, srca, stride, 
+			ggi_buffer->write+2*(virt_width*y0+x0), 2*virt_width);
+		    break;
+		case 15:
+        	    vo_draw_alpha_rgb15(w, h, src, srca, stride, 
+			ggi_buffer->write+2*(virt_width*y0+x0), 2*virt_width);
+		    break;
+	    }
+//	    vo_draw_alpha_yv12(w, h, src, srca, stride,
+//		ggi_buffer->write+(virt_width*y0+x0),
+//		virt_width);
 	    break;
 	case IMGFMT_YUY2:
 	case IMGFMT_YVYU:
@@ -312,26 +343,22 @@
 	case IMGFMT_RGB15:
         case IMGFMT_BGR15:
             vo_draw_alpha_rgb15(w, h, src, srca, stride, 
-		ggi_buffer->write+2*(virt_width*y0+x0),
-		2*virt_width);
+		ggi_buffer->write+2*(virt_width*y0+x0), 2*virt_width);
             break;
         case IMGFMT_RGB16:
         case IMGFMT_BGR16:
             vo_draw_alpha_rgb16(w, h, src, srca, stride, 
-		ggi_buffer->write+2*(virt_width*y0+x0),
-		2*virt_width);
+		ggi_buffer->write+2*(virt_width*y0+x0), 2*virt_width);
             break;
         case IMGFMT_RGB24:
         case IMGFMT_BGR24:
             vo_draw_alpha_rgb24(w, h, src, srca, stride, 
-		ggi_buffer->write+3*(virt_width*y0+x0),
-		3*virt_width);
+		ggi_buffer->write+3*(virt_width*y0+x0), 3*virt_width);
             break;
         case IMGFMT_RGB32:
         case IMGFMT_BGR32:
             vo_draw_alpha_rgb32(w, h, src, srca, stride, 
-		ggi_buffer->write+4*(virt_width*y0+x0),
-		4*virt_width);
+		ggi_buffer->write+4*(virt_width*y0+x0), 4*virt_width);
 	    break;
     }
 }
@@ -363,8 +390,8 @@
 	case IMGFMT_YV12:
 /*	case IMGFMT_I420:
 	case IMGFMT_IYUV:
-	case IMGFMT_YUY2:
-	case IMGFMT_YVYU:
+*/	case IMGFMT_YUY2:
+/*	case IMGFMT_YVYU:
 	case IMGFMT_UYVY:*/
 	    return(1);
 	case IMGFMT_RGB8: