extern addrbank gfxmem_bank;
extern addrbank *gfxmem_banks[MAX_RTG_BOARDS];
extern int rtg_index;
+int picasso96_test;
void lockrtg(void)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
struct picasso96_state_struct *state = &picasso96_state[monid];
- vidinfo->picasso_convert = getconvert(state->RGBFormat, picasso_vidinfo[monid].pixbytes);
+ if (state->advDragging) {
+ vidinfo->picasso_convert[0] = getconvert(vidinfo->dacrgbformat[0], picasso_vidinfo[monid].pixbytes);
+ vidinfo->picasso_convert[1] = getconvert(vidinfo->dacrgbformat[1], picasso_vidinfo[monid].pixbytes);
+ } else {
+ vidinfo->picasso_convert[0] = vidinfo->picasso_convert[1] = getconvert(state->RGBFormat, picasso_vidinfo[monid].pixbytes);
+ }
if (currprefs.gfx_api) {
vidinfo->host_mode = picasso_vidinfo[monid].pixbytes == 4 ? RGBFB_B8G8R8A8 : RGBFB_B5G6R5PC;
} else {
static void picasso_handle_vsync2(struct AmigaMonitor *mon)
{
- struct amigadisplay *ad = &adisplays[mon->monitor_id];
- struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[mon->monitor_id];
+ int monid = mon->monitor_id;
+ struct amigadisplay *ad = &adisplays[monid];
+ struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
+ struct picasso96_state_struct *p96state = &picasso96_state[monid];
static int vsynccnt;
int thisisvsync = 1;
int vsync = isvsync_rtg();
lockrtg();
if (state & PICASSO_STATE_SETDAC) {
atomic_and(&vidinfo->picasso_state_change, ~PICASSO_STATE_SETDAC);
+ if (p96state->advDragging) {
+ vidinfo->picasso_convert[0] = getconvert(vidinfo->dacrgbformat[0], picasso_vidinfo[monid].pixbytes);
+ vidinfo->picasso_convert[1] = getconvert(vidinfo->dacrgbformat[1], picasso_vidinfo[monid].pixbytes);
+ }
rtg_clear(mon->monitor_id);
}
if (state & PICASSO_STATE_SETGC) {
atomic_and(&vidinfo->picasso_state_change, ~PICASSO_STATE_SETGC);
set_gc_called = 1;
vidinfo->picasso_changed = true;
- init_picasso_screen(mon->monitor_id);
- init_hz_p96(mon->monitor_id);
+ init_picasso_screen(monid);
+ init_hz_p96(monid);
if (delayed_set_switch) {
delayed_set_switch = false;
atomic_or(&vidinfo->picasso_state_change, PICASSO_STATE_SETSWITCH);
atomic_and(&vidinfo->picasso_state_change, ~PICASSO_STATE_SETPANNING);
vidinfo->full_refresh = 1;
vidinfo->set_panning_called = 1;
- init_picasso_screen(mon->monitor_id);
+ init_picasso_screen(monid);
vidinfo->set_panning_called = 0;
}
if (state & PICASSO_STATE_SETDISPLAY) {
#endif
}
- getvsyncrate(mon->monitor_id, currprefs.chipset_refreshrate, &mult);
+ getvsyncrate(monid, currprefs.chipset_refreshrate, &mult);
if (vsync && mult < 0) {
vsynccnt++;
if (vsynccnt < 2)
if (thisisvsync) {
rtg_render();
- frame_drawn(mon->monitor_id);
+ frame_drawn(monid);
}
if (uaegfx) {
#endif
flags |= BIF_VGASCREENSPLIT;
flags |= BIF_PALETTESWITCH;
+ flags |= (1 << 28);
trap_put_long(ctx, ABI + PSSO_BoardInfo_Flags, flags);
if (debug_rtg_blitter != 3)
write_log (_T("P96: Blitter mode = %x!\n"), debug_rtg_blitter);
*/
static uae_u32 REGPARAM2 picasso_SetDAC (TrapContext *ctx)
{
- struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[currprefs.rtgboards[0].monitor_id];
+ int monid = currprefs.rtgboards[0].monitor_id;
+ struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
+ struct picasso96_state_struct* state = &picasso96_state[monid];
+ uae_u16 idx = trap_get_dreg(ctx, 0);
+ uae_u32 mode = trap_get_dreg(ctx, 7);
/* Fill in some static UAE related structure about this new DAC setting
* Lets us keep track of what pixel format the Amiga is thinking about in our frame-buffer */
+ if (state->advDragging) {
+ vidinfo->dacrgbformat[idx ? 1 : 0] = mode;
+ } else {
+ vidinfo->dacrgbformat[0] = mode;
+ vidinfo->dacrgbformat[1] = mode;
+ }
atomic_or(&vidinfo->picasso_state_change, PICASSO_STATE_SETDAC);
P96TRACE_SETUP((_T("SetDAC()\n")));
return 1;
}
+static uae_u32 REGPARAM2 picasso_CoerceMode(struct TrapContext *ctx)
+{
+ uae_u16 bw = trap_get_dreg(ctx, 2);
+ uae_u16 fw = trap_get_dreg(ctx, 3);
+ return bw > fw ? bw : fw;
+}
+
+static uae_u32 REGPARAM2 picasso_GetCompatibleDACFormats(struct TrapContext *ctx)
+{
+ int monid = currprefs.rtgboards[0].monitor_id;
+ struct picasso96_state_struct *state = &picasso96_state[monid];
+ RGBFTYPE type = (RGBFTYPE)trap_get_dreg(ctx, 7);
+ switch (type)
+ {
+ case RGBFB_CLUT:
+ case RGBFB_R8G8B8:
+ case RGBFB_B8G8R8:
+ case RGBFB_R5G6B5PC:
+ case RGBFB_R5G5B5PC:
+ case RGBFB_A8R8G8B8:
+ case RGBFB_A8B8G8R8:
+ case RGBFB_R8G8B8A8:
+ case RGBFB_B8G8R8A8:
+ case RGBFB_R5G6B5:
+ case RGBFB_R5G5B5:
+ case RGBFB_B5G6R5PC:
+ case RGBFB_B5G5R5PC:
+ state->advDragging = true;
+ return RGBMASK_8BIT | RGBMASK_15BIT | RGBMASK_16BIT | RGBMASK_24BIT | RGBMASK_32BIT;
+ }
+ return 0;
+}
+
static void init_picasso_screen(int monid)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
}
}
-static void copyrow (int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dx, int dy, int dstbytesperrow, int dstpixbytes, bool direct, int convert_mode, uae_u32 *p96_rgbx16p)
+static void copyrow(int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dx, int dy, int dstbytesperrow, int dstpixbytes, int *convert_modep, uae_u32 *p96_rgbx16p)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
struct picasso96_state_struct *state = &picasso96_state[monid];
int dstpix = dstpixbytes;
int srcpix = srcpixbytes;
uae_u32 *clut = vidinfo->clut;
+ int convert_mode = convert_modep[0];
if (y >= vidinfo->splitypos && vidinfo->splitypos >= 0) {
src = gfxmem_banks[monid]->start + natmem_offset;
clut += 256;
}
y -= vidinfo->splitypos;
+ if (convert_mode != convert_modep[1]) {
+ int bpp1 = GetBytesPerPixel(vidinfo->dacrgbformat[0]);
+ int bpp2 = GetBytesPerPixel(vidinfo->dacrgbformat[1]);
+ srcbytesperrow = srcbytesperrow * bpp2 / bpp1;
+ convert_mode = convert_modep[1];
+ }
}
uae_u8 *src2 = src + y * srcbytesperrow;
uae_u8 *dst2 = dst + dy * dstbytesperrow;
- if (direct) {
- memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
- return;
- }
// native match?
if (currprefs.gfx_api) {
switch (convert_mode)
int mx = overlay_src_width_in * 256 / overlay_w;
int my = overlay_src_height_in * 256 / overlay_h;
int y = 0;
-
+ int split = 0;
+ if (vidinfo->splitypos >= 0) {
+ split = vidinfo->splitypos;
+ }
for (int dy = 0; dy < overlay_h; dy++) {
if (s + (y >> 8) * overlay_src_width_in * overlay_pix > vram_end)
break;
- if (ss + (overlay_y + dy) * state->BytesPerRow > vram_end)
+ if (ss + (overlay_y + dy + split) * state->BytesPerRow > vram_end)
break;
- if (dst + (overlay_y + dy) * vidinfo->rowbytes > vram_end)
+ if (dst + (overlay_y + dy + split) * vidinfo->rowbytes > vram_end)
break;
copyrow_scale(monid, s, ss, dst,
0, (y >> 8), mx, overlay_src_width_in, overlay_src_width * overlay_pix, overlay_pix,
state->BytesPerRow, state->BytesPerPixel,
- overlay_x, overlay_y + dy, vidinfo->width, vidinfo->height, vidinfo->rowbytes, vidinfo->pixbytes,
+ overlay_x, overlay_y + dy + split, vidinfo->width, vidinfo->height, vidinfo->rowbytes, vidinfo->pixbytes,
overlay_occlusion != 0, overlay_color,
overlay_convert, p96_rgbx16_ovl, overlay_clut, true);
y += my;
struct picasso96_state_struct *state = &picasso96_state[monid];
copyrow(monid, src, dst, x, y, width, 0, srcpixbytes,
x, dy, picasso_vidinfo[monid].rowbytes, picasso_vidinfo[monid].pixbytes,
- state->RGBFormat == vidinfo->host_mode, vidinfo->picasso_convert, p96_rgbx16);
+ vidinfo->picasso_convert, p96_rgbx16);
}
-static void copyallinvert(int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert)
+static void copyallinvert(int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, int *mode_convert)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
- int x, y, w;
-
- w = pwidth * dstpixbytes;
- if (direct) {
- for (y = 0; y < pheight; y++) {
- if (y == vidinfo->splitypos) {
- src = gfxmem_banks[monid]->start + natmem_offset;
- }
- for (x = 0; x < w; x++) {
- dst[x] = src[x] ^ 0xff;
- }
- dst += dstbytesperrow;
- src += srcbytesperrow;
- }
- } else {
- uae_u8 *src2 = src;
- for (y = 0; y < pheight; y++) {
- for (x = 0; x < w; x++)
- src2[x] ^= 0xff;
- copyrow(monid, src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, 0, y, dstbytesperrow, dstpixbytes, direct, mode_convert, p96_rgbx16);
- for (x = 0; x < w; x++)
- src2[x] ^= 0xff;
- src2 += srcbytesperrow;
- }
+
+ int w = pwidth * dstpixbytes;
+ uae_u8 *src2 = src;
+ for (int y = 0; y < pheight; y++) {
+ for (int x = 0; x < w; x++)
+ src2[x] ^= 0xff;
+ copyrow(monid, src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, 0, y, dstbytesperrow, dstpixbytes, mode_convert, p96_rgbx16);
+ for (int x = 0; x < w; x++)
+ src2[x] ^= 0xff;
+ src2 += srcbytesperrow;
}
}
-static void copyall (int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert)
+static void copyall(int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, int *mode_convert)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
- int y;
- if (direct) {
- int w = pwidth * vidinfo->pixbytes;
- for (y = 0; y < pheight; y++) {
- if (y == vidinfo->splitypos) {
- src = gfxmem_banks[monid]->start + natmem_offset;
- }
- memcpy (dst, src, w);
- dst += dstbytesperrow;
- src += srcbytesperrow;
- }
- } else {
- for (y = 0; y < pheight; y++) {
- copyrow(monid, src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, 0, y, dstbytesperrow, dstpixbytes, direct, mode_convert, p96_rgbx16);
- }
+ for (int y = 0; y < pheight; y++) {
+ copyrow(monid, src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, 0, y, dstbytesperrow, dstpixbytes, mode_convert, p96_rgbx16);
}
}
int off = state->XYOffset - gfxmem_banks[monid]->start;
int width, height, pixbytes;
uae_u8 *dst;
- int convert;
- int hmode;
+ int convert[2];
if (!vidinfo->extra_mem)
return NULL;
dst = xmalloc (uae_u8, width * height * pixbytes);
if (!dst)
return NULL;
- hmode = pixbytes == 1 ? RGBFB_CLUT : RGBFB_B8G8R8A8;
- convert = getconvert (state->RGBFormat, pixbytes);
+ convert[0] = getconvert (state->RGBFormat, pixbytes);
+ convert[1] = convert[0];
alloc_colors_picasso(8, 8, 8, 16, 8, 0, state->RGBFormat, p96_rgbx16);
- if (pixbytes > 1 && hmode != convert) {
- copyall (monid, src + off, dst, width, height, state->BytesPerRow, state->BytesPerPixel, width * pixbytes, pixbytes, false, convert);
- } else {
- uae_u8 *dstp = dst;
- uae_u8 *srcp = src;
- for (int y = 0; y < height; y++) {
- memcpy (dstp, srcp, width * pixbytes);
- dstp += width * pixbytes;
- srcp += state->BytesPerRow;
- }
- }
+ copyall (monid, src + off, dst, width, height, state->BytesPerRow, state->BytesPerPixel, width * pixbytes, pixbytes, convert);
if (pixbytes == 1) {
for (int i = 0; i < 256; i++) {
palette[i * 3 + 0] = state->CLUT[i].Red;
copyallinvert(monid, src + off, dst, pwidth, pheight,
state->BytesPerRow, state->BytesPerPixel,
vidinfo->rowbytes, vidinfo->pixbytes,
- state->RGBFormat == vidinfo->host_mode, vidinfo->picasso_convert);
+ vidinfo->picasso_convert);
} else {
copyall(monid, src + off, dst, pwidth, pheight,
state->BytesPerRow, state->BytesPerPixel,
vidinfo->rowbytes, vidinfo->pixbytes,
- state->RGBFormat == vidinfo->host_mode, vidinfo->picasso_convert);
+ vidinfo->picasso_convert);
}
miny = 0;
maxy = pheight;
copyrow(monid, src + off, dst, x, y, pwidth - x,
state->BytesPerRow, state->BytesPerPixel,
x, y, vidinfo->rowbytes, vidinfo->pixbytes,
- state->RGBFormat == vidinfo->host_mode, vidinfo->picasso_convert, p96_rgbx16);
+ vidinfo->picasso_convert, p96_rgbx16);
flushlines++;
}
w = (gwwpagesize[index] - (state->BytesPerRow - x * state->BytesPerPixel) + state->BytesPerPixel - 1) / state->BytesPerPixel;
copyrow(monid, src + off, dst, 0, y, maxw,
state->BytesPerRow, state->BytesPerPixel,
0, y, vidinfo->rowbytes, vidinfo->pixbytes,
- state->RGBFormat == vidinfo->host_mode, vidinfo->picasso_convert, p96_rgbx16);
+ vidinfo->picasso_convert, p96_rgbx16);
w -= maxw;
y++;
flushlines++;
if (dstp == NULL) {
dstp = gfx_lock_picasso(monid, false);
}
- if (dstp)
+ if (dstp) {
picasso_flushoverlay(index, src, off, dstp);
+ }
}
if (0 && flushlines) {
#endif
RTGCALL2(PSSO_SetSplitPosition, picasso_SetSplitPosition);
+ if (picasso96_test) {
+ RTGCALL2(PSSO_BoardInfo_GetCompatibleDACFormats, picasso_GetCompatibleDACFormats);
+ RTGCALL2(PSSO_BoardInfo_CoerceMode, picasso_CoerceMode);
+ }
#endif
reserved_gfxmem = 0;
resetpalette(state);
state->dualclut = false;
+ state->advDragging = false;
InitPicasso96(monid);
}