[PATCH 04/49] drm/ttm: provide a driver-led init path for generic mm manager.
Dave Airlie
airlied at gmail.com
Fri Jul 31 07:20:26 UTC 2020
On Fri, 31 Jul 2020 at 16:57, Thomas Zimmermann <tzimmermann at suse.de> wrote:
>
> Hi
>
> Am 31.07.20 um 06:04 schrieb Dave Airlie:
> > From: Dave Airlie <airlied at redhat.com>
> >
> > This lets the generic mm manager be initialised by the driver.
> >
> > Signed-off-by: Dave Airlie <airlied at redhat.com>
> > ---
> > drivers/gpu/drm/ttm/ttm_bo_manager.c | 23 ++++++++++++++++++++---
> > include/drm/ttm/ttm_bo_driver.h | 3 +++
> > 2 files changed, 23 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> > index facd3049c3aa..64234e5caee3 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> > @@ -104,8 +104,8 @@ static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
> > }
> > }
> >
> > -static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
> > - unsigned long p_size)
> > +static int ttm_bo_man_init_private(struct ttm_mem_type_manager *man,
> > + unsigned long p_size)
> > {
> > struct ttm_range_manager *rman;
> >
> > @@ -119,6 +119,23 @@ static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
> > return 0;
> > }
> >
> > +int ttm_bo_man_init(struct ttm_bo_device *bdev,
> > + struct ttm_mem_type_manager *man,
> > + unsigned long p_size)
> > +{
> > + int ret;
> > +
> > + man->func = &ttm_bo_manager_func;
>
> Overriding man->func is the only reason for drivers to call
> ttm_bo_man_init_mm_base and ttm_bo_use_mm directly (e.g., as in nouveau)?
>
> If so, Wouldn't it be better to do
>
> if (!man->func)
> man->func = &ttm_bo_manager_func;
>
> in ttm_bo_man_init and forget about the other fucntions?
No ttm_bo_man_init, is just for the range manager, if you want to use
it, it's not generic code for driver manager that want to use a
different manager class (like nouveau).
Dave.
More information about the dri-devel
mailing list