Lines Matching refs:d
105 drawable_unlock(struct apple_glx_drawable *d) in drawable_unlock() argument
109 err = pthread_mutex_unlock(&d->mutex); in drawable_unlock()
119 reference_drawable(struct apple_glx_drawable *d) in reference_drawable() argument
121 d->lock(d); in reference_drawable()
122 d->reference_count++; in reference_drawable()
123 d->unlock(d); in reference_drawable()
127 release_drawable(struct apple_glx_drawable *d) in release_drawable() argument
129 d->lock(d); in release_drawable()
130 d->reference_count--; in release_drawable()
131 d->unlock(d); in release_drawable()
137 destroy_drawable(struct apple_glx_drawable *d) in destroy_drawable() argument
141 d->lock(d); in destroy_drawable()
143 if (d->reference_count > 0) { in destroy_drawable()
144 d->unlock(d); in destroy_drawable()
148 d->unlock(d); in destroy_drawable()
150 if (d->previous) { in destroy_drawable()
151 d->previous->next = d->next; in destroy_drawable()
158 drawables_list = d->next; in destroy_drawable()
161 if (d->next) in destroy_drawable()
162 d->next->previous = d->previous; in destroy_drawable()
166 if (d->callbacks.destroy) { in destroy_drawable()
172 d->callbacks.destroy(d->display, d); in destroy_drawable()
175 apple_glx_diagnostic("%s: freeing %p\n", __func__, (void *) d); in destroy_drawable()
178 while (pthread_mutex_unlock(&d->mutex) == 0); in destroy_drawable()
180 err = pthread_mutex_destroy(&d->mutex); in destroy_drawable()
186 free(d); in destroy_drawable()
199 destroy_drawable_callback(struct apple_glx_drawable *d) in destroy_drawable_callback() argument
203 d->lock(d); in destroy_drawable_callback()
206 (void *) d, d->reference_count); in destroy_drawable_callback()
208 d->reference_count--; in destroy_drawable_callback()
210 if (d->reference_count > 0) { in destroy_drawable_callback()
211 d->unlock(d); in destroy_drawable_callback()
215 d->unlock(d); in destroy_drawable_callback()
219 result = destroy_drawable(d); in destroy_drawable_callback()
227 is_pbuffer(struct apple_glx_drawable *d) in is_pbuffer() argument
229 return APPLE_GLX_DRAWABLE_PBUFFER == d->type; in is_pbuffer()
233 is_pixmap(struct apple_glx_drawable *d) in is_pixmap() argument
235 return APPLE_GLX_DRAWABLE_PIXMAP == d->type; in is_pixmap()
239 common_init(Display * dpy, GLXDrawable drawable, struct apple_glx_drawable *d) in common_init() argument
244 d->display = dpy; in common_init()
245 d->reference_count = 0; in common_init()
246 d->drawable = drawable; in common_init()
247 d->type = -1; in common_init()
268 err = pthread_mutex_init(&d->mutex, &attr); in common_init()
277 d->lock = drawable_lock; in common_init()
278 d->unlock = drawable_unlock; in common_init()
280 d->reference = reference_drawable; in common_init()
281 d->release = release_drawable; in common_init()
283 d->destroy = destroy_drawable_callback; in common_init()
285 d->is_pbuffer = is_pbuffer; in common_init()
286 d->is_pixmap = is_pixmap; in common_init()
288 d->width = -1; in common_init()
289 d->height = -1; in common_init()
290 d->row_bytes = 0; in common_init()
291 d->path[0] = '\0'; in common_init()
292 d->fd = -1; in common_init()
293 d->buffer = NULL; in common_init()
294 d->buffer_length = 0; in common_init()
296 d->previous = NULL; in common_init()
297 d->next = NULL; in common_init()
324 struct apple_glx_drawable *d; in apple_glx_drawable_create() local
326 d = calloc(1, sizeof *d); in apple_glx_drawable_create()
328 if (NULL == d) { in apple_glx_drawable_create()
333 common_init(dpy, drawable, d); in apple_glx_drawable_create()
334 d->type = callbacks->type; in apple_glx_drawable_create()
335 d->callbacks = *callbacks; in apple_glx_drawable_create()
337 d->reference(d); in apple_glx_drawable_create()
338 d->lock(d); in apple_glx_drawable_create()
340 link_tail(d); in apple_glx_drawable_create()
342 apple_glx_diagnostic("%s: new drawable %p\n", __func__, (void *) d); in apple_glx_drawable_create()
344 *agdResult = d; in apple_glx_drawable_create()
364 struct apple_glx_drawable *d, *dnext; in apple_glx_garbage_collect_drawables() local
380 for (d = drawables_list; d;) { in apple_glx_garbage_collect_drawables()
381 dnext = d->next; in apple_glx_garbage_collect_drawables()
383 d->lock(d); in apple_glx_garbage_collect_drawables()
385 if (d->reference_count > 0) { in apple_glx_garbage_collect_drawables()
390 d->unlock(d); in apple_glx_garbage_collect_drawables()
391 d = dnext; in apple_glx_garbage_collect_drawables()
395 d->unlock(d); in apple_glx_garbage_collect_drawables()
404 XGetGeometry(dpy, d->drawable, &root, &x, &y, &width, &height, &bd, in apple_glx_garbage_collect_drawables()
413 (void) destroy_drawable(d); in apple_glx_garbage_collect_drawables()
417 d = dnext; in apple_glx_garbage_collect_drawables()
429 struct apple_glx_drawable *d; in apple_glx_get_drawable_count() local
433 for (d = drawables_list; d; d = d->next) in apple_glx_get_drawable_count()
444 struct apple_glx_drawable *d; in apple_glx_drawable_find_by_type() local
448 for (d = drawables_list; d; d = d->next) { in apple_glx_drawable_find_by_type()
449 if (d->type == type && d->drawable == drawable) { in apple_glx_drawable_find_by_type()
451 d->reference(d); in apple_glx_drawable_find_by_type()
454 d->lock(d); in apple_glx_drawable_find_by_type()
458 return d; in apple_glx_drawable_find_by_type()
470 struct apple_glx_drawable *d; in apple_glx_drawable_find() local
474 for (d = drawables_list; d; d = d->next) { in apple_glx_drawable_find()
475 if (d->drawable == drawable) { in apple_glx_drawable_find()
477 d->reference(d); in apple_glx_drawable_find()
480 d->lock(d); in apple_glx_drawable_find()
484 return d; in apple_glx_drawable_find()
498 struct apple_glx_drawable *d; in apple_glx_drawable_destroy_by_type() local
502 for (d = drawables_list; d; d = d->next) { in apple_glx_drawable_destroy_by_type()
503 if (drawable == d->drawable && type == d->type) { in apple_glx_drawable_destroy_by_type()
510 d->release(d); in apple_glx_drawable_destroy_by_type()
513 __func__, d->reference_count); in apple_glx_drawable_destroy_by_type()
515 destroy_drawable(d); in apple_glx_drawable_destroy_by_type()
529 struct apple_glx_drawable *d; in apple_glx_drawable_find_by_uid() local
533 for (d = drawables_list; d; d = d->next) { in apple_glx_drawable_find_by_uid()
535 if (APPLE_GLX_DRAWABLE_SURFACE == d->type) { in apple_glx_drawable_find_by_uid()
536 if (d->types.surface.uid == uid) { in apple_glx_drawable_find_by_uid()
538 d->reference(d); in apple_glx_drawable_find_by_uid()
541 d->lock(d); in apple_glx_drawable_find_by_uid()
545 return d; in apple_glx_drawable_find_by_uid()