2 Copyright © 2010-2013, The AROS Development Team. All rights reserved.
6 #include "gallium_intern.h"
7 #include <proto/utility.h>
8 #include <aros/debug.h>
10 #undef HiddGalliumAttrBase
11 #define HiddGalliumAttrBase GB(GalliumBase)->galliumAttrBase
13 /*****************************************************************************
17 AROS_LH1(struct pipe_screen
*, CreatePipeScreen
,
20 AROS_LHA(struct TagItem
*, tags
, A0
),
23 struct Library
*, GalliumBase
, 5, Gallium
)
26 Creates a gallium pipe screen.
29 tags - a pointer to tags to be used during creation.
32 CPS_GalliumInterfaceVersion - Indicates a version of gallium interface
33 that a client is expected to receive. The client expected version
34 must ideally match with the version that the driver provides,
35 because gallium interface is not backwards compatible. This tag is
36 required. Unless otherwise needed, the value
37 GALLIUM_INTERFACE_VERSION should be passed.
38 See also CreatePipeScreenV.
41 A valid pipe screen instance or NULL if creation was not successful.
47 *****************************************************************************/
51 struct pipe_screen
* screen
= NULL
;
52 LONG requestedinterfaceversion
=
53 GetTagData(CPS_GalliumInterfaceVersion
, -1, tags
);
55 /* The tag is missing */
56 if (requestedinterfaceversion
== -1)
59 ObtainSemaphore(&GB(GalliumBase
)->driversemaphore
);
61 if (!GB(GalliumBase
)->driver
)
62 GB(GalliumBase
)->driver
= SelectGalliumDriver(requestedinterfaceversion
, GalliumBase
);
64 if(GB(GalliumBase
)->driver
)
66 /* Validate driver gallium interface version */
67 if (IsVersionMatching(requestedinterfaceversion
, GB(GalliumBase
)->driver
, GalliumBase
))
70 struct pHidd_Gallium_CreatePipeScreen cpsmsg
;
72 cpsmsg
.mID
= OOP_GetMethodID(IID_Hidd_Gallium
, moHidd_Gallium_CreatePipeScreen
);
73 screen
= (struct pipe_screen
*)OOP_DoMethod(GB(GalliumBase
)->driver
, (OOP_Msg
)&cpsmsg
);
77 bug("[gallium.library] Requested gallium interface version does not match selected driver\n");
82 bug("[gallium.library] Failed to acquire a driver\n");
85 ReleaseSemaphore(&GB(GalliumBase
)->driversemaphore
);