On Wed, Sep 17, 2008 at 5:04 PM, Thomas Hellström <[EMAIL PROTECTED]> wrote: >> Is there a way to get drm_device in a separate kernel module, which is >> the first parameter of drm_buffer_object_create, if taking TTM as an >> example? >> >> > > No, currently not, but if we were to export buffer object functionality to > other kernel modules > one would have to create a separate interface for that with data types that > may be exported, and > with functionality that is relevant to other kernel modules. > > A v4l / camera capture module would probably want to have an interface > similar to > > struct drm_bo_external; > struct drm_bo_external_sync; > > /* Create an external BO from scratch. @minor is the minor number of the drm > device. Returns a user-space handle. */ > struct drm_bo_external *drm_bo_external_create(int minor, size_t size, > uint32_t *user_space_handle);' > > /* Create an external BO from an already existing BO */ > struct drm_bo_external* drm_bo_external_create_by_reference(int minor, > uint32_t user_space_handle); Maybe pass struct "ttm_bo_create_req" directly. Such V4L client may only care translated table based BO, and I don't thing other devices can DMA data into VRAM.
> > /* Lock pages for external device DMA. > * (Is it possible for an external device to DMA into VRAM using a PCI > address??) > * Here we might want to hint where to lock pages. For fast GPU access or > fast CPU access. > */ > int drm_bo_external_get_pages(struct drm_bo_external *ext_bo, unsigned long > dma_page_addr[], size_t phys_page_addr_size); Return back an array of struct *page, just like get_user_pages? > > /* Release DMA pages. The sync object will have suitable methods for the > buffer manager to > * determine when the external device has finished DMA. > */ > int drm_bo_external_put_pages(struct drm_bo_external *ext_bo, struct > drm_bo_external_sync *sync_obj); Why need sync_obj? I think client should make sure its DMA engine release those pages before call this function > > /* Unreference the exernal BO */ > drm_bo_external_unref(**ext_bo); > > The user-space handles can then be used in the normal execbuf IOCTLS for the > GPU, and for user space data access if allowed by the creating module. > > Such an interface can probably made sufficiently generic to suit any > underlying implementation, be it GEM / TTM or a mix, and it would certainly > be very easy to write such an interface on top of TTM. > > /Thomas > Thomas, thank you for this valuable advice. I am not sure whether such interface can enter into DRM code base. If yes. maybe I can do some further implementation. Austin ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel