Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xen-front: Pass dumb buffer data offset to the backend

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>

authored by

Oleksandr Andrushchenko and committed by
Juergen Gross
585c6ed7 6f92337b

+7 -4
+4 -2
drivers/gpu/drm/xen/xen_drm_front.c
··· 157 157 158 158 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info, 159 159 u64 dbuf_cookie, u32 width, u32 height, 160 - u32 bpp, u64 size, struct page **pages) 160 + u32 bpp, u64 size, u32 offset, 161 + struct page **pages) 161 162 { 162 163 struct xen_drm_front_evtchnl *evtchnl; 163 164 struct xen_drm_front_dbuf *dbuf; ··· 195 194 req->op.dbuf_create.gref_directory = 196 195 xen_front_pgdir_shbuf_get_dir_start(&dbuf->shbuf); 197 196 req->op.dbuf_create.buffer_sz = size; 197 + req->op.dbuf_create.data_ofs = offset; 198 198 req->op.dbuf_create.dbuf_cookie = dbuf_cookie; 199 199 req->op.dbuf_create.width = width; 200 200 req->op.dbuf_create.height = height; ··· 410 408 ret = xen_drm_front_dbuf_create(drm_info->front_info, 411 409 xen_drm_front_dbuf_to_cookie(obj), 412 410 args->width, args->height, args->bpp, 413 - args->size, 411 + args->size, 0, 414 412 xen_drm_front_gem_get_pages(obj)); 415 413 if (ret) 416 414 goto fail_backend;
+1 -1
drivers/gpu/drm/xen/xen_drm_front.h
··· 145 145 146 146 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info, 147 147 u64 dbuf_cookie, u32 width, u32 height, 148 - u32 bpp, u64 size, struct page **pages); 148 + u32 bpp, u64 size, u32 offset, struct page **pages); 149 149 150 150 int xen_drm_front_fb_attach(struct xen_drm_front_info *front_info, 151 151 u64 dbuf_cookie, u64 fb_cookie, u32 width,
+2 -1
drivers/gpu/drm/xen/xen_drm_front_gem.c
··· 210 210 211 211 ret = xen_drm_front_dbuf_create(drm_info->front_info, 212 212 xen_drm_front_dbuf_to_cookie(&xen_obj->base), 213 - 0, 0, 0, size, xen_obj->pages); 213 + 0, 0, 0, size, sgt->sgl->offset, 214 + xen_obj->pages); 214 215 if (ret < 0) 215 216 return ERR_PTR(ret); 216 217