summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-10-04 10:01:30 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-10-04 10:01:30 +0200
commit938429090d455aa9cc9dc764e1d0108b72231bb9 (patch)
treea3cfeaa7f48641fddd8d9f4edbd6facc317b8e2a
parent40b411d2e22f274eb945b94cd6edf86d5233da39 (diff)
Revert "Copy the important parts of object_validate into object_create()."
-rw-r--r--linux-core/drm_bo.c61
1 files changed, 5 insertions, 56 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 660ab5ab..10477e34 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1638,7 +1638,6 @@ int drm_buffer_object_create(struct drm_device *dev,
{
struct drm_buffer_manager *bm = &dev->bm;
struct drm_buffer_object *bo;
- struct drm_bo_driver *driver = dev->driver->bo_driver;
int ret = 0;
unsigned long num_pages;
@@ -1699,28 +1698,10 @@ int drm_buffer_object_create(struct drm_device *dev,
if (ret)
goto out_err;
}
-
- bo->fence_class = 0;
- ret = driver->fence_type(bo, &bo->fence_class, &bo->fence_type);
- if (ret) {
- DRM_ERROR("Driver did not support given buffer permissions\n");
- goto out_err;
- }
-
- if (bo->type == drm_bo_type_fake) {
- ret = drm_bo_check_fake(dev, &bo->mem);
- if (ret)
- goto out_err;
- }
-
- ret = drm_bo_add_ttm(bo);
+ ret = drm_buffer_object_validate(bo, 0, 0, hint & DRM_BO_HINT_DONT_BLOCK);
if (ret)
goto out_err;
- mutex_lock(&dev->struct_mutex);
- drm_bo_add_to_lru(bo);
- mutex_unlock(&dev->struct_mutex);
-
mutex_unlock(&bo->mutex);
*buf_obj = bo;
return 0;
@@ -1771,8 +1752,6 @@ int drm_bo_op_ioctl(struct drm_device *dev, void *data, struct drm_file *file_pr
void __user *curuserarg = NULL;
int ret;
- DRM_DEBUG("drm_bo_op_ioctl\n");
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -1845,15 +1824,14 @@ int drm_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
struct drm_buffer_object *entry;
int ret = 0;
- DRM_DEBUG("drm_bo_create_ioctl: %dkb, %dkb align, %d type\n",
- (int)(req->size / 1024), req->page_alignment * 4, req->type);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
}
- if (req->type == drm_bo_type_fake)
- LOCK_TEST_WITH_RETURN(dev, file_priv);
+
+ ret = drm_bo_lock_test(dev, file_priv);
+ if (ret)
+ goto out;
ret = drm_buffer_object_create(file_priv->head->dev,
req->size, req->type, req->mask,
@@ -1884,8 +1862,6 @@ int drm_bo_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
struct drm_user_object *uo;
int ret = 0;
- DRM_DEBUG("drm_bo_destroy_ioctl: buffer %d\n", arg->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -1909,9 +1885,6 @@ int drm_bo_map_ioctl(struct drm_device *dev, void *data, struct drm_file *file_p
struct drm_bo_info_req *req = &arg->d.req;
struct drm_bo_info_rep *rep = &arg->d.rep;
int ret;
-
- DRM_DEBUG("drm_bo_map_ioctl: buffer %d\n", req->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -1929,9 +1902,6 @@ int drm_bo_unmap_ioctl(struct drm_device *dev, void *data, struct drm_file *file
{
struct drm_bo_handle_arg *arg = data;
int ret;
-
- DRM_DEBUG("drm_bo_unmap_ioctl: buffer %d\n", arg->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -1950,8 +1920,6 @@ int drm_bo_reference_ioctl(struct drm_device *dev, void *data, struct drm_file *
struct drm_user_object *uo;
int ret;
- DRM_DEBUG("drm_bo_reference_ioctl: buffer %d\n", req->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -1974,8 +1942,6 @@ int drm_bo_unreference_ioctl(struct drm_device *dev, void *data, struct drm_file
struct drm_bo_handle_arg *arg = data;
int ret = 0;
- DRM_DEBUG("drm_bo_unreference_ioctl: buffer %d\n", arg->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -1992,8 +1958,6 @@ int drm_bo_info_ioctl(struct drm_device *dev, void *data, struct drm_file *file_
struct drm_bo_info_rep *rep = &arg->d.rep;
int ret;
- DRM_DEBUG("drm_bo_info_ioctl: buffer %d\n", req->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -2012,9 +1976,6 @@ int drm_bo_wait_idle_ioctl(struct drm_device *dev, void *data, struct drm_file *
struct drm_bo_info_req *req = &arg->d.req;
struct drm_bo_info_rep *rep = &arg->d.rep;
int ret;
-
- DRM_DEBUG("drm_bo_wait_idle_ioctl: buffer %d\n", req->handle);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -2101,9 +2062,6 @@ int drm_bo_set_pin_ioctl(struct drm_device *dev, void *data,
struct drm_buffer_object *bo;
int ret;
- DRM_DEBUG("drm_bo_set_pin_ioctl: buffer %d, pin %d\n",
- req->handle, req->pin);
-
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
return -EINVAL;
@@ -2533,9 +2491,6 @@ int drm_mm_init_ioctl(struct drm_device *dev, void *data, struct drm_file *file_
struct drm_bo_driver *driver = dev->driver->bo_driver;
int ret;
- DRM_DEBUG("drm_mm_init_ioctl: type %d, 0x%08llx offset, %dkb\n",
- arg->mem_type, arg->p_offset * PAGE_SIZE, (int)(arg->p_size * 4));
-
if (!driver) {
DRM_ERROR("Buffer objects are not supported by this driver\n");
return -EINVAL;
@@ -2590,8 +2545,6 @@ int drm_mm_takedown_ioctl(struct drm_device *dev, void *data, struct drm_file *f
struct drm_bo_driver *driver = dev->driver->bo_driver;
int ret;
- DRM_DEBUG("drm_mm_takedown_ioctl: %d type\n", arg->mem_type);
-
if (!driver) {
DRM_ERROR("Buffer objects are not supported by this driver\n");
return -EINVAL;
@@ -2629,8 +2582,6 @@ int drm_mm_lock_ioctl(struct drm_device *dev, void *data, struct drm_file *file_
struct drm_bo_driver *driver = dev->driver->bo_driver;
int ret;
- DRM_DEBUG("drm_mm_lock_ioctl: %d type\n", arg->mem_type);
-
if (!driver) {
DRM_ERROR("Buffer objects are not supported by this driver\n");
return -EINVAL;
@@ -2653,8 +2604,6 @@ int drm_mm_unlock_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
struct drm_bo_driver *driver = dev->driver->bo_driver;
int ret;
- DRM_DEBUG("drm_mm_unlock_ioctl\n");
-
if (!driver) {
DRM_ERROR("Buffer objects are not supported by this driver\n");
return -EINVAL;