drm/xen-front: Pass dumb buffer data offset to the backend
authorOleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Thu, 13 Aug 2020 12:00:38 +0000 (14:00 +0200)
committerJuergen Gross <jgross@suse.com>
Thu, 13 Aug 2020 15:15:21 +0000 (17:15 +0200)
While importing a dmabuf it is possible that the data of the buffer
is put with offset which is indicated by the SGT offset.
Respect the offset value and forward it to the backend.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/gpu/drm/xen/xen_drm_front.c
drivers/gpu/drm/xen/xen_drm_front.h
drivers/gpu/drm/xen/xen_drm_front_gem.c

index 51818e76facde64eb27e1be3c6289b9dbac0051e..3dd56794593a40a757383f972faefef1a36936ef 100644 (file)
@@ -157,7 +157,8 @@ int xen_drm_front_mode_set(struct xen_drm_front_drm_pipeline *pipeline,
 
 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
                              u64 dbuf_cookie, u32 width, u32 height,
-                             u32 bpp, u64 size, struct page **pages)
+                             u32 bpp, u64 size, u32 offset,
+                             struct page **pages)
 {
        struct xen_drm_front_evtchnl *evtchnl;
        struct xen_drm_front_dbuf *dbuf;
@@ -194,6 +195,7 @@ int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
        req->op.dbuf_create.gref_directory =
                        xen_front_pgdir_shbuf_get_dir_start(&dbuf->shbuf);
        req->op.dbuf_create.buffer_sz = size;
+       req->op.dbuf_create.data_ofs = offset;
        req->op.dbuf_create.dbuf_cookie = dbuf_cookie;
        req->op.dbuf_create.width = width;
        req->op.dbuf_create.height = height;
@@ -408,7 +410,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp,
        ret = xen_drm_front_dbuf_create(drm_info->front_info,
                                        xen_drm_front_dbuf_to_cookie(obj),
                                        args->width, args->height, args->bpp,
-                                       args->size,
+                                       args->size, 0,
                                        xen_drm_front_gem_get_pages(obj));
        if (ret)
                goto fail_backend;
index f92c258350ca0ed0776aeeda02db5343c0bcffaa..54486d89650e1ed2e319e8f6c84c0f0bea23a70c 100644 (file)
@@ -145,7 +145,7 @@ int xen_drm_front_mode_set(struct xen_drm_front_drm_pipeline *pipeline,
 
 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
                              u64 dbuf_cookie, u32 width, u32 height,
-                             u32 bpp, u64 size, struct page **pages);
+                             u32 bpp, u64 size, u32 offset, struct page **pages);
 
 int xen_drm_front_fb_attach(struct xen_drm_front_info *front_info,
                            u64 dbuf_cookie, u64 fb_cookie, u32 width,
index 4ec8a49241e174174a7a7c9173438d58a26f7e84..39ff95b75357ddafc5daac2d0110b2adef7bffd6 100644 (file)
@@ -210,7 +210,8 @@ xen_drm_front_gem_import_sg_table(struct drm_device *dev,
 
        ret = xen_drm_front_dbuf_create(drm_info->front_info,
                                        xen_drm_front_dbuf_to_cookie(&xen_obj->base),
-                                       0, 0, 0, size, xen_obj->pages);
+                                       0, 0, 0, size, sgt->sgl->offset,
+                                       xen_obj->pages);
        if (ret < 0)
                return ERR_PTR(ret);