diff --git a/src/86box.c b/src/86box.c index 2c29b69ea..322f674f1 100644 --- a/src/86box.c +++ b/src/86box.c @@ -892,10 +892,9 @@ pc_init_modules(void) } if (!video_card_available(gfxcard_2)) { - char temp[1024] = { 0 }; - char tempc[1024] = { 0 }; + char tempc[512] = { 0 }; device_get_name(video_card_getdevice(gfxcard_2), 0, tempc); - snprintf(temp, sizeof(temp), "Video card #2 \"%s\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card.", tempc); + swprintf(temp, sizeof(temp), (wchar_t *) "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card.", tempc); ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2128, temp); gfxcard_2 = 0; } diff --git a/src/cdrom/cdrom_image_viso.c b/src/cdrom/cdrom_image_viso.c index 9cac65b70..3017857e8 100644 --- a/src/cdrom/cdrom_image_viso.c +++ b/src/cdrom/cdrom_image_viso.c @@ -13,8 +13,12 @@ * Copyright 2022 RichardG. */ // clang-format off +#ifndef _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE +#endif +#ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE +#endif #define __STDC_FORMAT_MACROS #include #include diff --git a/src/cdrom/cdrom_mitsumi.c b/src/cdrom/cdrom_mitsumi.c index 3ade6586c..e0a1e0405 100644 --- a/src/cdrom/cdrom_mitsumi.c +++ b/src/cdrom/cdrom_mitsumi.c @@ -183,7 +183,7 @@ mitsumi_cdrom_read_sector(mcd_t *dev, int first) return 0; } cdrom_stop(cdrom); - ret = cdrom_readsector_raw(cdrom, dev->buf, cdrom->seek_pos, 0, 2, 0x10, &dev->readcount); + ret = cdrom_readsector_raw(cdrom, dev->buf, cdrom->seek_pos, 0, 2, 0x10, (int *) &dev->readcount); if (!ret) return 0; if (dev->mode & 0x40) { diff --git a/src/config.c b/src/config.c index e433e4071..63b1c6805 100644 --- a/src/config.c +++ b/src/config.c @@ -713,7 +713,7 @@ load_network(void) ini_section_t cat = ini_find_section(config, "Network"); char *p; char temp[512]; - int c = 0, min = 0; + uint16_t c = 0, min = 0; /* Handle legacy configuration which supported only one NIC */ p = ini_section_get_string(cat, "net_card", NULL); diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index a488d8aa2..13a36355e 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -2090,18 +2090,27 @@ ide_board_callback(void *priv) #endif dev->ide[0]->atastat = DRDY_STAT | DSC_STAT; - if (dev->ide[0]->type == IDE_ATAPI) - dev->ide[0]->sc->status = DRDY_STAT | DSC_STAT; + if (dev->ide[0]->type == IDE_ATAPI) { + if (dev->ide[0]->sc->pad0) + dev->ide[0]->sc->status = DRDY_STAT | DSC_STAT; + else + dev->ide[0]->sc->status = 0; + } dev->ide[1]->atastat = DRDY_STAT | DSC_STAT; - if (dev->ide[1]->type == IDE_ATAPI) - dev->ide[1]->sc->status = DRDY_STAT | DSC_STAT; + if (dev->ide[1]->type == IDE_ATAPI) { + if (dev->ide[1]->sc->pad0) + dev->ide[1]->sc->status = DRDY_STAT | DSC_STAT; + else + dev->ide[1]->sc->status = 0; + } dev->cur_dev &= ~1; if (dev->diag) { dev->diag = 0; - ide_irq_raise(dev->ide[0]); + if ((dev->ide[0]->type != IDE_ATAPI) || dev->ide[0]->sc->pad0) + ide_irq_raise(dev->ide[0]); } } diff --git a/src/include/86box/ini.h b/src/include/86box/ini.h index 43b71f357..3ed0b1970 100644 --- a/src/include/86box/ini.h +++ b/src/include/86box/ini.h @@ -48,7 +48,7 @@ extern void ini_section_set_double(ini_section_t section, char *name, double extern void ini_section_set_hex16(ini_section_t section, char *name, int val); extern void ini_section_set_hex20(ini_section_t section, char *name, int val); extern void ini_section_set_mac(ini_section_t section, char *name, int val); -extern void ini_section_set_string(ini_section_t section, char *name, char *val); +extern void ini_section_set_string(ini_section_t section, const char *name, const char *val); extern void ini_section_set_wstring(ini_section_t section, char *name, wchar_t *val); #define ini_delete_var(ini, head, name) ini_section_delete_var(ini_find_section(ini, head), name) diff --git a/src/include/86box/network.h b/src/include/86box/network.h index 292c863fa..0a396968f 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -89,14 +89,14 @@ enum { }; typedef struct { - int device_num; + uint16_t device_num; int net_type; char host_dev_name[128]; uint32_t link_state; } netcard_conf_t; extern netcard_conf_t net_cards_conf[NET_CARD_MAX]; -extern int net_card_current; +extern uint16_t net_card_current; typedef int (*NETRXCB)(void *, uint8_t *, int); typedef int (*NETSETLINKSTATE)(void *, uint32_t link_state); @@ -135,7 +135,7 @@ struct _netcard_t { mutex_t *tx_mutex; mutex_t *rx_mutex; pc_timer_t timer; - int card_num; + uint16_t card_num; double byte_period; uint32_t led_timer; uint32_t led_state; diff --git a/src/include/86box/vid_voodoo_common.h b/src/include/86box/vid_voodoo_common.h index e61a70836..ab55cc9f4 100644 --- a/src/include/86box/vid_voodoo_common.h +++ b/src/include/86box/vid_voodoo_common.h @@ -320,6 +320,8 @@ typedef struct voodoo_t { uint32_t cmdfifo_amin, cmdfifo_amax; int cmdfifo_holecount; + atomic_uint cmd_status; + uint32_t sSetupMode; vert_t verts[4]; unsigned int vertex_ages[3]; diff --git a/src/ini.c b/src/ini.c index 923d50ca9..253def866 100644 --- a/src/ini.c +++ b/src/ini.c @@ -141,7 +141,7 @@ ini_rename_section(ini_section_t section, char *name) } static entry_t * -find_entry(section_t *section, char *name) +find_entry(section_t *section, const char *name) { entry_t *ent; @@ -222,7 +222,7 @@ ini_find_or_create_section(ini_t ini, char *name) } static entry_t * -create_entry(section_t *section, char *name) +create_entry(section_t *section, const char *name) { entry_t *ne = malloc(sizeof(entry_t)); @@ -750,7 +750,7 @@ ini_section_set_mac(ini_section_t self, char *name, int val) } void -ini_section_set_string(ini_section_t self, char *name, char *val) +ini_section_set_string(ini_section_t self, const char *name, const char *val) { section_t *section = (section_t *) self; entry_t *ent; diff --git a/src/network/net_slirp.c b/src/network/net_slirp.c index 89c658e64..ebdc4ec26 100644 --- a/src/network/net_slirp.c +++ b/src/network/net_slirp.c @@ -26,7 +26,6 @@ #include #include #include -#include #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/device.h> @@ -38,6 +37,10 @@ #include <86box/ini.h> #include <86box/config.h> #include <86box/video.h> + +# define _SSIZE_T_DEFINED +#include + #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include @@ -414,7 +417,7 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, void *priv) /* Set up port forwarding. */ int udp, external, internal, i = 0; char category[32]; - snprintf(category, sizeof(category), "SLiRP Port Forwarding #%i", card->card_num + 1); + snprintf(category, sizeof(category), "SLiRP Port Forwarding #%d", card->card_num + 1); char key[20]; while (1) { sprintf(key, "%d_protocol", i); diff --git a/src/network/network.c b/src/network/network.c index 9b4c9e4b9..38c480b6c 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -118,7 +118,7 @@ static const device_t *net_cards[] = { }; netcard_conf_t net_cards_conf[NET_CARD_MAX]; -int net_card_current = 0; +uint16_t net_card_current = 0; /* Global variables. */ int network_ndev; diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index 560249660..159c33b39 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -511,6 +511,7 @@ void MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) { QString menu_item_name = fi.fileName().isEmpty() ? tr("previous image").toUtf8().constData() : fi.fileName().toUtf8().constData(); imageHistoryUpdatePos->setText(QString::asprintf(tr("%s").toUtf8().constData(), menu_item_name.toUtf8().constData())); imageHistoryUpdatePos->setVisible(!fi.fileName().isEmpty()); + imageHistoryUpdatePos->setVisible(fi.exists()); } void MediaMenu::clearImageHistory() { diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index bee60bb5f..2a1e63c98 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -518,18 +518,29 @@ scsi_cdrom_mode_sense(scsi_cdrom_t *dev, uint8_t *buf, uint32_t pos, uint8_t pag buf[pos++] = msplen; scsi_cdrom_log("CD-ROM %i: MODE SENSE: Page [%02X] length %i\n", dev->id, i, msplen); for (j = 0; j < msplen; j++) { - if ((i == GPMODE_CAPABILITIES_PAGE) && (j >= 6) && (j <= 7)) { - if (j & 1) - buf[pos++] = ((dev->drv->speed * 176) & 0xff); - else - buf[pos++] = ((dev->drv->speed * 176) >> 8); - } else if ((i == GPMODE_CAPABILITIES_PAGE) && (j >= 12) && (j <= 13)) { - if (j & 1) - buf[pos++] = ((dev->drv->cur_speed * 176) & 0xff); - else - buf[pos++] = ((dev->drv->cur_speed * 176) >> 8); - } else + /* If we are returning changeable values, always return them from the page, + so they are all correctly. */ + if (page_control == 1) buf[pos++] = scsi_cdrom_mode_sense_read(dev, page_control, i, 2 + j); + else { + if ((i == GPMODE_CAPABILITIES_PAGE) && (j == 4)) { + buf[pos] = scsi_cdrom_mode_sense_read(dev, page_control, i, 2 + j) & 0x1f; + /* The early CD-ROM drives we emulate (NEC CDR-260 for ATAPI and Toshiba CDS-431) are + caddy drives, the later ones are tray drives. */ + buf[pos++] |= (dev->early ? 0x00 : 0x20); + } else if ((i == GPMODE_CAPABILITIES_PAGE) && (j >= 6) && (j <= 7)) { + if (j & 1) + buf[pos++] = ((dev->drv->speed * 176) & 0xff); + else + buf[pos++] = ((dev->drv->speed * 176) >> 8); + } else if ((i == GPMODE_CAPABILITIES_PAGE) && (j >= 12) && (j <= 13)) { + if (j & 1) + buf[pos++] = ((dev->drv->cur_speed * 176) & 0xff); + else + buf[pos++] = ((dev->drv->cur_speed * 176) >> 8); + } else + buf[pos++] = scsi_cdrom_mode_sense_read(dev, page_control, i, 2 + j); + } } } } diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index 930468fbf..9fd02cdd3 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -726,7 +726,7 @@ et4000_init(const device_t *info) et4000_kasan_recalctimings, et4000_in, et4000_out, NULL, NULL); io_sethandler(0x03c0, 32, - et4000_in, NULL, NULL, et4000_out, NULL, NULL, dev); + et4000k_in, NULL, NULL, et4000k_out, NULL, NULL, dev); io_sethandler(0x0250, 8, et4000_kasan_in, NULL, NULL, et4000_kasan_out, NULL, NULL, dev); io_sethandler(0x0258, 2, diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index e542ddd91..6d00125f5 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -20,11 +20,13 @@ * Copyright 2016-2019 Miran Grca. */ #include +#include #include #include -#include #include +#include #include +#define HAVE_STDARG_H #include <86box/86box.h> #include "cpu.h" #include <86box/device.h> @@ -54,6 +56,24 @@ uint8_t svga_rotate[8][256]; static svga_t *svga_pri; int vga_on, ibm8514_on; +#ifdef ENABLE_SVGA_LOG +int svga_do_log = ENABLE_SVGA_LOG; + +static void +svga_log(const char *fmt, ...) +{ + va_list ap; + + if (svga_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +# define svga_log(fmt, ...) +#endif + svga_t * svga_get_pri() @@ -235,7 +255,7 @@ svga_out(uint16_t addr, uint8_t val, void *p) break; case 6: if ((svga->gdcreg[6] & 0xc) != (val & 0xc)) { - switch (val & 0xC) { + switch (val & 0xc) { case 0x0: /*128k at A0000*/ mem_mapping_set_addr(&svga->mapping, 0xa0000, 0x20000); svga->banked_mask = 0xffff; @@ -363,7 +383,9 @@ svga_in(uint16_t addr, void *p) svga->cgastat &= ~0x30; else svga->cgastat ^= 0x30; + ret = svga->cgastat; + break; } @@ -453,7 +475,7 @@ svga_recalctimings(svga_t *svga) svga->render = svga_render_blank; if (!svga->scrblank && (svga->crtc[0x17] & 0x80) && svga->attr_palette_enable) { if (!(svga->gdcreg[6] & 1) && !(svga->attrregs[0x10] & 1)) { /*Text mode*/ - if (svga->seqregs[1] & 8) /*40 column*/ { + if (svga->seqregs[1] & 8) { /*40 column*/ svga->render = svga_render_text_40; svga->hdisp *= (svga->seqregs[1] & 1) ? 16 : 18; /* Character clock is off by 1 now in 40-line modes, on all cards. */ diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index 6775864fa..cb4d2b18e 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -178,6 +178,7 @@ enum { cmdRdPtrH0 = 0x30, cmdAMin0 = 0x34, cmdAMax0 = 0x3c, + cmdStatus0 = 0x40, cmdFifoDepth0 = 0x44, cmdHoleCnt0 = 0x48, @@ -1170,6 +1171,10 @@ banshee_cmd_read(banshee_t *banshee, uint32_t addr) // banshee_log("Read cmdfifo_depth %08x\n", ret); break; + case cmdStatus0: + ret = voodoo->cmd_status; + break; + case 0x108: break; @@ -2981,6 +2986,7 @@ banshee_init_common(const device_t *info, char *fn, int has_sgram, int type, int banshee->voodoo->tex_mem[1] = banshee->svga.vram; banshee->voodoo->tex_mem_w[1] = (uint16_t *) banshee->svga.vram; banshee->voodoo->texture_mask = banshee->svga.vram_mask; + banshee->voodoo->cmd_status = (1 << 28); voodoo_generate_filter_v1(banshee->voodoo); banshee->vidSerialParallelPort = VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W; diff --git a/src/video/vid_voodoo_banshee_blitter.c b/src/video/vid_voodoo_banshee_blitter.c index 8a9b24337..ef3b3bc1b 100644 --- a/src/video/vid_voodoo_banshee_blitter.c +++ b/src/video/vid_voodoo_banshee_blitter.c @@ -1,6 +1,6 @@ /*Current issues : - missing screen->screen scaled blits with format conversion - - missing YUV blits + - missing YUV blits (YUV -> 32-bit, 24-bit, or 16-bit RGB now done) - missing linestyle - missing wait for vsync - missing reversible lines @@ -109,7 +109,7 @@ bansheeblt_log(const char *fmt, ...) } } #else -# define banshee_log(fmt, ...) +# define bansheeblt_log(fmt, ...) #endif static int @@ -303,6 +303,7 @@ update_src_stride(voodoo_t *voodoo) bpp = 24; break; case SRC_FORMAT_COL_32_BPP: + case SRC_FORMAT_COL_YUYV: bpp = 32; break; @@ -399,6 +400,86 @@ banshee_do_rectfill(voodoo_t *voodoo) end_command(voodoo); } +void DECODE_YUYV422(uint32_t *buf, uint8_t *src) +{ + do { + int wp = 0; + + uint8_t y1, y2; + int8_t Cr, Cb; + int dR, dG, dB; + int r, g, b; + + y1 = src[0]; + Cr = src[1] - 0x80; + y2 = src[2]; + Cb = src[3] - 0x80; + + dR = (359 * Cr) >> 8; + dG = (88 * Cb + 183 * Cr) >> 8; + dB = (453 * Cb) >> 8; + + r = y1 + dR; + r = CLAMP(r); + g = y1 - dG; + g = CLAMP(g); + b = y1 + dB; + b = CLAMP(b); + buf[wp++] = r | (g << 8) | (b << 16); + + r = y2 + dR; + r = CLAMP(r); + g = y2 - dG; + g = CLAMP(g); + b = y2 + dB; + b = CLAMP(b); + buf[wp++] = r | (g << 8) | (b << 16); + } while (0); +} + +void DECODE_YUYV422_16BPP(uint16_t *buf, uint8_t *src) +{ + do { + int wp = 0; + + uint8_t y1, y2; + int8_t Cr, Cb; + int dR, dG, dB; + int r, g, b; + + y1 = src[0]; + Cr = src[1] - 0x80; + y2 = src[2]; + Cb = src[3] - 0x80; + + dR = (359 * Cr) >> 8; + dG = (88 * Cb + 183 * Cr) >> 8; + dB = (453 * Cb) >> 8; + + r = y1 + dR; + r = CLAMP(r); + r >>= 3; + g = y1 - dG; + g = CLAMP(g); + g >>= 2; + b = y1 + dB; + b = CLAMP(b); + b >>= 3; + buf[wp++] = r | (g << 5) | (b << 11); + + r = y2 + dR; + r = CLAMP(r); + r >>= 3; + g = y2 - dG; + g = CLAMP(g); + g >>= 2; + b = y2 + dB; + b = CLAMP(b); + b >>= 3; + buf[wp++] = r | (g << 5) | (b << 11); + } while (0); +} + static void do_screen_to_screen_line(voodoo_t *voodoo, uint8_t *src_p, int use_x_dir, int src_x, int src_tiled) { @@ -513,8 +594,9 @@ do_screen_to_screen_line(voodoo_t *voodoo, uint8_t *src_p, int use_x_dir, int sr src_x_real = (src_x_real & 127) + ((src_x_real >> 7) * 128 * 32); if (dst_x >= clip->x_min && dst_x < clip->x_max && pattern_trans) { - uint32_t src_data = 0; - int transparent = 0; + uint32_t src_data = 0; + uint32_t src_data_yuv = 0; /* Used in YUYV-to-RGB convesions. */ + int transparent = 0; switch (voodoo->banshee_blt.srcFormat & SRC_FORMAT_COL_MASK) { case SRC_FORMAT_COL_1_BPP: @@ -554,6 +636,11 @@ do_screen_to_screen_line(voodoo_t *voodoo, uint8_t *src_p, int use_x_dir, int sr src_data = *(uint32_t *) &src_p[src_x_real]; break; } + case SRC_FORMAT_COL_YUYV: + { + src_data_yuv = *(uint32_t *) &src_p[src_x_real]; + break; + } default: fatal("banshee_do_screen_to_screen_blt: unknown srcFormat %08x\n", voodoo->banshee_blt.srcFormat); @@ -567,9 +654,54 @@ do_screen_to_screen_line(voodoo_t *voodoo, uint8_t *src_p, int use_x_dir, int sr src_data = (b >> 3) | ((g >> 2) << 5) | ((r >> 3) << 11); } - if (!transparent) - PLOT(voodoo, dst_x, dst_y, pat_x, pat_y, pattern_mask, rop, src_data, src_colorkey); + if ((voodoo->banshee_blt.srcFormat & SRC_FORMAT_COL_MASK) == SRC_FORMAT_COL_YUYV) { + if (((voodoo->banshee_blt.dstFormat & DST_FORMAT_COL_MASK) == DST_FORMAT_COL_24_BPP) || + ((voodoo->banshee_blt.dstFormat & DST_FORMAT_COL_MASK) == DST_FORMAT_COL_32_BPP)) { + uint32_t rgbcol[2] = { 0, 0 }; + DECODE_YUYV422(rgbcol, (uint8_t *) &src_data_yuv); + + bansheeblt_log("YUV -> 24 bpp or 32 bpp\n"); + + if (!transparent) { + PLOT(voodoo, dst_x, dst_y, pat_x, pat_y, pattern_mask, rop, rgbcol[0], src_colorkey); + } + + if (use_x_dir) { + dst_x += (voodoo->banshee_blt.command & COMMAND_DX) ? -1 : 1; + } else { + dst_x++; + } + + if (!transparent) { + PLOT(voodoo, dst_x, dst_y, pat_x, pat_y, pattern_mask, rop, rgbcol[1], src_colorkey); + } + } else if ((voodoo->banshee_blt.dstFormat & DST_FORMAT_COL_MASK) == DST_FORMAT_COL_16_BPP) { + uint32_t rgbcol = 0; + DECODE_YUYV422_16BPP((uint16_t *) &rgbcol, (uint8_t *) &src_data_yuv); + + bansheeblt_log("YUV -> 16 bpp\n"); + + if (!transparent) { + PLOT(voodoo, dst_x, dst_y, pat_x, pat_y, pattern_mask, rop, rgbcol & 0xffff, src_colorkey); + } + + if (use_x_dir) { + dst_x += (voodoo->banshee_blt.command & COMMAND_DX) ? -1 : 1; + } else { + dst_x++; + } + + if (!transparent) { + PLOT(voodoo, dst_x, dst_y, pat_x, pat_y, pattern_mask, rop, rgbcol >> 16, src_colorkey); + } + } else + fatal("banshee_do_screen_to_screen_blt: unknown dstFormat %08x\n", voodoo->banshee_blt.dstFormat); + } else { + if (!transparent) + PLOT(voodoo, dst_x, dst_y, pat_x, pat_y, pattern_mask, rop, src_data, src_colorkey); + } } + if (use_x_dir) { src_x += (voodoo->banshee_blt.command & COMMAND_DX) ? -1 : 1; dst_x += (voodoo->banshee_blt.command & COMMAND_DX) ? -1 : 1; @@ -1183,6 +1315,7 @@ voodoo_2d_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val) voodoo->banshee_blt.src_bpp = 24; break; case SRC_FORMAT_COL_32_BPP: + case SRC_FORMAT_COL_YUYV: voodoo->banshee_blt.src_bpp = 32; break; case SRC_FORMAT_COL_16_BPP: diff --git a/src/video/vid_voodoo_fifo.c b/src/video/vid_voodoo_fifo.c index 65b8017a6..8dd8fb594 100644 --- a/src/video/vid_voodoo_fifo.c +++ b/src/video/vid_voodoo_fifo.c @@ -106,6 +106,7 @@ voodoo_queue_command(voodoo_t *voodoo, uint32_t addr_type, uint32_t val) fifo->addr_type = addr_type; voodoo->fifo_write_idx++; + voodoo->cmd_status &= ~(1 << 24); if (FIFO_ENTRIES > 0xe000) voodoo_wake_fifo_thread(voodoo); @@ -283,6 +284,8 @@ voodoo_fifo_thread(void *param) voodoo->time += end_time - start_time; } + voodoo->cmd_status |= (1 << 24); + while (voodoo->cmdfifo_enabled && (voodoo->cmdfifo_depth_rd != voodoo->cmdfifo_depth_wr || voodoo->cmdfifo_in_sub)) { uint64_t start_time = plat_timer_read(); uint64_t end_time; @@ -296,9 +299,13 @@ voodoo_fifo_thread(void *param) // voodoo_fifo_log(" CMDFIFO header %08x at %08x\n", header, voodoo->cmdfifo_rp); + voodoo->cmd_status &= ~7; + voodoo->cmd_status |= (header & 7); + voodoo->cmd_status |= (1 << 11); switch (header & 7) { case 0: // voodoo_fifo_log("CMDFIFO0\n"); + voodoo->cmd_status = (voodoo->cmd_status & 0xffff8fff) | (((header >> 3) & 7) << 12); switch ((header >> 3) & 7) { case 0: /*NOP*/ break; @@ -323,6 +330,7 @@ voodoo_fifo_thread(void *param) default: fatal("Bad CMDFIFO0 %08x\n", header); } + voodoo->cmd_status = (voodoo->cmd_status & ~(1 << 27)) | (voodoo->cmdfifo_in_sub << 27); break; case 1: diff --git a/src/video/vid_xga.c b/src/video/vid_xga.c index cbec48739..fbb776d1d 100644 --- a/src/video/vid_xga.c +++ b/src/video/vid_xga.c @@ -2663,7 +2663,6 @@ static void svga_t *svga = svga_get_pri(); xga_t *xga = &svga->xga; FILE *f; - uint32_t temp; uint32_t initial_bios_addr = device_get_config_hex20("init_bios_addr"); uint8_t *rom = NULL; @@ -2683,13 +2682,11 @@ static void f = rom_fopen(xga->type ? XGA2_BIOS_PATH : XGA_BIOS_PATH, "rb"); (void) fseek(f, 0L, SEEK_END); - temp = ftell(f); (void) fseek(f, 0L, SEEK_SET); rom = malloc(xga->bios_rom.sz); memset(rom, 0xff, xga->bios_rom.sz); (void) !fread(rom, xga->bios_rom.sz, 1, f); - temp -= xga->bios_rom.sz; (void) fclose(f); xga->bios_rom.rom = rom;