Austin Yuan wrote: > On Tue, Sep 16, 2008 at 8:07 PM, Thomas Hellström > <[EMAIL PROTECTED]> wrote: > >> Austin, I don't think it's the right thing to add that to this user-space >> interface. >> If you want to target a specific driver with this functionality, just add a >> driver-specific >> ioctl that does exactly what you want. >> >> > Understood. > > >> It looks to me that the best way to do this for camera capture or for >> v4l-like stuff is to have the >> video input kernel driver allocate a buffer object from DRM, and DMA >> directly into that >> buffer object? >> >> It would be better to try to set up such a generic interface within drm >> itself, >> >> > 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); /* 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); /* 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); /* 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. > Thanks > Austin > /Thomas ------------------------------------------------------------------------- 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