drm/rockchip: add support for src1
authorJacob Chen <jacob2.chen@rock-chips.com>
Mon, 13 Mar 2017 10:09:56 +0000 (18:09 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 23 Mar 2017 06:33:38 +0000 (14:33 +0800)
Although libdrm didn't implment src1, we should support it in driver in advance.

Change-Id: I7da051d1376ded63750f3363f9dd37fe6937a81c
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
drivers/gpu/drm/rockchip/rockchip_drm_rga.c
drivers/gpu/drm/rockchip/rockchip_drm_rga.h

index 139bf94..29c4e9d 100644 (file)
@@ -221,10 +221,12 @@ static int rga_check_reg_offset(struct device *dev,
                switch (reg) {
                case RGA_BUF_TYPE_GEMFD | RGA_DST_Y_RGB_BASE_ADDR:
                case RGA_BUF_TYPE_GEMFD | RGA_SRC_Y_RGB_BASE_ADDR:
+               case RGA_BUF_TYPE_GEMFD | RGA_SRC1_RGB_BASE_ADDR:
                        break;
 
                case RGA_BUF_TYPE_USERPTR | RGA_DST_Y_RGB_BASE_ADDR:
                case RGA_BUF_TYPE_USERPTR | RGA_SRC_Y_RGB_BASE_ADDR:
+               case RGA_BUF_TYPE_USERPTR | RGA_SRC1_RGB_BASE_ADDR:
                        goto err;
 
                default:
@@ -327,6 +329,16 @@ static int rga_map_cmdlist_gem(struct rockchip_rga *rga,
                int index = cmdlist->last - 2 * (i + 1);
 
                switch (cmdlist->data[index]) {
+               case RGA_SRC1_RGB_BASE_ADDR | RGA_BUF_TYPE_GEMFD:
+                       fd = cmdlist->data[index + 1];
+                       attach = rga_gem_buf_to_pages(rga, &mmu_pages, fd);
+                       if (IS_ERR(attach))
+                               return PTR_ERR(attach);
+
+                       cmdlist->src1_attach = attach;
+                       cmdlist->src1_mmu_pages = mmu_pages;
+                       break;
+
                case RGA_SRC_Y_RGB_BASE_ADDR | RGA_BUF_TYPE_GEMFD:
                        fd = cmdlist->data[index + 1];
                        attach = rga_gem_buf_to_pages(rga, &mmu_pages, fd);
@@ -366,6 +378,14 @@ static void rga_unmap_cmdlist_gem(struct rockchip_rga *rga,
        }
        node->cmdlist.src_attach = NULL;
 
+       attach = node->cmdlist.src1_attach;
+       if (attach) {
+               dma_buf = attach->dmabuf;
+               dma_buf_detach(dma_buf, attach);
+               dma_buf_put(dma_buf);
+       }
+       node->cmdlist.src1_attach = NULL;
+
        attach = node->cmdlist.dst_attach;
        if (attach) {
                dma_buf = attach->dmabuf;
index 49426eb..67f86be 100644 (file)
@@ -14,6 +14,7 @@ struct rga_cmdlist {
        void            *dst_mmu_pages;
        void            *src1_mmu_pages;
        struct dma_buf_attachment *src_attach;
+       struct dma_buf_attachment *src1_attach;
        struct dma_buf_attachment *dst_attach;
 };