1 #include <aros/debug.h>
2 #include <graphics/driver.h>
3 #include <hidd/compositor.h>
8 #include "graphics_intern.h"
9 #include "compositor_driver.h"
12 ULONG
compositor_Install(OOP_Class
*cl
, struct GfxBase
*GfxBase
)
14 struct monitor_driverdata
*mdd
;
16 D(bug("[Compositor] Installing class 0x%p\n", cl
));
19 * Completely lazy initialization.
20 * It even can't be done in other way because OOP_GetMethodID() on an unregistered
21 * interface will fail (unlike OOP_ObtainAttrBase).
23 if (!HiddCompositorAttrBase
)
24 HiddCompositorAttrBase
= OOP_ObtainAttrBase(IID_Hidd_Compositor
);
26 if (!HiddCompositorAttrBase
)
29 if (!PrivGBase(GfxBase
)->HiddCompositorMethodBase
)
31 PrivGBase(GfxBase
)->HiddCompositorMethodBase
= OOP_GetMethodID(IID_Hidd_Compositor
, 0);
33 if (!PrivGBase(GfxBase
)->HiddCompositorMethodBase
)
35 OOP_ReleaseAttrBase(IID_Hidd_Compositor
);
41 CDD(GfxBase
)->compositorClass
= cl
;
43 for (mdd
= CDD(GfxBase
)->monitors
; mdd
; mdd
= mdd
->next
)
45 /* If the driver needs software compositor, but has no one, instantiate it. */
46 if ((mdd
->flags
& DF_SoftCompose
) && (!mdd
->compositor
))
48 compositor_Setup(mdd
, GfxBase
);
55 void compositor_Setup(struct monitor_driverdata
*mdd
, struct GfxBase
*GfxBase
)
58 * Note that if we have fakegfx object, we'll actually work on top of it.
59 * This allows us to have transparent software mouse pointer support.
61 mdd
->compositor
= OOP_NewObjectTags(CDD(GfxBase
)->compositorClass
, NULL
,
62 aHidd_Compositor_GfxHidd
, mdd
->gfxhidd
,
63 aHidd_Compositor_DisplayID
, mdd
->id
,
64 aHidd_Compositor_FrameBuffer
, mdd
->framebuffer
, TAG_DONE
);
66 /* ... but print name of the original driver, to be informative */
67 D(bug("[Compositor] Added compositor object 0x%p to driver 0x%p (%s)\n", mdd
->compositor
, mdd
->gfxhidd
,
68 OOP_OCLASS(mdd
->gfxhidd_orig
)->ClassNode
.ln_Name
));
71 BOOL
compositor_IsBMCompositable(struct BitMap
*bitmap
, DisplayInfoHandle handle
, struct GfxBase
*GfxBase
)
73 if (DIH(handle
)->drv
->compositor
)
75 struct pHidd_Compositor_BitMapValidate msg
=
77 mID
: PrivGBase(GfxBase
)->HiddCompositorMethodBase
+ moHidd_Compositor_BitMapValidate
,
81 return (BOOL
)OOP_DoMethod(DIH(handle
)->drv
->compositor
, &msg
.mID
);
86 BOOL
compositor_SetBMCompositable(struct BitMap
*bitmap
, DisplayInfoHandle handle
, struct GfxBase
*GfxBase
)
88 if (DIH(handle
)->drv
->compositor
)
90 struct pHidd_Compositor_BitMapEnable msg
=
92 mID
: PrivGBase(GfxBase
)->HiddCompositorMethodBase
+ moHidd_Compositor_BitMapEnable
,
96 return (BOOL
)OOP_DoMethod(DIH(handle
)->drv
->compositor
, &msg
.mID
);