aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorFelix Kuehling <[email protected]>2006-10-02 20:34:06 +0000
committerFelix Kuehling <[email protected]>2006-10-02 20:34:06 +0000
commit3fd5aa88eaa6584c9d7292dd0d98499ff1055055 (patch)
tree2db42cf848b7a17f89d32e3a02ab66aab4a45794 /src/mesa
parent346a239f0144b5ba7ebad39b70ee7e125264cd6e (diff)
Bugzilla 6242: [mach64] Use private DMA buffers (only)
https://bugs.freedesktop.org/show_bug.cgi?id=6242 Patch by George Sapountzis: https://bugs.freedesktop.org/attachment.cgi?id=6271 Update to new mach64 DRM 2.0.0 with private DMA buffers. Handle EAGAIN in mach64FireBlitLocked: call drmCommandWrite up to MACH64_TIMEOUT times when EAGAIN is returned. Also handle EAGAIN in mach64FlushVerticesLocked.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_ioctl.c30
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_ioctl.h2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_texmem.c16
4 files changed, 27 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c
index 1889dc2b93c..109da1b5824 100644
--- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c
+++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c
@@ -105,7 +105,7 @@ void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
int prim = mmesa->hw_primitive;
int fd = mmesa->driScreen->fd;
drm_mach64_vertex_t vertex;
- int i, ret;
+ int i;
mmesa->num_verts = 0;
mmesa->vert_used = 0;
@@ -123,6 +123,9 @@ void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
mmesa->dirty |= MACH64_UPLOAD_CLIPRECTS;
if ( !count || !(mmesa->dirty & MACH64_UPLOAD_CLIPRECTS) ) {
+ int to = 0;
+ int ret;
+
/* FIXME: Is this really necessary */
if ( nbox == 1 )
mmesa->sarea->nbox = 0;
@@ -133,7 +136,10 @@ void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
vertex.buf = buffer;
vertex.used = count;
vertex.discard = 1;
- ret = drmCommandWrite( fd, DRM_MACH64_VERTEX, &vertex, sizeof(drm_mach64_vertex_t) );
+ do {
+ ret = drmCommandWrite( fd, DRM_MACH64_VERTEX,
+ &vertex, sizeof(drm_mach64_vertex_t) );
+ } while ( ( ret == -EAGAIN ) && ( to++ < MACH64_TIMEOUT ) );
if ( ret ) {
UNLOCK_HARDWARE( mmesa );
fprintf( stderr, "Error flushing vertex buffer: return = %d\n", ret );
@@ -146,6 +152,8 @@ void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
int nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS, nbox );
drm_clip_rect_t *b = mmesa->sarea->boxes;
int discard = 0;
+ int to = 0;
+ int ret;
mmesa->sarea->nbox = nr - i;
for ( ; i < nr ; i++ ) {
@@ -164,7 +172,10 @@ void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
vertex.buf = buffer;
vertex.used = count;
vertex.discard = discard;
- ret = drmCommandWrite( fd, DRM_MACH64_VERTEX, &vertex, sizeof(drm_mach64_vertex_t) );
+ do {
+ ret = drmCommandWrite( fd, DRM_MACH64_VERTEX,
+ &vertex, sizeof(drm_mach64_vertex_t) );
+ } while ( ( ret == -EAGAIN ) && ( to++ < MACH64_TIMEOUT ) );
if ( ret ) {
UNLOCK_HARDWARE( mmesa );
fprintf( stderr, "Error flushing vertex buffer: return = %d\n", ret );
@@ -180,14 +191,15 @@ void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
* Texture uploads
*/
-void mach64FireBlitLocked( mach64ContextPtr mmesa, drmBufPtr buffer,
+void mach64FireBlitLocked( mach64ContextPtr mmesa, void *buffer,
GLint offset, GLint pitch, GLint format,
GLint x, GLint y, GLint width, GLint height )
{
drm_mach64_blit_t blit;
- GLint ret;
+ int to = 0;
+ int ret;
- blit.idx = buffer->idx;
+ blit.buf = buffer;
blit.offset = offset;
blit.pitch = pitch;
blit.format = format;
@@ -196,8 +208,10 @@ void mach64FireBlitLocked( mach64ContextPtr mmesa, drmBufPtr buffer,
blit.width = width;
blit.height = height;
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_BLIT,
- &blit, sizeof(drm_mach64_blit_t) );
+ do {
+ ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_BLIT,
+ &blit, sizeof(drm_mach64_blit_t) );
+ } while ( ( ret == -EAGAIN ) && ( to++ < MACH64_TIMEOUT ) );
if ( ret ) {
UNLOCK_HARDWARE( mmesa );
diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.h b/src/mesa/drivers/dri/mach64/mach64_ioctl.h
index 8bd958531c1..52fe8634845 100644
--- a/src/mesa/drivers/dri/mach64/mach64_ioctl.h
+++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.h
@@ -74,7 +74,7 @@ static __inline void *mach64AllocDmaLocked( mach64ContextPtr mmesa, int bytes )
return head;
}
-extern void mach64FireBlitLocked( mach64ContextPtr mmesa, drmBufPtr buffer,
+extern void mach64FireBlitLocked( mach64ContextPtr mmesa, void *buffer,
GLint offset, GLint pitch, GLint format,
GLint x, GLint y, GLint width, GLint height );
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 60055e5c9f8..b17de01acc5 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -520,7 +520,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 6, 4, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 0, 0 };
+ static const __DRIversion drm_expected = { 2, 0, 0 };
dri_interface = interface;
diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c
index f771818c898..017fd3535d5 100644
--- a/src/mesa/drivers/dri/mach64/mach64_texmem.c
+++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c
@@ -569,27 +569,17 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa,
remaining > 0 ;
remaining -= rows, y += rows, i++ )
{
- drmBufPtr buffer;
- CARD32 *dst;
-
height = MIN2(remaining, rows);
- /* Grab the dma buffer for the texture blit */
- buffer = mach64GetBufferLocked( mmesa );
-
- dst = (CARD32 *)((char *)buffer->address + MACH64_HOSTDATA_BLIT_OFFSET);
-
assert(image->Data);
{
const GLubyte *src = (const GLubyte *) image->Data +
(y * image->Width + x) * image->TexFormat->TexelBytes;
- const GLuint bytes = width * height * image->TexFormat->TexelBytes;
- memcpy(dst, src, bytes);
- }
- mach64FireBlitLocked( mmesa, buffer, offset, pitch, format,
- x, y, width, height );
+ mach64FireBlitLocked( mmesa, (void *)src, offset, pitch, format,
+ x, y, width, height );
+ }
}