whitespace cleanup/aligment with kernel
parent
b2be72c444
commit
1ad5dfc369
|
@ -297,8 +297,7 @@ static int savage_dma_init(drm_savage_private_t *dev_priv)
|
||||||
dev_priv->nr_dma_pages = dev_priv->cmd_dma->size /
|
dev_priv->nr_dma_pages = dev_priv->cmd_dma->size /
|
||||||
(SAVAGE_DMA_PAGE_SIZE*4);
|
(SAVAGE_DMA_PAGE_SIZE*4);
|
||||||
dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) *
|
dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) *
|
||||||
dev_priv->nr_dma_pages,
|
dev_priv->nr_dma_pages, DRM_MEM_DRIVER);
|
||||||
DRM_MEM_DRIVER);
|
|
||||||
if (dev_priv->dma_pages == NULL)
|
if (dev_priv->dma_pages == NULL)
|
||||||
return DRM_ERR(ENOMEM);
|
return DRM_ERR(ENOMEM);
|
||||||
|
|
||||||
|
@ -373,8 +372,7 @@ uint32_t *savage_dma_alloc(drm_savage_private_t *dev_priv, unsigned int n)
|
||||||
|
|
||||||
if (cur + nr_pages < dev_priv->nr_dma_pages) {
|
if (cur + nr_pages < dev_priv->nr_dma_pages) {
|
||||||
dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
|
dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
|
||||||
cur*SAVAGE_DMA_PAGE_SIZE +
|
cur*SAVAGE_DMA_PAGE_SIZE + dev_priv->dma_pages[cur].used;
|
||||||
dev_priv->dma_pages[cur].used;
|
|
||||||
if (n < rest)
|
if (n < rest)
|
||||||
rest = n;
|
rest = n;
|
||||||
dev_priv->dma_pages[cur].used += rest;
|
dev_priv->dma_pages[cur].used += rest;
|
||||||
|
@ -382,7 +380,8 @@ uint32_t *savage_dma_alloc(drm_savage_private_t *dev_priv, unsigned int n)
|
||||||
cur++;
|
cur++;
|
||||||
} else {
|
} else {
|
||||||
dev_priv->dma_flush(dev_priv);
|
dev_priv->dma_flush(dev_priv);
|
||||||
nr_pages = (n + SAVAGE_DMA_PAGE_SIZE-1) / SAVAGE_DMA_PAGE_SIZE;
|
nr_pages =
|
||||||
|
(n + SAVAGE_DMA_PAGE_SIZE-1) / SAVAGE_DMA_PAGE_SIZE;
|
||||||
for (i = cur; i < dev_priv->nr_dma_pages; ++i) {
|
for (i = cur; i < dev_priv->nr_dma_pages; ++i) {
|
||||||
dev_priv->dma_pages[i].age = dev_priv->last_dma_age;
|
dev_priv->dma_pages[i].age = dev_priv->last_dma_age;
|
||||||
dev_priv->dma_pages[i].used = 0;
|
dev_priv->dma_pages[i].used = 0;
|
||||||
|
@ -440,8 +439,7 @@ static void savage_dma_flush(drm_savage_private_t *dev_priv)
|
||||||
/* pad with noops */
|
/* pad with noops */
|
||||||
if (pad) {
|
if (pad) {
|
||||||
uint32_t *dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
|
uint32_t *dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
|
||||||
cur * SAVAGE_DMA_PAGE_SIZE +
|
cur * SAVAGE_DMA_PAGE_SIZE + dev_priv->dma_pages[cur].used;
|
||||||
dev_priv->dma_pages[cur].used;
|
|
||||||
dev_priv->dma_pages[cur].used += pad;
|
dev_priv->dma_pages[cur].used += pad;
|
||||||
while(pad != 0) {
|
while(pad != 0) {
|
||||||
*dma_ptr++ = BCI_CMD_WAIT;
|
*dma_ptr++ = BCI_CMD_WAIT;
|
||||||
|
@ -456,8 +454,7 @@ static void savage_dma_flush(drm_savage_private_t *dev_priv)
|
||||||
(first * SAVAGE_DMA_PAGE_SIZE +
|
(first * SAVAGE_DMA_PAGE_SIZE +
|
||||||
dev_priv->dma_pages[first].flushed) * 4;
|
dev_priv->dma_pages[first].flushed) * 4;
|
||||||
len = (cur - first) * SAVAGE_DMA_PAGE_SIZE +
|
len = (cur - first) * SAVAGE_DMA_PAGE_SIZE +
|
||||||
dev_priv->dma_pages[cur].used -
|
dev_priv->dma_pages[cur].used - dev_priv->dma_pages[first].flushed;
|
||||||
dev_priv->dma_pages[first].flushed;
|
|
||||||
|
|
||||||
DRM_DEBUG("phys_addr=%lx, len=%u\n",
|
DRM_DEBUG("phys_addr=%lx, len=%u\n",
|
||||||
phys_addr | dev_priv->dma_type, len);
|
phys_addr | dev_priv->dma_type, len);
|
||||||
|
@ -585,19 +582,19 @@ int savage_driver_firstopen(drm_device_t *dev)
|
||||||
* MTRRs. */
|
* MTRRs. */
|
||||||
dev_priv->mtrr[0].base = fb_base;
|
dev_priv->mtrr[0].base = fb_base;
|
||||||
dev_priv->mtrr[0].size = 0x01000000;
|
dev_priv->mtrr[0].size = 0x01000000;
|
||||||
dev_priv->mtrr[0].handle = drm_mtrr_add(
|
dev_priv->mtrr[0].handle =
|
||||||
dev_priv->mtrr[0].base, dev_priv->mtrr[0].size,
|
drm_mtrr_add(dev_priv->mtrr[0].base,
|
||||||
DRM_MTRR_WC);
|
dev_priv->mtrr[0].size, DRM_MTRR_WC);
|
||||||
dev_priv->mtrr[1].base = fb_base+0x02000000;
|
dev_priv->mtrr[1].base = fb_base+0x02000000;
|
||||||
dev_priv->mtrr[1].size = 0x02000000;
|
dev_priv->mtrr[1].size = 0x02000000;
|
||||||
dev_priv->mtrr[1].handle = drm_mtrr_add(
|
dev_priv->mtrr[1].handle =
|
||||||
dev_priv->mtrr[1].base, dev_priv->mtrr[1].size,
|
drm_mtrr_add(dev_priv->mtrr[1].base,
|
||||||
DRM_MTRR_WC);
|
dev_priv->mtrr[1].size, DRM_MTRR_WC);
|
||||||
dev_priv->mtrr[2].base = fb_base+0x04000000;
|
dev_priv->mtrr[2].base = fb_base+0x04000000;
|
||||||
dev_priv->mtrr[2].size = 0x04000000;
|
dev_priv->mtrr[2].size = 0x04000000;
|
||||||
dev_priv->mtrr[2].handle = drm_mtrr_add(
|
dev_priv->mtrr[2].handle =
|
||||||
dev_priv->mtrr[2].base, dev_priv->mtrr[2].size,
|
drm_mtrr_add(dev_priv->mtrr[2].base,
|
||||||
DRM_MTRR_WC);
|
dev_priv->mtrr[2].size, DRM_MTRR_WC);
|
||||||
} else {
|
} else {
|
||||||
DRM_ERROR("strange pci_resource_len %08lx\n",
|
DRM_ERROR("strange pci_resource_len %08lx\n",
|
||||||
drm_get_resource_len(dev, 0));
|
drm_get_resource_len(dev, 0));
|
||||||
|
@ -616,9 +613,9 @@ int savage_driver_firstopen(drm_device_t *dev)
|
||||||
* aperture. */
|
* aperture. */
|
||||||
dev_priv->mtrr[0].base = fb_base;
|
dev_priv->mtrr[0].base = fb_base;
|
||||||
dev_priv->mtrr[0].size = 0x08000000;
|
dev_priv->mtrr[0].size = 0x08000000;
|
||||||
dev_priv->mtrr[0].handle = drm_mtrr_add(
|
dev_priv->mtrr[0].handle =
|
||||||
dev_priv->mtrr[0].base, dev_priv->mtrr[0].size,
|
drm_mtrr_add(dev_priv->mtrr[0].base,
|
||||||
DRM_MTRR_WC);
|
dev_priv->mtrr[0].size, DRM_MTRR_WC);
|
||||||
} else {
|
} else {
|
||||||
DRM_ERROR("strange pci_resource_len %08lx\n",
|
DRM_ERROR("strange pci_resource_len %08lx\n",
|
||||||
drm_get_resource_len(dev, 1));
|
drm_get_resource_len(dev, 1));
|
||||||
|
@ -664,8 +661,7 @@ void savage_driver_lastclose(drm_device_t *dev)
|
||||||
if (dev_priv->mtrr[i].handle >= 0)
|
if (dev_priv->mtrr[i].handle >= 0)
|
||||||
drm_mtrr_del(dev_priv->mtrr[i].handle,
|
drm_mtrr_del(dev_priv->mtrr[i].handle,
|
||||||
dev_priv->mtrr[i].base,
|
dev_priv->mtrr[i].base,
|
||||||
dev_priv->mtrr[i].size,
|
dev_priv->mtrr[i].size, DRM_MTRR_WC);
|
||||||
DRM_MTRR_WC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int savage_driver_unload(drm_device_t *dev)
|
int savage_driver_unload(drm_device_t *dev)
|
||||||
|
@ -833,9 +829,10 @@ static int savage_do_init_bci(drm_device_t *dev, drm_savage_init_t *init)
|
||||||
color_tile_format = SAVAGE_BD_TILE_DEST;
|
color_tile_format = SAVAGE_BD_TILE_DEST;
|
||||||
depth_tile_format = SAVAGE_BD_TILE_DEST;
|
depth_tile_format = SAVAGE_BD_TILE_DEST;
|
||||||
}
|
}
|
||||||
front_stride = dev_priv->front_pitch / (dev_priv->fb_bpp/8);
|
front_stride = dev_priv->front_pitch / (dev_priv->fb_bpp / 8);
|
||||||
back_stride = dev_priv-> back_pitch / (dev_priv->fb_bpp/8);
|
back_stride = dev_priv->back_pitch / (dev_priv->fb_bpp / 8);
|
||||||
depth_stride = dev_priv->depth_pitch / (dev_priv->depth_bpp/8);
|
depth_stride =
|
||||||
|
dev_priv->depth_pitch / (dev_priv->depth_bpp / 8);
|
||||||
|
|
||||||
dev_priv->front_bd = front_stride | SAVAGE_BD_BW_DISABLE |
|
dev_priv->front_bd = front_stride | SAVAGE_BD_BW_DISABLE |
|
||||||
(dev_priv->fb_bpp << SAVAGE_BD_BPP_SHIFT) |
|
(dev_priv->fb_bpp << SAVAGE_BD_BPP_SHIFT) |
|
||||||
|
@ -962,8 +959,8 @@ static int savage_bci_event_emit(DRM_IOCTL_ARGS)
|
||||||
|
|
||||||
event.count = savage_bci_emit_event(dev_priv, event.flags);
|
event.count = savage_bci_emit_event(dev_priv, event.flags);
|
||||||
event.count |= dev_priv->event_wrap << 16;
|
event.count |= dev_priv->event_wrap << 16;
|
||||||
DRM_COPY_TO_USER_IOCTL((drm_savage_event_emit_t __user *)data,
|
DRM_COPY_TO_USER_IOCTL(&((drm_savage_event_emit_t __user *)data)->
|
||||||
event, sizeof(event));
|
count, event.count, sizeof(event.count));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,7 +1065,8 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp) {
|
void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp)
|
||||||
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_savage_private_t *dev_priv = dev->dev_private;
|
drm_savage_private_t *dev_priv = dev->dev_private;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -89,7 +89,8 @@ static int savage_verify_texaddr(drm_savage_private_t *dev_priv, int unit,
|
||||||
addr &= ~7;
|
addr &= ~7;
|
||||||
if (addr < dev_priv->texture_offset ||
|
if (addr < dev_priv->texture_offset ||
|
||||||
addr >= dev_priv->texture_offset+dev_priv->texture_size) {
|
addr >= dev_priv->texture_offset+dev_priv->texture_size) {
|
||||||
DRM_ERROR("bad texAddr%d %08x (local addr out of range)\n",
|
DRM_ERROR
|
||||||
|
("bad texAddr%d %08x (local addr out of range)\n",
|
||||||
unit, addr);
|
unit, addr);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,8 @@ static int savage_verify_texaddr(drm_savage_private_t *dev_priv, int unit,
|
||||||
if (addr < dev_priv->agp_textures->offset ||
|
if (addr < dev_priv->agp_textures->offset ||
|
||||||
addr >= (dev_priv->agp_textures->offset +
|
addr >= (dev_priv->agp_textures->offset +
|
||||||
dev_priv->agp_textures->size)) {
|
dev_priv->agp_textures->size)) {
|
||||||
DRM_ERROR("bad texAddr%d %08x (AGP addr out of range)\n",
|
DRM_ERROR
|
||||||
|
("bad texAddr%d %08x (AGP addr out of range)\n",
|
||||||
unit, addr);
|
unit, addr);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -145,8 +147,8 @@ static int savage_verify_state_s3d(drm_savage_private_t *dev_priv,
|
||||||
SAVE_STATE(SAVAGE_TEXCTRL_S3D, s3d.texctrl);
|
SAVE_STATE(SAVAGE_TEXCTRL_S3D, s3d.texctrl);
|
||||||
SAVE_STATE(SAVAGE_TEXADDR_S3D, s3d.texaddr);
|
SAVE_STATE(SAVAGE_TEXADDR_S3D, s3d.texaddr);
|
||||||
if (dev_priv->state.s3d.texctrl & SAVAGE_TEXCTRL_TEXEN_MASK)
|
if (dev_priv->state.s3d.texctrl & SAVAGE_TEXCTRL_TEXEN_MASK)
|
||||||
return savage_verify_texaddr(
|
return savage_verify_texaddr(dev_priv, 0,
|
||||||
dev_priv, 0, dev_priv->state.s3d.texaddr);
|
dev_priv->state.s3d.texaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -172,17 +174,17 @@ static int savage_verify_state_s4(drm_savage_private_t *dev_priv,
|
||||||
|
|
||||||
/* if any texture regs were changed ... */
|
/* if any texture regs were changed ... */
|
||||||
if (start <= SAVAGE_TEXDESCR_S4 &&
|
if (start <= SAVAGE_TEXDESCR_S4 &&
|
||||||
start+count > SAVAGE_TEXPALADDR_S4) {
|
start + count > SAVAGE_TEXPALADDR_S4) {
|
||||||
/* ... check texture state */
|
/* ... check texture state */
|
||||||
SAVE_STATE(SAVAGE_TEXDESCR_S4, s4.texdescr);
|
SAVE_STATE(SAVAGE_TEXDESCR_S4, s4.texdescr);
|
||||||
SAVE_STATE(SAVAGE_TEXADDR0_S4, s4.texaddr0);
|
SAVE_STATE(SAVAGE_TEXADDR0_S4, s4.texaddr0);
|
||||||
SAVE_STATE(SAVAGE_TEXADDR1_S4, s4.texaddr1);
|
SAVE_STATE(SAVAGE_TEXADDR1_S4, s4.texaddr1);
|
||||||
if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX0EN_MASK)
|
if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX0EN_MASK)
|
||||||
ret |= savage_verify_texaddr(
|
ret |= savage_verify_texaddr(dev_priv, 0,
|
||||||
dev_priv, 0, dev_priv->state.s4.texaddr0);
|
dev_priv->state.s4.texaddr0);
|
||||||
if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX1EN_MASK)
|
if (dev_priv->state.s4.texdescr & SAVAGE_TEXDESCR_TEX1EN_MASK)
|
||||||
ret |= savage_verify_texaddr(
|
ret |= savage_verify_texaddr(dev_priv, 1,
|
||||||
dev_priv, 1, dev_priv->state.s4.texaddr1);
|
dev_priv->state.s4.texaddr1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -228,7 +230,8 @@ static int savage_dispatch_state(drm_savage_private_t *dev_priv,
|
||||||
/* scissor regs are emitted in savage_dispatch_draw */
|
/* scissor regs are emitted in savage_dispatch_draw */
|
||||||
if (start < SAVAGE_DRAWCTRL0_S4) {
|
if (start < SAVAGE_DRAWCTRL0_S4) {
|
||||||
if (start+count > SAVAGE_DRAWCTRL1_S4+1)
|
if (start+count > SAVAGE_DRAWCTRL1_S4+1)
|
||||||
count2 = count - (SAVAGE_DRAWCTRL1_S4+1 - start);
|
count2 = count -
|
||||||
|
(SAVAGE_DRAWCTRL1_S4 + 1 - start);
|
||||||
if (start+count > SAVAGE_DRAWCTRL0_S4)
|
if (start+count > SAVAGE_DRAWCTRL0_S4)
|
||||||
count = SAVAGE_DRAWCTRL0_S4 - start;
|
count = SAVAGE_DRAWCTRL0_S4 - start;
|
||||||
} else if (start <= SAVAGE_DRAWCTRL1_S4) {
|
} else if (start <= SAVAGE_DRAWCTRL1_S4) {
|
||||||
|
@ -304,7 +307,8 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv,
|
||||||
case SAVAGE_PRIM_TRISTRIP:
|
case SAVAGE_PRIM_TRISTRIP:
|
||||||
case SAVAGE_PRIM_TRIFAN:
|
case SAVAGE_PRIM_TRIFAN:
|
||||||
if (n < 3) {
|
if (n < 3) {
|
||||||
DRM_ERROR("wrong number of vertices %u in TRIFAN/STRIP\n",
|
DRM_ERROR
|
||||||
|
("wrong number of vertices %u in TRIFAN/STRIP\n",
|
||||||
n);
|
n);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -316,8 +320,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv,
|
||||||
|
|
||||||
if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
||||||
if (skip != 0) {
|
if (skip != 0) {
|
||||||
DRM_ERROR("invalid skip flags 0x%04x for DMA\n",
|
DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip);
|
||||||
skip);
|
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -325,8 +328,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv,
|
||||||
(skip >> 2 & 1) - (skip >> 3 & 1) - (skip >> 4 & 1) -
|
(skip >> 2 & 1) - (skip >> 3 & 1) - (skip >> 4 & 1) -
|
||||||
(skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1);
|
(skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1);
|
||||||
if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) {
|
if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) {
|
||||||
DRM_ERROR("invalid skip flags 0x%04x for DMA\n",
|
DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip);
|
||||||
skip);
|
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
if (reorder) {
|
if (reorder) {
|
||||||
|
@ -380,7 +382,8 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv,
|
||||||
|
|
||||||
for (i = start+1; i+1 < start+count; i += 2)
|
for (i = start+1; i+1 < start+count; i += 2)
|
||||||
BCI_WRITE((i + reorder[i % 3]) |
|
BCI_WRITE((i + reorder[i % 3]) |
|
||||||
((i+1 + reorder[(i+1) % 3]) << 16));
|
((i + 1 +
|
||||||
|
reorder[(i + 1) % 3]) << 16));
|
||||||
if (i < start+count)
|
if (i < start+count)
|
||||||
BCI_WRITE(i + reorder[i%3]);
|
BCI_WRITE(i + reorder[i%3]);
|
||||||
} else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
} else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
||||||
|
@ -441,7 +444,8 @@ static int savage_dispatch_vb_prim(drm_savage_private_t *dev_priv,
|
||||||
case SAVAGE_PRIM_TRISTRIP:
|
case SAVAGE_PRIM_TRISTRIP:
|
||||||
case SAVAGE_PRIM_TRIFAN:
|
case SAVAGE_PRIM_TRIFAN:
|
||||||
if (n < 3) {
|
if (n < 3) {
|
||||||
DRM_ERROR("wrong number of vertices %u in TRIFAN/STRIP\n",
|
DRM_ERROR
|
||||||
|
("wrong number of vertices %u in TRIFAN/STRIP\n",
|
||||||
n);
|
n);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -553,16 +557,15 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv,
|
||||||
prim = SAVAGE_PRIM_TRILIST;
|
prim = SAVAGE_PRIM_TRILIST;
|
||||||
case SAVAGE_PRIM_TRILIST:
|
case SAVAGE_PRIM_TRILIST:
|
||||||
if (n % 3 != 0) {
|
if (n % 3 != 0) {
|
||||||
DRM_ERROR("wrong number of indices %u in TRILIST\n",
|
DRM_ERROR("wrong number of indices %u in TRILIST\n", n);
|
||||||
n);
|
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SAVAGE_PRIM_TRISTRIP:
|
case SAVAGE_PRIM_TRISTRIP:
|
||||||
case SAVAGE_PRIM_TRIFAN:
|
case SAVAGE_PRIM_TRIFAN:
|
||||||
if (n < 3) {
|
if (n < 3) {
|
||||||
DRM_ERROR("wrong number of indices %u in TRIFAN/STRIP\n",
|
DRM_ERROR
|
||||||
n);
|
("wrong number of indices %u in TRIFAN/STRIP\n", n);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -573,8 +576,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv,
|
||||||
|
|
||||||
if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
||||||
if (skip != 0) {
|
if (skip != 0) {
|
||||||
DRM_ERROR("invalid skip flags 0x%04x for DMA\n",
|
DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip);
|
||||||
skip);
|
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -582,8 +584,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv,
|
||||||
(skip >> 2 & 1) - (skip >> 3 & 1) - (skip >> 4 & 1) -
|
(skip >> 2 & 1) - (skip >> 3 & 1) - (skip >> 4 & 1) -
|
||||||
(skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1);
|
(skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1);
|
||||||
if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) {
|
if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) {
|
||||||
DRM_ERROR("invalid skip flags 0x%04x for DMA\n",
|
DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip);
|
||||||
skip);
|
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
if (reorder) {
|
if (reorder) {
|
||||||
|
@ -640,7 +641,8 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv,
|
||||||
|
|
||||||
for (i = 1; i+1 < count; i += 2)
|
for (i = 1; i+1 < count; i += 2)
|
||||||
BCI_WRITE(idx[i + reorder[i % 3]] |
|
BCI_WRITE(idx[i + reorder[i % 3]] |
|
||||||
(idx[i+1 + reorder[(i+1) % 3]] << 16));
|
(idx[i + 1 +
|
||||||
|
reorder[(i + 1) % 3]] << 16));
|
||||||
if (i < count)
|
if (i < count)
|
||||||
BCI_WRITE(idx[i + reorder[i%3]]);
|
BCI_WRITE(idx[i + reorder[i%3]]);
|
||||||
} else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
} else if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
|
||||||
|
@ -674,8 +676,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t *dev_priv,
|
||||||
const drm_savage_cmd_header_t *cmd_header,
|
const drm_savage_cmd_header_t *cmd_header,
|
||||||
const uint16_t *idx,
|
const uint16_t *idx,
|
||||||
const uint32_t *vtxbuf,
|
const uint32_t *vtxbuf,
|
||||||
unsigned int vb_size,
|
unsigned int vb_size, unsigned int vb_stride)
|
||||||
unsigned int vb_stride)
|
|
||||||
{
|
{
|
||||||
unsigned char reorder = 0;
|
unsigned char reorder = 0;
|
||||||
unsigned int prim = cmd_header->idx.prim;
|
unsigned int prim = cmd_header->idx.prim;
|
||||||
|
@ -694,16 +695,15 @@ static int savage_dispatch_vb_idx(drm_savage_private_t *dev_priv,
|
||||||
prim = SAVAGE_PRIM_TRILIST;
|
prim = SAVAGE_PRIM_TRILIST;
|
||||||
case SAVAGE_PRIM_TRILIST:
|
case SAVAGE_PRIM_TRILIST:
|
||||||
if (n % 3 != 0) {
|
if (n % 3 != 0) {
|
||||||
DRM_ERROR("wrong number of indices %u in TRILIST\n",
|
DRM_ERROR("wrong number of indices %u in TRILIST\n", n);
|
||||||
n);
|
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SAVAGE_PRIM_TRISTRIP:
|
case SAVAGE_PRIM_TRISTRIP:
|
||||||
case SAVAGE_PRIM_TRIFAN:
|
case SAVAGE_PRIM_TRIFAN:
|
||||||
if (n < 3) {
|
if (n < 3) {
|
||||||
DRM_ERROR("wrong number of indices %u in TRIFAN/STRIP\n",
|
DRM_ERROR
|
||||||
n);
|
("wrong number of indices %u in TRIFAN/STRIP\n", n);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -805,8 +805,7 @@ static int savage_dispatch_clear(drm_savage_private_t *dev_priv,
|
||||||
BCI_CMD_SET_ROP(clear_cmd,0xCC);
|
BCI_CMD_SET_ROP(clear_cmd,0xCC);
|
||||||
|
|
||||||
nbufs = ((flags & SAVAGE_FRONT) ? 1 : 0) +
|
nbufs = ((flags & SAVAGE_FRONT) ? 1 : 0) +
|
||||||
((flags & SAVAGE_BACK) ? 1 : 0) +
|
((flags & SAVAGE_BACK) ? 1 : 0) + ((flags & SAVAGE_DEPTH) ? 1 : 0);
|
||||||
((flags & SAVAGE_DEPTH) ? 1 : 0);
|
|
||||||
if (nbufs == 0)
|
if (nbufs == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -976,7 +975,8 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS)
|
||||||
|
|
||||||
if (dma && dma->buflist) {
|
if (dma && dma->buflist) {
|
||||||
if (cmdbuf.dma_idx > dma->buf_count) {
|
if (cmdbuf.dma_idx > dma->buf_count) {
|
||||||
DRM_ERROR("vertex buffer index %u out of range (0-%u)\n",
|
DRM_ERROR
|
||||||
|
("vertex buffer index %u out of range (0-%u)\n",
|
||||||
cmdbuf.dma_idx, dma->buf_count-1);
|
cmdbuf.dma_idx, dma->buf_count-1);
|
||||||
return DRM_ERR(EINVAL);
|
return DRM_ERR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue