Flag bit pattern bugfixes. Remove some error messages.
parent
ef8e618cf3
commit
405b5d9ca8
|
@ -2598,6 +2598,7 @@ int drmBOCreate(int fd, drmTTM *ttm, unsigned long start, unsigned long size,
|
||||||
req->type = type;
|
req->type = type;
|
||||||
|
|
||||||
buf->ttm = NULL;
|
buf->ttm = NULL;
|
||||||
|
buf->virtual = NULL;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case drm_bo_type_ttm:
|
case drm_bo_type_ttm:
|
||||||
|
@ -2631,7 +2632,6 @@ int drmBOCreate(int fd, drmTTM *ttm, unsigned long start, unsigned long size,
|
||||||
drmBOCopyReply(rep, buf);
|
drmBOCopyReply(rep, buf);
|
||||||
buf->mapVirtual = NULL;
|
buf->mapVirtual = NULL;
|
||||||
buf->mapCount = 0;
|
buf->mapCount = 0;
|
||||||
buf->virtual = NULL;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2642,6 +2642,12 @@ int drmBODestroy(int fd, drmBO *buf)
|
||||||
drm_bo_arg_request_t *req = &arg.req;
|
drm_bo_arg_request_t *req = &arg.req;
|
||||||
drm_bo_arg_reply_t *rep = &arg.rep;
|
drm_bo_arg_reply_t *rep = &arg.rep;
|
||||||
|
|
||||||
|
if (buf->mapVirtual) {
|
||||||
|
(void) drmUnmap(buf->mapVirtual, buf->start + buf->size);
|
||||||
|
buf->mapVirtual = NULL;
|
||||||
|
buf->virtual = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
arg.handled = 0;
|
arg.handled = 0;
|
||||||
req->handle = buf->handle;
|
req->handle = buf->handle;
|
||||||
req->op = drm_bo_destroy;
|
req->op = drm_bo_destroy;
|
||||||
|
@ -2729,26 +2735,32 @@ int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
|
||||||
drm_bo_arg_reply_t *rep = &arg.rep;
|
drm_bo_arg_reply_t *rep = &arg.rep;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* At the moment, we don't allow recursive mapping of a buffer, since
|
||||||
|
* the first mapping may have to be unmapped before this one to succeed.
|
||||||
|
* This might result in a deadlock. We need a DRM mutex mechanism!!
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (buf->mapCount) {
|
||||||
|
drmMsg("Recursive mapping is currently not allowed.\n");
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we have a virtual address of the buffer.
|
* Make sure we have a virtual address of the buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(stderr, "Address is 0x%08x\n", address);
|
if (!buf->virtual) {
|
||||||
if (!buf->mapVirtual) {
|
drmAddress virtual;
|
||||||
if (buf->mapCount == 0) {
|
ret = drmMap(fd, buf->mapHandle, buf->size + buf->start, &virtual);
|
||||||
drmAddress virtual;
|
if (ret)
|
||||||
ret = drmMap(fd, buf->mapHandle, buf->size + buf->start, &virtual);
|
return ret;
|
||||||
if (ret)
|
buf->mapVirtual = virtual;
|
||||||
return ret;
|
buf->virtual = ((char *) virtual) + buf->start;
|
||||||
++buf->mapCount;
|
fprintf(stderr,"Mapvirtual, virtual: 0x%08x 0x%08x\n",
|
||||||
buf->mapVirtual = virtual;
|
buf->mapVirtual, buf->virtual);
|
||||||
buf->virtual = ((char *) virtual) + buf->start;
|
|
||||||
fprintf(stderr,"Mapvirtual, virtual: 0x%08x 0x%08x\n",
|
|
||||||
buf->mapVirtual, buf->virtual);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Address is 0x%08x\n", address);
|
|
||||||
arg.handled = 0;
|
arg.handled = 0;
|
||||||
req->handle = buf->handle;
|
req->handle = buf->handle;
|
||||||
req->mask = mapFlags;
|
req->mask = mapFlags;
|
||||||
|
@ -2761,17 +2773,10 @@ int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
|
||||||
* This IOCTL synchronizes the buffer.
|
* This IOCTL synchronizes the buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(stderr, "Address is 0x%08x\n", address);
|
|
||||||
do {
|
do {
|
||||||
ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
|
ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg);
|
||||||
} while (ret != 0 && errno == EAGAIN);
|
} while (ret != 0 && errno == EAGAIN);
|
||||||
|
|
||||||
fprintf(stderr, "Address is 0x%08x\n", address);
|
|
||||||
if (ret || !arg.handled || rep->ret) {
|
|
||||||
if (--buf->mapCount == 0) {
|
|
||||||
(void )drmUnmap(buf->mapVirtual, buf->start + buf->size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (!arg.handled)
|
if (!arg.handled)
|
||||||
|
@ -2779,10 +2784,10 @@ int drmBOMap(int fd, drmBO *buf, unsigned mapFlags, unsigned mapHint,
|
||||||
if (rep->ret)
|
if (rep->ret)
|
||||||
return rep->ret;
|
return rep->ret;
|
||||||
|
|
||||||
buf->mapFlags = mapFlags;
|
|
||||||
fprintf(stderr, "Address is 0x%08x\n", address);
|
|
||||||
*address = buf->virtual;
|
|
||||||
drmBOCopyReply(rep, buf);
|
drmBOCopyReply(rep, buf);
|
||||||
|
buf->mapFlags = mapFlags;
|
||||||
|
++buf->mapCount;
|
||||||
|
*address = buf->virtual;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2793,13 +2798,6 @@ int drmBOUnmap(int fd, drmBO *buf)
|
||||||
drm_bo_arg_request_t *req = &arg.req;
|
drm_bo_arg_request_t *req = &arg.req;
|
||||||
drm_bo_arg_reply_t *rep = &arg.rep;
|
drm_bo_arg_reply_t *rep = &arg.rep;
|
||||||
|
|
||||||
if (buf->mapCount == 0) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (--buf->mapCount == 0) {
|
|
||||||
(void) drmUnmap(buf->mapVirtual, buf->start + buf->size);
|
|
||||||
}
|
|
||||||
|
|
||||||
arg.handled = 0;
|
arg.handled = 0;
|
||||||
req->handle = buf->handle;
|
req->handle = buf->handle;
|
||||||
|
@ -2814,6 +2812,8 @@ int drmBOUnmap(int fd, drmBO *buf)
|
||||||
if (rep->ret)
|
if (rep->ret)
|
||||||
return rep->ret;
|
return rep->ret;
|
||||||
|
|
||||||
|
--buf->mapCount;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2825,6 +2825,11 @@ int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask,
|
||||||
drm_bo_arg_reply_t *rep = &arg.rep;
|
drm_bo_arg_reply_t *rep = &arg.rep;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (buf->mapCount) {
|
||||||
|
drmMsg("Cannot validate while buffer is mapped.\n");
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
arg.handled = 0;
|
arg.handled = 0;
|
||||||
req->handle = buf->handle;
|
req->handle = buf->handle;
|
||||||
req->mask = flags;
|
req->mask = flags;
|
||||||
|
@ -2988,6 +2993,11 @@ int drmBOValidateList(int fd, drmBOList *list)
|
||||||
if (prevNext)
|
if (prevNext)
|
||||||
*prevNext = (unsigned long) arg;
|
*prevNext = (unsigned long) arg;
|
||||||
|
|
||||||
|
if (node->buf->mapCount) {
|
||||||
|
drmMsg("Cannot validate while buffer is mapped.\n");
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
req->next = 0;
|
req->next = 0;
|
||||||
prevNext = &req->next;
|
prevNext = &req->next;
|
||||||
arg->handled = 0;
|
arg->handled = 0;
|
||||||
|
|
|
@ -70,7 +70,6 @@ static int drm_move_tt_to_local(drm_buffer_object_t * buf)
|
||||||
|
|
||||||
BUG_ON(!buf->tt);
|
BUG_ON(!buf->tt);
|
||||||
|
|
||||||
DRM_ERROR("Flipping out of AGP\n");
|
|
||||||
mutex_lock(&dev->struct_mutex);
|
mutex_lock(&dev->struct_mutex);
|
||||||
drm_unbind_ttm_region(buf->ttm_region);
|
drm_unbind_ttm_region(buf->ttm_region);
|
||||||
drm_mm_put_block(&bm->tt_manager, buf->tt);
|
drm_mm_put_block(&bm->tt_manager, buf->tt);
|
||||||
|
@ -442,8 +441,9 @@ static int drm_move_local_to_tt(drm_buffer_object_t * bo, int no_wait)
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
#ifdef BODEBUG
|
||||||
DRM_ERROR("Flipping in to AGP 0x%08lx\n", bo->tt->start);
|
DRM_ERROR("Flipping in to AGP 0x%08lx\n", bo->tt->start);
|
||||||
|
#endif
|
||||||
mutex_lock(&dev->struct_mutex);
|
mutex_lock(&dev->struct_mutex);
|
||||||
ret = drm_bind_ttm_region(bo->ttm_region, bo->tt->start);
|
ret = drm_bind_ttm_region(bo->ttm_region, bo->tt->start);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -459,9 +459,9 @@ static int drm_move_local_to_tt(drm_buffer_object_t * bo, int no_wait)
|
||||||
bo->flags |= DRM_BO_FLAG_MEM_TT;
|
bo->flags |= DRM_BO_FLAG_MEM_TT;
|
||||||
|
|
||||||
if (bo->priv_flags & _DRM_BO_FLAG_EVICTED) {
|
if (bo->priv_flags & _DRM_BO_FLAG_EVICTED) {
|
||||||
DRM_ERROR("Flush read caches\n");
|
|
||||||
ret = dev->driver->bo_driver->invalidate_caches(dev, bo->flags);
|
ret = dev->driver->bo_driver->invalidate_caches(dev, bo->flags);
|
||||||
DRM_ERROR("Warning: Could not flush read caches\n");
|
if (ret)
|
||||||
|
DRM_ERROR("Warning: Could not flush read caches\n");
|
||||||
}
|
}
|
||||||
DRM_FLAG_MASKED(bo->priv_flags, 0, _DRM_BO_FLAG_EVICTED);
|
DRM_FLAG_MASKED(bo->priv_flags, 0, _DRM_BO_FLAG_EVICTED);
|
||||||
|
|
||||||
|
@ -919,14 +919,12 @@ static int drm_bo_move_buffer(drm_buffer_object_t * bo, uint32_t new_flags,
|
||||||
/*
|
/*
|
||||||
* Flush outstanding fences.
|
* Flush outstanding fences.
|
||||||
*/
|
*/
|
||||||
DRM_ERROR("Flushing fences\n");
|
|
||||||
drm_bo_busy(bo);
|
drm_bo_busy(bo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we're not mapped.
|
* Make sure we're not mapped.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DRM_ERROR("Wait unmapped\n");
|
|
||||||
ret = drm_bo_wait_unmapped(bo, no_wait);
|
ret = drm_bo_wait_unmapped(bo, no_wait);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -935,7 +933,6 @@ static int drm_bo_move_buffer(drm_buffer_object_t * bo, uint32_t new_flags,
|
||||||
* Wait for outstanding fences.
|
* Wait for outstanding fences.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DRM_ERROR("Wait fences\n");
|
|
||||||
ret = drm_bo_wait(bo, 0, no_wait);
|
ret = drm_bo_wait(bo, 0, no_wait);
|
||||||
|
|
||||||
if (ret == -EINTR)
|
if (ret == -EINTR)
|
||||||
|
@ -979,19 +976,21 @@ static int drm_buffer_object_validate(drm_buffer_object_t * bo,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#ifdef BODEBUG
|
||||||
* Check whether we need to move buffer.
|
DRM_ERROR("New flags 0x%08x, Old flags 0x%08x\n",
|
||||||
*/
|
new_flags, bo->flags);
|
||||||
|
#endif
|
||||||
ret = driver->fence_type(new_flags, &bo->fence_class, &bo->fence_flags);
|
ret = driver->fence_type(new_flags, &bo->fence_class, &bo->fence_flags);
|
||||||
DRM_ERROR("Fence type = 0x%08x\n", bo->fence_flags);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("Driver did not support given buffer permissions\n");
|
DRM_ERROR("Driver did not support given buffer permissions\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether we need to move buffer.
|
||||||
|
*/
|
||||||
|
|
||||||
if (flag_diff & DRM_BO_MASK_MEM) {
|
if (flag_diff & DRM_BO_MASK_MEM) {
|
||||||
DRM_ERROR("Calling move buffer\n");
|
|
||||||
ret = drm_bo_move_buffer(bo, new_flags, no_wait);
|
ret = drm_bo_move_buffer(bo, new_flags, no_wait);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1050,7 +1049,7 @@ static int drm_bo_handle_validate(drm_file_t * priv, uint32_t handle,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = drm_bo_new_flags(dev, bo->flags,
|
ret = drm_bo_new_flags(dev, bo->flags,
|
||||||
(flags & mask) | (bo->flags & ~mask), hint,
|
(flags & mask) | (bo->mask & ~mask), hint,
|
||||||
0, &new_flags, &bo->mask);
|
0, &new_flags, &bo->mask);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -447,7 +447,9 @@ int drm_evict_ttm_region(drm_ttm_backend_list_t * entry)
|
||||||
entry->num_pages);
|
entry->num_pages);
|
||||||
drm_ttm_unlock_mm(ttm, 0, 1);
|
drm_ttm_unlock_mm(ttm, 0, 1);
|
||||||
}
|
}
|
||||||
|
#ifdef BODEBUG
|
||||||
DRM_ERROR("Unbinding\n");
|
DRM_ERROR("Unbinding\n");
|
||||||
|
#endif
|
||||||
be->unbind(entry->be);
|
be->unbind(entry->be);
|
||||||
if (ttm && be->needs_cache_adjust(be)) {
|
if (ttm && be->needs_cache_adjust(be)) {
|
||||||
drm_set_caching(ttm, entry->page_offset,
|
drm_set_caching(ttm, entry->page_offset,
|
||||||
|
|
|
@ -693,23 +693,23 @@ typedef struct drm_ttm_arg {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Pinned buffer. */
|
/* Pinned buffer. */
|
||||||
#define DRM_BO_FLAG_NO_EVICT 0x00000001
|
#define DRM_BO_FLAG_NO_EVICT 0x00000010
|
||||||
/* Always keep a system memory shadow to a vram buffer */
|
/* Always keep a system memory shadow to a vram buffer */
|
||||||
#define DRM_BO_FLAG_SHADOW_VRAM 0x00000002
|
#define DRM_BO_FLAG_SHADOW_VRAM 0x00000020
|
||||||
/* When mapped for reading, make sure the buffer is cached even
|
/* When mapped for reading, make sure the buffer is cached even
|
||||||
if it means moving the buffer to system memory */
|
if it means moving the buffer to system memory */
|
||||||
#define DRM_BO_FLAG_SHAREABLE 0x00000004
|
#define DRM_BO_FLAG_SHAREABLE 0x00000040
|
||||||
/* When there is a choice between VRAM and TT, prefer VRAM.
|
/* When there is a choice between VRAM and TT, prefer VRAM.
|
||||||
The default behaviour is to prefer TT. */
|
The default behaviour is to prefer TT. */
|
||||||
#define DRM_BO_FLAG_CACHED 0x00000008
|
#define DRM_BO_FLAG_CACHED 0x00000080
|
||||||
/* The buffer is shareable with other processes */
|
/* The buffer is shareable with other processes */
|
||||||
|
|
||||||
|
|
||||||
#define DRM_BO_FLAG_READ_CACHED 0x00001000
|
#define DRM_BO_FLAG_READ_CACHED 0x00080000
|
||||||
/* The buffer is currently cached */
|
/* The buffer is currently cached */
|
||||||
#define DRM_BO_FLAG_PREFER_VRAM 0x00002000
|
#define DRM_BO_FLAG_PREFER_VRAM 0x00040000
|
||||||
/* Bind this buffer cached if the hardware supports it. */
|
/* Bind this buffer cached if the hardware supports it. */
|
||||||
#define DRM_BO_FLAG_BIND_CACHED 0x00004000
|
#define DRM_BO_FLAG_BIND_CACHED 0x0002000
|
||||||
|
|
||||||
/* Translation table aperture */
|
/* Translation table aperture */
|
||||||
#define DRM_BO_FLAG_MEM_TT 0x01000000
|
#define DRM_BO_FLAG_MEM_TT 0x01000000
|
||||||
|
|
Loading…
Reference in New Issue