aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86platformBus.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:00:38 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:00:38 +0200
commitd0c30e7945e76ac119f6d867e27137c8a76f7e15 (patch)
tree1bfb3148a6f43bdd32746c5b882f9f083076cf91 /xorg-server/hw/xfree86/common/xf86platformBus.h
parente708bebcc029873004ade4241f347ce8c58896af (diff)
downloadvcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.tar.gz
vcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.tar.bz2
vcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.zip
fontconfig plink libX11 libxcb mesa git update 19 July 2014
plink revision 10207 xserver commit cfa302d6224d10860e60491333950544c4fb9b04 libxcb commit 49a61c8b459ab19c7f39e653bbb0d0339ea8f00f libX11 commit 5525e8433f93bce464412f27cffa203ea628f368 fontconfig commit 6781c6baef062eeea5b5b68e4a9c31ea6cd7539b mesa commit f6fc80734533140a69b30361fe0d4773a03515db
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86platformBus.h')
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.h104
1 files changed, 91 insertions, 13 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.h b/xorg-server/hw/xfree86/common/xf86platformBus.h
index 5dee4e0e0..317dd24d5 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.h
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.h
@@ -45,31 +45,109 @@ int xf86platformProbeDev(DriverPtr drvp);
extern int xf86_num_platform_devices;
extern struct xf86_platform_device *xf86_platform_devices;
-extern char *
-xf86_get_platform_attrib(int index, int attrib_id);
-extern int
-xf86_get_platform_int_attrib(int index, int attrib_id, int def);
extern int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
extern int
xf86_remove_platform_device(int dev_index);
extern Bool
xf86_get_platform_device_unowned(int index);
-/* Note starting with xserver 1.16 these 2 functions never fail */
-extern Bool
-xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str);
-extern Bool
-xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value);
extern int
xf86platformAddDevice(int index);
extern void
xf86platformRemoveDevice(int index);
-extern _X_EXPORT char *
-xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id);
-extern _X_EXPORT int
-xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def);
+static inline struct OdevAttributes *
+xf86_platform_device_odev_attributes(struct xf86_platform_device *device)
+{
+ return device->attribs;
+}
+
+static inline struct OdevAttributes *
+xf86_platform_odev_attributes(int index)
+{
+ struct xf86_platform_device *device = &xf86_platform_devices[index];
+
+ return device->attribs;
+}
+
+#ifndef _XORG_CONFIG_H_
+/*
+ * Define the legacy API only for external builds
+ */
+
+/* path to kernel device node - Linux e.g. /dev/dri/card0 */
+#define ODEV_ATTRIB_PATH 1
+/* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
+#define ODEV_ATTRIB_SYSPATH 2
+/* DRI-style bus id */
+#define ODEV_ATTRIB_BUSID 3
+/* Server managed FD */
+#define ODEV_ATTRIB_FD 4
+/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MAJOR 5
+/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MINOR 6
+/* kernel driver name */
+#define ODEV_ATTRIB_DRIVER 7
+
+/* Protect against a mismatch attribute type by generating a compiler
+ * error using a negative array size when an incorrect attribute is
+ * passed
+ */
+
+#define _ODEV_ATTRIB_IS_STRING(x) ((x) == ODEV_ATTRIB_PATH || \
+ (x) == ODEV_ATTRIB_SYSPATH || \
+ (x) == ODEV_ATTRIB_BUSID || \
+ (x) == ODEV_ATTRIB_DRIVER)
+
+#define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0)
+
+static inline char *
+_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_PATH:
+ return xf86_platform_device_odev_attributes(device)->path;
+ case ODEV_ATTRIB_SYSPATH:
+ return xf86_platform_device_odev_attributes(device)->syspath;
+ case ODEV_ATTRIB_BUSID:
+ return xf86_platform_device_odev_attributes(device)->busid;
+ case ODEV_ATTRIB_DRIVER:
+ return xf86_platform_device_odev_attributes(device)->driver;
+ default:
+ assert(FALSE);
+ return NULL;
+ }
+}
+
+#define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib))
+
+#define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR)
+#define _ODEV_ATTRIB_INT_DEFAULT(x) ((x) == ODEV_ATTRIB_FD ? -1 : 0)
+#define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def))
+#define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0)
+
+static inline int
+_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_FD:
+ return xf86_platform_device_odev_attributes(device)->fd;
+ case ODEV_ATTRIB_MAJOR:
+ return xf86_platform_device_odev_attributes(device)->major;
+ case ODEV_ATTRIB_MINOR:
+ return xf86_platform_device_odev_attributes(device)->minor;
+ default:
+ assert(FALSE);
+ return 0;
+ }
+}
+
+#define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def))
+
+#endif
+
extern _X_EXPORT Bool
xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid);