add place-holder directory for the a3000 wd533c93 scsi controller implementation.
[AROS.git] / workbench / libs / gallium / createpipe.c
blob884abcd0eb3e3a237d567a9b07fdb99541eb9d66
1 /*
2 Copyright © 2015-2019, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #include <proto/utility.h>
9 #include <proto/intuition.h>
11 #include <hidd/gfx.h>
13 #include <stdio.h>
15 #include "gallium_intern.h"
17 #undef HiddGalliumAttrBase
18 #define HiddGalliumAttrBase GB(GalliumBase)->galliumAttrBase
20 /*****************************************************************************
22 NAME */
24 AROS_LH1(PipeHandle_t, CreatePipe,
26 /* SYNOPSIS */
27 AROS_LHA(struct TagItem *, tags, A0),
29 /* LOCATION */
30 struct Library *, GalliumBase, 5, Gallium)
32 /* FUNCTION
33 Instantiates a gallium pipe.
35 INPUTS
36 tags - a pointer to tags to be used during creation.
38 TAGS
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.
47 See also CreatePipeV.
49 RESULT
50 A valid pipe instance or NULL if creation was not successful.
52 BUGS
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct TagItem galliumTags[] =
62 { aHidd_Gallium_InterfaceVersion, 0 },
63 { TAG_DONE, 0 }
65 OOP_Object *_driver = NULL;
66 OOP_Object **driver;
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)
76 return NULL;
78 if (!friendbm)
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);
89 if (bmObj)
91 OOP_Object *gfxhidd;
92 OOP_GetAttr(bmObj, aHidd_BitMap_GfxHidd, (IPTR *)&gfxhidd);
94 if (gfxhidd)
96 *driver = HIDD_Gfx_CreateObject(gfxhidd, GB(GalliumBase)->basegallium, galliumTags);
101 if (pubscreen)
102 UnlockPubScreen(NULL, pubscreen);
104 if (!*driver)
106 char tmpname[128];
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));
128 return *driver;
130 AROS_LIBFUNC_EXIT