From 24c05a4db9ad398139de8d660347513b301aa911 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:34 +1000 Subject: Remove unnecessary PowerVR helper functions The cross-process memory sharing code never really worked in the way we needed it to - so remove it until something better comes along. Reviewed-by: trustme Back port of 04648b44f0784223122a782320d0b09b5c1e9497 --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 60 ---------------------- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 15 ------ 2 files changed, 75 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index c1b655a5b1..17345a9983 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -828,63 +828,3 @@ void pvrQwsSetSwapFunction drawable->swapFunction = func; drawable->userData = userData; } - -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable) -{ - unsigned long addr; - unsigned long start; - unsigned long end; - unsigned long off; - unsigned long offset; - FILE *file; - char buffer[BUFSIZ]; - char flags[16]; - - if (!drawable->backBuffersValid) - return 0; - addr = (unsigned long) - (drawable->backBuffers[drawable->currentBackBuffer]->pBase); - - /* Search /proc/self/maps for the memory region that contains "addr". - The file offset for that memory region is the identifier we need */ - file = fopen("/proc/self/maps", "r"); - if (!file) { - perror("/proc/self/maps"); - return 0; - } - offset = 0; - while (fgets(buffer, sizeof(buffer), file)) { - if (sscanf(buffer, "%lx-%lx %s %lx", - &start, &end, flags, &off) < 4) - continue; - if (start <= addr && addr < end) { - offset = off; - break; - } - } - fclose(file); - return offset; -} - -void *pvrQwsMapMemory(unsigned long id, int size) -{ - void *addr; - int fd = open("/dev/pvrsrv", O_RDWR, 0); - if (fd < 0) { - perror("/dev/pvrsrv"); - return 0; - } - addr = mmap(0, (size_t)size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, (off_t)id); - if (addr == (void *)(-1)) { - perror("mmap pvr memory region"); - addr = 0; - } - close(fd); - return addr; -} - -void pvrQwsUnmapMemory(void *addr, int size) -{ - munmap(addr, size); -} diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index b9e035f084..55e031002c 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -162,21 +162,6 @@ int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly); void pvrQwsSetSwapFunction (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData); -/* Get a memory identifier for the indicated drawable's buffer. - The identifier can be passed to another process and then - passed to pvrQwsMapMemory() to map the drawable's buffer into - the other process's address space. Returns zero if the - memory identifier could not be determined. This should only - be used for pixmap drawables */ -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable); - -/* Map the memory buffer of a foreign application's drawable, as - indicated by "id" and "size". Returns null if the map failed */ -void *pvrQwsMapMemory(unsigned long id, int size); - -/* Unmap the memory obtained from pvrQwsMapMemory() */ -void pvrQwsUnmapMemory(void *addr, int size); - #ifdef __cplusplus }; #endif -- cgit v1.2.3