[PATCH 14/15] gma500: nuke the PSB debug stuff

Alan Cox alan at lxorguk.ukuu.org.uk
Mon Jun 13 08:44:03 PDT 2011


> Given that I've mucked around in drm_mm quite a bit I'd be very interested
> in your opinion about what's weird in it (and presumably what could be
> improved). Can you elaborate?

Mostly the API, which is also somewhat poorly documented. I've not dug
into the internals beyond trying to figure out how to use it. Looking at
the users the API is non-obvious, the interface involves a mix of calls
and digging deep into struct internals.

I'd have expected an API that had allocate/free type methods and exposed
the needed information directly or very easily not one that has drivers
doing. drm_sman seems to be attempt in that direction but its also rather
odd with interfaces like


        item = drm_sman_alloc(&dev_priv->sman, mem->type, tmpSize, 0,
                              (unsigned long)file_priv);
        mutex_unlock(&dev->struct_mutex);
        if (item) {
                mem->offset = ((mem->type == VIA_MEM_VIDEO) ?
                              dev_priv->vram_offset :
        dev_priv->agp_offset) + (item->mm->
                     offset(item->mm, item->mm_info) <<
        VIA_MM_ALIGN_SHIFT); mem->index = item->user_hash.key;


where the item->... gymnastics are spectacular to say the least given the
basic function of the allocator appears to be to provide said offset in
the first place.

And ultimately this is why I went with using allocate_region and friends
plus using GEM to do handles, which was a good choice for other reasons
as GEM is rather nicely designed barring the lack of a couple of helpers
and the few lines needed to split the shmem/handle abstraction properly.

Possibly drm_sman and friends should just wrap whatever simple native
allocator exists on the OS ?

Alan




More information about the dri-devel mailing list