]> git.sesse.net Git - vlc/commitdiff
Mise au point du driver GGI.
authorVincent Seguin <seguin@videolan.org>
Sun, 16 Jan 2000 19:17:15 +0000 (19:17 +0000)
committerVincent Seguin <seguin@videolan.org>
Sun, 16 Jan 2000 19:17:15 +0000 (19:17 +0000)
Makefile
src/interface/main.c
src/video_output/video_ggi.c
src/video_output/video_output.c
src/video_output/yuv_mmx.S

index a53066a41fd2bd3c25f0beba5a0ec6ea3d9d40b3..e035f41d1fe11babe44ec03e19c1f38b21c5ae0b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -215,7 +215,7 @@ endif
 
 ifeq ($(ARCH),MMX)
 ASM_OBJ =                      video_decoder_ref/idctmmx.o \
-                                               video_output/yuv-mmx.o
+                                               video_output/yuv_mmx.o
 endif
 
 C_OBJ = $(interface_obj) \
index b5033b26da13793cd2649eacb8d0b068f0170c3b..0802063f181f23302af07d6fd26f79768607f553 100644 (file)
@@ -388,7 +388,7 @@ static void Usage( void )
             );
 
     /* Options */
-    intf_Msg("Options:" \
+    intf_Msg("Options:\n" \
              "  -h, --help                      print usage\n" \
              "  -g, --grayscale                 grayscale video\n" \
              "  --noaudio                       disable audio\n" \
@@ -396,7 +396,7 @@ static void Usage( void )
              "  --mono                          disable stereo\n"
              "  --novideo                       disable video\n" \
              "  --color                         color video\n" \
-             "  --novlans                              disable vlans\n" \
+             "  --novlans                       disable vlans\n" \
              );
 
     /* Interface parameters */
@@ -408,7 +408,7 @@ static void Usage( void )
     intf_Msg("Audio parameters:\n" \
              "  " AOUT_DSP_VAR "=<filename>              dsp device path\n" \
              "  " AOUT_STEREO_VAR "={1|0}                stereo or mono output\n" \
-             "  " AOUT_RATE_VAR "=<rate>                 output rate\n" \
+             "  " AOUT_RATE_VAR "=<rate>           output rate\n" \
             );
 
     /* Video parameters */
index 2122ec660fe7f135b35bc384fdbf48b4bb6713a4..a0b649fd0f4c5ddc9d160e09d3407d3d2eaa73ef 100644 (file)
@@ -32,8 +32,14 @@ typedef struct vout_sys_s
     /* GGI system informations */
     ggi_visual_t        p_display;                           /* display device */
 
-    /* Buffer index */
-    int                 i_buffer_index;    
+    /* Buffers informations */
+    int                 i_buffer_index;                        /* buffer index */
+    ggi_directbuffer *  pp_buffer[2];                               /* buffers */
+    boolean_t           b_must_acquire;     /* must be acquired before writing */    
+
+    /* Characters size */
+    int                 i_char_width;
+    int                 i_char_height;    
 } vout_sys_t;
 
 /*******************************************************************************
@@ -77,7 +83,13 @@ int vout_SysCreate( vout_thread_t *p_vout )
  *******************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
+    /* Acquire first buffer */
     p_vout->p_sys->i_buffer_index = 0;
+    if( p_vout->p_sys->b_must_acquire )
+    {
+        ggiResourceAcquire( p_vout->p_sys->pp_buffer[ 0 ]->resource, GGI_ACTYPE_WRITE );        
+    }    
+
     return( 0 );
 }
 
@@ -88,7 +100,11 @@ int vout_SysInit( vout_thread_t *p_vout )
  *******************************************************************************/
 void vout_SysEnd( vout_thread_t *p_vout )
 {
-    ;
+    /* Release buffer */
+    if( p_vout->p_sys->b_must_acquire )
+    {
+        ggiResourceRelease( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource );
+    }
 }
 
 /*******************************************************************************
@@ -126,13 +142,24 @@ int vout_SysManage( vout_thread_t *p_vout )
 void vout_SysDisplay( vout_thread_t *p_vout )
 {
     /* Change display frame */
+    if( p_vout->p_sys->b_must_acquire )
+    {            
+        ggiResourceRelease( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource );
+    }    
     ggiFlush( p_vout->p_sys->p_display ); // ??    
-    ggiSetDisplayFrame( p_vout->p_sys->p_display, p_vout->p_sys->i_buffer_index );      
+    ggiSetDisplayFrame( p_vout->p_sys->p_display, 
+                        p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->frame );      
         
     /* Swap buffers and change write frame */
     p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1;
-    ggiSetWriteFrame( p_vout->p_sys->p_display, p_vout->p_sys->i_buffer_index );        
-}
+    if( p_vout->p_sys->b_must_acquire )
+    {            
+        ggiResourceAcquire( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->resource, 
+                            GGI_ACTYPE_WRITE );
+    } 
+    ggiSetWriteFrame( p_vout->p_sys->p_display,
+                      p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->frame );    
+ }
 
 /*******************************************************************************
  * vout_SysGetPicture: get current display buffer informations
@@ -140,9 +167,41 @@ void vout_SysDisplay( vout_thread_t *p_vout )
  * This function returns the address of the current display buffer.
  *******************************************************************************/
 byte_t * vout_SysGetPicture( vout_thread_t *p_vout )
+{    
+    return( p_vout->p_sys->pp_buffer[ p_vout->p_sys->i_buffer_index ]->write );        
+}
+
+/*******************************************************************************
+ * vout_SysPrint: print simple text on a picture
+ *******************************************************************************
+ * This function will print a simple text on the picture. It is designed to
+ * print debugging or general informations, not to render subtitles. 
+ *******************************************************************************/
+void vout_SysPrint( vout_thread_t *p_vout, int i_x, int i_y, int i_halign, 
+                    int i_valign, unsigned char *psz_text )
 {
-//????
-//    return( p_vout->p_sys->p_ximage[ p_vout->p_sys->i_buffer_index ].data );        
+    /* Update upper left coordinates according to alignment */
+    switch( i_halign )
+    {
+    case 0:                                                        /* centered */
+        i_x -= p_vout->p_sys->i_char_width * strlen( psz_text ) / 2;
+        break;        
+    case 1:                                                   /* right aligned */
+        i_x -= p_vout->p_sys->i_char_width * strlen( psz_text );
+        break;                
+    }
+    switch( i_valign )
+    {
+    case 0:                                                        /* centered */
+        i_y -= p_vout->p_sys->i_char_height / 2;
+        break;        
+    case 1:                                                   /* bottom aligned */
+        i_y -= p_vout->p_sys->i_char_height;
+        break;                
+    }
+
+    /* Print text */
+    ggiPuts( p_vout->p_sys->p_display, i_x, i_y, psz_text );
 }
 
 /* following functions are local */
@@ -156,6 +215,9 @@ byte_t * vout_SysGetPicture( vout_thread_t *p_vout )
 static int GGIOpenDisplay( vout_thread_t *p_vout )
 {
     ggi_mode    mode;                                       /* mode descriptor */    
+    ggi_color   col_fg;                                    /* foreground color */    
+    ggi_color   col_bg;                                    /* background color */    
+    int         i_index;                                 /* all purposes index */    
     
     /* Initialize library */
     if( ggiInit() )
@@ -176,7 +238,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
     /* Find most appropriate mode */
     mode.frames =       2;                                        /* 2 buffers */
     mode.visible.x =    p_vout->i_width;                      /* minimum width */
-    mode.visible.y =    p_vout->i_width;                      /* maximum width */    
+    mode.visible.y =    p_vout->i_height;                    /* minimum height */    
     mode.virt.x =       GGI_AUTO;
     mode.virt.y =       GGI_AUTO;
     mode.size.x =       GGI_AUTO;
@@ -198,9 +260,75 @@ static int GGIOpenDisplay( vout_thread_t *p_vout )
         return( 1 );        
     }            
 
+    /* Check buffers properties */
+    p_vout->p_sys->b_must_acquire = 0;    
+    for( i_index = 0; i_index < 2; i_index++ )
+    {
+        /* Get buffer address */
+        p_vout->p_sys->pp_buffer[ i_index ] = 
+            ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
+        if( p_vout->p_sys->pp_buffer[ i_index ] == NULL )
+        {
+            intf_ErrMsg("error: double buffering is not possible\n");
+            ggiClose( p_vout->p_sys->p_display );        
+            ggiExit();
+            return( 1 );            
+        }        
+        
+        /* Check buffer properties */
+        if( ! (p_vout->p_sys->pp_buffer[ i_index ]->type & GGI_DB_SIMPLE_PLB) ||
+            (p_vout->p_sys->pp_buffer[ i_index ]->page_size != 0) ||
+            (p_vout->p_sys->pp_buffer[ i_index ]->write == NULL ) ||
+            (p_vout->p_sys->pp_buffer[ i_index ]->noaccess != 0) ||
+            (p_vout->p_sys->pp_buffer[ i_index ]->align != 0) )
+        {
+            intf_ErrMsg("error: incorrect video memory type\n");
+            ggiClose( p_vout->p_sys->p_display );        
+            ggiExit();
+            return( 1 ); 
+        } 
+
+        /* Check if buffer needs to be acquired before write */
+        if( ggiResourceMustAcquire( p_vout->p_sys->pp_buffer[ i_index ]->resource ) )
+        {
+            p_vout->p_sys->b_must_acquire = 1;            
+        }            
+    } 
+#ifdef DEBUG
+    if( p_vout->p_sys->b_must_acquire )
+    {
+        intf_DbgMsg("buffers must be acquired\n");        
+    }    
+#endif
+
+    /* Get font size */
+    if( ggiGetCharSize( p_vout->p_sys->p_display, &p_vout->p_sys->i_char_width,
+                        &p_vout->p_sys->i_char_height ) )
+    {
+        intf_ErrMsg("error: can't get font size\n");
+        ggiClose( p_vout->p_sys->p_display );        
+        ggiExit();
+        return( 1 );   
+    }
+
+    /* Set graphic context colors */
+    col_fg.r = col_fg.g = col_fg.b = -1;    
+    col_bg.r = col_bg.g = col_bg.b = 0;    
+    if( ggiSetGCForeground(p_vout->p_sys->p_display, 
+                           ggiMapColor(p_vout->p_sys->p_display,&col_fg)) ||
+        ggiSetGCBackground(p_vout->p_sys->p_display, 
+                           ggiMapColor(p_vout->p_sys->p_display,&col_bg)) )
+    {
+        intf_ErrMsg("error: can't set colors\n");
+        ggiClose( p_vout->p_sys->p_display );        
+        ggiExit();
+        return( 1 );  
+    }    
+
     /* Set thread information */
     p_vout->i_width =           mode.visible.x;    
     p_vout->i_height =          mode.visible.y;
+    p_vout->i_bytes_per_line =  p_vout->p_sys->pp_buffer[ 0 ]->buffer.plb.stride;    
     switch( mode.graphtype )
     {
     case GT_15BIT:
index 1594666676ca0098e5c30d638aafb9f50bde5dbf..4f93e47a5701f2bdf9ca2d9f12acabb4fa14dce1 100644 (file)
@@ -177,7 +177,11 @@ vout_thread_t * vout_CreateThread               (
 
     /* Initialize some fields used by the system-dependant method - these fields will
      * probably be modified by the method */
+#ifdef DEBUG
+    p_vout->b_info              = 1;    
+#else
     p_vout->b_info              = 0;    
+#endif
     p_vout->b_grayscale         = main_GetIntVariable( VOUT_GRAYSCALE_VAR, 
                                                        VOUT_GRAYSCALE_DEFAULT );
     p_vout->i_width             = i_width;
index 992ddf8a7de0ad779c0dd6068f8efff72cf0b01d..9b855153f468ba2516332be9034f279c529d4f60 100644 (file)
@@ -1,6 +1,10 @@
-/*
- *-------------------------------------------------------------------------
- *cxm12161 -- This function performs YUV12-to-RGB16 color conversion for H26x.
+/*******************************************************************************
+ * yuv_mmx.S: YUV transformation, optimized for MMX processors
+ * (c)1999 VideoLAN
+ *******************************************************************************
+ * Following functions are defined:     
+ * vout_YUV420_16_MMX
+ *            This function performs YUV12-to-RGB16 color conversion for H26x.
  *            It handles any format in which there are three fields, the low
  *            order field being B and fully contained in the low order byte, the
  *            second field being G and being somewhere in bits 4 through 11,
@@ -15,7 +19,7 @@
  *            Height may be any amount, but must be a multiple of two.  The U
  *            and V planes may have a different pitch than the Y plane, subject
  *            to the same limitations.
- */
+ *******************************************************************************/
 
 //.include iammx.inc
 //.include locals.inc
@@ -85,9 +89,8 @@ sixbitu:            .quad 0xc0c0c0c0c0c0c0c0
 #define GUpperLimit      140
 #define BUpperLimit      148
 
-
 /*
- * extern void C MMX_YUV12ToRGB16 (
+ * extern void C vout_YUV420_16_MMX (
  *                                     U8* YPlane,
  *                                     U8* UPlane,
  *                                     U8* VPlane,
@@ -113,8 +116,8 @@ sixbitu:            .quad 0xc0c0c0c0c0c0c0c0
  *    RGB655 = 3
  */
 
-.globl yuv_2_rgb
-yuv_2_rgb
+.globl vout_YUV420_16_MMX
+vout_YUV420_16_MMX
   pushl      %esi
   pushl      %edi