/[gxemul]/trunk/src/devices/dev_fb.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_fb.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_fb.c,v 1.118 2006/03/04 12:38:47 debug Exp $   *  $Id: dev_fb.c,v 1.121 2006/07/08 12:30:02 debug Exp $
29   *     *  
30   *  Generic framebuffer device.   *  Generic framebuffer device.
31   *   *
# Line 34  Line 34 
34   *      DECstation Maxine, 1024x768 8-bit color   *      DECstation Maxine, 1024x768 8-bit color
35   *      HPC (mips, arm, ..) framebuffer   *      HPC (mips, arm, ..) framebuffer
36   *      Playstation 2 (24-bit color)   *      Playstation 2 (24-bit color)
37   *      generic (any resolution, several bit depths possible)   *      Generic (any resolution, several bit depths possible, useful for
38     *              testmachines)
39   *   *
40   *   *
41   *  TODO:  This should actually be independent of X11, but that   *  TODO:  This should actually be independent of X11, but that
# Line 62  Line 63 
63  #endif  #endif
64    
65    
66  #define FB_TICK_SHIFT           18  #define FB_TICK_SHIFT           19
67    
68    
69  /*  #define FB_DEBUG  */  /*  #define FB_DEBUG  */
# Line 104  void set_blackwhite_palette(struct vfb_d Line 105  void set_blackwhite_palette(struct vfb_d
105  }  }
106    
107    
108    static void set_title(struct vfb_data *d)
109    {
110            snprintf(d->title, sizeof(d->title),"GXemul: %ix%ix%i %s framebuffer",
111                d->visible_xsize, d->visible_ysize, d->bit_depth, d->name);
112            d->title[sizeof(d->title)-1] = '\0';
113    }
114    
115    
116  /*  /*
117   *  dev_fb_resize():   *  dev_fb_resize():
118   *   *
119   *  Resize a framebuffer window. (This functionality is probably a bit buggy,   *  Resize a framebuffer window. (This functionality is probably a bit buggy,
120   *  because I didn't think of including it from the start.)   *  because I didn't think of including it from the start.)
121     *
122     *  SUPER-IMPORTANT: Anyone who resizes a framebuffer by calling this function
123     *  must also clear all dyntrans address translations manually, in all cpus
124     *  which might have access to the framebuffer!
125   */   */
126  void dev_fb_resize(struct vfb_data *d, int new_xsize, int new_ysize)  void dev_fb_resize(struct vfb_data *d, int new_xsize, int new_ysize)
127  {  {
# Line 121  void dev_fb_resize(struct vfb_data *d, i Line 134  void dev_fb_resize(struct vfb_data *d, i
134                  return;                  return;
135          }          }
136    
137            if (new_xsize < 10 || new_ysize < 10) {
138                    fatal("dev_fb_resize(): size too small.\n");
139                    exit(1);
140            }
141    
142          new_bytes_per_line = new_xsize * d->bit_depth / 8;          new_bytes_per_line = new_xsize * d->bit_depth / 8;
143          size = new_ysize * new_bytes_per_line;          size = new_ysize * new_bytes_per_line;
144    
# Line 163  void dev_fb_resize(struct vfb_data *d, i Line 181  void dev_fb_resize(struct vfb_data *d, i
181          d->x11_xsize = d->xsize / d->vfb_scaledown;          d->x11_xsize = d->xsize / d->vfb_scaledown;
182          d->x11_ysize = d->ysize / d->vfb_scaledown;          d->x11_ysize = d->ysize / d->vfb_scaledown;
183    
184            memory_device_update_data(d->memory, d, d->framebuffer);
185    
186            set_title(d);
187    
188  #ifdef WITH_X11  #ifdef WITH_X11
189          if (d->fb_window != NULL)          if (d->fb_window != NULL) {
190                  x11_fb_resize(d->fb_window, new_xsize, new_ysize);                  x11_fb_resize(d->fb_window, new_xsize, new_ysize);
191                    x11_set_standard_properties(d->fb_window, d->title);
192            }
193  #endif  #endif
194  }  }
195    
# Line 728  struct vfb_data *dev_fb_init(struct mach Line 752  struct vfb_data *dev_fb_init(struct mach
752          size_t size, nlen;          size_t size, nlen;
753          int flags;          int flags;
754          int reverse_start = 0;          int reverse_start = 0;
         char title[400];  
755          char *name2;          char *name2;
756    
757          d = malloc(sizeof(struct vfb_data));          d = malloc(sizeof(struct vfb_data));
# Line 743  struct vfb_data *dev_fb_init(struct mach Line 766  struct vfb_data *dev_fb_init(struct mach
766                  reverse_start = 1;                  reverse_start = 1;
767          }          }
768    
769            d->memory = mem;
770          d->vfb_type = vfb_type;          d->vfb_type = vfb_type;
771    
772          /*  Defaults:  */          /*  Defaults:  */
# Line 821  struct vfb_data *dev_fb_init(struct mach Line 845  struct vfb_data *dev_fb_init(struct mach
845                  d->update_x2 = d->update_y2 = -1;                  d->update_x2 = d->update_y2 = -1;
846          }          }
847    
848          /*  Don't set the title to include the size of the framebuffer for          d->name = strdup(name);
849              VGA, since then the resolution might change during runtime.  */          set_title(d);
         if (strcmp(name, "VGA") == 0)  
                 snprintf(title, sizeof(title),"GXemul: %s framebuffer", name);  
         else  
                 snprintf(title, sizeof(title),"GXemul: %ix%ix%i %s framebuffer",  
                     d->visible_xsize, d->visible_ysize, d->bit_depth, name);  
         title[sizeof(title)-1] = '\0';  
850    
851  #ifdef WITH_X11  #ifdef WITH_X11
852          if (machine->use_x11) {          if (machine->use_x11) {
853                  int i = 0;                  int i = 0;
854                  d->fb_window = x11_fb_init(d->x11_xsize, d->x11_ysize,                  d->fb_window = x11_fb_init(d->x11_xsize, d->x11_ysize,
855                      title, machine->x11_scaledown, machine);                      d->title, machine->x11_scaledown, machine);
856                  switch (d->fb_window->x11_screen_depth) {                  switch (d->fb_window->x11_screen_depth) {
857                  case 15: i = 2; break;                  case 15: i = 2; break;
858                  case 16: i = 4; break;                  case 16: i = 4; break;

Legend:
Removed from v.24  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26