Tomas Carnecky wrote:
Hi,

Can I control a graphics card _completely_ with DRI? I mean
allocate the framebuffer, switch between modes etc. Or do I
need some kind of helper code that does these things (like
fbdev or the Xserver)?
I'm particulary interested in allocating memory for the
framebuffer via DRI, I think there is an ioctl for that, but
I'm not sure.
And is it possible to allocate offscreen memory with DRI?
So I could render into it, read the pixels out of it and
put them into an image (for example).


I've checked out the cvs drm and mesa tree and did a bit of browsing..
In the mesa tree under src/mesa/drivers/dri/*/xxx_context.c, there usually is xxxMakeCurrent, xxxCreateContext, xxxDestroyContext, but no xxxCreateFramebuffer. It seems that the framebuffer is allocated somewhere else, not in the dri code.


Then I found this nice file in the drm tree: linux-core/drm_drawable.c
But it's almost empty, only two noop functions. What are they for?
Are they used somewhere? Is DRM_IOCTL_ADD_DRAW used?

It seems to me that the framebuffer is allocated from the main meory, not from the videocard memory.

Ok, I think I've found it: linux-code/drm_bufs.c::drm_addmap (or DRM_IOCTL_ADD_MAP).

typedef struct drm_map {
        unsigned long offset;    /**< Requested physical address (0 for SAREA)*/
        unsigned long size;      /**< Requested physical size (bytes) */
        drm_map_type_t type;     /**< Type of memory to map */
        drm_map_flags_t flags;   /**< Flags */
        void *handle;            /**< User-space: "Handle" to pass to mmap() */
                                 /**< Kernel-space: kernel-virtual address */
        int mtrr;                /**< MTRR slot used */
        /*   Private data */
} drm_map_t;

How can the userspace know which offset is free? Or is it possible to map two overlapping areas? In drm_bufs.c::drm_addmap is:
case _DRM_AGP:
if (drm_core_has_AGP(dev)) {
map->offset += dev->agp->base;
map->mtrr = dev->agp->agp_mtrr; /* for getmap */
}


It just returns the offset plus the start of the agp memory, but no checks for overlapping maps, so is it possible to do the following?
drm_addmap(type = _DRM_AGP, offset = 0, size = 100)
drm_addmap(type = _DRM_AGP, offset = 10, size = 90)


Does the agp memory have some size restrictions? Or can I map any size?
drm_addmap(type = _DRM_AGP, offset = 0, size = MAX_INT)?


thanks tom


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
--
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to