static int radeon_emit_packet3_cliprect( drm_device_t *dev,
- drm_radeon_cmd_buffer_t *cmdbuf )
+ drm_radeon_cmd_buffer_t *cmdbuf,
+ int orig_nbox )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
drm_clip_rect_t box;
cmdsz * 4 > cmdbuf->bufsz)
return DRM_ERR(EINVAL);
+ if (!orig_nbox)
+ goto out;
+
do {
if ( i < cmdbuf->nbox ) {
if (DRM_COPY_FROM_USER_UNCHECKED( &box, &boxes[i], sizeof(box) ))
if (cmdbuf->nbox == 1)
cmdbuf->nbox = 0;
+ out:
cmdbuf->buf += cmdsz * 4;
cmdbuf->bufsz -= cmdsz * 4;
return 0;
int idx;
drm_radeon_cmd_buffer_t cmdbuf;
drm_radeon_cmd_header_t header;
+ int orig_nbox;
LOCK_TEST_WITH_RETURN( dev );
cmdbuf.nbox * sizeof(drm_clip_rect_t)))
return DRM_ERR(EFAULT);
+ orig_nbox = cmdbuf.nbox;
+
while ( cmdbuf.bufsz >= sizeof(header) ) {
if (DRM_GET_USER_UNCHECKED( header.i, (int *)cmdbuf.buf )) {
break;
case RADEON_CMD_PACKET3_CLIP:
- if (radeon_emit_packet3_cliprect( dev, &cmdbuf )) {
+ if (radeon_emit_packet3_cliprect( dev, &cmdbuf, orig_nbox )) {
DRM_ERROR("radeon_emit_packet3_clip failed\n");
return DRM_ERR(EINVAL);
}
static int radeon_emit_packet3_cliprect( drm_device_t *dev,
- drm_radeon_cmd_buffer_t *cmdbuf )
+ drm_radeon_cmd_buffer_t *cmdbuf,
+ int orig_nbox )
{
drm_radeon_private_t *dev_priv = dev->dev_private;
drm_clip_rect_t box;
cmdsz * 4 > cmdbuf->bufsz)
return DRM_ERR(EINVAL);
+ if (!orig_nbox)
+ goto out;
+
do {
if ( i < cmdbuf->nbox ) {
if (DRM_COPY_FROM_USER_UNCHECKED( &box, &boxes[i], sizeof(box) ))
if (cmdbuf->nbox == 1)
cmdbuf->nbox = 0;
+ out:
cmdbuf->buf += cmdsz * 4;
cmdbuf->bufsz -= cmdsz * 4;
return 0;
int idx;
drm_radeon_cmd_buffer_t cmdbuf;
drm_radeon_cmd_header_t header;
+ int orig_nbox;
LOCK_TEST_WITH_RETURN( dev );
cmdbuf.nbox * sizeof(drm_clip_rect_t)))
return DRM_ERR(EFAULT);
+ orig_nbox = cmdbuf.nbox;
+
while ( cmdbuf.bufsz >= sizeof(header) ) {
if (DRM_GET_USER_UNCHECKED( header.i, (int *)cmdbuf.buf )) {
break;
case RADEON_CMD_PACKET3_CLIP:
- if (radeon_emit_packet3_cliprect( dev, &cmdbuf )) {
+ if (radeon_emit_packet3_cliprect( dev, &cmdbuf, orig_nbox )) {
DRM_ERROR("radeon_emit_packet3_clip failed\n");
return DRM_ERR(EINVAL);
}