summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin-Éric Racine <q-funk@iki.fi>2008-01-14 03:05:48 +0200
committerMartin-Éric Racine <q-funk@iki.fi>2008-01-14 03:05:48 +0200
commitcf5e5d2b37de2504b76d96e1f26a5450550b8320 (patch)
tree399afd78a4244ef975ab09420d00ba225fc7cbaf
parent471f96cf85c6db9952ff4443f84a3c8d701927e7 (diff)
Basic OLPC support from Bernardo Innocenti and Jordan Crouse.xf86-video-amd-2.7.7.5
-rw-r--r--configure.ac2
-rw-r--r--src/amd.h20
-rw-r--r--src/amd_common.c43
-rw-r--r--src/amd_gx_accel.c1
-rw-r--r--src/amd_gx_driver.c30
-rw-r--r--src/amd_lx_driver.c33
-rw-r--r--src/amd_msr.c1
-rw-r--r--src/durango.c1
-rw-r--r--src/gfx/gfx_init.c2
-rw-r--r--src/gfx/msr_rdcl.c4
-rw-r--r--src/gfx/vid_rdcl.c10
-rw-r--r--src/panel/gx2_9211.c2
-rw-r--r--src/z4l.c3
13 files changed, 104 insertions, 48 deletions
diff --git a/configure.ac b/configure.ac
index 4d2cc46..c630564 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-amd],
- 2.7.7.4,
+ 2.7.7.5,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-amd)
diff --git a/src/amd.h b/src/amd.h
index dbf4a92..8eb2253 100644
--- a/src/amd.h
+++ b/src/amd.h
@@ -37,7 +37,6 @@
#include <X11/extensions/randr.h>
#include "xf86xv.h"
-#include "randrstr.h"
/* We only support EXA version >=2 */
@@ -168,7 +167,6 @@ extern unsigned short gfx_inw(unsigned short port);
extern void gfx_outw(unsigned short port, unsigned short data);
extern unsigned long gfx_ind(unsigned short port);
extern void gfx_outd(unsigned short port, unsigned long data);
-void gfx_reset_pitch(unsigned short pitch);
#define Q_WORD QQ_WORD
#include "gfx_rtns.h"
@@ -287,7 +285,7 @@ typedef struct _geodeRec
unsigned long FBLinearAddr;
unsigned char *FBBase;
- int FBAvail;
+ unsigned int FBAvail;
unsigned int FBOffset;
unsigned int FBSize;
@@ -310,7 +308,7 @@ typedef struct _geodeRec
ExaDriverPtr pExa;
unsigned int exaBfrOffset;
- int exaBfrSz;
+ unsigned int exaBfrSz;
/* XAA structures */
unsigned char **AccelImageWriteBuffers;
@@ -459,6 +457,7 @@ GX_GeodeOpts;
/* amd_dcon.c */
extern Bool dcon_init(ScrnInfoPtr pScrni);
+extern int DCONDPMSSet(ScrnInfoPtr pScrni, int mode, int flags);
/* amd_common.c */
@@ -466,6 +465,7 @@ void geode_memory_to_screen_blt(unsigned long, unsigned long,
unsigned long, unsigned long, long, long, int);
int GeodeGetRefreshRate(DisplayModePtr);
void GeodeCopyGreyscale(unsigned char *, unsigned char *, int, int, int, int);
+int GeodeGetSizeFromFB(unsigned int *);
/* amd_gx_video.c */
@@ -484,7 +484,6 @@ int GeodeGetFPGeometry(const char *str, int *width, int *height);
void GeodePointerMoved(int index, int x, int y);
void GeodeFreeScreen(int scrnIndex, int flags);
int GeodeCalculatePitchBytes(unsigned int width, unsigned int bpp);
-void GXSetupChipsetFPtr(ScrnInfoPtr pScrn);
/* amd_msr.c */
int GeodeReadMSR(unsigned long addr, unsigned long *lo, unsigned long *hi);
@@ -499,21 +498,16 @@ void GXShowCursor(ScrnInfoPtr pScrni);
/* amd_gx_randr.c */
Rotation GXGetRotation(ScreenPtr pScreen);
Bool GXRandRInit(ScreenPtr pScreen, int rotation);
-Bool GXRandRSetConfig(ScreenPtr, Rotation, int, RRScreenSizePtr);
/* amd_gx_rotate.c */
Bool GXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode);
/* amd_gx_accel.c */
Bool GXAccelInit(ScreenPtr pScrn);
-void GXAccelSync(ScrnInfoPtr pScrni);
/* amd_gx_video.c */
void GXInitVideo(ScreenPtr pScrn);
-/* amd_lx_driver.c */
-void LXSetupChipsetFPtr(ScrnInfoPtr pScrn);
-
/* amd_lx_cursor.c */
Bool LXHWCursorInit(ScreenPtr pScrn);
void LXLoadCursorImage(ScrnInfoPtr pScrni, unsigned char *src);
@@ -523,20 +517,16 @@ void LXShowCursor(ScrnInfoPtr pScrni);
/* amd_lx_randr.c */
Rotation LXGetRotation(ScreenPtr pScreen);
Bool LXRandRInit(ScreenPtr pScreen, int rotation);
-Bool LXRandRSetConfig(ScreenPtr, Rotation, int, RRScreenSizePtr);
/* amd_lx_rotate.c */
Bool LXSetRotatePitch(ScrnInfoPtr pScrni);
Bool LXRotate(ScrnInfoPtr pScrni, DisplayModePtr mode);
+Bool LXAllocShadow(ScrnInfoPtr pScrni);
/* amd_lx_exa.c */
Bool LXExaInit(ScreenPtr pScreen);
/* amd_lx_video.c */
void LXInitVideo(ScreenPtr pScrn);
-void LXDisplayVideo(ScrnInfoPtr pScrni, int id, short width, short height,
- BoxPtr dstBox, short srcW, short srcH, short drawW, short drawH);
-void LXStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit);
-void LXResetVideo(ScrnInfoPtr pScrni);
#endif /* _AMD_GEODE_H_ */
diff --git a/src/amd_common.c b/src/amd_common.c
index 86a8e86..375ade8 100644
--- a/src/amd_common.c
+++ b/src/amd_common.c
@@ -30,6 +30,13 @@
#include "config.h"
#endif
+#include <string.h> /* memcmp() */
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
#include "xf86.h"
#include "amd.h"
@@ -157,3 +164,39 @@ GeodeCopyGreyscale(unsigned char *src, unsigned char *dst,
src2 += srcPitch;
}
}
+
+#if defined(linux)
+
+#include <linux/fb.h>
+
+int GeodeGetSizeFromFB(unsigned int *size)
+{
+ struct fb_fix_screeninfo fix;
+ int ret;
+ int fd = open("/dev/fb0", O_RDONLY);
+
+ if (fd == -1)
+ return -1;
+
+ ret = ioctl(fd, FBIOGET_FSCREENINFO, &fix);
+ close(fd);
+
+ if (!ret) {
+ if (!memcmp(fix.id, "Geode", 5)) {
+ *size = fix.smem_len;
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+#else
+
+int GeodeGetSizeFromFB(unsigned int *size)
+{
+ return -1;
+}
+
+#endif
+
diff --git a/src/amd_gx_accel.c b/src/amd_gx_accel.c
index cf0efd7..1655801 100644
--- a/src/amd_gx_accel.c
+++ b/src/amd_gx_accel.c
@@ -1504,7 +1504,6 @@ amd_gx_exa_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
static Bool
amd_gx_exa_PrepareSolid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg)
{
-
int dstPitch = exaGetPixmapPitch(pxMap);
unsigned int ROP =
amd_gx_BppToRasterMode(pxMap->drawable.bitsPerPixel)
diff --git a/src/amd_gx_driver.c b/src/amd_gx_driver.c
index 0c99902..0f5212a 100644
--- a/src/amd_gx_driver.c
+++ b/src/amd_gx_driver.c
@@ -558,9 +558,7 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
/* Set up the panel */
- if (dcon_init(pScrni)) {
- pGeode->Panel = TRUE;
- } else if (pGeode->Panel) {
+ if (pGeode->Panel) {
if (panelgeo != NULL) {
if (GeodeGetFPGeometry(panelgeo, &pGeode->PanelX, &pGeode->PanelY))
pGeode->Panel = FALSE;
@@ -598,8 +596,15 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
#endif
}
- if (pGeode->FBAvail == 0)
- pGeode->FBAvail = gfx_get_frame_buffer_size();
+ /* First try to get the framebuffer size from the framebuffer,
+ * and if that fails, revert all the way back to the legacy
+ * method
+ */
+
+ if (pGeode->FBAvail == 0) {
+ if (GeodeGetSizeFromFB(&pGeode->FBAvail))
+ pGeode->FBAvail = gfx_get_frame_buffer_size();
+ }
if (pScrni->memPhysBase == 0)
pScrni->memPhysBase = gfx_get_frame_buffer_base();
@@ -1157,7 +1162,11 @@ GXCreateScreenResources(ScreenPtr pScreen)
if (!(*pScreen->CreateScreenResources) (pScreen))
return FALSE;
- if (pGeode->rotation != RR_Rotate_0) {
+ if (xf86LoaderCheckSymbol("GXRandRSetConfig")
+ && pGeode->rotation != RR_Rotate_0) {
+ Rotation(*GXRandRSetConfig) (ScreenPtr pScreen, Rotation rr, int rate,
+ RRScreenSizePtr pSize) = NULL;
+
RRScreenSize p;
Rotation requestedRotation = pGeode->rotation;
@@ -1170,9 +1179,12 @@ GXCreateScreenResources(ScreenPtr pScreen)
p.mmWidth = pScreen->mmWidth;
p.mmHeight = pScreen->mmHeight;
- pGeode->starting = TRUE;
- GXRandRSetConfig(pScreen, requestedRotation, 0, &p);
- pGeode->starting = FALSE;
+ GXRandRSetConfig = LoaderSymbol("GXRandRSetConfig");
+ if (GXRandRSetConfig) {
+ pGeode->starting = TRUE;
+ (*GXRandRSetConfig) (pScreen, requestedRotation, 0, &p);
+ pGeode->starting = FALSE;
+ }
}
return TRUE;
diff --git a/src/amd_lx_driver.c b/src/amd_lx_driver.c
index 08a7e51..9cb7e42 100644
--- a/src/amd_lx_driver.c
+++ b/src/amd_lx_driver.c
@@ -55,6 +55,7 @@
#include "xf86cmap.h"
#include "compiler.h"
#include "mipointer.h"
+#include <shadow.h> /* setupShadow() */
#include <X11/extensions/randr.h>
#include "fb.h"
#include "miscstruct.h"
@@ -670,15 +671,19 @@ LXPreInit(ScrnInfoPtr pScrni, int flags)
}
/* Read the amount of framebuffer memory */
-
+ /* First try to read it from the framebuffer, and if that fails,
+ * do it the legacy way
+ */
+
if (pGeode->FBAvail == 0) {
- unsigned long value;
- cim_outw(0xAC1C, 0xFC53);
- cim_outw(0xAC1C, 0x0200);
+ if (GeodeGetSizeFromFB(&pGeode->FBAvail)) {
+ unsigned long value;
+ cim_outw(0xAC1C, 0xFC53);
+ cim_outw(0xAC1C, 0x0200);
- value = (unsigned long)(cim_inw(0xAC1E)) & 0xFE;
-
- pGeode->FBAvail = value << 20;
+ value = (unsigned long)(cim_inw(0xAC1E)) & 0xFE;
+ pGeode->FBAvail = value << 20;
+ }
}
pScrni->fbOffset = 0;
@@ -1160,7 +1165,10 @@ LXCreateScreenResources(ScreenPtr pScreen)
if (!(*pScreen->CreateScreenResources) (pScreen))
return FALSE;
- if (pGeode->rotation != RR_Rotate_0) {
+ if (xf86LoaderCheckSymbol("LXRandRSetConfig")
+ && pGeode->rotation != RR_Rotate_0) {
+ Rotation(*LXRandRSetConfig) (ScreenPtr pScreen, Rotation rr, int rate,
+ RRScreenSizePtr pSize) = NULL;
RRScreenSize p;
Rotation requestedRotation = pGeode->rotation;
@@ -1173,9 +1181,12 @@ LXCreateScreenResources(ScreenPtr pScreen)
p.mmWidth = pScreen->mmWidth;
p.mmHeight = pScreen->mmHeight;
- pGeode->starting = TRUE;
- LXRandRSetConfig(pScreen, requestedRotation, 0, &p);
- pGeode->starting = FALSE;
+ LXRandRSetConfig = LoaderSymbol("LXRandRSetConfig");
+ if (LXRandRSetConfig) {
+ pGeode->starting = TRUE;
+ (*LXRandRSetConfig) (pScreen, requestedRotation, 0, &p);
+ pGeode->starting = FALSE;
+ }
}
return TRUE;
diff --git a/src/amd_msr.c b/src/amd_msr.c
index c37d921..12b9f73 100644
--- a/src/amd_msr.c
+++ b/src/amd_msr.c
@@ -5,7 +5,6 @@
#include <sys/types.h>
#include <sys/errno.h>
#include "os.h"
-#include "amd.h"
static int _msr_open(void)
{
diff --git a/src/durango.c b/src/durango.c
index 91bbb3e..adc5565 100644
--- a/src/durango.c
+++ b/src/durango.c
@@ -37,7 +37,6 @@
#include <unistd.h>
#include <errno.h>
#include <compiler.h>
-#include "amd.h"
/* Compiler options */
diff --git a/src/gfx/gfx_init.c b/src/gfx/gfx_init.c
index 715153d..469c70f 100644
--- a/src/gfx/gfx_init.c
+++ b/src/gfx/gfx_init.c
@@ -274,7 +274,7 @@ gfx_detect_cpu(void)
value = gfx_pci_config_read(0x80000800);
if (value == PCI_VENDOR_DEVICE_REDCLOUD) {
- QQ_WORD msr_value;
+ Q_WORD msr_value;
int valid, i;
/* CHECK FOR SOFT VG */
diff --git a/src/gfx/msr_rdcl.c b/src/gfx/msr_rdcl.c
index 2174a11..548e8a4 100644
--- a/src/gfx/msr_rdcl.c
+++ b/src/gfx/msr_rdcl.c
@@ -580,7 +580,7 @@ redcloud_msr_read(unsigned int device, unsigned int msrRegister,
Q_WORD * msrValue)
#else
DEV_STATUS
-gfx_msr_read(unsigned int device, unsigned int msrRegister, QQ_WORD * msrValue)
+gfx_msr_read(unsigned int device, unsigned int msrRegister, Q_WORD * msrValue)
#endif
{
if (device < NUM_DEVS) {
@@ -618,7 +618,7 @@ redcloud_msr_write(unsigned int device, unsigned int msrRegister,
#else
DEV_STATUS
gfx_msr_write(unsigned int device, unsigned int msrRegister,
- QQ_WORD * msrValue)
+ Q_WORD * msrValue)
#endif
{
if (device < NUM_DEVS) {
diff --git a/src/gfx/vid_rdcl.c b/src/gfx/vid_rdcl.c
index 0aff629..7c98d2d 100644
--- a/src/gfx/vid_rdcl.c
+++ b/src/gfx/vid_rdcl.c
@@ -254,7 +254,7 @@ void
gfx_set_clock_frequency(unsigned long frequency)
#endif
{
- QQ_WORD msr_value, sys_value;
+ Q_WORD msr_value, sys_value;
unsigned long sys_low;
unsigned int i, index = 0;
unsigned long value;
@@ -1632,7 +1632,7 @@ unsigned long
gfx_get_clock_frequency(void)
#endif
{
- QQ_WORD msr_value;
+ Q_WORD msr_value;
unsigned int index;
unsigned long value, mask = 0x00001FFF;
unsigned long post_div3 = 0, pre_mult2 = 0;
@@ -2310,7 +2310,7 @@ unsigned long
gfx_read_crc(void)
#endif
{
- QQ_WORD msr_value;
+ Q_WORD msr_value;
unsigned long crc = 0xFFFFFFFF;
/* DISABLE 32-BIT CRCS */
@@ -2359,7 +2359,7 @@ unsigned long
gfx_read_crc32(void)
#endif
{
- QQ_WORD msr_value;
+ Q_WORD msr_value;
unsigned long crc = 0xFFFFFFFF;
/* ENABLE 32-BIT CRCS */
@@ -2409,7 +2409,7 @@ gfx_read_window_crc(int source, unsigned short x, unsigned short y,
unsigned short width, unsigned short height, int crc32)
#endif
{
- QQ_WORD msr_value;
+ Q_WORD msr_value;
unsigned long xpos, ypos, crc = 0;
unsigned long old_fmt = 0;
unsigned int vsync_active_base, vsync_inactive_base, hsync_active_base;
diff --git a/src/panel/gx2_9211.c b/src/panel/gx2_9211.c
index 7d46b9c..a60264d 100644
--- a/src/panel/gx2_9211.c
+++ b/src/panel/gx2_9211.c
@@ -193,7 +193,7 @@ set_Redcloud_92xx_mode_params(int mode)
CS92xx_MODE *pMode = &FPModeParams[mode];
unsigned long temp_data = 0;
unsigned long base_data;
- QQ_WORD msrValue;
+ Q_WORD msrValue;
/* on a Redcloud, we need to set up the DF pad select MSR */
if (gfx_msr_read(RC_ID_DF, GX2_VP_MSR_PAD_SELECT, &msrValue) == FOUND) {
diff --git a/src/z4l.c b/src/z4l.c
index d36b933..0df3d13 100644
--- a/src/z4l.c
+++ b/src/z4l.c
@@ -36,6 +36,9 @@
#include <sys/ioctl.h>
#include <errno.h>
#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
#include "xf86.h"
#include <X11/extensions/Xv.h>