Home | History | Annotate | Download | only in xpr

Lines Matching refs:shared

752  * This creates a shared memory buffer for use with GLXPixmaps
759 DRIPixmapBufferPtr shared;
767 shared = malloc(sizeof(*shared));
768 if(NULL == shared) {
772 shared->pDrawable = pDrawable;
773 shared->refCount = 1;
776 shared->bytesPerPixel = 4;
778 shared->bytesPerPixel = 2;
781 shared->width = pDrawable->width;
782 shared->height = pDrawable->height;
784 if(-1 == snprintf(shared->shmPath, sizeof(shared->shmPath),
790 shared->fd = shm_open(shared->shmPath,
794 if(-1 == shared->fd) {
795 free(shared);
799 shared->length = shared->width * shared->height * shared->bytesPerPixel;
801 if(-1 == ftruncate(shared->fd, shared->length)) {
803 shm_unlink(shared->shmPath);
804 close(shared->fd);
805 free(shared);
809 shared->buffer = mmap(NULL, shared->length,
811 MAP_FILE | MAP_SHARED, shared->fd, 0);
813 if(MAP_FAILED == shared->buffer) {
814 ErrorF("failed to mmap shared memory.");
815 shm_unlink(shared->shmPath);
816 close(shared->fd);
817 free(shared);
821 strncpy(path, shared->shmPath, pathmax);
824 dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared);
835 DRIPixmapBufferPtr shared;
842 shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey);
844 if(NULL == shared)
847 assert(pDrawable->width == shared->width);
848 assert(pDrawable->height == shared->height);
850 *width = shared->width;
851 *height = shared->height;
852 *bpp = shared->bytesPerPixel;
853 *pitch = shared->width * shared->bytesPerPixel;
854 *ptr = shared->buffer;
861 DRIPixmapBufferPtr shared;
869 shared = dixLookupPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey);
871 if(NULL == shared)
874 close(shared->fd);
875 munmap(shared->buffer, shared->length);
876 shm_unlink(shared->shmPath);
877 free(shared);