Lines Matching refs:device
51 static void kms_device_probe_screens(struct kms_device *device) in kms_device_probe_screens() argument
60 res = drmModeGetResources(device->fd); in kms_device_probe_screens()
64 device->screens = calloc(res->count_connectors, sizeof(screen)); in kms_device_probe_screens()
65 if (!device->screens) in kms_device_probe_screens()
73 screen = kms_screen_create(device, res->connectors[i]); in kms_device_probe_screens()
92 device->screens[i] = screen; in kms_device_probe_screens()
93 device->num_screens++; in kms_device_probe_screens()
100 static void kms_device_probe_crtcs(struct kms_device *device) in kms_device_probe_crtcs() argument
106 res = drmModeGetResources(device->fd); in kms_device_probe_crtcs()
110 device->crtcs = calloc(res->count_crtcs, sizeof(crtc)); in kms_device_probe_crtcs()
111 if (!device->crtcs) in kms_device_probe_crtcs()
115 crtc = kms_crtc_create(device, res->crtcs[i]); in kms_device_probe_crtcs()
119 device->crtcs[i] = crtc; in kms_device_probe_crtcs()
120 device->num_crtcs++; in kms_device_probe_crtcs()
127 static void kms_device_probe_planes(struct kms_device *device) in kms_device_probe_planes() argument
133 res = drmModeGetPlaneResources(device->fd); in kms_device_probe_planes()
137 device->planes = calloc(res->count_planes, sizeof(plane)); in kms_device_probe_planes()
138 if (!device->planes) in kms_device_probe_planes()
142 plane = kms_plane_create(device, res->planes[i]); in kms_device_probe_planes()
146 device->planes[i] = plane; in kms_device_probe_planes()
147 device->num_planes++; in kms_device_probe_planes()
154 static void kms_device_probe(struct kms_device *device) in kms_device_probe() argument
156 kms_device_probe_screens(device); in kms_device_probe()
157 kms_device_probe_crtcs(device); in kms_device_probe()
158 kms_device_probe_planes(device); in kms_device_probe()
163 struct kms_device *device; in kms_device_open() local
165 device = calloc(1, sizeof(*device)); in kms_device_open()
166 if (!device) in kms_device_open()
169 device->fd = fd; in kms_device_open()
171 kms_device_probe(device); in kms_device_open()
173 return device; in kms_device_open()
176 void kms_device_close(struct kms_device *device) in kms_device_close() argument
180 for (i = 0; i < device->num_planes; i++) in kms_device_close()
181 kms_plane_free(device->planes[i]); in kms_device_close()
183 free(device->planes); in kms_device_close()
185 for (i = 0; i < device->num_crtcs; i++) in kms_device_close()
186 kms_crtc_free(device->crtcs[i]); in kms_device_close()
188 free(device->crtcs); in kms_device_close()
190 for (i = 0; i < device->num_screens; i++) in kms_device_close()
191 kms_screen_free(device->screens[i]); in kms_device_close()
193 free(device->screens); in kms_device_close()
195 if (device->fd >= 0) in kms_device_close()
196 close(device->fd); in kms_device_close()
198 free(device); in kms_device_close()
201 struct kms_plane *kms_device_find_plane_by_type(struct kms_device *device, in kms_device_find_plane_by_type() argument
207 for (i = 0; i < device->num_planes; i++) { in kms_device_find_plane_by_type()
208 if (device->planes[i]->type == type) { in kms_device_find_plane_by_type()
210 return device->planes[i]; in kms_device_find_plane_by_type()