Lines Matching refs:region

112 intel_region_map(struct intel_context *intel, struct intel_region *region,
115 /* We have the region->map_refcount controlling mapping of the BO because
127 if (drm_intel_bo_busy(region->bo)) {
132 _DBG("%s %p\n", __FUNCTION__, region);
133 if (!region->map_refcount) {
136 if (region->tiling != I915_TILING_NONE)
137 drm_intel_gem_bo_map_gtt(region->bo);
139 drm_intel_bo_map(region->bo, true);
141 region->map = region->bo->virtual;
143 if (region->map) {
145 region->map_refcount++;
148 return region->map;
152 intel_region_unmap(struct intel_context *intel, struct intel_region *region)
154 _DBG("%s %p\n", __FUNCTION__, region);
155 if (!--region->map_refcount) {
156 if (region->tiling != I915_TILING_NONE)
157 drm_intel_gem_bo_unmap_gtt(region->bo);
159 drm_intel_bo_unmap(region->bo);
161 region->map = NULL;
173 struct intel_region *region;
175 region = calloc(sizeof(*region), 1);
176 if (region == NULL)
177 return region;
179 region->cpp = cpp;
180 region->width = width;
181 region->height = height;
182 region->pitch = pitch;
183 region->refcount = 1;
184 region->bo = buffer;
185 region->tiling = tiling;
186 region->screen = screen;
188 _DBG("%s <-- %p\n", __FUNCTION__, region);
189 return region;
201 struct intel_region *region;
206 buffer = drm_intel_bo_alloc_tiled(screen->bufmgr, "region",
212 region = intel_region_alloc_internal(screen, cpp, width, height,
214 if (region == NULL) {
219 return region;
223 intel_region_flink(struct intel_region *region, uint32_t *name)
225 if (region->name == 0) {
226 if (drm_intel_bo_flink(region->bo, &region->name))
229 _mesa_HashInsert(region->screen->named_regions,
230 region->name, region);
233 *name = region->name;
244 struct intel_region *region, *dummy;
249 region = _mesa_HashLookup(screen->named_regions, handle);
250 if (region != NULL) {
252 if (region->width != width || region->height != height ||
253 region->cpp != cpp || region->pitch != pitch) {
259 intel_region_reference(&dummy, region);
274 region = intel_region_alloc_internal(screen, cpp,
276 if (region == NULL) {
281 region->name = handle;
282 _mesa_HashInsert(screen->named_regions, handle, region);
284 return region;
306 struct intel_region *region = *region_handle;
308 if (region == NULL) {
313 _DBG("%s %p %d\n", __FUNCTION__, region, region->refcount - 1);
315 ASSERT(region->refcount > 0);
316 region->refcount--;
318 if (region->refcount == 0) {
319 assert(region->map_refcount == 0);
321 drm_intel_bo_unreference(region->bo);
323 if (region->name > 0)
324 _mesa_HashRemove(region->screen->named_regions, region->name);
326 free(region);
402 * and Y coordinates that indicate the offset within a tile. If the region is
406 intel_region_get_tile_masks(struct intel_region *region,
410 int cpp = region->cpp;
411 uint32_t tiling = region->tiling;
434 * Compute the offset (in bytes) from the start of the region to the given x
439 intel_region_get_aligned_offset(struct intel_region *region, uint32_t x,
442 int cpp = region->cpp;
443 uint32_t pitch = region->pitch * cpp;
444 uint32_t tiling = region->tiling;
451 * the resulting region is twice the pitch of the original region, since