Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    T113-S3 G2D 裸机测试

    其它全志芯片讨论区
    2
    5
    3471
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      L13819506056 LV 5 last edited by whycan

      终于将G2D裸机环境使用搞定了。 简单测试了一下bitblt 和矩形填充。

      extern const unsigned char image_mn_map[800*480*4];/*图片文件*/
      void  g2d_test(void)
      {
         g2d_probe();
         g2d_open();
      	 g2d_blt_h blit_para;
         while(1)
         {
            /* bitblt测试  */
            memset(&blit_para,0,sizeof(g2d_blt_h));
            g2d_image_enh *src = &blit_para.src_image_h;
            g2d_image_enh *des = &blit_para.dst_image_h;
            blit_para.flag_h   =  G2D_ROT_180;//G2D_ROT_V;// G2D_ROT_0;
      
            src->laddr[0] = (uint32_t)image_mn_map;
            src->align[0] = 4;
            src->clip_rect.w = 800;
            src->clip_rect.h = 480;
            src->width       = 800;
            src->height      = 480;
            src->format      = G2D_FORMAT_ARGB8888;
            src->mode        = G2D_PIXEL_ALPHA;
            src->bpremul     = 0;
      
            des->laddr[0]    = r528_de_config.LayerAddr[0] ;
            des->align[0]    = 4;
            des->clip_rect.w = 800;
            des->clip_rect.h = 480;
            des->width       = 800;
            des->height      = 480;
            des->format      = G2D_FORMAT_ARGB8888;
            des->mode        = G2D_PIXEL_ALPHA;
            des->bpremul     = 0;
            long ret         = g2d_ioctl( G2D_CMD_BITBLT_H, (unsigned long )&blit_para);
      
            /* 矩形填充测试  */
            g2d_fillrect_h fill_para;
            memset(&fill_para,0,sizeof(g2d_fillrect_h));
            src = &fill_para.dst_image_h;
            src->laddr[0] = (uint32_t)r528_de_config.LayerAddr[0] ;;
            src->align[0] = 4;
            src->clip_rect.w = 800;
            src->clip_rect.h = 480;
            src->width       = 800;
            src->height      = 480;
            src->format      = G2D_FORMAT_ARGB8888;
            src->mode = G2D_PIXEL_ALPHA;
            src->bpremul = 0;
            src->gamut = G2D_BT709;
            src->color = 0xFFFF0000;
            src->alpha = 0xff;
            ret = g2d_ioctl( G2D_CMD_FILLRECT_H, (unsigned long )&fill_para);
         }
      }
      
      S 1 Reply Last reply Reply Quote Share 1
      • S
        smiletiger LV 6 @L13819506056 last edited by

        @l13819506056 在 T113-S3 G2D 裸机测试 中说:

        终于将G2D裸机环境使用搞定了。 简单测试了一下bitblt 和矩形填充。

        extern const unsigned char image_mn_map[800*480*4];/*图片文件*/
        void  g2d_test(void)
        {
           g2d_probe();
           g2d_open();
        	 g2d_blt_h blit_para;
           while(1)
           {
              /* bitblt测试  */
              memset(&blit_para,0,sizeof(g2d_blt_h));
              g2d_image_enh *src = &blit_para.src_image_h;
              g2d_image_enh *des = &blit_para.dst_image_h;
              blit_para.flag_h   =  G2D_ROT_180;//G2D_ROT_V;// G2D_ROT_0;
        
              src->laddr[0] = (uint32_t)image_mn_map;
              src->align[0] = 4;
              src->clip_rect.w = 800;
              src->clip_rect.h = 480;
              src->width       = 800;
              src->height      = 480;
              src->format      = G2D_FORMAT_ARGB8888;
              src->mode        = G2D_PIXEL_ALPHA;
              src->bpremul     = 0;
        
              des->laddr[0]    = r528_de_config.LayerAddr[0] ;
              des->align[0]    = 4;
              des->clip_rect.w = 800;
              des->clip_rect.h = 480;
              des->width       = 800;
              des->height      = 480;
              des->format      = G2D_FORMAT_ARGB8888;
              des->mode        = G2D_PIXEL_ALPHA;
              des->bpremul     = 0;
              long ret         = g2d_ioctl( G2D_CMD_BITBLT_H, (unsigned long )&blit_para);
        
              /* 矩形填充测试  */
              g2d_fillrect_h fill_para;
              memset(&fill_para,0,sizeof(g2d_fillrect_h));
              src = &fill_para.dst_image_h;
              src->laddr[0] = (uint32_t)r528_de_config.LayerAddr[0] ;;
              src->align[0] = 4;
              src->clip_rect.w = 800;
              src->clip_rect.h = 480;
              src->width       = 800;
              src->height      = 480;
              src->format      = G2D_FORMAT_ARGB8888;
              src->mode = G2D_PIXEL_ALPHA;
              src->bpremul = 0;
              src->gamut = G2D_BT709;
              src->color = 0xFFFF0000;
              src->alpha = 0xff;
              ret = g2d_ioctl( G2D_CMD_FILLRECT_H, (unsigned long )&fill_para);
           }
        }
        

        请问可以共享一下更多的细节吗,一直也在研究裸机G2D,一直搞不定看了linux的源代码
        void g2d_top_set_base(unsigned long base)
        {
        g2d_top = (struct g2d_top_reg *)(base);
        mixer_glb = (struct g2d_mixer_glb_reg *)(base + 0x0100);
        }

        void g2d_rot_set_base(unsigned long base)
        {
        base_addr = base;
        }

        这里的基址base是多少啊,是不是0x05410000

        1 Reply Last reply Reply Quote Share 0
        • Moved from Linux by  YuzukiTsuru YuzukiTsuru 
        • L
          L13819506056 LV 5 last edited by whycan

          __s32 drv_g2d_init(void)
          {
          	memset(&g2d_ext_hd, 0, sizeof(__g2d_drv_t));
          	init_wait_event(&g2d_ext_hd.wait_event);
          	g2d_top_set_base((unsigned long) para.io);
          
          #if defined(CONFIG_SUNXI_G2D_ROTATE)
          	g2d_rot_set_base((unsigned long) para.io);
          #endif
          	return 0;
          }
          
          
          int g2d_probe(void )
          {
          
          	__g2d_info_t *info = NULL;
          
          	info = ¶
          	info->dev =  0;
          	info->io =  (__u32 *)0x05410000;
           	info->irq = 121;
            info->clk = (__u32 *)0x02001630;
            info->clk_parent = 0;
            info->bus_clk = (__u32 *)0x0200163c;
          	info->mbus_clk = (__u32 *)0x02001804;
          
            bsp_int_vect_set(info->irq,  /* Assign ISR handler. */
                             8u,            /* 中断的优先级         */
                             1u,            /* 中断的目标CPU        */
                             0u,            /* 参数                 */
                             g2d_handle_irq);
          
            irq_enable(info->irq);//
          	drv_g2d_init();
          	mutex_init(&info->mutex);
          	mutex_init(&global_lock);
          	return 0;
          
          }
          
          S 2 Replies Last reply Reply Quote Share 0
          • S
            smiletiger LV 6 @L13819506056 last edited by

            @l13819506056 谢谢回复,我先按照你提供的代码理解下移植下,谢谢你兄弟

            1 Reply Last reply Reply Quote Share 0
            • S
              smiletiger LV 6 @L13819506056 last edited by

              @l13819506056 请问可以提供一下裸机g2d部分的全部驱动吗,我愿意给红包,因为自己对linux不太熟,感觉要修改好多才能用在裸机上,可否把g2d部分的代码打包发给我参考下,谢谢

              1 Reply Last reply Reply Quote Share 0
              • 1 / 1
              • First post
                Last post

              Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

              行为准则 | 用户协议 | 隐私权政策