Home | History | Annotate | Download | only in libgralloc1

Lines Matching defs:hnd

194   auto hnd = buf->handle;
195 ALOGD_IF(DEBUG, "FreeBuffer handle:%p id: %" PRIu64, hnd, hnd->id);
196 if (allocator_->FreeBuffer(reinterpret_cast<void *>(hnd->base), hnd->size, hnd->offset,
197 hnd->fd, buf->ion_handle_main) != 0) {
202 if (allocator_->FreeBuffer(reinterpret_cast<void *>(hnd->base_metadata), meta_size,
203 hnd->offset_metadata, hnd->fd_metadata, buf->ion_handle_meta) != 0) {
207 private_handle_t * handle = const_cast<private_handle_t *>(hnd);
216 void BufferManager::RegisterHandleLocked(const private_handle_t *hnd,
219 auto buffer = std::make_shared<Buffer>(hnd, ion_handle, ion_handle_meta);
220 handles_map_.emplace(std::make_pair(hnd, buffer));
223 gralloc1_error_t BufferManager::ImportHandleLocked(private_handle_t *hnd) {
224 ALOGD_IF(DEBUG, "Importing handle:%p id: %" PRIu64, hnd, hnd->id);
225 int ion_handle = allocator_->ImportBuffer(hnd->fd);
227 ALOGE("Failed to import ion buffer: hnd: %p, fd:%d, id:%" PRIu64, hnd, hnd->fd, hnd->id);
230 int ion_handle_meta = allocator_->ImportBuffer(hnd->fd_metadata);
232 ALOGE("Failed to import ion metadata buffer: hnd: %p, fd:%d, id:%" PRIu64, hnd,
233 hnd->fd, hnd->id);
237 hnd->base = 0;
238 hnd->base_metadata = 0;
239 RegisterHandleLocked(hnd, ion_handle, ion_handle_meta);
244 BufferManager::GetBufferFromHandleLocked(const private_handle_t *hnd) {
245 auto it = handles_map_.find(hnd);
254 private_handle_t *hnd = const_cast<private_handle_t *>(handle);
255 ALOGD_IF(DEBUG, "Map buffer handle:%p id: %" PRIu64, hnd, hnd->id);
257 hnd->base = 0;
258 if (allocator_->MapBuffer(reinterpret_cast<void **>(&hnd->base), hnd->size, hnd->offset,
259 hnd->fd) != 0) {
265 gralloc1_error_t BufferManager::RetainBuffer(private_handle_t const *hnd) {
266 ALOGD_IF(DEBUG, "Retain buffer handle:%p id: %" PRIu64, hnd, hnd->id);
269 auto buf = GetBufferFromHandleLocked(hnd);
273 private_handle_t *handle = const_cast<private_handle_t *>(hnd);
277 if (hnd->flags & private_handle_t::PRIV_FLAGS_SECURE_BUFFER) {
280 err = MapBuffer(hnd);
286 gralloc1_error_t BufferManager::ReleaseBuffer(private_handle_t const *hnd) {
287 ALOGD_IF(DEBUG, "Release buffer handle:%p id: %" PRIu64, hnd, hnd->id);
289 auto buf = GetBufferFromHandleLocked(hnd);
291 ALOGE("Could not find handle: %p id: %" PRIu64, hnd, hnd->id);
295 handles_map_.erase(hnd);
303 gralloc1_error_t BufferManager::LockBuffer(const private_handle_t *hnd,
308 ALOGD_IF(DEBUG, "LockBuffer buffer handle:%p id: %" PRIu64, hnd, hnd->id);
315 auto buf = GetBufferFromHandleLocked(hnd);
320 if (hnd->base == 0) {
322 err = MapBuffer(hnd);
330 if (!err && (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) &&
331 (hnd->flags & private_handle_t::PRIV_FLAGS_CACHED)) {
332 if (allocator_->CleanBuffer(reinterpret_cast<void *>(hnd->base), hnd->size, hnd->offset,
340 private_handle_t *handle = const_cast<private_handle_t *>(hnd);
351 private_handle_t *hnd = const_cast<private_handle_t *>(handle);
352 auto buf = GetBufferFromHandleLocked(hnd);
357 if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) {
358 if (allocator_->CleanBuffer(reinterpret_cast<void *>(hnd->base), hnd->size, hnd->offset,
362 hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
513 private_handle_t *hnd = new private_handle_t(data.fd,
526 hnd->id = ++next_id_;
527 hnd->base = 0;
528 hnd->base_metadata = 0;
529 hnd->layer_count = layer_count;
532 setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace));
533 *handle = hnd;
534 RegisterHandleLocked(hnd, data.ion_handle, e_data.ion_handle);
535 ALOGD_IF(DEBUG, "Allocated buffer handle: %p id: %" PRIu64, hnd, hnd->id);
537 private_handle_t::Dump(hnd);
558 private_handle_t *hnd = reinterpret_cast<private_handle_t *>(
560 if (hnd) {
562 hnd->magic = private_handle_t::kMagic;
563 hnd->fd = fd;
564 hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
565 hnd->size = size;
566 hnd->offset = offset;
567 hnd->base = uint64_t(base);
568 hnd->gpuaddr = 0;
571 hnd->unaligned_width = width;
572 hnd->unaligned_height = height;
573 hnd->width = INT(alignedw);
574 hnd->height = INT(alignedh);
575 hnd->format = format;
576 *handle = reinterpret_cast<native_handle_t *>(hnd);
596 private_handle_t *hnd = va_arg(args, private_handle_t *);
598 if (private_handle_t::validate(hnd) != 0) {
607 if (getMetaData(hnd, GET_BUFFER_GEOMETRY, &buffer_dim) == 0) {
610 *stride = hnd->width;
616 private_handle_t *hnd = va_arg(args, private_handle_t *);
619 if (private_handle_t::validate(hnd) != 0) {
628 if (getMetaData(hnd, GET_BUFFER_GEOMETRY, &buffer_dim) == 0) {
632 *stride = hnd->width;
633 *height = hnd->height;
664 private_handle_t *hnd = va_arg(args, private_handle_t *);
667 if (private_handle_t::validate(hnd) != 0) {
678 if (getMetaData(hnd, GET_COLOR_METADATA, &color_metadata) == 0) {
695 if (getMetaData(hnd, GET_COLOR_SPACE, &color_metadata) != 0) {
701 private_handle_t *hnd = va_arg(args, private_handle_t *);
703 if (private_handle_t::validate(hnd) != 0) {
711 if (GetYUVPlaneInfo(hnd, ycbcr)) {
717 private_handle_t *hnd = va_arg(args, private_handle_t *);
720 if (private_handle_t::validate(hnd) != 0) {
728 if (getMetaData(hnd, GET_MAP_SECURE_BUFFER, map_secure_buffer) == 0) {
734 private_handle_t *hnd = va_arg(args, private_handle_t *);
737 if (private_handle_t::validate(hnd) != 0) {
745 *flag = hnd->flags &private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
747 if (getMetaData(hnd, GET_LINEAR_FORMAT, &linear_format) == 0) {
755 private_handle_t *hnd = va_arg(args, private_handle_t *);
758 if (private_handle_t::validate(hnd) != 0) {
766 if (GetRgbDataAddress(hnd, rgb_data)) {
800 buffer_handle_t *hnd = va_arg(args, buffer_handle_t*);
807 AllocateBuffer(descriptor, hnd, size);
811 private_handle_t *hnd = va_arg(args, private_handle_t *);
814 if (private_handle_t::validate(hnd) != 0) {
822 if (getMetaData(hnd, GET_PP_PARAM_INTERLACED, flag) != 0) {
833 static bool IsYuvFormat(const private_handle_t *hnd) {
834 switch (hnd->format) {
856 gralloc1_error_t BufferManager::GetNumFlexPlanes(const private_handle_t *hnd,
858 if (!IsYuvFormat(hnd)) {
866 gralloc1_error_t BufferManager::GetFlexLayout(const private_handle_t *hnd,
868 if (!IsYuvFormat(hnd)) {
873 int err = GetYUVPlaneInfo(hnd, &ycbcr);
910 auto hnd = buf->handle;
911 *os << "handle id: " << std::setw(4) << hnd->id;
912 *os << " fd: " << std::setw(3) << hnd->fd;
913 *os << " fd_meta: " << std::setw(3) << hnd->fd_metadata;
914 *os << " wxh: " << std::setw(4) << hnd->width <<" x " << std::setw(4) << hnd->height;
915 *os << " uwxuh: " << std::setw(4) << hnd->unaligned_width << " x ";
916 *os << std::setw(4) << hnd->unaligned_height;
917 *os << " size: " << std::setw(9) << hnd->size;
919 *os << " priv_flags: " << "0x" << std::setw(8) << hnd->flags;
920 *os << " prod_usage: " << "0x" << std::setw(8) << hnd->producer_usage;
921 *os << " cons_usage: " << "0x" << std::setw(8) << hnd->consumer_usage;
923 *os << " format: " << "0x" << std::setw(8) << hnd->format;