Added 400ns delay in ata_WaitBusyTO before read of device status.
[tangerine.git] / arch / common / hidd.vmwaresvga / vmwaresvgaonbitmap.c
blob66434fcfef439af4e7c5790ade8388c86d944ba9
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Bitmap class for VMWareSVGA hidd.
6 Lang: English.
7 */
9 #define DEBUG 0
10 #include <aros/debug.h>
12 #define __OOP_NOATTRBASES__
14 #include <proto/oop.h>
15 #include <proto/utility.h>
16 #include <assert.h>
17 #include <exec/memory.h>
18 #include <exec/lists.h>
19 #include <aros/symbolsets.h>
20 #include <graphics/rastport.h>
21 #include <graphics/gfx.h>
22 #include <hidd/graphics.h>
23 #include <oop/oop.h>
25 #include "vmwaresvgabitmap.h"
26 #include "vmwaresvgaclass.h"
28 #include LC_LIBDEFS_FILE
30 /* Don't initialize static variables with "=0", otherwise they go into DATA segment */
32 static OOP_AttrBase HiddBitMapAttrBase;
33 static OOP_AttrBase HiddPixFmtAttrBase;
34 static OOP_AttrBase HiddGfxAttrBase;
35 static OOP_AttrBase HiddSyncAttrBase;
36 static OOP_AttrBase HiddVMWareSVGAAttrBase;
37 static OOP_AttrBase HiddVMWareSVGABitMapAttrBase;
39 static struct OOP_ABDescr attrbases[] =
41 { IID_Hidd_BitMap, &HiddBitMapAttrBase },
42 { IID_Hidd_PixFmt, &HiddPixFmtAttrBase },
43 { IID_Hidd_Gfx, &HiddGfxAttrBase },
44 { IID_Hidd_Sync, &HiddSyncAttrBase },
45 /* Private bases */
46 { IID_Hidd_VMWareSVGA, &HiddVMWareSVGAAttrBase },
47 { IID_Hidd_VMWareSVGABitMap, &HiddVMWareSVGABitMapAttrBase },
48 { NULL, NULL }
51 #define MNAME_ROOT(x) VMWareSVGAOnBM__Root__ ## x
52 #define MNAME_BM(x) VMWareSVGAOnBM__Hidd_BitMap__ ## x
54 #define OnBitmap 1
55 #include "vmwaresvgabitmap_common.c"
57 /*********** BitMap::New() *************************************/
59 OOP_Object *MNAME_ROOT(New)(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
61 EnterFunc(bug("VMWareSVGA.BitMap::New()\n"));
62 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg);
63 if (o)
65 struct BitmapData *data;
66 LONG multi=1;
67 OOP_Object *pf;
68 IPTR width, height, depth;
69 HIDDT_ModeID modeid;
70 OOP_Object *sync;
71 ULONG pixelc;
73 data = OOP_INST_DATA(cl, o);
74 /* clear all data */
75 memset(data, 0, sizeof(struct BitmapData));
76 /* Get attr values */
77 OOP_GetAttr(o, aHidd_BitMap_Width, &width);
78 OOP_GetAttr(o, aHidd_BitMap_Height, &height);
79 OOP_GetAttr(o, aHidd_BitMap_PixFmt, (IPTR *)&pf);
80 OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth);
81 ASSERT (width != 0 && height != 0 && depth != 0);
82 /*
83 We must only create depths that are supported by the friend drawable
84 Currently we only support the default depth
87 width=(width+15) & ~15;
88 data->width = width;
89 data->height = height;
90 data->bpp = depth;
91 data->disp = -1;
92 if (depth>16)
93 multi = 4;
94 else if (depth>8)
95 multi = 2;
96 data->bytesperpix = multi;
97 data->data = &XSD(cl)->data;
98 data->mouse = &XSD(cl)->mouse;
99 data->VideoData = data->data->vrambase;
100 /* We should be able to get modeID from the bitmap */
101 OOP_GetAttr(o, aHidd_BitMap_ModeID, &modeid);
102 if (modeid != vHidd_ModeID_Invalid)
105 Because of not defined BitMap_Show method show
106 bitmap immediately
108 setModeVMWareSVGA(&XSD(cl)->data, width, height);
109 XSD(cl)->visible = data; /* Set created object as visible */
110 ReturnPtr("VMWareSVGA.BitMap::New()", OOP_Object *, o);
113 OOP_MethodID disp_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose);
114 OOP_CoerceMethod(cl, o, (OOP_Msg) &disp_mid);
116 o = NULL;
117 } /* if created object */
118 ReturnPtr("VMWareSVGA.BitMap::New()", OOP_Object *, o);
121 /********** Bitmap::Dispose() ***********************************/
123 VOID MNAME_ROOT(Dispose)(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
125 struct BitmapData *data = OOP_INST_DATA(cl, o);
127 EnterFunc(bug("VMWareSVGA.BitMap::Dispose()\n"));
128 OOP_DoSuperMethod(cl, o, msg);
129 ReturnVoid("VMWareSVGA.BitMap::Dispose");
132 /*** init_onbmclass *********************************************************/
134 static int VMWareSVGAOnBM_Init(LIBBASETYPEPTR LIBBASE)
136 EnterFunc(bug("VMWareSVGAOnBM_Init\n"));
138 ReturnInt("VMWareSVGAOnBM_Init", ULONG, OOP_ObtainAttrBases(attrbases));
141 /*** free_bitmapclass *********************************************************/
143 static int VMWareSVGAOnBM_Expunge(LIBBASETYPEPTR LIBBASE)
145 EnterFunc(bug("VMWareSVGAOnBM_Expunge\n"));
147 OOP_ReleaseAttrBases(attrbases);
149 ReturnInt("VMWareSVGAOnBM_Expunge", int, TRUE);
152 ADD2INITLIB(VMWareSVGAOnBM_Init, 0)
153 ADD2EXPUNGELIB(VMWareSVGAOnBM_Expunge, 0)