Lines Matching refs:hnd
97 struct cros_gralloc_handle *hnd; in allocate() local
127 hnd = new cros_gralloc_handle(); in allocate()
130 hnd->base.version = sizeof(hnd->base); in allocate()
131 hnd->base.numFds = num_planes; in allocate()
132 hnd->base.numInts = handle_data_size - num_planes; in allocate()
135 hnd->fds[plane] = drv_bo_get_plane_fd(bo, plane); in allocate()
136 hnd->strides[plane] = drv_bo_get_plane_stride(bo, plane); in allocate()
137 hnd->offsets[plane] = drv_bo_get_plane_offset(bo, plane); in allocate()
140 hnd->format_modifiers[2 * plane] = static_cast<uint32_t>(mod >> 32); in allocate()
141 hnd->format_modifiers[2 * plane + 1] = static_cast<uint32_t>(mod); in allocate()
144 hnd->width = drv_bo_get_width(bo); in allocate()
145 hnd->height = drv_bo_get_height(bo); in allocate()
146 hnd->format = drv_bo_get_format(bo); in allocate()
147 hnd->use_flags[0] = static_cast<uint32_t>(descriptor->use_flags >> 32); in allocate()
148 hnd->use_flags[1] = static_cast<uint32_t>(descriptor->use_flags); in allocate()
149 bytes_per_pixel = drv_bytes_per_pixel_from_format(hnd->format, 0); in allocate()
150 hnd->pixel_stride = DIV_ROUND_UP(hnd->strides[0], bytes_per_pixel); in allocate()
151 hnd->magic = cros_gralloc_magic; in allocate()
152 hnd->droid_format = descriptor->droid_format; in allocate()
153 hnd->usage = descriptor->producer_usage; in allocate()
156 auto buffer = new cros_gralloc_buffer(id, bo, hnd); in allocate()
160 handles_.emplace(hnd, std::make_pair(buffer, 1)); in allocate()
161 *out_handle = &hnd->base; in allocate()
170 auto hnd = cros_gralloc_convert_handle(handle); in retain() local
171 if (!hnd) { in retain()
176 auto buffer = get_buffer(hnd); in retain()
178 handles_[hnd].second++; in retain()
183 if (drmPrimeFDToHandle(drv_get_fd(drv_), hnd->fds[0], &id)) { in retain()
194 data.format = hnd->format; in retain()
195 data.width = hnd->width; in retain()
196 data.height = hnd->height; in retain()
197 data.use_flags = static_cast<uint64_t>(hnd->use_flags[0]) << 32; in retain()
198 data.use_flags |= hnd->use_flags[1]; in retain()
200 memcpy(data.fds, hnd->fds, sizeof(data.fds)); in retain()
201 memcpy(data.strides, hnd->strides, sizeof(data.strides)); in retain()
202 memcpy(data.offsets, hnd->offsets, sizeof(data.offsets)); in retain()
205 static_cast<uint64_t>(hnd->format_modifiers[2 * plane]) << 32; in retain()
206 data.format_modifiers[plane] |= hnd->format_modifiers[2 * plane + 1]; in retain()
219 handles_.emplace(hnd, std::make_pair(buffer, 1)); in retain()
227 auto hnd = cros_gralloc_convert_handle(handle); in release() local
228 if (!hnd) { in release()
233 auto buffer = get_buffer(hnd); in release()
239 if (!--handles_[hnd].second) in release()
240 handles_.erase(hnd); in release()
259 auto hnd = cros_gralloc_convert_handle(handle); in lock() local
260 if (!hnd) { in lock()
265 auto buffer = get_buffer(hnd); in lock()
278 auto hnd = cros_gralloc_convert_handle(handle); in unlock() local
279 if (!hnd) { in unlock()
284 auto buffer = get_buffer(hnd); in unlock()
304 auto hnd = cros_gralloc_convert_handle(handle); in get_backing_store() local
305 if (!hnd) { in get_backing_store()
310 auto buffer = get_buffer(hnd); in get_backing_store()
320 cros_gralloc_buffer *cros_gralloc_driver::get_buffer(cros_gralloc_handle_t hnd) in get_buffer() argument
323 if (handles_.count(hnd)) in get_buffer()
324 return handles_[hnd].first; in get_buffer()