2 Copyright © 2015-2019, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
8 #include <proto/utility.h>
9 #include <proto/intuition.h>
15 #include "gallium_intern.h"
17 #undef HiddGalliumAttrBase
18 #define HiddGalliumAttrBase GB(GalliumBase)->galliumAttrBase
20 /*****************************************************************************
24 AROS_LH1(PipeHandle_t
, CreatePipe
,
27 AROS_LHA(struct TagItem
*, tags
, A0
),
30 struct Library
*, GalliumBase
, 5, Gallium
)
33 Instantiates a gallium pipe.
36 tags - a pointer to tags to be used during creation.
39 CPS_PipeFriendBitmap - a bitmap our pipe screen will target.
40 CPS_PipeScreenDriver * - where to store the driver.
41 CPS_GalliumInterfaceVersion - Indicates a version of gallium interface
42 that a client is expected to receive. The client expected version
43 must ideally match with the version that the driver provides,
44 because gallium interface is not backwards compatible. This tag is
45 required. Unless otherwise needed, the value
46 GALLIUM_INTERFACE_VERSION should be passed.
50 A valid pipe instance or NULL if creation was not successful.
56 *****************************************************************************/
60 struct TagItem galliumTags
[] =
62 { aHidd_Gallium_InterfaceVersion
, 0 },
65 OOP_Object
*_driver
= NULL
;
67 struct BitMap
*friendbm
;
68 struct Screen
*pubscreen
= NULL
;
70 galliumTags
[0].ti_Data
= GetTagData(CPS_GalliumInterfaceVersion
, -1, tags
);
71 friendbm
= (struct BitMap
*)GetTagData(CPS_PipeFriendBitMap
, 0, tags
);
72 driver
= (OOP_Object
**)GetTagData(CPS_PipeScreenDriver
, (IPTR
)&_driver
, tags
);
74 /* The tag is missing */
75 if (galliumTags
[0].ti_Data
== -1)
80 if ((pubscreen
= LockPubScreen(NULL
)) != NULL
)
81 friendbm
= pubscreen
->RastPort
.BitMap
;
84 D(bug("[Gallium] %s: friendbm @ 0x%p\n", __PRETTY_FUNCTION__
, friendbm
));
86 if (friendbm
&& IS_HIDD_BM(friendbm
))
88 OOP_Object
*bmObj
= HIDD_BM_OBJ(friendbm
);
92 OOP_GetAttr(bmObj
, aHidd_BitMap_GfxHidd
, (IPTR
*)&gfxhidd
);
96 *driver
= HIDD_Gfx_CreateObject(gfxhidd
, GB(GalliumBase
)->basegallium
, galliumTags
);
102 UnlockPubScreen(NULL
, pubscreen
);
107 if (!GB(GalliumBase
)->fallbackmodule
)
109 sprintf(tmpname
, "%s.hidd", GB(GalliumBase
)->fallback
);
111 D(bug("[Gallium] %s: trying fallback '%s' ...\n", __PRETTY_FUNCTION__
, tmpname
));
113 GB(GalliumBase
)->fallbackmodule
= OpenLibrary(tmpname
, 9);
115 D(bug("[Gallium] %s: '%s' @ 0x%p\n", __PRETTY_FUNCTION__
, tmpname
, GB(GalliumBase
)->fallbackmodule
));
118 if (GB(GalliumBase
)->fallbackmodule
)
120 sprintf(tmpname
, "hidd.gallium.%s", GB(GalliumBase
)->fallback
);
122 *driver
= OOP_NewObject(NULL
, tmpname
, galliumTags
);
124 D(bug("[Gallium] %s: '%s' @ 0x%p\n", __PRETTY_FUNCTION__
, tmpname
, *driver
));