Lines Matching refs:frm

246 bool CScalerV4L2::ResetDevice(FrameInfo &frm)  in ResetDevice()  argument
248 DQBuf(frm); in ResetDevice()
250 if (TestFlag(frm.flags, SCFF_STREAMING)) { in ResetDevice()
251 if (ioctl(m_fdScaler, VIDIOC_STREAMOFF, &frm.type) < 0) { in ResetDevice()
252 SC_LOGERR("Failed STREAMOFF for the %s", frm.name); in ResetDevice()
254 ClearFlag(frm.flags, SCFF_STREAMING); in ResetDevice()
257 SC_LOGD("VIDIC_STREAMOFF is successful for the %s", frm.name); in ResetDevice()
259 if (TestFlag(frm.flags, SCFF_REQBUFS)) { in ResetDevice()
262 reqbufs.type = frm.type; in ResetDevice()
263 reqbufs.memory = frm.memory; in ResetDevice()
265 SC_LOGERR("Failed to REQBUFS(0) for the %s", frm.name); in ResetDevice()
268 ClearFlag(frm.flags, SCFF_REQBUFS); in ResetDevice()
271 SC_LOGD("VIDIC_REQBUFS(0) is successful for the %s", frm.name); in ResetDevice()
276 bool CScalerV4L2::DevSetFormat(FrameInfo &frm) in DevSetFormat() argument
279 if (!TestFlag(frm.flags, SCFF_BUF_FRESH)) { in DevSetFormat()
280 SC_LOGD("Skipping S_FMT for the %s since it is already done", frm.name); in DevSetFormat()
284 if (!ResetDevice(frm)) { in DevSetFormat()
285 SC_LOGE("Failed to VIDIOC_S_FMT for the %s", frm.name); in DevSetFormat()
291 fmt.type = frm.type; in DevSetFormat()
292 fmt.fmt.pix_mp.pixelformat = frm.color_format; in DevSetFormat()
293 fmt.fmt.pix_mp.width = frm.width; in DevSetFormat()
294 fmt.fmt.pix_mp.height = frm.height; in DevSetFormat()
296 if (TestFlag(frm.flags, SCFF_PREMULTIPLIED)) { in DevSetFormat()
307 frm.name); in DevSetFormat()
312 frm.out_num_planes = fmt.fmt.pix_mp.num_planes; in DevSetFormat()
314 for (int i = 0; i < frm.out_num_planes; i++) in DevSetFormat()
315 frm.out_plane_size[i] = fmt.fmt.pix_mp.plane_fmt[i].sizeimage; in DevSetFormat()
318 crop.type = frm.type; in DevSetFormat()
319 crop.c = frm.crop; in DevSetFormat()
324 frm.name); in DevSetFormat()
328 if (frm.out_num_planes > SC_MAX_PLANES) { in DevSetFormat()
329 SC_LOGE("Number of planes exceeds %d of %s", frm.out_num_planes, frm.name); in DevSetFormat()
333 ClearFlag(frm.flags, SCFF_BUF_FRESH); in DevSetFormat()
335 SC_LOGD("Successfully S_FMT and S_CROP for the %s", frm.name); in DevSetFormat()
348 bool CScalerV4L2::QBuf(FrameInfo &frm, int *pfdReleaseFence) in QBuf() argument
353 if (!TestFlag(frm.flags, SCFF_REQBUFS)) { in QBuf()
355 frm.name); in QBuf()
359 if (!DQBuf(frm)) in QBuf()
365 buffer.type = frm.type; in QBuf()
366 buffer.memory = frm.memory; in QBuf()
368 buffer.length = frm.out_num_planes; in QBuf()
372 buffer.reserved = frm.fdAcquireFence; in QBuf()
377 planes[i].length = frm.out_plane_size[i]; in QBuf()
381 planes[i].m.fd = static_cast<__s32>(reinterpret_cast<long>(frm.addr[i])); in QBuf()
383 planes[i].m.userptr = reinterpret_cast<unsigned long>(frm.addr[i]); in QBuf()
388 SC_LOGERR("Failed to QBUF for the %s", frm.name); in QBuf()
392 SetFlag(frm.flags, SCFF_QBUF); in QBuf()
395 if (frm.fdAcquireFence >= 0) in QBuf()
396 close(frm.fdAcquireFence); in QBuf()
397 frm.fdAcquireFence = -1; in QBuf()
402 SC_LOGD("Successfully QBUF for the %s", frm.name); in QBuf()
407 bool CScalerV4L2::ReqBufs(FrameInfo &frm) in ReqBufs() argument
411 if (TestFlag(frm.flags, SCFF_REQBUFS)) { in ReqBufs()
412 SC_LOGD("Skipping REQBUFS for the %s since it is already done", frm.name); in ReqBufs()
418 reqbufs.type = frm.type; in ReqBufs()
419 reqbufs.memory = frm.memory; in ReqBufs()
423 SC_LOGERR("Failed to REQBUFS for the %s", frm.name); in ReqBufs()
427 SetFlag(frm.flags, SCFF_REQBUFS); in ReqBufs()
429 SC_LOGD("Successfully REQBUFS for the %s", frm.name); in ReqBufs()
458 bool CScalerV4L2::StreamOn(FrameInfo &frm) in StreamOn() argument
460 if (!TestFlag(frm.flags, SCFF_REQBUFS)) { in StreamOn()
462 frm.name); in StreamOn()
466 if (!TestFlag(frm.flags, SCFF_STREAMING)) { in StreamOn()
467 if (ioctl(m_fdScaler, VIDIOC_STREAMON, &frm.type) < 0 ) { in StreamOn()
468 SC_LOGERR("Failed StreamOn for the %s", frm.name); in StreamOn()
472 SetFlag(frm.flags, SCFF_STREAMING); in StreamOn()
474 SC_LOGD("Successfully VIDIOC_STREAMON for the %s", frm.name); in StreamOn()
480 bool CScalerV4L2::DQBuf(FrameInfo &frm) in DQBuf() argument
482 if (!TestFlag(frm.flags, SCFF_QBUF)) in DQBuf()
490 buffer.type = frm.type; in DQBuf()
491 buffer.memory = frm.memory; in DQBuf()
496 buffer.length = frm.out_num_planes; in DQBuf()
500 ClearFlag(frm.flags, SCFF_QBUF); in DQBuf()
503 SC_LOGERR("Failed to DQBuf the %s", frm.name); in DQBuf()
512 SC_LOGD("Successfully VIDIOC_DQBUF for the %s", frm.name); in DQBuf()
517 static bool GetBuffer(CScalerV4L2::FrameInfo &frm, char *addr[]) in GetBuffer() argument
519 for (int i = 0; i < frm.out_num_planes; i++) { in GetBuffer()
520 if (frm.memory == V4L2_MEMORY_DMABUF) { in GetBuffer()
521 addr[i] = reinterpret_cast<char *>(mmap(NULL, frm.out_plane_size[i], in GetBuffer()
523 static_cast<int>(reinterpret_cast<long>(frm.addr[i])), 0)); in GetBuffer()
525 SC_LOGE("Failed to map FD %ld", reinterpret_cast<long>(frm.addr[i])); in GetBuffer()
527 munmap(addr[i], frm.out_plane_size[i]); in GetBuffer()
531 addr[i] = reinterpret_cast<char *>(frm.addr[i]); in GetBuffer()
538 static void PutBuffer(CScalerV4L2::FrameInfo &frm, char *addr[]) in PutBuffer() argument
540 for (int i = 0; i < frm.out_num_planes; i++) { in PutBuffer()
541 if (frm.memory == V4L2_MEMORY_DMABUF) { in PutBuffer()
542 munmap(addr[i], frm.out_plane_size[i]); in PutBuffer()