diff options
author | Eric Anholt <eric@anholt.net> | 2007-05-24 16:55:06 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-05-24 16:55:06 -0700 |
commit | b9323aa2cb4563fba1b328dbc802d673449056ac (patch) | |
tree | a2711a7b2152971311607ef72186c86b244e3738 /src/mesa/drivers/dri/common/dri_bufmgr_ttm.c | |
parent | fd9d27e0686f5a15803d13d207e58be1972fdf31 (diff) |
Replace the flags/hint arguments to bo_alloc{,_static} with a location mask.
Now, allocations only take locations, rather than a variety of unused flags.
The only interesting flag before was the no_move/no_evict pair for scanout
and similar buffers, which the DRI drivers don't use. That will be readded
when we get to using this code for display buffer allocation, by adding a
pin/unpin call (dynamic pinning/unpinning may be useful for VT switching and
root window resizing).
This commit changes one instance of DRM_BO_FLAG_MEM_LOCAL with
DRM_BO_FLAG_MEM_TT, which appeared to have been unintentional.
Diffstat (limited to 'src/mesa/drivers/dri/common/dri_bufmgr_ttm.c')
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr_ttm.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c index edf2a923ce..a721a7ce5c 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c @@ -89,13 +89,14 @@ driFenceSignaled(DriFenceObject * fence, unsigned type) static dri_bo * dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, - unsigned long size, unsigned int alignment, unsigned int flags, - unsigned int hint) + unsigned long size, unsigned int alignment, + unsigned int location_mask) { dri_bufmgr_ttm *ttm_bufmgr; dri_bo_ttm *ttm_buf; unsigned int pageSize = getpagesize(); int ret; + unsigned int flags, hint; ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; @@ -103,6 +104,15 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, if (!ttm_buf) return NULL; + /* The mask argument doesn't do anything for us that we want other than + * determine which pool (TTM or local) the buffer is allocated into, so just + * pass all of the allocation class flags. + */ + flags = location_mask | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | + DRM_BO_FLAG_EXE; + /* No hints we want to use. */ + hint = 0; + ret = drmBOCreate(ttm_bufmgr->fd, 0, size, alignment / pageSize, NULL, drm_bo_type_dc, flags, hint, &ttm_buf->drm_bo); @@ -122,11 +132,12 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, static dri_bo * dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset, unsigned long size, void *virtual, - unsigned int flags, unsigned int hint) + unsigned int location_mask) { dri_bufmgr_ttm *ttm_bufmgr; dri_bo_ttm *ttm_buf; int ret; + unsigned int flags, hint; ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; @@ -134,9 +145,18 @@ dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name, if (!ttm_buf) return NULL; + /* The mask argument doesn't do anything for us that we want other than + * determine which pool (TTM or local) the buffer is allocated into, so just + * pass all of the allocation class flags. + */ + flags = location_mask | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | + DRM_BO_FLAG_EXE | DRM_BO_FLAG_NO_EVICT | DRM_BO_FLAG_NO_MOVE; + /* No hints we want to use. */ + hint = 0; + ret = drmBOCreate(ttm_bufmgr->fd, offset, size, 0, NULL, drm_bo_type_fake, - flags, 0, &ttm_buf->drm_bo); + flags, hint, &ttm_buf->drm_bo); if (ret != 0) { free(ttm_buf); return NULL; |