Merge branch 'master' of https://github.com/86Box/86Box into qt-opengl-renderer
This commit is contained in:
@@ -158,7 +158,8 @@ typedef struct svga_t
|
|||||||
|
|
||||||
/*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/
|
/*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/
|
||||||
int force_dword_mode;
|
int force_dword_mode;
|
||||||
int force_byte_mode;
|
|
||||||
|
int force_old_addr;
|
||||||
|
|
||||||
int remap_required;
|
int remap_required;
|
||||||
uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr);
|
uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -37,7 +37,14 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="RendererStack" name="stackedWidget"/>
|
<widget class="RendererStack" name="stackedWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -169,10 +169,10 @@ OpenGLOptions::addShader(const QString &path)
|
|||||||
.toStdString());
|
.toStdString());
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version_line % "\n#define VERTEX\n" % shader_text))
|
if (!shader->addShaderFromSourceCode(QOpenGLShader::Vertex, version_line % "\n#extension GL_ARB_shading_language_420pack : enable\n" % "\n#define VERTEX\n" % shader_text))
|
||||||
throw_shader_error(tr("Error compiling vertex shader in file \"%1\""));
|
throw_shader_error(tr("Error compiling vertex shader in file \"%1\""));
|
||||||
|
|
||||||
if (!shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version_line % "\n#define FRAGMENT\n" % shader_text))
|
if (!shader->addShaderFromSourceCode(QOpenGLShader::Fragment, version_line % "\n#extension GL_ARB_shading_language_420pack : enable\n" "\n#define FRAGMENT\n" % shader_text))
|
||||||
throw_shader_error(tr("Error compiling fragment shader in file \"%1\""));
|
throw_shader_error(tr("Error compiling fragment shader in file \"%1\""));
|
||||||
|
|
||||||
if (!shader->link())
|
if (!shader->link())
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
#include <QOpenGLTexture>
|
#include <QOpenGLTexture>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
|
#include <QOpenGLTexture>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@@ -89,8 +90,8 @@ OpenGLRenderer::resizeEvent(QResizeEvent *event)
|
|||||||
glViewport(
|
glViewport(
|
||||||
destination.x(),
|
destination.x(),
|
||||||
destination.y(),
|
destination.y(),
|
||||||
destination.width(),
|
destination.width() * devicePixelRatio(),
|
||||||
destination.height());
|
destination.height() * devicePixelRatio());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -374,7 +375,7 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h)
|
|||||||
|
|
||||||
/* Resize the texture */
|
/* Resize the texture */
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, QOpenGLTexture::RGBA8_UNorm, source.width(), source.height(), 0, QOpenGLTexture::BGRA, QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, (GLenum)QOpenGLTexture::RGBA8_UNorm, source.width(), source.height(), 0, (GLenum)QOpenGLTexture::BGRA, (GLenum)QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, unpackBufferID);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, unpackBufferID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +384,7 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h)
|
|||||||
|
|
||||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, BUFFERPIXELS * buf_idx + y * ROW_LENGTH + x);
|
glPixelStorei(GL_UNPACK_SKIP_PIXELS, BUFFERPIXELS * buf_idx + y * ROW_LENGTH + x);
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, ROW_LENGTH);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, ROW_LENGTH);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, QOpenGLTexture::BGRA, QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, (GLenum)QOpenGLTexture::BGRA, (GLenum)QOpenGLTexture::UInt32_RGBA8_Rev, NULL);
|
||||||
|
|
||||||
/* TODO: check if fence sync is implementable here and still has any benefit. */
|
/* TODO: check if fence sync is implementable here and still has any benefit. */
|
||||||
glFinish();
|
glFinish();
|
||||||
|
|||||||
@@ -202,6 +202,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Time synchronization</string>
|
<string>Time synchronization</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ static void s3_pci_write(int func, int addr, uint8_t val, void *p);
|
|||||||
static __inline uint32_t
|
static __inline uint32_t
|
||||||
dword_remap(svga_t *svga, uint32_t in_addr)
|
dword_remap(svga_t *svga, uint32_t in_addr)
|
||||||
{
|
{
|
||||||
if (svga->packed_chain4)
|
if (svga->packed_chain4 || svga->force_old_addr)
|
||||||
return in_addr;
|
return in_addr;
|
||||||
|
|
||||||
return ((in_addr << 2) & 0x3fff0) |
|
return ((in_addr << 2) & 0x3fff0) |
|
||||||
@@ -414,7 +414,7 @@ dword_remap(svga_t *svga, uint32_t in_addr)
|
|||||||
static __inline uint32_t
|
static __inline uint32_t
|
||||||
dword_remap_w(svga_t *svga, uint32_t in_addr)
|
dword_remap_w(svga_t *svga, uint32_t in_addr)
|
||||||
{
|
{
|
||||||
if (svga->packed_chain4)
|
if (svga->packed_chain4 || svga->force_old_addr)
|
||||||
return in_addr;
|
return in_addr;
|
||||||
|
|
||||||
return ((in_addr << 2) & 0x1fff8) |
|
return ((in_addr << 2) & 0x1fff8) |
|
||||||
@@ -424,7 +424,7 @@ dword_remap_w(svga_t *svga, uint32_t in_addr)
|
|||||||
static __inline uint32_t
|
static __inline uint32_t
|
||||||
dword_remap_l(svga_t *svga, uint32_t in_addr)
|
dword_remap_l(svga_t *svga, uint32_t in_addr)
|
||||||
{
|
{
|
||||||
if (svga->packed_chain4)
|
if (svga->packed_chain4 || svga->force_old_addr)
|
||||||
return in_addr;
|
return in_addr;
|
||||||
|
|
||||||
return ((in_addr << 2) & 0xfffc) |
|
return ((in_addr << 2) & 0xfffc) |
|
||||||
@@ -2552,6 +2552,7 @@ s3_out(uint16_t addr, uint8_t val, void *p)
|
|||||||
{
|
{
|
||||||
case 0x31:
|
case 0x31:
|
||||||
s3->ma_ext = (s3->ma_ext & 0x1c) | ((val & 0x30) >> 4);
|
s3->ma_ext = (s3->ma_ext & 0x1c) | ((val & 0x30) >> 4);
|
||||||
|
svga->force_dword_mode = !!(val & 0x08);
|
||||||
break;
|
break;
|
||||||
case 0x32:
|
case 0x32:
|
||||||
if ((svga->crtc[0x31] & 0x30) && (svga->crtc[0x51] & 0x01) && (val & 0x40))
|
if ((svga->crtc[0x31] & 0x30) && (svga->crtc[0x51] & 0x01) && (val & 0x40))
|
||||||
@@ -2971,7 +2972,6 @@ static void s3_recalctimings(svga_t *svga)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
||||||
svga->fb_only = 1;
|
|
||||||
switch (svga->bpp) {
|
switch (svga->bpp) {
|
||||||
case 8:
|
case 8:
|
||||||
svga->render = svga_render_8bpp_highres;
|
svga->render = svga_render_8bpp_highres;
|
||||||
@@ -3154,7 +3154,6 @@ static void s3_recalctimings(svga_t *svga)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
svga->fb_only = 0;
|
|
||||||
if (!svga->scrblank && svga->attr_palette_enable) {
|
if (!svga->scrblank && svga->attr_palette_enable) {
|
||||||
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
|
if ((svga->gdcreg[6] & 1) || (svga->attrregs[0x10] & 1)) {
|
||||||
if ((svga->crtc[0x31] & 0x08) && ((svga->gdcreg[5] & 0x60) == 0x00)) {
|
if ((svga->crtc[0x31] & 0x08) && ((svga->gdcreg[5] & 0x60) == 0x00)) {
|
||||||
@@ -3208,7 +3207,6 @@ static void s3_trio64v_recalctimings(svga_t *svga)
|
|||||||
svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10));
|
svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10));
|
||||||
|
|
||||||
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
||||||
svga->fb_only = 1;
|
|
||||||
switch (svga->bpp) {
|
switch (svga->bpp) {
|
||||||
case 8:
|
case 8:
|
||||||
svga->render = svga_render_8bpp_highres;
|
svga->render = svga_render_8bpp_highres;
|
||||||
@@ -3229,13 +3227,10 @@ static void s3_trio64v_recalctimings(svga_t *svga)
|
|||||||
svga->render = svga_render_32bpp_highres;
|
svga->render = svga_render_32bpp_highres;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
svga->fb_only = 0;
|
|
||||||
}
|
}
|
||||||
else /*Streams mode*/
|
else /*Streams mode*/
|
||||||
{
|
{
|
||||||
svga->fb_only = 1;
|
|
||||||
|
|
||||||
if (s3->streams.buffer_ctrl & 1)
|
if (s3->streams.buffer_ctrl & 1)
|
||||||
svga->ma_latch = s3->streams.pri_fb1 >> 2;
|
svga->ma_latch = s3->streams.pri_fb1 >> 2;
|
||||||
else
|
else
|
||||||
@@ -3379,7 +3374,12 @@ s3_updatemapping(s3_t *s3)
|
|||||||
|
|
||||||
mem_mapping_set_addr(&s3->linear_mapping, s3->linear_base, s3->linear_size);
|
mem_mapping_set_addr(&s3->linear_mapping, s3->linear_base, s3->linear_size);
|
||||||
}
|
}
|
||||||
|
if (s3->chip >= S3_TRIO64V)
|
||||||
|
svga->fb_only = 1;
|
||||||
} else {
|
} else {
|
||||||
|
if (s3->chip >= S3_TRIO64V)
|
||||||
|
svga->fb_only = 0;
|
||||||
|
|
||||||
mem_mapping_disable(&s3->linear_mapping);
|
mem_mapping_disable(&s3->linear_mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7140,6 +7140,8 @@ static void *s3_init(const device_t *info)
|
|||||||
|
|
||||||
s3->card_type = info->local;
|
s3->card_type = info->local;
|
||||||
|
|
||||||
|
svga->force_old_addr = 1;
|
||||||
|
|
||||||
switch(s3->card_type) {
|
switch(s3->card_type) {
|
||||||
case S3_ORCHID_86C911:
|
case S3_ORCHID_86C911:
|
||||||
case S3_DIAMOND_STEALTH_VRAM:
|
case S3_DIAMOND_STEALTH_VRAM:
|
||||||
@@ -7401,8 +7403,6 @@ static void *s3_init(const device_t *info)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
svga->packed_chain4 = 1;
|
|
||||||
|
|
||||||
if (s3->pci)
|
if (s3->pci)
|
||||||
s3->card = pci_add_card(PCI_ADD_VIDEO, s3_pci_read, s3_pci_write, s3);
|
s3->card = pci_add_card(PCI_ADD_VIDEO, s3_pci_read, s3_pci_write, s3);
|
||||||
|
|
||||||
@@ -7609,73 +7609,124 @@ static void s3_force_redraw(void *p)
|
|||||||
s3->svga.fullchange = changeframecount;
|
s3->svga.fullchange = changeframecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
static const device_config_t s3_orchid_86c911_config[] =
|
||||||
static const device_config_t s3_orchid_86c911_config[] = {
|
{
|
||||||
{
|
{
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 1, "", { 0 },
|
"memory", "Memory size", CONFIG_SELECTION, "", 1, "", { 0 },
|
||||||
{
|
{
|
||||||
{ "512 KB", 0 },
|
{
|
||||||
{ "1 MB", 1 },
|
"512 KB", 0
|
||||||
{ "" }
|
},
|
||||||
}
|
{
|
||||||
},
|
"1 MB", 1
|
||||||
{ "", "", -1 }
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t s3_9fx_config[] = {
|
static const device_config_t s3_9fx_config[] =
|
||||||
{
|
{
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
{
|
||||||
{
|
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
||||||
{ "1 MB", 1 },
|
{
|
||||||
{ "2 MB", 2 },
|
{
|
||||||
/*Trio64 also supports 4 MB, however the Number Nine BIOS does not*/
|
"1 MB", 1
|
||||||
{ "" }
|
},
|
||||||
}
|
{
|
||||||
},
|
"2 MB", 2
|
||||||
{ "", "", -1 }
|
},
|
||||||
|
/*Trio64 also supports 4 MB, however the Number Nine BIOS does not*/
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const device_config_t s3_phoenix_trio32_config[] = {
|
static const device_config_t s3_phoenix_trio32_config[] =
|
||||||
{
|
{
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
{
|
||||||
{
|
"memory", "Memory size", CONFIG_SELECTION, "", 2, "", { 0 },
|
||||||
{ "512 KB", 0 },
|
{
|
||||||
{ "1 MB", 1 },
|
{
|
||||||
{ "2 MB", 2 },
|
"512 KB", 0
|
||||||
{ "" }
|
},
|
||||||
}
|
{
|
||||||
},
|
"1 MB", 1
|
||||||
{ "", "", -1 }
|
},
|
||||||
|
{
|
||||||
|
"2 MB", 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t s3_standard_config[] = {
|
static const device_config_t s3_standard_config[] =
|
||||||
{
|
{
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
{
|
||||||
{
|
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||||
{ "1 MB", 1 },
|
{
|
||||||
{ "2 MB", 2 },
|
{
|
||||||
{ "4 MB", 4 },
|
"1 MB", 1
|
||||||
{ "" }
|
},
|
||||||
}
|
{
|
||||||
},
|
"2 MB", 2
|
||||||
{ "", "", -1 }
|
},
|
||||||
|
{
|
||||||
|
"4 MB", 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t s3_968_config[] = {
|
static const device_config_t s3_968_config[] =
|
||||||
{
|
{
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
{
|
||||||
{
|
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||||
{ "1 MB", 1 },
|
{
|
||||||
{ "2 MB", 2 },
|
{
|
||||||
{ "4 MB", 4 },
|
"1 MB", 1
|
||||||
{ "8 MB", 8 },
|
},
|
||||||
{ "" }
|
{
|
||||||
}
|
"2 MB", 2
|
||||||
},
|
},
|
||||||
{ "", "", -1 }
|
{
|
||||||
|
"4 MB", 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"8 MB", 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
const device_t s3_orchid_86c911_isa_device =
|
const device_t s3_orchid_86c911_isa_device =
|
||||||
{
|
{
|
||||||
@@ -8333,7 +8384,7 @@ const device_t s3_elsa_winner2000_pro_x_964_pci_device =
|
|||||||
S3_ELSAWIN2KPROX_964,
|
S3_ELSAWIN2KPROX_964,
|
||||||
s3_init,
|
s3_init,
|
||||||
s3_close,
|
s3_close,
|
||||||
s3_reset,
|
s3_reset,
|
||||||
{ s3_elsa_winner2000_pro_x_964_available },
|
{ s3_elsa_winner2000_pro_x_964_available },
|
||||||
s3_speed_changed,
|
s3_speed_changed,
|
||||||
s3_force_redraw,
|
s3_force_redraw,
|
||||||
@@ -8348,7 +8399,7 @@ const device_t s3_elsa_winner2000_pro_x_pci_device =
|
|||||||
S3_ELSAWIN2KPROX,
|
S3_ELSAWIN2KPROX,
|
||||||
s3_init,
|
s3_init,
|
||||||
s3_close,
|
s3_close,
|
||||||
s3_reset,
|
s3_reset,
|
||||||
{ s3_elsa_winner2000_pro_x_available },
|
{ s3_elsa_winner2000_pro_x_available },
|
||||||
s3_speed_changed,
|
s3_speed_changed,
|
||||||
s3_force_redraw,
|
s3_force_redraw,
|
||||||
@@ -8363,7 +8414,7 @@ const device_t s3_trio64v2_dx_pci_device =
|
|||||||
S3_TRIO64V2_DX,
|
S3_TRIO64V2_DX,
|
||||||
s3_init,
|
s3_init,
|
||||||
s3_close,
|
s3_close,
|
||||||
s3_reset,
|
s3_reset,
|
||||||
{ s3_trio64v2_dx_available },
|
{ s3_trio64v2_dx_available },
|
||||||
s3_speed_changed,
|
s3_speed_changed,
|
||||||
s3_force_redraw,
|
s3_force_redraw,
|
||||||
@@ -8379,7 +8430,7 @@ const device_t s3_trio64v2_dx_onboard_pci_device =
|
|||||||
S3_TRIO64V2_DX_ONBOARD,
|
S3_TRIO64V2_DX_ONBOARD,
|
||||||
s3_init,
|
s3_init,
|
||||||
s3_close,
|
s3_close,
|
||||||
NULL,
|
NULL,
|
||||||
{ NULL },
|
{ NULL },
|
||||||
s3_speed_changed,
|
s3_speed_changed,
|
||||||
s3_force_redraw,
|
s3_force_redraw,
|
||||||
|
|||||||
@@ -776,6 +776,7 @@ static void s3_virge_recalctimings(svga_t *svga)
|
|||||||
|
|
||||||
if ((svga->crtc[0x67] & 0xc) != 0xc) /*VGA mode*/
|
if ((svga->crtc[0x67] & 0xc) != 0xc) /*VGA mode*/
|
||||||
{
|
{
|
||||||
|
svga->fb_only = 0;
|
||||||
svga->ma_latch |= (virge->ma_ext << 16);
|
svga->ma_latch |= (virge->ma_ext << 16);
|
||||||
if (svga->crtc[0x51] & 0x30) svga->rowoffset += (svga->crtc[0x51] & 0x30) << 4;
|
if (svga->crtc[0x51] & 0x30) svga->rowoffset += (svga->crtc[0x51] & 0x30) << 4;
|
||||||
else if (svga->crtc[0x43] & 0x04) svga->rowoffset += 0x100;
|
else if (svga->crtc[0x43] & 0x04) svga->rowoffset += 0x100;
|
||||||
@@ -783,7 +784,6 @@ static void s3_virge_recalctimings(svga_t *svga)
|
|||||||
|
|
||||||
svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10));
|
svga->lowres = !((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10));
|
||||||
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
if ((svga->gdcreg[5] & 0x40) && (svga->crtc[0x3a] & 0x10)) {
|
||||||
svga->fb_only = 1;
|
|
||||||
switch (svga->bpp) {
|
switch (svga->bpp) {
|
||||||
case 8:
|
case 8:
|
||||||
svga->render = svga_render_8bpp_highres;
|
svga->render = svga_render_8bpp_highres;
|
||||||
@@ -813,8 +813,7 @@ static void s3_virge_recalctimings(svga_t *svga)
|
|||||||
svga->render = svga_render_32bpp_highres;
|
svga->render = svga_render_32bpp_highres;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
svga->fb_only = 0;
|
|
||||||
svga->vram_display_mask = (!(svga->crtc[0x31] & 0x08) && (svga->crtc[0x32] & 0x40)) ? 0x3ffff : virge->vram_mask;
|
svga->vram_display_mask = (!(svga->crtc[0x31] & 0x08) && (svga->crtc[0x32] & 0x40)) ? 0x3ffff : virge->vram_mask;
|
||||||
s3_virge_log("VGA mode\n");
|
s3_virge_log("VGA mode\n");
|
||||||
}
|
}
|
||||||
@@ -940,8 +939,10 @@ static void s3_virge_updatemapping(virge_t *virge)
|
|||||||
|
|
||||||
mem_mapping_set_addr(&virge->linear_mapping, virge->linear_base, virge->linear_size);
|
mem_mapping_set_addr(&virge->linear_mapping, virge->linear_base, virge->linear_size);
|
||||||
}
|
}
|
||||||
|
svga->fb_only = 1;
|
||||||
} else {
|
} else {
|
||||||
mem_mapping_disable(&virge->linear_mapping);
|
mem_mapping_disable(&virge->linear_mapping);
|
||||||
|
svga->fb_only = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s3_virge_log("Memory mapped IO %02X\n", svga->crtc[0x53] & 0x38);
|
s3_virge_log("Memory mapped IO %02X\n", svga->crtc[0x53] & 0x38);
|
||||||
@@ -4118,7 +4119,7 @@ static void *s3_virge_init(const device_t *info)
|
|||||||
virge->i2c = i2c_gpio_init("ddc_s3_virge");
|
virge->i2c = i2c_gpio_init("ddc_s3_virge");
|
||||||
virge->ddc = ddc_init(i2c_gpio_get_bus(virge->i2c));
|
virge->ddc = ddc_init(i2c_gpio_get_bus(virge->i2c));
|
||||||
|
|
||||||
virge->svga.packed_chain4 = 1;
|
virge->svga.force_old_addr = 1;
|
||||||
|
|
||||||
virge->wake_render_thread = thread_create_event();
|
virge->wake_render_thread = thread_create_event();
|
||||||
virge->wake_main_thread = thread_create_event();
|
virge->wake_main_thread = thread_create_event();
|
||||||
@@ -4216,60 +4217,102 @@ static void s3_virge_force_redraw(void *p)
|
|||||||
virge->svga.fullchange = changeframecount;
|
virge->svga.fullchange = changeframecount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
static const device_config_t s3_virge_config[] =
|
static const device_config_t s3_virge_config[] =
|
||||||
{
|
{
|
||||||
{
|
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
|
||||||
{
|
{
|
||||||
{ "2 MB", 2 },
|
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||||
{ "4 MB", 4 },
|
{
|
||||||
{ "" }
|
{
|
||||||
|
"2 MB", 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"4 MB", 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"dithering", "Dithering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{ "bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1 },
|
|
||||||
{ "dithering", "Dithering", CONFIG_BINARY, "", 1 },
|
|
||||||
{ "", "", -1 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t s3_virge_stb_config[] =
|
static const device_config_t s3_virge_stb_config[] =
|
||||||
{
|
{
|
||||||
{
|
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
|
||||||
{
|
{
|
||||||
{ "2 MB", 2 },
|
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||||
{ "4 MB", 4 },
|
{
|
||||||
{ "8 MB", 8 },
|
{
|
||||||
{ "" }
|
"2 MB", 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"4 MB", 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"8 MB", 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"dithering", "Dithering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{ "bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1 },
|
|
||||||
{ "dithering", "Dithering", CONFIG_BINARY, "", 1 },
|
|
||||||
{ "", "", -1 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t s3_virge_357_config[] =
|
static const device_config_t s3_virge_357_config[] =
|
||||||
{
|
{
|
||||||
{ "bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1 },
|
{
|
||||||
{ "dithering", "Dithering", CONFIG_BINARY, "", 1 },
|
"bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1
|
||||||
{ "", "", -1 }
|
},
|
||||||
|
{
|
||||||
|
"dithering", "Dithering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t s3_trio3d2x_config[] =
|
static const device_config_t s3_trio3d2x_config[] =
|
||||||
{
|
{
|
||||||
{
|
|
||||||
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
|
||||||
{
|
{
|
||||||
{ "4 MB", 4 },
|
"memory", "Memory size", CONFIG_SELECTION, "", 4, "", { 0 },
|
||||||
{ "8 MB", 8 },
|
{
|
||||||
{ "" }
|
{
|
||||||
|
"4 MB", 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"8 MB", 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"dithering", "Dithering", CONFIG_BINARY, "", 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"", "", -1
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{ "bilinear", "Bilinear filtering", CONFIG_BINARY, "", 1 },
|
|
||||||
{ "dithering", "Dithering", CONFIG_BINARY, "", 1 },
|
|
||||||
{ "", "", -1 }
|
|
||||||
};
|
};
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
const device_t s3_virge_325_pci_device =
|
const device_t s3_virge_325_pci_device =
|
||||||
{
|
{
|
||||||
@@ -4279,7 +4322,7 @@ const device_t s3_virge_325_pci_device =
|
|||||||
S3_VIRGE_325,
|
S3_VIRGE_325,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_325_available },
|
{ s3_virge_325_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4294,7 +4337,7 @@ const device_t s3_diamond_stealth_2000_pci_device =
|
|||||||
S3_DIAMOND_STEALTH3D_2000,
|
S3_DIAMOND_STEALTH3D_2000,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_325_diamond_available },
|
{ s3_virge_325_diamond_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4309,7 +4352,7 @@ const device_t s3_diamond_stealth_3000_pci_device =
|
|||||||
S3_DIAMOND_STEALTH3D_3000,
|
S3_DIAMOND_STEALTH3D_3000,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_988_diamond_available },
|
{ s3_virge_988_diamond_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4324,7 +4367,7 @@ const device_t s3_stb_velocity_3d_pci_device =
|
|||||||
S3_STB_VELOCITY_3D,
|
S3_STB_VELOCITY_3D,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_988_stb_available },
|
{ s3_virge_988_stb_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4339,7 +4382,7 @@ const device_t s3_virge_375_pci_device =
|
|||||||
S3_VIRGE_DX,
|
S3_VIRGE_DX,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_375_available },
|
{ s3_virge_375_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4354,7 +4397,7 @@ const device_t s3_diamond_stealth_2000pro_pci_device =
|
|||||||
S3_DIAMOND_STEALTH3D_2000PRO,
|
S3_DIAMOND_STEALTH3D_2000PRO,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_375_diamond_available },
|
{ s3_virge_375_diamond_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4369,7 +4412,7 @@ const device_t s3_virge_385_pci_device =
|
|||||||
S3_VIRGE_GX,
|
S3_VIRGE_GX,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_385_available },
|
{ s3_virge_385_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4384,7 +4427,7 @@ const device_t s3_virge_357_pci_device =
|
|||||||
S3_VIRGE_GX2,
|
S3_VIRGE_GX2,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_357_available },
|
{ s3_virge_357_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4399,7 +4442,7 @@ const device_t s3_virge_357_agp_device =
|
|||||||
S3_VIRGE_GX2,
|
S3_VIRGE_GX2,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_357_available },
|
{ s3_virge_357_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4414,7 +4457,7 @@ const device_t s3_diamond_stealth_4000_pci_device =
|
|||||||
S3_DIAMOND_STEALTH3D_4000,
|
S3_DIAMOND_STEALTH3D_4000,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_357_diamond_available },
|
{ s3_virge_357_diamond_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4429,7 +4472,7 @@ const device_t s3_diamond_stealth_4000_agp_device =
|
|||||||
S3_DIAMOND_STEALTH3D_4000,
|
S3_DIAMOND_STEALTH3D_4000,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_virge_357_diamond_available },
|
{ s3_virge_357_diamond_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4444,7 +4487,7 @@ const device_t s3_trio3d2x_pci_device =
|
|||||||
S3_TRIO_3D2X,
|
S3_TRIO_3D2X,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_trio3d2x_available },
|
{ s3_trio3d2x_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
@@ -4459,7 +4502,7 @@ const device_t s3_trio3d2x_agp_device =
|
|||||||
S3_TRIO_3D2X,
|
S3_TRIO_3D2X,
|
||||||
s3_virge_init,
|
s3_virge_init,
|
||||||
s3_virge_close,
|
s3_virge_close,
|
||||||
s3_virge_reset,
|
s3_virge_reset,
|
||||||
{ s3_trio3d2x_available },
|
{ s3_trio3d2x_available },
|
||||||
s3_virge_speed_changed,
|
s3_virge_speed_changed,
|
||||||
s3_virge_force_redraw,
|
s3_virge_force_redraw,
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ svga_out(uint16_t addr, uint8_t val, void *p)
|
|||||||
svga->chain2_write = !(val & 4);
|
svga->chain2_write = !(val & 4);
|
||||||
svga->chain4 = val & 8;
|
svga->chain4 = val & 8;
|
||||||
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) &&
|
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) &&
|
||||||
!svga->gdcreg[1]) && ((svga->chain4 && svga->packed_chain4) || svga->fb_only) && !(svga->adv_flags & FLAG_ADDR_BY8);
|
!svga->gdcreg[1]) && ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) && !(svga->adv_flags & FLAG_ADDR_BY8);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -264,7 +264,7 @@ svga_out(uint16_t addr, uint8_t val, void *p)
|
|||||||
}
|
}
|
||||||
svga->gdcreg[svga->gdcaddr & 15] = val;
|
svga->gdcreg[svga->gdcaddr & 15] = val;
|
||||||
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) &&
|
svga->fast = (svga->gdcreg[8] == 0xff && !(svga->gdcreg[3] & 0x18) &&
|
||||||
!svga->gdcreg[1]) && ((svga->chain4 && svga->packed_chain4) || svga->fb_only);
|
!svga->gdcreg[1]) && ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only);
|
||||||
if (((svga->gdcaddr & 15) == 5 && (val ^ o) & 0x70) ||
|
if (((svga->gdcaddr & 15) == 5 && (val ^ o) & 0x70) ||
|
||||||
((svga->gdcaddr & 15) == 6 && (val ^ o) & 1))
|
((svga->gdcaddr & 15) == 6 && (val ^ o) & 1))
|
||||||
svga_recalctimings(svga);
|
svga_recalctimings(svga);
|
||||||
@@ -582,7 +582,8 @@ svga_recalctimings(svga_t *svga)
|
|||||||
if (svga->dispofftime < TIMER_USEC)
|
if (svga->dispofftime < TIMER_USEC)
|
||||||
svga->dispofftime = TIMER_USEC;
|
svga->dispofftime = TIMER_USEC;
|
||||||
|
|
||||||
svga_recalc_remap_func(svga);
|
if (!svga->force_old_addr)
|
||||||
|
svga_recalc_remap_func(svga);
|
||||||
|
|
||||||
/* Inform the user interface of any DPMS mode changes. */
|
/* Inform the user interface of any DPMS mode changes. */
|
||||||
if (svga->dpms) {
|
if (svga->dpms) {
|
||||||
@@ -1068,7 +1069,7 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *p)
|
|||||||
addr <<= 4;
|
addr <<= 4;
|
||||||
else if ((svga->adv_flags & FLAG_ADDR_BY8) && (svga->writemode < 4))
|
else if ((svga->adv_flags & FLAG_ADDR_BY8) && (svga->writemode < 4))
|
||||||
addr <<= 3;
|
addr <<= 3;
|
||||||
else if (((svga->chain4 && svga->packed_chain4) || svga->fb_only) && (svga->writemode < 4)) {
|
else if (((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) && (svga->writemode < 4)) {
|
||||||
writemask2 = 1 << (addr & 3);
|
writemask2 = 1 << (addr & 3);
|
||||||
addr &= ~3;
|
addr &= ~3;
|
||||||
} else if (svga->chain4 && (svga->writemode < 4)) {
|
} else if (svga->chain4 && (svga->writemode < 4)) {
|
||||||
@@ -1256,7 +1257,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p)
|
|||||||
addr <<= 4;
|
addr <<= 4;
|
||||||
else if (svga->adv_flags & FLAG_ADDR_BY8)
|
else if (svga->adv_flags & FLAG_ADDR_BY8)
|
||||||
addr <<= 3;
|
addr <<= 3;
|
||||||
else if ((svga->chain4 && svga->packed_chain4) || svga->fb_only) {
|
else if ((svga->chain4 && (svga->packed_chain4 || svga->force_old_addr)) || svga->fb_only) {
|
||||||
addr &= svga->decode_mask;
|
addr &= svga->decode_mask;
|
||||||
if (svga->translate_address)
|
if (svga->translate_address)
|
||||||
addr = svga->translate_address(addr, p);
|
addr = svga->translate_address(addr, p);
|
||||||
@@ -1266,7 +1267,7 @@ svga_read_common(uint32_t addr, uint8_t linear, void *p)
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
svga->latch.b[i] = svga->vram[latch_addr | i];
|
svga->latch.b[i] = svga->vram[latch_addr | i];
|
||||||
return svga->vram[addr & svga->vram_mask];
|
return svga->vram[addr & svga->vram_mask];
|
||||||
} else if (svga->chain4) {
|
} else if (svga->chain4 && !svga->force_old_addr) {
|
||||||
readplane = addr & 3;
|
readplane = addr & 3;
|
||||||
addr = ((addr & 0xfffc) << 2) | ((addr & 0x30000) >> 14) | (addr & ~0x3ffff);
|
addr = ((addr & 0xfffc) << 2) | ((addr & 0x30000) >> 14) | (addr & ~0x3ffff);
|
||||||
} else if (svga->chain2_read) {
|
} else if (svga->chain2_read) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user