summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--src/i830.h8
-rw-r--r--src/i830_debug.c1
-rw-r--r--src/i830_display.c8
-rw-r--r--src/i830_dri.c5
-rw-r--r--src/i830_driver.c20
-rw-r--r--src/i830_edid_modes.c2
-rw-r--r--src/i830_exa.c1
-rw-r--r--src/i830_randr.c200
-rw-r--r--src/i830_tv.c1
-rw-r--r--src/i830_xf86Crtc.c7
-rw-r--r--src/i830_xf86Crtc.h8
-rw-r--r--src/i830_xf86cvt.c1
-rw-r--r--src/i965_video.c1
14 files changed, 132 insertions, 137 deletions
diff --git a/configure.ac b/configure.ac
index be80a872..b295c5ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,9 +120,13 @@ fi
AM_CONDITIONAL(DRI, test x$DRI = xyes)
if test "$DRI" = yes; then
- PKG_CHECK_MODULES(DRI, [libdrm >= 2.2 xf86driproto])
+ PKG_CHECK_MODULES(DRI, [libdrm xf86driproto])
AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
+ PKG_CHECK_MODULES(DRI_MM, [libdrm >= 2.2],[DRI_MM=yes], [DRI_MM=no])
+ if test "x$DRM_MM" = xyes; then
+ AC_DEFINE(XF86DRI_MM,1,[Extended DRI memory management])
+ fi
fi
AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes)
diff --git a/src/i830.h b/src/i830.h
index 06f68384..c2670cda 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -628,14 +628,6 @@ void i830_tv_init(ScrnInfoPtr pScrn);
#define _845_DRAM_RW_CONTROL 0x90
#define DRAM_WRITE 0x33330000
-/* Compat definitions for older X Servers. */
-#ifndef M_T_PREFERRED
-#define M_T_PREFERRED 0x08
-#endif
-#ifndef M_T_DRIVER
-#define M_T_DRIVER 0x40
-#endif
-
/*
* Xserver MM compatibility. Remove code guarded by this when the
* XServer contains the libdrm mm code
diff --git a/src/i830_debug.c b/src/i830_debug.c
index 25245fb2..897ab926 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -32,6 +32,7 @@
#include "xf86.h"
#include "i830.h"
#include "i830_debug.h"
+#include <strings.h>
#define DEBUGSTRING(func) static char *func(I830Ptr pI830, int reg, CARD32 val)
diff --git a/src/i830_display.c b/src/i830_display.c
index c5880d6b..9ec46a45 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -350,8 +350,8 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
}
if (IS_I965G(pI830)) {
- OUTREG(dspbase, ((y * pScrn->displayWidth + x) * pI830->cpp));
- OUTREG(dspsurf, Start);
+ OUTREG(dspbase, ((y * pScrn->displayWidth + x) * pI830->cpp));
+ OUTREG(dspsurf, Start);
} else {
OUTREG(dspbase, Start + ((y * pScrn->displayWidth + x) * pI830->cpp));
}
@@ -603,7 +603,6 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
int dpll_md_reg = (intel_crtc->pipe == 0) ? DPLL_A_MD : DPLL_B_MD;
int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
- int dspbase_reg = (pipe == 0) ? DSPABASE : DSPBBASE;
int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
int htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B;
int hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B;
@@ -828,13 +827,12 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
OUTREG(dspsize_reg, ((mode->VDisplay - 1) << 16) | (mode->HDisplay - 1));
OUTREG(dsppos_reg, 0);
OUTREG(pipesrc_reg, ((mode->HDisplay - 1) << 16) | (mode->VDisplay - 1));
- i830PipeSetBase(crtc, crtc->x, crtc->y);
OUTREG(pipeconf_reg, pipeconf);
i830WaitForVblank(pScrn);
OUTREG(dspcntr_reg, dspcntr);
/* Flush the plane changes */
- OUTREG(dspbase_reg, INREG(dspbase_reg));
+ i830PipeSetBase(crtc, crtc->x, crtc->y);
i830WaitForVblank(pScrn);
}
diff --git a/src/i830_dri.c b/src/i830_dri.c
index c5d7a94e..5fdacc7d 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -655,11 +655,14 @@ I830DRIScreenInit(ScreenPtr pScreen)
}
pI830->drmMinor = version->version_minor;
if (!(pI830->mmModeFlags & I830_KERNEL_TEX)) {
+#ifdef XF86DRI_MM
if ((version->version_major > 1) ||
((version->version_minor >= 7) &&
(version->version_major == 1))) {
pI830->mmModeFlags |= I830_KERNEL_MM;
- } else {
+ } else
+#endif
+ {
pI830->mmModeFlags |= I830_KERNEL_TEX;
}
} else {
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7f535ac7..52647676 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2469,11 +2469,7 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
}
}
-#ifdef XF86DRI
-#ifndef DRM_BO_MEM_TT
-#error "Wrong drm.h file included. You need to compile and install a recent libdrm."
-#endif
-
+#ifdef XF86DRI_MM
#ifndef XSERVER_LIBDRM_MM
static int
@@ -2548,7 +2544,7 @@ static int I830DrmMMUnlock(int fd, unsigned memType)
}
#endif
-#endif
+#endif /* XF86DRI_MM */
static Bool
I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
@@ -3001,7 +2997,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
break;
}
-#ifdef XF86DRI
+#ifdef XF86DRI_MM
if (pI830->directRenderingEnabled && (pI830->mmModeFlags & I830_KERNEL_MM)) {
unsigned long aperEnd = ROUND_DOWN_TO(pI830->FbMapSize, GTT_PAGE_SIZE)
/ GTT_PAGE_SIZE;
@@ -3040,7 +3036,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
}
-#endif
+#endif /* XF86DRI_MM */
return TRUE;
}
@@ -3101,6 +3097,7 @@ I830LeaveVT(int scrnIndex, int flags)
#ifdef XF86DRI
if (pI830->directRenderingOpen) {
DRILock(screenInfo.screens[pScrn->scrnIndex], 0);
+#ifdef XF86DRI_MM
if (pI830->mmModeFlags & I830_KERNEL_MM) {
#ifndef XSERVER_LIBDRM_MM
I830DrmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT);
@@ -3108,6 +3105,7 @@ I830LeaveVT(int scrnIndex, int flags)
drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT);
#endif
}
+#endif /* XF86DRI_MM */
I830DRISetVBlankInterrupt (pScrn, FALSE);
drmCtlUninstHandler(pI830->drmSubFD);
@@ -3185,8 +3183,6 @@ I830EnterVT(int scrnIndex, int flags)
if (!i830PipeSetMode (crtc, &crtc->desiredMode, TRUE))
return FALSE;
-
- i830PipeSetBase(crtc, crtc->x, crtc->y);
}
i830DumpRegs (pScrn);
@@ -3221,6 +3217,7 @@ I830EnterVT(int scrnIndex, int flags)
for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++)
sarea->texList[i].age = sarea->texAge;
+#ifdef XF86DRI_MM
if (pI830->mmModeFlags & I830_KERNEL_MM) {
#ifndef XSERVER_LIBDRM_MM
I830DrmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT);
@@ -3228,6 +3225,7 @@ I830EnterVT(int scrnIndex, int flags)
drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT);
#endif
}
+#endif /* XF86DRI_MM */
DPRINTF(PFX, "calling dri unlock\n");
DRIUnlock(screenInfo.screens[pScrn->scrnIndex]);
@@ -3371,6 +3369,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
pI830->closing = TRUE;
#ifdef XF86DRI
if (pI830->directRenderingOpen) {
+#ifdef XF86DRI_MM
if (pI830->mmModeFlags & I830_KERNEL_MM) {
#ifndef XSERVER_LIBDRM_MM
I830DrmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT);
@@ -3378,6 +3377,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT);
#endif
}
+#endif /* XF86DRI_MM */
pI830->directRenderingOpen = FALSE;
I830DRICloseScreen(pScreen);
}
diff --git a/src/i830_edid_modes.c b/src/i830_edid_modes.c
index c1216109..31ce1000 100644
--- a/src/i830_edid_modes.c
+++ b/src/i830_edid_modes.c
@@ -37,6 +37,8 @@
#include "xf86DDC.h"
#include "i830.h"
#include "i830_display.h"
+#include <string.h>
+#include <math.h>
#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 7de56176..9356c79c 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -36,6 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830.h"
#include "i810_reg.h"
#include "i830_reg.h"
+#include <string.h>
#ifdef I830DEBUG
#define DEBUG_I830FALLBACK 1
diff --git a/src/i830_randr.c b/src/i830_randr.c
index aa50254f..55ff31e2 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -325,6 +325,44 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
return TRUE;
}
+static Bool
+xf86RandR12ScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ Bool ret = TRUE;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ if (pRoot)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ pScrn->virtualX = width;
+ pScrn->virtualY = height;
+
+ pScreen->width = pScrn->virtualX;
+ pScreen->height = pScrn->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+
+ xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
+ xf86SetViewport (pScreen, 0, 0);
+ if (pRoot)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+#if RANDR_12_INTERFACE
+ if (WindowTable[pScreen->myNum])
+ RRScreenSizeNotify (pScreen);
+#endif
+ return ret;
+}
+
Rotation
xf86RandR12GetRotation(ScreenPtr pScreen)
{
@@ -336,38 +374,68 @@ xf86RandR12GetRotation(ScreenPtr pScreen)
Bool
xf86RandR12CreateScreenResources (ScreenPtr pScreen)
{
-#if 0
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
-#endif
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int c;
+ int width, height;
+ int mmWidth, mmHeight;
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
if (!noPanoramiXExtension)
return TRUE;
#endif
+
+ /*
+ * Compute size of screen
+ */
+ width = 0; height = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ int crtc_width = crtc->x + crtc->curMode.HDisplay;
+ int crtc_height = crtc->y + crtc->curMode.VDisplay;
+
+ if (crtc->enabled && crtc_width > width)
+ width = crtc_width;
+ if (crtc->enabled && crtc_height > height)
+ height = crtc_height;
+ }
+
+ if (width && height)
+ {
+ /*
+ * Compute physical size of screen
+ */
+ if (monitorResolution)
+ {
+ mmWidth = width * 25.4 / monitorResolution;
+ mmHeight = height * 25.4 / monitorResolution;
+ }
+ else
+ {
+ mmWidth = pScreen->mmWidth;
+ mmHeight = pScreen->mmHeight;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Setting screen physical size to %d x %d\n",
+ mmWidth, mmHeight);
+ xf86RandR12ScreenSetSize (pScreen,
+ width,
+ height,
+ mmWidth,
+ mmHeight);
+ }
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
#if RANDR_12_INTERFACE
if (xf86RandR12CreateScreenResources12 (pScreen))
return TRUE;
#endif
-#if 0
- /* XXX deal with initial rotation */
- if (pI830->rotation != RR_Rotate_0) {
- RRScreenSize p;
- Rotation requestedRotation = pI830->rotation;
-
- pI830->rotation = RR_Rotate_0;
-
- /* Just setup enough for an initial rotate */
- p.width = pScreen->width;
- p.height = pScreen->height;
- p.mmWidth = pScreen->mmWidth;
- p.mmHeight = pScreen->mmHeight;
-
- pI830->starting = TRUE; /* abuse this for dual head & rotation */
- xf86RandR12SetConfig (pScreen, requestedRotation, 0, &p);
- pI830->starting = FALSE;
- }
-#endif
return TRUE;
}
@@ -450,42 +518,6 @@ xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
#if RANDR_12_INTERFACE
static Bool
-xf86RandR12ScreenSetSize (ScreenPtr pScreen,
- CARD16 width,
- CARD16 height,
- CARD32 mmWidth,
- CARD32 mmHeight)
-{
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- WindowPtr pRoot = WindowTable[pScreen->myNum];
- Bool ret = TRUE;
-
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
- }
- if (pRoot)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
- pScrn->virtualX = width;
- pScrn->virtualY = height;
-
- pScreen->width = pScrn->virtualX;
- pScreen->height = pScrn->virtualY;
- pScreen->mmWidth = mmWidth;
- pScreen->mmHeight = mmHeight;
-
- xf86SetViewport (pScreen, pScreen->width, pScreen->height);
- xf86SetViewport (pScreen, 0, 0);
- if (pRoot)
- (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
- if (WindowTable[pScreen->myNum])
- RRScreenSizeNotify (pScreen);
- return ret;
-}
-
-static Bool
xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
{
ScreenPtr pScreen = randr_crtc->pScreen;
@@ -832,62 +864,10 @@ xf86RandR12CreateObjects12 (ScreenPtr pScreen)
static Bool
xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
- int c;
- int width, height;
- int mmWidth, mmHeight;
-
- /*
- * Compute size of screen
- */
- width = 0; height = 0;
- for (c = 0; c < config->num_crtc; c++)
- {
- xf86CrtcPtr crtc = config->crtc[c];
- int crtc_width = crtc->x + crtc->curMode.HDisplay;
- int crtc_height = crtc->y + crtc->curMode.VDisplay;
-
- if (crtc->enabled && crtc_width > width)
- width = crtc_width;
- if (crtc->enabled && crtc_height > height)
- height = crtc_height;
- }
- if (width && height)
- {
- /*
- * Compute physical size of screen
- */
- if (monitorResolution)
- {
- mmWidth = width * 25.4 / monitorResolution;
- mmHeight = height * 25.4 / monitorResolution;
- }
- else
- {
- mmWidth = pScreen->mmWidth;
- mmHeight = pScreen->mmHeight;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Setting screen physical size to %d x %d\n",
- mmWidth, mmHeight);
- xf86RandR12ScreenSetSize (pScreen,
- width,
- height,
- mmWidth,
- mmHeight);
- }
-
for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
- if (randrp->virtualX == -1 || randrp->virtualY == -1)
- {
- randrp->virtualX = pScrn->virtualX;
- randrp->virtualY = pScrn->virtualY;
- }
RRScreenSetSizeRange (pScreen, 320, 240,
randrp->virtualX, randrp->virtualY);
diff --git a/src/i830_tv.c b/src/i830_tv.c
index f17a3532..5cf36a5a 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -36,6 +36,7 @@
#include "xf86.h"
#include "i830.h"
#include "i830_display.h"
+#include <string.h>
enum tv_type {
TV_TYPE_NONE,
diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index 33f96abc..a0f44df5 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -143,7 +143,7 @@ xf86OutputSetMonitor (xf86OutputPtr output)
monitor = output->name;
else
xf86MarkOptionUsedByName (output->scrn->options, option_name);
- free (option_name);
+ xfree (option_name);
output->conf_monitor = xf86findMonitor (monitor, xf86configptr->conf_monitor_lst);
}
@@ -1026,7 +1026,10 @@ i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
{
ScrnInfoPtr pScrn = output->scrn;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- int i, size;
+ int i;
+#ifdef RANDR_12_INTERFACE
+ int size;
+#endif
if (output->MonInfo != NULL)
xfree(output->MonInfo);
diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h
index 3e705632..b30003e7 100644
--- a/src/i830_xf86Crtc.h
+++ b/src/i830_xf86Crtc.h
@@ -27,6 +27,14 @@
#include "i830_xf86Modes.h"
#include "xf86Parser.h"
+/* Compat definitions for older X Servers. */
+#ifndef M_T_PREFERRED
+#define M_T_PREFERRED 0x08
+#endif
+#ifndef M_T_DRIVER
+#define M_T_DRIVER 0x40
+#endif
+
typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
diff --git a/src/i830_xf86cvt.c b/src/i830_xf86cvt.c
index dba57c82..1a2b7869 100644
--- a/src/i830_xf86cvt.c
+++ b/src/i830_xf86cvt.c
@@ -39,6 +39,7 @@
#include "i830.h"
#include "i830_display.h"
+#include <string.h>
#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
/*
diff --git a/src/i965_video.c b/src/i965_video.c
index 0d1bec69..9e96527d 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -39,6 +39,7 @@
#include "i830_video.h"
#include "brw_defines.h"
#include "brw_structs.h"
+#include <string.h>
/* Make assert() work. */
#undef NDEBUG