Lines Matching refs:shared

685     DRIPixmapBufferPtr shared;  in DRICreatePixmap()  local
693 shared = malloc(sizeof(*shared)); in DRICreatePixmap()
694 if (NULL == shared) { in DRICreatePixmap()
698 shared->pDrawable = pDrawable; in DRICreatePixmap()
699 shared->refCount = 1; in DRICreatePixmap()
702 shared->bytesPerPixel = 4; in DRICreatePixmap()
705 shared->bytesPerPixel = 2; in DRICreatePixmap()
708 shared->width = pDrawable->width; in DRICreatePixmap()
709 shared->height = pDrawable->height; in DRICreatePixmap()
711 if (-1 == snprintf(shared->shmPath, sizeof(shared->shmPath), in DRICreatePixmap()
717 shared->fd = shm_open(shared->shmPath, in DRICreatePixmap()
721 if (-1 == shared->fd) { in DRICreatePixmap()
722 free(shared); in DRICreatePixmap()
726 shared->length = shared->width * shared->height * shared->bytesPerPixel; in DRICreatePixmap()
728 if (-1 == ftruncate(shared->fd, shared->length)) { in DRICreatePixmap()
730 shm_unlink(shared->shmPath); in DRICreatePixmap()
731 close(shared->fd); in DRICreatePixmap()
732 free(shared); in DRICreatePixmap()
736 shared->buffer = mmap(NULL, shared->length, in DRICreatePixmap()
738 MAP_FILE | MAP_SHARED, shared->fd, 0); in DRICreatePixmap()
740 if (MAP_FAILED == shared->buffer) { in DRICreatePixmap()
742 shm_unlink(shared->shmPath); in DRICreatePixmap()
743 close(shared->fd); in DRICreatePixmap()
744 free(shared); in DRICreatePixmap()
748 strlcpy(path, shared->shmPath, pathmax); in DRICreatePixmap()
750 dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared); in DRICreatePixmap()
762 DRIPixmapBufferPtr shared; in DRIGetPixmapData() local
769 shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); in DRIGetPixmapData()
771 if (NULL == shared) in DRIGetPixmapData()
774 assert(pDrawable->width == shared->width); in DRIGetPixmapData()
775 assert(pDrawable->height == shared->height); in DRIGetPixmapData()
777 *width = shared->width; in DRIGetPixmapData()
778 *height = shared->height; in DRIGetPixmapData()
779 *bpp = shared->bytesPerPixel; in DRIGetPixmapData()
780 *pitch = shared->width * shared->bytesPerPixel; in DRIGetPixmapData()
781 *ptr = shared->buffer; in DRIGetPixmapData()
789 DRIPixmapBufferPtr shared; in DRIFreePixmapImp() local
797 shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey); in DRIFreePixmapImp()
799 if (NULL == shared) in DRIFreePixmapImp()
802 close(shared->fd); in DRIFreePixmapImp()
803 munmap(shared->buffer, shared->length); in DRIFreePixmapImp()
804 shm_unlink(shared->shmPath); in DRIFreePixmapImp()
805 free(shared); in DRIFreePixmapImp()