summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-10-09 21:09:30 -0400
committerDave Airlie <airlied@linux.ie>2007-10-16 22:03:05 +1100
commitdccefba71a65566e7e1628b3be67621866000411 (patch)
tree339b8d236f0ebca9e88554042fbc648309bc21bc
parent440fc5113ef1ffb1a22bff92cf34eaf23896db8d (diff)
Take bo type argument out of the ioctl interface.
The buffer object type is still tracked internally, but it is no longer part of the user space visible ioctl interface. If the bo create ioctl specifies a non-NULL buffer address we assume drm_bo_type_user, otherwise drm_bo_type_dc. Kernel side allocations call drm_buffer_object_create() directly and can still specify drm_bo_type_kernel. Not 100% this makes sense either, but with this patch, the buffer type is no longer exported and we can clean up the internals later on.
-rw-r--r--libdrm/xf86drm.c19
-rw-r--r--libdrm/xf86mm.h8
-rw-r--r--linux-core/drm_bo.c11
-rw-r--r--linux-core/drm_objects.h6
-rw-r--r--shared-core/drm.h8
5 files changed, 19 insertions, 33 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index bb2b3abe..c450a985 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2698,8 +2698,8 @@ static void drmBOCopyReply(const struct drm_bo_info_rep *rep, drmBO *buf)
-int drmBOCreate(int fd, unsigned long start, unsigned long size,
- unsigned pageAlignment, void *user_buffer, drm_bo_type_t type,
+int drmBOCreate(int fd, unsigned long size,
+ unsigned pageAlignment, void *user_buffer,
uint64_t mask,
unsigned hint, drmBO *buf)
{
@@ -2713,23 +2713,11 @@ int drmBOCreate(int fd, unsigned long start, unsigned long size,
req->mask = mask;
req->hint = hint;
req->size = size;
- req->type = type;
req->page_alignment = pageAlignment;
+ req->buffer_start = (unsigned long) user_buffer;
buf->virtual = NULL;
- switch(type) {
- case drm_bo_type_dc:
- req->buffer_start = start;
- break;
- case drm_bo_type_user:
- req->buffer_start = (unsigned long) user_buffer;
- buf->virtual = user_buffer;
- break;
- default:
- return -EINVAL;
- }
-
do {
ret = ioctl(fd, DRM_IOCTL_BO_CREATE, &arg);
} while (ret != 0 && errno == EAGAIN);
@@ -2777,7 +2765,6 @@ int drmBOReference(int fd, unsigned handle, drmBO *buf)
return -errno;
drmBOCopyReply(rep, buf);
- buf->type = drm_bo_type_dc;
buf->mapVirtual = NULL;
buf->mapCount = 0;
buf->virtual = NULL;
diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h
index cacd13af..0dac7eff 100644
--- a/libdrm/xf86mm.h
+++ b/libdrm/xf86mm.h
@@ -106,7 +106,6 @@ typedef struct _drmFence
typedef struct _drmBO
{
- drm_bo_type_t type;
unsigned handle;
uint64_t mapHandle;
uint64_t flags;
@@ -179,10 +178,9 @@ extern int drmBOCreateList(int numTarget, drmBOList *list);
* Buffer object functions.
*/
-extern int drmBOCreate(int fd, unsigned long start, unsigned long size,
- unsigned pageAlignment,void *user_buffer,
- drm_bo_type_t type, uint64_t mask,
- unsigned hint, drmBO *buf);
+extern int drmBOCreate(int fd, unsigned long size,
+ unsigned pageAlignment, void *user_buffer,
+ uint64_t mask, unsigned hint, drmBO *buf);
extern int drmBODestroy(int fd, drmBO *buf);
extern int drmBOReference(int fd, unsigned handle, drmBO *buf);
extern int drmBOUnReference(int fd, drmBO *buf);
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 7dd9856d..e2f460ed 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1620,7 +1620,10 @@ int drm_buffer_object_create(struct drm_device *dev,
INIT_LIST_HEAD(&bo->vma_list);
#endif
bo->dev = dev;
- bo->type = type;
+ if (buffer_start != 0)
+ bo->type = drm_bo_type_user;
+ else
+ bo->type = type;
bo->num_pages = num_pages;
bo->mem.mem_type = DRM_BO_MEM_LOCAL;
bo->mem.num_pages = bo->num_pages;
@@ -1783,8 +1786,8 @@ 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);
+ DRM_DEBUG("drm_bo_create_ioctl: %dkb, %dkb align\n",
+ (int)(req->size / 1024), req->page_alignment * 4);
if (!dev->bm.initialized) {
DRM_ERROR("Buffer object manager is not initialized.\n");
@@ -1792,7 +1795,7 @@ int drm_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
}
ret = drm_buffer_object_create(file_priv->head->dev,
- req->size, req->type, req->mask,
+ req->size, drm_bo_type_dc, req->mask,
req->hint, req->page_alignment,
req->buffer_start, &entry);
if (ret)
diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
index 9748baae..b58db57f 100644
--- a/linux-core/drm_objects.h
+++ b/linux-core/drm_objects.h
@@ -350,6 +350,12 @@ struct drm_bo_mem_reg {
uint32_t hw_tile_stride;
};
+enum drm_bo_type {
+ drm_bo_type_dc,
+ drm_bo_type_user,
+ drm_bo_type_kernel, /* for initial kernel allocations */
+};
+
struct drm_buffer_object {
struct drm_device *dev;
struct drm_user_object base;
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 279f858f..568b1003 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -754,12 +754,6 @@ struct drm_fence_arg {
#define DRM_BO_INIT_MINOR 1
-enum drm_bo_type {
- drm_bo_type_dc,
- drm_bo_type_user,
- drm_bo_type_kernel, /* for initial kernel allocations */
-};
-
struct drm_bo_info_req {
uint64_t mask;
uint64_t flags;
@@ -775,8 +769,6 @@ struct drm_bo_create_req {
uint64_t buffer_start;
unsigned int hint;
unsigned int page_alignment;
- enum drm_bo_type type;
- unsigned int pad64;
};
struct drm_bo_op_req {