gpu crashes when imx8qxp mek runs for a while

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

gpu crashes when imx8qxp mek runs for a while

1,821 次查看
783435100
Contributor III

Dear technical support:
    My development environment is as follows:
i.MX 8QuadXPlus Multisensory Enablement Kit (MEK) CPU Board
imx-yocto-L5.4.47_2.2.0
DISTRO=fsl-imx-wayland MACHINE=imx8qxpmek source imx-setup-release.sh -b build-wayland
bitbake imx-image-multimedia

   After the program runs for a period of time, about a few hours or tens of hours, the program must crash! The GPU error message was thrown in the log terminal. The information is included in the attachment file. At the same time,  We are using in-vehicle products, this problem must be handled for me, this BUG risk is too great.

 thank you very much!

  mian code:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <semaphore.h>
#include <pthread.h>

#include <GLES3/gl3.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/eglvivante.h>


#include "commonEx.h"

static vector<camera_buffer> gcb;
static vdkEGL egl;

int server_coral(render_param *prp,unsigned int program);

void *server_record_coral(void *arg)
{
int width = 0;
int height = 0;
EGLint configAttribs[] =
{
EGL_SAMPLES, 1,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE,
};

EGLint attribListContext[] =
{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};

render_param *prp = (render_param *)arg;

while (!vdkSetupEGL(0, 0, prp->record_width, prp->record_height, configAttribs, NULL, attribListContext, &egl))
{
printf("vdkSetupEGL error %s %d\n",__FILE__,__LINE__);
usleep(500*1000);
}

vdkGetWindowInfo(egl.window, NULL, NULL, &width, &height, NULL, NULL);

vdkSetWindowTitle(egl.window, "tm360");
vdkShowWindow(egl.window);

unsigned int program = loadShaderProgram("original_yuv");
unsigned int program_coral = loadShaderProgram("original");

if( program == 0xFFFFFFFF ) {
printf("loadShaderProgram error %s %d\n",__FILE__,__LINE__);
return 0;
}

glEnableVertexAttribArray(glGetAttribLocation(program, "vertex"));
glEnableVertexAttribArray(glGetAttribLocation(program, "tcolor"));

glCullFace(GL_BACK);
glFrontFace(GL_CW);

vector<camera_buffer> cb_tmp;

while( 1 )
{
cb_tmp.clear();
pthread_mutex_lock(&(prp->camera_lock));
for(int i = 0; i < gcb.size(); i++)
cb_tmp.push_back(gcb[i]);
gcb.clear();
pthread_mutex_unlock(&(prp->camera_lock));

int camera_flag[SENSOR_NUM];
for(int i = 0; i < SENSOR_NUM; i++)
camera_flag[i] = 0;

int count = cb_tmp.size();
while( (--count) >= 0 ) {
if( camera_flag[cb_tmp[count].index] == 0 ) {
update_texture_record(cb_tmp[count].index,prp->image_width,prp->image_height,
GL_VIV_YUY2,prp->buffers[cb_tmp[count].index][cb_tmp[count].buf_index].planes[0].start,
prp->image_width*prp->image_height*2);
camera_flag[cb_tmp[count].index] = 1;
}
ortherQueue_buffer(prp,cb_tmp[count].index,cb_tmp[count].buf_index);
}

GLfloat vertices[16][2] = {
{ -1.0f, -1.0f },
{ -1.0f, 0.0f },
{ 0.0f, -1.0f },
{ 0.0f, 0.0f },

{ 0.0f, -1.0f },
{ 0.0f, 0.0f },
{ 1.0f, -1.0f },
{ 1.0f, 0.0f },

{ -1.0f, 0.0f },
{ -1.0f, 1.0f },
{ 0.0f, 0.0f },
{ 0.0f, 1.0f },

{ 0.0f, 0.0f },
{ 0.0f, 1.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
};

GLfloat uvcolors[16][2] = {
{ 0.0f, 0.0f },
{ 0.0f, 1.0f },
{ 1.0f, 0.0f },
{ 1.0f, 1.0f },

{ 0.0f, 1.0f },
{ 0.0f, 0.0f },
{ 1.0f, 1.0f },
{ 1.0f, 0.0f },

{ 1.0f, 0.0f },
{ 1.0f, 1.0f },
{ 0.0f, 0.0f },
{ 0.0f, 1.0f },

{ 1.0f, 1.0f },
{ 1.0f, 0.0f },
{ 0.0f, 1.0f },
{ 0.0f, 0.0f },
};

//BeginFBO(prp,g_pOffscreenFBO);

glUseProgram(program);

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

for( int i = 0; i < SENSOR_NUM; i++) {
int j = 0;
if( prp->camera_h_filp[i] && prp->camera_v_filp[i] ) {
j = 3;
} else if( prp->camera_h_filp[i] ) {
j = 1;
} else if( prp->camera_v_filp[i] ) {
j = 2;
}
glUniform1i(glGetUniformLocation(program,"camera"), i);
glVertexAttribPointer(glGetAttribLocation(program, "vertex"), 2, GL_FLOAT, GL_FALSE, 0, &vertices[i*4][0]);
glVertexAttribPointer(glGetAttribLocation(program, "tcolor"), 2, GL_FLOAT, GL_FALSE, 0, &uvcolors[j*4][0]);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}

glReadPixels (0, 0, prp->record_width, prp->record_height,
GL_RGBA, GL_UNSIGNED_BYTE, (void *)prp->record_coral_temp);

memcpy(prp->record_coral_data,prp->record_coral_temp,prp->record_width*prp->record_height*4);

if( cb_tmp.size() == 0 ) continue;

server_coral(prp,program_coral);

if( prp->encoder_status ) {
sem_post(&(prp->encoder_sem));
}
else {
printf("*******-----%s:%d\n",__FILE__,__LINE__);
}
#if 0
static unsigned int t = 0;
printf("%d-----%s:%d\n",(vdkGetTicks()-t),__FILE__,__LINE__);
t = vdkGetTicks();
#endif
}

return 0;
}


void push_camera_buffer(render_param *prp,int index,int buf_index) {
camera_buffer cb;
cb.index = index;
cb.buf_index = buf_index;
pthread_mutex_lock(&(prp->camera_lock));
gcb.push_back(cb);
pthread_mutex_unlock(&(prp->camera_lock));
}

 

  

 

0 项奖励
回复
2 回复数

1,802 次查看
igorpadykov
NXP Employee
NXP Employee

Hi 783435100

 

what processor revision used in the case, one can try Demo Image from link

https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applicat...

 

Best regards
igor

0 项奖励
回复

1,797 次查看
783435100
Contributor III

   Thanks a lot for reply!
   I am using the latest version of Linux 5.4.47_2.2.0! Looking forward to helping me deal with it! Or you can provide technical support from GPU Vivante Corporation.

root@imx8qxpmek:~# cat /proc/version
Linux version 5.4.47-2.2.0+g5ec03d06f54e (oe-user@oe-host) (gcc version 9.2.0 (GCC)) #1 SMP PREEMPT Tue Nov 17 01:11:39 UTC 2020

0 项奖励
回复