Lines Matching refs:device

55 static void kms_device_probe_screens(struct kms_device *device)  in kms_device_probe_screens()  argument
64 res = drmModeGetResources(device->fd); in kms_device_probe_screens()
68 device->screens = calloc(res->count_connectors, sizeof(screen)); in kms_device_probe_screens()
69 if (!device->screens) in kms_device_probe_screens()
77 screen = kms_screen_create(device, res->connectors[i]); in kms_device_probe_screens()
96 device->screens[i] = screen; in kms_device_probe_screens()
97 device->num_screens++; in kms_device_probe_screens()
103 static void kms_device_probe_crtcs(struct kms_device *device) in kms_device_probe_crtcs() argument
109 res = drmModeGetResources(device->fd); in kms_device_probe_crtcs()
113 device->crtcs = calloc(res->count_crtcs, sizeof(crtc)); in kms_device_probe_crtcs()
114 if (!device->crtcs) in kms_device_probe_crtcs()
118 crtc = kms_crtc_create(device, res->crtcs[i]); in kms_device_probe_crtcs()
122 device->crtcs[i] = crtc; in kms_device_probe_crtcs()
123 device->num_crtcs++; in kms_device_probe_crtcs()
129 static void kms_device_probe_planes(struct kms_device *device) in kms_device_probe_planes() argument
135 res = drmModeGetPlaneResources(device->fd); in kms_device_probe_planes()
139 device->planes = calloc(res->count_planes, sizeof(plane)); in kms_device_probe_planes()
140 if (!device->planes) in kms_device_probe_planes()
144 plane = kms_plane_create(device, res->planes[i]); in kms_device_probe_planes()
148 device->planes[i] = plane; in kms_device_probe_planes()
149 device->num_planes++; in kms_device_probe_planes()
155 static void kms_device_probe(struct kms_device *device) in kms_device_probe() argument
157 kms_device_probe_screens(device); in kms_device_probe()
158 kms_device_probe_crtcs(device); in kms_device_probe()
159 kms_device_probe_planes(device); in kms_device_probe()
164 struct kms_device *device; in kms_device_open() local
166 device = calloc(1, sizeof(*device)); in kms_device_open()
167 if (!device) in kms_device_open()
170 device->fd = fd; in kms_device_open()
172 kms_device_probe(device); in kms_device_open()
174 return device; in kms_device_open()
177 void kms_device_close(struct kms_device *device) in kms_device_close() argument
181 for (i = 0; i < device->num_planes; i++) in kms_device_close()
182 kms_plane_free(device->planes[i]); in kms_device_close()
184 free(device->planes); in kms_device_close()
186 for (i = 0; i < device->num_crtcs; i++) in kms_device_close()
187 kms_crtc_free(device->crtcs[i]); in kms_device_close()
189 free(device->crtcs); in kms_device_close()
191 for (i = 0; i < device->num_screens; i++) in kms_device_close()
192 kms_screen_free(device->screens[i]); in kms_device_close()
194 free(device->screens); in kms_device_close()
196 if (device->fd >= 0) in kms_device_close()
197 close(device->fd); in kms_device_close()
199 free(device); in kms_device_close()
202 struct kms_plane *kms_device_find_plane_by_type(struct kms_device *device, in kms_device_find_plane_by_type() argument
208 for (i = 0; i < device->num_planes; i++) { in kms_device_find_plane_by_type()
209 if (device->planes[i]->type == type) { in kms_device_find_plane_by_type()
211 return device->planes[i]; in kms_device_find_plane_by_type()