mirror of https://github.com/xemu-project/xemu.git
nv2a: Migrate nv2a_get_offsets to new _get_params model
This commit is contained in:
parent
008d848582
commit
5cb65d1791
|
@ -149,27 +149,16 @@ static int nv2a_get_bpp(VGACommonState *s)
|
|||
return bpp;
|
||||
}
|
||||
|
||||
static void nv2a_get_offsets(VGACommonState *s,
|
||||
uint32_t *pline_offset,
|
||||
uint32_t *pstart_addr,
|
||||
uint32_t *pline_compare)
|
||||
static void nv2a_get_params(VGACommonState *s, VGADisplayParams *params)
|
||||
{
|
||||
NV2AState *d = container_of(s, NV2AState, vga);
|
||||
uint32_t start_addr, line_offset, line_compare;
|
||||
|
||||
line_offset = s->cr[0x13]
|
||||
| ((s->cr[0x19] & 0xe0) << 3)
|
||||
| ((s->cr[0x25] & 0x20) << 6);
|
||||
line_offset <<= 3;
|
||||
*pline_offset = line_offset;
|
||||
|
||||
start_addr = d->pcrtc.start / 4;
|
||||
*pstart_addr = start_addr;
|
||||
|
||||
line_compare = s->cr[VGA_CRTC_LINE_COMPARE] |
|
||||
((s->cr[VGA_CRTC_OVERFLOW] & 0x10) << 4) |
|
||||
((s->cr[VGA_CRTC_MAX_SCAN] & 0x40) << 3);
|
||||
*pline_compare = line_compare;
|
||||
params->line_offset = (s->cr[0x13] | ((s->cr[0x19] & 0xe0) << 3) |
|
||||
((s->cr[0x25] & 0x20) << 6))
|
||||
<< 3;
|
||||
params->start_addr = d->pcrtc.start / 4;
|
||||
params->line_compare = s->cr[VGA_CRTC_LINE_COMPARE] |
|
||||
((s->cr[VGA_CRTC_OVERFLOW] & 0x10) << 4) |
|
||||
((s->cr[VGA_CRTC_MAX_SCAN] & 0x40) << 3);
|
||||
}
|
||||
|
||||
const uint8_t *nv2a_get_dac_palette(void)
|
||||
|
@ -235,7 +224,7 @@ static void nv2a_init_vga(NV2AState *d)
|
|||
|
||||
vga_common_init(vga, OBJECT(d), &error_fatal);
|
||||
vga->get_bpp = nv2a_get_bpp;
|
||||
vga->get_offsets = nv2a_get_offsets;
|
||||
vga->get_params = nv2a_get_params;
|
||||
// vga->overlay_draw_line = nv2a_overlay_draw_line;
|
||||
|
||||
d->hw_ops = *vga->hw_ops;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/display/vga_int.h"
|
||||
#include "hw/xbox/nv2a/nv2a_int.h"
|
||||
#include "hw/xbox/nv2a/pgraph/util.h"
|
||||
#include "renderer.h"
|
||||
|
@ -284,10 +286,10 @@ static void render_display(NV2AState *d, SurfaceBinding *surface)
|
|||
PGRAPHGLState *r = pg->gl_renderer_state;
|
||||
|
||||
unsigned int width, height;
|
||||
uint32_t pline_offset, pstart_addr, pline_compare;
|
||||
VGADisplayParams vga_display_params;
|
||||
d->vga.get_resolution(&d->vga, (int*)&width, (int*)&height);
|
||||
d->vga.get_offsets(&d->vga, &pline_offset, &pstart_addr, &pline_compare);
|
||||
int line_offset = pline_offset ? surface->pitch / pline_offset : 1;
|
||||
d->vga.get_params(&d->vga, &vga_display_params);
|
||||
int line_offset = vga_display_params.line_offset ? surface->pitch / vga_display_params.line_offset : 1;
|
||||
|
||||
/* Adjust viewport height for interlaced mode, used only in 1080i */
|
||||
if (d->vga.cr[NV_PRMCIO_INTERLACE_MODE] != NV_PRMCIO_INTERLACE_MODE_DISABLED) {
|
||||
|
@ -376,9 +378,10 @@ static void gl_fence(void)
|
|||
|
||||
void pgraph_gl_sync(NV2AState *d)
|
||||
{
|
||||
uint32_t pline_offset, pstart_addr, pline_compare;
|
||||
d->vga.get_offsets(&d->vga, &pline_offset, &pstart_addr, &pline_compare);
|
||||
SurfaceBinding *surface = pgraph_gl_surface_get_within(d, d->pcrtc.start + pline_offset);
|
||||
VGADisplayParams vga_display_params;
|
||||
d->vga.get_params(&d->vga, &vga_display_params);
|
||||
|
||||
SurfaceBinding *surface = pgraph_gl_surface_get_within(d, d->pcrtc.start + vga_display_params.line_offset);
|
||||
if (surface == NULL) {
|
||||
qemu_event_set(&d->pgraph.sync_complete);
|
||||
return;
|
||||
|
@ -411,9 +414,12 @@ int pgraph_gl_get_framebuffer_surface(NV2AState *d)
|
|||
|
||||
qemu_mutex_lock(&d->pfifo.lock);
|
||||
// FIXME: Possible race condition with pgraph, consider lock
|
||||
uint32_t pline_offset, pstart_addr, pline_compare;
|
||||
d->vga.get_offsets(&d->vga, &pline_offset, &pstart_addr, &pline_compare);
|
||||
SurfaceBinding *surface = pgraph_gl_surface_get_within(d, d->pcrtc.start + pline_offset);
|
||||
|
||||
VGADisplayParams vga_display_params;
|
||||
d->vga.get_params(&d->vga, &vga_display_params);
|
||||
|
||||
SurfaceBinding *surface = pgraph_gl_surface_get_within(
|
||||
d, d->pcrtc.start + vga_display_params.line_offset);
|
||||
if (surface == NULL || !surface->color) {
|
||||
qemu_mutex_unlock(&d->pfifo.lock);
|
||||
return 0;
|
||||
|
|
|
@ -870,9 +870,11 @@ static void update_uniforms(PGRAPHState *pg, SurfaceBinding *surface)
|
|||
int display_size_loc = uniform_index(l, "display_size"); // FIXME: Cache
|
||||
uniform2f(l, display_size_loc, r->display.width, r->display.height);
|
||||
|
||||
uint32_t pline_offset, pstart_addr, pline_compare;
|
||||
d->vga.get_offsets(&d->vga, &pline_offset, &pstart_addr, &pline_compare);
|
||||
int line_offset = pline_offset ? surface->pitch / pline_offset : 1;
|
||||
VGADisplayParams vga_display_params;
|
||||
d->vga.get_params(&d->vga, &vga_display_params);
|
||||
int line_offset = vga_display_params.line_offset ?
|
||||
surface->pitch / vga_display_params.line_offset :
|
||||
1;
|
||||
int line_offset_loc = uniform_index(l, "line_offset");
|
||||
uniform1f(l, line_offset_loc, line_offset);
|
||||
|
||||
|
@ -1065,11 +1067,11 @@ void pgraph_vk_render_display(PGRAPHState *pg)
|
|||
NV2AState *d = container_of(pg, NV2AState, pgraph);
|
||||
PGRAPHVkState *r = pg->vk_renderer_state;
|
||||
|
||||
uint32_t pline_offset, pstart_addr, pline_compare;
|
||||
d->vga.get_offsets(&d->vga, &pline_offset, &pstart_addr, &pline_compare);
|
||||
VGADisplayParams vga_display_params;
|
||||
d->vga.get_params(&d->vga, &vga_display_params);
|
||||
|
||||
SurfaceBinding *surface =
|
||||
pgraph_vk_surface_get_within(d, d->pcrtc.start + pline_offset);
|
||||
SurfaceBinding *surface = pgraph_vk_surface_get_within(
|
||||
d, d->pcrtc.start + vga_display_params.line_offset);
|
||||
if (surface == NULL || !surface->color) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -173,10 +173,12 @@ static int pgraph_vk_get_framebuffer_surface(NV2AState *d)
|
|||
PGRAPHVkState *r = pg->vk_renderer_state;
|
||||
|
||||
qemu_mutex_lock(&d->pfifo.lock);
|
||||
// FIXME: Possible race condition with pgraph, consider lock
|
||||
uint32_t pline_offset, pstart_addr, pline_compare;
|
||||
d->vga.get_offsets(&d->vga, &pline_offset, &pstart_addr, &pline_compare);
|
||||
SurfaceBinding *surface = pgraph_vk_surface_get_within(d, d->pcrtc.start + pline_offset);
|
||||
|
||||
VGADisplayParams vga_display_params;
|
||||
d->vga.get_params(&d->vga, &vga_display_params);
|
||||
|
||||
SurfaceBinding *surface = pgraph_vk_surface_get_within(
|
||||
d, d->pcrtc.start + vga_display_params.line_offset);
|
||||
if (surface == NULL || !surface->color) {
|
||||
qemu_mutex_unlock(&d->pfifo.lock);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue