Home | History | Annotate | Download | only in gralloc

Lines Matching defs:hnd

194   auto hnd = buf->handle;
195 ALOGD_IF(DEBUG, "FreeBuffer handle:%p", hnd);
197 if (private_handle_t::validate(hnd) != 0) {
198 ALOGE("FreeBuffer: Invalid handle: %p", hnd);
202 if (allocator_->FreeBuffer(reinterpret_cast<void *>(hnd->base), hnd->size, hnd->offset,
203 hnd->fd, buf->ion_handle_main) != 0) {
208 if (allocator_->FreeBuffer(reinterpret_cast<void *>(hnd->base_metadata), meta_size,
209 hnd->offset_metadata, hnd->fd_metadata, buf->ion_handle_meta) != 0) {
213 private_handle_t * handle = const_cast<private_handle_t *>(hnd);
222 void BufferManager::RegisterHandleLocked(const private_handle_t *hnd,
225 auto buffer = std::make_shared<Buffer>(hnd, ion_handle, ion_handle_meta);
226 handles_map_.emplace(std::make_pair(hnd, buffer));
229 gralloc1_error_t BufferManager::ImportHandleLocked(private_handle_t *hnd) {
230 ALOGD_IF(DEBUG, "Importing handle:%p id: %" PRIu64, hnd, hnd->id);
231 int ion_handle = allocator_->ImportBuffer(hnd->fd);
233 ALOGE("Failed to import ion buffer: hnd: %p, fd:%d, id:%" PRIu64, hnd, hnd->fd, hnd->id);
236 int ion_handle_meta = allocator_->ImportBuffer(hnd->fd_metadata);
238 ALOGE("Failed to import ion metadata buffer: hnd: %p, fd:%d, id:%" PRIu64, hnd,
239 hnd->fd, hnd->id);
243 hnd->base = 0;
244 hnd->base_metadata = 0;
245 RegisterHandleLocked(hnd, ion_handle, ion_handle_meta);
250 BufferManager::GetBufferFromHandleLocked(const private_handle_t *hnd) {
251 auto it = handles_map_.find(hnd);
260 private_handle_t *hnd = const_cast<private_handle_t *>(handle);
261 ALOGD_IF(DEBUG, "Map buffer handle:%p id: %" PRIu64, hnd, hnd->id);
263 hnd->base = 0;
264 if (allocator_->MapBuffer(reinterpret_cast<void **>(&hnd->base), hnd->size, hnd->offset,
265 hnd->fd) != 0) {
271 gralloc1_error_t BufferManager::RetainBuffer(private_handle_t const *hnd) {
272 ALOGD_IF(DEBUG, "Retain buffer handle:%p id: %" PRIu64, hnd, hnd->id);
275 auto buf = GetBufferFromHandleLocked(hnd);
279 private_handle_t *handle = const_cast<private_handle_t *>(hnd);
285 gralloc1_error_t BufferManager::ReleaseBuffer(private_handle_t const *hnd) {
286 ALOGD_IF(DEBUG, "Release buffer handle:%p", hnd);
288 auto buf = GetBufferFromHandleLocked(hnd);
290 ALOGE("Could not find handle: %p id: %" PRIu64, hnd, hnd->id);
294 handles_map_.erase(hnd);
302 gralloc1_error_t BufferManager::LockBuffer(const private_handle_t *hnd,
307 ALOGD_IF(DEBUG, "LockBuffer buffer handle:%p id: %" PRIu64, hnd, hnd->id);
314 auto buf = GetBufferFromHandleLocked(hnd);
319 if (hnd->base == 0) {
321 err = MapBuffer(hnd);
325 if (!err && (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) &&
326 (hnd->flags & private_handle_t::PRIV_FLAGS_CACHED)) {
332 && (hnd->flags & private_handle_t::PRIV_FLAGS_NON_CPU_WRITER)) {
333 if (allocator_->CleanBuffer(reinterpret_cast<void *>(hnd->base), hnd->size, hnd->offset,
343 private_handle_t *handle = const_cast<private_handle_t *>(hnd);
354 private_handle_t *hnd = const_cast<private_handle_t *>(handle);
355 auto buf = GetBufferFromHandleLocked(hnd);
360 if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) {
361 if (allocator_->CleanBuffer(reinterpret_cast<void *>(hnd->base), hnd->size, hnd->offset,
365 hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
516 private_handle_t *hnd = new private_handle_t(data.fd,
529 hnd->id = ++next_id_;
530 hnd->base = 0;
531 hnd->base_metadata = 0;
532 hnd->layer_count = layer_count;
535 setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace));
536 *handle = hnd;
537 RegisterHandleLocked(hnd, data.ion_handle, e_data.ion_handle);
538 ALOGD_IF(DEBUG, "Allocated buffer handle: %p id: %" PRIu64, hnd, hnd->id);
540 private_handle_t::Dump(hnd);
561 private_handle_t *hnd = reinterpret_cast<private_handle_t *>(
563 if (hnd) {
565 hnd->magic = private_handle_t::kMagic;
566 hnd->fd = fd;
567 hnd->flags = private_handle_t::PRIV_FLAGS_USES_ION;
568 hnd->size = size;
569 hnd->offset = offset;
570 hnd->base = uint64_t(base);
571 hnd->gpuaddr = 0;
574 hnd->unaligned_width = width;
575 hnd->unaligned_height = height;
576 hnd->width = INT(alignedw);
577 hnd->height = INT(alignedh);
578 hnd->format = format;
579 *handle = reinterpret_cast<native_handle_t *>(hnd);
599 private_handle_t *hnd = va_arg(args, private_handle_t *);
601 if (private_handle_t::validate(hnd) != 0) {
610 if (getMetaData(hnd, GET_BUFFER_GEOMETRY, &buffer_dim) == 0) {
613 *stride = hnd->width;
619 private_handle_t *hnd = va_arg(args, private_handle_t *);
622 if (private_handle_t::validate(hnd) != 0) {
631 if (getMetaData(hnd, GET_BUFFER_GEOMETRY, &buffer_dim) == 0) {
635 *stride = hnd->width;
636 *height = hnd->height;
667 private_handle_t *hnd = va_arg(args, private_handle_t *);
670 if (private_handle_t::validate(hnd) != 0) {
680 if (getMetaData(hnd, GET_COLOR_METADATA, &color_metadata) == 0) {
696 } else if (getMetaData(hnd, GET_COLOR_SPACE, color_space) != 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)) {
801 buffer_handle_t *hnd = va_arg(args, buffer_handle_t*);
808 AllocateBuffer(descriptor, hnd, size);
812 private_handle_t *hnd = va_arg(args, private_handle_t *);
815 if (private_handle_t::validate(hnd) != 0) {
823 if (getMetaData(hnd, GET_PP_PARAM_INTERLACED, flag) != 0) {
834 static bool IsYuvFormat(const private_handle_t *hnd) {
835 switch (hnd->format) {
857 gralloc1_error_t BufferManager::GetNumFlexPlanes(const private_handle_t *hnd,
859 if (!IsYuvFormat(hnd)) {
867 gralloc1_error_t BufferManager::GetFlexLayout(const private_handle_t *hnd,
869 if (!IsYuvFormat(hnd)) {
874 int err = GetYUVPlaneInfo(hnd, &ycbcr);
911 auto hnd = buf->handle;
912 *os << "handle id: " << std::setw(4) << hnd->id;
913 *os << " fd: " << std::setw(3) << hnd->fd;
914 *os << " fd_meta: " << std::setw(3) << hnd->fd_metadata;
915 *os << " wxh: " << std::setw(4) << hnd->width <<" x " << std::setw(4) << hnd->height;
916 *os << " uwxuh: " << std::setw(4) << hnd->unaligned_width << " x ";
917 *os << std::setw(4) << hnd->unaligned_height;
918 *os << " size: " << std::setw(9) << hnd->size;
920 *os << " priv_flags: " << "0x" << std::setw(8) << hnd->flags;
921 *os << " prod_usage: " << "0x" << std::setw(8) << hnd->producer_usage;
922 *os << " cons_usage: " << "0x" << std::setw(8) << hnd->consumer_usage;
924 *os << " format: " << "0x" << std::setw(8) << hnd->format;