Lines Matching refs:surface
27 * A 'free' surface is one that is not allocated on the device. These
30 * A 'live' surface is one that the X server is using for something. It
34 * A 'dead' surface is one that the X server is no using any more, but
39 * A 'destroyed' surface is one whose ref count has reached 0. It is no
41 * When a surface enters this state, the associated pixman images are freed, and
43 * which puts the surface into the 'free' state.
80 * All surfaces, excluding the primary one, indexed by surface id.
101 surface_log = fopen("/tmp/xf86-video-qxl.surface.log", "w+");
104 fprintf(stderr, "error creating surface log file (DEBUG_SURFACE_LIFECYCLE)\n");
109 static int surface_count(qxl_surface_t *surface)
113 for (i = 0; surface ;++i, surface = surface->next);
169 if (i) /* surface 0 is the primary surface */
211 ErrorF ("Surface %p has pixmap %p, but pixmap %p has surface %p\n",
272 qxl_surface_t *surface = cache->all_surfaces + id;
275 if (surface->bo)
276 cache->qxl->bo_funcs->bo_decref (cache->qxl, surface->bo);
277 surface->bo = NULL;
278 surface->next = cache->free_surfaces;
279 cache->free_surfaces = surface;
295 qxl_surface_t *surface;
333 surface = malloc (sizeof *surface);
334 surface->id = 0;
335 surface->dev_image = dev_image;
336 surface->host_image = host_image;
337 surface->cache = cache;
338 surface->qxl = qxl;
339 surface->bpp = mode->bits;
340 surface->next = NULL;
341 surface->prev = NULL;
342 surface->evacuated = NULL;
343 surface->bo = bo;
344 surface->image_bo = NULL;
346 REGION_INIT (NULL, &(surface->access_region), (BoxPtr)NULL, 0);
347 surface->access_type = UXA_ACCESS_RO;
349 return surface;
353 qxl_surface_get_host_bits(qxl_surface_t *surface)
355 if (!surface)
357 return (void *) pixman_image_get_data(surface->host_image);
370 cmd_bo = qxl->bo_funcs->cmd_alloc (qxl, sizeof *cmd, "surface command");
440 qxl_surface_t *surface;
482 surface = surface_get_from_free_list (cache);
483 if (!surface)
495 surface->bo = bo;
497 cmd_bo = make_surface_cmd (cache, surface->id, QXL_SURFACE_CMD_CREATE);
506 qxl->bo_funcs->bo_output_bo_reloc(qxl, offsetof(struct QXLSurfaceCmd, u.surface_create.data), cmd_bo, surface->bo);
510 dev_ptr = qxl->bo_funcs->bo_map(surface->bo);
514 surface->dev_image = pixman_image_create_bits (
517 surface->host_image = pixman_image_create_bits (
520 qxl->bo_funcs->bo_unmap(surface->bo);
521 surface->bpp = bpp;
525 return surface;
534 qxl_surface_t *surface;
572 if (!(surface = surface_get_from_cache (cache, width, height, bpp)))
573 if (!(surface = surface_send_create (cache, width, height, bpp)))
576 surface->next = cache->live_surfaces;
577 surface->prev = NULL;
579 cache->live_surfaces->prev = surface;
580 cache->live_surfaces = surface;
582 return surface;
586 qxl_surface_set_pixmap (qxl_surface_t *surface, PixmapPtr pixmap)
588 surface->pixmap = pixmap;
590 assert (get_surface (pixmap) == surface);
594 unlink_surface (qxl_surface_t *surface)
596 if (surface->id != 0)
598 if (surface->prev)
599 surface->prev->next = surface->next;
601 surface->cache->live_surfaces = surface->next;
604 debug_surface_log(surface->cache);
606 if (surface->next)
607 surface->next->prev = surface->prev;
609 surface->pixmap = NULL;
611 surface->prev = NULL;
612 surface->next = NULL;
616 surface_destroy (qxl_surface_t *surface)
620 if (surface->dev_image)
621 pixman_image_unref (surface->dev_image);
622 if (surface->host_image)
623 pixman_image_unref (surface->host_image);
626 ErrorF("destroy %ld\n", (long int)surface->end - (long int)surface->address);
628 cmd_bo = make_surface_cmd (surface->cache, surface->id, QXL_SURFACE_CMD_DESTROY);
630 push_surface_cmd (surface->cache, cmd_bo);
632 surface->cache->qxl->bo_funcs->bo_decref(surface->cache->qxl, surface->bo);
636 surface_add_to_cache (qxl_surface_t *surface)
638 surface_cache_t *cache = surface->cache;
645 surface->ref_count++;
692 cache->cached_surfaces[i + delta] = surface;
710 qxl_surface_t *surface = cache->all_surfaces + id;
712 if (--surface->ref_count == 0)
713 surface_destroy (surface);
718 qxl_surface_kill (qxl_surface_t *surface)
720 struct evacuated_surface_t *ev = surface->evacuated;
724 /* server side surface is already destroyed (via reset), don't
725 * resend a destroy. Just mark surface as not to be recreated */
734 surface->evacuated = NULL;
738 unlink_surface (surface);
740 if (!surface->cache->all_surfaces) {
744 if (surface->id != 0 &&
745 surface->host_image &&
746 pixman_image_get_width (surface->host_image) >= 128 &&
747 pixman_image_get_height (surface->host_image) >= 128)
749 surface_add_to_cache (surface);
752 qxl_surface_unref (surface->cache, surface->id);
828 qxl_surface_t *surface;
830 surface = qxl_surface_create (cache->qxl, width, height, ev->bpp);
832 assert (surface->host_image);
833 assert (surface->dev_image);
835 pixman_image_unref (surface->host_image);
836 surface->host_image = ev->image;
838 qxl_upload_box (surface, 0, 0, width, height);
840 set_surface (ev->pixmap, surface);
842 qxl_surface_set_pixmap (surface, ev->pixmap);