gcc-4.6.2: Update with patch for gengtype.c
[AROS.git] / rom / graphics / compositing_driver.c
blobb1944dfcd12053b45846ff2760894f3877341171
1 #include <aros/debug.h>
2 #include <graphics/driver.h>
3 #include <hidd/compositing.h>
4 #include <oop/oop.h>
6 #include <proto/oop.h>
8 #include "graphics_intern.h"
9 #include "compositing_driver.h"
11 ULONG composer_Install(OOP_Class *cl, struct GfxBase *GfxBase)
13 struct monitor_driverdata *mdd;
15 D(bug("[Composer] Installing class 0x%p\n", cl));
18 * Completely lazy initialization.
19 * It even can't be done in other way because OOP_GetMethodID() on an unregistered
20 * interface will fail (unlike OOP_ObtainAttrBase).
22 if (!HiddCompositingAttrBase)
23 HiddCompositingAttrBase = OOP_ObtainAttrBase(IID_Hidd_Compositing);
25 if (!HiddCompositingAttrBase)
26 return DD_NO_MEM;
28 if (!PrivGBase(GfxBase)->HiddCompositingMethodBase)
30 PrivGBase(GfxBase)->HiddCompositingMethodBase = OOP_GetMethodID(IID_Hidd_Compositing, 0);
32 if (!PrivGBase(GfxBase)->HiddCompositingMethodBase)
34 OOP_ReleaseAttrBase(IID_Hidd_Compositing);
36 return DD_NO_MEM;
40 CDD(GfxBase)->composerClass = cl;
42 for (mdd = CDD(GfxBase)->monitors; mdd; mdd = mdd->next)
44 /* If the driver needs software composer, but has no one, instantiate it. */
45 if ((mdd->flags & DF_SoftCompose) && (!mdd->composer))
47 composer_Setup(mdd, GfxBase);
51 return DD_OK;
54 void composer_Setup(struct monitor_driverdata *mdd, struct GfxBase *GfxBase)
56 /*
57 * Note that if we have fakegfx object, we'll actually work on top of it.
58 * This allows us to have transparent software mouse pointer support.
60 mdd->composer = OOP_NewObjectTags(CDD(GfxBase)->composerClass, NULL,
61 aHidd_Compositing_GfxHidd, mdd->gfxhidd,
62 aHidd_Compositing_FrameBuffer, mdd->framebuffer, TAG_DONE);
64 /* ... but print name of the original driver, to be informative */
65 D(bug("[Composer] Added compositing object 0x%p to driver 0x%p (%s)\n", mdd->composer, mdd->gfxhidd,
66 OOP_OCLASS(mdd->gfxhidd_orig)->ClassNode.ln_Name));