Skip to content

Commit

Permalink
W.I.P update.
Browse files Browse the repository at this point in the history
# Handle copper and palette data per screen-bitmap.  This fixes issues with the palette becoming corrupt when screen changes/closure occur.
# Initialize some data at object instantiation instead of e.g. when compositing the display.
# adapt display composition code to chain copperlist fragments together for visible screens.
# adapt screen dragging code to work with the chained display bitmaps, and adjust the cursor handling to match. This allows multiple screens to be displayed at tge same time similar to AmigaOS. (1)

(1) - this is currently incomplete and still needs to patch in or remove obscured screens, and fix issues with some screen combinations. the cursor code also breaks a little need screen overlap.
  • Loading branch information
Kalamatee committed Nov 30, 2019
1 parent 3b333e5 commit 5d819c2
Show file tree
Hide file tree
Showing 10 changed files with 579 additions and 336 deletions.
2 changes: 1 addition & 1 deletion arch/m68k-amiga/hidd/amigavideo/amigavideo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
basename AmigaVideoCl
libbase AmigaVideoClBase
libbasetype struct amigavideoclbase
version 45.2
version 45.3
residentpri 9
classid CLID_Hidd_Gfx_AmigaVideo
superclass CLID_Hidd_Gfx
Expand Down
52 changes: 35 additions & 17 deletions arch/m68k-amiga/hidd/amigavideo/amigavideo_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef _AMIGABITMAP_H
#define _AMIGABITMAP_H

#include "amigavideo_intern.h"

#define IID_Hidd_BitMap_AmigaVideo "hidd.bitmap.amigavideo"

enum
Expand All @@ -28,24 +30,40 @@ enum

struct amigabm_data
{
struct MinNode node;
struct BitMap *pbm;
UBYTE *palette;
OOP_Object *compositor;
WORD width;
WORD height;
WORD bytesperrow;
UBYTE depth;
UBYTE planebuf_size;
WORD topedge, leftedge;
BOOL disp;
WORD align;
WORD displaywidth;
WORD displayheight;
/* display composition data ... */
struct Node node;
struct copper2data copper2;
struct copper2data copper2i;
IPTR modeid;

UBYTE res; // 0 = lores, 1 = hires, 2 = shres
UBYTE interlace;
WORD modulopre, modulo;
UWORD ddfstrt, ddfstop;
UWORD use_colors;

UBYTE *palette;
OOP_Object *compositor;
UBYTE bploffsets[8];

/* old stuff.. */
struct BitMap *pbm;
WORD width;
WORD height;
WORD bytesperrow;
UBYTE depth;
UBYTE planebuf_size;
WORD topedge, leftedge;
WORD align;
WORD displaywidth;
WORD displayheight;
/* pixel read/write cache */
ULONG pixelcacheoffset;
UBYTE pixelcache[32];
ULONG writemask;
ULONG pixelcacheoffset;
UBYTE pixelcache[32];
ULONG writemask;
/* flags */
BOOL disp; /* displayable ? */
BOOL vis; /* visible ? */
};

#include "chipset.h"
Expand Down
64 changes: 53 additions & 11 deletions arch/m68k-amiga/hidd/amigavideo/amigavideo_bitmapclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <exec/lists.h>
#include <graphics/rastport.h>
#include <graphics/gfx.h>
#include <graphics/modeid.h>
#include <oop/oop.h>
#include <hidd/gfx.h>
#include <aros/symbolsets.h>
Expand Down Expand Up @@ -54,7 +55,7 @@ OOP_Object *AmigaVideoBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_N
struct amigavideo_staticdata *csd = CSD(cl);
struct Library *UtilityBase = csd->cs_UtilityBase;
struct Library *OOPBase = csd->cs_OOPBase;
IPTR width, height, depth, disp;
IPTR width, height, depth, disp, modeid, coppersize;
BOOL ok = TRUE;
struct amigabm_data *data;
struct BitMap *pbm = NULL;
Expand Down Expand Up @@ -83,6 +84,7 @@ OOP_Object *AmigaVideoBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_N
OOP_GetAttr(o, aHidd_BitMap_Depth, &depth);
OOP_GetAttr(o, aHidd_BitMap_Displayable, &disp);
OOP_GetAttr(o, aHidd_PlanarBM_BitMap, &pbm);
OOP_GetAttr(o, aHidd_BitMap_ModeID , &modeid);

D(bug("[AmigaVideo:Bitmap] %s: %dx%dx%d\n", __func__, width, height, depth));

Expand All @@ -94,19 +96,51 @@ OOP_Object *AmigaVideoBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_N
data->pixelcacheoffset = -1;
data->pbm = pbm;

data->compositor = (OOP_Object *)GetTagData(aHidd_BitMap_AmigaVideo_Compositor, 0, msg->attrList);
if ((data->disp = disp))
{
D(bug("[AmigaVideo:Bitmap] %s: DISPLAYABLE bitmap\n", __func__));

data->compositor = (OOP_Object *)GetTagData(aHidd_BitMap_AmigaVideo_Compositor, 0, msg->attrList);
D(bug("[AmigaVideo:Bitmap] %s: compositor @ 0x%p\n", __func__, data->compositor));

if (data->compositor)
{
data->palette = AllocVec(csd->max_colors * 3, MEMF_CLEAR);
D(bug("[AmigaVideo:Bitmap] %s: palette data @ 0x%p\n", __func__, data->palette);)

data->modeid = modeid;

D(bug("[AmigaVideo:Bitmap] %s: compositor @ 0x%p\n", __func__, data->compositor));
data->res = 0;
if ((data->modeid & SUPER_KEY) == SUPER_KEY)
data->res = 2;
else if ((data->modeid & SUPER_KEY) == HIRES_KEY)
data->res = 1;
data->interlace = (data->modeid & LORESLACE_KEY) ? 1 : 0;

if ((data->compositor == NULL) || !ok) {
coppersize = get_copper_list_length(csd, data->depth);

data->copper2.copper2 = AllocVec(coppersize, MEMF_CLEAR | MEMF_CHIP);
D(bug("[AmigaVideo:Bitmap] %s: allocated %d bytes for copperlist data @ 0x%p\n", __func__, coppersize, data->copper2.copper2);)

if (data->interlace)
{
data->copper2i.copper2 = AllocVec(coppersize, MEMF_CLEAR | MEMF_CHIP);
D(bug("[AmigaVideo:Bitmap] %s: interlaced copperlist data @ 0x%p\n", __func__, data->copper2i.copper2);)
}
setmode(csd, data);
}
else
ok = FALSE;
}
if (!ok) {
OOP_MethodID dispose_mid;

dispose_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose);
OOP_CoerceMethod(cl, o, (OOP_Msg)&dispose_mid);

o = NULL;
}

D(bug("[AmigaVideo:Bitmap] %s: ret=%x bm=%x\n", __func__, o, data));

return o;
Expand All @@ -122,9 +156,18 @@ VOID AmigaVideoBM__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
bug("[AmigaVideo:Bitmap] %s(0x%p)\n", __func__, o);
bug("[AmigaVideo:Bitmap] %s: data @ 0x%p\n", __func__, data);
)

if (data->vis)
{
D(bug("[AmigaVideo:Bitmap] %s: WARNING! destroying visible bitmap!\n", __func__);)
}

if (data->disp)
{
D(bug("[AmigaVideo:Bitmap] %s: removing displayed bitmap?!\n", __func__);)
D(bug("[AmigaVideo:Bitmap] %s: destroying displayable bitmap\n", __func__);)
FreeVec(data->palette);
FreeVec(data->copper2.copper2);
FreeVec(data->copper2i.copper2);
}

OOP_DoSuperMethod(cl, o, msg);
Expand Down Expand Up @@ -158,12 +201,11 @@ VOID AmigaVideoBM__Root__Set(OOP_Class *cl, OOP_Object *o, struct pRoot_Set *msg
volatile struct Custom *custom = (struct Custom*)0xdff000;
struct GfxBase *GfxBase = (struct GfxBase *)csd->cs_GfxBase;
D(bug("[AmigaVideo:Bitmap] %s: aoHidd_BitMap_Focus\n", __func__);)
custom->bplcon0 = GfxBase->system_bplcon0;
}
break;
case aoHidd_BitMap_Visible:
data->disp = tag->ti_Data;
if (data->disp) {
data->vis = tag->ti_Data;
if (data->vis) {
setrtg(csd, FALSE);
setbitmap(csd, data);
} else {
Expand Down Expand Up @@ -235,7 +277,7 @@ VOID AmigaVideoBM__Root__Get(OOP_Class *cl, OOP_Object *o, struct pRoot_Get *msg
break;

case aoHidd_BitMap_Visible:
*msg->storage = data->disp;
*msg->storage = data->vis;
handled = TRUE;
break;

Expand Down Expand Up @@ -296,7 +338,7 @@ BOOL AmigaVideoBM__Hidd_BitMap__SetColors(OOP_Class *cl, OOP_Object *o, struct p

if (!OOP_DoSuperMethod(cl, o, (OOP_Msg)msg))
return FALSE;
return setcolors(csd, msg, data->disp);
return setcolors(csd, data, msg);
}

/****************************************************************************************/
Expand Down
5 changes: 0 additions & 5 deletions arch/m68k-amiga/hidd/amigavideo/amigavideo_compositor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
#include <exec/lists.h>
#include <exec/semaphores.h>

struct StackBitMapNode
{
struct Node n; // NB: n.ln_Name = (OOP_Object *)bm;
};

struct amigacomposit_data
{
struct List bitmapstack;
Expand Down
Loading

0 comments on commit 5d819c2

Please sign in to comment.