資源簡介
MAX9286的V4L2測試代碼,mxc_v4l2_tvin_max9286,詳見我的博客
MAX9286的V4L2測試代碼,mxc_v4l2_tvin_max9286,詳見我的博客
代碼片段和文件信息
/*
?*?Copyright?2007-2015?Freescale?Semiconductor?Inc.?All?rights?reserved.
?*/
/*
?*?The?code?contained?herein?is?licensed?under?the?GNU?General?Public
?*?License.?You?may?obtain?a?copy?of?the?GNU?General?Public?License
?*?Version?2?or?later?at?the?following?locations:
?*
?*?http://www.opensource.org/licenses/gpl-license.html
?*?http://www.gnu.org/copyleft/gpl.html
?*/
/*
?*?@file?mxc_v4l2_tvin.c
?*
?*?@brief?Mxc?TVIN?For?Linux?2?driver?test?application
?*
?*/
/*=======================================================================
INCLUDE?FILES
=======================================================================*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?“mxcfb.h“
#include?“ipu.h“
#include?“g2d.h“
#define?G2D_CACHEABLE????0
#define?TFAIL?-1
#define?TPASS?0
#define?NUMBER_BUFFERS????4
char?v4l_capture_dev[100]?=?“/dev/video0“;
#ifdef?BUILD_FOR_ANDROID
char?fb_display_dev[100]?=?“/dev/graphics/fb1“;
char?fb_display_bg_dev[100]?=?“/dev/graphics/fb0“;
#else
char?fb_display_dev[100]?=?“/dev/fb1“;
char?fb_display_bg_dev[100]?=?“/dev/fb0“;
#endif
int?fd_capture_v4l?=?0;
int?fd_fb_display?=?0;
int?fd_ipu?=?0;
unsigned?char?*?g_fb_display?=?NULL;
int?g_input?=?1;
int?g_display_num_buffers?=?3;
int?g_capture_num_buffers?=?NUMBER_BUFFERS;
int?g_in_width?=?0;
int?g_in_height?=?0;
int?g_in_fmt?=?V4L2_PIX_FMT_UYVY;
int?g_display_width?=?0;
int?g_display_height?=?0;
int?g_display_top?=?0;
int?g_display_left?=?0;
int?g_display_fmt?=?V4L2_PIX_FMT_UYVY;
int?g_display_base_phy;;
int?g_display_size;
int?g_display_fg?=?1;
int?g_display_id?=?1;
struct?fb_var_screeninfo?g_screen_info;
int?g_frame_count?=?0x7FFFFFFF;
int?g_frame_size;
bool?g_g2d_render?=?0;
int?g_g2d_fmt;
int?g_mem_type?=?V4L2_MEMORY_MMAP;
struct?testbuffer
{
unsigned?char?*start;
size_t?offset;
unsigned?int?length;
};
struct?testbuffer?display_buffers[3];
struct?testbuffer?capture_buffers[NUMBER_BUFFERS];
struct?g2d_buf?*g2d_buffers[NUMBER_BUFFERS];
static?void?draw_image_to_framebuffer(struct?g2d_buf?*buf?int?img_width?int?img_height?int?img_format?
?struct?fb_var_screeninfo?*screen_info?int?left?int?top?int?to_width?int?to_height?int?set_alpha?int?rotation)
{
int?i;
struct?g2d_surface?src?dst;
void?*g2dHandle;
if?(((left+to_width)?>?(int)screen_info->xres)?||?((top+to_height)?>?(int)screen_info->yres))?{
printf(“Bad?display?image?dimensions!\n“);
return;
}
#if?G2D_CACHEABLE
????????g2d_cache_op(buf?G2D_CACHE_FLUSH);
#endif
if?(g2d_open(&g2dHandle)?==?-1?||?g2dHandle?==?NULL)?{
printf(“Fail?to?open?g2d?device!\n“);
g2d_free(buf);
return;
}
/*
NOTE:?in?this?example?all?the?test?image?data?meet
評論
共有 條評論