]> xenbits.xensource.com Git - seabios.git/commitdiff
vgasrc: Rename vgahw_get_linesize() to vgahw_minimum_linelength()
authorKevin O'Connor <kevin@koconnor.net>
Fri, 15 Mar 2024 23:50:29 +0000 (19:50 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 15 Mar 2024 23:50:29 +0000 (19:50 -0400)
Make the relationship between vgahw_get_linelength() and
vgahw_get_linesize() more clear by renaming it to
vgahw_minimum_linelength().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
vgasrc/cbvga.c
vgasrc/stdvga.c
vgasrc/stdvga.h
vgasrc/vbe.c
vgasrc/vgahw.h
vgasrc/vgautil.h

index 9e3cc9315264ded08aaff818d7981366ad816a88..243e6be9459b4c535d7ddce330143bf67a2bd2ba 100644 (file)
@@ -81,6 +81,13 @@ cbvga_set_window(struct vgamode_s *curmode_g, int window, int val)
     return -1;
 }
 
+int
+cbvga_minimum_linelength(struct vgamode_s *vmode_g)
+{
+    /* Can't change mode, always report active pitch. */
+    return GET_GLOBAL(CBlinelength);
+}
+
 int
 cbvga_get_linelength(struct vgamode_s *curmode_g)
 {
@@ -156,13 +163,6 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags)
     return 0;
 }
 
-int
-cbvga_get_linesize(struct vgamode_s *vmode_g)
-{
-    /* Can't change mode, always report active pitch. */
-    return GET_GLOBAL(CBlinelength);
-}
-
 #define CB_TAG_FRAMEBUFFER      0x0012
 struct cb_framebuffer {
     u32 tag;
index 9d8f556f0bae4fd5861454900cb7fbe8ff3906f8..da67af41af595be55b884087e217b3cd2ef2c0c0 100644 (file)
@@ -275,6 +275,14 @@ stdvga_set_window(struct vgamode_s *curmode_g, int window, int val)
     return -1;
 }
 
+// Minimum framebuffer bytes between each vertical line for given mode
+int
+stdvga_minimum_linelength(struct vgamode_s *vmode_g)
+{
+    return DIV_ROUND_UP(GET_GLOBAL(vmode_g->width) * vga_bpp(vmode_g), 8);
+}
+
+// Return number of framebuffer bytes between start of each vertical line
 int
 stdvga_get_linelength(struct vgamode_s *curmode_g)
 {
@@ -282,6 +290,7 @@ stdvga_get_linelength(struct vgamode_s *curmode_g)
     return val * 8 / stdvga_vram_ratio(curmode_g);
 }
 
+// Set number of framebuffer bytes between start of each vertical line
 int
 stdvga_set_linelength(struct vgamode_s *curmode_g, int val)
 {
@@ -290,6 +299,7 @@ stdvga_set_linelength(struct vgamode_s *curmode_g, int val)
     return 0;
 }
 
+// Return framebuffer offset of first byte of displayed content
 int
 stdvga_get_displaystart(struct vgamode_s *curmode_g)
 {
@@ -299,6 +309,7 @@ stdvga_get_displaystart(struct vgamode_s *curmode_g)
     return addr * 4 / stdvga_vram_ratio(curmode_g);
 }
 
+// Set framebuffer offset of first byte of displayed content
 int
 stdvga_set_displaystart(struct vgamode_s *curmode_g, int val)
 {
@@ -321,11 +332,6 @@ stdvga_set_dacformat(struct vgamode_s *curmode_g, int val)
     return -1;
 }
 
-int
-stdvga_get_linesize(struct vgamode_s *vmode_g)
-{
-    return DIV_ROUND_UP(GET_GLOBAL(vmode_g->width) * vga_bpp(vmode_g), 8);
-}
 
 /****************************************************************
  * Save/Restore state
index 5164ca1b0274fe8aa98b7d812e92ac1ba3c41e01..ce797836cabaebed5e39acef93588202dc591fbe 100644 (file)
@@ -68,6 +68,7 @@ void stdvga_set_scan_lines(u8 lines);
 u16 stdvga_get_vde(void);
 int stdvga_get_window(struct vgamode_s *curmode_g, int window);
 int stdvga_set_window(struct vgamode_s *curmode_g, int window, int val);
+int stdvga_minimum_linelength(struct vgamode_s *vmode_g);
 int stdvga_get_linelength(struct vgamode_s *curmode_g);
 int stdvga_set_linelength(struct vgamode_s *curmode_g, int val);
 int stdvga_get_displaystart(struct vgamode_s *curmode_g);
index 3efb54f5096a720fd82dbe68ddb119a6e931ce17..d2aaace0f7d1485369456360deefc2f254b0ce13 100644 (file)
@@ -110,7 +110,7 @@ vbe_104f01(struct bregs *regs)
     // Basic information about mode.
     int width = GET_GLOBAL(vmode_g->width);
     int height = GET_GLOBAL(vmode_g->height);
-    int linesize = vgahw_get_linesize(vmode_g);
+    int linesize = vgahw_minimum_linelength(vmode_g);
     SET_FARVAR(seg, info->bytes_per_scanline, linesize);
     SET_FARVAR(seg, info->xres, width);
     SET_FARVAR(seg, info->yres, height);
index bd33e208df2abba26a1895cffd8c5be5bc77cb8c..a6ddaa95c0195b8bea064d6074025b56a72dda35 100644 (file)
@@ -95,6 +95,12 @@ static inline int vgahw_get_linelength(struct vgamode_s *curmode_g) {
     return stdvga_get_linelength(curmode_g);
 }
 
+static inline int vgahw_minimum_linelength(struct vgamode_s *vmode_g) {
+    if (CONFIG_VGA_EMULATE_TEXT)
+        return cbvga_minimum_linelength(vmode_g);
+    return stdvga_minimum_linelength(vmode_g);
+}
+
 static inline int vgahw_set_linelength(struct vgamode_s *curmode_g, int val) {
     if (CONFIG_VGA_CIRRUS)
         return clext_set_linelength(curmode_g, val);
@@ -151,10 +157,4 @@ static inline int vgahw_save_restore(int cmd, u16 seg, void *data) {
     return stdvga_save_restore(cmd, seg, data);
 }
 
-static inline int vgahw_get_linesize(struct vgamode_s *vmode_g) {
-    if (CONFIG_VGA_EMULATE_TEXT)
-        return cbvga_get_linesize(vmode_g);
-    return stdvga_get_linesize(vmode_g);
-}
-
 #endif // vgahw.h
index 245a562f274ce22eb730f88ff7b8a546c17e0ce7..ce307c9329a754a0bef53c9a474b3b77e282e36f 100644 (file)
@@ -9,6 +9,7 @@ struct vgamode_s *cbvga_find_mode(int mode);
 void cbvga_list_modes(u16 seg, u16 *dest, u16 *last);
 int cbvga_get_window(struct vgamode_s *curmode_g, int window);
 int cbvga_set_window(struct vgamode_s *curmode_g, int window, int val);
+int cbvga_minimum_linelength(struct vgamode_s *vmode_g);
 int cbvga_get_linelength(struct vgamode_s *curmode_g);
 int cbvga_set_linelength(struct vgamode_s *curmode_g, int val);
 int cbvga_get_displaystart(struct vgamode_s *curmode_g);
@@ -17,7 +18,6 @@ int cbvga_get_dacformat(struct vgamode_s *curmode_g);
 int cbvga_set_dacformat(struct vgamode_s *curmode_g, int val);
 int cbvga_save_restore(int cmd, u16 seg, void *data);
 int cbvga_set_mode(struct vgamode_s *vmode_g, int flags);
-int cbvga_get_linesize(struct vgamode_s *vmode_g);
 void cbvga_setup_modes(u64 addr, u8 bpp, u32 xlines, u32 ylines, u32 linelength);
 int cbvga_setup(void);
 
@@ -77,7 +77,6 @@ void stdvga_list_modes(u16 seg, u16 *dest, u16 *last);
 void stdvga_build_video_param(void);
 void stdvga_override_crtc(int mode, u8 *crtc);
 int stdvga_set_mode(struct vgamode_s *vmode_g, int flags);
-int stdvga_get_linesize(struct vgamode_s *vmode_g);
 void stdvga_set_packed_palette(void);
 
 // swcursor.c