2 Copyright © 2015-2018, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
9 #include <proto/utility.h>
10 #include <proto/intuition.h>
16 #include "gallium_intern.h"
18 #undef HiddGalliumAttrBase
19 #define HiddGalliumAttrBase GB(GalliumBase)->galliumAttrBase
21 /*****************************************************************************
25 AROS_LH1(PipeHandle_t
, CreatePipe
,
28 AROS_LHA(struct TagItem
*, tags
, A0
),
31 struct Library
*, GalliumBase
, 5, Gallium
)
34 Instantiates a gallium pipe.
37 tags - a pointer to tags to be used during creation.
40 CPS_PipeFriendBitmap - a bitmap our pipe screen will target.
41 CPS_PipeScreenDriver * - where to store the driver.
42 CPS_GalliumInterfaceVersion - Indicates a version of gallium interface
43 that a client is expected to receive. The client expected version
44 must ideally match with the version that the driver provides,
45 because gallium interface is not backwards compatible. This tag is
46 required. Unless otherwise needed, the value
47 GALLIUM_INTERFACE_VERSION should be passed.
51 A valid pipe instance or NULL if creation was not successful.
57 *****************************************************************************/
61 struct TagItem galliumTags
[] =
63 { aHidd_Gallium_InterfaceVersion
, 0 },
66 OOP_Object
*_driver
= NULL
;
68 struct BitMap
*friendbm
;
69 struct Screen
*pubscreen
= NULL
;
71 galliumTags
[0].ti_Data
= GetTagData(CPS_GalliumInterfaceVersion
, -1, tags
);
72 friendbm
= (struct BitMap
*)GetTagData(CPS_PipeFriendBitMap
, 0, tags
);
73 driver
= (OOP_Object
**)GetTagData(CPS_PipeScreenDriver
, (IPTR
)&_driver
, tags
);
75 /* The tag is missing */
76 if (galliumTags
[0].ti_Data
== -1)
81 if ((pubscreen
= LockPubScreen(NULL
)) != NULL
)
82 friendbm
= pubscreen
->RastPort
.BitMap
;
85 D(bug("[Gallium] %s: friendbm @ 0x%p\n", __PRETTY_FUNCTION__
, friendbm
));
87 if (friendbm
&& IS_HIDD_BM(friendbm
))
89 OOP_Object
*bmObj
= HIDD_BM_OBJ(friendbm
);
93 OOP_GetAttr(bmObj
, aHidd_BitMap_GfxHidd
, (IPTR
*)&gfxhidd
);
97 *driver
= HIDD_Gfx_CreateObject(gfxhidd
, GB(GalliumBase
)->basegallium
, galliumTags
);
103 UnlockPubScreen(NULL
, pubscreen
);
108 if (!GB(GalliumBase
)->fallbackmodule
)
110 sprintf(tmpname
, "%s.hidd", GB(GalliumBase
)->fallback
);
112 D(bug("[Gallium] %s: trying fallback '%s' ...\n", __PRETTY_FUNCTION__
, tmpname
));
114 GB(GalliumBase
)->fallbackmodule
= OpenLibrary(tmpname
, 9);
116 D(bug("[Gallium] %s: '%s' @ 0x%p\n", __PRETTY_FUNCTION__
, tmpname
, GB(GalliumBase
)->fallbackmodule
));
119 if (GB(GalliumBase
)->fallbackmodule
)
121 sprintf(tmpname
, "hidd.gallium.%s", GB(GalliumBase
)->fallback
);
123 *driver
= OOP_NewObject(NULL
, tmpname
, galliumTags
);
125 D(bug("[Gallium] %s: '%s' @ 0x%p\n", __PRETTY_FUNCTION__
, tmpname
, *driver
));