抄的 Hal Vendor 共享

2021-08-13 11:04:30 字數 3428 閱讀 4270

研究導向:

open camera過程中有些初始化設定引數需要從vendor層獲取,而vendor與hal隸屬於不同程序,通過ion機制設定共享記憶體來實現不同程序間資料共享,下面簡要介紹流程:

在初始化過程中hal層會通過socket將訊息傳送至vendor層-通知vendor map共享記憶體。

ion初始化過程:

//初始化m_pcapability-從vendor層拿到的camera相關初始化資料

mparameters.init(gcamcapability[mcameraid], mcamerahandle, this, this);

pthread_mutex_unlock(&m_parm_lock);/* mm-mc-fixstring8heapcorrupt-00+ */

mparameters.m_parm_lock_ptr = &m_parm_lock;/* mm-mc-fixstring8heapcorrupt-00+ */

alogi("opencamera: m_parm_lock_ptr = 0x%x", mparameters.m_parm_lock_ptr);/* mm-mc-fixstring8heapcorrupt-00+ */

mcameraopened = true;

gcameraopened = true;/* mm-cl-cts-testmulticamerarelease-00+ */

#ifdef use_arcsoft_feature

if ((null != marcsoft_feature)&&(mcameraid == 0))/* mm-mc-fixopencameracrash-00+ */

marcsoft_feature->imx214_module_source = gcamcapability[0]->fih_imx214_module_source;//mm-yw-get module source for hal-00

#endif

return no_error;

}int qcamera2hardwareinte***ce::initcapabilities(uint32_t cameraid,

mm_camera_vtbl_t *camerahandle)

return no_memory;

} else

mptr[i] = vaddr;

}if (rc == 0)

mbuffercount = count;

tracelogallocend((size * count));

return ok;

}int qcameramemory::alloc(int count, size_t size, unsigned int heap_id)

} else }}

tracelogallocend (size * (size_t)count);

return rc;

}int qcameramemory::alloconebuffer(qcamerameminfo &meminfo,

unsigned int heap_id, size_t size, bool cached)

memset(&alloc, 0, sizeof(alloc));

memset(&ion_info_fd, 0, sizeof(ion_info_fd));/* mm-mc-modifyionfdinitflow-00+ */

alloc.len = size;

/* to make it page size aligned */

alloc.len = (alloc.len + 4095u) & (~4095u);

alloc.align = 4096;

if (cached)

alloc.heap_id_mask = heap_id;

rc =ioctl(main_ion_fd, ion_ioc_alloc, &alloc);

if (rc < 0)

//memset(&ion_info_fd, 0, sizeof(ion_info_fd));/* mm-mc-modifyionfdinitflow-00- */

ion_info_fd.handle = alloc.handle;

rc =ioctl(main_ion_fd, ion_ioc_share, &ion_info_fd);

if (rc < 0)

meminfo.main_ion_fd = main_ion_fd;

meminfo.fd = ion_info_fd.fd;

meminfo.handle = ion_info_fd.handle;

meminfo.size = alloc.len;

meminfo.cached = cached;

meminfo.heap_id = heap_id;

cdbg_high("%s : ion buffer %lx with size %d allocated",

__func__, (unsigned long)meminfo.handle, meminfo.size);

return ok;

ion_map_failed:

memset(&handle_data, 0, sizeof(handle_data));

handle_data.handle = ion_info_fd.handle;

ioctl(main_ion_fd, ion_ioc_free, &handle_data);

ion_alloc_failed:

close(main_ion_fd);

ion_open_failed:

return no_memory;

}2、通過socket通知vendor對映相應共享記憶體用於程序間通訊:

refer: ion機制介紹

開通MSN Messenger的離線訊息 抄來的

開通msn messenger的離線訊息 開通msn messenger的離線訊息 長期以來,msn messenger因為沒有離線訊息的功能而被用慣了qq的中國使用者所詬病。但是我們可以開通離線訊息。下面介紹一下開通的步驟 1.在瀏覽器中輸入 進入到msn mobile 2.點藍色的 join n...

抄的 FFT 和 NTT 模板

洛谷p1919 fft include include include includeconst int n 1e6 10 const double pi acos 1.0 struct cp cp friend operator cp a,cp b cp friend operator cp a,...

開通MSN Messenger的離線訊息 抄來的

開通msn messenger的離線訊息 開通msn messenger的離線訊息 長期以來,msn messenger因為沒有離線訊息的功能而被用慣了qq的中國使用者所詬病。但是我們可以開通離線訊息。下面介紹一下開通的步驟 1.在瀏覽器中輸入 進入到msn mobile 2.點藍色的 join n...