Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页
    1. Home
    2. tianj03
    T
    • Profile
    • Following 0
    • Followers 0
    • my integral 96
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    tianj03LV 2

    @tianj03

    96
    integral
    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    tianj03 Unfollow Follow

    Latest posts made by tianj03

    • 有用过F133 melis系统的g2d吗?

      各位有用过F133 melis系统的g2d功能吗?我需要一个图片缩放的功能,软件缩放太慢,想用g2d功能加速一下。但是用不了。我的代码如下:
      static int g2d_img_scale(char* src, int src_w, int src_h, char* dst, int dst_w, int dst_h)
      {
      int g2d_fd = open("/dev/g2d", O_RDWR);
      if (g2d_fd < 0)
      {
      eLIBs_printf("g2d_img_effect1, open g2d failed, g2d_fd: %d\n", g2d_fd);
      return -1;
      }
      eLIBs_printf("g2d_img_effect1, open g2d success, g2d_fd: %d\n", g2d_fd);

      g2d_stretchblt *pstStchBlt = (g2d_stretchblt*)eLIBs_malloc(sizeof(*pstStchBlt));
      if (!pstStchBlt)
      {
          eLIBs_printf("g2d_img_effect1, malloc pstStchBlt failed, g2d_fd: %d\n", g2d_fd);
          close(g2d_fd);
          return -1;
      }
      eLIBs_memset(pstStchBlt, 0, sizeof(*pstStchBlt));
      
      pstStchBlt->flag = G2D_BLT_NONE;
      pstStchBlt->color = 0;
      pstStchBlt->alpha = 0;
      pstStchBlt->src_image.addr[0] = src;
      pstStchBlt->src_image.format = G2D_FORMAT_ARGB8888;
      pstStchBlt->src_image.w = src_w;
      pstStchBlt->src_image.h = src_h;
      pstStchBlt->src_image.pixel_seq = G2D_SEQ_NORMAL;
      pstStchBlt->src_rect.x = 0;
      pstStchBlt->src_rect.y = 0;
      pstStchBlt->src_rect.w = src_w;
      pstStchBlt->src_rect.h = src_h;
      
      pstStchBlt->dst_image.addr[0] = dst;
      pstStchBlt->dst_image.format = G2D_FORMAT_ARGB8888;
      pstStchBlt->dst_image.w = dst_w;
      pstStchBlt->dst_image.h = dst_h;
      pstStchBlt->dst_image.pixel_seq = G2D_SEQ_NORMAL;
      pstStchBlt->dst_rect.x = 0;
      pstStchBlt->dst_rect.y = 0;
      pstStchBlt->dst_rect.w = dst_w;
      pstStchBlt->dst_rect.h = dst_h;
      
      int iRet = ioctl(g2d_fd, G2D_CMD_STRETCHBLT, pstStchBlt);
      if (iRet != 0) {
          eLIBs_printf("do G2D_CMD_STRETCHBLT failed!iRet: %d\n", iRet);
          close(g2d_fd);
          eLIBs_free(pstStchBlt);
          return -1;
      }
      close(g2d_fd);
      eLIBs_free(pstStchBlt);
      return 0;
      

      }
      就是在ioctl(g2d_fd, G2D_CMD_STRETCHBLT, pstStchBlt);返回-1,不知道哪位老板用过,请教一下。

      posted in MR Series
      T
      tianj03