[PATCH] Fix compile errors and warnings when building without DRI

Daniel Stone daniel at fooishbar.org
Sat Oct 27 09:23:16 PDT 2007


Fix a raft of compile errors (unconditional use of memory manager) when
building without DRI.
Fix a bunch of unused variable warnings too.
i830SetPipeBase operated on planes, so make its debug message mention the
plane instead of the pipe, and eliminate the pipe variable altogether.
---
 src/i810_driver.c  |    2 ++
 src/i830_display.c |    3 +--
 src/i830_driver.c  |    2 +-
 src/i830_memory.c  |   13 ++++++++++---
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/i810_driver.c b/src/i810_driver.c
index a6c13ed..488bca6 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -2374,7 +2374,9 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    vgaHWPtr hwp;
    I810Ptr pI810;
    VisualPtr visual;
+#ifdef XF86DRI
    MessageType driFrom = X_DEFAULT;
+#endif
 
    pScrn = xf86Screens[pScreen->myNum];
    pI810 = I810PTR(pScrn);
diff --git a/src/i830_display.c b/src/i830_display.c
index 292814c..e528af0 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -371,7 +371,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
     ScrnInfoPtr pScrn = crtc->scrn;
     I830Ptr pI830 = I830PTR(pScrn);
     I830CrtcPrivatePtr	intel_crtc = crtc->driver_private;
-    int pipe = intel_crtc->pipe;
     int plane = intel_crtc->plane;
     unsigned long Start, Offset;
     int dspbase = (plane == 0 ? DSPABASE : DSPBBASE);
@@ -425,7 +424,7 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
 	    break;
 	default:
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Can't update pipe %d in SAREA\n", pipe);
+		       "Can't update plane %d in SAREA\n", plane);
 	    break;
 	}
     }
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 0ab7e8f..5e4eb77 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -166,6 +166,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 
 #include <assert.h>
+#include <errno.h>
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -202,7 +203,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #ifdef XF86DRI
 #include "dri.h"
 #include <sys/ioctl.h>
-#include <errno.h>
 #ifdef XF86DRI_MM
 #include "xf86mm.h"
 #endif
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 91d7beb..9174f30 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -311,6 +311,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
 
     /* While there is any memory between the start and end markers, free it. */
     while (pI830->memory_list->next->next != NULL) {
+#ifdef XF86DRI_MM
 	i830_memory *mem = pI830->memory_list->next;
 
 	/* Don't reset BO allocator, which we set up at init. */
@@ -319,6 +320,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
 	    if (mem->next == NULL)
 		break;
 	}
+#endif
 
 	i830_free_memory(pScrn, pI830->memory_list->next);
     }
@@ -359,9 +361,9 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
 void
 i830_free_3d_memory(ScrnInfoPtr pScrn)
 {
+#ifdef XF86DRI
     I830Ptr pI830 = I830PTR(pScrn);
 
-#ifdef XF86DRI
     i830_free_memory(pScrn, pI830->back_buffer);
     pI830->back_buffer = NULL;
     i830_free_memory(pScrn, pI830->third_buffer);
@@ -387,8 +389,8 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     i830_memory *start, *end;
-    int ret;
 #ifdef XF86DRI_MM
+    int ret;
     int dri_major, dri_minor, dri_patch;
 #endif
 
@@ -822,14 +824,19 @@ i830_memory *
 i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
 		     unsigned long size, unsigned long alignment, int flags)
 {
+#ifdef XF86DRI_MM
     I830Ptr pI830 = I830PTR(pScrn);
+#endif
     i830_memory *mem;
 
+#ifdef XF86DRI_MM
     if (pI830->memory_manager && !(flags & NEED_PHYSICAL_ADDR) &&
 	!(flags & NEED_LIFETIME_FIXED))
     {
 	return i830_allocate_memory_bo(pScrn, name, size, alignment, flags);
-    } else {
+    } else
+#endif
+    {
 	mem = i830_allocate_aperture(pScrn, name, size, alignment, flags);
 	if (mem == NULL)
 	    return NULL;
-- 
1.5.3.4




More information about the xorg mailing list