void GuiExtPoolItem::touchIonBuffer(sp<GraphicBuffer> gb) { int ion_fd = -1; android_native_buffer_t* buffer = gb.get(); buffer_handle_t hnd = getNativehandle(buffer); int err = 0; uint32_t bufSize = 0; GuiExtIONDevice &device(GuiExtIONDevice::getInstance()); err |= gralloc_extra_query(hnd, GRALLOC_EXTRA_GET_ION_FD, &ion_fd); uint32_t ion_hnd = device.import(ion_fd); device.touchMMUAddress(0, ion_hnd); close(ion_hnd); }
void HWComposer::waitFbtIfCameraExist(const sp<Fence>& acquireFence) { DisplayData& disp = mDisplayData[0]; if (disp.list != NULL) { for (size_t i = 0; i < disp.list->numHwLayers; ++i) { const hwc_layer_1_t&l = disp.list->hwLayers[i]; if (l.compositionType == HWC_FRAMEBUFFER_TARGET || l.handle == NULL) continue; gralloc_extra_ion_sf_info_t sf_info; gralloc_extra_query(l.handle, GRALLOC_EXTRA_GET_IOCTL_ION_SF_INFO, &sf_info); int buffer_type = (sf_info.status & GRALLOC_EXTRA_MASK_TYPE); if (buffer_type == GRALLOC_EXTRA_BIT_TYPE_CAMERA) { acquireFence->waitForever("HWComposer::fbPost"); break; } } } }
// BufferQueueProducer part // ----------------------------------------------------------------------------- void BufferQueueDebug::setIonInfo(const sp<GraphicBuffer>& gb, int usage) { #ifndef MTK_EMULATOR_SUPPORT if (gb->handle != NULL) { gralloc_extra_ion_debug_t info; snprintf(info.name, 16, "p:%d c:%d", mProducerPid, mConsumerPid); gralloc_extra_perform(gb->handle, GRALLOC_EXTRA_SET_IOCTL_ION_DEBUG, &info); if ((usage & GRALLOC_USAGE_HW_COMPOSER) && (mScenarioLayerType == GRALLOC_EXTRA_BIT2_LAYER_NAV)) { gralloc_extra_ion_sf_info_t sf_info; gralloc_extra_query(gb->handle, GRALLOC_EXTRA_GET_IOCTL_ION_SF_INFO, &sf_info); gralloc_extra_sf_set_status2(&sf_info, GRALLOC_EXTRA_MASK2_LAYER_TYPE, GRALLOC_EXTRA_BIT2_LAYER_NAV); gralloc_extra_perform(gb->handle, GRALLOC_EXTRA_SET_IOCTL_ION_SF_INFO, &sf_info); } } else { BQP_LOGE("handle of graphic buffer is NULL when producer set ION info"); } #endif // MTK_EMULATOR_SUPPORT }