Search
lxdream.org :: lxdream/src/video.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/video.h
changeset 106:9048bac046c3
prev103:9b9cfc5855e0
author nkeynes
date Wed Mar 22 14:27:40 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Fix FMOV for writes to the back bank (ie FMOV @R1, XD2)
view annotate diff log raw
     1 /**
     2  * $Id: video.h,v 1.6 2006-03-14 12:45:50 nkeynes Exp $
     3  *
     4  * The PC side of the video support (responsible for actually displaying / 
     5  * rendering frames)
     6  *
     7  * Copyright (c) 2005 Nathan Keynes.
     8  *
     9  * This program is free software; you can redistribute it and/or modify
    10  * it under the terms of the GNU General Public License as published by
    11  * the Free Software Foundation; either version 2 of the License, or
    12  * (at your option) any later version.
    13  *
    14  * This program is distributed in the hope that it will be useful,
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  * GNU General Public License for more details.
    18  */
    20 #ifndef dream_video_H
    21 #define dream_video_H
    23 #include <stdint.h>
    24 #include <glib.h>
    26 #ifdef __cplusplus
    27 extern "C" {
    28 #endif
    30 /**
    31  * Supported colour formats. Note that ARGB4444 is only ever used for texture
    32  * rendering (it's not valid for display purposes).
    33  */
    34 #define COLFMT_RGB565    1
    35 #define COLFMT_RGB888    4
    36 #define COLFMT_ARGB1555  0
    37 #define COLFMT_ARGB8888  5
    38 #define COLFMT_ARGB4444  2
    39 #define COLFMT_YUV422    3 /* 8-bit YUV (texture source only) */
    40 #define COLFMT_INDEX4    6 /* 4 bit indexed colour (texture source only) */
    41 #define COLFMT_INDEX8    7 /* 8-bit indexed colour (texture source only) */
    43 typedef struct video_buffer {
    44     uint32_t hres;
    45     uint32_t vres;
    46     uint32_t rowstride;
    47     int colour_format;
    48     char *data;
    49 } *video_buffer_t;
    51 /**
    52  * Core video driver - expected to directly support an OpenGL context
    53  */
    54 typedef struct video_driver {
    55     char *name;
    56     /**
    57      * Initialize the driver. This is called only once at startup time, and
    58      * is guaranteed to be called before any other methods.
    59      * @return TRUE if the driver was successfully initialized, otherwise
    60      * FALSE.
    61      */
    62     gboolean (*init_driver)(void);
    64     /**
    65      * Cleanly shutdown the driver. Normally only called at system shutdown
    66      * time.
    67      */
    68     void (*shutdown_driver)(void);
    70     /**
    71      * Set the current display format to the specified values. This is
    72      * called immediately prior to any display frame call where the
    73      * parameters have changed from the previous frame
    74      */
    75     gboolean (*set_display_format)( uint32_t hres, uint32_t vres, 
    76 				    int colour_fmt );
    78     /**
    79      * Set the current rendering format to the specified values. This is
    80      * called immediately prior to starting rendering of a frame where the
    81      * parameters have changed from the previous frame. Note that the driver
    82      * is not required to precisely support the requested colour format.
    83      *
    84      * This method is also responsible for setting up an appropriate GL
    85      * context for the main engine to render into.
    86      *
    87      * @param hres The horizontal resolution (ie 640)
    88      * @param vres The vertical resolution (ie 480)
    89      * @param colour_fmt The colour format of the buffer (ie COLFMT_ARGB4444)
    90      * @param texture Flag indicating that the frame being rendered is a
    91      * texture, rather than a display frame. 
    92      */
    93     gboolean (*set_render_format)( uint32_t hres, uint32_t vres,
    94 				   int colour_fmt, gboolean texture );
    95     /**
    96      * Display a single frame using the supplied pixmap data. Is assumed to
    97      * invalidate the current GL front buffer (but not the back buffer).
    98      */
    99     gboolean (*display_frame)( video_buffer_t buffer );
   101     /**
   102      * Display a single blanked frame using a fixed colour for the
   103      * entire frame (specified in RGB888 format). Is assumed to invalidate
   104      * the current GL front buffer (but not the back buffer).
   105      */
   106     gboolean (*display_blank_frame)( uint32_t rgb );
   108     /**
   109      * Promote the current render back buffer to the front buffer
   110      */
   111     void (*display_back_buffer)( void );
   112 } *video_driver_t;
   114 void video_open( void );
   115 void video_update_frame( void );
   116 void video_update_size( int, int, int );
   118 extern uint32_t pvr2_frame_counter;
   120 extern struct video_driver video_gtk_driver;
   121 extern struct video_driver video_null_driver;
   123 #ifdef __cplusplus
   124 }
   125 #endif
   126 #endif
.