On Thu, 25 Jul 2019 at 23:27, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote: > > That way we can ditch our gem_prime_res_obj implementation. Since ttm > absolutely needs the right reservation object all the boilerplate is > already there and we just have to wire it up correctly. > > Note that gem/prime doesn't care when we do this, as long as we do it > before the bo is registered and someone can call the handle2fd ioctl > on it. > > Aside: ttm_buffer_object.ttm_resv could probably be ditched in favour > of always passing a non-NULL resv to ttm_bo_init(). At least for gem > drivers that would avoid having two of these, on in ttm_buffer_object > and the other in drm_gem_object, one just there for confusion. > > Acked-by: Gerd Hoffmann <kraxel@xxxxxxxxxx> > Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx> > Reviewed-by: Emil Velikov <emil.velikov@xxxxxxxxxxxxx> > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx> > Cc: Ben Skeggs <bskeggs@xxxxxxxxxx> > Cc: nouveau@xxxxxxxxxxxxxxxxxxxxx Reviewed-by: Ben Skeggs <bskeggs@xxxxxxxxxx> > --- > drivers/gpu/drm/nouveau/nouveau_bo.c | 2 ++ > drivers/gpu/drm/nouveau/nouveau_drm.c | 1 - > drivers/gpu/drm/nouveau/nouveau_gem.h | 1 - > drivers/gpu/drm/nouveau/nouveau_prime.c | 7 ------- > 4 files changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c > index 34a998012bf6..6f1217b3e6b9 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c > @@ -299,6 +299,8 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, > type, &nvbo->placement, > align >> PAGE_SHIFT, false, acc_size, sg, > robj, nouveau_bo_del_ttm); > + nvbo->gem.resv = nvbo->bo.resv; > + > if (ret) { > /* ttm will call nouveau_bo_del_ttm if it fails.. */ > return ret; > diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c > index 068ff3ad6ed0..7e045580a3a4 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_drm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c > @@ -1131,7 +1131,6 @@ driver_stub = { > .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > .gem_prime_pin = nouveau_gem_prime_pin, > - .gem_prime_res_obj = nouveau_gem_prime_res_obj, > .gem_prime_unpin = nouveau_gem_prime_unpin, > .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table, > .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, > diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h > index 03371204a47c..d67e2f9ec59c 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_gem.h > +++ b/drivers/gpu/drm/nouveau/nouveau_gem.h > @@ -33,7 +33,6 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *, > struct drm_file *); > > extern int nouveau_gem_prime_pin(struct drm_gem_object *); > -struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *); > extern void nouveau_gem_prime_unpin(struct drm_gem_object *); > extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *); > extern struct drm_gem_object *nouveau_gem_prime_import_sg_table( > diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c > index 1fefc93af1d7..ec50017692d4 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_prime.c > +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c > @@ -107,10 +107,3 @@ void nouveau_gem_prime_unpin(struct drm_gem_object *obj) > > nouveau_bo_unpin(nvbo); > } > - > -struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *obj) > -{ > - struct nouveau_bo *nvbo = nouveau_gem_object(obj); > - > - return nvbo->bo.resv; > -} > -- > 2.22.0 > > _______________________________________________ > Nouveau mailing list > Nouveau@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/nouveau _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel