AnsweredAssumed Answered

g2d_blit_2d: fail with status -20

Question asked by yong tang on Jan 5, 2016
Latest reply on Jan 10, 2016 by igorpadykov

Hi,FreeScale

     I meet a very strange question on blit image which with G2D_I420,I blit image with physical continued memory as below,if the source image with 576*360,blit success,but if with 480*300,blit failed,how can i fix this?

 

     int width = 480;

   int height = 300;

   int o_width = 320;

   int o_height = 240;

  g2d_buf* mpInputBuf = g2d_alloc(width * height * 3 / 2, 0);

  g2d_buf* mpOutputBuf = g2d_alloc(o_width * o_height * 4, 0);

 

 

   mInputSurface.planes[0] = mpInputBuf->buf_paddr;

   mInputSurface.planes[1] = mpInputBuf->buf_paddr+ a_width*height;

   mInputSurface.planes[2] = mInputSurface.planes[1] + a_width*height / 4;

   mInputSurface.left = 0;

   mInputSurface.top = 0;

   mInputSurface.right = width;

   mInputSurface.bottom = height;

   mInputSurface.stride = width;

   mInputSurface.width  = width;

   mInputSurface.height = height;

   mInputSurface.rot    = G2D_ROTATION_0;

   mInputSurface.format = G2D_I420;

   mInputSurface.blendfunc = G2D_ZERO;

   mInputSurface.global_alpha = 0;     //Global alpha value 0~255

   mInputSurface.clrcolor = 0;

 

 

   mOutputSurface.planes[0] = mpOutputBuf->buf_paddr;

   mOutputSurface.left = 0;

   mOutputSurface.top = 0;

   mOutputSurface.right = o_width;

   mOutputSurface.bottom = o_height;

   mOutputSurface.stride = o_width;

   mOutputSurface.width  = o_width;

   mOutputSurface.height = o_height;

   mOutputSurface.rot    = G2D_ROTATION_0;

   mOutputSurface.format = G2D_RGBA8888;

   mOutputSurface.blendfunc = G2D_SRC_ALPHA;//G2D_ZERO;

   mOutputSurface.global_alpha = 0;     //Global alpha value 0~255

   mOutputSurface.clrcolor = 0;

 

 

   if(0 != g2d_make_current(mhG2d, G2D_HARDWARE_2D))

   {    

      return -4;

   }

 

   g2d_enable(mhG2d,G2D_BLEND);

   if(0 != g2d_blit(mhG2d, &mInputSurface, &mOutputSurface))

   {

      g2d_finish(mhG2d);

    

      return -5;

   }

   g2d_disable(mhG2d, G2D_BLEND);

 

 

   if(0 != g2d_finish(mhG2d))

   {    

      return -6;

   }

Outcomes