G2D Problems

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

G2D Problems

1,039 次查看
ZHIYUANSONG
Contributor I

Hi, There was a problem with the g2d module, My board is IMX8QM, Linux version 5.4.129-5.4.0-devel+git.cb88cc157bfb (oe-user@oe-host) (gcc version 9.3.0 (GCC)) #1 SMP PREEMPT Wed Sep 29 18:17:21 UTC 2021.

My code as follow, All api return is success, but output_buffer->buf_vaddr value is 0. Could you help me to solve this problem? Thank you~

g2d_buf* input_buffer = nullptr;
g2d_buf* output_buffer = nullptr;
void* g2d_handle = nullptr;
g2d_surface* src_surface = new g2d_surface;
g2d_surface* dst_surface = new g2d_surface;
g2d_open(&g2d_handle);
input_buffer = g2d_alloc(1280*800*4, 1);
output_buffer = g2d_alloc(1280*800*4, 1);
FILE* fp = fopen("/home/root/user_test/P118_1280x800-32_0001_FB152.rgb", "rb");
if(fp != nullptr){
fread(input_buffer->buf_vaddr, 1, input_buffer->buf_size, fp);
fclose(fp);
}else{}

memset(src_surface, 0, sizeof(g2d_surface));
memset(dst_surface, 0, sizeof(g2d_surface));

src_surface->planes[0] = input_buffer->buf_paddr;
src_surface->left = 0;
src_surface->top = 0;
src_surface->right = 1280;
src_surface->bottom = 800;
src_surface->stride = 1280;
src_surface->width = 1280;
src_surface->height = 800;
src_surface->rot = G2D_ROTATION_0;
src_surface->format = G2D_RGBX8888;


dst_surface->planes[0] = input_buffer->buf_paddr;
dst_surface->left = 0;
dst_surface->top = 0;
dst_surface->right = 1280;
dst_surface->bottom = 800;
dst_surface->stride = 1280;
dst_surface->width = 1280;
dst_surface->height = 800;
dst_surface->rot = G2D_ROTATION_0;
dst_surface->format = G2D_RGBX8888;

std::cout << input_buffer << " " << input_buffer->buf_size << " " << input_buffer->buf_vaddr << std::endl;

std::cout << g2d_blit(g2d_handle, src_surface, dst_surface) << std::endl;
std::cout << g2d_finish(g2d_handle) << std::endl;

fp = fopen("/home/root/user_test/P118_1280x800-32_0001_FB152-test111.rgb", "wb");
if(fp != nullptr){
std::cout << fwrite(output_buffer->buf_vaddr, 1, 1280*800*4, fp) << std::endl ;
fclose(fp);
}else{}

标记 (1)
0 项奖励
回复
4 回复数

1,022 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

Please refer https://github.com/nxp-imx/g2d-samples/blob/imx_2.1/multiblit_test/g2d_multiblit.c

Need to modify dst_surface->planes[0]

 dst_surface->planes[0] = output_buffer->buf_paddr;



Best Regards,
Zhiming

0 项奖励
回复

1,012 次查看
ZHIYUANSONG
Contributor I
When I compile g2d_multiblit.c into an executable file,running result as follow:
Width 1920, Height 1088, Format RGBA, Bpp 32

----- g2d blit -----
g2d blit fail!!!
g2d blit time 21522us, 46fps, 97Mpixel/s ........

--- g2d blit with multiblit ---
g2d_feature 'G2D_MULTI_SOURCE_BLT' Not Supported for this hardware!
0 项奖励
回复

997 次查看
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hello,

Have you tested this reference code in conjunction with your own image files?

Best Regards,
Zhiming

0 项奖励
回复

1,014 次查看
ZHIYUANSONG
Contributor I
sorry,It was my negligence. When I corrected the error, the result was the same. output_buffer->buf_vaddr all is 0.
0 项奖励
回复