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