Contents of /trunk/hal/patches/hal-0.5.10-linux-add-drm-subsystem.patch
Parent Directory | Revision Log
Revision 597 -
(show annotations)
(download)
Mon May 19 19:05:19 2008 UTC (16 years, 4 months ago) by niro
File size: 5106 byte(s)
Mon May 19 19:05:19 2008 UTC (16 years, 4 months ago) by niro
File size: 5106 byte(s)
-gentoo patches
1 | From 131d4822b9fb081fb1b9768c00cefeef09fac032 Mon Sep 17 00:00:00 2001 |
2 | From: Danny Kukawka <danny.kukawka@web.de> |
3 | Date: Thu, 6 Dec 2007 09:59:01 +0100 |
4 | Subject: [PATCH] linux: add drm subsystem |
5 | |
6 | Add the drm (Direct Rendering Manager devices) subsystem to HAL. This |
7 | should allow to get the device file of the dri devices, which allows to set |
8 | ACL permissions via HAL on them. |
9 | --- |
10 | doc/spec/hal-spec-properties.xml | 33 +++++++++++++++++++ |
11 | hald/linux/device.c | 64 ++++++++++++++++++++++++++++++++++++++ |
12 | 2 files changed, 97 insertions(+), 0 deletions(-) |
13 | |
14 | diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml |
15 | index 4234e8d..75cad45 100644 |
16 | --- a/doc/spec/hal-spec-properties.xml |
17 | +++ b/doc/spec/hal-spec-properties.xml |
18 | @@ -2747,6 +2747,39 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} |
19 | </informaltable> |
20 | </sect2> |
21 | |
22 | + <sect2 id="device-properties-drm"> |
23 | + <title>drm namespace</title> |
24 | + <para> |
25 | + The <literal>drm</literal> namespace is present for Direct Rendering Manager device objects. |
26 | + They represent a Direct Rendering Interface. |
27 | + </para> |
28 | + <informaltable> |
29 | + <tgroup cols="2"> |
30 | + <thead> |
31 | + <row> |
32 | + <entry>Key (type)</entry> |
33 | + <entry>Values</entry> |
34 | + <entry>Mandatory</entry> |
35 | + <entry>Description</entry> |
36 | + </row> |
37 | + </thead> |
38 | + <tbody> |
39 | + <row> |
40 | + <entry><literal>drm.dri_library</literal> (string)</entry> |
41 | + <entry></entry> |
42 | + <entry>Yes</entry> |
43 | + <entry>Name of the dri (Direct Rendering Interface) library (e.g. i915).</entry> |
44 | + </row> |
45 | + <row> |
46 | + <entry><literal>drm.version</literal> (string)</entry> |
47 | + <entry></entry> |
48 | + <entry>Yes</entry> |
49 | + <entry>The drm version (of the kernel module/diver).</entry> |
50 | + </row> |
51 | + </tbody> |
52 | + </tgroup> |
53 | + </informaltable> |
54 | + </sect2> |
55 | </sect1> |
56 | |
57 | <sect1 id="properties-functional"> |
58 | diff --git a/hald/linux/device.c b/hald/linux/device.c |
59 | index 2e68378..a59107f 100644 |
60 | --- a/hald/linux/device.c |
61 | +++ b/hald/linux/device.c |
62 | @@ -3301,6 +3301,61 @@ power_supply_compute_udi (HalDevice *d) |
63 | /*--------------------------------------------------------------------------------------------------------------*/ |
64 | |
65 | static HalDevice * |
66 | +drm_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path) |
67 | +{ |
68 | + HalDevice *d = NULL; |
69 | + |
70 | + d = hal_device_new (); |
71 | + |
72 | + hal_device_add_capability (d, "drm"); |
73 | + |
74 | + if (parent_dev != NULL) { |
75 | + hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev)); |
76 | + hal_device_copy_property( parent_dev, "info.vendor", d, "info.vendor"); |
77 | + } else { |
78 | + hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer"); |
79 | + } |
80 | + |
81 | + hal_device_property_set_string (d, "info.product", "Direct Rendering Manager Device"); |
82 | + hal_device_property_set_string (d, "info.category", "drm"); |
83 | + hal_device_property_set_string (d, "linux.device_file", device_file); |
84 | + hal_device_property_set_string (d, "linux.subsystem", "drm"); |
85 | + hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path); |
86 | + |
87 | + hal_util_set_driver (d, "info.linux.driver", sysfs_path); /* not sure if this is needed/set */ |
88 | + hal_util_set_string_from_file (d, "drm.dri_library", sysfs_path, "dri_library_name"); |
89 | + hal_util_set_string_from_file (d, "drm.version", sysfs_path, "../version"); |
90 | + |
91 | + return d; |
92 | +} |
93 | + |
94 | +static gboolean |
95 | +drm_compute_udi (HalDevice *d) |
96 | +{ |
97 | + gchar udi[256]; |
98 | + const char *dir; |
99 | + const char *name; |
100 | + |
101 | + dir = hal_device_property_get_string (d, "linux.sysfs_path"); |
102 | + |
103 | + name = hal_util_get_last_element(dir); |
104 | + |
105 | + /* generate e.g.: /org/freedesktop/Hal/devices/pci_8086_2a02_drm_i915_card0 */ |
106 | + hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi), |
107 | + "%s_drm_%s_%s", |
108 | + hal_device_property_get_string (d, "info.parent"), |
109 | + hal_device_property_get_string (d, "drm.dri_library"), |
110 | + name); |
111 | + |
112 | + hal_device_set_udi (d, udi); |
113 | + hal_device_property_set_string (d, "info.udi", udi); |
114 | + |
115 | + return TRUE; |
116 | +} |
117 | + |
118 | +/*--------------------------------------------------------------------------------------------------------------*/ |
119 | + |
120 | +static HalDevice * |
121 | pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path) |
122 | { |
123 | HalDevice *d; |
124 | @@ -3637,6 +3692,14 @@ static DevHandler dev_handler_power_supply = |
125 | .remove = dev_remove |
126 | }; |
127 | |
128 | +static DevHandler dev_handler_drm = |
129 | +{ |
130 | + .subsystem = "drm", |
131 | + .add = drm_add, |
132 | + .compute_udi = drm_compute_udi, |
133 | + .remove = dev_remove |
134 | +}; |
135 | + |
136 | /* SCSI debug, to test thousends of fake devices */ |
137 | static DevHandler dev_handler_pseudo = { |
138 | .subsystem = "pseudo", |
139 | @@ -3680,6 +3743,7 @@ static DevHandler *dev_handlers[] = { |
140 | &dev_handler_backlight, |
141 | &dev_handler_firewire, |
142 | &dev_handler_power_supply, |
143 | + &dev_handler_drm, |
144 | NULL |
145 | }; |
146 | |
147 | -- |
148 | 1.5.3.7 |
149 |