AnsweredAssumed Answered

imx6q G2D API  g2d_blit_2d: Invalid dst format 20!

Question asked by xi peng on Aug 13, 2018

使用G2D API 将UYVY转换为NV12格式,代码如下:

void *handle = NULL;

if(g2d_open(&handle))
{
printf("g2d_open fail.\n");
return -1;
}

struct g2d_surface src,dst;
int test_width=1920;
int test_height=1080;
struct g2d_buf *s_buf, *d_buf, *d_buf_1,*d_buf_2;

s_buf = g2d_alloc(test_width * test_height * 2, 0);
d_buf = g2d_alloc(test_width * test_height * 2/2, 0);
d_buf_1 = g2d_alloc(test_width * test_height * 2/2, 0);
d_buf_2 = g2d_alloc(test_width * test_height * 2/2, 0);

// memcpy(s_buf->buf_vaddr,buffers[queue_buf.index].start,test_width * test_height * 2);

src.format = G2D_UYVY;
src.planes[0] = s_buf->buf_paddr;
src.left = 0;
src.top = 0;
src.right = test_width;
src.bottom = test_height;
src.stride = test_width;
src.width = test_width;
src.height = test_height;
src.rot = G2D_ROTATION_0;

dst.format = G2D_NV12;//G2D_BGR565;//G2D_ARGB8888;
dst.planes[0] = d_buf->buf_paddr;
dst.planes[1] = d_buf_1->buf_paddr;
dst.planes[2] = d_buf_2->buf_paddr;
dst.left = 0;
dst.top = 0;
dst.right = test_width;
dst.bottom = test_height;
dst.stride = test_width;
dst.width = test_width;
dst.height = test_height;
dst.rot = G2D_ROTATION_0;

// g2d_make_current(handle, G2D_HARDWARE_VG);
g2d_blit(handle, &src, &dst);
g2d_finish(handle);

 

运行后提示       g2d_blit_2d: Invalid dst format 20!

 

转换结果数据全为0,这个是什么原因?

Outcomes