On Mon, Jan 22, 2024 at 04:42:55PM +0000, Biju Das wrote: > +static const struct drm_gem_object_funcs rzg2l_du_gem_funcs = { > + .free = drm_gem_dma_object_free, > + .print_info = drm_gem_dma_object_print_info, > + .get_sg_table = drm_gem_dma_object_get_sg_table, > + .vmap = drm_gem_dma_object_vmap, > + .mmap = drm_gem_dma_object_mmap, > + .vm_ops = &drm_gem_dma_vm_ops, > +}; > + > +struct drm_gem_object * > +rzg2l_du_gem_prime_import_sg_table(struct drm_device *dev, > + struct dma_buf_attachment *attach, > + struct sg_table *sgt) > +{ > + struct drm_gem_dma_object *dma_obj; > + struct drm_gem_object *gem_obj; > + int ret; > + > + /* Create a DMA GEM buffer. */ > + dma_obj = kzalloc(sizeof(*dma_obj), GFP_KERNEL); > + if (!dma_obj) > + return ERR_PTR(-ENOMEM); > + > + gem_obj = &dma_obj->base; > + gem_obj->funcs = &rzg2l_du_gem_funcs; > + > + drm_gem_private_object_init(dev, gem_obj, attach->dmabuf->size); > + dma_obj->map_noncoherent = false; > + > + ret = drm_gem_create_mmap_offset(gem_obj); > + if (ret) { > + drm_gem_object_release(gem_obj); > + kfree(dma_obj); > + return ERR_PTR(ret); > + } > + > + dma_obj->dma_addr = 0; > + dma_obj->sgt = sgt; > + > + return gem_obj; > +} It looks like you're just reusing the helpers there, why do you need to declare a new import_sg_table implementation? Maxime
Attachment:
signature.asc
Description: PGP signature