Use the new name for the IntelGMA HIDD, allowing hardware 3D with that
[AROS.git] / workbench / libs / gallium / gallium_func.c
bloba31a3c78ead8397f65057575e195659ec27de712
1 /*
2 Copyright 2010-2016, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "gallium_intern.h"
7 #include <proto/oop.h>
8 #include <aros/debug.h>
10 #undef HiddGalliumAttrBase
11 #define HiddGalliumAttrBase GB(GalliumBase)->galliumAttrBase
13 BOOL IsVersionMatching(ULONG version, OOP_Object * driver, struct Library * GalliumBase)
15 IPTR galliuminterfaceversion = 0;
17 if ((!driver) || (!GalliumBase))
18 return FALSE;
20 OOP_GetAttr(driver, aHidd_Gallium_GalliumInterfaceVersion, &galliuminterfaceversion);
22 return (version == (ULONG)galliuminterfaceversion);
25 OOP_Object * SelectGalliumDriver(ULONG requestedinterfaceversion, struct Library * GalliumBase)
27 OOP_Object * driver = NULL;
29 /* 1. Let's see if we can create hidd.gallium.nouveau object. This will
30 only work if the nouveau.hidd is actually loaded and used */
31 driver = OOP_NewObject(NULL, "hidd.gallium.nouveau", NULL);
32 if (driver)
34 if (IsVersionMatching(requestedinterfaceversion, driver, GalliumBase))
35 return driver;
36 else
38 /* Failed version check */
39 OOP_DisposeObject(driver);
40 driver = NULL;
44 /* 2. Nouveau fails, try the next best... */
45 driver = OOP_NewObject(NULL, "hidd.gallium.intelgma", NULL);
46 if (driver)
48 if (IsVersionMatching(requestedinterfaceversion, driver, GalliumBase)){
49 return driver;
51 else
53 /* Failed version check */
54 OOP_DisposeObject(driver);
55 driver = NULL;
59 /* 3. Everything else failed. Let's try loading softpipe */
60 if (!GB(GalliumBase)->drivermodule)
61 GB(GalliumBase)->drivermodule = OpenLibrary("softpipe.hidd", 9);
63 if (GB(GalliumBase)->drivermodule)
65 driver = OOP_NewObject(NULL, "hidd.gallium.softpipe", NULL);
66 if (driver)
68 if (IsVersionMatching(requestedinterfaceversion, driver, GalliumBase))
69 return driver;
70 else
72 /* Failed version check */
73 OOP_DisposeObject(driver);
74 driver = NULL;
78 /* Failed. Close library */
79 CloseLibrary(GB(GalliumBase)->drivermodule);
80 GB(GalliumBase)->drivermodule = NULL;
83 return NULL;