Shm_Handle * cserve2_shm_resize(Shm_Handle *shm, size_t newsize) { size_t map_size; int fd; if (!shm) return NULL; if (shm->map_offset || shm->image_offset) { CRI("Can not resize shm with non-zero offset"); return NULL; } if (eina_inlist_count(shm->mapping->segments) > 1) { CRI("Can not resize shm with more than one segment"); return NULL; } fd = shm_open(shm->mapping->name, O_RDWR, S_IRUSR | S_IWUSR); if (fd == -1) { ERR("Could not reopen shm handle: %m"); return NULL; } map_size = cserve2_shm_size_normalize(newsize, 0); if (ftruncate(fd, map_size)) { ERR("Could not set the size of the shm: %m"); close(fd); return NULL; } if (shm->data) { munmap(shm->data, shm->image_size); shm->data = mmap(NULL, shm->image_size, PROT_WRITE, MAP_SHARED, fd, shm->image_offset); } close(fd); shm->map_size = map_size; shm->image_size = newsize; shm->mapping->length = map_size; return shm; }
void eng_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage) { if (glsym_eglSetDamageRegionKHR) { Tilebuf_Rect *tr; int *rect, *rects, count; count = eina_inlist_count(EINA_INLIST_GET(damage)); rects = alloca(sizeof(int) * 4 * count); rect = rects; EINA_INLIST_FOREACH(damage, tr) { _convert_glcoords(rect, ob, tr->x, tr->y, tr->w, tr->h); rect += 4; } glsym_eglSetDamageRegionKHR(ob->egl_disp, ob->egl_surface, rects, count); }