Merge branch 'master' of git://proxy.ims.intel.com:9419/git/xorg/driver/xf86-video-intel into crestline

Conflicts:

	src/i830_display.c

Change LVDS output and postread like upstream. This might
need to be retested on 965GM LVDS.
This commit is contained in:
Wang Zhenyu 2007-03-20 11:34:40 +08:00
commit 0a612e7115
35 changed files with 1114 additions and 1309 deletions

138
ChangeLog
View File

@ -1,138 +0,0 @@
2006-05-01 Matthieu Herrb <matthieu.herrb@laas.fr>
* src/common.h:
Fix build on non-dri systems.
2006-04-07 Adam Jackson <ajax@freedesktop.org>
* configure.ac:
* src/i810.h:
Bump to 1.6.0.
2006-04-07 Aaron Plattner <aplattner@nvidia.com>
* src/i810_video.c: (I810PutImage):
* src/i830_video.c: (I830PutImage):
Add a DrawablePtr argument to the XV functions to pave the way for
redirected video.
2006-04-05 Dave Airlie <airlied@linux.ie>
* src/i810_hwmc.c: (I810XvMCCreateContext),
(I810XvMCCreateSurface), (I810XvMCCreateSubpicture):
* src/i810_memory.c: (I810SetTiledMemory):
* src/i830_memory.c: (SetFence):
Fix some argument inversions in xf86DrvMsg function calls
2006-04-04 Kristian Høgsberg <krh@redhat.com>
* src/i810_dri.c:
* src/i810_driver.c:
* src/i830_dri.c:
* src/i830_driver.c: Add more missing #include's, in particular
assert.h.
2006-03-22 Kristian Høgsberg <krh@redhat.com>
* src/*.c: Drop libc wrapper; don't include xf86_ansic.h and add
includes now missing.
2006-03-10 Alan Hourihane <alanh@fairlite.demon.co.uk>
* src/i830_cursor.c: (I830InitHWCursor), (I830ShowCursor),
(I830HideCursor):
Enable gamma for hw cursor when ARGB cursor in use (Lukas Hejtmanek)
2006-03-03 Alan Hourihane <alanh@fairlite.demon.co.uk>
* configure.ac:
* src/i810.h:
* src/i830.h:
* src/i830_dri.h:
* src/i830_driver.c: (I830BIOSPreInit), (I830BIOSScreenInit),
(I830BIOSCloseScreen):
* src/i830_video.c:
Check the version of shadow being used and turn off rotation if
it isn't the right one.
Bump the Xvideo resolution support from 1920x1080 to 1920x1088.
2006-02-20 Alan Hourihane <alanh@fairlite.demon.co.uk>
* src/i830_rotate.c: (I915UpdateRotate), (I830UpdateRotate):
Fix a rotation problem when DRI is disabled
2005-01-25 Alan Hourihane <alanh@fairlite.demon.co.uk>
* src/i830_driver.c: When going dual head only take a portion of
memory for the second head instead of doubling the requirements.
2005-01-25 Alan Hourihane <alanh@fairlite.demon.co.uk>
* src/i830_driver.c: Fix a glitch in a dual head fix from #3105
2005-01-24 Alan Hourihane <alanh@fairlite.demon.co.uk>
* configure.ac, man/i810.man, src/Makefile.am, src/common.h,
src/i810.h, src/i810_dri.c, src/i810_driver.c, src/i830.h,
src/i830_common.h, src/i830_cursor.c, src/i830_dga.c,
src/i830_dri.c, src/i830_dri.h, src/i830_driver.c,
src/i830_memory.c, src/i830_modes.c, src/i830_randr.c,
src/i830_rotate.c, src/i830_shadow.c, src/i830_video.c:
Bump version to 1.5.0.0
Add Intel 945GM support
Add RandR rotation support (full 3D acceleration, HWcursor &
Xvideo rotated too)
Remove older shadow framebuffer rotation code
Add a new LinearAlloc option to allow more offscreen memory
to be allocated for XVideo applications. This allows HDTV movies
to be played via Xvideo.
2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version for X11R7 release.
2005-12-14 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version number for final X11R7 release candidate.
2005-12-06 Kevin E. Martin <kem-at-freedesktop-dot-org>
* man/Makefile.am:
Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
2005-12-03 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version number for X11R7 RC3 release.
2005-12-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Remove extraneous AC_MSG_RESULT.
2005-11-30 Adam Jackson <ajax@freedesktop.org>
* configure.ac:
Bump libdrm dep to 2.0.
2005-11-29 Adam Jackson <ajax@freedesktop.org>
* configure.ac:
Only build dlloader modules by default.
2005-11-19 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update dependencies to work with separate build roots.
2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version number for X11R7 RC2 release.
2005-11-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update pkgcheck dependencies to work with separate build roots.

View File

@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-video-intel],
1.9.90,
1.9.92,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-video-intel)
@ -102,6 +102,8 @@ if test "$DRI" != no; then
[have_sarea_h="yes"], [have_sarea_h="no"])
AC_CHECK_FILE([${sdkdir}/dristruct.h],
[have_dristruct_h="yes"], [have_dristruct_h="no"])
AC_CHECK_FILE([${sdkdir}/damage.h],
[have_damage_h="yes"], [have_damage_h="no"])
fi
AC_MSG_CHECKING([whether to include DRI support])
@ -175,6 +177,17 @@ if test "$DRI" = yes; then
if test "x$DRI_MM" = xyes; then
AC_DEFINE(XF86DRI_MM,1,[Extended DRI memory management])
fi
if test "$have_damage_h" = yes; then
AC_DEFINE(DAMAGE,1,[Use Damage extension])
fi
save_CFLAGS="$CFLAGS"
CFLAGS="$DRI_CFLAGS"
AC_CHECK_TYPE(drm_i915_flip_t,
[AC_DEFINE(HAVE_I915_FLIP, 1,
[Have drm_i915_flip_t and related definitions])],
[], [#include <i915_drm.h>])
CFLAGS="$save_CFLAGS"
fi
AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes)

View File

@ -159,6 +159,26 @@ atctivate the legacy texture pool (see
gain some performance by increasing this value.
Default: 32768.
.TP
.BI "Option \*qPageFlip\*q \*q" boolean \*q
Enable support for page flipping. This should improve 3D performance at the
potential cost of worse performance with mixed 2D/3D. Also note that this gives
no benefit without corresponding support in the Mesa 3D driver and may not give
the full benefit without triple buffering (see
.B "Option \*qTripleBuffer\*q"
).
Default for i810: The option is not used.
Default for i830 and above: Disabled.
.TP
.BI "Option \*qTripleBuffer\*q \*q" boolean \*q
Enable support for triple buffering. This should improve 3D performance at the
potential cost of worse performance with mixed 2D/3D. Also note that this gives
no benefit without corresponding support in the Mesa 3D driver and may not give
any benefit without page flipping either (see
.B "Option \*qPageFlip\*q"
).
Default for i810: The option is not used.
Default for i830 and above: Disabled.
.TP
.BI "Option \*qAccelMethod\*q \*q" string \*q
Choose acceleration architecture, either "XAA" or "EXA". XAA is the old
(but stable) XFree86 based acceleration architecture. EXA is a newer and

View File

@ -60,15 +60,15 @@ int main(int argc, char **argv)
if (dev == NULL)
errx(1, "Couldn't find graphics card");
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
err = pci_device_probe(dev);
if (err != 0) {
fprintf(stderr, "Couldn't probe graphics card: %s\n", strerror(err));
exit(1);
}
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
bios = malloc(dev->rom_size);
if (bios == NULL)
errx(1, "Couldn't allocate memory for BIOS data\n");

View File

@ -3,7 +3,7 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
AM_CFLAGS = @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
ch7017_la_LTLIBRARIES = ch7017.la
ch7017_la_LDFLAGS = -module -avoid-version

View File

@ -3,7 +3,7 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
AM_CFLAGS = @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
ch7xxx_la_LTLIBRARIES = ch7xxx.la
ch7xxx_la_LDFLAGS = -module -avoid-version

View File

@ -87,7 +87,6 @@ extern const char *I810ddcSymbols[];
extern const char *I810fbSymbols[];
extern const char *I810xaaSymbols[];
extern const char *I810shadowFBSymbols[];
extern const char *I810shadowSymbols[];
#ifdef XF86DRI
extern const char *I810driSymbols[];
extern const char *I810drmSymbols[];
@ -234,6 +233,7 @@ union intfloat {
#define INREG8(addr) *(volatile CARD8 *)(RecPtr->MMIOBase + (addr))
#define INREG16(addr) *(volatile CARD16 *)(RecPtr->MMIOBase + (addr))
#define INREG(addr) *(volatile CARD32 *)(RecPtr->MMIOBase + (addr))
#define POSTING_READ(addr) (void)INREG(addr)
#define OUTREG8(addr, val) do { \
*(volatile CARD8 *)(RecPtr->MMIOBase + (addr)) = (val); \

View File

@ -597,7 +597,8 @@ I810RefreshRing(ScrnInfoPtr pScrn)
if (pI810->LpRing->space < 0)
pI810->LpRing->space += pI810->LpRing->mem.Size;
pI810->AccelInfoRec->NeedToSync = TRUE;
if (pI810->AccelInfoRec)
pI810->AccelInfoRec->NeedToSync = TRUE;
}
/* Emit on gaining VT?

View File

@ -222,6 +222,7 @@ I810InitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].redSize = 5;
pConfigs[i].greenSize = 6;
pConfigs[i].blueSize = 5;
pConfigs[i].alphaSize = 0;
pConfigs[i].redMask = 0x0000F800;
pConfigs[i].greenMask = 0x000007E0;
pConfigs[i].blueMask = 0x0000001F;
@ -1173,7 +1174,9 @@ I810DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
pbox++;
}
I810SelectBuffer(pScrn, I810_SELECT_FRONT);
pI810->AccelInfoRec->NeedToSync = TRUE;
if (pI810->AccelInfoRec)
pI810->AccelInfoRec->NeedToSync = TRUE;
}
/* This routine is a modified form of XAADoBitBlt with the calls to
@ -1332,7 +1335,8 @@ I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
DEALLOCATE_LOCAL(pboxNew1);
}
pI810->AccelInfoRec->NeedToSync = TRUE;
if (pI810->AccelInfoRec)
pI810->AccelInfoRec->NeedToSync = TRUE;
}

View File

@ -10,7 +10,7 @@
#define I810_MAJOR_VERSION 1
#define I810_MINOR_VERSION 7
#define I810_PATCHLEVEL 2
#define I810_PATCHLEVEL 4
typedef struct {
drm_handle_t regs;

View File

@ -343,12 +343,6 @@ const char *I810driSymbols[] = {
#endif /* I830_ONLY */
const char *I810shadowSymbols[] = {
"shadowSetup",
"shadowAdd",
NULL
};
const char *I810i2cSymbols[] = {
"xf86CreateI2CBusRec",
"xf86I2CBusInit",
@ -437,7 +431,6 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
I810drmSymbols,
I810driSymbols,
#endif
I810shadowSymbols,
I810shadowFBSymbols,
I810vbeSymbols, vbeOptionalSymbols,
I810ddcSymbols, I810int10Symbols, NULL);
@ -2227,7 +2220,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
fbPictureInit(pScreen, 0, 0);
fbPictureInit(pScreen, NULL, 0);
xf86SetBlackWhitePixels(pScreen);
@ -2286,18 +2279,18 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Use driver specific palette load routines for Direct Color support. -jens */
if (pScrn->bitsPerPixel == 16) {
if (pScrn->depth == 15) {
if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette15, 0,
if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette15, NULL,
CMAP_PALETTED_TRUECOLOR |
CMAP_RELOAD_ON_MODE_SWITCH))
return FALSE;
} else {
if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, 0,
if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, NULL,
CMAP_PALETTED_TRUECOLOR |
CMAP_RELOAD_ON_MODE_SWITCH))
return FALSE;
}
} else {
if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette24, 0,
if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette24, NULL,
CMAP_PALETTED_TRUECOLOR |
CMAP_RELOAD_ON_MODE_SWITCH))
return FALSE;
@ -2545,19 +2538,19 @@ I810CloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pI810->ScanlineColorExpandBuffers) {
xfree(pI810->ScanlineColorExpandBuffers);
pI810->ScanlineColorExpandBuffers = 0;
pI810->ScanlineColorExpandBuffers = NULL;
}
if (infoPtr) {
if (infoPtr->ScanlineColorExpandBuffers)
xfree(infoPtr->ScanlineColorExpandBuffers);
XAADestroyInfoRec(infoPtr);
pI810->AccelInfoRec = 0;
pI810->AccelInfoRec = NULL;
}
if (pI810->CursorInfoRec) {
xf86DestroyCursorInfoRec(pI810->CursorInfoRec);
pI810->CursorInfoRec = 0;
pI810->CursorInfoRec = NULL;
}
/* Free all allocated video ram.

View File

@ -68,6 +68,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dri.h"
#include "GL/glxint.h"
#include "i830_dri.h"
#ifdef DAMAGE
#include "damage.h"
#endif
#endif
#ifdef I830_USE_EXA
@ -223,9 +226,15 @@ typedef struct _I830CrtcPrivateRec {
#ifdef I830_USE_EXA
ExaOffscreenArea *rotate_mem_exa;
#endif
i830_memory *cursor_mem;
i830_memory *cursor_mem_argb;
/* Card virtual address of the cursor */
unsigned long cursor_offset;
unsigned long cursor_argb_offset;
/* Physical or virtual addresses of the cursor for setting in the cursor
* registers.
*/
unsigned long cursor_addr;
unsigned long cursor_argb_addr;
Bool cursor_is_argb;
} I830CrtcPrivateRec, *I830CrtcPrivatePtr;
#define I830CrtcPrivate(c) ((I830CrtcPrivatePtr) (c)->driver_private)
@ -255,8 +264,6 @@ typedef struct _I830Rec {
unsigned char *FbBase;
int cpp;
DisplayModePtr currentMode;
I830EntPtr entityPrivate;
int init;
@ -274,6 +281,11 @@ typedef struct _I830Rec {
i830_memory *front_buffer;
i830_memory *front_buffer_2;
/* One big buffer for all cursors for kernels that support this */
i830_memory *cursor_mem;
/* separate small buffers for kernels that support this */
i830_memory *cursor_mem_classic[2];
i830_memory *cursor_mem_argb[2];
i830_memory *xaa_scratch;
i830_memory *xaa_scratch_2;
#ifdef I830_USE_EXA
@ -298,31 +310,36 @@ typedef struct _I830Rec {
i830_memory *logical_context;
#ifdef XF86DRI
i830_memory *back_buffer;
i830_memory *third_buffer;
i830_memory *depth_buffer;
i830_memory *textures; /**< Compatibility texture memory */
i830_memory *memory_manager; /**< DRI memory manager aperture */
int TexGranularity;
int drmMinor;
Bool have3DWindows;
int mmModeFlags;
int mmSize;
unsigned int front_tiled;
unsigned int back_tiled;
unsigned int third_tiled;
unsigned int depth_tiled;
#ifdef DAMAGE
DamagePtr pDamage;
RegionRec driRegion;
#endif
#endif
Bool NeedRingBufferLow;
Bool allowPageFlip;
Bool TripleBuffer;
Bool disableTiling;
int backPitch;
Bool CursorNeedsPhysical;
Bool CursorIsARGB;
CursorPtr pCurs;
DGAModePtr DGAModes;
int numDGAModes;
Bool DGAactive;
@ -358,7 +375,6 @@ typedef struct _I830Rec {
Bool useEXA;
Bool noAccel;
Bool SWCursor;
Bool cursorOn;
#ifdef I830_USE_XAA
XAAInfoRecPtr AccelInfoRec;
@ -374,7 +390,6 @@ typedef struct _I830Rec {
int w, int h);
void (*xaa_done_composite)(PixmapPtr pDst);
#endif
xf86CursorInfoPtr CursorInfoRec;
CloseScreenProcPtr CloseScreen;
#ifdef I830_USE_EXA
@ -519,6 +534,7 @@ typedef struct _I830Rec {
#define I830_SELECT_FRONT 0
#define I830_SELECT_BACK 1
#define I830_SELECT_DEPTH 2
#define I830_SELECT_THIRD 3
/* I830 specific functions */
extern int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis);
@ -533,6 +549,27 @@ extern void I830EmitInvarientState(ScrnInfoPtr pScrn);
extern void I915EmitInvarientState(ScrnInfoPtr pScrn);
extern void I830SelectBuffer(ScrnInfoPtr pScrn, int buffer);
/* CRTC-based cursor functions */
void
i830_crtc_load_cursor_image (xf86CrtcPtr crtc, unsigned char *src);
#ifdef ARGB_CURSOR
void
i830_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image);
#endif
void
i830_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y);
void
i830_crtc_show_cursor (xf86CrtcPtr crtc);
void
i830_crtc_hide_cursor (xf86CrtcPtr crtc);
void
i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg);
extern void I830RefreshRing(ScrnInfoPtr pScrn);
extern void I830EmitFlush(ScrnInfoPtr pScrn);
@ -582,6 +619,7 @@ void i830_free_3d_memory(ScrnInfoPtr pScrn);
void i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem);
extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn);
Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn);
Bool i830_allocate_texture_memory(ScrnInfoPtr pScrn);
Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn);
extern Bool I830IsPrimary(ScrnInfoPtr pScrn);

View File

@ -228,6 +228,9 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
case I830_SELECT_BACK:
pI830->bufferOffset = pI830->back_buffer->offset;
break;
case I830_SELECT_THIRD:
pI830->bufferOffset = pI830->third_buffer->offset;
break;
case I830_SELECT_DEPTH:
pI830->bufferOffset = pI830->depth_buffer->offset;
break;

View File

@ -130,6 +130,12 @@ typedef struct {
int pipeB_y;
int pipeB_w;
int pipeB_h;
/* Triple buffering */
drm_handle_t third_handle;
int third_offset;
int third_size;
unsigned int third_tiled;
} drmI830Sarea;
/* Flags for perf_boxes

View File

@ -68,17 +68,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830.h"
static void I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
static void I830ShowCursor(ScrnInfoPtr pScrn);
static void I830HideCursor(ScrnInfoPtr pScrn);
static void I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fb);
static void I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
static Bool I830UseHWCursor(ScreenPtr pScrn, CursorPtr pCurs);
#ifdef ARGB_CURSOR
static void I830LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs);
static Bool I830UseHWCursorARGB(ScreenPtr pScrn, CursorPtr pCurs);
#endif
static void
I830SetPipeCursorBase (xf86CrtcPtr crtc)
{
@ -86,533 +75,203 @@ I830SetPipeCursorBase (xf86CrtcPtr crtc)
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
int pipe = intel_crtc->pipe;
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int cursor_base = (pipe == 0 ? CURSOR_A_BASE : CURSOR_B_BASE);
i830_memory *cursor_mem;
int cursor_base;
if (pipe >= xf86_config->num_crtc)
FatalError("Bad pipe number for cursor base setting\n");
if (pI830->CursorIsARGB)
cursor_mem = intel_crtc->cursor_mem_argb;
else
cursor_mem = intel_crtc->cursor_mem;
if (pI830->CursorNeedsPhysical) {
OUTREG(cursor_base, cursor_mem->bus_addr);
} else {
OUTREG(cursor_base, cursor_mem->offset);
}
}
void
I830SetPipeCursor (xf86CrtcPtr crtc, Bool force)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
int pipe = intel_crtc->pipe;
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
Bool show;
cursor_base = (pipe == 0) ? CURSOR_A_BASE : CURSOR_B_BASE;
if (!crtc->enabled)
return;
show = pI830->cursorOn && crtc->cursorInRange;
if (show && (force || !crtc->cursorShown))
{
if (IS_MOBILE(pI830) || IS_I9XX(pI830)) {
int cursor_control;
if (pipe == 0)
cursor_control = CURSOR_A_CONTROL;
else
cursor_control = CURSOR_B_CONTROL;
temp = INREG(cursor_control);
temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
if (pI830->CursorIsARGB) {
temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
} else
temp |= CURSOR_MODE_64_4C_AX;
temp |= (pipe << 28); /* Connect to correct pipe */
/* Need to set mode, then address. */
OUTREG(cursor_control, temp);
} else {
temp = INREG(CURSOR_CONTROL);
temp &= ~(CURSOR_FORMAT_MASK);
temp |= CURSOR_ENABLE;
if (pI830->CursorIsARGB) {
temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE;
} else
temp |= CURSOR_FORMAT_3C;
OUTREG(CURSOR_CONTROL, temp);
}
crtc->cursorShown = TRUE;
}
else if (!show && (force || crtc->cursorShown))
{
if (IS_MOBILE(pI830) || IS_I9XX(pI830))
{
int cursor_control;
if (pipe == 0)
cursor_control = CURSOR_A_CONTROL;
else
cursor_control = CURSOR_B_CONTROL;
temp = INREG(cursor_control);
temp &= ~(CURSOR_MODE|MCURSOR_GAMMA_ENABLE);
temp |= CURSOR_MODE_DISABLE;
OUTREG(cursor_control, temp);
} else {
temp = INREG(CURSOR_CONTROL);
temp &= ~(CURSOR_ENABLE|CURSOR_GAMMA_ENABLE);
OUTREG(CURSOR_CONTROL, temp);
}
crtc->cursorShown = FALSE;
}
/* Flush cursor changes. */
I830SetPipeCursorBase(crtc);
if (intel_crtc->cursor_is_argb)
OUTREG(cursor_base, intel_crtc->cursor_argb_addr);
else
OUTREG(cursor_base, intel_crtc->cursor_addr);
}
void
I830InitHWCursor(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
int i;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
int i;
DPRINTF(PFX, "I830InitHWCursor\n");
for (i = 0; i < xf86_config->num_crtc; i++)
xf86_config->crtc[i]->cursorShown = FALSE;
DPRINTF(PFX, "I830InitHWCursor\n");
/* Initialise the HW cursor registers, leaving the cursor hidden. */
if (IS_MOBILE(pI830) || IS_I9XX(pI830)) {
for (i = 0; i < xf86_config->num_crtc; i++)
{
int cursor_control = i == 0 ? CURSOR_A_CONTROL : CURSOR_B_CONTROL;
temp = INREG(cursor_control);
temp &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE |
MCURSOR_MEM_TYPE_LOCAL |
MCURSOR_PIPE_SELECT);
temp |= (i << 28);
if (pI830->CursorIsARGB)
temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
else
temp |= CURSOR_MODE_64_4C_AX;
/* Need to set control, then address. */
OUTREG(cursor_control, temp);
I830SetPipeCursorBase(xf86_config->crtc[i]);
}
} else {
temp = INREG(CURSOR_CONTROL);
temp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE |
CURSOR_ENABLE | CURSOR_STRIDE_MASK);
if (pI830->CursorIsARGB)
temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE;
else
temp |= CURSOR_FORMAT_3C;
/* This initialises the format and leave the cursor disabled. */
OUTREG(CURSOR_CONTROL, temp);
/* Need to set address and size after disabling. */
I830SetPipeCursorBase(xf86_config->crtc[0]);
temp = ((I810_CURSOR_X & CURSOR_SIZE_MASK) << CURSOR_SIZE_HSHIFT) |
((I810_CURSOR_Y & CURSOR_SIZE_MASK) << CURSOR_SIZE_VSHIFT);
OUTREG(CURSOR_SIZE, temp);
}
if (!IS_I9XX(pI830))
OUTREG(CURSOR_SIZE, (I810_CURSOR_Y << 12) | I810_CURSOR_X);
/* Initialise the HW cursor registers, leaving the cursor hidden. */
for (i = 0; i < xf86_config->num_crtc; i++)
{
int cursor_control = i == 0 ? CURSOR_A_CONTROL : CURSOR_B_CONTROL;
temp = INREG(cursor_control);
if (IS_MOBILE(pI830) || IS_I9XX(pI830))
{
temp &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE |
MCURSOR_MEM_TYPE_LOCAL |
MCURSOR_PIPE_SELECT);
temp |= (i << 28);
temp |= CURSOR_MODE_DISABLE;
}
else
{
temp &= ~(CURSOR_ENABLE|CURSOR_GAMMA_ENABLE);
}
/* Need to set control, then address. */
OUTREG(cursor_control, temp);
I830SetPipeCursorBase(xf86_config->crtc[i]);
}
}
Bool
I830CursorInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn;
I830Ptr pI830;
xf86CursorInfoPtr infoPtr;
DPRINTF(PFX, "I830CursorInit\n");
pScrn = xf86Screens[pScreen->myNum];
pI830 = I830PTR(pScrn);
pI830->CursorInfoRec = infoPtr = xf86CreateCursorInfoRec();
if (!infoPtr)
return FALSE;
infoPtr->MaxWidth = I810_CURSOR_X;
infoPtr->MaxHeight = I810_CURSOR_Y;
infoPtr->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
HARDWARE_CURSOR_INVERT_MASK |
HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |
HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | 0);
infoPtr->SetCursorColors = I830SetCursorColors;
infoPtr->SetCursorPosition = I830SetCursorPosition;
infoPtr->LoadCursorImage = I830LoadCursorImage;
infoPtr->HideCursor = I830HideCursor;
infoPtr->ShowCursor = I830ShowCursor;
infoPtr->UseHWCursor = I830UseHWCursor;
#ifdef ARGB_CURSOR
infoPtr->UseHWCursorARGB = I830UseHWCursorARGB;
infoPtr->LoadCursorARGB = I830LoadCursorARGB;
#endif
pI830->pCurs = NULL;
I830HideCursor(pScrn);
return xf86InitCursor(pScreen, infoPtr);
return xf86_cursors_init (pScreen, I810_CURSOR_X, I810_CURSOR_Y,
(HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
HARDWARE_CURSOR_INVERT_MASK |
HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |
HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
HARDWARE_CURSOR_ARGB));
}
static Bool
I830UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
void
i830_crtc_load_cursor_image (xf86CrtcPtr crtc, unsigned char *src)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
I830Ptr pI830 = I830PTR(crtc->scrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD8 *pcurs;
pI830->pCurs = pCurs;
pcurs = pI830->FbBase + intel_crtc->cursor_offset;
return TRUE;
intel_crtc->cursor_is_argb = FALSE;
memcpy (pcurs, src, I810_CURSOR_X * I810_CURSOR_Y / 4);
}
static void
I830CRTCLoadCursorImage(xf86CrtcPtr crtc, unsigned char *src)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830Ptr pI830 = I830PTR(pScrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD8 *pcurs = (CARD8 *) (pI830->FbBase + intel_crtc->cursor_mem->offset);
int x, y;
DPRINTF(PFX, "I830LoadCursorImage\n");
#ifdef ARGB_CURSOR
pI830->CursorIsARGB = FALSE;
#endif
memset(pcurs, 0, 64 * 64 / 4);
#define GetBit(image, x, y)\
((int)((*(image + ((x) / 8) + ((y) * (128/8))) &\
(1 << ( 7 -((x) % 8) ))) ? 1 : 0))
#define SetBit(image, x, y)\
(*(image + (x) / 8 + (y) * (128/8)) |=\
(int) (1 << (7-((x) % 8))))
switch (crtc->rotation) {
case RR_Rotate_90:
for (y = 0; y < 64; y++) {
for (x = 0; x < 64; x++) {
if (GetBit(src, 64 - y - 1, x))
SetBit(pcurs, x, y);
if (GetBit(src, 128 - y - 1, x))
SetBit(pcurs, x + 64, y);
}
}
return;
case RR_Rotate_180:
for (y = 0; y < 64; y++) {
for (x = 0; x < 64; x++) {
if (GetBit(src, 64 - x - 1, 64 - y - 1))
SetBit(pcurs, x, y);
if (GetBit(src, 128 - x - 1, 64 - y - 1))
SetBit(pcurs, x + 64, y);
}
}
return;
case RR_Rotate_270:
for (y = 0; y < 64; y++) {
for (x = 0; x < 64; x++) {
if (GetBit(src, y, 64 - x - 1))
SetBit(pcurs, x, y);
if (GetBit(src, y + 64, 64 - x - 1))
SetBit(pcurs, x + 64, y);
}
}
return;
}
for (y = 0; y < 64; y++) {
for (x = 0; x < 64 / 4; x++) {
*pcurs++ = *src++;
}
}
}
static void
I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
void
i830_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int pipe;
I830Ptr pI830 = I830PTR(crtc->scrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD32 *pcurs;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++) {
I830CRTCLoadCursorImage(xf86_config->crtc[pipe], src);
pcurs = (CARD32 *) (pI830->FbBase + intel_crtc->cursor_argb_offset);
intel_crtc->cursor_is_argb = TRUE;
memcpy (pcurs, image, I810_CURSOR_Y * I810_CURSOR_X * 4);
}
#endif
void
i830_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
{
ScrnInfoPtr scrn = crtc->scrn;
I830Ptr pI830 = I830PTR(scrn);
I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc);
CARD32 temp;
temp = 0;
if (x < 0) {
temp |= (CURSOR_POS_SIGN << CURSOR_X_SHIFT);
x = -x;
}
}
if (y < 0) {
temp |= (CURSOR_POS_SIGN << CURSOR_Y_SHIFT);
y = -y;
}
temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT);
temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
#ifdef ARGB_CURSOR
#include "cursorstr.h"
static Bool I830UseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
DPRINTF(PFX, "I830UseHWCursorARGB\n");
pI830->pCurs = pCurs;
/* Check that our ARGB allocations succeeded */
for (i = 0; i < xf86_config->num_crtc; i++) {
I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
if (intel_crtc->cursor_mem_argb == NULL)
return FALSE;
}
if (pScrn->bitsPerPixel == 8)
return FALSE;
if (pCurs->bits->height <= 64 && pCurs->bits->width <= 64)
return TRUE;
return FALSE;
}
static void I830CRTCLoadCursorARGB (xf86CrtcPtr crtc, CursorPtr pCurs)
{
I830Ptr pI830 = I830PTR(crtc->scrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD32 *dst = (CARD32 *) (pI830->FbBase +
intel_crtc->cursor_mem_argb->offset);
CARD32 *image = (CARD32 *)pCurs->bits->argb;
int x, y, w, h;
DPRINTF(PFX, "I830LoadCursorARGB\n");
if (!image)
return; /* XXX can't happen */
switch (intel_crtc->pipe) {
case 0:
OUTREG(CURSOR_A_POSITION, temp);
break;
case 1:
OUTREG(CURSOR_B_POSITION, temp);
break;
}
pI830->CursorIsARGB = TRUE;
w = pCurs->bits->width;
h = pCurs->bits->height;
switch (crtc->rotation) {
case RR_Rotate_90:
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
dst[(y) + ((64 - x - 1) * 64)] = *image++;
for(; x < 64; x++)
dst[(y) + ((64 - x - 1) * 64)] = 0;
}
for(; y < 64; y++) {
for(x = 0; x < 64; x++)
dst[(y) + ((64 - x - 1) * 64)] = 0;
}
return;
case RR_Rotate_180:
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
dst[(64 - x - 1) + ((64 - y - 1) * 64)] = *image++;
for(; x < 64; x++)
dst[(64 - x - 1) + ((64 - y - 1) * 64)] = 0;
}
for(; y < 64; y++) {
for(x = 0; x < 64; x++)
dst[(64 - x - 1) + ((64 - y - 1) * 64)] = 0;
}
return;
case RR_Rotate_270:
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
dst[(64 - y - 1) + (x * 64)] = *image++;
for(; x < 64; x++)
dst[(64 - y - 1) + (x * 64)] = 0;
}
for(; y < 64; y++) {
for(x = 0; x < 64; x++)
dst[(64 - y - 1) + (x * 64)] = 0;
}
return;
}
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++)
*dst++ = *image++;
for(; x < 64; x++)
*dst++ = 0;
}
for(; y < 64; y++) {
for(x = 0; x < 64; x++)
*dst++ = 0;
}
if (crtc->cursor_shown)
I830SetPipeCursorBase (crtc);
}
static void
I830LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
void
i830_crtc_show_cursor (xf86CrtcPtr crtc)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int pipe;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++) {
I830CRTCLoadCursorARGB(xf86_config->crtc[pipe], pCurs);
}
}
#endif
static void
I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
Bool inrange;
int root_x = x, root_y = y;
int pipe;
root_x = x + pScrn->frameX0; /* undo what xf86HWCurs did */
root_y = y + pScrn->frameY0;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
ScrnInfoPtr scrn = crtc->scrn;
I830Ptr pI830 = I830PTR(scrn);
I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc);
int pipe = intel_crtc->pipe;
CARD32 temp;
int cursor_control = (pipe == 0 ? CURSOR_A_CONTROL :
CURSOR_B_CONTROL);
temp = INREG(cursor_control);
if (IS_MOBILE(pI830) || IS_I9XX(pI830))
{
xf86CrtcPtr crtc = xf86_config->crtc[pipe];
DisplayModePtr mode = &crtc->mode;
int thisx = 0;
int thisy = 0;
int hotspotx = 0, hotspoty = 0;
temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
if (intel_crtc->cursor_is_argb)
temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
else
temp |= CURSOR_MODE_64_4C_AX;
if (!crtc->enabled)
continue;
switch (crtc->rotation) {
case RR_Rotate_0:
thisx = (root_x - crtc->x);
thisy = (root_y - crtc->y);
break;
case RR_Rotate_90:
thisx = (root_y - crtc->y);
thisy = mode->VDisplay - (root_x - crtc->x);
hotspoty = I810_CURSOR_X;
break;
case RR_Rotate_180:
thisx = mode->HDisplay - (root_x - crtc->x);
thisy = mode->VDisplay - (root_y - crtc->y);
hotspotx = I810_CURSOR_X;
hotspoty = I810_CURSOR_Y;
break;
case RR_Rotate_270:
thisx = mode->HDisplay - (root_y - crtc->y);
thisy = (root_x - crtc->x);
hotspotx = I810_CURSOR_Y;
break;
}
thisx -= hotspotx;
thisy -= hotspoty;
/*
* There is a screen display problem when the cursor position is set
* wholely outside of the viewport. We trap that here, turning the
* cursor off when that happens, and back on when it comes back into
* the viewport.
*/
inrange = TRUE;
if (thisx >= mode->HDisplay ||
thisy >= mode->VDisplay ||
thisx <= -I810_CURSOR_X || thisy <= -I810_CURSOR_Y)
{
inrange = FALSE;
thisx = 0;
thisy = 0;
}
temp = 0;
if (thisx < 0) {
temp |= (CURSOR_POS_SIGN << CURSOR_X_SHIFT);
thisx = -thisx;
}
if (thisy < 0) {
temp |= (CURSOR_POS_SIGN << CURSOR_Y_SHIFT);
thisy = -thisy;
}
temp |= ((thisx & CURSOR_POS_MASK) << CURSOR_X_SHIFT);
temp |= ((thisy & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
if (pipe == 0)
OUTREG(CURSOR_A_POSITION, temp);
if (pipe == 1)
OUTREG(CURSOR_B_POSITION, temp);
crtc->cursorInRange = inrange;
I830SetPipeCursor (crtc, FALSE);
temp |= (pipe << 28); /* Connect to correct pipe */
}
else
{
temp &= ~(CURSOR_FORMAT_MASK);
temp |= CURSOR_ENABLE;
if (intel_crtc->cursor_is_argb)
temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE;
else
temp |= CURSOR_FORMAT_3C;
}
/* Need to set mode, then address. */
OUTREG(cursor_control, temp);
I830SetPipeCursorBase (crtc);
}
static void
I830ShowCursor(ScrnInfoPtr pScrn)
void
i830_crtc_hide_cursor (xf86CrtcPtr crtc)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
ScrnInfoPtr scrn = crtc->scrn;
I830Ptr pI830 = I830PTR(scrn);
I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc);
int pipe = intel_crtc->pipe;
CARD32 temp;
int cursor_control = (pipe == 0 ? CURSOR_A_CONTROL :
CURSOR_B_CONTROL);
temp = INREG(cursor_control);
if (IS_MOBILE(pI830) || IS_I9XX(pI830))
{
temp &= ~(CURSOR_MODE|MCURSOR_GAMMA_ENABLE);
temp |= CURSOR_MODE_DISABLE;
}
else
temp &= ~(CURSOR_ENABLE|CURSOR_GAMMA_ENABLE);
DPRINTF(PFX, "I830ShowCursor\n");
pI830->cursorOn = TRUE;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
I830SetPipeCursor (xf86_config->crtc[pipe], TRUE);
/* Need to set mode, then address. */
OUTREG(cursor_control, temp);
I830SetPipeCursorBase (crtc);
}
static void
I830HideCursor(ScrnInfoPtr pScrn)
void
i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
ScrnInfoPtr scrn = crtc->scrn;
I830Ptr pI830 = I830PTR(scrn);
I830CrtcPrivatePtr intel_crtc = I830CrtcPrivate(crtc);
int pipe = intel_crtc->pipe;
int pal0 = pipe == 0 ? CURSOR_A_PALETTE0 : CURSOR_B_PALETTE0;
DPRINTF(PFX, "I830HideCursor\n");
pI830->cursorOn = FALSE;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
I830SetPipeCursor (xf86_config->crtc[pipe], TRUE);
}
static void
I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
#ifdef ARGB_CURSOR
/* Don't recolour cursors set with SetCursorARGB. */
if (pI830->CursorIsARGB)
return;
#endif
DPRINTF(PFX, "I830SetCursorColors\n");
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
{
xf86CrtcPtr crtc = xf86_config->crtc[pipe];
int pal0 = pipe == 0 ? CURSOR_A_PALETTE0 : CURSOR_B_PALETTE0;
if (crtc->enabled)
{
OUTREG(pal0 + 0, bg & 0x00ffffff);
OUTREG(pal0 + 4, fg & 0x00ffffff);
OUTREG(pal0 + 8, fg & 0x00ffffff);
OUTREG(pal0 + 12, bg & 0x00ffffff);
}
}
OUTREG(pal0 + 0, bg & 0x00ffffff);
OUTREG(pal0 + 4, fg & 0x00ffffff);
OUTREG(pal0 + 8, fg & 0x00ffffff);
OUTREG(pal0 + 12, bg & 0x00ffffff);
}

View File

@ -187,25 +187,24 @@ DEBUGSTRING(i830_debug_dpll)
} else {
Bool is_lvds = (INREG(LVDS) & LVDS_PORT_EN) && (reg == DPLL_B);
if (val & PLL_P2_DIVIDE_BY_4)
p2 = 4;
else
p2 = 2;
if (is_lvds) {
mode = "LVDS";
/* Map the bit number set from (1, 6) to (-1, 4). */
p1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS) >>
DPLL_FPA01_P1_POST_DIV_SHIFT);
p2 = 14;
} else {
mode = "DAC/serial";
if (val & PLL_P1_DIVIDE_BY_TWO) {
p1 = 2;
} else {
/* Map the number in the field to (1, 31) */
/* Map the number in the field to (3, 33) */
p1 = ((val & DPLL_FPA01_P1_POST_DIV_MASK_I830) >>
DPLL_FPA01_P1_POST_DIV_SHIFT) + 2;
}
if (val & PLL_P2_DIVIDE_BY_4)
p2 = 4;
else
p2 = 2;
}
}
@ -255,6 +254,17 @@ DEBUGSTRING(i830_debug_dpll_test)
dpllbndiv, dpllbmdiv, dpllbinput);
}
DEBUGSTRING(i830_debug_adpa)
{
char pipe = (val & ADPA_PIPE_B_SELECT) ? 'B' : 'A';
char *enable = (val & ADPA_DAC_ENABLE) ? "enabled" : "disabled";
char hsync = (val & ADPA_HSYNC_ACTIVE_HIGH) ? '+' : '-';
char vsync = (val & ADPA_VSYNC_ACTIVE_HIGH) ? '+' : '-';
return XNFprintf("%s, pipe %c, %chsync, %cvsync",
enable, pipe, hsync, vsync);
}
DEBUGSTRING(i830_debug_lvds)
{
char pipe = val & LVDS_PIPEB_SELECT ? 'B' : 'A';
@ -314,7 +324,7 @@ static struct i830SnapshotRec {
DEFINEREG(DSPFW2),
DEFINEREG(DSPFW3),
DEFINEREG(ADPA),
DEFINEREG2(ADPA, i830_debug_adpa),
DEFINEREG2(LVDS, i830_debug_lvds),
DEFINEREG(DVOA),
DEFINEREG(DVOB),

View File

@ -85,15 +85,14 @@ typedef struct {
#define I8XX_M2_MAX 16
#define I8XX_P_MIN 4
#define I8XX_P_MAX 128
/* LVDS p1 value can go from 1 to 6, while DAC goes from 2 to 33. These
* values below get 2 added in the clock calculations.
*/
#define I8XX_P1_MIN 0
#define I8XX_P1_MAX 31
#define I8XX_P1_LVDS_MIN -1
#define I8XX_P1_LVDS_MAX 4
#define I8XX_P2_SLOW 1 /* this is a bit shift amount */
#define I8XX_P2_FAST 0 /* this is a bit shift amount */
#define I8XX_P1_MIN 2
#define I8XX_P1_MAX 33
#define I8XX_P1_LVDS_MIN 1
#define I8XX_P1_LVDS_MAX 6
#define I8XX_P2_SLOW 4
#define I8XX_P2_FAST 2
#define I8XX_P2_LVDS_SLOW 14
#define I8XX_P2_LVDS_FAST 14 /* No fast option */
#define I8XX_P2_SLOW_LIMIT 165000
#define I9XX_DOT_MIN 20000
@ -149,7 +148,7 @@ static const intel_limit_t intel_limits[] = {
.p = { .min = I8XX_P_MIN, .max = I8XX_P_MAX },
.p1 = { .min = I8XX_P1_LVDS_MIN, .max = I8XX_P1_LVDS_MAX },
.p2 = { .dot_limit = I8XX_P2_SLOW_LIMIT,
.p2_slow = I8XX_P2_FAST, .p2_fast = I8XX_P2_FAST },
.p2_slow = I8XX_P2_LVDS_SLOW, .p2_fast = I8XX_P2_LVDS_FAST },
},
{ /* INTEL_LIMIT_I9XX_SDVO_DAC */
.dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX },
@ -206,7 +205,7 @@ static const intel_limit_t *intel_limit (xf86CrtcPtr crtc)
static void i8xx_clock(int refclk, intel_clock_t *clock)
{
clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
clock->p = (clock->p1 + 2) << (clock->p2 + 1);
clock->p = clock->p1 * clock->p2;
clock->vco = refclk * clock->m / (clock->n + 2);
clock->dot = clock->vco / clock->p;
}
@ -383,114 +382,37 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
if (IS_I965G(pI830)) {
OUTREG(dspbase, Offset);
(void) INREG(dspbase);
POSTING_READ(dspbase);
OUTREG(dspsurf, Start);
(void) INREG(dspsurf);
POSTING_READ(dspsurf);
} else {
OUTREG(dspbase, Start + Offset);
(void) INREG(dspbase);
POSTING_READ(dspbase);
}
}
/**
* In the current world order, there are lists of modes per output, which may
* or may not include the mode that was asked to be set by XFree86's mode
* selection. Find the closest one, in the following preference order:
*
* - Equality
* - Closer in size to the requested mode, but no larger
* - Closer in refresh rate to the requested mode.
*/
DisplayModePtr
i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode)
{
ScrnInfoPtr pScrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
DisplayModePtr pBest = NULL, pScan = NULL;
int i;
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
/* Assume that there's only one output connected to the given CRTC. */
for (i = 0; i < xf86_config->num_output; i++)
{
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc == crtc && output->probed_modes != NULL)
{
pScan = output->probed_modes;
if (!sPriv)
return;
switch (pipe) {
case 0:
sPriv->pipeA_x = x;
sPriv->pipeA_y = y;
break;
case 1:
sPriv->pipeB_x = x;
sPriv->pipeB_y = y;
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Can't update pipe %d in SAREA\n", pipe);
break;
}
}
/* If the pipe doesn't have any detected modes, just let the system try to
* spam the desired mode in.
*/
if (pScan == NULL) {
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"No pipe mode list for pipe %d,"
"continuing with desired mode\n", intel_crtc->pipe);
return pMode;
}
for (; pScan != NULL; pScan = pScan->next) {
assert(pScan->VRefresh != 0.0);
/* If there's an exact match, we're done. */
if (xf86ModesEqual(pScan, pMode)) {
pBest = pMode;
break;
}
/* Reject if it's larger than the desired mode. */
if (pScan->HDisplay > pMode->HDisplay ||
pScan->VDisplay > pMode->VDisplay)
{
continue;
}
if (pBest == NULL) {
pBest = pScan;
continue;
}
/* Find if it's closer to the right size than the current best
* option.
*/
if ((pScan->HDisplay > pBest->HDisplay &&
pScan->VDisplay >= pBest->VDisplay) ||
(pScan->HDisplay >= pBest->HDisplay &&
pScan->VDisplay > pBest->VDisplay))
{
pBest = pScan;
continue;
}
/* Find if it's still closer to the right refresh than the current
* best resolution.
*/
if (pScan->HDisplay == pBest->HDisplay &&
pScan->VDisplay == pBest->VDisplay &&
(fabs(pScan->VRefresh - pMode->VRefresh) <
fabs(pBest->VRefresh - pMode->VRefresh))) {
pBest = pScan;
}
}
if (pBest == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"No suitable mode found to program for the pipe.\n"
" continuing with desired mode %dx%d@%.1f\n",
pMode->HDisplay, pMode->VDisplay, pMode->VRefresh);
} else if (!xf86ModesEqual(pBest, pMode)) {
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
int pipe = intel_crtc->pipe;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Choosing pipe %d's mode %dx%d@%.1f instead of xf86 "
"mode %dx%d@%.1f\n", pipe,
pBest->HDisplay, pBest->VDisplay, pBest->VRefresh,
pMode->HDisplay, pMode->VDisplay, pMode->VRefresh);
pMode = pBest;
}
return pMode;
#endif
}
/**
@ -524,12 +446,15 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
if ((temp & DPLL_VCO_ENABLE) == 0)
{
OUTREG(dpll_reg, temp);
POSTING_READ(dpll_reg);
/* Wait for the clocks to stabilize. */
usleep(150);
OUTREG(dpll_reg, temp | DPLL_VCO_ENABLE);
POSTING_READ(dpll_reg);
/* Wait for the clocks to stabilize. */
usleep(150);
OUTREG(dpll_reg, temp | DPLL_VCO_ENABLE);
POSTING_READ(dpll_reg);
/* Wait for the clocks to stabilize. */
usleep(150);
}
@ -567,6 +492,7 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
OUTREG(dspcntr_reg, temp & ~DISPLAY_PLANE_ENABLE);
/* Flush the plane changes */
OUTREG(dspbase_reg, INREG(dspbase_reg));
POSTING_READ(dspbase_reg);
}
if (!IS_I9XX(pI830)) {
@ -576,20 +502,49 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
/* Next, disable display pipes */
temp = INREG(pipeconf_reg);
if ((temp & PIPEACONF_ENABLE) != 0)
if ((temp & PIPEACONF_ENABLE) != 0) {
OUTREG(pipeconf_reg, temp & ~PIPEACONF_ENABLE);
POSTING_READ(pipeconf_reg);
}
/* Wait for vblank for the disable to take effect. */
i830WaitForVblank(pScrn);
temp = INREG(dpll_reg);
if ((temp & DPLL_VCO_ENABLE) != 0)
if ((temp & DPLL_VCO_ENABLE) != 0) {
OUTREG(dpll_reg, temp & ~DPLL_VCO_ENABLE);
POSTING_READ(dpll_reg);
}
/* Wait for the clocks to turn off. */
usleep(150);
break;
}
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen);
Bool enabled = crtc->enabled && mode != DPMSModeOff;
if (!sPriv)
return;
switch (pipe) {
case 0:
sPriv->pipeA_w = enabled ? crtc->mode.HDisplay : 0;
sPriv->pipeA_h = enabled ? crtc->mode.VDisplay : 0;
break;
case 1:
sPriv->pipeB_w = enabled ? crtc->mode.HDisplay : 0;
sPriv->pipeB_h = enabled ? crtc->mode.VDisplay : 0;
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Can't update pipe %d in SAREA\n", pipe);
break;
}
}
#endif
}
static Bool
@ -623,6 +578,8 @@ static void
i830_crtc_commit (xf86CrtcPtr crtc)
{
crtc->funcs->dpms (crtc, DPMSModeOn);
if (crtc->scrn->pScreen != NULL)
xf86_reload_cursors (crtc->scrn->pScreen);
}
void
@ -841,15 +798,15 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT);
} else {
if (is_lvds) {
/* map (-1 to 4) to ((1 << 0) to (1 << 5)). */
dpll |= (1 << (clock.p1 + 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT;
} else {
if (clock.p1 == 0)
if (clock.p1 == 2)
dpll |= PLL_P1_DIVIDE_BY_TWO;
else
dpll |= clock.p1 << DPLL_FPA01_P1_POST_DIV_SHIFT;
dpll |= (clock.p1 - 2) << DPLL_FPA01_P1_POST_DIV_SHIFT;
if (clock.p2 == 4)
dpll |= PLL_P2_DIVIDE_BY_4;
}
dpll |= clock.p2 << 23;
}
if (is_tv)
@ -908,6 +865,30 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
pipeconf |= PIPEACONF_ENABLE;
dpll |= DPLL_VCO_ENABLE;
#endif
/* Disable the panel fitter if it was on our pipe */
if (i830_panel_fitter_pipe (pI830) == pipe)
OUTREG(PFIT_CONTROL, 0);
#if 1
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
xf86PrintModeline(pScrn->scrnIndex, mode);
if (!xf86ModesEqual(mode, adjusted_mode)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
xf86PrintModeline(pScrn->scrnIndex, mode);
}
i830PrintPll("chosen", &clock);
#endif
if (dpll & DPLL_VCO_ENABLE)
{
OUTREG(fp_reg, fp);
OUTREG(dpll_reg, dpll & ~DPLL_VCO_ENABLE);
POSTING_READ(dpll_reg);
usleep(150);
}
if (is_lvds)
{
@ -926,23 +907,12 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
lvds &= ~LVDS_DITHER_ENABLE;
}
OUTREG(LVDS, lvds);
POSTING_READ(LVDS);
}
/* Disable the panel fitter if it was on our pipe */
if (i830_panel_fitter_pipe (pI830) == pipe)
OUTREG(PFIT_CONTROL, 0);
i830PrintPll("chosen", &clock);
ErrorF("clock regs: 0x%08x, 0x%08x\n", (int)dpll, (int)fp);
if (dpll & DPLL_VCO_ENABLE)
{
OUTREG(fp_reg, fp);
OUTREG(dpll_reg, dpll & ~DPLL_VCO_ENABLE);
usleep(150);
}
OUTREG(fp_reg, fp);
OUTREG(dpll_reg, dpll);
POSTING_READ(dpll_reg);
/* Wait for the clocks to stabilize. */
usleep(150);
@ -951,9 +921,10 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
OUTREG(dpll_md_reg, (0 << DPLL_MD_UDI_DIVIDER_SHIFT) |
((sdvo_pixel_multiply - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT));
} else {
/* write it again -- the BIOS does, after all */
OUTREG(dpll_reg, dpll);
/* write it again -- the BIOS does, after all */
OUTREG(dpll_reg, dpll);
}
POSTING_READ(dpll_reg);
/* Wait for the clocks to stabilize. */
usleep(150);
@ -977,11 +948,15 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
OUTREG(dsppos_reg, 0);
OUTREG(pipesrc_reg, ((mode->HDisplay - 1) << 16) | (mode->VDisplay - 1));
OUTREG(pipeconf_reg, pipeconf);
POSTING_READ(pipeconf_reg);
i830WaitForVblank(pScrn);
OUTREG(dspcntr_reg, dspcntr);
/* Flush the plane changes */
i830PipeSetBase(crtc, x, y);
#ifdef XF86DRI
I830DRISetVBlankInterrupt (pScrn, TRUE);
#endif
i830WaitForVblank(pScrn);
}
@ -1150,46 +1125,6 @@ i830_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
}
/**
* This function configures the screens in clone mode on
* all active outputs using a mode similar to the specified mode.
*/
Bool
i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
Bool ok = TRUE;
xf86CrtcPtr crtc = config->output[config->compat_output]->crtc;
DPRINTF(PFX, "i830SetMode\n");
if (crtc && crtc->enabled)
{
ok = xf86CrtcSetMode(crtc,
i830PipeFindClosestMode(crtc, pMode),
rotation, 0, 0);
if (!ok)
goto done;
crtc->desiredMode = *pMode;
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Mode bandwidth is %d Mpixel/s\n",
(int)(pMode->HDisplay * pMode->VDisplay *
pMode->VRefresh / 1000000));
xf86DisableUnusedFunctions(pScrn);
i830DescribeOutputConfiguration(pScrn);
#ifdef XF86DRI
I830DRISetVBlankInterrupt (pScrn, TRUE);
#endif
done:
i830DumpRegs (pScrn);
i830_sdvo_dump(pScrn);
return ok;
}
void
i830DescribeOutputConfiguration(ScrnInfoPtr pScrn)
{
@ -1340,26 +1275,28 @@ i830_crtc_clock_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc)
Bool is_lvds = (pipe == 1) && (INREG(LVDS) & LVDS_PORT_EN);
if (is_lvds) {
/* Map the bit number set from (1, 6) to (-1, 4). */
clock.p1 = ffs((dpll & DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS) >>
DPLL_FPA01_P1_POST_DIV_SHIFT) - 2;
clock.p2 = 0;
DPLL_FPA01_P1_POST_DIV_SHIFT);
clock.p2 = 14;
if ((dpll & PLL_REF_INPUT_MASK) == PLLB_REF_INPUT_SPREADSPECTRUMIN)
i8xx_clock(66000, &clock); /* XXX: might not be 66MHz */
else
i8xx_clock(48000, &clock);
} else {
if (dpll & PLL_P1_DIVIDE_BY_TWO) {
clock.p1 = 0;
clock.p1 = 2;
} else {
/* Map the number in the field to (1, 31) */
clock.p1 = ((dpll & DPLL_FPA01_P1_POST_DIV_MASK_I830) >>
DPLL_FPA01_P1_POST_DIV_SHIFT);
DPLL_FPA01_P1_POST_DIV_SHIFT) + 2;
}
if (dpll & PLL_P2_DIVIDE_BY_4)
clock.p2 = 1;
clock.p2 = 4;
else
clock.p2 = 0;
}
clock.p2 = 2;
/* XXX: Deal with other refclocks */
i8xx_clock(48000, &clock);
i8xx_clock(48000, &clock);
}
}
/* XXX: It would be nice to validate the clocks, but we can't reuse
@ -1418,6 +1355,12 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = {
.shadow_create = i830_crtc_shadow_create,
.shadow_allocate = i830_crtc_shadow_allocate,
.shadow_destroy = i830_crtc_shadow_destroy,
.set_cursor_colors = i830_crtc_set_cursor_colors,
.set_cursor_position = i830_crtc_set_cursor_position,
.show_cursor = i830_crtc_show_cursor,
.hide_cursor = i830_crtc_hide_cursor,
/* .load_cursor_image = i830_crtc_load_cursor_image, */
.load_cursor_argb = i830_crtc_load_cursor_argb,
.destroy = NULL, /* XXX */
};

View File

@ -28,9 +28,6 @@
#include "xorgVersion.h"
/* i830_display.c */
DisplayModePtr
i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode);
Bool i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation);
void i830PipeSetBase(xf86CrtcPtr crtc, int x, int y);
void i830WaitForVblank(ScrnInfoPtr pScrn);
void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn);

View File

@ -81,6 +81,25 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i830.h"
#include "i830_dri.h"
#include "i915_drm.h"
/* This block and the corresponding configure test can be removed when
* libdrm >= 2.3.1 is required.
*/
#ifndef HAVE_I915_FLIP
#define DRM_VBLANK_FLIP 0x8000000
typedef struct drm_i915_flip {
int pipes;
} drm_i915_flip_t;
#undef DRM_IOCTL_I915_FLIP
#define DRM_IOCTL_I915_FLIP DRM_IOW(DRM_COMMAND_BASE + DRM_I915_FLIP, \
drm_i915_flip_t)
#endif
#include "dristruct.h"
static char I830KernelDriverName[] = "i915";
@ -107,9 +126,13 @@ static void I830DRITransitionTo2d(ScreenPtr pScreen);
static void I830DRITransitionTo3d(ScreenPtr pScreen);
static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen);
static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen);
#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 || \
(DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1))
#define DRI_SUPPORTS_CLIP_NOTIFY 1
#endif
#if 0
static void I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
#ifdef DRI_SUPPORTS_CLIP_NOTIFY
static void I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num);
#endif
extern void GlxSetVisualConfigs(int nconfigs,
@ -551,10 +574,32 @@ I830DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->InitBuffers = I830DRIInitBuffers;
pDRIInfo->MoveBuffers = I830DRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
{
#if DRI_SUPPORTS_CLIP_NOTIFY && DRIINFO_MAJOR_VERSION == 5 && \
DRIINFO_MINOR_VERSION >= 1
int major, minor, patch;
DRIQueryVersion(&major, &minor, &patch);
if (minor >= 1)
#endif
#if DRI_SUPPORTS_CLIP_NOTIFY
pDRIInfo->ClipNotify = I830DRIClipNotify;
#endif
}
pDRIInfo->TransitionTo2d = I830DRITransitionTo2d;
pDRIInfo->TransitionTo3d = I830DRITransitionTo3d;
pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d;
pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d;
#if DRIINFO_MAJOR_VERSION > 5 || \
(DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)
if (!pDRIInfo->ClipNotify)
#endif
{
pDRIInfo->TransitionTo3d = I830DRITransitionTo3d;
pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d;
pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d;
}
/* do driver-independent DRI screen initialization here */
if (!DRIScreenInit(pScreen, pDRIInfo, &pI830->drmSubFD)) {
@ -664,8 +709,26 @@ I830DRIScreenInit(ScreenPtr pScreen)
i830_free_memory(pScrn, pI830->memory_manager);
pI830->memory_manager = NULL;
if (!(pI830->mmModeFlags & I830_KERNEL_TEX)) {
pI830->mmModeFlags |= I830_KERNEL_TEX;
if (!i830_allocate_texture_memory(pScrn)) {
I830DRICloseScreen(pScreen);
drmFreeVersion(version);
return FALSE;
}
}
}
}
#ifdef DAMAGE
if (pI830->allowPageFlip && pI830->drmMinor < 9) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"DRM version 1.9 or newer required for Page flipping. "
"Disabling.\n");
pI830->allowPageFlip = FALSE;
}
#endif
drmFreeVersion(version);
}
}
@ -726,6 +789,22 @@ I830DRIMapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Back Buffer = 0x%08x\n",
(int)sarea->back_handle);
if (pI830->third_buffer) {
if (drmAddMap(pI830->drmSubFD,
(drm_handle_t)(sarea->third_offset + pI830->LinearAddr),
sarea->third_size, DRM_AGP, 0,
(drmAddress) &sarea->third_handle) < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"[drm] drmAddMap(third_handle) failed. Triple buffering "
"inactive\n");
i830_free_memory(pScrn, pI830->third_buffer);
pI830->third_buffer = NULL;
sarea->third_handle = 0;
} else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Third Buffer = 0x%08x\n",
(int)sarea->third_handle);
}
if (drmAddMap(pI830->drmSubFD,
(drm_handle_t)sarea->depth_offset + pI830->LinearAddr,
sarea->depth_size, DRM_AGP, 0,
@ -769,6 +848,10 @@ I830DRIUnmapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
drmRmMap(pI830->drmSubFD, sarea->back_handle);
sarea->back_handle = 0;
}
if (sarea->third_handle) {
drmRmMap(pI830->drmSubFD, sarea->third_handle);
sarea->third_handle = 0;
}
if (sarea->depth_handle) {
drmRmMap(pI830->drmSubFD, sarea->depth_handle);
sarea->depth_handle = 0;
@ -845,6 +928,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
/* init to zero to be safe */
sarea->front_handle = 0;
sarea->back_handle = 0;
sarea->third_handle = 0;
sarea->depth_handle = 0;
sarea->tex_handle = 0;
@ -936,6 +1020,10 @@ I830DRICloseScreen(ScreenPtr pScreen)
DPRINTF(PFX, "I830DRICloseScreen\n");
#ifdef DAMAGE
REGION_UNINIT(pScreen, &pI830->driRegion);
#endif
if (pI830DRI->irq) {
drmCtlUninstHandler(pI830->drmSubFD);
pI830DRI->irq = 0;
@ -981,17 +1069,6 @@ I830DRIFinishScreenInit(ScreenPtr pScreen)
DPRINTF(PFX, "I830DRIFinishScreenInit\n");
/* Have shadow run only while there is 3d active.
*/
#if 0
if (pI830->allowPageFlip && pI830->drmMinor >= 1) {
shadowAdd(pScreen, 0, I830DRIShadowUpdate, 0, 0, 0);
}
else
#endif
pI830->allowPageFlip = 0;
if (!DRIFinishScreenInit(pScreen))
return FALSE;
@ -1022,6 +1099,61 @@ I830DRIFinishScreenInit(ScreenPtr pScreen)
}
}
#ifdef DAMAGE
/* This should be done *before* XAA syncs,
* Otherwise will have to sync again???
*/
static void
I830DRIDoRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox, CARD32 dst)
{
I830Ptr pI830 = I830PTR(pScrn);
int i, cmd, br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16);
if (pScrn->bitsPerPixel == 32) {
cmd = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
br13 |= 3 << 24;
} else {
cmd = (XY_SRC_COPY_BLT_CMD);
br13 |= 1 << 24;
}
for (i = 0 ; i < num ; i++, pbox++) {
BEGIN_LP_RING(8);
OUT_RING(cmd);
OUT_RING(br13);
OUT_RING((pbox->y1 << 16) | pbox->x1);
OUT_RING((pbox->y2 << 16) | pbox->x2);
OUT_RING(dst);
OUT_RING((pbox->y1 << 16) | pbox->x1);
OUT_RING(br13 & 0xffff);
OUT_RING(pI830->front_buffer->offset);
ADVANCE_LP_RING();
}
}
static void
I830DRIRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
I830Ptr pI830 = I830PTR(pScrn);
drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
/* Don't want to do this when no 3d is active and pages are
* right-way-round :
*/
if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0)
return;
I830DRIDoRefreshArea(pScrn, num, pbox, pI830->back_buffer->offset);
if (pI830->third_buffer) {
I830DRIDoRefreshArea(pScrn, num, pbox, pI830->third_buffer->offset);
}
DamageEmpty(pI830->pDamage);
}
#endif
static void
I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType oldContextType, void *oldContext,
@ -1042,12 +1174,92 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
return;
pI830->LockHeld = 1;
I830RefreshRing(pScrn);
I830EmitFlush(pScrn);
#ifdef DAMAGE
if (!pI830->pDamage && pI830->allowPageFlip) {
PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen);
pI830->pDamage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
pScreen, pPix);
if (pI830->pDamage == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"No screen damage record, page flipping disabled\n");
pI830->allowPageFlip = FALSE;
} else {
DamageRegister(&pPix->drawable, pI830->pDamage);
DamageDamageRegion(&pPix->drawable,
&WindowTable[pScreen->myNum]->winSize);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Damage tracking initialized for page flipping\n");
}
}
#endif
} else if (syncType == DRI_2D_SYNC &&
oldContextType == DRI_NO_CONTEXT &&
newContextType == DRI_2D_CONTEXT) {
pI830->LockHeld = 0;
#ifdef DAMAGE
drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
#endif
if (I810_DEBUG & DEBUG_VERBOSE_DRI)
ErrorF("i830DRISwapContext (out)\n");
if (!pScrn->vtSema)
return;
#ifdef DAMAGE
if (pI830->pDamage) {
RegionPtr pDamageReg = DamageRegion(pI830->pDamage);
if (pDamageReg) {
RegionRec region;
int nrects;
REGION_NULL(pScreen, &region);
REGION_SUBTRACT(pScreen, &region, pDamageReg, &pI830->driRegion);
if ((nrects = REGION_NUM_RECTS(&region)))
I830DRIRefreshArea(pScrn, nrects, REGION_RECTS(&region));
REGION_UNINIT(pScreen, &region);
}
}
#endif
I830EmitFlush(pScrn);
#ifdef DAMAGE
/* Try flipping back to the front page if necessary */
if (sPriv && !sPriv->pf_enabled && sPriv->pf_current_page != 0) {
drm_i915_flip_t flip = { .pipes = 0 };
if (sPriv->pf_current_page & (0x3 << 2)) {
sPriv->pf_current_page = sPriv->pf_current_page & 0x3;
sPriv->pf_current_page |= (sPriv->third_handle ? 2 : 1) << 2;
flip.pipes |= 0x2;
}
if (sPriv->pf_current_page & 0x3) {
sPriv->pf_current_page = sPriv->pf_current_page & (0x3 << 2);
sPriv->pf_current_page |= sPriv->third_handle ? 2 : 1;
flip.pipes |= 0x1;
}
drmCommandWrite(pI830->drmSubFD, DRM_I915_FLIP, &flip, sizeof(flip));
if (sPriv->pf_current_page != 0)
xf86DrvMsg(pScreen->myNum, X_WARNING,
"[dri] %s: kernel failed to unflip buffers.\n", __func__);
}
#endif
pI830->LockHeld = 0;
} else if (I810_DEBUG & DEBUG_VERBOSE_DRI)
ErrorF("i830DRISwapContext (other)\n");
}
@ -1068,6 +1280,13 @@ I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
I830SelectBuffer(pScrn, I830_SELECT_BACK);
I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
if (I830PTR(pScrn)->third_buffer) {
I830SelectBuffer(pScrn, I830_SELECT_THIRD);
I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1,
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
}
pbox++;
}
@ -1241,6 +1460,10 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
I830SelectBuffer(pScrn, I830_SELECT_BACK);
I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h);
if (pI830->third_buffer) {
I830SelectBuffer(pScrn, I830_SELECT_THIRD);
I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h);
}
if (!IS_I965G(pI830)) {
I830SelectBuffer(pScrn, I830_SELECT_DEPTH);
I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h);
@ -1267,10 +1490,6 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
* allocate and free 3d-specific memory on demand.
*/
/* Use the miext/shadow module to maintain a list of dirty rectangles.
* These are blitted to the back buffer to keep both buffers clean
* during page-flipping when the 3d application isn't fullscreen.
@ -1283,99 +1502,20 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
* might be faster, but seems like a lot more work...
*/
#if 0
/* This should be done *before* XAA syncs,
* Otherwise will have to sync again???
*/
static void
I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
RegionPtr damage = &pBuf->damage;
int i, num = REGION_NUM_RECTS(damage);
BoxPtr pbox = REGION_RECTS(damage);
drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
int cmd, br13;
/* Don't want to do this when no 3d is active and pages are
* right-way-round :
*/
if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0)
return;
br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16);
if (pScrn->bitsPerPixel == 32) {
cmd = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
br13 |= 3 << 24;
} else {
cmd = (XY_SRC_COPY_BLT_CMD);
br13 |= 1 << 24;
}
for (i = 0 ; i < num ; i++, pbox++) {
BEGIN_LP_RING(8);
OUT_RING(cmd);
OUT_RING(br13);
OUT_RING((pbox->y1 << 16) | pbox->x1);
OUT_RING((pbox->y2 << 16) | pbox->x2);
OUT_RING(pI830->back_buffer->offset);
OUT_RING((pbox->y1 << 16) | pbox->x1);
OUT_RING(br13 & 0xffff);
OUT_RING(pI830->front_buffer->offset);
ADVANCE_LP_RING();
}
}
#endif
static void
I830EnablePageFlip(ScreenPtr pScreen)
I830DRISetPfMask(ScreenPtr pScreen, int pfMask)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
pSAREAPriv->pf_enabled = pI830->allowPageFlip;
pSAREAPriv->pf_active = 0;
if (pI830->allowPageFlip) {
int br13 = (pScrn->displayWidth * pI830->cpp) | (0xcc << 16);
BEGIN_LP_RING(8);
if (pScrn->bitsPerPixel == 32) {
OUT_RING(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
br13 |= 3 << 24;
} else {
OUT_RING(XY_SRC_COPY_BLT_CMD);
br13 |= 1 << 24;
}
OUT_RING(br13);
OUT_RING(0);
OUT_RING((pScrn->virtualY << 16) | pScrn->virtualX);
OUT_RING(pI830->back_buffer->offset);
OUT_RING(0);
OUT_RING(br13 & 0xffff);
OUT_RING(pI830->front_buffer->offset);
ADVANCE_LP_RING();
pSAREAPriv->pf_active = 1;
}
if (pI830->allowPageFlip && pfMask) {
pSAREAPriv->pf_enabled = pI830->allowPageFlip;
pSAREAPriv->pf_active = pfMask;
} else
pSAREAPriv->pf_active = 0;
}
static void
I830DisablePageFlip(ScreenPtr pScreen)
{
drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
pSAREAPriv->pf_active = 0;
}
static void
I830DRITransitionSingleToMulti3d(ScreenPtr pScreen)
{
@ -1383,15 +1523,18 @@ I830DRITransitionSingleToMulti3d(ScreenPtr pScreen)
* -- Field in sarea, plus bumping the window counters.
* -- DRM needs to cope with Front-to-Back swapbuffers.
*/
I830DisablePageFlip(pScreen);
I830DRISetPfMask(pScreen, 0);
}
static void
I830DRITransitionMultiToSingle3d(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
/* Let the remaining 3d app start page flipping again.
*/
I830EnablePageFlip(pScreen);
I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0);
}
static void
@ -1400,32 +1543,69 @@ I830DRITransitionTo3d(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
I830EnablePageFlip(pScreen);
pI830->have3DWindows = 1;
I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0);
}
static void
I830DRITransitionTo2d(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
/* Try flipping back to the front page if necessary */
if (sPriv->pf_current_page == 1)
drmCommandNone(pI830->drmSubFD, DRM_I830_FLIP);
/* Shut down shadowing if we've made it back to the front page:
*/
if (sPriv->pf_current_page == 0) {
I830DisablePageFlip(pScreen);
}
pI830->have3DWindows = 0;
I830DRISetPfMask(pScreen, 0);
sPriv->pf_enabled = 0;
}
#if DRI_SUPPORTS_CLIP_NOTIFY
static void
I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
unsigned pfMask = 0;
REGION_UNINIT(pScreen, &pI830->driRegion);
REGION_NULL(pScreen, &pI830->driRegion);
if (num > 0) {
drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
BoxRec crtcBox[2];
unsigned numvisible[2] = { 0, 0 };
int i, j;
crtcBox[0].x1 = sPriv->pipeA_x;
crtcBox[0].y1 = sPriv->pipeA_y;
crtcBox[0].x2 = crtcBox[0].x1 + sPriv->pipeA_w;
crtcBox[0].y2 = crtcBox[0].y1 + sPriv->pipeA_h;
crtcBox[1].x1 = sPriv->pipeB_x;
crtcBox[1].y1 = sPriv->pipeB_y;
crtcBox[1].x2 = crtcBox[1].x1 + sPriv->pipeB_w;
crtcBox[1].y2 = crtcBox[1].y1 + sPriv->pipeB_h;
for (i = 0; i < 2; i++) {
for (j = 0; j < num; j++) {
WindowPtr pWin = ppWin[j];
if (pWin) {
if (RECT_IN_REGION(pScreen, &pWin->clipList, &crtcBox[i]) !=
rgnOUT)
numvisible[i]++;
if (i == 0)
REGION_UNION(pScreen, &pI830->driRegion, &pWin->clipList,
&pI830->driRegion);
}
}
if (numvisible[i] == 1)
pfMask |= 1 << i;
}
} else
REGION_NULL(pScreen, &pI830->driRegion);
I830DRISetPfMask(pScreen, pfMask);
}
#endif /* DRI_SUPPORTS_CLIP_NOTIFY */
/**
* Update the SAREA fields with the most recent values.
@ -1442,6 +1622,7 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
sarea->front_tiled = pI830->front_tiled;
sarea->back_tiled = pI830->back_tiled;
sarea->third_tiled = pI830->third_tiled;
sarea->depth_tiled = pI830->depth_tiled;
sarea->rotated_tiled = FALSE;
@ -1460,6 +1641,13 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
sarea->height = pScreen->height;
sarea->back_offset = pI830->back_buffer->offset;
sarea->back_size = pI830->back_buffer->size;
if (pI830->third_buffer != NULL) {
sarea->third_offset = pI830->third_buffer->offset;
sarea->third_size = pI830->third_buffer->size;
} else {
sarea->third_offset = 0;
sarea->third_size = 0;
}
sarea->depth_offset = pI830->depth_buffer->offset;
sarea->depth_size = pI830->depth_buffer->size;
if (pI830->textures != NULL) {
@ -1500,7 +1688,10 @@ I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on)
if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) {
if (on) {
if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled)
pipe.pipe = DRM_I830_VBLANK_PIPE_B;
if (pI830->drmMinor >= 6)
pipe.pipe = DRM_I830_VBLANK_PIPE_A | DRM_I830_VBLANK_PIPE_B;
else
pipe.pipe = DRM_I830_VBLANK_PIPE_B;
else
pipe.pipe = DRM_I830_VBLANK_PIPE_A;
} else {

View File

@ -9,8 +9,8 @@
#define I830_MAX_DRAWABLES 256
#define I830_MAJOR_VERSION 1
#define I830_MINOR_VERSION 7
#define I830_PATCHLEVEL 2
#define I830_MINOR_VERSION 8
#define I830_PATCHLEVEL 0
#define I830_REG_SIZE 0x80000

View File

@ -165,6 +165,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define PRINT_MODE_INFO 0
#endif
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
@ -274,8 +275,11 @@ typedef enum {
OPTION_COLOR_KEY,
OPTION_CHECKDEVICES,
OPTION_LINEARALLOC,
#ifdef XF86DRI_MM
OPTION_INTELTEXPOOL,
OPTION_INTELMMSIZE
OPTION_INTELMMSIZE,
#endif
OPTION_TRIPLEBUFFER,
} I830Opts;
static OptionInfoRec I830Options[] = {
@ -292,8 +296,11 @@ static OptionInfoRec I830Options[] = {
{OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE},
{OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE},
#ifdef XF86DRI_MM
{OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE},
#endif
{OPTION_TRIPLEBUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
/* *INDENT-ON* */
@ -535,8 +542,10 @@ I830MapMem(ScrnInfoPtr pScrn)
if (!pI830->FbBase)
return FALSE;
if (I830IsPrimary(pScrn))
pI830->LpRing->virtual_start = pI830->FbBase + pI830->LpRing->mem->offset;
if (I830IsPrimary(pScrn) && pI830->LpRing->mem != NULL) {
pI830->LpRing->virtual_start =
pI830->FbBase + pI830->LpRing->mem->offset;
}
return TRUE;
}
@ -548,7 +557,7 @@ I830UnmapMMIO(ScrnInfoPtr pScrn)
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->MMIOBase,
I810_REG_SIZE);
pI830->MMIOBase = 0;
pI830->MMIOBase = NULL;
}
static Bool
@ -558,7 +567,7 @@ I830UnmapMem(ScrnInfoPtr pScrn)
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->FbBase,
pI830->FbMapSize);
pI830->FbBase = 0;
pI830->FbBase = NULL;
I830UnmapMMIO(pScrn);
return TRUE;
}
@ -839,7 +848,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
char *s;
pointer pVBEModule = NULL;
const char *chipname;
Bool enable;
int num_pipe;
int max_width, max_height;
@ -897,7 +905,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
} else
pI830->entityPrivate = NULL;
if (xf86RegisterResources(pI830->pEnt->index, 0, ResNone)) {
if (xf86RegisterResources(pI830->pEnt->index, NULL, ResNone)) {
PreInitCleanup(pScrn);
return FALSE;
}
@ -1235,30 +1243,37 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->mmModeFlags = 0;
if (!pI830->directRenderingDisabled) {
pI830->mmModeFlags = I830_KERNEL_TEX;
#ifdef XF86DRI_MM
Bool tmp = FALSE;
pI830->mmModeFlags |= I830_KERNEL_TEX;
#ifdef XF86DRI_MM
if (!IS_I965G(pI830))
pI830->mmModeFlags |= I830_KERNEL_MM;
#endif
from = X_PROBED;
#ifdef XF86DRI_MM
if (xf86GetOptValBool(pI830->Options,
OPTION_INTELTEXPOOL, &tmp)) {
from = X_CONFIG;
if (tmp) {
pI830->mmModeFlags |= I830_KERNEL_TEX;
pI830->mmModeFlags &= ~I830_KERNEL_MM;
} else {
pI830->mmModeFlags &= ~I830_KERNEL_TEX;
pI830->mmModeFlags |= I830_KERNEL_MM;
}
}
#endif
xf86DrvMsg(pScrn->scrnIndex, from,
"Will %stry to allocate texture pool "
"for old Mesa 3D driver.\n",
(pI830->mmModeFlags & I830_KERNEL_TEX) ?
"" : "not ");
#ifdef XF86DRI_MM
pI830->mmSize = I830_MM_MAXSIZE;
from = X_INFO;
if (xf86GetOptValInteger(pI830->Options, OPTION_INTELMMSIZE,
@ -1270,6 +1285,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
"\tfor the DRM memory manager.\n",
pI830->mmSize);
}
#endif
}
#endif
@ -1288,17 +1304,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
I830SetupOutputs(pScrn);
SaveHWState(pScrn);
/* Do an initial detection of the outputs while none are configured on yet.
* This will give us some likely legitimate response for later if both
* pipes are already allocated and we're asked to do a detect.
*/
for (i = 0; i < xf86_config->num_output; i++)
{
xf86OutputPtr output = xf86_config->output[i];
output->status = (*output->funcs->detect) (output);
}
if (!xf86InitialConfiguration (pScrn, FALSE))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
@ -1355,14 +1360,24 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->colorKey);
#endif
pI830->allowPageFlip = FALSE;
enable = xf86ReturnOptValBool(pI830->Options, OPTION_PAGEFLIP, FALSE);
#ifdef XF86DRI
if (!pI830->directRenderingDisabled) {
pI830->allowPageFlip = enable;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "page flipping %s\n",
enable ? "enabled" : "disabled");
}
pI830->allowPageFlip = FALSE;
from = (!pI830->directRenderingDisabled &&
xf86GetOptValBool(pI830->Options, OPTION_PAGEFLIP,
&pI830->allowPageFlip)) ? X_CONFIG : X_DEFAULT;
xf86DrvMsg(pScrn->scrnIndex, from, "Will%s try to enable page flipping\n",
pI830->allowPageFlip ? "" : " not");
#endif
#ifdef XF86DRI
pI830->TripleBuffer = FALSE;
from = (!pI830->directRenderingDisabled &&
xf86GetOptValBool(pI830->Options, OPTION_TRIPLEBUFFER,
&pI830->TripleBuffer)) ? X_CONFIG : X_DEFAULT;
xf86DrvMsg(pScrn->scrnIndex, from, "Triple buffering %sabled\n",
pI830->TripleBuffer ? "en" : "dis");
#endif
/*
@ -1405,13 +1420,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->SWCursor = TRUE;
}
if (!xf86RandR12PreInit (pScrn))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "RandR initialization failure\n");
PreInitCleanup(pScrn);
return FALSE;
}
if (pScrn->modes == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
PreInitCleanup(pScrn);
@ -1458,7 +1466,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
memset(&req, 0, sizeof(req));
req.majorversion = 2;
req.minorversion = 0;
req.minorversion = 1;
if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req,
&errmaj, &errmin)) {
LoaderErrorMsg(NULL, "exa", errmaj, errmin);
@ -1502,29 +1510,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
/* rotation requires the newer libshadow */
if (I830IsPrimary(pScrn)) {
int errmaj, errmin;
pI830->shadowReq.majorversion = 1;
pI830->shadowReq.minorversion = 1;
if (!LoadSubModule(pScrn->module, "shadow", NULL, NULL, NULL,
&pI830->shadowReq, &errmaj, &errmin)) {
pI830->shadowReq.minorversion = 0;
if (!LoadSubModule(pScrn->module, "shadow", NULL, NULL, NULL,
&pI830->shadowReq, &errmaj, &errmin)) {
LoaderErrorMsg(NULL, "shadow", errmaj, errmin);
return FALSE;
}
}
} else {
I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
pI830->shadowReq.majorversion = pI8301->shadowReq.majorversion;
pI830->shadowReq.minorversion = pI8301->shadowReq.minorversion;
pI830->shadowReq.patchlevel = pI8301->shadowReq.patchlevel;
}
xf86LoaderReqSymLists(I810shadowSymbols, NULL);
pI830->preinit = FALSE;
return TRUE;
@ -1583,9 +1568,8 @@ ResetState(ScrnInfoPtr pScrn, Bool flush)
OUTREG(LP_RING + RING_HEAD, 0);
OUTREG(LP_RING + RING_TAIL, 0);
OUTREG(LP_RING + RING_START, 0);
if (pI830->CursorInfoRec && pI830->CursorInfoRec->HideCursor)
pI830->CursorInfoRec->HideCursor(pScrn);
xf86_hide_cursors (pScrn);
}
static void
@ -1905,18 +1889,6 @@ RestoreHWState(ScrnInfoPtr pScrn)
return TRUE;
}
static void
InitRegisterRec(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
int i;
if (!I830IsPrimary(pScrn)) return;
for (i = 0; i < 8; i++)
pI830->fence[i] = 0;
}
static void
I830PointerMoved(int index, int x, int y)
{
@ -1944,22 +1916,6 @@ I830PointerMoved(int index, int x, int y)
(*pI830->PointerMoved)(index, newX, newY);
}
static Bool
I830CreateScreenResources (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
pScreen->CreateScreenResources = pI830->CreateScreenResources;
if (!(*pScreen->CreateScreenResources)(pScreen))
return FALSE;
if (!xf86RandR12CreateScreenResources (pScreen))
return FALSE;
return TRUE;
}
static Bool
I830InitFBManager(
ScreenPtr pScreen,
@ -2010,7 +1966,7 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
drmI830Sarea *sarea;
#endif
if (pI830->noAccel)
if (pI830->noAccel || !I830IsPrimary(pScrn))
return;
#ifdef XF86DRI
@ -2134,7 +2090,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
MessageType from;
#ifdef XF86DRI
Bool driDisabled;
#ifdef XF86DRI_MM
unsigned long savedMMSize;
#endif
#endif
pScrn = xf86Screens[pScreen->myNum];
@ -2262,7 +2220,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!I830CheckDRIAvailable(pScrn)) {
pI830->directRenderingDisabled = TRUE;
#ifdef XF86DRI_MM
pI830->mmSize = 0;
#endif
}
if (!pI830->directRenderingDisabled) {
@ -2312,23 +2272,33 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
*/
pI830->disableTiling = FALSE;
#ifdef XF86DRI_MM
savedMMSize = pI830->mmSize;
for (i = 0; i < 4; i++) {
#define MM_TURNS 4
#else
#define MM_TURNS 2
#endif
for (i = 0; i < MM_TURNS; i++) {
if (!tiled && i < 2)
continue;
if (i >= 2) {
if (i >= MM_TURNS/2) {
/* For further allocations, disable tiling */
pI830->disableTiling = TRUE;
pScrn->displayWidth = savedDisplayWidth;
if (pI830->allowPageFlip)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Couldn't allocate tiled memory, page flipping "
"disabled\n");
pI830->allowPageFlip = FALSE;
}
#ifdef XF86DRI_MM
if (i & 1) {
/* For this allocation, switch to a smaller DRI memory manager
* size.
*/
pI830->mmSize = I830_MM_MINPAGES * GTT_PAGE_SIZE;
pI830->mmSize = I830_MM_MINPAGES * GTT_PAGE_SIZE / KB(1);
} else {
pI830->mmSize = savedMMSize;
}
@ -2338,6 +2308,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
"\t %s DRI memory manager reservation:\n",
(i & 2) ? "untiled" : "tiled",
(i & 1) ? "small" : "large");
#else
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Attempting memory allocation with %s buffers:\n",
(i & 1) ? "untiled" : "tiled");
#endif
if (i830_allocate_2d_memory(pScrn) &&
i830_allocate_3d_memory(pScrn))
@ -2356,10 +2331,12 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
i830_reset_allocations(pScrn);
}
if (i == 4) {
if (i == MM_TURNS) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Not enough video memory. Disabling DRI.\n");
#ifdef XF86DRI_MM
pI830->mmSize = 0;
#endif
pI830->directRenderingDisabled = TRUE;
}
} else
@ -2481,8 +2458,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
#endif
InitRegisterRec(pScrn);
#ifdef XF86DRI
/*
* pI830->directRenderingDisabled is set once in PreInit. Reinitialise
@ -2520,6 +2495,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#ifdef XF86DRI
if (pI830->directRenderingEnabled)
pI830->directRenderingEnabled = I830DRIDoMappings(pScreen);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Page Flipping %sabled\n",
pI830->allowPageFlip ? "en" : "dis");
#endif
DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n");
@ -2595,7 +2573,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
fbPictureInit(pScreen, 0, 0);
fbPictureInit(pScreen, NULL, 0);
xf86SetBlackWhitePixels(pScreen);
@ -2611,9 +2589,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
if (!I830EnterVT(scrnIndex, 0))
return FALSE;
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@ -2627,12 +2602,15 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
} else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing SW Cursor!\n");
if (!I830EnterVT(scrnIndex, 0))
return FALSE;
DPRINTF(PFX, "assert( if(!miCreateDefColormap(pScreen)) )\n");
if (!miCreateDefColormap(pScreen))
return FALSE;
DPRINTF(PFX, "assert( if(!xf86HandleColormaps(pScreen, ...)) )\n");
if (!xf86HandleColormaps(pScreen, 256, 8, I830LoadPalette, 0,
if (!xf86HandleColormaps(pScreen, 256, 8, I830LoadPalette, NULL,
CMAP_RELOAD_ON_MODE_SWITCH |
CMAP_PALETTED_TRUECOLOR)) {
return FALSE;
@ -2673,38 +2651,12 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = I830CloseScreen;
if (pI830->shadowReq.minorversion >= 1) {
/* Rotation */
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RandR enabled, ignore the following RandR disabled message.\n");
xf86DisableRandR(); /* Disable built-in RandR extension */
shadowSetup(pScreen);
/* support all rotations */
xf86RandR12Init (pScreen);
if (pI830->useEXA) {
#ifdef I830_USE_EXA
if (pI830->EXADriverPtr->exa_minor >= 1) {
xf86RandR12SetRotations (pScreen, RR_Rotate_0 | RR_Rotate_90 |
RR_Rotate_180 | RR_Rotate_270);
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"EXA version %d.%d too old to support rotation\n",
pI830->EXADriverPtr->exa_major,
pI830->EXADriverPtr->exa_minor);
xf86RandR12SetRotations (pScreen, RR_Rotate_0);
}
#endif /* I830_USE_EXA */
} else {
xf86RandR12SetRotations (pScreen, RR_Rotate_0 | RR_Rotate_90 |
RR_Rotate_180 | RR_Rotate_270);
}
pI830->PointerMoved = pScrn->PointerMoved;
pScrn->PointerMoved = I830PointerMoved;
pI830->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = I830CreateScreenResources;
} else {
/* Rotation */
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "libshadow is version %d.%d.%d, required 1.1.0 or greater for rotation.\n",pI830->shadowReq.majorversion,pI830->shadowReq.minorversion,pI830->shadowReq.patchlevel);
}
if (!xf86CrtcScreenInit (pScreen))
return FALSE;
/* Wrap pointer motion to flip touch screen around */
pI830->PointerMoved = pScrn->PointerMoved;
pScrn->PointerMoved = I830PointerMoved;
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
@ -2739,13 +2691,17 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
I830DRICloseScreen(pScreen);
pI830->directRenderingEnabled = FALSE;
} else {
unsigned long aperEnd = ROUND_DOWN_TO(pI830->memory_manager->offset +
pI830->memory_manager->size,
GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
unsigned long aperStart = ROUND_TO(pI830->memory_manager->offset,
GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
#ifndef XSERVER_LIBDRM_MM
if (I830DrmMMInit(pI830->drmSubFD, pI830->memory_manager->offset,
pI830->memory_manager->size,
if (I830DrmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart,
DRM_BO_MEM_TT)) {
#else
if (drmMMInit(pI830->drmSubFD, pI830->memory_manager->offset,
pI830->memory_manager->size,
if (drmMMInit(pI830->drmSubFD, aperStart, aperEnd - aperStart,
DRM_BO_MEM_TT)) {
#endif
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@ -2833,8 +2789,7 @@ I830LeaveVT(int scrnIndex, int flags)
}
#endif
if (pI830->CursorInfoRec && pI830->CursorInfoRec->HideCursor)
pI830->CursorInfoRec->HideCursor(pScrn);
xf86_hide_cursors (pScrn);
ResetState(pScrn, TRUE);
@ -2856,9 +2811,7 @@ static Bool
I830EnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int i;
DPRINTF(PFX, "Enter VT\n");
@ -2873,12 +2826,6 @@ I830EnterVT(int scrnIndex, int flags)
pI830->leaving = FALSE;
#if 1
/* Clear the framebuffer */
memset(pI830->FbBase + pScrn->fbOffset, 0,
pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
#endif
if (I830IsPrimary(pScrn))
if (!i830_bind_all_memory(pScrn))
return FALSE;
@ -2891,34 +2838,16 @@ I830EnterVT(int scrnIndex, int flags)
ResetState(pScrn, FALSE);
SetHWOperatingState(pScrn);
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)
{
crtc->desiredMode = *i830PipeFindClosestMode (crtc, pScrn->currentMode);
crtc->desiredRotation = RR_Rotate_0;
crtc->desiredX = 0;
crtc->desiredY = 0;
}
if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
crtc->desiredX, crtc->desiredY))
return FALSE;
}
xf86DisableUnusedFunctions(pScrn);
/* Clear the framebuffer */
memset(pI830->FbBase + pScrn->fbOffset, 0,
pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
if (!xf86SetDesiredModes (pScrn))
return FALSE;
i830DumpRegs (pScrn);
i830DescribeOutputConfiguration(pScrn);
#ifdef XF86DRI
I830DRISetVBlankInterrupt (pScrn, TRUE);
#endif
ResetState(pScrn, TRUE);
SetHWOperatingState(pScrn);
@ -2974,8 +2903,6 @@ I830EnterVT(int scrnIndex, int flags)
if (pI830->checkDevices)
pI830->devicesTimer = TimerSet(NULL, 0, 1000, I830CheckDevicesTimer, pScrn);
pI830->currentMode = pScrn->currentMode;
/* Force invarient 3D state to be emitted */
*pI830->used3D = 1<<31;
@ -2985,17 +2912,10 @@ I830EnterVT(int scrnIndex, int flags)
static Bool
I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
Bool ret = TRUE;
DPRINTF(PFX, "I830SwitchMode: mode == %p\n", mode);
if (!i830SetMode(pScrn, mode, pI830->rotation))
pI830->currentMode = mode;
return ret;
return xf86SetSingleMode (pScrn, mode, pI830->rotation);
}
static Bool
@ -3010,6 +2930,15 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
pI830->closing = TRUE;
#ifdef XF86DRI
if (pI830->directRenderingOpen) {
#ifdef DAMAGE
if (pI830->pDamage) {
PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen);
DamageUnregister(&pPix->drawable, pI830->pDamage);
DamageDestroy(pI830->pDamage);
pI830->pDamage = NULL;
}
#endif
#ifdef XF86DRI_MM
if (pI830->mmModeFlags & I830_KERNEL_MM) {
#ifndef XSERVER_LIBDRM_MM
@ -3038,7 +2967,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pI830->ScanlineColorExpandBuffers) {
xfree(pI830->ScanlineColorExpandBuffers);
pI830->ScanlineColorExpandBuffers = 0;
pI830->ScanlineColorExpandBuffers = NULL;
}
#ifdef I830_USE_XAA
if (infoPtr) {
@ -3055,10 +2984,9 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
pI830->EXADriverPtr = NULL;
}
#endif
if (pI830->CursorInfoRec) {
xf86DestroyCursorInfoRec(pI830->CursorInfoRec);
pI830->CursorInfoRec = 0;
}
xf86_cursors_fini (pScreen);
i830_reset_allocations(pScrn);
if (I830IsPrimary(pScrn)) {
xf86GARTCloseScreen(scrnIndex);

View File

@ -72,7 +72,7 @@ struct _I830DVODriver i830_dvo_drivers[] =
*/
/*
{ I830_DVO_CHIP_LVDS, "ch7017", "ch7017_methods",
(CH7017_ADDR_1 << 1), ch7017_symbols, NULL, NULL, NULL }
0xea, ch7017_symbols, NULL, NULL, NULL }
*/
};

View File

@ -336,6 +336,7 @@ i830I2CPutBits(I2CBusPtr b, int clock, int data)
clock_bits = GPIO_CLOCK_DIR_OUT|GPIO_CLOCK_DIR_MASK|GPIO_CLOCK_VAL_MASK;
OUTREG(b->DriverPrivate.uval, reserved | data_bits | clock_bits);
POSTING_READ(b->DriverPrivate.uval);
}
#endif
@ -367,11 +368,16 @@ I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name)
/* Assume all busses are used for DDCish stuff */
/*
* These were set incorrectly in the server pre-1.3, Having
* duplicate settings is sub-optimal, but this lets the driver
* work with older servers
*/
pI2CBus->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
pI2CBus->StartTimeout = 550;
pI2CBus->BitTimeout = 40;
pI2CBus->ByteTimeout = 40;
pI2CBus->AcknTimeout = 40;
pI2CBus->RiseFallTime = 20;
if (!xf86I2CBusInit(pI2CBus))
return FALSE;

View File

@ -225,13 +225,9 @@ i830_lvds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
I830Ptr pI830 = I830PTR(pScrn);
CARD32 pfit_control;
#if 0
/* The LVDS pin pair needs to be on before the DPLLs are enabled.
* This is an exception to the general rule that mode_set doesn't turn
* things on.
/* The LVDS pin pair will already have been turned on in the
* i830_crtc_mode_set since it has a large impact on the DPLL settings.
*/
OUTREG(LVDS, INREG(LVDS) | LVDS_PORT_EN | LVDS_PIPEB_SELECT);
#endif
/* Enable automatic panel scaling so that non-native modes fill the
* screen. Should be enabled before the pipe is enabled, according to

View File

@ -62,10 +62,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* The allocations we might do:
*
* - Ring buffer
* - HW cursor 1
* - HW cursor 2
* - HW ARGB cursor 1
* - HW ARGB cursor 2
* - HW cursor block (either one block or four)
* - Overlay registers
* - XAA linear allocator (optional)
* - EXA 965 state buffer
@ -99,6 +96,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "config.h"
#endif
#include <assert.h>
#include <string.h>
#include "xf86.h"
@ -213,8 +211,7 @@ void
i830_reset_allocations(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
int p;
/* While there is any memory between the start and end markers, free it. */
while (pI830->memory_list->next->next != NULL)
@ -223,13 +220,11 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
/* Null out the pointers for all the allocations we just freed. This is
* kind of gross, but at least it's just one place now.
*/
for (i = 0; i < xf86_config->num_crtc; i++) {
I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
intel_crtc->cursor_mem = NULL;
intel_crtc->cursor_mem_argb = NULL;
pI830->cursor_mem = NULL;
for (p = 0; p < 2; p++) {
pI830->cursor_mem_classic[p] = NULL;
pI830->cursor_mem_argb[p] = NULL;
}
pI830->front_buffer = NULL;
pI830->front_buffer_2 = NULL;
pI830->xaa_scratch = NULL;
@ -240,6 +235,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
pI830->xaa_linear = NULL;
pI830->logical_context = NULL;
pI830->back_buffer = NULL;
pI830->third_buffer = NULL;
pI830->depth_buffer = NULL;
pI830->textures = NULL;
pI830->memory_manager = NULL;
@ -257,6 +253,8 @@ i830_free_3d_memory(ScrnInfoPtr pScrn)
i830_free_memory(pScrn, pI830->back_buffer);
pI830->back_buffer = NULL;
i830_free_memory(pScrn, pI830->third_buffer);
pI830->third_buffer = NULL;
i830_free_memory(pScrn, pI830->depth_buffer);
pI830->depth_buffer = NULL;
i830_free_memory(pScrn, pI830->textures);
@ -611,6 +609,10 @@ i830_describe_allocations(ScrnInfoPtr pScrn, int verbosity, const char *prefix)
i830_describe_tiling(pScrn, verbosity, prefix, pI830->back_buffer,
pI830->back_tiled);
}
if (pI830->third_buffer != NULL) {
i830_describe_tiling(pScrn, verbosity, prefix, pI830->third_buffer,
pI830->third_tiled);
}
if (pI830->depth_buffer != NULL) {
i830_describe_tiling(pScrn, verbosity, prefix, pI830->depth_buffer,
pI830->depth_tiled);
@ -835,54 +837,96 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
return NULL;
}
if (pI830->FbBase)
memset (pI830->FbBase + front_buffer->offset, 0, size);
return front_buffer;
}
static Bool
i830_allocate_cursor_buffers(xf86CrtcPtr crtc)
i830_allocate_cursor_buffers(ScrnInfoPtr pScrn)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
I830Ptr pI830 = I830PTR(pScrn);
long size;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int flags = pI830->CursorNeedsPhysical ? NEED_PHYSICAL_ADDR : 0;
int i;
long size;
if (pI830->SWCursor)
return FALSE;
/* Mouse cursor -- The i810-i830 need a physical address in system
* memory from which to upload the cursor. We get this from
* the agpgart module using a special memory type.
/* Try to allocate one big blob for our cursor memory. This works
* around a limitation in the FreeBSD AGP driver that allows only one
* physical allocation larger than a page, and could allos us
* to pack the cursors smaller.
*/
size = xf86_config->num_crtc * (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB);
size = HWCURSOR_SIZE;
pI830->cursor_mem = i830_allocate_memory(pScrn, "HW cursors",
size, GTT_PAGE_SIZE,
flags);
if (pI830->cursor_mem != NULL) {
unsigned long cursor_offset_base = pI830->cursor_mem->offset;
unsigned long cursor_addr_base, offset = 0;
if (intel_crtc->cursor_mem == NULL) {
intel_crtc->cursor_mem = i830_allocate_memory(pScrn, "HW cursor",
size, GTT_PAGE_SIZE,
flags);
if (intel_crtc->cursor_mem == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate HW cursor space.\n");
if (pI830->CursorNeedsPhysical)
cursor_addr_base = pI830->cursor_mem->bus_addr;
else
cursor_addr_base = pI830->cursor_mem->offset;
/* Set up the offsets for our cursors in each CRTC. */
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
intel_crtc->cursor_argb_addr = cursor_addr_base + offset;
intel_crtc->cursor_argb_offset = cursor_offset_base + offset;
offset += HWCURSOR_SIZE_ARGB;
intel_crtc->cursor_addr = cursor_addr_base + offset;
intel_crtc->cursor_offset = cursor_offset_base + offset;
offset += HWCURSOR_SIZE;
}
return TRUE;
}
/*
* Allocate four separate buffers when the kernel doesn't support
* large allocations as on Linux. If any of these fail, just
* bail back to software cursors everywhere
*/
for (i = 0; i < xf86_config->num_crtc; i++)
{
xf86CrtcPtr crtc = xf86_config->crtc[i];
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn,
"Core cursor",
HWCURSOR_SIZE,
GTT_PAGE_SIZE,
flags);
if (!pI830->cursor_mem_classic[i])
return FALSE;
pI830->cursor_mem_argb[i] = i830_allocate_memory (pScrn, "ARGB cursor",
HWCURSOR_SIZE_ARGB,
GTT_PAGE_SIZE,
flags);
if (!pI830->cursor_mem_argb[i])
return FALSE;
}
}
if (intel_crtc->cursor_mem_argb == NULL) {
/* Allocate the ARGB cursor space. Its success is optional -- we won't
* set SWCursor if it fails.
/*
* Set up the pointers into the allocations
*/
intel_crtc->cursor_mem_argb = i830_allocate_memory(pScrn,
"HW ARGB cursor",
HWCURSOR_SIZE_ARGB,
GTT_PAGE_SIZE,
flags);
if (intel_crtc->cursor_mem_argb == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate HW (ARGB) cursor space.\n");
if (pI830->CursorNeedsPhysical)
{
intel_crtc->cursor_addr = pI830->cursor_mem_classic[i]->bus_addr;
intel_crtc->cursor_argb_addr = pI830->cursor_mem_argb[i]->bus_addr;
}
else
{
intel_crtc->cursor_addr = pI830->cursor_mem_classic[i]->offset;
intel_crtc->cursor_argb_addr = pI830->cursor_mem_argb[i]->offset;
}
intel_crtc->cursor_offset = pI830->cursor_mem_classic[i]->offset;
intel_crtc->cursor_argb_offset = pI830->cursor_mem_argb[i]->offset;
}
return TRUE;
}
@ -894,10 +938,8 @@ Bool
i830_allocate_2d_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
long size;
int i;
if (!pI830->StolenOnly &&
(!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex))) {
@ -913,19 +955,11 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
i830_allocate_ringbuffer(pScrn);
/* Next, allocate other fixed-size allocations we have. */
if (!pI830->SWCursor) {
/* Allocate cursor memory */
for (i = 0; i < xf86_config->num_crtc; i++) {
if (!i830_allocate_cursor_buffers(xf86_config->crtc[i]) &&
!pI830->SWCursor)
{
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling HW cursor because the cursor memory "
"allocation failed.\n");
pI830->SWCursor = TRUE;
break;
}
}
if (!pI830->SWCursor && !i830_allocate_cursor_buffers(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling HW cursor because the cursor memory "
"allocation failed.\n");
pI830->SWCursor = TRUE;
}
/* Space for the X Server's 3D context. 32k is fine for right now. */
@ -936,6 +970,20 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
"Failed to allocate logical context space.\n");
return FALSE;
}
#ifdef I830_USE_EXA
if (pI830->useEXA) {
if (IS_I965G(pI830) && pI830->exa_965_state == NULL) {
pI830->exa_965_state =
i830_allocate_memory(pScrn, "exa G965 state buffer",
EXA_LINEAR_EXTRA, GTT_PAGE_SIZE, 0);
if (pI830->exa_965_state == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to allocate exa state buffer for 965.\n");
return FALSE;
}
}
}
#endif
#ifdef I830_XV
/* Allocate overlay register space and optional XAA linear allocator
@ -982,17 +1030,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
return FALSE;
}
}
if (IS_I965G(pI830) && pI830->exa_965_state == NULL) {
pI830->exa_965_state =
i830_allocate_memory(pScrn, "exa G965 state buffer",
EXA_LINEAR_EXTRA, GTT_PAGE_SIZE, 0);
if (pI830->exa_965_state == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to allocate exa state buffer for 965.\n");
return FALSE;
}
}
}
#endif /* I830_USE_EXA */
@ -1052,7 +1089,8 @@ myLog2(unsigned int n)
}
static Bool
i830_allocate_backbuffer(ScrnInfoPtr pScrn)
i830_allocate_backbuffer(ScrnInfoPtr pScrn, i830_memory **buffer,
unsigned int *tiled, const char *name)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned int pitch = pScrn->displayWidth * pI830->cpp;
@ -1068,26 +1106,23 @@ i830_allocate_backbuffer(ScrnInfoPtr pScrn)
if (!pI830->disableTiling && IsTileable(pScrn, pitch))
{
size = ROUND_TO_PAGE(pitch * ALIGN(height, 16));
pI830->back_buffer =
i830_allocate_memory_tiled(pScrn, "back buffer",
size, pitch, GTT_PAGE_SIZE,
ALIGN_BOTH_ENDS,
TILING_XMAJOR);
pI830->back_tiled = FENCE_XMAJOR;
*buffer = i830_allocate_memory_tiled(pScrn, name, size, pitch,
GTT_PAGE_SIZE, ALIGN_BOTH_ENDS,
TILING_XMAJOR);
*tiled = FENCE_XMAJOR;
}
/* Otherwise, just allocate it linear */
if (pI830->back_buffer == NULL) {
if (*buffer == NULL) {
size = ROUND_TO_PAGE(pitch * height);
pI830->back_buffer = i830_allocate_memory(pScrn, "back buffer",
size, GTT_PAGE_SIZE,
ALIGN_BOTH_ENDS);
pI830->back_tiled = FENCE_LINEAR;
*buffer = i830_allocate_memory(pScrn, name, size, GTT_PAGE_SIZE,
ALIGN_BOTH_ENDS);
*tiled = FENCE_LINEAR;
}
if (pI830->back_buffer == NULL) {
if (*buffer == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to allocate back buffer space.\n");
"Failed to allocate %s space.\n", name);
return FALSE;
}
@ -1111,13 +1146,20 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
/* First try allocating it tiled */
if (!pI830->disableTiling && IsTileable(pScrn, pitch))
{
enum tile_format tile_format;
size = ROUND_TO_PAGE(pitch * ALIGN(height, 16));
/* The 965 requires that the depth buffer be in Y Major format, while
* the rest appear to fail when handed that format.
*/
tile_format = IS_I965G(pI830) ? TILING_YMAJOR: TILING_XMAJOR;
pI830->depth_buffer =
i830_allocate_memory_tiled(pScrn, "depth buffer", size, pitch,
GTT_PAGE_SIZE, ALIGN_BOTH_ENDS,
TILING_YMAJOR);
pI830->depth_tiled = FENCE_YMAJOR;
tile_format);
pI830->depth_tiled = FENCE_XMAJOR;
}
/* Otherwise, allocate it linear. */
@ -1138,7 +1180,7 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
return TRUE;
}
static Bool
Bool
i830_allocate_texture_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
@ -1187,11 +1229,23 @@ i830_allocate_texture_memory(ScrnInfoPtr pScrn)
Bool
i830_allocate_3d_memory(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
DPRINTF(PFX, "i830_allocate_3d_memory\n");
if (!i830_allocate_backbuffer(pScrn))
if (!i830_allocate_backbuffer(pScrn, &pI830->back_buffer,
&pI830->back_tiled, "back buffer"))
return FALSE;
if (pI830->TripleBuffer && !i830_allocate_backbuffer(pScrn,
&pI830->third_buffer,
&pI830->third_tiled,
"third buffer")) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to allocate third buffer, triple buffering "
"inactive\n");
}
if (!i830_allocate_depthbuffer(pScrn))
return FALSE;
@ -1364,7 +1418,9 @@ i830_set_fence(ScrnInfoPtr pScrn, int nr, unsigned int offset,
}
}
if (IS_I9XX(pI830))
if ((IS_I945G(pI830) || IS_I945GM(pI830)) && tile_format == TILING_YMAJOR)
fence_pitch = pitch / 128;
else if (IS_I9XX(pI830))
fence_pitch = pitch / 512;
else
fence_pitch = pitch / 128;

View File

@ -79,6 +79,39 @@ struct i830_sdvo_priv {
/** @} */
};
/**
* Writes the SDVOB or SDVOC with the given value, but always writes both
* SDVOB and SDVOC to work around apparent hardware issues (according to
* comments in the BIOS).
*/
static void i830_sdvo_write_sdvox(xf86OutputPtr output, CARD32 val)
{
ScrnInfoPtr pScrn = output->scrn;
I830OutputPrivatePtr intel_output = output->driver_private;
struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
I830Ptr pI830 = I830PTR(pScrn);
CARD32 bval = val, cval = val;
int i;
if (dev_priv->output_device == SDVOB)
cval = INREG(SDVOC);
else
bval = INREG(SDVOB);
/*
* Write the registers twice for luck. Sometimes,
* writing them only once doesn't appear to 'stick'.
* The BIOS does this too. Yay, magic
*/
for (i = 0; i < 2; i++)
{
OUTREG(SDVOB, bval);
POSTING_READ(SDVOB);
OUTREG(SDVOC, cval);
POSTING_READ(SDVOC);
}
}
/** Read a single byte from the given address on the SDVO device. */
static Bool i830_sdvo_read_byte(xf86OutputPtr output, int addr,
unsigned char *ch)
@ -163,6 +196,9 @@ const static struct _sdvo_cmd_name {
SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_TV_FORMATS),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_TV_FORMAT),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_FORMAT),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_POWER_STATES),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_ENCODER_POWER_STATE),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ENCODER_POWER_STATE),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_RESOLUTION_SUPPORT),
SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_CONTROL_BUS_SWITCH),
};
@ -346,6 +382,34 @@ i830_sdvo_set_active_outputs(xf86OutputPtr output,
return (status == SDVO_CMD_STATUS_SUCCESS);
}
static Bool
i830_sdvo_set_encoder_power_state(xf86OutputPtr output, int mode)
{
CARD8 status;
CARD8 state;
switch (mode) {
case DPMSModeOn:
state = SDVO_ENCODER_STATE_ON;
break;
case DPMSModeStandby:
state = SDVO_ENCODER_STATE_STANDBY;
break;
case DPMSModeSuspend:
state = SDVO_ENCODER_STATE_SUSPEND;
break;
case DPMSModeOff:
state = SDVO_ENCODER_STATE_OFF;
break;
}
i830_sdvo_write_cmd(output, SDVO_CMD_SET_ENCODER_POWER_STATE, &state,
sizeof(state));
status = i830_sdvo_read_response(output, NULL, 0);
return (status == SDVO_CMD_STATUS_SUCCESS);
}
/**
* Returns the pixel clock range limits of the current target input in kHz.
*/
@ -673,7 +737,7 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode,
sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT;
}
OUTREG(dev_priv->output_device, sdvox);
i830_sdvo_write_sdvox(output, sdvox);
}
static void
@ -687,9 +751,15 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode)
if (mode != DPMSModeOn) {
i830_sdvo_set_active_outputs(output, 0);
temp = INREG(dev_priv->output_device);
if ((temp & SDVO_ENABLE) != 0)
OUTREG(dev_priv->output_device, temp & ~SDVO_ENABLE);
if (0)
i830_sdvo_set_encoder_power_state(output, mode);
if (mode == DPMSModeOff) {
temp = INREG(dev_priv->output_device);
if ((temp & SDVO_ENABLE) != 0) {
i830_sdvo_write_sdvox(output, temp & ~SDVO_ENABLE);
}
}
} else {
Bool input1, input2;
int i;
@ -697,16 +767,7 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode)
temp = INREG(dev_priv->output_device);
if ((temp & SDVO_ENABLE) == 0)
{
OUTREG(dev_priv->output_device, temp | SDVO_ENABLE);
#if 0
/* Do it again! If we remove this below register write, or the exact
* same one 2 lines up, the mac mini SDVO output doesn't turn on.
*/
OUTREG(dev_priv->output_device,
INREG(dev_priv->output_device) | SDVO_ENABLE);
#endif
}
i830_sdvo_write_sdvox(output, temp | SDVO_ENABLE);
for (i = 0; i < 2; i++)
i830WaitForVblank(pScrn);
@ -719,6 +780,8 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode)
SDVO_NAME(dev_priv));
}
if (0)
i830_sdvo_set_encoder_power_state(output, mode);
i830_sdvo_set_active_outputs(output, dev_priv->active_outputs);
}
}
@ -766,7 +829,6 @@ i830_sdvo_restore(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
I830OutputPrivatePtr intel_output = output->driver_private;
struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
I830Ptr pI830 = I830PTR(pScrn);
int o;
int i;
Bool input1, input2;
@ -796,7 +858,7 @@ i830_sdvo_restore(xf86OutputPtr output)
i830_sdvo_set_clock_rate_mult(output, dev_priv->save_sdvo_mult);
OUTREG(dev_priv->output_device, dev_priv->save_SDVOX);
i830_sdvo_write_sdvox(output, dev_priv->save_SDVOX);
if (dev_priv->save_SDVOX & SDVO_ENABLE)
{
@ -1209,6 +1271,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device)
"%s: No active TMDS outputs (0x%02x%02x)\n",
SDVO_NAME(dev_priv),
bytes[0], bytes[1]);
name_prefix="Unknown";
}
strcpy (name, name_prefix);
strcat (name, name_suffix);

View File

@ -307,6 +307,14 @@ struct i830_sdvo_set_target_input_args {
#define SDVO_CMD_SET_TV_FORMAT 0x29
#define SDVO_CMD_GET_SUPPORTED_POWER_STATES 0x2a
#define SDVO_CMD_GET_ENCODER_POWER_STATE 0x2b
#define SDVO_CMD_SET_ENCODER_POWER_STATE 0x2c
# define SDVO_ENCODER_STATE_ON (1 << 0)
# define SDVO_ENCODER_STATE_STANDBY (1 << 1)
# define SDVO_ENCODER_STATE_SUSPEND (1 << 2)
# define SDVO_ENCODER_STATE_OFF (1 << 3)
#define SDVO_CMD_SET_TV_RESOLUTION_SUPPORT 0x93
#define SDVO_CMD_SET_CONTROL_BUS_SWITCH 0x7a

View File

@ -944,6 +944,8 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
return BadValue;
pPriv->brightness = value;
overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff);
if (*pI830->overlayOn)
OVERLAY_UPDATE;
OVERLAY_DEBUG("BRIGHTNESS\n");
OVERLAY_UPDATE;
} else if (attribute == xvContrast) {
@ -952,7 +954,8 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
pPriv->contrast = value;
overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff);
OVERLAY_DEBUG("CONTRAST\n");
OVERLAY_UPDATE;
if (*pI830->overlayOn)
OVERLAY_UPDATE;
} else if (attribute == xvSaturation) {
if ((value < 0) || (value > 1023))
return BadValue;
@ -973,7 +976,8 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
else
overlay->OCONFIG |= OVERLAY_PIPE_B;
OVERLAY_DEBUG("PIPE CHANGE\n");
OVERLAY_UPDATE;
if (*pI830->overlayOn)
OVERLAY_UPDATE;
} else if (attribute == xvGamma0 && (IS_I9XX(pI830))) {
pPriv->gamma0 = value;
} else if (attribute == xvGamma1 && (IS_I9XX(pI830))) {
@ -1000,7 +1004,8 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
break;
}
OVERLAY_DEBUG("COLORKEY\n");
OVERLAY_UPDATE;
if (*pI830->overlayOn)
OVERLAY_UPDATE;
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
} else if(attribute == xvDoubleBuffer) {
if ((value < 0) || (value > 1))
@ -1018,13 +1023,8 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
attribute == xvGamma3 ||
attribute == xvGamma4 ||
attribute == xvGamma5) && (IS_I9XX(pI830))) {
CARD32 r = overlay->OCMD & OVERLAY_ENABLE;
OVERLAY_DEBUG("GAMMA\n");
overlay->OCMD &= ~OVERLAY_ENABLE;
OVERLAY_UPDATE;
I830UpdateGamma(pScrn);
overlay->OCMD |= r;
OVERLAY_UPDATE;
}
return Success;

View File

@ -48,6 +48,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "config.h"
#endif
#include <assert.h>
#include "xf86.h"
#include "xaarop.h"
#include "i830.h"
@ -284,6 +285,11 @@ CheckTiling(ScrnInfoPtr pScrn)
pI830->back_tiled == FENCE_XMAJOR) {
tiled = 1;
}
if (pI830->third_buffer != NULL &&
pI830->bufferOffset == pI830->third_buffer->offset &&
pI830->third_tiled == FENCE_XMAJOR) {
tiled = 1;
}
/* not really supported as it's always YMajor tiled */
if (pI830->depth_buffer != NULL &&
pI830->bufferOffset == pI830->depth_buffer->offset &&

View File

@ -30,6 +30,7 @@
#include "config.h"
#endif
#include <assert.h>
#include "xf86.h"
#include "i830.h"
#include "i915_reg.h"

View File

@ -3,7 +3,7 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
AM_CFLAGS = @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
ivch_la_LTLIBRARIES = ivch.la
ivch_la_LDFLAGS = -module -avoid-version

View File

@ -52,15 +52,15 @@ int main(int argc, char **argv)
if (dev == NULL)
errx(1, "Couldn't find graphics card");
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
err = pci_device_probe(dev);
if (err != 0) {
fprintf(stderr, "Couldn't probe graphics card: %s\n", strerror(err));
exit(1);
}
if (dev->vendor_id != 0x8086)
errx(1, "Graphics card is non-intel");
i830.PciInfo = &i830.pci_info_rec;
i830.PciInfo->chipType = dev->device_id;

View File

@ -25,7 +25,7 @@
*
*/
#include <sys/types.h>
#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

View File

@ -3,7 +3,7 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
AM_CFLAGS = @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../modes
sil164_la_LTLIBRARIES = sil164.la
sil164_la_LDFLAGS = -module -avoid-version

View File

@ -5,4 +5,5 @@ libI810XvMC_la_SOURCES = I810XvMC.c \
libI810XvMC_la_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0
libI810XvMC_la_LDFLAGS = -version-number 1:0:0
endif
libI810XvMC_la_LIBADD = @DRI_LIBS@
endif