[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-avivo: Changes to 'debian-experimental'



 debian/changelog                            |   21 +
 debian/control                              |    2 
 debian/patches/implicit_declarations.diff   |   57 +++++
 debian/patches/map_mem_ctrl_mem_return.diff |   12 +
 debian/patches/output_init_return.diff      |   19 +
 debian/patches/series                       |    3 
 debian/rules                                |   13 -
 include/avivo.h                             |   37 ++-
 xorg/Makefile.am                            |    2 
 xorg/Makefile.in                            |    7 
 xorg/avivo.c                                |  156 +++++++++++++-
 xorg/avivo_bios.c                           |   75 +++++++
 xorg/avivo_crtc.c                           |  200 +++++++++++++-----
 xorg/avivo_cursor.c                         |    2 
 xorg/avivo_output.c                         |  296 ++++++++++++++++++++++++++++
 xorg/avivo_state.c                          |    4 
 16 files changed, 804 insertions(+), 102 deletions(-)

New commits:
commit 9f11da2c792fceef38562c84a25f8f2bd4c70028
Author: Julien Cristau <jcristau@debian.org>
Date:   Fri Jun 15 01:56:06 2007 +0200

    Prepare changelog for upload.

diff --git a/debian/changelog b/debian/changelog
index a9e6576..164efde 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xserver-xorg-video-avivo (0.0.1+git20070614-1) UNRELEASED; urgency=low
+xserver-xorg-video-avivo (0.0.1+git20070614-1) experimental; urgency=low
 
   * First upload to Debian (closes: #428777).
   * Pull from upstream master branch, commit 52e78cf2.
@@ -12,7 +12,7 @@ xserver-xorg-video-avivo (0.0.1+git20070614-1) UNRELEASED; urgency=low
   * Build with -D_BSD_SOURCE, needed for usleep(), and -Wno-unused, to silence
     harmless warnings.
 
- -- Julien Cristau <jcristau@debian.org>  Fri, 15 Jun 2007 01:13:41 +0200
+ -- Julien Cristau <jcristau@debian.org>  Fri, 15 Jun 2007 01:55:34 +0200
 
 xserver-xorg-video-avivo (0.0.1-0ubuntu2) gutsy; urgency=low
 

commit 9d39c03fde430d898ca727f5ad9d6ef8347d9350
Author: Julien Cristau <jcristau@debian.org>
Date:   Fri Jun 15 01:20:52 2007 +0200

    Fix a bunch of warnings from gcc.
    
    + Build-depend on quilt for the patches and autotools-dev for
      config.{guess,sub}.
    + New patch implicit_declarations.diff: declare various functions in avivo.h
      and add a missing #include in avivo_i2c.c and avivotool/xf86i2c.c; make
      avivo_restore_cursor() non-static.
    + New patch map_mem_ctrl_mem_return.diff: make sure avivo_map_mem_ctrl_mem()
      returns something.
    + New patch output_init_return.diff: ditto for avivo_output_init().
    + Build with -D_BSD_SOURCE, needed for usleep(), and -Wno-unused, to silence
      harmless warnings.

diff --git a/debian/changelog b/debian/changelog
index 425553a..a9e6576 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,18 @@
 xserver-xorg-video-avivo (0.0.1+git20070614-1) UNRELEASED; urgency=low
 
-  * First upload to Debian.
+  * First upload to Debian (closes: #428777).
   * Pull from upstream master branch, commit 52e78cf2.
-
- -- Julien Cristau <jcristau@debian.org>  Thu, 14 Jun 2007 02:00:53 +0200
+  * Add a few patches to fix build warnings:
+    + implicit_declarations.diff: declare various functions in avivo.h and add
+      a missing #include in avivo_i2c.c; make avivo_restore_cursor()
+      non-static;
+    + map_mem_ctrl_mem_return.diff: make sure avivo_map_mem_ctrl_mem() returns
+      something;
+    + output_init_return.diff: ditto for avivo_output_init().
+  * Build with -D_BSD_SOURCE, needed for usleep(), and -Wno-unused, to silence
+    harmless warnings.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 15 Jun 2007 01:13:41 +0200
 
 xserver-xorg-video-avivo (0.0.1-0ubuntu2) gutsy; urgency=low
 
diff --git a/debian/control b/debian/control
index 8d449b2..9801a1d 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: x11
 Priority: extra
 Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
 Uploaders: Julien Cristau <jcristau@debian.org>
-Build-Depends: debhelper (>= 5.0.0), pkg-config, xserver-xorg-dev (>= 2:1.2.99.902), x11proto-video-dev, x11proto-core-dev, x11proto-fonts-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-xext-dev, libpciaccess-dev
+Build-Depends: debhelper (>= 5.0.0), pkg-config, xserver-xorg-dev (>= 2:1.2.99.902), x11proto-video-dev, x11proto-core-dev, x11proto-fonts-dev, x11proto-randr-dev, x11proto-render-dev, x11proto-xext-dev, libpciaccess-dev, autotools-dev, quilt
 Standards-Version: 3.7.2
 
 Package: xserver-xorg-video-avivo
diff --git a/debian/patches/implicit_declarations.diff b/debian/patches/implicit_declarations.diff
new file mode 100644
index 0000000..6262fbd
--- /dev/null
+++ b/debian/patches/implicit_declarations.diff
@@ -0,0 +1,57 @@
+Index: xserver-xorg-video-avivo/include/avivo.h
+===================================================================
+--- xserver-xorg-video-avivo.orig/include/avivo.h	2007-06-15 01:27:34.000000000 +0200
++++ xserver-xorg-video-avivo/include/avivo.h	2007-06-15 01:27:56.000000000 +0200
+@@ -331,4 +331,15 @@
+  */
+ void avivo_cursor_init(ScreenPtr screen);
+ 
++
++void avivo_wait_idle(struct avivo_info *avivo);
++
++void avivo_probe_monitor(ScrnInfoPtr screen_info);
++
++void avivo_restore_cursor(ScrnInfoPtr screen_info);
++
++void avivo_save_cursor(ScrnInfoPtr screen_info);
++
++void avivo_setup_cursor(struct avivo_info *avivo, int id, int enable);
++
+ #endif /* _AVIVO_H_ */
+Index: xserver-xorg-video-avivo/xorg/avivo_i2c.c
+===================================================================
+--- xserver-xorg-video-avivo.orig/xorg/avivo_i2c.c	2007-06-15 01:27:34.000000000 +0200
++++ xserver-xorg-video-avivo/xorg/avivo_i2c.c	2007-06-15 01:27:56.000000000 +0200
+@@ -28,6 +28,7 @@
+ #include "avivo.h"
+ #include "radeon_reg.h"
+ #include <stdint.h>
++#include <unistd.h>
+ 
+ void
+ avivo_wait_idle(struct avivo_info *avivo)
+Index: xserver-xorg-video-avivo/xorg/avivo_state.c
+===================================================================
+--- xserver-xorg-video-avivo.orig/xorg/avivo_state.c	2007-06-15 01:27:34.000000000 +0200
++++ xserver-xorg-video-avivo/xorg/avivo_state.c	2007-06-15 01:27:56.000000000 +0200
+@@ -44,7 +44,7 @@
+     state->cursor1_position = INREG(AVIVO_CURSOR1_POSITION);
+ }
+ 
+-static void
++void
+ avivo_restore_cursor(ScrnInfoPtr screen_info)
+ {
+     struct avivo_info *avivo = avivo_get_info(screen_info);
+Index: xserver-xorg-video-avivo/avivotool/xf86i2c.c
+===================================================================
+--- xserver-xorg-video-avivo.orig/avivotool/xf86i2c.c	2007-06-15 01:28:05.000000000 +0200
++++ xserver-xorg-video-avivo/avivotool/xf86i2c.c	2007-06-15 01:28:17.000000000 +0200
+@@ -10,6 +10,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <unistd.h>
+ #include "xf86i2c.h"
+ 
+ #define I2C_TIMEOUT(x)	/*(x)*/  /* Report timeouts */
diff --git a/debian/patches/map_mem_ctrl_mem_return.diff b/debian/patches/map_mem_ctrl_mem_return.diff
new file mode 100644
index 0000000..3966902
--- /dev/null
+++ b/debian/patches/map_mem_ctrl_mem_return.diff
@@ -0,0 +1,12 @@
+Index: xserver-xorg-video-avivo/xorg/avivo.c
+===================================================================
+--- xserver-xorg-video-avivo.orig/xorg/avivo.c	2007-06-15 01:09:13.000000000 +0200
++++ xserver-xorg-video-avivo/xorg/avivo.c	2007-06-15 01:09:24.000000000 +0200
+@@ -193,6 +193,7 @@
+                    "Couldn't map control memory at %p", avivo->ctrl_addr);
+         return 0;
+     }
++    return 1;
+ }
+ 
+ static int
diff --git a/debian/patches/output_init_return.diff b/debian/patches/output_init_return.diff
new file mode 100644
index 0000000..a8da853
--- /dev/null
+++ b/debian/patches/output_init_return.diff
@@ -0,0 +1,19 @@
+Index: xserver-xorg-video-avivo/xorg/avivo_output.c
+===================================================================
+--- xserver-xorg-video-avivo.orig/xorg/avivo_output.c	2007-06-15 01:05:33.000000000 +0200
++++ xserver-xorg-video-avivo/xorg/avivo_output.c	2007-06-15 01:06:28.000000000 +0200
+@@ -261,7 +261,7 @@
+         xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
+                    "Couldn't initialise I2C bus for %s connector %d\n",
+                    xf86ConnectorGetName(type), number);
+-        return;
++        return FALSE;
+     }
+     avivo_output->type = type;
+     avivo_output->number = number;
+@@ -293,4 +293,5 @@
+     output->doubleScanAllowed = FALSE;
+     xf86DrvMsg(screen_info->scrnIndex, X_INFO,
+                "added %s connector %d\n", xf86ConnectorGetName(type), number);
++    return TRUE;
+ }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d83f3ae
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+implicit_declarations.diff
+output_init_return.diff
+map_mem_ctrl_mem_return.diff
diff --git a/debian/rules b/debian/rules
index e8b47c4..2628f3a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,7 +21,9 @@ ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 	confflags += --host=$(DEB_HOST_GNU_TYPE)
 endif
 
-CFLAGS = -Wall -g
+CFLAGS = -Wall -g -Wno-unused
+# _BSD_SOURCE is needed for usleep
+CPPFLAGS = -D_BSD_SOURCE
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -O0
@@ -39,12 +41,13 @@ ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 	cp -f /usr/share/misc/config.guess config.guess
 endif
 	./configure --prefix=/usr --mandir=\$${prefix}/share/man \
-		--infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" \
+		--infodir=\$${prefix}/share/info \
+		CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
 		$(confflags)
 
-build: build-stamp
+build: patch build-stamp
 
-build-stamp:  config.status
+build-stamp: config.status
 	dh_testdir
 
 	# Add here commands to compile the package.
@@ -53,7 +56,7 @@ build-stamp:  config.status
 
 	touch $@
 
-clean:
+clean: xsfclean
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp 

commit 6a5493792146d1528100f72d7b904364c5c23b77
Author: Julien Cristau <jcristau@debian.org>
Date:   Fri Jun 15 00:34:51 2007 +0200

    Update to latest upstream.

diff --git a/debian/changelog b/debian/changelog
index 02f6f3a..425553a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,7 @@
-xserver-xorg-video-avivo (0.0.1+git20070613-1) UNRELEASED; urgency=low
+xserver-xorg-video-avivo (0.0.1+git20070614-1) UNRELEASED; urgency=low
 
   * First upload to Debian.
-  * Pull from upstream master branch, commit 23730b5c.
+  * Pull from upstream master branch, commit 52e78cf2.
 
  -- Julien Cristau <jcristau@debian.org>  Thu, 14 Jun 2007 02:00:53 +0200
 
diff --git a/xorg/Makefile.in b/xorg/Makefile.in
index aa4839b..9dbd5de 100644
--- a/xorg/Makefile.in
+++ b/xorg/Makefile.in
@@ -76,7 +76,8 @@ avivo_drv_laLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(avivo_drv_la_LTLIBRARIES)
 avivo_drv_la_LIBADD =
 am_avivo_drv_la_OBJECTS = avivo_common.lo avivo_state.lo avivo_bios.lo \
-	avivo_cursor.lo avivo_i2c.lo avivo.lo
+	avivo_cursor.lo avivo_crtc.lo avivo_output.lo avivo_i2c.lo \
+	avivo.lo
 avivo_drv_la_OBJECTS = $(am_avivo_drv_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -234,6 +235,8 @@ avivo_drv_la_SOURCES = \
 	 avivo_state.c \
          avivo_bios.c \
 	 avivo_cursor.c \
+	 avivo_crtc.c \
+	 avivo_output.c \
 	 avivo_i2c.c \
          avivo.c
 
@@ -309,8 +312,10 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_bios.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_common.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_crtc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_cursor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_i2c.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_output.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avivo_state.Plo@am__quote@
 
 .c.o:

commit 52e78cf2d65b33ab23a6bea22caf6da68fa77768
Author: Jerome Glisse <glisse@freedesktop.org>
Date:   Thu Jun 14 21:07:14 2007 +0200

    avivo: randr1.2: initial support, not working enable with AVIVO_RR12
    
    For some reason the server is not calling in driver crtc function
    to set video mode thus launching with it will end up in a broken
    display. This why this is disabled by default. Also randr 1.2 still
    need work on rotation, allocating framebuffer, shadow buffer for
    rotation, ...

diff --git a/include/avivo.h b/include/avivo.h
index ac136c0..e83e2b8 100644
--- a/include/avivo.h
+++ b/include/avivo.h
@@ -139,6 +139,7 @@ struct avivo_output_private {
     I2CBusPtr         i2c;
     unsigned long     output_offset;
     int               number;
+    char              *name;
 };
 
 /**
diff --git a/xorg/Makefile.am b/xorg/Makefile.am
index 89c8dad..1a59543 100644
--- a/xorg/Makefile.am
+++ b/xorg/Makefile.am
@@ -33,5 +33,7 @@ avivo_drv_la_SOURCES = \
 	 avivo_state.c \
          avivo_bios.c \
 	 avivo_cursor.c \
+	 avivo_crtc.c \
+	 avivo_output.c \
 	 avivo_i2c.c \
          avivo.c
diff --git a/xorg/avivo.c b/xorg/avivo.c
index 9986ee9..4672ea4 100644
--- a/xorg/avivo.c
+++ b/xorg/avivo.c
@@ -409,6 +409,7 @@ avivo_get_chipset(struct avivo_info *avivo)
 static Bool
 avivo_preinit(ScrnInfoPtr screen_info, int flags)
 {
+    xf86CrtcConfigPtr config;
     struct avivo_info *avivo;
     DisplayModePtr mode;
     ClockRangePtr clock_ranges;
@@ -461,7 +462,7 @@ avivo_preinit(ScrnInfoPtr screen_info, int flags)
     avivo_get_chipset(avivo);
     screen_info->chipset = "avivo";
     screen_info->monitor = screen_info->confScreen->monitor;
-    /* setup depth */
+
     if (!xf86SetDepthBpp(screen_info, 0, 0, 0, Support32bppFb))
         return FALSE;
     xf86PrintDepthBpp(screen_info);
@@ -476,10 +477,73 @@ avivo_preinit(ScrnInfoPtr screen_info, int flags)
     default:
         FatalError("Unsupported screen depth: %d\n", xf86GetDepth());
     }
-
-
+#if AVIVO_RR12
+    if (!avivo_crtc_create(screen_info))
+        return FALSE;
+#if 0
+    if (!avivo_output_setup(screen_info))
+        return FALSE;
+#else
+    avivo_output_setup(screen_info);
+#endif
+    /* color weight */
+    if (!xf86SetWeight(screen_info, rzeros, rzeros))
+        return FALSE;
+    /* visual init */
+    if (!xf86SetDefaultVisual(screen_info, -1))
+        return FALSE;
+    /* TODO: gamma correction */
+    xf86SetGamma(screen_info, gzeros);
+    /* Set display resolution */
+    xf86SetDpi(screen_info, 100, 100);
+    /* probe monitor found */
+    monitor = NULL;
+    config = XF86_CRTC_CONFIG_PTR(screen_info);
+    for (i = 0; i < config->num_output; i++) {
+        xf86OutputPtr output = config->output[i];
+        struct avivo_output_private *avivo_output = output->driver_private;
+        if (output->funcs->detect(output) == XF86OutputStatusConnected) {
+            output->funcs->get_modes(output);
+            monitor = output->MonInfo;
+            xf86PrintEDID(monitor);
+        }
+    }
+    if (monitor == NULL) {
+        xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
+                   "No monitor found.\n");
+        return FALSE;
+    }
+    xf86SetDDCproperties(screen_info, monitor);
+    /* validates mode */
+    clock_ranges = xcalloc(sizeof(ClockRange), 1);
+    if (clock_ranges == NULL) {
+        xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
+                   "Failed to allocate memory for clock range\n");
+        return FALSE;
+    }
+    clock_ranges->minClock = 12000;
+    clock_ranges->maxClock = 165000;
+    clock_ranges->clockIndex = -1;
+    clock_ranges->interlaceAllowed = FALSE;
+    clock_ranges->doubleScanAllowed = FALSE;
+    screen_info->progClock = TRUE;
+    xf86ValidateModes(screen_info, screen_info->monitor->Modes,
+                      screen_info->display->modes, clock_ranges, 0, 320, 2048,
+                      16 * screen_info->bitsPerPixel, 200, 2047,
+                      screen_info->display->virtualX,
+                      screen_info->display->virtualY,
+                      screen_info->videoRam, LOOKUP_BEST_REFRESH);
+    xf86PruneDriverModes(screen_info);
+    /* check if there modes available */
+    if (screen_info->modes == NULL) {
+        xf86DrvMsg(screen_info->scrnIndex, X_ERROR, "No modes available\n");
+        return FALSE;
+    }
+    screen_info->currentMode = screen_info->modes;
+#else
     /* probe BIOS information */
     avivo_probe_info(screen_info);
+
     /* color weight */
     if (!xf86SetWeight(screen_info, rzeros, rzeros))
         return FALSE;
@@ -533,8 +597,8 @@ avivo_preinit(ScrnInfoPtr screen_info, int flags)
         xf86DrvMsg(screen_info->scrnIndex, X_ERROR, "No modes available\n");
         return FALSE;
     }
-
     screen_info->currentMode = screen_info->modes;
+#endif
 
     /* options */
     xf86CollectOptions(screen_info, NULL);
@@ -555,6 +619,7 @@ avivo_preinit(ScrnInfoPtr screen_info, int flags)
 
 #endif
 
+    xf86DrvMsg(screen_info->scrnIndex, X_INFO, "[ScreenPreInit OK]\n");
     return TRUE;
 }
 
@@ -575,8 +640,9 @@ avivo_screen_init(int index, ScreenPtr screen, int argc, char **argv)
 {
     ScrnInfoPtr screen_info = xf86Screens[index];
     struct avivo_info *avivo = avivo_get_info(screen_info);
+    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(screen_info);
     VisualPtr visual;
-    int flags;
+    int flags, i;
     unsigned int mc_memory_map;
     unsigned int mc_memory_map_end;
 
@@ -592,13 +658,6 @@ avivo_screen_init(int index, ScreenPtr screen, int argc, char **argv)
            (avivo->fb_addr >> 16) & AVIVO_MC_MEMORY_MAP_BASE_MASK);
     OUTREG(AVIVO_VGA_FB_START, avivo->fb_addr);
 
-    /* set first video mode */
-    if (!avivo_set_mode(screen_info, screen_info->currentMode))
-        return FALSE;
-
-    /* set the viewport */
-    avivo_adjust_frame(index, screen_info->frameX0, screen_info->frameY0, 0);
-
     /* mi layer */
     miClearVisualTypes();
 
@@ -630,18 +689,43 @@ avivo_screen_init(int index, ScreenPtr screen, int argc, char **argv)
             visual->blueMask = screen_info->mask.blue;
         }
     }
-
     /* must be after RGB ordering fixed */
     fbPictureInit(screen, 0, 0);
 
     xf86SetBlackWhitePixels(screen);
+#if AVIVO_RR12
+    for (i = 0; i < xf86_config->num_crtc; i++) {
+        xf86CrtcPtr crtc = xf86_config->crtc[i];
+        /* Mark that we'll need to re-set the mode for sure */
+        memset(&crtc->mode, 0, sizeof(crtc->mode));
+        if (!crtc->desiredMode.CrtcHDisplay) {
+            memcpy(&crtc->desiredMode, screen_info->currentMode,
+                   sizeof(crtc->desiredMode));
+            crtc->desiredRotation = RR_Rotate_0;
+            crtc->desiredX = 0;
+            crtc->desiredY = 0;
+        }
 
-    xf86DPMSInit(screen, avivo_dpms, 0);
+        if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
+                              crtc->desiredX, crtc->desiredY))
+            return FALSE;
+    }
+#else
+    /* set first video mode */
+    if (!avivo_set_mode(screen_info, screen_info->currentMode))
+        return FALSE;
+#endif
+    /* set the viewport */
+    avivo_adjust_frame(index, screen_info->frameX0, screen_info->frameY0, 0);
 
     miDCInitialize(screen, xf86GetPointerScreenFuncs());
+#if 1
     /* FIXME enormous hack ... */
     avivo->cursor_offset = screen_info->virtualX * screen_info->virtualY * 4;
     avivo_cursor_init(screen);
+#endif
+
+    xf86DPMSInit(screen, avivo_dpms, 0);
 
     if (!miCreateDefColormap(screen))
         return FALSE;
@@ -654,6 +738,12 @@ avivo_screen_init(int index, ScreenPtr screen, int argc, char **argv)
     avivo->close_screen = screen->CloseScreen;
     screen->CloseScreen = avivo_close_screen;
 
+#if AVIVO_RR12
+    if (!xf86CrtcScreenInit(screen))
+        return FALSE;
+#endif
+
+    xf86DrvMsg(screen_info->scrnIndex, X_INFO, "[ScreenInit OK]\n");
     return TRUE;
 }
 
@@ -913,7 +1003,31 @@ avivo_setup_crtc(struct avivo_info *avivo, struct avivo_crtc *crtc,
 
     avivo_crtc_enable(avivo, crtc, 1);
 }
+#if AVIVO_RR12
+static Bool
+avivo_switch_mode(int index, DisplayModePtr mode, int flags)
+{
+    ScrnInfoPtr screen_info = xf86Screens[index];
+    Bool ok;
 
+    xf86DrvMsg(screen_info->scrnIndex, X_INFO,
+               "set mode: hdisp %d, htotal %d, hss %d, hse %d, hsk %d\n",
+               mode->HDisplay, mode->HTotal, mode->HSyncStart, mode->HSyncEnd,
+               mode->HSkew);
+    xf86DrvMsg(screen_info->scrnIndex, X_INFO,
+               "      vdisp %d, vtotal %d, vss %d, vse %d, vsc %d\n",
+               mode->VDisplay, mode->VTotal, mode->VSyncStart, mode->VSyncEnd,
+               mode->VScan);
+
+    ok = xf86SetSingleMode(screen_info, mode, RR_Rotate_0);
+    if (!ok) {
+        xf86DrvMsg(screen_info->scrnIndex, X_INFO, "Failed to set mode\n");
+    } else {
+        xf86DrvMsg(screen_info->scrnIndex, X_INFO, "Setting mode succeed\n");
+    }
+    return ok;
+}
+#else
 static Bool
 avivo_switch_mode(int index, DisplayModePtr mode, int flags)
 {
@@ -947,6 +1061,7 @@ avivo_switch_mode(int index, DisplayModePtr mode, int flags)
 
     return TRUE;
 }
+#endif
 
 /* Set a graphics mode */
 static Bool
diff --git a/xorg/avivo_bios.c b/xorg/avivo_bios.c
index e8d612c..e030602 100644
--- a/xorg/avivo_bios.c
+++ b/xorg/avivo_bios.c
@@ -328,3 +328,78 @@ avivo_probe_info(ScrnInfoPtr screen_info)
         connector = connector->next;
     }
 }
+
+
+int
+avivo_output_clones(ScrnInfoPtr screen_info)
+{
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (screen_info);
+    int o, index_mask;
+
+    for (o = 0; o < config->num_output; o++) {
+	    index_mask |= (1 << o);
+    }
+    return index_mask;
+}
+
+Bool
+avivo_output_setup(ScrnInfoPtr screen_info)
+{
+    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(screen_info);
+    struct avivo_info *avivo = avivo_get_info(screen_info);
+    int offset = 0;
+    int tmp, i;
+
+    if (RADEONGetBIOSInfo(screen_info))
+        return FALSE;
+
+    offset = RADEON_BIOS16(avivo->master_data + 22);
+    if (offset == 0) {
+        xf86DrvMsg(screen_info->scrnIndex, X_INFO,
+                   "No connector table in BIOS");
+        return 1;
+    }
+
+    tmp = RADEON_BIOS16(offset + 4);
+    for (i = 0; i < 8; i++) {
+        if (tmp & (1 << i)) {
+            int portinfo, number, connector_type, tmp0;
+            unsigned int ddc_reg;
+            xf86ConnectorType type;    
+
+            portinfo = RADEON_BIOS16(offset + 6 + i * 2);
+            number = (portinfo >> 8) & 0xf;
+            connector_type = (portinfo >> 4) & 0xf;
+            tmp0 = RADEON_BIOS16(avivo->master_data + 24);
+            ddc_reg = RADEON_BIOS16(tmp0 + 4 + 27 * number) * 4;
+            switch (connector_type) {
+            case 0: type = XF86ConnectorNone; break;
+            case 1: type = XF86ConnectorVGA; break;
+            case 2: type = XF86ConnectorDVI_I; break;
+            case 3: type = XF86ConnectorDVI_D; break;
+            case 4: type = XF86ConnectorDVI_A; break;
+            case 5: type = XF86ConnectorSvideo; break;
+            case 6: type = XF86ConnectorComponent; break;
+            case 7: type = XF86ConnectorLFP; break;
+            case 8: type = XF86ConnectorNone; break;
+            default: type = XF86ConnectorNone; break;
+            }
+
+            switch (type) {
+            case XF86ConnectorVGA:
+            case XF86ConnectorLFP:
+            case XF86ConnectorDVI_I:
+                avivo_output_init(screen_info, type, number, ddc_reg);
+                break;
+            }
+        }
+    }
+
+
+    for (i = 0; i < config->num_output; i++) {
+        xf86OutputPtr output = config->output[i];
+        output->possible_crtcs = (1 << 0) | (1 << 1);
+        output->possible_clones = avivo_output_clones(screen_info);
+    }
+    return TRUE;
+}
diff --git a/xorg/avivo_crtc.c b/xorg/avivo_crtc.c
index 90375be..6233717 100644
--- a/xorg/avivo_crtc.c
+++ b/xorg/avivo_crtc.c
@@ -194,7 +194,16 @@ avivo_crtc_mode_set(xf86CrtcPtr crtc,
     default:
         FatalError("Unsupported screen depth: %d\n", xf86GetDepth());
     }
-
+    xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO,
+               "crtc(%d) hdisp %d, htotal %d, hss %d, hse %d, hsk %d\n",
+               avivo_crtc->crtc_number, adjusted_mode->CrtcHDisplay,
+               adjusted_mode->CrtcHTotal, adjusted_mode->CrtcHSyncStart,
+               adjusted_mode->CrtcHSyncEnd, adjusted_mode->CrtcHSkew);
+    xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO,
+               "crtc(%d) vdisp %d, vtotal %d, vss %d, vse %d, vsc %d\n",
+               avivo_crtc->crtc_number, adjusted_mode->CrtcVDisplay,
+               adjusted_mode->CrtcVTotal, adjusted_mode->CrtcVSyncStart,
+               adjusted_mode->CrtcVSyncEnd, adjusted_mode->VScan);
     /* TODO: find out what this regs truely are for.
      * last guess: Switch from text to graphics mode.
      */
@@ -317,10 +326,10 @@ avivo_crtc_cursor_load_argb(xf86CrtcPtr crtc, CARD32 *image)
 }
 
 static void
-avivo_crtc_destroy(xf86OutputPtr output)
+avivo_crtc_destroy(xf86CrtcPtr crtc)
 {
-    if (output->driver_private)
-        xfree(output->driver_private);
+    if (crtc->driver_private)
+        xfree(crtc->driver_private);
 }
 
 static const xf86CrtcFuncsRec avivo_crtc_funcs = {
@@ -358,6 +367,8 @@ avivo_crtc_init(ScrnInfoPtr screen_info, int crtc_number)
     if (avivo_crtc == NULL)
         return FALSE;
     avivo_crtc->crtc_number = crtc_number;
+    avivo_crtc->fb_offset = 0;
+    avivo_crtc->cursor_offset = 0;
     avivo_crtc->crtc_offset = 0;
     if (avivo_crtc->crtc_number == 1)
         avivo_crtc->crtc_offset = AVIVO_CRTC2_H_TOTAL - AVIVO_CRTC1_H_TOTAL;
@@ -370,6 +381,8 @@ avivo_crtc_init(ScrnInfoPtr screen_info, int crtc_number)
     }
 
     crtc->driver_private = avivo_crtc;
+    xf86DrvMsg(screen_info->scrnIndex, X_INFO,
+               "added CRTC %d\n", crtc_number);
     return TRUE;
 }
 
diff --git a/xorg/avivo_state.c b/xorg/avivo_state.c
index f7a21bf..a1e65f6 100644
--- a/xorg/avivo_state.c
+++ b/xorg/avivo_state.c
@@ -32,7 +32,7 @@
 #include "avivo.h"
 #include "radeon_reg.h"
 
-static void
+void
 avivo_save_cursor(ScrnInfoPtr screen_info)
 {
     struct avivo_info *avivo = avivo_get_info(screen_info);

commit 61f20371eb3af031767776300587eb9dacd453ef
Author: Jerome Glisse <glisse@freedesktop.org>
Date:   Thu Jun 14 18:19:49 2007 +0200

    avivo: fix bugs introduced by randr change.

diff --git a/xorg/avivo.c b/xorg/avivo.c
index 040cee0..9986ee9 100644
--- a/xorg/avivo.c
+++ b/xorg/avivo.c
@@ -461,8 +461,11 @@ avivo_preinit(ScrnInfoPtr screen_info, int flags)
     avivo_get_chipset(avivo);
     screen_info->chipset = "avivo";
     screen_info->monitor = screen_info->confScreen->monitor;
-
-    switch (xf86GetDepth()) {
+    /* setup depth */
+    if (!xf86SetDepthBpp(screen_info, 0, 0, 0, Support32bppFb))
+        return FALSE;
+    xf86PrintDepthBpp(screen_info);
+    switch (screen_info->depth) {
     case 16:
         avivo->bpp = 2;
         break;
@@ -477,11 +480,6 @@ avivo_preinit(ScrnInfoPtr screen_info, int flags)
 
     /* probe BIOS information */
     avivo_probe_info(screen_info);
-
-    if (!xf86SetDepthBpp(screen_info, 0, 0, 0, Support32bppFb))
-        return FALSE;
-    xf86PrintDepthBpp(screen_info);
-
     /* color weight */
     if (!xf86SetWeight(screen_info, rzeros, rzeros))
         return FALSE;
diff --git a/xorg/avivo_cursor.c b/xorg/avivo_cursor.c
index b5588b8..5398438 100644
--- a/xorg/avivo_cursor.c
+++ b/xorg/avivo_cursor.c
@@ -65,7 +65,7 @@ avivo_cursor_set_position(ScrnInfoPtr screen_info, int x, int y)
     avivo->cursor_y = y;
 }
 
-static void
+void
 avivo_setup_cursor(struct avivo_info *avivo, int id, int enable)
 {
     if (id == 1) {

commit ef115f143e6197aae9c2ed59c5759a095467eb28
Author: Jerome Glisse <glisse@freedesktop.org>
Date:   Thu Jun 14 14:58:24 2007 +0200

    avivo: crtc & output handling fixes.

diff --git a/xorg/avivo_crtc.c b/xorg/avivo_crtc.c
index 84a8a90..90375be 100644
--- a/xorg/avivo_crtc.c
+++ b/xorg/avivo_crtc.c
@@ -183,7 +183,7 @@ avivo_crtc_mode_set(xf86CrtcPtr crtc,
     avivo_crtc->fb_pitch = adjusted_mode->CrtcHDisplay;
     avivo_crtc->fb_offset = 0;
     avivo_crtc->fb_length = avivo_crtc->fb_pitch * avivo_crtc->fb_height * 4;
-    switch (xf86GetDepth()) {
+    switch (crtc->scrn->depth) {
     case 16:
         avivo_crtc->fb_format = AVIVO_CRTC_FORMAT_ARGB16;
         break;
@@ -359,7 +359,7 @@ avivo_crtc_init(ScrnInfoPtr screen_info, int crtc_number)
         return FALSE;
     avivo_crtc->crtc_number = crtc_number;
     avivo_crtc->crtc_offset = 0;
-    if (avivo_crtc->crtc_number == 2)
+    if (avivo_crtc->crtc_number == 1)
         avivo_crtc->crtc_offset = AVIVO_CRTC2_H_TOTAL - AVIVO_CRTC1_H_TOTAL;
 
     /* allocate & initialize xf86Crtc */
@@ -390,6 +390,9 @@ avivo_crtc_create(ScrnInfoPtr screen_info)
     /*
      * add both crtc i think all r5xx chipset got two crtc
      */
-
+    if (!avivo_crtc_init(screen_info, 0))
+        return FALSE;
+    if (!avivo_crtc_init(screen_info, 1))
+        return FALSE;
     return TRUE;
 }
diff --git a/xorg/avivo_output.c b/xorg/avivo_output.c
index 8bbd335..805d653 100644
--- a/xorg/avivo_output.c
+++ b/xorg/avivo_output.c
@@ -202,6 +202,7 @@ avivo_output_destroy(xf86OutputPtr output)
     if (avivo_output == NULL)
         return;
     xf86DestroyI2CBusRec(avivo_output->i2c, TRUE, TRUE);
+    xfree(avivo_output->name);
     xfree(avivo_output);
 }
 
@@ -225,21 +226,32 @@ avivo_output_init(ScrnInfoPtr screen_info, xf86ConnectorType type,
 {
     xf86OutputPtr output;
     struct avivo_output_private *avivo_output;
+    int name_size;
 
     /* allocate & initialize private crtc structure */
     avivo_output = xcalloc(sizeof(struct avivo_output_private), 1);
     if (avivo_output == NULL)
         return FALSE;
+    name_size = snprintf(NULL, 0, "%s connector %d",
+                         xf86ConnectorGetName(type), number);
+    avivo_output->name = xcalloc(name_size + 1, 1);
+    if (avivo_output->name == NULL) {
+        xfree(avivo_output);
+        xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
+                   "Failed to allocate memory for I2C bus name\n");
+        return FALSE;
+    }
+    snprintf(avivo_output->name, name_size + 1, "%s connector %d",
+             xf86ConnectorGetName(type), number);
+    avivo_output->i2c = xf86CreateI2CBusRec();
     if (!avivo_output->i2c) {
-        avivo_output->i2c = xf86CreateI2CBusRec();
-        if (!avivo_output->i2c) {
-            xfree(avivo_output);
-            xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
-                       "Couldn't create I2C bus\n");
-            return FALSE;
-        }
+        xfree(avivo_output);
+        xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
+                   "Couldn't create I2C bus for %s connector %d\n",
+                   xf86ConnectorGetName(type), number);
+        return FALSE;
     }
-    avivo_output->i2c->BusName = "DDC";
+    avivo_output->i2c->BusName = avivo_output->name;
     avivo_output->i2c->scrnIndex = screen_info->scrnIndex;
     avivo_output->i2c->I2CPutBits = avivo_i2c_put_bits;
     avivo_output->i2c->I2CGetBits = avivo_i2c_get_bits;
@@ -247,7 +259,8 @@ avivo_output_init(ScrnInfoPtr screen_info, xf86ConnectorType type,
     avivo_output->i2c->DriverPrivate.uval = ddc_reg;
     if (!xf86I2CBusInit(avivo_output->i2c)) {
         xf86DrvMsg(screen_info->scrnIndex, X_ERROR,
-                   "Couldn't initialise I2C bus\n");
+                   "Couldn't initialise I2C bus for %s connector %d\n",
+                   xf86ConnectorGetName(type), number);
         return;
     }
     avivo_output->type = type;
@@ -278,4 +291,6 @@ avivo_output_init(ScrnInfoPtr screen_info, xf86ConnectorType type,
     output->driver_private = avivo_output;
     output->interlaceAllowed = FALSE;
     output->doubleScanAllowed = FALSE;
+    xf86DrvMsg(screen_info->scrnIndex, X_INFO,
+               "added %s connector %d\n", xf86ConnectorGetName(type), number);
 }

commit e9e9a0b35a31840a4b1bff14efd506d2c9e5ac13
Author: Jerome Glisse <glisse@freedesktop.org>
Date:   Thu Jun 14 14:14:15 2007 +0200

    avivo: randr 1.2: fix crtc & output handling (not activated yet)

diff --git a/xorg/avivo_crtc.c b/xorg/avivo_crtc.c
index 1e5cebc..84a8a90 100644
--- a/xorg/avivo_crtc.c
+++ b/xorg/avivo_crtc.c
@@ -25,6 +25,9 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+/* DPMS */
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
 
 #include "avivo.h"
 #include "radeon_reg.h"
@@ -179,7 +182,7 @@ avivo_crtc_mode_set(xf86CrtcPtr crtc,
     avivo_crtc->fb_height = adjusted_mode->CrtcVDisplay;
     avivo_crtc->fb_pitch = adjusted_mode->CrtcHDisplay;
     avivo_crtc->fb_offset = 0;
-    avivo_crtc->fb_length = avivo_crtc->fb_pitch * crtc->fb_height * 4;
+    avivo_crtc->fb_length = avivo_crtc->fb_pitch * avivo_crtc->fb_height * 4;
     switch (xf86GetDepth()) {
     case 16:
         avivo_crtc->fb_format = AVIVO_CRTC_FORMAT_ARGB16;
@@ -189,6 +192,7 @@ avivo_crtc_mode_set(xf86CrtcPtr crtc,
         avivo_crtc->fb_format = AVIVO_CRTC_FORMAT_ARGB32;
         break;
     default:
+        FatalError("Unsupported screen depth: %d\n", xf86GetDepth());
     }
 
     /* TODO: find out what this regs truely are for.
@@ -210,7 +214,7 @@ avivo_crtc_mode_set(xf86CrtcPtr crtc,
     /* set PLL TODO: there is likely PLL registers we miss for having
      * different PLL for each CRTC for instance.
      */
-    avivo_crtc_set_pll(avivo, avivo_crtc, adjusted_mode);
+    avivo_crtc_set_pll(crtc, adjusted_mode);
 
     /* finaly set the mode
      */
@@ -259,13 +263,13 @@ avivo_crtc_commit(xf86CrtcPtr crtc)
 }
 
 static void
-avivo_crtc_cursor_set_colors(xf86CrtcPtr crtc, int bg, int fg)
+avivo_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
 {
     /* TODO: implement */
 }
 
 static void
-avivo_crtc_cursor_set_position(xf86CrtcPtr crtc, int x, int y)
+avivo_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
 {
     struct avivo_crtc_private *avivo_crtc = crtc->driver_private;
     struct avivo_info *avivo = avivo_get_info(crtc->scrn);
@@ -281,7 +285,7 @@ avivo_crtc_cursor_set_position(xf86CrtcPtr crtc, int x, int y)
 }
 
 static void
-avivo_crtc_cursor_show(xf86CrtcPtr crtc)
+avivo_crtc_show_cursor(xf86CrtcPtr crtc)
 {
     struct avivo_crtc_private *avivo_crtc = crtc->driver_private;
     struct avivo_info *avivo = avivo_get_info(crtc->scrn);
@@ -292,7 +296,7 @@ avivo_crtc_cursor_show(xf86CrtcPtr crtc)
 }
 
 static void
-avivo_crtc_cursor_hide(xf86CrtcPtr crtc)
+avivo_crtc_hide_cursor(xf86CrtcPtr crtc)
 {
     struct avivo_crtc_private *avivo_crtc = crtc->driver_private;
     struct avivo_info *avivo = avivo_get_info(crtc->scrn);
@@ -338,7 +342,7 @@ static const xf86CrtcFuncsRec avivo_crtc_funcs = {
     .show_cursor = avivo_crtc_show_cursor,
     .hide_cursor = avivo_crtc_hide_cursor,
     .load_cursor_image = NULL,
-    .load_cursor_argb = avivo_crtc_load_cursor_argb,
+    .load_cursor_argb = avivo_crtc_cursor_load_argb,
     .destroy = avivo_crtc_destroy,
 };
 
diff --git a/xorg/avivo_output.c b/xorg/avivo_output.c
index ba4a4f7..8bbd335 100644
--- a/xorg/avivo_output.c
+++ b/xorg/avivo_output.c
@@ -25,6 +25,9 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+/* DPMS */
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
 



Reply to: