summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-24 05:51:24 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-24 05:51:24 +0000
commit3162ea963766ba6b006f688ae05c692d7a955d60 (patch)
treee00bcd0ec8653957deb47b0510513b0034d90177
parent76a1250eebd5c78858b3fadb4399f38cf77c399c (diff)
Instead of having a ``private data'' pointer in the dma buffers, just
ask the driver how large they need the structure we allocate to be, and use inheritance like we do for struct device. Simplifies things a little bit and saves us a pointer.
-rw-r--r--sys/dev/pci/drm/drmP.h1
-rw-r--r--sys/dev/pci/drm/drm_bufs.c47
-rw-r--r--sys/dev/pci/drm/drm_dma.c6
-rw-r--r--sys/dev/pci/drm/i915_drv.c1
-rw-r--r--sys/dev/pci/drm/mach64_drv.c1
-rw-r--r--sys/dev/pci/drm/mga_dma.c5
-rw-r--r--sys/dev/pci/drm/mga_drv.h7
-rw-r--r--sys/dev/pci/drm/mga_state.c12
-rw-r--r--sys/dev/pci/drm/r128_cce.c6
-rw-r--r--sys/dev/pci/drm/r128_drv.h11
-rw-r--r--sys/dev/pci/drm/r128_state.c14
-rw-r--r--sys/dev/pci/drm/r300_cmdbuf.c2
-rw-r--r--sys/dev/pci/drm/radeon_cp.c4
-rw-r--r--sys/dev/pci/drm/radeon_drv.h3
-rw-r--r--sys/dev/pci/drm/radeon_state.c2
-rw-r--r--sys/dev/pci/drm/savage_bci.c16
-rw-r--r--sys/dev/pci/drm/savage_drv.h8
-rw-r--r--sys/dev/pci/drm/savage_state.c3
-rw-r--r--sys/dev/pci/drm/sis_drv.c1
-rw-r--r--sys/dev/pci/drm/tdfx_drv.c2
20 files changed, 60 insertions, 92 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index 107cf93653f..d11cef347ec 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -288,7 +288,6 @@ typedef struct drm_buf {
unsigned long bus_address; /* Bus address of buffer */
__volatile__ int pending; /* On hardware DMA queue */
struct drm_file *file_priv; /* Unique identifier of holding process */
- void *dev_private; /* Per-buffer private storage */
} drm_buf_t;
typedef struct drm_dma_handle {
diff --git a/sys/dev/pci/drm/drm_bufs.c b/sys/dev/pci/drm/drm_bufs.c
index 58488b9668c..c2c42d59a8f 100644
--- a/sys/dev/pci/drm/drm_bufs.c
+++ b/sys/dev/pci/drm/drm_bufs.c
@@ -420,7 +420,10 @@ drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request)
entry = &dma->bufs[order];
- entry->buflist = drm_calloc(count, sizeof(*entry->buflist),
+ if (dev->driver->buf_priv_size == 0)
+ return (ENOMEM);
+
+ entry->buflist = drm_calloc(count, dev->driver->buf_priv_size,
DRM_MEM_BUFS);
if (entry->buflist == NULL)
return ENOMEM;
@@ -441,15 +444,6 @@ drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request)
buf->pending = 0;
buf->file_priv = NULL;
- buf->dev_private = drm_calloc(1, dev->driver->buf_priv_size,
- DRM_MEM_BUFS);
- if (buf->dev_private == NULL) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf(dev, entry);
- return ENOMEM;
- }
-
offset += alignment;
entry->buf_count++;
byte_count += PAGE_SIZE << page_order;
@@ -518,7 +512,10 @@ drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request)
entry = &dma->bufs[order];
- entry->buflist = drm_calloc(count, sizeof(*entry->buflist),
+ if (dev->driver->buf_priv_size == 0)
+ return (EINVAL);
+
+ entry->buflist = drm_calloc(count, dev->driver->buf_priv_size,
DRM_MEM_BUFS);
entry->seglist = drm_calloc(count, sizeof(*entry->seglist),
DRM_MEM_BUFS);
@@ -586,20 +583,6 @@ drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request)
buf->pending = 0;
buf->file_priv = NULL;
- buf->dev_private = drm_calloc(1,
- dev->driver->buf_priv_size, DRM_MEM_BUFS);
- if (buf->dev_private == NULL) {
- /* Set count so we free the proper amount. */
- entry->buf_count = count;
- entry->seg_count = count;
- drm_cleanup_buf(dev, entry);
- drm_free(temp_pagelist, (dma->page_count +
- (count << page_order)) *
- sizeof(*dma->pagelist),
- DRM_MEM_BUFS);
- return ENOMEM;
- }
-
DRM_DEBUG("buffer %d\n",
entry->buf_count);
}
@@ -681,7 +664,10 @@ drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request)
entry = &dma->bufs[order];
- entry->buflist = drm_calloc(count, sizeof(*entry->buflist),
+ if (dev->driver->buf_priv_size == 0)
+ return (ENOMEM);
+
+ entry->buflist = drm_calloc(count, dev->driver->buf_priv_size,
DRM_MEM_BUFS);
if (entry->buflist == NULL)
return ENOMEM;
@@ -702,15 +688,6 @@ drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request)
buf->pending = 0;
buf->file_priv = NULL;
- buf->dev_private = drm_calloc(1, dev->driver->buf_priv_size,
- DRM_MEM_BUFS);
- if (buf->dev_private == NULL) {
- /* Set count correctly so we free the proper amount. */
- entry->buf_count = count;
- drm_cleanup_buf(dev, entry);
- return ENOMEM;
- }
-
DRM_DEBUG("buffer %d\n", entry->buf_count);
offset += alignment;
diff --git a/sys/dev/pci/drm/drm_dma.c b/sys/dev/pci/drm/drm_dma.c
index 88334924a6f..6b3ec78fc34 100644
--- a/sys/dev/pci/drm/drm_dma.c
+++ b/sys/dev/pci/drm/drm_dma.c
@@ -68,12 +68,8 @@ drm_cleanup_buf(struct drm_device *dev, drm_buf_entry_t *entry)
}
if (entry->buf_count) {
- for (i = 0; i < entry->buf_count; i++) {
- drm_free(entry->buflist[i].dev_private,
- dev->driver->buf_priv_size, DRM_MEM_BUFS);
- }
drm_free(entry->buflist, entry->buf_count *
- sizeof(*entry->buflist), DRM_MEM_BUFS);
+ dev->driver->buf_priv_size, DRM_MEM_BUFS);
entry->buf_count = 0;
}
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c
index c5cea77a6f1..43dc8edaf07 100644
--- a/sys/dev/pci/drm/i915_drv.c
+++ b/sys/dev/pci/drm/i915_drv.c
@@ -90,7 +90,6 @@ static drm_pci_id_list_t inteldrm_pciidlist[] = {
};
static const struct drm_driver_info inteldrm_driver = {
- .buf_priv_size = 1, /* No dev_priv */
.ioctl = inteldrm_ioctl,
.preclose = i915_driver_preclose,
.lastclose = i915_driver_lastclose,
diff --git a/sys/dev/pci/drm/mach64_drv.c b/sys/dev/pci/drm/mach64_drv.c
index f1d6271ef08..00e0737f69f 100644
--- a/sys/dev/pci/drm/mach64_drv.c
+++ b/sys/dev/pci/drm/mach64_drv.c
@@ -68,7 +68,6 @@ static drm_pci_id_list_t mach64_pciidlist[] = {
};
static const struct drm_driver_info machdrm_driver = {
- .buf_priv_size = 1, /* No dev_priv */
.ioctl = machdrm_ioctl,
.lastclose = mach64_driver_lastclose,
.vblank_pipes = 1,
diff --git a/sys/dev/pci/drm/mga_dma.c b/sys/dev/pci/drm/mga_dma.c
index 992e04ce227..5798718cb05 100644
--- a/sys/dev/pci/drm/mga_dma.c
+++ b/sys/dev/pci/drm/mga_dma.c
@@ -261,7 +261,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_mga_buf_priv_t *)buf;
entry = drm_calloc(1, sizeof(drm_mga_freelist_t),
DRM_MEM_DRIVER);
@@ -271,7 +271,6 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
entry->next = dev_priv->head->next;
entry->prev = dev_priv->head;
SET_AGE(&entry->age, MGA_BUFFER_FREE, 0);
- entry->buf = buf;
if (dev_priv->head->next != NULL)
dev_priv->head->next->prev = entry;
@@ -359,7 +358,7 @@ static struct drm_buf *mga_freelist_get(struct drm_device * dev)
int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf)
{
drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_buf_priv_t *buf_priv = (drm_mga_buf_priv_t *)buf;
drm_mga_freelist_t *head, *entry, *prev;
DRM_DEBUG("age=0x%06lx wrap=%d\n",
diff --git a/sys/dev/pci/drm/mga_drv.h b/sys/dev/pci/drm/mga_drv.h
index a46858aa549..cba4d6945b3 100644
--- a/sys/dev/pci/drm/mga_drv.h
+++ b/sys/dev/pci/drm/mga_drv.h
@@ -69,9 +69,10 @@ typedef struct drm_mga_freelist {
} drm_mga_freelist_t;
typedef struct {
- drm_mga_freelist_t *list_entry;
- int discard;
- int dispatched;
+ struct drm_buf buf;
+ drm_mga_freelist_t *list_entry;
+ int discard;
+ int dispatched;
} drm_mga_buf_priv_t;
typedef struct drm_mga_private {
diff --git a/sys/dev/pci/drm/mga_state.c b/sys/dev/pci/drm/mga_state.c
index f13c60fcdaa..1dae29e6ae4 100644
--- a/sys/dev/pci/drm/mga_state.c
+++ b/sys/dev/pci/drm/mga_state.c
@@ -650,7 +650,7 @@ static void mga_dma_dispatch_swap(struct drm_device * dev)
static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
{
drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_buf_priv_t *buf_priv = (drm_mga_buf_priv_t *)buf;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
u32 address = (u32) buf->bus_address;
u32 length = (u32) buf->used;
@@ -698,7 +698,7 @@ static void mga_dma_dispatch_indices(struct drm_device * dev, struct drm_buf * b
unsigned int start, unsigned int end)
{
drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_buf_priv_t *buf_priv = (drm_mga_buf_priv_t *)buf;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
u32 address = (u32) buf->bus_address;
int i = 0;
@@ -747,7 +747,7 @@ static void mga_dma_dispatch_iload(struct drm_device * dev, struct drm_buf * buf
unsigned int dstorg, unsigned int length)
{
drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_buf_priv_t *buf_priv = (drm_mga_buf_priv_t *)buf;
drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state;
u32 srcorg = buf->bus_address | dev_priv->dma_access | MGA_SRCMAP_SYSMEM;
u32 y2;
@@ -917,7 +917,7 @@ int mga_dma_vertex(struct drm_device *dev, void *data, struct drm_file *file_pri
if (vertex->idx < 0 || vertex->idx > dma->buf_count)
return EINVAL;
buf = dma->buflist[vertex->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_mga_buf_priv_t *)buf;
buf->used = vertex->used;
buf_priv->discard = vertex->discard;
@@ -953,7 +953,7 @@ int mga_dma_indices(struct drm_device *dev, void *data, struct drm_file *file_pr
return EINVAL;
buf = dma->buflist[indices->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_mga_buf_priv_t *)buf;
buf_priv->discard = indices->discard;
@@ -996,7 +996,7 @@ int mga_dma_iload(struct drm_device *dev, void *data, struct drm_file *file_priv
return EINVAL;
buf = dma->buflist[iload->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_mga_buf_priv_t *)buf;
if (mga_verify_iload(dev_priv, iload->dstorg, iload->length)) {
mga_freelist_put(dev, buf);
diff --git a/sys/dev/pci/drm/r128_cce.c b/sys/dev/pci/drm/r128_cce.c
index 2f3f8bd05ac..53e2e2ee132 100644
--- a/sys/dev/pci/drm/r128_cce.c
+++ b/sys/dev/pci/drm/r128_cce.c
@@ -784,7 +784,7 @@ static struct drm_buf *r128_freelist_get(struct drm_device * dev)
for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_r128_buf_priv_t *)buf;
if (buf->file_priv == 0)
return buf;
}
@@ -794,7 +794,7 @@ static struct drm_buf *r128_freelist_get(struct drm_device * dev)
for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_r128_buf_priv_t *)buf;
if (buf->pending && buf_priv->age <= done_age) {
/* The buffer has been processed, so it
* can now be used.
@@ -817,7 +817,7 @@ void r128_freelist_reset(struct drm_device * dev)
for (i = 0; i < dma->buf_count; i++) {
struct drm_buf *buf = dma->buflist[i];
- drm_r128_buf_priv_t *buf_priv = buf->dev_private;
+ drm_r128_buf_priv_t *buf_priv = (drm_r128_buf_priv_t *)buf;
buf_priv->age = 0;
}
}
diff --git a/sys/dev/pci/drm/r128_drv.h b/sys/dev/pci/drm/r128_drv.h
index ca647af09e4..c1ef4df5f53 100644
--- a/sys/dev/pci/drm/r128_drv.h
+++ b/sys/dev/pci/drm/r128_drv.h
@@ -131,11 +131,12 @@ typedef struct drm_r128_private {
} drm_r128_private_t;
typedef struct drm_r128_buf_priv {
- u32 age;
- int prim;
- int discard;
- int dispatched;
- drm_r128_freelist_t *list_entry;
+ struct drm_buf buf;
+ drm_r128_freelist_t *list_entry;
+ u_int32_t age;
+ int prim;
+ int discard;
+ int dispatched;
} drm_r128_buf_priv_t;
/* r128_cce.c */
diff --git a/sys/dev/pci/drm/r128_state.c b/sys/dev/pci/drm/r128_state.c
index a79f44ae467..b831029d8c4 100644
--- a/sys/dev/pci/drm/r128_state.c
+++ b/sys/dev/pci/drm/r128_state.c
@@ -570,7 +570,7 @@ static void r128_cce_dispatch_flip(struct drm_device * dev)
static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
{
drm_r128_private_t *dev_priv = dev->dev_private;
- drm_r128_buf_priv_t *buf_priv = buf->dev_private;
+ drm_r128_buf_priv_t *buf_priv = (drm_r128_buf_priv_t *)buf;
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
int format = sarea_priv->vc_format;
int offset = buf->bus_address;
@@ -642,7 +642,7 @@ static void r128_cce_dispatch_indirect(struct drm_device * dev,
struct drm_buf * buf, int start, int end)
{
drm_r128_private_t *dev_priv = dev->dev_private;
- drm_r128_buf_priv_t *buf_priv = buf->dev_private;
+ drm_r128_buf_priv_t *buf_priv = (drm_r128_buf_priv_t *)buf;
RING_LOCALS;
DRM_DEBUG("indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end);
@@ -698,7 +698,7 @@ static void r128_cce_dispatch_indices(struct drm_device * dev,
int start, int end, int count)
{
drm_r128_private_t *dev_priv = dev->dev_private;
- drm_r128_buf_priv_t *buf_priv = buf->dev_private;
+ drm_r128_buf_priv_t *buf_priv = (drm_r128_buf_priv_t *)buf;
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
int format = sarea_priv->vc_format;
int offset = dev->agp_buffer_map->offset - dev_priv->cce_buffers_offset;
@@ -830,7 +830,7 @@ static int r128_cce_dispatch_blit(struct drm_device * dev,
/* Dispatch the indirect buffer.
*/
buf = dma->buflist[blit->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_r128_buf_priv_t *)buf;
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
@@ -1380,7 +1380,7 @@ int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *file_pr
VB_AGE_TEST_WITH_RETURN(dev_priv);
buf = dma->buflist[vertex->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_r128_buf_priv_t *)buf;
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
@@ -1436,7 +1436,7 @@ int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_p
VB_AGE_TEST_WITH_RETURN(dev_priv);
buf = dma->buflist[elts->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_r128_buf_priv_t *)buf;
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
@@ -1574,7 +1574,7 @@ int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file *file_
}
buf = dma->buflist[indirect->idx];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_r128_buf_priv_t *)buf;
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
diff --git a/sys/dev/pci/drm/r300_cmdbuf.c b/sys/dev/pci/drm/r300_cmdbuf.c
index f1f49fcf6fa..c77ade2baf0 100644
--- a/sys/dev/pci/drm/r300_cmdbuf.c
+++ b/sys/dev/pci/drm/r300_cmdbuf.c
@@ -864,7 +864,7 @@ static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv)
static void r300_discard_buffer(struct drm_device * dev, struct drm_buf * buf)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
- drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
+ drm_radeon_buf_priv_t *buf_priv = (drm_radeon_buf_priv_t *)buf;
buf_priv->age = ++dev_priv->sarea_priv->last_dispatch;
buf->pending = 1;
diff --git a/sys/dev/pci/drm/radeon_cp.c b/sys/dev/pci/drm/radeon_cp.c
index b22a2ad9336..7c38809cb45 100644
--- a/sys/dev/pci/drm/radeon_cp.c
+++ b/sys/dev/pci/drm/radeon_cp.c
@@ -1544,7 +1544,7 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
DRM_DEBUG("done_age = %d\n", done_age);
for (i = start; i < dma->buf_count; i++) {
buf = dma->buflist[i];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_radeon_buf_priv_t *)buf;
if (buf->file_priv == NULL || (buf->pending &&
buf_priv->age <=
done_age)) {
@@ -1610,7 +1610,7 @@ void radeon_freelist_reset(struct drm_device * dev)
dev_priv->last_buf = 0;
for (i = 0; i < dma->buf_count; i++) {
struct drm_buf *buf = dma->buflist[i];
- drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
+ drm_radeon_buf_priv_t *buf_priv = (drm_radeon_buf_priv_t *)buf;
buf_priv->age = 0;
}
}
diff --git a/sys/dev/pci/drm/radeon_drv.h b/sys/dev/pci/drm/radeon_drv.h
index f5dd17611fa..c733cb0baf8 100644
--- a/sys/dev/pci/drm/radeon_drv.h
+++ b/sys/dev/pci/drm/radeon_drv.h
@@ -324,7 +324,8 @@ typedef struct drm_radeon_private {
} drm_radeon_private_t;
typedef struct drm_radeon_buf_priv {
- u32 age;
+ struct drm_buf buf;
+ u_int32_t age;
} drm_radeon_buf_priv_t;
typedef struct drm_radeon_kcmd_buffer {
diff --git a/sys/dev/pci/drm/radeon_state.c b/sys/dev/pci/drm/radeon_state.c
index 4863a9b9204..1de5d1693e7 100644
--- a/sys/dev/pci/drm/radeon_state.c
+++ b/sys/dev/pci/drm/radeon_state.c
@@ -1548,7 +1548,7 @@ static void radeon_cp_dispatch_vertex(struct drm_device * dev,
static void radeon_cp_discard_buffer(struct drm_device * dev, struct drm_buf * buf)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
- drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
+ drm_radeon_buf_priv_t *buf_priv = (drm_radeon_buf_priv_t *)buf;
RING_LOCALS;
buf_priv->age = ++dev_priv->sarea_priv->last_dispatch;
diff --git a/sys/dev/pci/drm/savage_bci.c b/sys/dev/pci/drm/savage_bci.c
index 58c9b07a377..df848f0d810 100644
--- a/sys/dev/pci/drm/savage_bci.c
+++ b/sys/dev/pci/drm/savage_bci.c
@@ -214,18 +214,15 @@ static int savage_freelist_init(struct drm_device *dev)
dev_priv->head.next = &dev_priv->tail;
dev_priv->head.prev = NULL;
- dev_priv->head.buf = NULL;
dev_priv->tail.next = NULL;
dev_priv->tail.prev = &dev_priv->head;
- dev_priv->tail.buf = NULL;
for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
- entry = buf->dev_private;
+ entry = (drm_savage_buf_priv_t *)buf;
SET_AGE(&entry->age, 0, 0);
- entry->buf = buf;
entry->next = dev_priv->head.next;
entry->prev = &dev_priv->head;
@@ -256,13 +253,13 @@ static struct drm_buf *savage_freelist_get(struct drm_device *dev)
DRM_DEBUG(" tail=0x%04x %d\n", tail->age.event, tail->age.wrap);
DRM_DEBUG(" head=0x%04x %d\n", event, wrap);
- if (tail->buf && (TEST_AGE(&tail->age, event, wrap) || event == 0)) {
+ if ((TEST_AGE(&tail->age, event, wrap) || event == 0)) {
drm_savage_buf_priv_t *next = tail->next;
drm_savage_buf_priv_t *prev = tail->prev;
prev->next = next;
next->prev = prev;
tail->next = tail->prev = NULL;
- return tail->buf;
+ return &tail->buf;
}
DRM_DEBUG("returning NULL, tail->buf=%p!\n", tail->buf);
@@ -271,8 +268,9 @@ static struct drm_buf *savage_freelist_get(struct drm_device *dev)
void savage_freelist_put(struct drm_device *dev, struct drm_buf *buf)
{
- drm_savage_private_t *dev_priv = dev->dev_private;
- drm_savage_buf_priv_t *entry = buf->dev_private, *prev, *next;
+ drm_savage_private_t *dev_priv = dev->dev_private;
+ drm_savage_buf_priv_t *entry = (drm_savage_buf_priv_t *)buf;
+ drm_savage_buf_priv_t *prev, *next;
DRM_DEBUG("age=0x%04x wrap=%d\n", entry->age.event, entry->age.wrap);
@@ -1000,7 +998,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
for (i = 0; i < dma->buf_count; i++) {
struct drm_buf *buf = dma->buflist[i];
- drm_savage_buf_priv_t *buf_priv = buf->dev_private;
+ drm_savage_buf_priv_t *buf_priv = (drm_savage_buf_priv_t *)buf;
if (buf->file_priv == file_priv && buf_priv &&
buf_priv->next == NULL && buf_priv->prev == NULL) {
diff --git a/sys/dev/pci/drm/savage_drv.h b/sys/dev/pci/drm/savage_drv.h
index 8176ebb8c32..c0082e4cb55 100644
--- a/sys/dev/pci/drm/savage_drv.h
+++ b/sys/dev/pci/drm/savage_drv.h
@@ -55,10 +55,10 @@ typedef struct drm_savage_age {
} drm_savage_age_t;
typedef struct drm_savage_buf_priv {
- struct drm_savage_buf_priv *next;
- struct drm_savage_buf_priv *prev;
- drm_savage_age_t age;
- struct drm_buf *buf;
+ struct drm_buf buf;
+ struct drm_savage_buf_priv *next;
+ struct drm_savage_buf_priv *prev;
+ drm_savage_age_t age;
} drm_savage_buf_priv_t;
typedef struct drm_savage_dma_page {
diff --git a/sys/dev/pci/drm/savage_state.c b/sys/dev/pci/drm/savage_state.c
index 0cb733090eb..024cc46370e 100644
--- a/sys/dev/pci/drm/savage_state.c
+++ b/sys/dev/pci/drm/savage_state.c
@@ -1146,7 +1146,8 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
DMA_FLUSH();
if (dmabuf && cmdbuf->discard) {
- drm_savage_buf_priv_t *buf_priv = dmabuf->dev_private;
+ drm_savage_buf_priv_t *buf_priv =
+ (drm_savage_buf_priv_t *)dmabuf;
uint16_t event;
event = savage_bci_emit_event(dev_priv, SAVAGE_WAIT_3D);
SET_AGE(&buf_priv->age, event, dev_priv->event_wrap);
diff --git a/sys/dev/pci/drm/sis_drv.c b/sys/dev/pci/drm/sis_drv.c
index cdda6c78718..1500824e764 100644
--- a/sys/dev/pci/drm/sis_drv.c
+++ b/sys/dev/pci/drm/sis_drv.c
@@ -47,7 +47,6 @@ static drm_pci_id_list_t sis_pciidlist[] = {
};
static const struct drm_driver_info sis_driver = {
- .buf_priv_size = 1, /* No dev_priv */
.ioctl = sisdrm_ioctl,
.context_ctor = sis_init_context,
.context_dtor = sis_final_context,
diff --git a/sys/dev/pci/drm/tdfx_drv.c b/sys/dev/pci/drm/tdfx_drv.c
index 647a70f3b38..861d3bb871b 100644
--- a/sys/dev/pci/drm/tdfx_drv.c
+++ b/sys/dev/pci/drm/tdfx_drv.c
@@ -54,8 +54,6 @@ static drm_pci_id_list_t tdfxdrm_pciidlist[] = {
};
static const struct drm_driver_info tdfxdrm_driver = {
- .buf_priv_size = 1, /* No dev_priv */
-
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,