2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <graphics/driver.h>
8 #include <hidd/compositor.h>
11 #include <proto/oop.h>
13 #include "graphics_intern.h"
14 #include "compositor_driver.h"
17 ULONG
compositor_Install(OOP_Class
*cl
, struct GfxBase
*GfxBase
)
19 struct monitor_driverdata
*mdd
;
21 D(bug("[Compositor] Installing class 0x%p\n", cl
));
24 * Completely lazy initialization.
25 * It even can't be done in other way because OOP_GetMethodID() on an unregistered
26 * interface will fail (unlike OOP_ObtainAttrBase).
28 if (!HiddCompositorAttrBase
)
29 HiddCompositorAttrBase
= OOP_ObtainAttrBase(IID_Hidd_Compositor
);
31 if (!HiddCompositorAttrBase
)
34 if (!PrivGBase(GfxBase
)->HiddCompositorMethodBase
)
36 PrivGBase(GfxBase
)->HiddCompositorMethodBase
= OOP_GetMethodID(IID_Hidd_Compositor
, 0);
38 if (!PrivGBase(GfxBase
)->HiddCompositorMethodBase
)
40 OOP_ReleaseAttrBase(IID_Hidd_Compositor
);
46 CDD(GfxBase
)->compositorClass
= cl
;
48 for (mdd
= CDD(GfxBase
)->monitors
; mdd
; mdd
= mdd
->next
)
50 /* If the driver needs software compositor, but has no one, instantiate it. */
51 if ((mdd
->flags
& DF_SoftCompose
) && (!mdd
->compositor
))
53 compositor_Setup(mdd
, GfxBase
);
60 void compositor_Setup(struct monitor_driverdata
*mdd
, struct GfxBase
*GfxBase
)
63 * Note that if we have fakegfx object, we'll actually work on top of it.
64 * This allows us to have transparent software mouse pointer support.
66 mdd
->compositor
= OOP_NewObjectTags(CDD(GfxBase
)->compositorClass
, NULL
,
67 aHidd_Compositor_GfxHidd
, mdd
->gfxhidd
,
68 aHidd_Compositor_DisplayID
, mdd
->id
,
69 aHidd_Compositor_FrameBuffer
, mdd
->framebuffer
, TAG_DONE
);
71 /* ... but print name of the original driver, to be informative */
72 D(bug("[Compositor] Added compositor object 0x%p to driver 0x%p (%s)\n", mdd
->compositor
, mdd
->gfxhidd
,
73 OOP_OCLASS(mdd
->gfxhidd_orig
)->ClassNode
.ln_Name
));
76 BOOL
compositor_IsBMCompositable(struct BitMap
*bitmap
, DisplayInfoHandle handle
, struct GfxBase
*GfxBase
)
78 if (DIH(handle
)->drv
->compositor
)
80 struct pHidd_Compositor_BitMapValidate msg
=
82 mID
: PrivGBase(GfxBase
)->HiddCompositorMethodBase
+ moHidd_Compositor_BitMapValidate
,
86 return (BOOL
)OOP_DoMethod(DIH(handle
)->drv
->compositor
, &msg
.mID
);
91 BOOL
compositor_SetBMCompositable(struct BitMap
*bitmap
, DisplayInfoHandle handle
, struct GfxBase
*GfxBase
)
93 if (DIH(handle
)->drv
->compositor
)
95 struct pHidd_Compositor_BitMapEnable msg
=
97 mID
: PrivGBase(GfxBase
)->HiddCompositorMethodBase
+ moHidd_Compositor_BitMapEnable
,
101 return (BOOL
)OOP_DoMethod(DIH(handle
)->drv
->compositor
, &msg
.mID
);