Merge branch 'modesetting' into crestline

Conflicts:

	src/i830_display.c
	src/i830_tv.c
	src/i830_xf86Crtc.c
This commit is contained in:
Wang Zhenyu 2007-02-02 11:26:57 +08:00
commit f7489bbec1
46 changed files with 3081 additions and 4861 deletions

View File

@ -129,51 +129,6 @@ other drivers.
Disable or enable XVideo support.
Default: XVideo is enabled for configurations where it is supported.
.TP
.BI "Option \*qMonitorLayout\*q \*q" anystr \*q
Allow different monitor configurations. e.g. \*qCRT,LFP\*q will
configure a CRT on Pipe A and an LFP on Pipe B. Regardless of the
primary heads' pipe it is always configured as \*q<PIPEA>,<PIPEB>\*q.
Additionally you can add different configurations such as
\*qCRT+DFP,LFP\*q which would put a digital flat panel and a CRT
on pipe A, and a local flat panel on pipe B.
For single pipe configurations you can just specify the monitors types
on Pipe A, such as \*qCRT+DFP\*q which will enable the CRT and DFP
on Pipe A.
Valid monitors are CRT, LFP, DFP, TV, CRT2, LFP2, DFP2, TV2 and NONE.
NOTE: Some configurations of monitor types may fail, this depends on
the Video BIOS and system configuration.
Default: Not configured, and will use the current head's pipe and monitor.
.TP
.BI "Option \*qClone\*q \*q" boolean \*q
Enable Clone mode on pipe B. This will setup the second head as a complete
mirror of the monitor attached to pipe A.
NOTE: Video overlay functions will not work on the second head in this mode.
If you require this, then use the MonitorLayout above and do (as an example)
\*qCRT+DFP,NONE\*q to configure both a CRT and DFP on Pipe A to achieve
local mirroring and disable the use of this option.
Default: Clone mode on pipe B is disabled.
.TP
.BI "Option \*qCloneRefresh\*q \*q" integer \*q
When the Clone option is specified we can drive the second monitor at a
different refresh rate than the primary.
Default: 60Hz.
.TP
.BI "Option \*qCheckLid\*q \*q" boolean \*q
On mobile platforms it's desirable to monitor the lid status and switch
the outputs accordingly when the lid is opened or closed. By default this
option is on, but may incur a very minor performance penalty as we need
to poll a register on the card to check for this activity. It can be
turned off using this option. This only works with the 830M, 852GM and 855GM
systems.
Default: enabled.
.TP
.BI "Option \*qFlipPrimary\*q \*q" boolean \*q
When using a dual pipe system, it may be preferable to switch the primary
screen to the alternate pipe to display on the other monitor connection.
NOTE: Using this option may cause text mode to be restored incorrectly,
and thus should be used with caution.
Default: disabled.
.TP
.BI "Option \*qRotate\*q \*q90\*q"
Rotate the desktop 90 degrees counterclockwise. Other valid options are
0, 90, 180 and 270 degrees. The RandR extension is used for rotation

View File

@ -74,7 +74,6 @@ i810_drv_la_SOURCES = \
i830_video.c \
i830_video.h \
i830_reg.h \
i830_rotate.c \
i830_randr.c \
i830_sdvo.c \
i830_sdvo.h \
@ -85,6 +84,7 @@ i810_drv_la_SOURCES = \
i830_xf86cvt.c \
i830_xf86Crtc.h \
i830_xf86Crtc.c \
i830_xf86Rotate.c \
i915_3d.c \
i915_3d.h \
i915_reg.h \
@ -92,9 +92,9 @@ i810_drv_la_SOURCES = \
i965_video.c \
i830_exa.c \
i830_xaa.c \
i830_exa_render.c \
i915_exa_render.c \
i965_exa_render.c
i830_render.c \
i915_render.c \
i965_render.c
if HAVE_GEN4ASM
sf_prog.h: packed_yuv_sf.g4a

View File

@ -183,9 +183,20 @@ static xf86OutputStatus
ch7xxx_detect(I2CDevPtr d)
{
struct ch7xxx_priv *dev_priv = d->DriverPrivate.ptr;
CARD8 cdet;
CARD8 cdet, gpio, orig_pm, pm;
ch7xxx_read(dev_priv, CH7xxx_PM, &orig_pm);
pm = orig_pm;
pm &= ~CH7xxx_PM_FPD;
pm |= CH7xxx_PM_DVIL | CH7xxx_PM_DVIP;
ch7xxx_write(dev_priv, CH7xxx_PM, pm);
ch7xxx_read(dev_priv, CH7xxx_CONNECTION_DETECT, &cdet);
ch7xxx_write(dev_priv, CH7xxx_PM, orig_pm);
if (cdet & CH7xxx_CDET_DVI)
return XF86OutputStatusConnected;
return XF86OutputStatusDisconnected;

View File

@ -44,6 +44,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define CH7xxx_CM_MCP (1<<2)
#define CH7xxx_INPUT_CLOCK 0x1D
#define CH7xxx_GPIO 0x1E
#define CH7xxx_GPIO_HPIR (1<<3)
#define CH7xxx_IDF 0x1F
#define CH7xxx_IDF_HSP (1<<3)

View File

@ -130,6 +130,17 @@ extern void I830DPRINTF_stub(const char *filename, int line,
outring &= ringmask; \
} while (0)
union intfloat {
float f;
unsigned int ui;
};
#define OUT_RING_F(x) do { \
union intfloat tmp; \
tmp.f = (float)(x); \
OUT_RING(tmp.ui); \
} while(0)
#define ADVANCE_LP_RING() do { \
if (ringused > needed) \
FatalError("%s: ADVANCE_LP_RING: exceeded allocation %d/%d\n ", \

View File

@ -344,11 +344,8 @@ const char *I810driSymbols[] = {
#endif /* I830_ONLY */
const char *I810shadowSymbols[] = {
"shadowInit",
"shadowSetup",
"shadowAdd",
"shadowRemove",
"shadowUpdateRotatePacked",
NULL
};

View File

@ -401,7 +401,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# define ERR_VERTEX_MAX (1 << 5) /* lpt/cst */
# define ERR_PGTBL_ERROR (1 << 4)
# define ERR_DISPLAY_OVERLAY_UNDERRUN (1 << 3)
# define ERR_MAIN_MEMORY_REFRESH (1 << 2)
# define ERR_MAIN_MEMORY_REFRESH (1 << 1)
# define ERR_INSTRUCTION_ERROR (1 << 0)

View File

@ -195,8 +195,19 @@ extern const char *i830_output_type_names[];
typedef struct _I830CrtcPrivateRec {
int pipe;
/* Lookup table values to be set when the CRTC is enabled */
CARD8 lut_r[256], lut_g[256], lut_b[256];
#ifdef I830_USE_XAA
FBLinearPtr rotate_mem_xaa;
#endif
#ifdef I830_USE_EXA
ExaOffscreenArea *rotate_mem_exa;
#endif
I830MemRange cursor_mem;
I830MemRange cursor_mem_argb;
} I830CrtcPrivateRec, *I830CrtcPrivatePtr;
#define I830CrtcPrivate(c) ((I830CrtcPrivatePtr) (c)->driver_private)
@ -221,6 +232,7 @@ enum last_3d {
LAST_3D_ROTATION
};
#if 0
typedef struct _I830PipeRec {
Bool enabled;
int x;
@ -233,6 +245,7 @@ typedef struct _I830PipeRec {
RRCrtcPtr randr_crtc;
#endif
} I830PipeRec, *I830PipePtr;
#endif
typedef struct _I830Rec {
unsigned char *MMIOBase;
@ -271,8 +284,6 @@ typedef struct _I830Rec {
I830MemRange EXAStateMem; /* specific exa state for G965 */
#endif
/* Regions allocated either from the above pools, or from agpgart. */
I830MemRange *CursorMem;
I830MemRange *CursorMemARGB;
I830RingBuffer *LpRing;
#if REMAP_RESERVED
@ -286,11 +297,7 @@ typedef struct _I830Rec {
#endif
unsigned long LinearAlloc;
XF86ModReqInfo shadowReq; /* to test for later libshadow */
I830MemRange RotatedMem;
I830MemRange RotatedMem2;
I830MemRange RotateStateMem; /* for G965 state buffer */
Rotation rotation;
int InitialRotation;
int displayWidth;
void (*PointerMoved)(int, int, int);
CreateScreenResourcesProcPtr CreateScreenResources;
@ -310,8 +317,6 @@ typedef struct _I830Rec {
unsigned int front_tiled;
unsigned int back_tiled;
unsigned int depth_tiled;
unsigned int rotated_tiled;
unsigned int rotated2_tiled;
#endif
Bool NeedRingBufferLow;
@ -354,6 +359,18 @@ typedef struct _I830Rec {
Bool cursorOn;
#ifdef I830_USE_XAA
XAAInfoRecPtr AccelInfoRec;
/* additional XAA accelerated Composite support */
CompositeProcPtr saved_composite;
Bool (*xaa_check_composite)(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst);
Bool (*xaa_prepare_composite)(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, PixmapPtr pSrcPixmap,
PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
void (*xaa_composite)(PixmapPtr pDst, int xSrc, int ySrc,
int xMask, int yMask, int xDst, int yDst,
int w, int h);
void (*xaa_done_composite)(PixmapPtr pDst);
#endif
xf86CursorInfoPtr CursorInfoRec;
CloseScreenProcPtr CloseScreen;
@ -381,7 +398,7 @@ typedef struct _I830Rec {
/* EXA render state */
float scale_units[2][2];
Bool is_transform[2];
/** Transform pointers for src/mask, or NULL if identity */
PictTransform *transform[2];
/* i915 EXA render state */
CARD32 mapstate[6];
@ -527,8 +544,6 @@ extern void I830InitVideo(ScreenPtr pScreen);
extern void i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on);
#endif
extern Bool I830AllocateRotatedBuffer(ScrnInfoPtr pScrn, const int flags);
extern Bool I830AllocateRotated2Buffer(ScrnInfoPtr pScrn, const int flags);
#ifdef XF86DRI
extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags);
extern Bool I830AllocateBackBuffer(ScrnInfoPtr pScrn, const int flags);
@ -549,6 +564,8 @@ extern Bool I830DRILock(ScrnInfoPtr pScrn);
extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on);
#endif
unsigned long intel_get_pixmap_offset(PixmapPtr pPix);
unsigned long intel_get_pixmap_pitch(PixmapPtr pPix);
extern Bool I830AccelInit(ScreenPtr pScreen);
extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
int ydir, int rop,
@ -581,7 +598,6 @@ extern void I830ReadAllRegisters(I830Ptr pI830, I830RegPtr i830Reg);
extern void I830ChangeFrontbuffer(ScrnInfoPtr pScrn,int buffer);
extern Bool I830IsPrimary(ScrnInfoPtr pScrn);
extern Bool I830Rotate(ScrnInfoPtr pScrn, DisplayModePtr mode);
extern Bool I830FixOffset(ScrnInfoPtr pScrn, I830MemRange *mem);
extern Bool I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg,
char *name);
@ -608,6 +624,14 @@ extern void i830WaitSync(ScrnInfoPtr pScrn);
/* i830_memory.c */
Bool I830BindAGPMemory(ScrnInfoPtr pScrn);
Bool I830UnbindAGPMemory(ScrnInfoPtr pScrn);
#ifdef I830_USE_XAA
FBLinearPtr
i830_xf86AllocateOffscreenLinear(ScreenPtr pScreen, int length,
int granularity,
MoveLinearCallbackProcPtr moveCB,
RemoveLinearCallbackProcPtr removeCB,
pointer privData);
#endif /* I830_USE_EXA */
/* i830_modes.c */
DisplayModePtr i830_ddc_get_modes(xf86OutputPtr output);
@ -615,32 +639,37 @@ DisplayModePtr i830_ddc_get_modes(xf86OutputPtr output);
/* i830_tv.c */
void i830_tv_init(ScrnInfoPtr pScrn);
#ifdef I830_USE_EXA
extern Bool I830EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
extern Bool I830EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
PixmapPtr, PixmapPtr, PixmapPtr);
extern Bool I915EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
extern Bool I915EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
PixmapPtr, PixmapPtr, PixmapPtr);
/* i830_render.c */
Bool i830_check_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst);
Bool i830_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, PixmapPtr pSrcPixmap,
PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
void i830_composite(PixmapPtr pDst, int srcX, int srcY,
int maskX, int maskY, int dstX, int dstY, int w, int h);
void i830_done_composite(PixmapPtr pDst);
/* i915_render.c */
Bool i915_check_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst);
Bool i915_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, PixmapPtr pSrcPixmap,
PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
/* i965_render.c */
Bool i965_check_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst);
Bool i965_prepare_composite(int op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, PixmapPtr pSrcPixmap,
PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap);
void i965_composite(PixmapPtr pDst, int srcX, int srcY,
int maskX, int maskY, int dstX, int dstY, int w, int h);
extern Bool I965EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
extern Bool I965EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
PixmapPtr, PixmapPtr, PixmapPtr);
extern void I965EXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX,
int maskY, int dstX, int dstY, int width, int height);
extern Bool
I830EXACheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture);
extern Bool
I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
void
i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
float *x_out, float *y_out);
extern const int I830PatternROP[16];
extern const int I830CopyROP[16];
#endif
/* Flags for memory allocation function */
#define FROM_ANYWHERE 0x00000000
#define FROM_POOL_ONLY 0x00000001

View File

@ -60,6 +60,36 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i810_reg.h"
#include "i830_debug.h"
unsigned long
intel_get_pixmap_offset(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
#ifdef I830_USE_EXA
if (pI830->useEXA)
return exaGetPixmapOffset(pPix);
#endif
return (unsigned long)pPix->devPrivate.ptr - (unsigned long)pI830->FbBase;
}
unsigned long
intel_get_pixmap_pitch(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
#ifdef I830_USE_EXA
if (pI830->useEXA)
return exaGetPixmapPitch(pPix);
#endif
#ifdef I830_USE_XAA
return (unsigned long)pPix->devKind;
#endif
}
int
I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
{

View File

@ -314,7 +314,7 @@ i830_crt_detect(xf86OutputPtr output)
if (intel_output->load_detect_temp)
{
xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
i830PipeSetMode (crtc, &mode, FALSE);
xf86CrtcSetMode (crtc, &mode, RR_Rotate_0, 0, 0);
}
connected = i830_crt_detect_load (crtc, output);

View File

@ -94,9 +94,9 @@ I830SetPipeCursorBase (xf86CrtcPtr crtc)
FatalError("Bad pipe number for cursor base setting\n");
if (pI830->CursorIsARGB)
cursor_mem = pI830->CursorMemARGB;
cursor_mem = &intel_crtc->cursor_mem_argb;
else
cursor_mem = pI830->CursorMem;
cursor_mem = &intel_crtc->cursor_mem;
if (pI830->CursorNeedsPhysical) {
OUTREG(cursor_base, cursor_mem->Physical);
@ -251,21 +251,13 @@ I830CursorInit(ScreenPtr pScreen)
infoPtr->HideCursor = I830HideCursor;
infoPtr->ShowCursor = I830ShowCursor;
infoPtr->UseHWCursor = I830UseHWCursor;
#ifdef ARGB_CURSOR
infoPtr->UseHWCursorARGB = I830UseHWCursorARGB;
infoPtr->LoadCursorARGB = I830LoadCursorARGB;
#endif
pI830->pCurs = NULL;
#ifdef ARGB_CURSOR
pI830->CursorIsARGB = FALSE;
if (pI830->CursorMemARGB->Start) {
/* Use ARGB if we were able to allocate the 16kb needed */
infoPtr->UseHWCursorARGB = I830UseHWCursorARGB;
infoPtr->LoadCursorARGB = I830LoadCursorARGB;
}
#endif
if (pI830->CursorNeedsPhysical && !pI830->CursorMem->Physical)
return FALSE;
I830HideCursor(pScrn);
@ -280,18 +272,16 @@ I830UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
pI830->pCurs = pCurs;
DPRINTF(PFX, "I830UseHWCursor\n");
if (pI830->CursorNeedsPhysical && !pI830->CursorMem->Physical)
return FALSE;
return TRUE;
}
static void
I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
I830CRTCLoadCursorImage(xf86CrtcPtr crtc, unsigned char *src)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830Ptr pI830 = I830PTR(pScrn);
CARD8 *pcurs = (CARD8 *) (pI830->FbBase + pI830->CursorMem->Start);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD8 *pcurs = (CARD8 *) (pI830->FbBase + intel_crtc->cursor_mem.Start);
int x, y;
DPRINTF(PFX, "I830LoadCursorImage\n");
@ -310,7 +300,7 @@ I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
(*(image + (x) / 8 + (y) * (128/8)) |=\
(int) (1 << (7-((x) % 8))))
switch (pI830->rotation) {
switch (crtc->rotation) {
case RR_Rotate_90:
for (y = 0; y < 64; y++) {
for (x = 0; x < 64; x++) {
@ -353,6 +343,17 @@ I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
}
}
static void
I830LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int pipe;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++) {
I830CRTCLoadCursorImage(xf86_config->crtc[pipe], src);
}
}
#ifdef ARGB_CURSOR
#include "cursorstr.h"
@ -360,15 +361,22 @@ 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;
if (pScrn->bitsPerPixel == 8)
return FALSE;
/* 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 (pI830->CursorNeedsPhysical && !pI830->CursorMemARGB->Physical)
if (!intel_crtc->cursor_mem_argb.Start)
return FALSE;
}
if (pScrn->bitsPerPixel == 8)
return FALSE;
if (pCurs->bits->height <= 64 && pCurs->bits->width <= 64)
@ -377,10 +385,11 @@ static Bool I830UseHWCursorARGB (ScreenPtr pScreen, CursorPtr pCurs)
return FALSE;
}
static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
static void I830CRTCLoadCursorARGB (xf86CrtcPtr crtc, CursorPtr pCurs)
{
I830Ptr pI830 = I830PTR(pScrn);
CARD32 *dst = (CARD32 *) (pI830->FbBase + pI830->CursorMemARGB->Start);
I830Ptr pI830 = I830PTR(crtc->scrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD32 *dst = (CARD32 *) (pI830->FbBase + intel_crtc->cursor_mem_argb.Start);
CARD32 *image = (CARD32 *)pCurs->bits->argb;
int x, y, w, h;
@ -394,7 +403,7 @@ static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
w = pCurs->bits->width;
h = pCurs->bits->height;
switch (pI830->rotation) {
switch (crtc->rotation) {
case RR_Rotate_90:
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
@ -447,58 +456,69 @@ static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
*dst++ = 0;
}
}
static void
I830LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
{
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);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
Bool inrange;
int oldx = x, oldy = y;
int hotspotx = 0, hotspoty = 0;
int root_x = x, root_y = y;
int pipe;
oldx += pScrn->frameX0; /* undo what xf86HWCurs did */
oldy += pScrn->frameY0;
switch (pI830->rotation) {
case RR_Rotate_0:
x = oldx;
y = oldy;
break;
case RR_Rotate_90:
x = oldy;
y = pScrn->pScreen->width - oldx;
hotspoty = I810_CURSOR_X;
break;
case RR_Rotate_180:
x = pScrn->pScreen->width - oldx;
y = pScrn->pScreen->height - oldy;
hotspotx = I810_CURSOR_X;
hotspoty = I810_CURSOR_Y;
break;
case RR_Rotate_270:
x = pScrn->pScreen->height - oldy;
y = oldx;
hotspotx = I810_CURSOR_Y;
break;
}
x -= hotspotx;
y -= hotspoty;
root_x = x + pScrn->frameX0; /* undo what xf86HWCurs did */
root_y = y + pScrn->frameY0;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
{
xf86CrtcPtr crtc = xf86_config->crtc[pipe];
DisplayModePtr mode = &crtc->curMode;
int thisx = x - crtc->x;
int thisy = y - crtc->y;
xf86CrtcPtr crtc = xf86_config->crtc[pipe];
DisplayModePtr mode = &crtc->mode;
int thisx = 0;
int thisy = 0;
int hotspotx = 0, hotspoty = 0;
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->VDisplay - (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
@ -541,19 +561,11 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
static void
I830ShowCursor(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
DPRINTF(PFX, "I830ShowCursor\n");
DPRINTF(PFX,
"Value of CursorMem->Physical is %x, "
" Value of CursorMem->Start is %x ",
pI830->CursorMem->Physical, pI830->CursorMem->Start);
DPRINTF(PFX,
"Value of CursorMemARGB->Physical is %x, "
" Value of CursorMemARGB->Start is %x ",
pI830->CursorMemARGB->Physical, pI830->CursorMemARGB->Start);
DPRINTF(PFX, "I830ShowCursor\n");
pI830->cursorOn = TRUE;
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)

View File

@ -462,7 +462,7 @@ void i830DumpRegs (ScrnInfoPtr pScrn)
break;
default:
p2 = 1;
xf86DrvMsg (pScrn->scrnIndex, X_ERROR, "p2 out of range\n");
xf86DrvMsg (pScrn->scrnIndex, X_WARNING, "p2 out of range\n");
break;
}
switch ((dpll >> 16) & 0xff) {
@ -484,33 +484,39 @@ void i830DumpRegs (ScrnInfoPtr pScrn)
p1 = 8; break;
default:
p1 = 1;
xf86DrvMsg (pScrn->scrnIndex, X_ERROR, "p1 out of range\n");
xf86DrvMsg (pScrn->scrnIndex, X_WARNING, "p1 out of range\n");
break;
}
switch ((dpll >> 13) & 0x3) {
case 0:
ref = 96000;
break;
case 3:
ref = 100000;
break;
default:
ref = 0;
xf86DrvMsg (pScrn->scrnIndex, X_ERROR, "ref out of range\n");
xf86DrvMsg (pScrn->scrnIndex, X_WARNING, "ref out of range\n");
break;
}
phase = (dpll >> 9) & 0xf;
switch (phase) {
case 6:
break;
default:
xf86DrvMsg (pScrn->scrnIndex, X_INFO,
"SDVO phase shift %d out of range -- probobly not "
"an issue.\n", phase);
break;
if (IS_I965G(pI830)) {
phase = (dpll >> 9) & 0xf;
switch (phase) {
case 6:
break;
default:
xf86DrvMsg (pScrn->scrnIndex, X_INFO,
"SDVO phase shift %d out of range -- probobly not "
"an issue.\n", phase);
break;
}
}
switch ((dpll >> 8) & 1) {
case 0:
break;
default:
xf86DrvMsg (pScrn->scrnIndex, X_ERROR, "fp select out of range\n");
xf86DrvMsg (pScrn->scrnIndex, X_WARNING,
"fp select out of range\n");
break;
}
n = ((fp >> 16) & 0x3f);
@ -645,13 +651,18 @@ i830_check_error_state(ScrnInfoPtr pScrn)
temp = INREG16(ESR);
if (temp != 0) {
Bool vertex_max = !IS_I965G(pI830) && (temp & ERR_VERTEX_MAX);
Bool pgtbl = temp & ERR_PGTBL_ERROR;
Bool underrun = !IS_I965G(pI830) &&
(temp & ERR_DISPLAY_OVERLAY_UNDERRUN);
Bool instruction = !IS_I965G(pI830) && (temp & ERR_INSTRUCTION_ERROR);
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"ESR is 0x%08lx%s%s%s%s\n", temp,
temp & ERR_VERTEX_MAX ? ", max vertices exceeded" : "",
temp & ERR_PGTBL_ERROR ? ", page table error" : "",
temp & ERR_DISPLAY_OVERLAY_UNDERRUN ?
", display/overlay underrun" : "",
temp & ERR_INSTRUCTION_ERROR ? ", instruction error" : "");
vertex_max ? ", max vertices exceeded" : "",
pgtbl ? ", page table error" : "",
underrun ? ", display/overlay underrun" : "",
instruction ? ", instruction error" : "");
errors++;
}
/* Check first for page table errors */
@ -665,7 +676,7 @@ i830_check_error_state(ScrnInfoPtr pScrn)
} else {
temp = INREG(PGTBL_ER);
if (temp != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"PGTBL_ER is 0x%08lx"
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", temp,
temp & PGTBL_ERR_HOST_GTT_PTE ? ", host gtt pte" : "",

View File

@ -397,17 +397,11 @@ I830_CloseFramebuffer(ScrnInfoPtr pScrn)
};
if (I830IsPrimary(pScrn)) {
if (pI830->rotation != RR_Rotate_0)
pScrn->fbOffset = pI830->RotatedMem.Start;
else
pScrn->fbOffset = pI830->FrontBuffer.Start;
pScrn->fbOffset = pI830->FrontBuffer.Start;
} else {
I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
if (pI830->rotation != RR_Rotate_0)
pScrn->fbOffset = pI8301->RotatedMem2.Start;
else
pScrn->fbOffset = pI8301->FrontBuffer2.Start;
pScrn->fbOffset = pI8301->FrontBuffer2.Start;
}
I830SelectBuffer(pScrn, I830_SELECT_FRONT);

View File

@ -342,9 +342,12 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE);
int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
if (I830IsPrimary(pScrn))
if (crtc->rotatedPixmap != NULL) {
Start = (char *)crtc->rotatedPixmap->devPrivate.ptr -
(char *)pI830->FbBase;
} else if (I830IsPrimary(pScrn)) {
Start = pI830->FrontBuffer.Start;
else {
} else {
I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
Start = pI8301->FrontBuffer2.Start;
}
@ -358,9 +361,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
OUTREG(dspbase, Start + ((y * pScrn->displayWidth + x) * pI830->cpp));
(void) INREG(dspbase);
}
crtc->x = x;
crtc->y = y;
}
/**
@ -464,23 +464,6 @@ i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode)
return pMode;
}
/**
* Return whether any outputs are connected to the specified pipe
*/
Bool
i830PipeInUse (xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
for (i = 0; i < xf86_config->num_output; i++)
if (xf86_config->output[i]->crtc == crtc)
return TRUE;
return FALSE;
}
/**
* Sets the power management mode of the pipe and plane.
*
@ -580,6 +563,27 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
}
}
static Bool
i830_crtc_lock (xf86CrtcPtr crtc)
{
/* Sync the engine before mode switch */
i830WaitSync(crtc->scrn);
#ifdef XF86DRI
return I830DRILock(crtc->scrn);
#else
return FALSE;
#endif
}
static void
i830_crtc_unlock (xf86CrtcPtr crtc)
{
#ifdef XF86DRI
I830DRIUnlock (crtc->scrn);
#endif
}
static Bool
i830_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
DisplayModePtr adjusted_mode)
@ -597,7 +601,8 @@ i830_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
*/
static void
i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
DisplayModePtr adjusted_mode)
DisplayModePtr adjusted_mode,
int x, int y)
{
ScrnInfoPtr pScrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@ -833,7 +838,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
OUTREG(dspcntr_reg, dspcntr);
/* Flush the plane changes */
i830PipeSetBase(crtc, crtc->x, crtc->y);
i830PipeSetBase(crtc, x, y);
i830WaitForVblank(pScrn);
}
@ -881,166 +886,111 @@ i830_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
}
/**
* Sets the given video mode on the given pipe.
* Creates a locked-in-framebuffer pixmap of the given width and height for
* this CRTC's rotated shadow framebuffer.
*
* Plane A is always output to pipe A, and plane B to pipe B. The plane
* will not be enabled if plane_enable is FALSE, which is used for
* load detection, when something else will be output to the pipe other than
* display data.
* The current implementation uses fixed buffers allocated at startup at the
* maximal size.
*/
Bool
i830PipeSetMode(xf86CrtcPtr crtc, DisplayModePtr pMode,
Bool plane_enable)
static PixmapPtr
i830_crtc_shadow_create(xf86CrtcPtr crtc, int width, int height)
{
ScrnInfoPtr pScrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
Bool ret = FALSE;
#ifdef XF86DRI
Bool didLock = FALSE;
#endif
DisplayModePtr adjusted_mode;
ScreenPtr pScreen = pScrn->pScreen;
I830Ptr pI830 = I830PTR(pScrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
unsigned long rotate_pitch;
PixmapPtr rotate_pixmap;
unsigned long rotate_offset;
int align = KB(4), size;
/* XXX: curMode */
rotate_pitch = pI830->displayWidth * pI830->cpp;
size = rotate_pitch * height;
adjusted_mode = xf86DuplicateMode(pMode);
crtc->enabled = i830PipeInUse (crtc);
if (!crtc->enabled)
{
/* XXX disable crtc? */
return TRUE;
}
#ifdef XF86DRI
didLock = I830DRILock(pScrn);
#endif
/* Pass our mode to the outputs and the CRTC to give them a chance to
* adjust it according to limitations or output properties, and also
* a chance to reject the mode entirely.
#ifdef I830_USE_EXA
/* We could get close to what we want here by just creating a pixmap like
* normal, but we have to lock it down in framebuffer, and there is no
* setter for offscreen area locking in EXA currently. So, we just
* allocate offscreen memory and fake up a pixmap header for it.
*/
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
if (pI830->useEXA) {
assert(intel_crtc->rotate_mem_exa == NULL);
if (output->crtc != crtc)
continue;
if (!output->funcs->mode_fixup(output, pMode, adjusted_mode)) {
ret = FALSE;
goto done;
intel_crtc->rotate_mem_exa = exaOffscreenAlloc(pScreen, size, align,
TRUE, NULL, NULL);
if (intel_crtc->rotate_mem_exa == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate shadow memory for rotated CRTC\n");
return NULL;
}
rotate_offset = intel_crtc->rotate_mem_exa->offset;
}
#endif /* I830_USE_EXA */
#ifdef I830_USE_XAA
if (!pI830->useEXA) {
/* The XFree86 linear allocator operates in units of screen pixels,
* sadly.
*/
size = (size + pI830->cpp - 1) / pI830->cpp;
align = (align + pI830->cpp - 1) / pI830->cpp;
if (!crtc->funcs->mode_fixup(crtc, pMode, adjusted_mode)) {
ret = FALSE;
goto done;
assert(intel_crtc->rotate_mem_xaa == NULL);
intel_crtc->rotate_mem_xaa =
i830_xf86AllocateOffscreenLinear(pScreen, size, align,
NULL, NULL, NULL);
if (intel_crtc->rotate_mem_xaa == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate shadow memory for rotated CRTC\n");
return NULL;
}
rotate_offset = pI830->FrontBuffer.Start +
intel_crtc->rotate_mem_xaa->offset * pI830->cpp;
}
#endif /* I830_USE_XAA */
/* Disable the outputs and CRTCs before setting the mode. */
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc != crtc)
continue;
/* Disable the output as the first thing we do. */
output->funcs->dpms(output, DPMSModeOff);
rotate_pixmap = GetScratchPixmapHeader(pScrn->pScreen,
width, height,
pScrn->depth,
pScrn->bitsPerPixel,
rotate_pitch,
pI830->FbBase + rotate_offset);
if (rotate_pixmap == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate shadow pixmap for rotated CRTC\n");
}
crtc->funcs->dpms(crtc, DPMSModeOff);
/* Set up the DPLL and any output state that needs to adjust or depend
* on the DPLL.
*/
crtc->funcs->mode_set(crtc, pMode, adjusted_mode);
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc == crtc)
output->funcs->mode_set(output, pMode, adjusted_mode);
}
if (plane_enable) {
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->dpms(crtc, DPMSModeOn);
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc == crtc)
output->funcs->dpms(output, DPMSModeOn);
}
}
#if 0
/*
* If the display isn't solid, it may be running out
* of memory bandwidth. This code will dump out the
* pipe status, if bit 31 is on, the fifo underran
*/
for (i = 0; i < 4; i++) {
i830WaitForVblank(pScrn);
OUTREG(pipestat_reg, INREG(pipestat_reg) | 0x80000000);
i830WaitForVblank(pScrn);
temp = INREG(pipestat_reg);
ErrorF ("pipe status 0x%x\n", temp);
}
#endif
crtc->curMode = *pMode;
/* XXX free adjustedmode */
ret = TRUE;
done:
#ifdef XF86DRI
if (didLock)
I830DRIUnlock(pScrn);
#endif
return ret;
return rotate_pixmap;
}
void
i830DisableUnusedFunctions(ScrnInfoPtr pScrn)
static void
i830_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int o, pipe;
ScrnInfoPtr pScrn = crtc->scrn;
I830Ptr pI830 = I830PTR(pScrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling unused functions\n");
for (o = 0; o < xf86_config->num_output; o++)
{
xf86OutputPtr output = xf86_config->output[o];
if (!output->crtc) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling output %s\n",
output->name);
(*output->funcs->dpms)(output, DPMSModeOff);
}
FreeScratchPixmapHeader(rotate_pixmap);
#ifdef I830_USE_EXA
if (pI830->useEXA && intel_crtc->rotate_mem_exa != NULL) {
exaOffscreenFree(pScrn->pScreen, intel_crtc->rotate_mem_exa);
intel_crtc->rotate_mem_exa = NULL;
}
for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
{
xf86CrtcPtr crtc = xf86_config->crtc[pipe];
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
int pipe = intel_crtc->pipe;
char *pipe_name = pipe == 0 ? "A" : "B";
if (!crtc->enabled) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling CRTC %s\n",
pipe_name);
crtc->funcs->dpms(crtc, DPMSModeOff);
memset(&crtc->curMode, 0, sizeof(crtc->curMode));
}
#endif /* I830_USE_EXA */
#ifdef I830_USE_XAA
if (!pI830->useEXA) {
xf86FreeOffscreenLinear(intel_crtc->rotate_mem_xaa);
intel_crtc->rotate_mem_xaa = NULL;
}
#endif /* I830_USE_XAA */
}
/**
* 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)
i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
Bool ok = TRUE;
@ -1050,9 +1000,9 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
if (crtc && crtc->enabled)
{
ok = i830PipeSetMode(crtc,
i830PipeFindClosestMode(crtc, pMode),
TRUE);
ok = xf86CrtcSetMode(crtc,
i830PipeFindClosestMode(crtc, pMode),
rotation, 0, 0);
if (!ok)
goto done;
crtc->desiredMode = *pMode;
@ -1062,7 +1012,7 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
(int)(pMode->HDisplay * pMode->VDisplay *
pMode->VRefresh / 1000000));
i830DisableUnusedFunctions(pScrn);
xf86DisableUnusedFunctions(pScrn);
i830DescribeOutputConfiguration(pScrn);
@ -1154,7 +1104,7 @@ i830GetLoadDetectPipe(xf86OutputPtr output)
return output->crtc;
for (i = 0; i < xf86_config->num_crtc; i++)
if (!i830PipeInUse(xf86_config->crtc[i]))
if (!xf86CrtcInUse (xf86_config->crtc[i]))
break;
if (i == xf86_config->num_crtc)
@ -1178,7 +1128,7 @@ i830ReleaseLoadDetectPipe(xf86OutputPtr output)
{
output->crtc = NULL;
intel_output->load_detect_temp = FALSE;
i830DisableUnusedFunctions(pScrn);
xf86DisableUnusedFunctions(pScrn);
}
}
@ -1186,9 +1136,13 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = {
.dpms = i830_crtc_dpms,
.save = NULL, /* XXX */
.restore = NULL, /* XXX */
.lock = i830_crtc_lock,
.unlock = i830_crtc_unlock,
.mode_fixup = i830_crtc_mode_fixup,
.mode_set = i830_crtc_mode_set,
.gamma_set = i830_crtc_gamma_set,
.shadow_create = i830_crtc_shadow_create,
.shadow_destroy = i830_crtc_shadow_destroy,
.destroy = NULL, /* XXX */
};

View File

@ -30,16 +30,12 @@
/* i830_display.c */
DisplayModePtr
i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode);
Bool i830PipeSetMode(xf86CrtcPtr crtc, DisplayModePtr pMode,
Bool plane_enable);
void i830DisableUnusedFunctions(ScrnInfoPtr pScrn);
Bool i830SetMode(ScrnInfoPtr pScrn, 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);
xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output);
void i830ReleaseLoadDetectPipe(xf86OutputPtr output);
Bool i830PipeInUse(xf86CrtcPtr crtc);
void i830_crtc_init(ScrnInfoPtr pScrn, int pipe);
void i830_crtc_load_lut(xf86CrtcPtr crtc);

View File

@ -1446,22 +1446,13 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
sarea->front_tiled = pI830->front_tiled;
sarea->back_tiled = pI830->back_tiled;
sarea->depth_tiled = pI830->depth_tiled;
sarea->rotated_tiled = pI830->rotated_tiled;
#if 0
sarea->rotated2_tiled = pI830->rotated2_tiled;
#endif
sarea->rotated_tiled = FALSE;
if (pI830->rotation == RR_Rotate_0) {
sarea->front_offset = pI830->FrontBuffer.Start;
/* Don't use FrontBuffer.Size here as it includes the pixmap cache area
* Instead, calculate the entire framebuffer.
*/
sarea->front_size = pI830->displayWidth * pScrn->virtualY * pI830->cpp;
} else {
/* Need to deal with rotated2 once we have dual head DRI */
sarea->front_offset = pI830->RotatedMem.Start;
sarea->front_size = pI830->RotatedMem.Size;
}
sarea->front_offset = pI830->FrontBuffer.Start;
/* Don't use FrontBuffer.Size here as it includes the pixmap cache area
* Instead, calculate the entire framebuffer.
*/
sarea->front_size = pI830->displayWidth * pScrn->virtualY * pI830->cpp;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"[drm] init sarea width,height = %d x %d (pitch %d)\n",
@ -1480,32 +1471,12 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
sarea->virtualX = pScrn->virtualX;
sarea->virtualY = pScrn->virtualY;
switch (pI830->rotation) {
case RR_Rotate_0:
sarea->rotation = 0;
break;
case RR_Rotate_90:
sarea->rotation = 90;
break;
case RR_Rotate_180:
sarea->rotation = 180;
break;
case RR_Rotate_270:
sarea->rotation = 270;
break;
default:
sarea->rotation = 0;
}
if (pI830->rotation == RR_Rotate_0) {
sarea->rotated_offset = -1;
sarea->rotated_size = 0;
}
else {
sarea->rotated_offset = pI830->FrontBuffer.Start;
sarea->rotated_size = pI830->FrontBuffer.Size;
}
/* This is the original pitch */
/* The rotation is now handled entirely by the X Server, so just leave the
* DRI unaware.
*/
sarea->rotation = 0;
sarea->rotated_offset = -1;
sarea->rotated_size = 0;
sarea->rotated_pitch = pI830->displayWidth;
success = I830DRIMapScreenRegions(pScrn, sarea);

View File

@ -272,13 +272,7 @@ typedef enum {
OPTION_XVIDEO,
OPTION_VIDEO_KEY,
OPTION_COLOR_KEY,
OPTION_VBE_RESTORE,
OPTION_DISPLAY_INFO,
OPTION_DEVICE_PRESENCE,
OPTION_MONITOR_LAYOUT,
OPTION_CHECKDEVICES,
OPTION_FIXEDPIPE,
OPTION_ROTATE,
OPTION_LINEARALLOC,
OPTION_INTELTEXPOOL,
OPTION_INTELMMSIZE
@ -296,10 +290,7 @@ static OptionInfoRec I830Options[] = {
{OPTION_XVIDEO, "XVideo", OPTV_BOOLEAN, {0}, TRUE},
{OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_MONITOR_LAYOUT, "MonitorLayout", OPTV_ANYSTR,{0}, FALSE},
{OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE},
{OPTION_FIXEDPIPE, "FixedPipe", OPTV_ANYSTR, {0}, FALSE},
{OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE},
{OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE},
{OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE},
@ -766,12 +757,6 @@ PreInitCleanup(ScrnInfoPtr pScrn)
if (pI830->LpRing)
xfree(pI830->LpRing);
pI830->LpRing = NULL;
if (pI830->CursorMem)
xfree(pI830->CursorMem);
pI830->CursorMem = NULL;
if (pI830->CursorMemARGB)
xfree(pI830->CursorMemARGB);
pI830->CursorMemARGB = NULL;
if (pI830->OverlayMem)
xfree(pI830->OverlayMem);
pI830->OverlayMem = NULL;
@ -1379,17 +1364,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
RestoreHWState(pScrn);
pScrn->displayWidth = (pScrn->virtualX + 63) & ~63;
/* XXX This should go away, replaced by xf86Crtc.c support for it */
pI830->rotation = RR_Rotate_0;
if ((s = xf86GetOptValString(pI830->Options, OPTION_ROTATE))) {
pI830->InitialRotation = 0;
if(!xf86NameCmp(s, "CW") || !xf86NameCmp(s, "270"))
pI830->InitialRotation = 270;
if(!xf86NameCmp(s, "CCW") || !xf86NameCmp(s, "90"))
pI830->InitialRotation = 90;
if(!xf86NameCmp(s, "180"))
pI830->InitialRotation = 180;
}
/*
* Let's setup the mobile systems to check the lid status
@ -1531,12 +1508,10 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
/* Alloc our pointers for the primary head */
if (I830IsPrimary(pScrn)) {
pI830->LpRing = xalloc(sizeof(I830RingBuffer));
pI830->CursorMem = xalloc(sizeof(I830MemRange));
pI830->CursorMemARGB = xalloc(sizeof(I830MemRange));
pI830->OverlayMem = xalloc(sizeof(I830MemRange));
pI830->overlayOn = xalloc(sizeof(Bool));
pI830->used3D = xalloc(sizeof(int));
if (!pI830->LpRing || !pI830->CursorMem || !pI830->CursorMemARGB ||
if (!pI830->LpRing ||
!pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Could not allocate primary data structures.\n");
@ -1605,25 +1580,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
PreInitCleanup(pScrn);
return FALSE;
}
/*
* Fix up modes to make hblank start at hsync start.
* I don't know why the xf86 code mangles this...
*/
{
DisplayModePtr p;
for (p = pScrn->modes; p;) {
xf86DrvMsg (pScrn->scrnIndex,
X_INFO, "move blank start from %d to %d\n",
p->CrtcHBlankStart, p->CrtcHDisplay);
p->CrtcHBlankStart = p->CrtcHDisplay;
p = p->next;
if (p == pScrn->modes)
break;
}
}
pScrn->currentMode = pScrn->modes;
pI830->disableTiling = FALSE;
@ -2527,19 +2483,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->displayWidth = pI830->displayWidth;
if (I830IsPrimary(pScrn)) {
/* Rotated Buffer */
memset(&(pI830->RotatedMem), 0, sizeof(pI830->RotatedMem));
pI830->RotatedMem.Key = -1;
/* Rotated2 Buffer */
memset(&(pI830->RotatedMem2), 0, sizeof(pI830->RotatedMem2));
pI830->RotatedMem2.Key = -1;
if (IS_I965G(pI830)) {
memset(&(pI830->RotateStateMem), 0, sizeof(pI830->RotateStateMem));
pI830->RotateStateMem.Key = -1;
}
}
#ifdef HAS_MTRR_SUPPORT
{
int fd;
@ -2587,17 +2530,13 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (I830IsPrimary(pScrn)) {
if (!pI830->LpRing)
pI830->LpRing = xalloc(sizeof(I830RingBuffer));
if (!pI830->CursorMem)
pI830->CursorMem = xalloc(sizeof(I830MemRange));
if (!pI830->CursorMemARGB)
pI830->CursorMemARGB = xalloc(sizeof(I830MemRange));
if (!pI830->OverlayMem)
pI830->OverlayMem = xalloc(sizeof(I830MemRange));
if (!pI830->overlayOn)
pI830->overlayOn = xalloc(sizeof(Bool));
if (!pI830->used3D)
pI830->used3D = xalloc(sizeof(int));
if (!pI830->LpRing || !pI830->CursorMem || !pI830->CursorMemARGB ||
if (!pI830->LpRing ||
!pI830->OverlayMem || !pI830->overlayOn || !pI830->used3D) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Could not allocate primary data structures.\n");
@ -2612,8 +2551,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!I830IsPrimary(pScrn)) {
pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
pI830->LpRing = pI8301->LpRing;
pI830->CursorMem = pI8301->CursorMem;
pI830->CursorMemARGB = pI8301->CursorMemARGB;
pI830->OverlayMem = pI8301->OverlayMem;
pI830->overlayOn = pI8301->overlayOn;
pI830->used3D = pI8301->used3D;
@ -2662,15 +2599,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
if (!pI830->SWCursor) {
if (pI830->CursorMem->Size == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling HW cursor because the cursor memory "
"allocation failed.\n");
pI830->SWCursor = TRUE;
}
}
#ifdef I830_XV
if (pI830->XvEnabled) {
if (pI830->noAccel) {
@ -2906,7 +2834,23 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
shadowSetup(pScreen);
/* support all rotations */
xf86RandR12Init (pScreen);
xf86RandR12SetRotations (pScreen, RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270);
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;
@ -2937,29 +2881,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->closing = FALSE;
pI830->suspended = FALSE;
switch (pI830->InitialRotation) {
case 0:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 0 degrees\n");
pI830->rotation = RR_Rotate_0;
break;
case 90:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 90 degrees\n");
pI830->rotation = RR_Rotate_90;
break;
case 180:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 180 degrees\n");
pI830->rotation = RR_Rotate_180;
break;
case 270:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotating to 270 degrees\n");
pI830->rotation = RR_Rotate_270;
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bad rotation setting - defaulting to 0 degrees\n");
pI830->rotation = RR_Rotate_0;
break;
}
#ifdef XF86DRI_MM
if (pI830->directRenderingEnabled && (pI830->mmModeFlags & I830_KERNEL_MM)) {
unsigned long aperEnd = ROUND_DOWN_TO(pI830->FbMapSize, GTT_PAGE_SIZE)
@ -3021,6 +2942,8 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags)
/* Sync the engine before adjust frame */
i830WaitSync(pScrn);
i830PipeSetBase(crtc, output->initial_x + x, output->initial_y + y);
crtc->x = output->initial_x + x;
crtc->y = output->initial_y + y;
}
}
@ -3124,25 +3047,31 @@ I830EnterVT(int scrnIndex, int flags)
return FALSE;
if (i830_check_error_state(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Existing errors found in hardware state\n");
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Existing errors found in hardware state.\n");
}
ResetState(pScrn, FALSE);
SetHWOperatingState(pScrn);
i830DisableUnusedFunctions(pScrn);
xf86DisableUnusedFunctions(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->curMode, 0, sizeof(crtc->curMode));
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 (!i830PipeSetMode (crtc, &crtc->desiredMode, TRUE))
if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
crtc->desiredX, crtc->desiredY))
return FALSE;
}
@ -3210,7 +3139,7 @@ I830EnterVT(int scrnIndex, int flags)
pI830->currentMode = pScrn->currentMode;
/* Force invarient state when rotated to be emitted */
/* Force invarient 3D state to be emitted */
*pI830->used3D = 1<<31;
return TRUE;
@ -3223,45 +3152,11 @@ I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
Bool ret = TRUE;
PixmapPtr pspix = (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen);
DPRINTF(PFX, "I830SwitchMode: mode == %p\n", mode);
/* Sync the engine before mode switch */
i830WaitSync(pScrn);
/* Check if our currentmode is about to change. We do this so if we
* are rotating, we don't need to call the mode setup again.
*/
if (pI830->currentMode != mode) {
if (!i830SetMode(pScrn, mode))
ret = FALSE;
}
/* Kludge to detect Rotate or Vidmode switch. Not very elegant, but
* workable given the implementation currently. We only need to call
* the rotation function when we know that the framebuffer has been
* disabled by the EnableDisableFBAccess() function.
*
* The extra WindowTable check detects a rotation at startup.
*/
if ( (!WindowTable[pScrn->scrnIndex] || pspix->devPrivate.ptr == NULL) &&
!pI830->DGAactive && (pScrn->PointerMoved == I830PointerMoved)) {
if (!I830Rotate(pScrn, mode))
ret = FALSE;
}
/* Either the original setmode or rotation failed, so restore the previous
* video mode here, as we'll have already re-instated the original rotation.
*/
if (!ret) {
if (!i830SetMode(pScrn, pI830->currentMode)) {
xf86DrvMsg(scrnIndex, X_INFO,
"Failed to restore previous mode (SwitchMode)\n");
}
} else {
if (!i830SetMode(pScrn, mode, pI830->rotation))
pI830->currentMode = mode;
}
return ret;
}
@ -3333,10 +3228,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
xfree(pI830->LpRing);
pI830->LpRing = NULL;
xfree(pI830->CursorMem);
pI830->CursorMem = NULL;
xfree(pI830->CursorMemARGB);
pI830->CursorMemARGB = NULL;
xfree(pI830->OverlayMem);
pI830->OverlayMem = NULL;
xfree(pI830->overlayOn);

View File

@ -97,18 +97,6 @@ const int I830PatternROP[16] =
ROP_1
};
/* move to common.h */
union intfloat {
float f;
unsigned int ui;
};
#define OUT_RING_F(x) do { \
union intfloat tmp; \
tmp.f = (float)(x); \
OUT_RING(tmp.ui); \
} while(0)
/**
* I830EXASync - wait for a command to finish
* @pScreen: current screen
@ -282,121 +270,31 @@ I830EXADoneCopy(PixmapPtr pDstPixmap)
#endif
}
static void
IntelEXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
int dstX, int dstY, int w, int h)
#define xFixedToFloat(val) \
((float)xFixedToInt(val) + ((float)xFixedFrac(val) / 65536.0))
/**
* Returns the floating-point coordinates transformed by the given transform.
*
* transform may be null.
*/
void
i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
float *x_out, float *y_out)
{
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
int srcXend, srcYend, maskXend, maskYend;
PictVector v;
int pMask = 1;
if (transform == NULL) {
*x_out = x;
*y_out = y;
} else {
PictVector v;
DPRINTF(PFX, "Composite: srcX %d, srcY %d\n\t maskX %d, maskY %d\n\t"
"dstX %d, dstY %d\n\twidth %d, height %d\n\t"
"src_scale_x %f, src_scale_y %f, "
"mask_scale_x %f, mask_scale_y %f\n",
srcX, srcY, maskX, maskY, dstX, dstY, w, h,
pI830->scale_units[0][0], pI830->scale_units[0][1],
pI830->scale_units[1][0], pI830->scale_units[1][1]);
if (pI830->scale_units[1][0] == -1 || pI830->scale_units[1][1] == -1) {
pMask = 0;
}
srcXend = srcX + w;
srcYend = srcY + h;
maskXend = maskX + w;
maskYend = maskY + h;
if (pI830->is_transform[0]) {
v.vector[0] = IntToxFixed(srcX);
v.vector[1] = IntToxFixed(srcY);
v.vector[0] = IntToxFixed(x);
v.vector[1] = IntToxFixed(y);
v.vector[2] = xFixed1;
PictureTransformPoint(pI830->transform[0], &v);
srcX = xFixedToInt(v.vector[0]);
srcY = xFixedToInt(v.vector[1]);
v.vector[0] = IntToxFixed(srcXend);
v.vector[1] = IntToxFixed(srcYend);
v.vector[2] = xFixed1;
PictureTransformPoint(pI830->transform[0], &v);
srcXend = xFixedToInt(v.vector[0]);
srcYend = xFixedToInt(v.vector[1]);
PictureTransformPoint(transform, &v);
*x_out = xFixedToFloat(v.vector[0]);
*y_out = xFixedToFloat(v.vector[1]);
}
if (pI830->is_transform[1]) {
v.vector[0] = IntToxFixed(maskX);
v.vector[1] = IntToxFixed(maskY);
v.vector[2] = xFixed1;
PictureTransformPoint(pI830->transform[1], &v);
maskX = xFixedToInt(v.vector[0]);
maskY = xFixedToInt(v.vector[1]);
v.vector[0] = IntToxFixed(maskXend);
v.vector[1] = IntToxFixed(maskYend);
v.vector[2] = xFixed1;
PictureTransformPoint(pI830->transform[1], &v);
maskXend = xFixedToInt(v.vector[0]);
maskYend = xFixedToInt(v.vector[1]);
}
DPRINTF(PFX, "After transform: srcX %d, srcY %d,srcXend %d, srcYend %d\n\t"
"maskX %d, maskY %d, maskXend %d, maskYend %d\n\t"
"dstX %d, dstY %d\n", srcX, srcY, srcXend, srcYend,
maskX, maskY, maskXend, maskYend, dstX, dstY);
{
int vertex_count;
if (pMask)
vertex_count = 3*6;
else
vertex_count = 3*4;
BEGIN_LP_RING(6+vertex_count);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(PRIM3D_INLINE | PRIM3D_RECTLIST | (vertex_count-1));
OUT_RING_F(dstX);
OUT_RING_F(dstY);
OUT_RING_F(srcX / pI830->scale_units[0][0]);
OUT_RING_F(srcY / pI830->scale_units[0][1]);
if (pMask) {
OUT_RING_F(maskX / pI830->scale_units[1][0]);
OUT_RING_F(maskY / pI830->scale_units[1][1]);
}
OUT_RING_F(dstX);
OUT_RING_F(dstY + h);
OUT_RING_F(srcX / pI830->scale_units[0][0]);
OUT_RING_F(srcYend / pI830->scale_units[0][1]);
if (pMask) {
OUT_RING_F(maskX / pI830->scale_units[1][0]);
OUT_RING_F(maskYend / pI830->scale_units[1][1]);
}
OUT_RING_F(dstX + w);
OUT_RING_F(dstY + h);
OUT_RING_F(srcXend / pI830->scale_units[0][0]);
OUT_RING_F(srcYend / pI830->scale_units[0][1]);
if (pMask) {
OUT_RING_F(maskXend / pI830->scale_units[1][0]);
OUT_RING_F(maskYend / pI830->scale_units[1][1]);
}
ADVANCE_LP_RING();
}
}
static void
IntelEXADoneComposite(PixmapPtr pDst)
{
#if ALWAYS_SYNC
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
I830Sync(pScrn);
#endif
}
/*
@ -418,7 +316,7 @@ I830EXAInit(ScreenPtr pScreen)
pI830->bufferOffset = 0;
pI830->EXADriverPtr->exa_major = 2;
pI830->EXADriverPtr->exa_minor = 0;
pI830->EXADriverPtr->exa_minor = 1;
pI830->EXADriverPtr->memoryBase = pI830->FbBase;
pI830->EXADriverPtr->offScreenBase = pI830->Offscreen.Start;
pI830->EXADriverPtr->memorySize = pI830->Offscreen.End;
@ -500,29 +398,36 @@ I830EXAInit(ScreenPtr pScreen)
pI830->EXADriverPtr->DoneCopy = I830EXADoneCopy;
/* Composite */
if (IS_I915G(pI830) || IS_I915GM(pI830) ||
IS_I945G(pI830) || IS_I945GM(pI830)) {
pI830->EXADriverPtr->CheckComposite = I915EXACheckComposite;
pI830->EXADriverPtr->PrepareComposite = I915EXAPrepareComposite;
pI830->EXADriverPtr->Composite = IntelEXAComposite;
pI830->EXADriverPtr->DoneComposite = IntelEXADoneComposite;
} else if (IS_I865G(pI830) || IS_I855(pI830) ||
IS_845G(pI830) || IS_I830(pI830)) {
pI830->EXADriverPtr->CheckComposite = I830EXACheckComposite;
pI830->EXADriverPtr->PrepareComposite = I830EXAPrepareComposite;
pI830->EXADriverPtr->Composite = IntelEXAComposite;
pI830->EXADriverPtr->DoneComposite = IntelEXADoneComposite;
} else if (IS_I965G(pI830)) {
pI830->EXADriverPtr->CheckComposite = I965EXACheckComposite;
pI830->EXADriverPtr->PrepareComposite = I965EXAPrepareComposite;
pI830->EXADriverPtr->Composite = I965EXAComposite;
pI830->EXADriverPtr->DoneComposite = IntelEXADoneComposite;
if (IS_I865G(pI830) || IS_I855(pI830) ||
IS_845G(pI830) || IS_I830(pI830))
{
pI830->EXADriverPtr->CheckComposite = i830_check_composite;
pI830->EXADriverPtr->PrepareComposite = i830_prepare_composite;
pI830->EXADriverPtr->Composite = i830_composite;
pI830->EXADriverPtr->DoneComposite = i830_done_composite;
} else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
IS_I945G(pI830) || IS_I945GM(pI830))
{
pI830->EXADriverPtr->CheckComposite = i915_check_composite;
pI830->EXADriverPtr->PrepareComposite = i915_prepare_composite;
pI830->EXADriverPtr->Composite = i830_composite;
pI830->EXADriverPtr->DoneComposite = i830_done_composite;
} else {
pI830->EXADriverPtr->CheckComposite = i965_check_composite;
pI830->EXADriverPtr->PrepareComposite = i965_prepare_composite;
pI830->EXADriverPtr->Composite = i965_composite;
pI830->EXADriverPtr->DoneComposite = i830_done_composite;
}
if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
xfree(pI830->EXADriverPtr);
pI830->noAccel = TRUE;
return FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"EXA initialization failed; trying older version\n");
pI830->EXADriverPtr->exa_minor = 0;
if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
xfree(pI830->EXADriverPtr);
pI830->noAccel = TRUE;
return FALSE;
}
}
I830SelectBuffer(pScrn, I830_SELECT_FRONT);

View File

@ -270,10 +270,10 @@ i830_lvds_get_modes(xf86OutputPtr output)
xf86MonPtr edid_mon;
DisplayModePtr modes;
edid_mon = i830_xf86OutputGetEDID (output, intel_output->pDDCBus);
i830_xf86OutputSetEDID (output, edid_mon);
edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
xf86OutputSetEDID (output, edid_mon);
modes = i830_xf86OutputGetEDIDModes (output);
modes = xf86OutputGetEDIDModes (output);
if (modes != NULL)
return modes;

View File

@ -471,156 +471,6 @@ IsTileable(ScrnInfoPtr pScrn, int pitch)
}
}
Bool
I830AllocateRotatedBuffer(ScrnInfoPtr pScrn, int flags)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned long size, alloced;
Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int verbosity = dryrun ? 4 : 1;
const char *s = dryrun ? "[dryrun] " : "";
int align;
Bool tileable;
int lines;
int height = (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) ? pScrn->virtualY : pScrn->virtualX;
/* Rotated Buffer */
memset(&(pI830->RotatedMem), 0, sizeof(I830MemRange));
pI830->RotatedMem.Key = -1;
tileable = !(flags & ALLOC_NO_TILING) &&
IsTileable(pScrn, pScrn->displayWidth * pI830->cpp);
if (tileable) {
/* Make the height a multiple of the tile height (16) */
lines = (height + 15) / 16 * 16;
} else {
lines = height;
}
size = ROUND_TO_PAGE(pScrn->displayWidth * lines * pI830->cpp);
/*
* Try to allocate on the best tile-friendly boundaries.
*/
alloced = 0;
if (tileable) {
align = GetBestTileAlignment(size);
for (align = GetBestTileAlignment(size); align >= (IS_I9XX(pI830) ? MB(1) : KB(512)); align >>= 1) {
alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem),
&(pI830->StolenPool), size, align,
flags | FROM_ANYWHERE | ALLOCATE_AT_TOP |
ALIGN_BOTH_ENDS);
if (alloced >= size)
break;
}
}
if (alloced < size) {
/* Give up on trying to tile */
tileable = FALSE;
size = ROUND_TO_PAGE(pScrn->displayWidth * height * pI830->cpp);
align = GTT_PAGE_SIZE;
alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem),
&(pI830->StolenPool), size, align,
flags | FROM_ANYWHERE | ALLOCATE_AT_TOP);
}
if (alloced < size) {
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate rotated buffer space.\n");
}
return FALSE;
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for the rotated buffer at 0x%lx.\n", s,
alloced / 1024, pI830->RotatedMem.Start);
#define BRW_LINEAR_EXTRA (32*1024)
if (IS_I965G(pI830)) {
memset(&(pI830->RotateStateMem), 0, sizeof(I830MemRange));
pI830->RotateStateMem.Key = -1;
size = ROUND_TO_PAGE(BRW_LINEAR_EXTRA);
align = GTT_PAGE_SIZE;
alloced = I830AllocVidMem(pScrn, &(pI830->RotateStateMem),
&(pI830->StolenPool), size, align,
flags | FROM_ANYWHERE | ALLOCATE_AT_TOP);
if (alloced < size) {
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"G965: Failed to allocate rotate state buffer space.\n");
}
return FALSE;
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for the G965 rotate state buffer at 0x%lx - 0x%lx.\n", s,
alloced / 1024, pI830->RotateStateMem.Start, pI830->RotateStateMem.End);
}
return TRUE;
}
Bool
I830AllocateRotated2Buffer(ScrnInfoPtr pScrn, int flags)
{
I830Ptr pI830 = I830PTR(pScrn);
unsigned long size, alloced;
Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int verbosity = dryrun ? 4 : 1;
const char *s = dryrun ? "[dryrun] " : "";
int align;
Bool tileable;
int lines;
I830EntPtr pI830Ent = pI830->entityPrivate;
I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2);
int height = (pI8302->rotation & (RR_Rotate_0 | RR_Rotate_180)) ? pI830Ent->pScrn_2->virtualY : pI830Ent->pScrn_2->virtualX;
/* Rotated Buffer */
memset(&(pI830->RotatedMem2), 0, sizeof(I830MemRange));
pI830->RotatedMem2.Key = -1;
tileable = !(flags & ALLOC_NO_TILING) &&
IsTileable(pScrn, pI830Ent->pScrn_2->displayWidth * pI8302->cpp);
if (tileable) {
/* Make the height a multiple of the tile height (16) */
lines = (height + 15) / 16 * 16;
} else {
lines = height;
}
size = ROUND_TO_PAGE(pI830Ent->pScrn_2->displayWidth * lines * pI8302->cpp);
/*
* Try to allocate on the best tile-friendly boundaries.
*/
alloced = 0;
if (tileable) {
align = GetBestTileAlignment(size);
for (align = GetBestTileAlignment(size); align >= (IS_I9XX(pI830) ? MB(1) : KB(512)); align >>= 1) {
alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem2),
&(pI830->StolenPool), size, align,
flags | FROM_ANYWHERE | ALLOCATE_AT_TOP |
ALIGN_BOTH_ENDS);
if (alloced >= size)
break;
}
}
if (alloced < size) {
/* Give up on trying to tile */
tileable = FALSE;
size = ROUND_TO_PAGE(pI830Ent->pScrn_2->displayWidth * height * pI8302->cpp);
align = GTT_PAGE_SIZE;
alloced = I830AllocVidMem(pScrn, &(pI830->RotatedMem2),
&(pI830->StolenPool), size, align,
flags | FROM_ANYWHERE | ALLOCATE_AT_TOP);
}
if (alloced < size) {
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate rotated2 buffer space.\n");
}
return FALSE;
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for the rotated2 buffer at 0x%lx.\n", s,
alloced / 1024, pI830->RotatedMem2.Start);
return TRUE;
}
static unsigned long
GetFreeSpace(ScrnInfoPtr pScrn)
{
@ -769,6 +619,91 @@ I830AllocateFramebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
return TRUE;
}
static Bool
I830AllocateCursorBuffers(xf86CrtcPtr crtc, const int flags)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
I830Ptr pI830 = I830PTR(pScrn);
Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int verbosity = dryrun ? 4 : 1;
const char *s = dryrun ? "[dryrun] " : "";
long size, alloced;
int cursFlags = 0;
/* Clear cursor info */
memset(&intel_crtc->cursor_mem, 0, sizeof(I830MemRange));
intel_crtc->cursor_mem.Key = -1;
memset(&intel_crtc->cursor_mem_argb, 0, sizeof(I830MemRange));
intel_crtc->cursor_mem_argb.Key = -1;
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.
*/
size = HWCURSOR_SIZE;
cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
if (pI830->CursorNeedsPhysical)
cursFlags |= NEED_PHYSICAL_ADDR;
alloced = I830AllocVidMem(pScrn, &intel_crtc->cursor_mem,
&pI830->StolenPool, size,
GTT_PAGE_SIZE, flags | cursFlags);
if (alloced < size ||
(pI830->CursorNeedsPhysical && !intel_crtc->cursor_mem.Physical))
{
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate HW cursor space.\n");
return FALSE;
}
} else {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for HW cursor at 0x%lx", s,
alloced / 1024, intel_crtc->cursor_mem.Start);
if (pI830->CursorNeedsPhysical) {
xf86ErrorFVerb(verbosity, " (0x%08lx)",
intel_crtc->cursor_mem.Physical);
}
xf86ErrorFVerb(verbosity, "\n");
}
/* Allocate the ARGB cursor space. Its success is optional -- we won't set
* SWCursor if it fails.
*/
size = HWCURSOR_SIZE_ARGB;
cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
if (pI830->CursorNeedsPhysical)
cursFlags |= NEED_PHYSICAL_ADDR;
alloced = I830AllocVidMem(pScrn, &intel_crtc->cursor_mem_argb,
&pI830->StolenPool, size,
GTT_PAGE_SIZE, flags | cursFlags);
if (alloced < size ||
(pI830->CursorNeedsPhysical && !intel_crtc->cursor_mem_argb.Physical)) {
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate HW (ARGB) cursor space.\n");
}
} else {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for HW (ARGB) cursor at 0x%lx", s,
alloced / 1024, intel_crtc->cursor_mem_argb.Start);
if (pI830->CursorNeedsPhysical) {
xf86ErrorFVerb(verbosity, " (0x%08lx)",
intel_crtc->cursor_mem_argb.Physical);
}
xf86ErrorFVerb(verbosity, "\n");
}
return FALSE;
}
/*
* Allocate memory for 2D operation. This includes the (front) framebuffer,
* ring buffer, scratch memory, HW cursor.
@ -777,12 +712,13 @@ Bool
I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
{
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
long size, alloced;
Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0);
int verbosity = dryrun ? 4 : 1;
const char *s = dryrun ? "[dryrun] " : "";
Bool tileable;
int align, alignflags;
int align, alignflags, i;
DPRINTF(PFX, "I830Allocate2DMemory: inital is %s\n",
BOOLTOSTRING(flags & ALLOC_INITIAL));
@ -814,7 +750,6 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
pI830->StolenPool.Free.Size);
if (flags & ALLOC_INITIAL) {
if (pI830->NeedRingBufferLow)
AllocateRingBuffer(pScrn, flags | FORCE_LOW);
@ -979,63 +914,18 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
}
#endif
/* Clear cursor info */
memset(pI830->CursorMem, 0, sizeof(I830MemRange));
pI830->CursorMem->Key = -1;
memset(pI830->CursorMemARGB, 0, sizeof(I830MemRange));
pI830->CursorMemARGB->Key = -1;
if (!pI830->SWCursor) {
int cursFlags = 0;
/*
* 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.
*/
size = HWCURSOR_SIZE;
cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
if (pI830->CursorNeedsPhysical)
cursFlags |= NEED_PHYSICAL_ADDR;
alloced = I830AllocVidMem(pScrn, pI830->CursorMem,
&(pI830->StolenPool), size,
GTT_PAGE_SIZE, flags | cursFlags);
if (alloced < size) {
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate HW cursor space.\n");
}
} else {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for HW cursor at 0x%lx", s,
alloced / 1024, pI830->CursorMem->Start);
if (pI830->CursorNeedsPhysical)
xf86ErrorFVerb(verbosity, " (0x%08lx)", pI830->CursorMem->Physical);
xf86ErrorFVerb(verbosity, "\n");
}
size = HWCURSOR_SIZE_ARGB;
cursFlags = FROM_ANYWHERE | ALLOCATE_AT_TOP;
if (pI830->CursorNeedsPhysical)
cursFlags |= NEED_PHYSICAL_ADDR;
alloced = I830AllocVidMem(pScrn, pI830->CursorMemARGB,
&(pI830->StolenPool), size,
GTT_PAGE_SIZE, flags | cursFlags);
if (alloced < size) {
if (!dryrun) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate HW (ARGB) cursor space.\n");
}
} else {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
"%sAllocated %ld kB for HW (ARGB) cursor at 0x%lx", s,
alloced / 1024, pI830->CursorMemARGB->Start);
if (pI830->CursorNeedsPhysical)
xf86ErrorFVerb(verbosity, " (0x%08lx)", pI830->CursorMemARGB->Physical);
xf86ErrorFVerb(verbosity, "\n");
}
if (!pI830->SWCursor && !dryrun) {
for (i = 0; i < xf86_config->num_crtc; i++) {
if (!I830AllocateCursorBuffers(xf86_config->crtc[i], flags) &&
pI830->SWCursor)
{
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling HW cursor because the cursor memory "
"allocation failed.\n");
pI830->SWCursor = TRUE;
break;
}
}
}
#ifdef I830_XV
@ -1505,6 +1395,8 @@ Bool
I830FixupOffsets(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
DPRINTF(PFX, "I830FixupOffsets\n");
@ -1512,8 +1404,14 @@ I830FixupOffsets(ScrnInfoPtr pScrn)
if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2)
I830FixOffset(pScrn, &(pI830->FrontBuffer2));
I830FixOffset(pScrn, &(pI830->FrontBuffer));
I830FixOffset(pScrn, pI830->CursorMem);
I830FixOffset(pScrn, pI830->CursorMemARGB);
for (i = 0; i < xf86_config->num_crtc; i++) {
I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
I830FixOffset(pScrn, &intel_crtc->cursor_mem);
I830FixOffset(pScrn, &intel_crtc->cursor_mem_argb);
}
I830FixOffset(pScrn, &(pI830->LpRing->mem));
I830FixOffset(pScrn, &(pI830->Scratch));
if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2)
@ -1792,8 +1690,6 @@ I830SetupMemoryTiling(ScrnInfoPtr pScrn)
pI830->front_tiled = FENCE_LINEAR;
pI830->back_tiled = FENCE_LINEAR;
pI830->depth_tiled = FENCE_LINEAR;
pI830->rotated_tiled = FENCE_LINEAR;
pI830->rotated2_tiled = FENCE_LINEAR;
if (pI830->allowPageFlip) {
if (pI830->allowPageFlip && pI830->FrontBuffer.Alignment >= KB(512)) {
@ -1840,35 +1736,7 @@ I830SetupMemoryTiling(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"MakeTiles failed for the depth buffer.\n");
}
}
/* XXX tiled rotate mem not ready on G965*/
if(!IS_I965G(pI830)) {
if (pI830->RotatedMem.Alignment >= KB(512)) {
if (MakeTiles(pScrn, &(pI830->RotatedMem), FENCE_XMAJOR)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Activating tiled memory for the rotated buffer.\n");
pI830->rotated_tiled = FENCE_XMAJOR;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"MakeTiles failed for the rotated buffer.\n");
}
}
}
#if 0
if (pI830->RotatedMem2.Alignment >= KB(512)) {
if (MakeTiles(pScrn, &(pI830->RotatedMem2), FENCE_XMAJOR)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Activating tiled memory for the rotated2 buffer.\n");
pI830->rotated2_tiled = FENCE_XMAJOR;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"MakeTiles failed for the rotated buffer.\n");
}
}
#endif
}
}}
#endif /* XF86DRI */
static Bool
@ -1896,6 +1764,9 @@ I830BindAGPMemory(ScrnInfoPtr pScrn)
return TRUE;
if (xf86AgpGARTSupported() && !pI830->GttBound) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
if (!xf86AcquireGART(pScrn->scrnIndex))
return FALSE;
@ -1911,10 +1782,15 @@ I830BindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
if (!BindMemRange(pScrn, &(pI830->FrontBuffer)))
return FALSE;
if (!BindMemRange(pScrn, pI830->CursorMem))
return FALSE;
if (!BindMemRange(pScrn, pI830->CursorMemARGB))
return FALSE;
for (i = 0; i < xf86_config->num_crtc; i++) {
I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
if (!BindMemRange(pScrn, &intel_crtc->cursor_mem))
return FALSE;
if (!BindMemRange(pScrn, &intel_crtc->cursor_mem_argb))
return FALSE;
}
if (!BindMemRange(pScrn, &(pI830->LpRing->mem)))
return FALSE;
if (!BindMemRange(pScrn, &(pI830->Scratch)))
@ -1931,13 +1807,6 @@ I830BindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
}
#endif
if (pI830->RotatedMem.Start)
if (!BindMemRange(pScrn, &(pI830->RotatedMem)))
return FALSE;
if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2 &&
pI830->RotatedMem2.Start)
if (!BindMemRange(pScrn, &(pI830->RotatedMem2)))
return FALSE;
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
if (!BindMemRange(pScrn, &(pI830->ContextMem)))
@ -1991,6 +1860,8 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn)
return TRUE;
if (xf86AgpGARTSupported() && pI830->GttBound) {
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
#if REMAP_RESERVED
/* "unbind" the pre-allocated region. */
@ -2004,10 +1875,16 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
if (!UnbindMemRange(pScrn, &(pI830->FrontBuffer)))
return FALSE;
if (!UnbindMemRange(pScrn, pI830->CursorMem))
return FALSE;
if (!UnbindMemRange(pScrn, pI830->CursorMemARGB))
return FALSE;
for (i = 0; i < xf86_config->num_crtc; i++) {
I830CrtcPrivatePtr intel_crtc = xf86_config->crtc[i]->driver_private;
if (!UnbindMemRange(pScrn, &intel_crtc->cursor_mem))
return FALSE;
if (!UnbindMemRange(pScrn, &intel_crtc->cursor_mem_argb))
return FALSE;
}
if (!UnbindMemRange(pScrn, &(pI830->LpRing->mem)))
return FALSE;
if (!UnbindMemRange(pScrn, &(pI830->Scratch)))
@ -2024,13 +1901,6 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
}
#endif
if (pI830->RotatedMem.Start)
if (!UnbindMemRange(pScrn, &(pI830->RotatedMem)))
return FALSE;
if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2 &&
pI830->RotatedMem2.Start)
if (!UnbindMemRange(pScrn, &(pI830->RotatedMem2)))
return FALSE;
#ifdef XF86DRI
if (pI830->directRenderingEnabled) {
if (!UnbindMemRange(pScrn, &(pI830->ContextMem)))
@ -2079,3 +1949,41 @@ I830CheckAvailableMemory(ScrnInfoPtr pScrn)
return maxPages * 4;
}
#ifdef I830_USE_XAA
/**
* Allocates memory from the XF86 linear allocator, but also purges
* memory if possible to cause the allocation to succeed.
*/
FBLinearPtr
i830_xf86AllocateOffscreenLinear(ScreenPtr pScreen, int length,
int granularity,
MoveLinearCallbackProcPtr moveCB,
RemoveLinearCallbackProcPtr removeCB,
pointer privData)
{
FBLinearPtr linear;
int max_size;
linear = xf86AllocateOffscreenLinear(pScreen, length, granularity, moveCB,
removeCB, privData);
if (linear != NULL)
return linear;
/* The above allocation didn't succeed, so purge unlocked stuff and try
* again.
*/
xf86QueryLargestOffscreenLinear(pScreen, &max_size, granularity,
PRIORITY_EXTREME);
if (max_size < length)
return NULL;
xf86PurgeUnlockedOffscreenAreas(pScreen);
linear = xf86AllocateOffscreenLinear(pScreen, length, granularity, moveCB,
removeCB, privData);
return linear;
}
#endif

View File

@ -62,9 +62,9 @@ i830_ddc_get_modes (xf86OutputPtr output)
xf86MonPtr edid_mon;
DisplayModePtr modes;
edid_mon = i830_xf86OutputGetEDID (output, intel_output->pDDCBus);
i830_xf86OutputSetEDID (output, edid_mon);
edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
xf86OutputSetEDID (output, edid_mon);
modes = i830_xf86OutputGetEDIDModes (output);
modes = xf86OutputGetEDIDModes (output);
return modes;
}

View File

@ -393,8 +393,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
for (c = 0; c < config->num_crtc; c++)
{
xf86CrtcPtr crtc = config->crtc[c];
int crtc_width = crtc->x + crtc->curMode.HDisplay;
int crtc_height = crtc->y + crtc->curMode.VDisplay;
int crtc_width = crtc->x + crtc->mode.HDisplay;
int crtc_height = crtc->y + crtc->mode.VDisplay;
if (crtc->enabled && crtc_width > width)
width = crtc_width;
@ -494,8 +494,19 @@ void
xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
randrp->supported_rotations = rotations;
#if RANDR_12_INTERFACE
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
RRCrtcSetRotations (crtc->randr_crtc, rotations);
}
#endif
}
void
@ -533,7 +544,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
xf86CrtcPtr crtc = randr_crtc->devPrivate;
xf86OutputPtr output;
int i, j;
DisplayModePtr curMode = &crtc->curMode;
DisplayModePtr mode = &crtc->mode;
Bool ret;
randr_outputs = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
@ -541,7 +552,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
return FALSE;
x = crtc->x;
y = crtc->y;
rotation = RR_Rotate_0;
rotation = crtc->rotation;
numOutputs = 0;
randr_mode = NULL;
for (i = 0; i < config->num_output; i++)
@ -558,7 +569,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
for (j = 0; j < randr_output->numModes; j++)
{
DisplayModePtr outMode = randr_output->modes[j]->devPrivate;
if (xf86ModesEqual(curMode, outMode))
if (xf86ModesEqual(mode, outMode))
{
randr_mode = randr_output->modes[j];
break;
@ -587,7 +598,6 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
xf86CrtcPtr crtc = randr_crtc->devPrivate;
DisplayModePtr mode = randr_mode ? randr_mode->devPrivate : NULL;
Bool changed = FALSE;
Bool pos_changed;
int o, ro;
xf86CrtcPtr *save_crtcs;
Bool save_enabled = crtc->enabled;
@ -595,12 +605,11 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
save_crtcs = ALLOCATE_LOCAL(config->num_crtc * sizeof (xf86CrtcPtr));
if ((mode != NULL) != crtc->enabled)
changed = TRUE;
else if (mode && !xf86ModesEqual (&crtc->curMode, mode))
else if (mode && !xf86ModesEqual (&crtc->mode, mode))
changed = TRUE;
pos_changed = changed;
if (x != crtc->x || y != crtc->y)
pos_changed = TRUE;
changed = TRUE;
for (o = 0; o < config->num_output; o++)
{
xf86OutputPtr output = config->output[o];
@ -629,12 +638,9 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
{
crtc->enabled = mode != NULL;
/* Sync the engine before adjust mode */
i830WaitSync(pScrn);
if (mode)
{
if (!i830PipeSetMode (crtc, mode, TRUE))
if (!xf86CrtcSetMode (crtc, mode, rotation, x, y))
{
crtc->enabled = save_enabled;
for (o = 0; o < config->num_output; o++)
@ -645,14 +651,16 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
DEALLOCATE_LOCAL(save_crtcs);
return FALSE;
}
/*
* Save the last successful setting for EnterVT
*/
crtc->desiredMode = *mode;
crtc->desiredRotation = rotation;
crtc->desiredX = x;
crtc->desiredY = y;
}
i830DisableUnusedFunctions (pScrn);
i830DumpRegs(pScrn);
xf86DisableUnusedFunctions (pScrn);
}
if (pos_changed && mode)
i830PipeSetBase(crtc, x, y);
DEALLOCATE_LOCAL(save_crtcs);
return xf86RandR12CrtcNotify (randr_crtc);
}
@ -830,6 +838,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
return TRUE;
}
/*
* Query the hardware for the current state, then mirror
* that to RandR

View File

@ -48,7 +48,7 @@ do { \
#define I830FALLBACK(s, arg...) \
do { \
return FALSE; \
} while(0)
} while(0)
#endif
struct blendinfo {
@ -112,7 +112,7 @@ struct formatinfo {
#define TB0A_ARG1_SEL_TEXEL2 (8 << 6)
#define TB0A_ARG1_SEL_TEXEL3 (9 << 6)
static struct blendinfo I830BlendOp[] = {
static struct blendinfo i830_blend_op[] = {
/* Clear */
{0, 0, BLENDFACTOR_ZERO, BLENDFACTOR_ZERO},
/* Src */
@ -141,21 +141,20 @@ static struct blendinfo I830BlendOp[] = {
{0, 0, BLENDFACTOR_ONE, BLENDFACTOR_ONE},
};
static struct formatinfo I830TexFormats[] = {
{PICT_a8r8g8b8, MT_32BIT_ARGB8888 },
{PICT_x8r8g8b8, MT_32BIT_ARGB8888 },
{PICT_a8b8g8r8, MT_32BIT_ABGR8888 },
{PICT_x8b8g8r8, MT_32BIT_ABGR8888 },
{PICT_r5g6b5, MT_16BIT_RGB565 },
{PICT_a1r5g5b5, MT_16BIT_ARGB1555 },
{PICT_x1r5g5b5, MT_16BIT_ARGB1555 },
{PICT_a8, MT_8BIT_I8 },
static struct formatinfo i830_tex_formats[] = {
{PICT_a8r8g8b8, MT_32BIT_ARGB8888 },
{PICT_x8r8g8b8, MT_32BIT_ARGB8888 },
{PICT_a8b8g8r8, MT_32BIT_ABGR8888 },
{PICT_x8b8g8r8, MT_32BIT_ABGR8888 },
{PICT_r5g6b5, MT_16BIT_RGB565 },
{PICT_a1r5g5b5, MT_16BIT_ARGB1555 },
{PICT_x1r5g5b5, MT_16BIT_ARGB1555 },
{PICT_a8, MT_8BIT_I8 },
};
static Bool I830GetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
static Bool i830_get_dest_format(PicturePtr pDstPicture, CARD32 *dst_format)
{
/* XXX: color buffer format for i830 */
/* XXX: color buffer format for i830 */
switch (pDstPicture->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
@ -177,35 +176,35 @@ static Bool I830GetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
break;
default:
I830FALLBACK("Unsupported dest format 0x%x\n",
(int)pDstPicture->format);
(int)pDstPicture->format);
}
return TRUE;
}
static CARD32 I830GetBlendCntl(int op, PicturePtr pMask, CARD32 dst_format)
static CARD32 i830_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format)
{
CARD32 sblend, dblend;
sblend = I830BlendOp[op].src_blend;
dblend = I830BlendOp[op].dst_blend;
sblend = i830_blend_op[op].src_blend;
dblend = i830_blend_op[op].dst_blend;
/* If there's no dst alpha channel, adjust the blend op so that we'll treat
* it as always 1.
*/
if (PICT_FORMAT_A(dst_format) == 0 && I830BlendOp[op].dst_alpha) {
if (PICT_FORMAT_A(dst_format) == 0 && i830_blend_op[op].dst_alpha) {
if (sblend == BLENDFACTOR_DST_ALPHA)
sblend = BLENDFACTOR_ONE;
else if (sblend == BLENDFACTOR_INV_DST_ALPHA)
sblend = BLENDFACTOR_ZERO;
}
/* If the source alpha is being used, then we should only be in a case where
* the source blend factor is 0, and the source blend value is the mask
* channels multiplied by the source picture's alpha.
/* If the source alpha is being used, then we should only be in a case
* where the source blend factor is 0, and the source blend value is the
* mask channels multiplied by the source picture's alpha.
*/
if (pMask && pMask->componentAlpha && I830BlendOp[op].src_alpha) {
if (pMask && pMask->componentAlpha && i830_blend_op[op].src_alpha) {
if (dblend == BLENDFACTOR_SRC_ALPHA) {
dblend = BLENDFACTOR_SRC_COLR;
} else if (dblend == BLENDFACTOR_INV_SRC_ALPHA) {
@ -213,27 +212,28 @@ static CARD32 I830GetBlendCntl(int op, PicturePtr pMask, CARD32 dst_format)
}
}
return (sblend << S8_SRC_BLEND_FACTOR_SHIFT) |
(dblend << S8_DST_BLEND_FACTOR_SHIFT);
return (sblend << S8_SRC_BLEND_FACTOR_SHIFT) |
(dblend << S8_DST_BLEND_FACTOR_SHIFT);
}
static Bool I830CheckCompositeTexture(PicturePtr pPict, int unit)
static Bool i830_check_composite_texture(PicturePtr pPict, int unit)
{
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i;
if ((w > 0x7ff) || (h > 0x7ff))
I830FALLBACK("Picture w/h too large (%dx%d)\n", w, h);
for (i = 0; i < sizeof(I830TexFormats) / sizeof(I830TexFormats[0]); i++)
for (i = 0; i < sizeof(i830_tex_formats) / sizeof(i830_tex_formats[0]);
i++)
{
if (I830TexFormats[i].fmt == pPict->format)
if (i830_tex_formats[i].fmt == pPict->format)
break;
}
if (i == sizeof(I830TexFormats) / sizeof(I830TexFormats[0]))
if (i == sizeof(i830_tex_formats) / sizeof(i830_tex_formats[0]))
I830FALLBACK("Unsupported picture format 0x%x\n",
(int)pPict->format);
(int)pPict->format);
/* FIXME: fix repeat support */
if (pPict->repeat)
@ -241,47 +241,51 @@ static Bool I830CheckCompositeTexture(PicturePtr pPict, int unit)
if (pPict->filter != PictFilterNearest &&
pPict->filter != PictFilterBilinear)
{
I830FALLBACK("Unsupported filter 0x%x\n", pPict->filter);
}
return TRUE;
}
static Bool
I830TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
{
ScrnInfoPtr pScrn = xf86Screens[pPict->pDrawable->pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
CARD32 format, offset, pitch, filter;
int w, h, i;
CARD32 wrap_mode = TEXCOORDMODE_CLAMP;
CARD32 wrap_mode = TEXCOORDMODE_CLAMP;
offset = exaGetPixmapOffset(pPix);
pitch = exaGetPixmapPitch(pPix);
offset = intel_get_pixmap_offset(pPix);
pitch = intel_get_pixmap_pitch(pPix);
w = pPict->pDrawable->width;
h = pPict->pDrawable->height;
pI830->scale_units[unit][0] = pPix->drawable.width;
pI830->scale_units[unit][1] = pPix->drawable.height;
for (i = 0; i < sizeof(I830TexFormats) / sizeof(I830TexFormats[0]); i++) {
if (I830TexFormats[i].fmt == pPict->format)
for (i = 0; i < sizeof(i830_tex_formats) / sizeof(i830_tex_formats[0]);
i++)
{
if (i830_tex_formats[i].fmt == pPict->format)
break;
}
if ( i == sizeof(I830TexFormats)/ sizeof(I830TexFormats[0]) )
if (i == sizeof(i830_tex_formats)/ sizeof(i830_tex_formats[0]))
I830FALLBACK("unknown texture format\n");
format = I830TexFormats[i].card_fmt;
format = i830_tex_formats[i].card_fmt;
if (pPict->repeat)
if (pPict->repeat)
wrap_mode = TEXCOORDMODE_WRAP; /* XXX: correct ? */
switch (pPict->filter) {
case PictFilterNearest:
filter = ((FILTER_NEAREST<<TM0S3_MAG_FILTER_SHIFT) |
(FILTER_NEAREST<<TM0S3_MIN_FILTER_SHIFT));
filter = ((FILTER_NEAREST<<TM0S3_MAG_FILTER_SHIFT) |
(FILTER_NEAREST<<TM0S3_MIN_FILTER_SHIFT));
break;
case PictFilterBilinear:
filter = ((FILTER_LINEAR<<TM0S3_MAG_FILTER_SHIFT) |
(FILTER_LINEAR<<TM0S3_MIN_FILTER_SHIFT));
filter = ((FILTER_LINEAR<<TM0S3_MAG_FILTER_SHIFT) |
(FILTER_LINEAR<<TM0S3_MIN_FILTER_SHIFT));
break;
default:
filter = 0;
@ -300,7 +304,7 @@ I830TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
OUT_RING(_3DSTATE_MAP_INFO_CMD);
OUT_RING(format | TEXMAP_INDEX(unit) | MAP_FORMAT_2D);
OUT_RING(((pPix->drawable.height - 1) << 16) |
(pPix->drawable.width - 1)); /* height, width */
(pPix->drawable.width - 1)); /* height, width */
OUT_RING(offset); /* map address */
OUT_RING(((pitch / 4) - 1) << 2); /* map pitch */
OUT_RING(0);
@ -310,16 +314,19 @@ I830TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
{
BEGIN_LP_RING(2);
/* coord sets */
OUT_RING(_3DSTATE_MAP_COORD_SET_CMD | TEXCOORD_SET(unit) |
ENABLE_TEXCOORD_PARAMS | TEXCOORDS_ARE_NORMAL |
TEXCOORDTYPE_CARTESIAN | ENABLE_ADDR_V_CNTL |
TEXCOORD_ADDR_V_MODE(wrap_mode) |
ENABLE_ADDR_U_CNTL | TEXCOORD_ADDR_U_MODE(wrap_mode));
OUT_RING(_3DSTATE_MAP_COORD_SET_CMD | TEXCOORD_SET(unit) |
ENABLE_TEXCOORD_PARAMS | TEXCOORDS_ARE_NORMAL |
TEXCOORDTYPE_CARTESIAN | ENABLE_ADDR_V_CNTL |
TEXCOORD_ADDR_V_MODE(wrap_mode) |
ENABLE_ADDR_U_CNTL | TEXCOORD_ADDR_U_MODE(wrap_mode));
OUT_RING(MI_NOOP);
/* XXX: filter seems hang engine...*/
#if 0
OUT_RING(I830_STATE3D_MAP_FILTER | FILTER_MAP_INDEX(unit) | ENABLE_KEYS| DISABLE_COLOR_KEY | DISABLE_CHROMA_KEY | DISABLE_KILL_PIXEL |ENABLE_MIP_MODE_FILTER | MIPFILTER_NONE | filter);
OUT_RING(I830_STATE3D_MAP_FILTER | FILTER_MAP_INDEX(unit) |
ENABLE_KEYS| DISABLE_COLOR_KEY | DISABLE_CHROMA_KEY |
DISABLE_KILL_PIXEL |ENABLE_MIP_MODE_FILTER |
MIPFILTER_NONE | filter);
OUT_RING(0);
#endif
@ -328,93 +335,86 @@ I830TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
ADVANCE_LP_RING();
}
/* XXX */
if (pPict->transform != 0) {
pI830->is_transform[unit] = TRUE;
pI830->transform[unit] = pPict->transform;
} else {
pI830->is_transform[unit] = FALSE;
}
pI830->transform[unit] = pPict->transform;
#ifdef I830DEBUG
ErrorF("try to sync to show any errors...");
I830Sync(pScrn);
#endif
return TRUE;
}
Bool
I830EXACheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
i830_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
CARD32 tmp1;
/* Check for unsupported compositing operations. */
if (op >= sizeof(I830BlendOp) / sizeof(I830BlendOp[0]))
if (op >= sizeof(i830_blend_op) / sizeof(i830_blend_op[0]))
I830FALLBACK("Unsupported Composite op 0x%x\n", op);
if (pMaskPicture != NULL && pMaskPicture->componentAlpha) {
/* Check if it's component alpha that relies on a source alpha and on
* the source value. We can only get one of those into the single
* source value that we get to blend with.
*/
if (I830BlendOp[op].src_alpha &&
(I830BlendOp[op].src_blend != BLENDFACTOR_ZERO))
if (i830_blend_op[op].src_alpha &&
(i830_blend_op[op].src_blend != BLENDFACTOR_ZERO))
I830FALLBACK("Component alpha not supported with source "
"alpha and source value blending.\n");
"alpha and source value blending.\n");
}
if (!I830CheckCompositeTexture(pSrcPicture, 0))
if (!i830_check_composite_texture(pSrcPicture, 0))
I830FALLBACK("Check Src picture texture\n");
if (pMaskPicture != NULL && !I830CheckCompositeTexture(pMaskPicture, 1))
if (pMaskPicture != NULL && !i830_check_composite_texture(pMaskPicture, 1))
I830FALLBACK("Check Mask picture texture\n");
if (!I830GetDestFormat(pDstPicture, &tmp1))
if (!i830_get_dest_format(pDstPicture, &tmp1))
I830FALLBACK("Get Color buffer format\n");
return TRUE;
}
Bool
I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
i830_prepare_composite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
/* XXX: setup texture map from pixmap, vertex format, blend cntl */
/* XXX: setup texture map from pixmap, vertex format, blend cntl */
ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
CARD32 dst_format, dst_offset, dst_pitch;
I830GetDestFormat(pDstPicture, &dst_format);
dst_offset = exaGetPixmapOffset(pDst);
dst_pitch = exaGetPixmapPitch(pDst);
i830_get_dest_format(pDstPicture, &dst_format);
dst_offset = intel_get_pixmap_offset(pDst);
dst_pitch = intel_get_pixmap_pitch(pDst);
pI830->last_3d = LAST_3D_RENDER;
if (!I830TextureSetup(pSrcPicture, pSrc, 0))
if (!i830_texture_setup(pSrcPicture, pSrc, 0))
I830FALLBACK("fail to setup src texture\n");
if (pMask != NULL) {
if (!I830TextureSetup(pMaskPicture, pMask, 1))
I830FALLBACK("fail to setup mask texture\n");
if (!i830_texture_setup(pMaskPicture, pMask, 1))
I830FALLBACK("fail to setup mask texture\n");
} else {
pI830->is_transform[1] = FALSE;
pI830->transform[1] = NULL;
pI830->scale_units[1][0] = -1;
pI830->scale_units[1][1] = -1;
}
{
CARD32 cblend, ablend, blendctl, vf2;
BEGIN_LP_RING(22+6);
/*color buffer*/
/* color buffer */
OUT_RING(_3DSTATE_BUF_INFO_CMD);
OUT_RING(BUF_3D_ID_COLOR_BACK| BUF_3D_PITCH(dst_pitch));
OUT_RING(BUF_3D_ADDR(dst_offset));
OUT_RING(MI_NOOP);
OUT_RING(_3DSTATE_DST_BUF_VARS_CMD);
OUT_RING(dst_format);
@ -429,10 +429,10 @@ I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
OUT_RING(_3DSTATE_DFLT_SPEC_CMD);
OUT_RING(0);
OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | 0);
OUT_RING((1 << S3_POINT_WIDTH_SHIFT) | (2 << S3_LINE_WIDTH_SHIFT) |
S3_CULLMODE_NONE | S3_VERTEXHAS_XY);
OUT_RING((1 << S3_POINT_WIDTH_SHIFT) | (2 << S3_LINE_WIDTH_SHIFT) |
S3_CULLMODE_NONE | S3_VERTEXHAS_XY);
OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) | 0);
if (pMask)
vf2 = 2 << 12; /* 2 texture coord sets */
@ -443,7 +443,7 @@ I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
vf2 |= (TEXCOORDFMT_2D << 18);
else
vf2 |= (TEXCOORDFMT_1D << 18);
vf2 |= (TEXCOORDFMT_1D << 20);
vf2 |= (TEXCOORDFMT_1D << 22);
vf2 |= (TEXCOORDFMT_1D << 24);
@ -458,10 +458,10 @@ I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
/* IN operator: Multiply src by mask components or mask alpha.*/
/* TEXBLENDOP_MODULE: arg1*arg2 */
cblend = TB0C_LAST_STAGE | TB0C_RESULT_SCALE_1X | TB0C_OP_MODULE |
TB0C_OUTPUT_WRITE_CURRENT;
ablend = TB0A_RESULT_SCALE_1X | TB0A_OP_MODULE |
TB0C_OUTPUT_WRITE_CURRENT;
ablend = TB0A_RESULT_SCALE_1X | TB0A_OP_MODULE |
TB0A_OUTPUT_WRITE_CURRENT;
cblend |= TB0C_ARG1_SEL_TEXEL0;
ablend |= TB0A_ARG1_SEL_TEXEL0;
if (pMask) {
@ -471,11 +471,12 @@ I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
cblend |= (TB0C_ARG2_SEL_TEXEL1 | TB0C_ARG2_REPLICATE_ALPHA);
ablend |= TB0A_ARG2_SEL_TEXEL1;
} else {
cblend |= TB0C_ARG2_SEL_ONE;
ablend |= TB0A_ARG2_SEL_ONE;
cblend |= TB0C_ARG2_SEL_ONE;
ablend |= TB0A_ARG2_SEL_ONE;
}
OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_2 | LOAD_TEXTURE_BLEND_STAGE(0)|1);
OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
LOAD_TEXTURE_BLEND_STAGE(0)|1);
OUT_RING(cblend);
OUT_RING(ablend);
OUT_RING(0);
@ -483,18 +484,120 @@ I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE);
OUT_RING(MI_NOOP); /* pad to quadword */
blendctl = I830GetBlendCntl(op, pMaskPicture, pDstPicture->format);
blendctl = i830_get_blend_cntl(op, pMaskPicture, pDstPicture->format);
OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(8) | 0);
OUT_RING(S8_ENABLE_COLOR_BLEND | S8_BLENDFUNC_ADD |(blendctl<<4) |
S8_ENABLE_COLOR_BUFFER_WRITE);
S8_ENABLE_COLOR_BUFFER_WRITE);
ADVANCE_LP_RING();
}
#ifdef I830DEBUG
Error("try to sync to show any errors...");
I830Sync(pScrn);
Error("try to sync to show any errors...");
I830Sync(pScrn);
#endif
return TRUE;
}
/**
* Do a single rectangle composite operation.
*
* This function is shared between i830 and i915 generation code.
*/
void
i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
int dstX, int dstY, int w, int h)
{
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
Bool has_mask;
float src_x[3], src_y[3], mask_x[3], mask_y[3];
i830_get_transformed_coordinates(srcX, srcY,
pI830->transform[0],
&src_x[0], &src_y[0]);
i830_get_transformed_coordinates(srcX, srcY + h,
pI830->transform[0],
&src_x[1], &src_y[1]);
i830_get_transformed_coordinates(srcX + w, srcY + h,
pI830->transform[0],
&src_x[2], &src_y[2]);
if (pI830->scale_units[1][0] == -1 || pI830->scale_units[1][1] == -1) {
has_mask = FALSE;
} else {
has_mask = TRUE;
i830_get_transformed_coordinates(maskX, maskY,
pI830->transform[1],
&mask_x[0], &mask_y[0]);
i830_get_transformed_coordinates(maskX, maskY + h,
pI830->transform[1],
&mask_x[1], &mask_y[1]);
i830_get_transformed_coordinates(maskX + w, maskY + h,
pI830->transform[1],
&mask_x[2], &mask_y[2]);
}
{
int vertex_count;
if (has_mask)
vertex_count = 3*6;
else
vertex_count = 3*4;
BEGIN_LP_RING(6+vertex_count);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(MI_NOOP);
OUT_RING(PRIM3D_INLINE | PRIM3D_RECTLIST | (vertex_count-1));
OUT_RING_F(dstX);
OUT_RING_F(dstY);
OUT_RING_F(src_x[0] / pI830->scale_units[0][0]);
OUT_RING_F(src_y[0] / pI830->scale_units[0][1]);
if (has_mask) {
OUT_RING_F(mask_x[0] / pI830->scale_units[1][0]);
OUT_RING_F(mask_y[0] / pI830->scale_units[1][1]);
}
OUT_RING_F(dstX);
OUT_RING_F(dstY + h);
OUT_RING_F(src_x[1] / pI830->scale_units[0][0]);
OUT_RING_F(src_y[1] / pI830->scale_units[0][1]);
if (has_mask) {
OUT_RING_F(mask_x[1] / pI830->scale_units[1][0]);
OUT_RING_F(mask_y[1] / pI830->scale_units[1][1]);
}
OUT_RING_F(dstX + w);
OUT_RING_F(dstY + h);
OUT_RING_F(src_x[2] / pI830->scale_units[0][0]);
OUT_RING_F(src_y[2] / pI830->scale_units[0][1]);
if (has_mask) {
OUT_RING_F(mask_x[2] / pI830->scale_units[1][0]);
OUT_RING_F(mask_y[2] / pI830->scale_units[1][1]);
}
ADVANCE_LP_RING();
}
}
/**
* Do any cleanup from the Composite operation.
*
* This is shared between i830 through i965.
*/
void
i830_done_composite(PixmapPtr pDst)
{
#if ALWAYS_SYNC
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
I830Sync(pScrn);
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -1399,33 +1399,33 @@ i830_tv_detect_type (xf86CrtcPtr crtc,
static xf86OutputStatus
i830_tv_detect(xf86OutputPtr output)
{
xf86CrtcPtr crtc;
DisplayModeRec mode;
I830OutputPrivatePtr intel_output = output->driver_private;
struct i830_tv_priv *dev_priv = intel_output->dev_priv;
xf86CrtcPtr crtc;
DisplayModeRec mode;
I830OutputPrivatePtr intel_output = output->driver_private;
struct i830_tv_priv *dev_priv = intel_output->dev_priv;
crtc = i830GetLoadDetectPipe (output);
if (crtc)
{
if (intel_output->load_detect_temp)
{
/* we only need the pixel clock set correctly here */
mode = reported_modes[0];
xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
i830PipeSetMode (crtc, &mode, FALSE);
}
i830_tv_detect_type (crtc, output);
i830ReleaseLoadDetectPipe (output);
}
crtc = i830GetLoadDetectPipe (output);
if (crtc)
{
if (intel_output->load_detect_temp)
{
/* we only need the pixel clock set correctly here */
mode = reported_modes[0];
xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
xf86CrtcSetMode (crtc, &mode, RR_Rotate_0, 0, 0);
}
i830_tv_detect_type (crtc, output);
i830ReleaseLoadDetectPipe (output);
}
switch (dev_priv->type) {
case TV_TYPE_NONE:
return XF86OutputStatusDisconnected;
case TV_TYPE_UNKNOWN:
return XF86OutputStatusUnknown;
default:
return XF86OutputStatusConnected;
}
switch (dev_priv->type) {
case TV_TYPE_NONE:
return XF86OutputStatusDisconnected;
case TV_TYPE_UNKNOWN:
return XF86OutputStatusUnknown;
default:
return XF86OutputStatusConnected;
}
}
struct input_res {

View File

@ -2073,8 +2073,6 @@ I830AllocateMemory(ScrnInfoPtr pScrn, struct linear_alloc *linear, int size,
#endif /* I830_USE_EXA */
#ifdef I830_USE_XAA
if (!pI830->useEXA) {
int max_size;
/* Converts an offset from XAA's linear allocator to an offset from the
* start of fb.
*/
@ -2100,25 +2098,11 @@ I830AllocateMemory(ScrnInfoPtr pScrn, struct linear_alloc *linear, int size,
xf86FreeOffscreenLinear(linear->xaa);
}
linear->xaa = xf86AllocateOffscreenLinear(pScreen, size, align,
NULL, NULL, NULL);
if (linear->xaa != NULL) {
linear->offset = XAA_OFFSET_TO_OFFSET(linear->xaa->offset);
linear->xaa = i830_xf86AllocateOffscreenLinear(pScreen, size, align,
NULL, NULL, NULL);
if (linear->xaa == NULL)
return;
}
xf86QueryLargestOffscreenLinear(pScreen, &max_size, align,
PRIORITY_EXTREME);
if (max_size < size) {
ErrorF("No memory available\n");
linear->offset = 0;
return;
}
xf86PurgeUnlockedOffscreenAreas(pScreen);
linear->xaa = xf86AllocateOffscreenLinear(pScreen, size, 4,
NULL, NULL, NULL);
linear->offset = XAA_OFFSET_TO_OFFSET(linear->xaa->offset);
}
#endif /* I830_USE_XAA */

View File

@ -52,6 +52,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xaarop.h"
#include "i830.h"
#include "i810_reg.h"
#include "mipict.h"
#ifndef DO_SCANLINE_IMAGE_WRITE
#define DO_SCANLINE_IMAGE_WRITE 0
@ -91,11 +92,26 @@ static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
#endif
static void I830RestoreAccelState(ScrnInfoPtr pScrn);
void
i830_xaa_composite(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
Bool
I830XAAInit(ScreenPtr pScreen)
{
XAAInfoRecPtr infoPtr;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
I830Ptr pI830 = I830PTR(pScrn);
int i;
int width = 0;
@ -220,7 +236,36 @@ I830XAAInit(ScreenPtr pScreen)
I830SelectBuffer(pScrn, I830_SELECT_FRONT);
return XAAInit(pScreen, infoPtr);
if (!XAAInit(pScreen, infoPtr))
return FALSE;
if (ps != NULL) {
if (IS_I865G(pI830) || IS_I855(pI830) ||
IS_845G(pI830) || IS_I830(pI830))
{
pI830->xaa_check_composite = i830_check_composite;
pI830->xaa_prepare_composite = i830_prepare_composite;
pI830->xaa_composite = i830_composite;
pI830->xaa_done_composite = i830_done_composite;
} else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
IS_I945G(pI830) || IS_I945GM(pI830))
{
pI830->xaa_check_composite = i915_check_composite;
pI830->xaa_prepare_composite = i915_prepare_composite;
pI830->xaa_composite = i830_composite;
pI830->xaa_done_composite = i830_done_composite;
} else {
pI830->xaa_check_composite = i965_check_composite;
pI830->xaa_prepare_composite = i965_prepare_composite;
pI830->xaa_composite = i965_composite;
pI830->xaa_done_composite = i830_done_composite;
}
pI830->saved_composite = ps->Composite;
ps->Composite = i830_xaa_composite;
}
return TRUE;
}
#ifdef XF86DRI
@ -234,8 +279,6 @@ CheckTiling(ScrnInfoPtr pScrn)
if (IS_I965G(pI830)) {
if (pI830->bufferOffset == pScrn->fbOffset && pI830->front_tiled == FENCE_XMAJOR)
tiled = 1;
if (pI830->bufferOffset == pI830->RotatedMem.Start && pI830->rotated_tiled == FENCE_XMAJOR)
tiled = 1;
if (pI830->bufferOffset == pI830->BackBuffer.Start && pI830->back_tiled == FENCE_XMAJOR)
tiled = 1;
/* not really supported as it's always YMajor tiled */
@ -694,6 +737,126 @@ I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
#endif /* DO_SCANLINE_IMAGE_WRITE */
/* Support for multiscreen */
/**
* Special case acceleration for Render acceleration of rotation operations
* by xf86Rotate.c
*/
void
i830_xaa_composite(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
PictureScreenPtr ps;
PixmapPtr pSrcPixmap, pDstPixmap;
RegionRec region;
BoxPtr pbox;
int nbox;
int i;
/* Throw out cases that aren't going to be our rotation first */
if (pMask != NULL || op != PictOpSrc || pSrc->pDrawable == NULL)
goto fallback;
if (pSrc->pDrawable->type != DRAWABLE_PIXMAP ||
pDst->pDrawable->type != DRAWABLE_PIXMAP)
{
goto fallback;
}
pSrcPixmap = (PixmapPtr)pSrc->pDrawable;
pDstPixmap = (PixmapPtr)pDst->pDrawable;
/* Check if the dest is one of our shadow pixmaps */
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
if (crtc->rotatedPixmap == pDstPixmap)
break;
}
if (i == xf86_config->num_crtc)
goto fallback;
if (pSrcPixmap != pScreen->GetScreenPixmap(pScreen))
goto fallback;
/* OK, so we've got a Render operation on one of our shadow pixmaps, with
* the source being the real framebuffer. We know that both of these are
* in framebuffer, with no x/y offsets, i.e. normal pixmaps like our EXA-
* based Render acceleration code expects.
*/
assert(pSrcPixmap->drawable.x == 0);
assert(pSrcPixmap->drawable.y == 0);
assert(pDstPixmap->drawable.x == 0);
assert(pDstPixmap->drawable.y == 0);
if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
xSrc, ySrc, 0, 0, xDst, yDst,
width, height))
return;
if (!pI830->xaa_check_composite(op, pSrc, NULL, pDst)) {
REGION_UNINIT(pScreen, &region);
goto fallback;
}
if (!pI830->xaa_prepare_composite(op, pSrc, NULL, pDst,
pSrcPixmap, NULL, pDstPixmap))
{
REGION_UNINIT(pScreen, &region);
goto fallback;
}
nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region);
xSrc -= xDst;
ySrc -= yDst;
while (nbox--)
{
pI830->xaa_composite(pDstPixmap,
pbox->x1 + xSrc,
pbox->y1 + ySrc,
0, 0,
pbox->x1,
pbox->y1,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
pI830->xaa_done_composite(pDstPixmap);
i830MarkSync(pScrn);
return;
fallback:
/* Fallback path: Call down to the next level (XAA) */
ps = GetPictureScreenIfSet(pScreen);
ps->Composite = pI830->saved_composite;
ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height);
pI830->saved_composite = ps->Composite;
ps->Composite = i830_xaa_composite;
}
static void
I830RestoreAccelState(ScrnInfoPtr pScrn)
{

View File

@ -87,6 +87,8 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
#ifdef RANDR_12_INTERFACE
crtc->randr_crtc = NULL;
#endif
crtc->rotation = RR_Rotate_0;
crtc->desiredRotation = RR_Rotate_0;
if (xf86_config->crtc)
crtcs = xrealloc (xf86_config->crtc,
(xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
@ -121,6 +123,139 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
xfree (crtc);
}
/**
* Return whether any outputs are connected to the specified pipe
*/
Bool
xf86CrtcInUse (xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int o;
for (o = 0; o < xf86_config->num_output; o++)
if (xf86_config->output[o]->crtc == crtc)
return TRUE;
return FALSE;
}
/**
* Sets the given video mode on the given crtc
*/
Bool
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
int x, int y)
{
ScrnInfoPtr scrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
int i;
Bool ret = FALSE;
Bool didLock = FALSE;
DisplayModePtr adjusted_mode;
DisplayModeRec saved_mode;
int saved_x, saved_y;
Rotation saved_rotation;
adjusted_mode = xf86DuplicateMode(mode);
crtc->enabled = xf86CrtcInUse (crtc);
if (!crtc->enabled)
{
/* XXX disable crtc? */
return TRUE;
}
didLock = crtc->funcs->lock (crtc);
saved_mode = crtc->mode;
saved_x = crtc->x;
saved_y = crtc->y;
saved_rotation = crtc->rotation;
/* Update crtc values up front so the driver can rely on them for mode
* setting.
*/
crtc->mode = *mode;
crtc->x = x;
crtc->y = y;
crtc->rotation = rotation;
/* XXX short-circuit changes to base location only */
/* Pass our mode to the outputs and the CRTC to give them a chance to
* adjust it according to limitations or output properties, and also
* a chance to reject the mode entirely.
*/
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc != crtc)
continue;
if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
goto done;
}
}
if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
goto done;
}
if (!xf86CrtcRotate (crtc, mode, rotation)) {
goto done;
}
/* Disable the outputs and CRTCs before setting the mode. */
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc != crtc)
continue;
/* Disable the output as the first thing we do. */
output->funcs->dpms(output, DPMSModeOff);
}
crtc->funcs->dpms(crtc, DPMSModeOff);
/* Set up the DPLL and any output state that needs to adjust or depend
* on the DPLL.
*/
crtc->funcs->mode_set(crtc, mode, adjusted_mode, x, y);
for (i = 0; i < xf86_config->num_output; i++)
{
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc == crtc)
output->funcs->mode_set(output, mode, adjusted_mode);
}
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->dpms(crtc, DPMSModeOn);
for (i = 0; i < xf86_config->num_output; i++)
{
xf86OutputPtr output = xf86_config->output[i];
if (output->crtc == crtc)
output->funcs->dpms(output, DPMSModeOn);
}
/* XXX free adjustedmode */
ret = TRUE;
done:
if (!ret) {
crtc->x = saved_x;
crtc->y = saved_y;
crtc->rotation = saved_rotation;
crtc->mode = saved_mode;
}
if (didLock)
crtc->funcs->unlock (crtc);
return ret;
}
/*
* Output functions
*/
@ -362,14 +497,14 @@ xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
}
static int
xf86PickCrtcs (ScrnInfoPtr pScrn,
xf86PickCrtcs (ScrnInfoPtr scrn,
xf86CrtcPtr *best_crtcs,
DisplayModePtr *modes,
int n,
int width,
int height)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int c, o, l;
xf86OutputPtr output;
xf86CrtcPtr crtc;
@ -388,7 +523,7 @@ xf86PickCrtcs (ScrnInfoPtr pScrn,
*/
best_crtcs[n] = NULL;
best_crtc = NULL;
best_score = xf86PickCrtcs (pScrn, best_crtcs, modes, n+1, width, height);
best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
if (modes[n] == NULL)
return best_score;
@ -442,7 +577,7 @@ xf86PickCrtcs (ScrnInfoPtr pScrn,
}
crtcs[n] = crtc;
memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
score = my_score + xf86PickCrtcs (pScrn, crtcs, modes, n+1, width, height);
score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
if (score > best_score)
{
best_crtc = crtc;
@ -462,9 +597,9 @@ xf86PickCrtcs (ScrnInfoPtr pScrn,
*/
static void
xf86DefaultScreenLimits (ScrnInfoPtr pScrn, int *widthp, int *heightp)
xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int width = 0, height = 0;
int o;
int c;
@ -513,9 +648,9 @@ xf86DefaultScreenLimits (ScrnInfoPtr pScrn, int *widthp, int *heightp)
#define POSITION_UNSET -100000
static Bool
xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o;
int min_x, min_y;
@ -563,7 +698,7 @@ xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
}
else
{
xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Output %s position not of form \"x y\"\n",
output->name);
output->initial_x = output->initial_y = 0;
@ -606,7 +741,7 @@ xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
}
if (!relative)
{
xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Cannot position output %s relative to unknown output %s\n",
output->name, relative_name);
output->initial_x = 0;
@ -655,7 +790,7 @@ xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
xf86OutputPtr output = config->output[o];
if (output->initial_x == POSITION_UNSET)
{
xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Output position loop. Moving %s to 0,0\n",
output->name);
output->initial_x = output->initial_y = 0;
@ -778,16 +913,16 @@ i830xf86SortModes (DisplayModePtr input)
#define DEBUG_REPROBE 1
void
xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o;
if (maxX == 0 || maxY == 0)
xf86RandR12GetOriginalVirtualSize (pScrn, &maxX, &maxY);
xf86RandR12GetOriginalVirtualSize (scrn, &maxX, &maxY);
/* Elide duplicate modes before defaulting code uses them */
xf86PruneDuplicateMonitorModes (pScrn->monitor);
xf86PruneDuplicateMonitorModes (scrn->monitor);
/* Probe the list of modes for each output. */
for (o = 0; o < config->num_output; o++)
@ -837,7 +972,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
mon_rec.nVrefresh++;
sync_source = sync_config;
}
config_modes = i830xf86GetMonitorModes (pScrn, conf_monitor);
config_modes = xf86GetMonitorModes (scrn, conf_monitor);
}
output_modes = (*output->funcs->get_modes) (output);
@ -901,27 +1036,27 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
mon_rec.vrefresh[0].hi = 62.0;
mon_rec.nVrefresh = 1;
}
default_modes = i830xf86GetDefaultModes (output->interlaceAllowed,
output->doubleScanAllowed);
default_modes = xf86GetDefaultModes (output->interlaceAllowed,
output->doubleScanAllowed);
if (sync_source == sync_config)
{
/*
* Check output and config modes against sync range from config file
*/
i830xf86ValidateModesSync (pScrn, output_modes, &mon_rec);
i830xf86ValidateModesSync (pScrn, config_modes, &mon_rec);
xf86ValidateModesSync (scrn, output_modes, &mon_rec);
xf86ValidateModesSync (scrn, config_modes, &mon_rec);
}
/*
* Check default modes against sync range
*/
i830xf86ValidateModesSync (pScrn, default_modes, &mon_rec);
xf86ValidateModesSync (scrn, default_modes, &mon_rec);
/*
* Check default modes against monitor max clock
*/
if (max_clock)
i830xf86ValidateModesClocks(pScrn, default_modes,
&min_clock, &max_clock, 1);
xf86ValidateModesClocks(scrn, default_modes,
&min_clock, &max_clock, 1);
output->probed_modes = NULL;
output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
@ -933,7 +1068,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
* Check all modes against max size
*/
if (maxX && maxY)
i830xf86ValidateModesSize (pScrn, output->probed_modes,
xf86ValidateModesSize (scrn, output->probed_modes,
maxX, maxY, 0);
/*
@ -943,7 +1078,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
if (mode->status == MODE_OK)
mode->status = (*output->funcs->mode_valid)(output, mode);
i830xf86PruneInvalidModes(pScrn, &output->probed_modes, TRUE);
xf86PruneInvalidModes(scrn, &output->probed_modes, TRUE);
output->probed_modes = i830xf86SortModes (output->probed_modes);
@ -976,11 +1111,11 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
#ifdef DEBUG_REPROBE
if (output->probed_modes != NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Printing probed modes for output %s\n",
output->name);
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"No remaining probed modes for output %s\n",
output->name);
}
@ -994,7 +1129,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
#ifdef DEBUG_REPROBE
xf86PrintModeline(pScrn->scrnIndex, mode);
xf86PrintModeline(scrn->scrnIndex, mode);
#endif
}
}
@ -1007,12 +1142,12 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
/* XXX where does this function belong? Here? */
void
xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
void
xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
xf86SetScrnInfoModes (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
xf86OutputPtr output;
xf86CrtcPtr crtc;
DisplayModePtr last, mode;
@ -1036,31 +1171,31 @@ xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
}
crtc = output->crtc;
/* Clear any existing modes from pScrn->modes */
while (pScrn->modes != NULL)
xf86DeleteMode(&pScrn->modes, pScrn->modes);
/* Clear any existing modes from scrn->modes */
while (scrn->modes != NULL)
xf86DeleteMode(&scrn->modes, scrn->modes);
/* Set pScrn->modes to the mode list for the 'compat' output */
pScrn->modes = xf86DuplicateModes(pScrn, output->probed_modes);
/* Set scrn->modes to the mode list for the 'compat' output */
scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
for (mode = pScrn->modes; mode; mode = mode->next)
for (mode = scrn->modes; mode; mode = mode->next)
if (xf86ModesEqual (mode, &crtc->desiredMode))
break;
if (pScrn->modes != NULL) {
/* For some reason, pScrn->modes is circular, unlike the other mode
if (scrn->modes != NULL) {
/* For some reason, scrn->modes is circular, unlike the other mode
* lists. How great is that?
*/
for (last = pScrn->modes; last && last->next; last = last->next)
for (last = scrn->modes; last && last->next; last = last->next)
;
last->next = pScrn->modes;
pScrn->modes->prev = last;
last->next = scrn->modes;
scrn->modes->prev = last;
if (mode) {
while (pScrn->modes != mode)
pScrn->modes = pScrn->modes->next;
while (scrn->modes != mode)
scrn->modes = scrn->modes->next;
}
}
pScrn->currentMode = pScrn->modes;
scrn->currentMode = scrn->modes;
}
/**
@ -1071,9 +1206,9 @@ xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
*/
Bool
xf86InitialConfiguration (ScrnInfoPtr pScrn)
xf86InitialConfiguration (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o, c;
DisplayModePtr target_mode = NULL;
xf86CrtcPtr *crtcs;
@ -1082,16 +1217,16 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
int width;
int height;
if (pScrn->display->virtualX)
width = pScrn->display->virtualX;
if (scrn->display->virtualX)
width = scrn->display->virtualX;
else
width = config->maxWidth;
if (pScrn->display->virtualY)
height = pScrn->display->virtualY;
if (scrn->display->virtualY)
height = scrn->display->virtualY;
else
height = config->maxHeight;
xf86ProbeOutputModes (pScrn, width, height);
xf86ProbeOutputModes (scrn, width, height);
crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
@ -1153,7 +1288,7 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
/*
* Set the position of each output
*/
if (!xf86InitialOutputPositions (pScrn, modes))
if (!xf86InitialOutputPositions (scrn, modes))
{
xfree (crtcs);
xfree (modes);
@ -1163,7 +1298,7 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
/*
* Assign CRTCs to fit output configuration
*/
if (!xf86PickCrtcs (pScrn, crtcs, modes, 0, width, height))
if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
{
xfree (crtcs);
xfree (modes);
@ -1172,8 +1307,8 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
/* XXX override xf86 common frame computation code */
pScrn->display->frameX0 = 0;
pScrn->display->frameY0 = 0;
scrn->display->frameX0 = 0;
scrn->display->frameY0 = 0;
for (c = 0; c < config->num_crtc; c++)
{
@ -1202,24 +1337,24 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
}
}
if (pScrn->display->virtualX == 0)
if (scrn->display->virtualX == 0)
{
/*
* Expand virtual size to cover potential mode switches
*/
xf86DefaultScreenLimits (pScrn, &width, &height);
xf86DefaultScreenLimits (scrn, &width, &height);
pScrn->display->virtualX = width;
pScrn->display->virtualY = height;
scrn->display->virtualX = width;
scrn->display->virtualY = height;
}
if (width > pScrn->virtualX)
pScrn->virtualX = width;
if (height > pScrn->virtualY)
pScrn->virtualY = height;
if (width > scrn->virtualX)
scrn->virtualX = width;
if (height > scrn->virtualY)
scrn->virtualY = height;
/* Mirror output modes to pScrn mode list */
xf86SetScrnInfoModes (pScrn);
/* Mirror output modes to scrn mode list */
xf86SetScrnInfoModes (scrn);
xfree (crtcs);
xfree (modes);
@ -1233,12 +1368,12 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
* Otherwise, it will affect CRTCs before outputs.
*/
void
xf86DPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int i;
if (!pScrn->vtSema)
if (!scrn->vtSema)
return;
if (mode == DPMSModeOff) {
@ -1283,6 +1418,34 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
return TRUE;
}
/**
* Disable all inactive crtcs and outputs
*/
void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int o, c;
for (o = 0; o < xf86_config->num_output; o++)
{
xf86OutputPtr output = xf86_config->output[o];
if (!output->crtc)
(*output->funcs->dpms)(output, DPMSModeOff);
}
for (c = 0; c < xf86_config->num_crtc; c++)
{
xf86CrtcPtr crtc = xf86_config->crtc[c];
if (!crtc->enabled)
{
crtc->funcs->dpms(crtc, DPMSModeOff);
memset(&crtc->mode, 0, sizeof(crtc->mode));
}
}
}
#ifdef RANDR_12_INTERFACE
#define EDID_ATOM_NAME "EDID_DATA"
@ -1313,10 +1476,10 @@ xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
* Set the EDID information for the specified output
*/
void
i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
{
ScrnInfoPtr pScrn = output->scrn;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
ScrnInfoPtr scrn = output->scrn;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int i;
#ifdef RANDR_12_INTERFACE
int size;
@ -1328,12 +1491,12 @@ i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
output->MonInfo = edid_mon;
/* Debug info for now, at least */
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name);
xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name);
xf86PrintEDID(edid_mon);
/* Set the DDC properties for the 'compat' output */
if (output == config->output[config->compat_output])
xf86SetDDCproperties(pScrn, edid_mon);
xf86SetDDCproperties(scrn, edid_mon);
#ifdef RANDR_12_INTERFACE
/* Set the RandR output properties */
@ -1377,20 +1540,20 @@ i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
* stored in 'output'
*/
DisplayModePtr
i830_xf86OutputGetEDIDModes (xf86OutputPtr output)
xf86OutputGetEDIDModes (xf86OutputPtr output)
{
ScrnInfoPtr pScrn = output->scrn;
ScrnInfoPtr scrn = output->scrn;
xf86MonPtr edid_mon = output->MonInfo;
if (!edid_mon)
return NULL;
return xf86DDCGetModes(pScrn->scrnIndex, edid_mon);
return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
}
xf86MonPtr
i830_xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
{
ScrnInfoPtr pScrn = output->scrn;
ScrnInfoPtr scrn = output->scrn;
return xf86DoEDID_DDC2 (pScrn->scrnIndex, pDDCBus);
return xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
}

View File

@ -24,8 +24,10 @@
#include <edid.h>
#include "randrstr.h"
#include "i830_xf86Rename.h"
#include "i830_xf86Modes.h"
#include "xf86Parser.h"
#include "damage.h"
/* Compat definitions for older X Servers. */
#ifndef M_T_PREFERRED
@ -68,7 +70,19 @@ typedef struct _xf86CrtcFuncs {
void
(*restore)(xf86CrtcPtr crtc);
/**
* Lock CRTC prior to mode setting, mostly for DRI.
* Returns whether unlock is needed
*/
Bool
(*lock) (xf86CrtcPtr crtc);
/**
* Unlock CRTC after mode setting, mostly for DRI
*/
void
(*unlock) (xf86CrtcPtr crtc);
/**
* Callback to adjust the mode to be set in the CRTC.
*
@ -87,13 +101,26 @@ typedef struct _xf86CrtcFuncs {
void
(*mode_set)(xf86CrtcPtr crtc,
DisplayModePtr mode,
DisplayModePtr adjusted_mode);
DisplayModePtr adjusted_mode,
int x, int y);
/* Set the color ramps for the CRTC to the given values. */
void
(*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
int size);
/**
* Create shadow pixmap for rotation support
*/
PixmapPtr
(*shadow_create) (xf86CrtcPtr crtc, int width, int height);
/**
* Destroy shadow pixmap
*/
void
(*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap);
/**
* Clean up driver-specific bits of the crtc
*/
@ -114,13 +141,6 @@ struct _xf86Crtc {
*/
Bool enabled;
/**
* Position on screen
*
* Locates this CRTC within the frame buffer
*/
int x, y;
/** Track whether cursor is within CRTC range */
Bool cursorInRange;
@ -134,7 +154,15 @@ struct _xf86Crtc {
* It will be cleared when the VT is not active or
* during server startup
*/
DisplayModeRec curMode;
DisplayModeRec mode;
Rotation rotation;
PixmapPtr rotatedPixmap;
/**
* Position on screen
*
* Locates this CRTC within the frame buffer
*/
int x, y;
/**
* Desired mode
@ -145,6 +173,8 @@ struct _xf86Crtc {
* on VT switch.
*/
DisplayModeRec desiredMode;
Rotation desiredRotation;
int desiredX, desiredY;
/** crtc-specific functions */
const xf86CrtcFuncsRec *funcs;
@ -379,6 +409,13 @@ typedef struct _xf86CrtcConfig {
int minWidth, minHeight;
int maxWidth, maxHeight;
/* For crtc-based rotation */
DamagePtr rotationDamage;
/* DGA */
unsigned int dga_flags;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex;
@ -427,6 +464,25 @@ xf86AllocCrtc (xf86OutputPtr output);
void
xf86FreeCrtc (xf86CrtcPtr crtc);
/**
* Sets the given video mode on the given crtc
*/
Bool
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
int x, int y);
/*
* Assign crtc rotation during mode set
*/
Bool
xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation);
/**
* Return whether any output is assigned to the crtc
*/
Bool
xf86CrtcInUse (xf86CrtcPtr crtc);
/*
* Output functions
*/
@ -456,20 +512,23 @@ xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
Bool
xf86SaveScreen(ScreenPtr pScreen, int mode);
void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
/**
* Set the EDID information for the specified output
*/
void
i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
/**
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
DisplayModePtr
i830_xf86OutputGetEDIDModes (xf86OutputPtr output);
xf86OutputGetEDIDModes (xf86OutputPtr output);
xf86MonPtr
i830_xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
#endif /* _XF86CRTC_H_ */

View File

@ -148,47 +148,13 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
p->CrtcVSyncEnd *= p->VScan;
p->CrtcVTotal *= p->VScan;
}
p->CrtcHAdjusted = FALSE;
p->CrtcVAdjusted = FALSE;
/*
* XXX
*
* The following is taken from VGA, but applies to other cores as well.
*/
p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
if ((p->CrtcVBlankEnd - p->CrtcVBlankStart) >= 127) {
/*
* V Blanking size must be < 127.
* Moving blank start forward is safer than moving blank end
* back, since monitors clamp just AFTER the sync pulse (or in
* the sync pulse), but never before.
*/
p->CrtcVBlankStart = p->CrtcVBlankEnd - 127;
/*
* If VBlankStart is now > VSyncStart move VBlankStart
* to VSyncStart using the maximum width that fits into
* VTotal.
*/
if (p->CrtcVBlankStart > p->CrtcVSyncStart) {
p->CrtcVBlankStart = p->CrtcVSyncStart;
p->CrtcVBlankEnd = min(p->CrtcHBlankStart + 127, p->CrtcVTotal);
}
}
p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
if ((p->CrtcHBlankEnd - p->CrtcHBlankStart) >= 63 * 8) {
/*
* H Blanking size must be < 63*8. Same remark as above.
*/
p->CrtcHBlankStart = p->CrtcHBlankEnd - 63 * 8;
if (p->CrtcHBlankStart > p->CrtcHSyncStart) {
p->CrtcHBlankStart = p->CrtcHSyncStart;
p->CrtcHBlankEnd = min(p->CrtcHBlankStart + 63 * 8, p->CrtcHTotal);
}
}
p->CrtcHAdjusted = FALSE;
p->CrtcVAdjusted = FALSE;
}
/**
@ -337,7 +303,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags)
{
DisplayModePtr mode;
@ -358,7 +324,7 @@ i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
i830xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int maxX, int maxY, int maxPitch)
{
DisplayModePtr mode;
@ -387,7 +353,7 @@ i830xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
MonPtr mon)
{
DisplayModePtr mode;
@ -434,7 +400,7 @@ i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
i830xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int *min, int *max, int n_ranges)
{
DisplayModePtr mode;
@ -468,7 +434,7 @@ i830xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
DisplayModePtr mode;
@ -502,7 +468,7 @@ i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
i830xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
Bool verbose)
{
DisplayModePtr mode;
@ -558,13 +524,13 @@ xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
* Build a mode list from a list of config file modes
*/
static DisplayModePtr
i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
{
DisplayModePtr head = NULL, prev = NULL, mode;
for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
{
mode = xalloc(sizeof(DisplayModeRec));
mode = xcalloc(1, sizeof(DisplayModeRec));
if (!mode)
continue;
mode->name = xstrdup(conf_mode->ml_identifier);
@ -573,8 +539,6 @@ i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
xfree (mode);
continue;
}
memset(mode,'\0',sizeof(DisplayModeRec));
mode->type = 0;
mode->Clock = conf_mode->ml_clock;
mode->HDisplay = conf_mode->ml_hdisplay;
@ -604,7 +568,7 @@ i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
* Build a mode list from a monitor configuration
*/
DisplayModePtr
i830xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
{
DisplayModePtr modes = NULL;
XF86ConfModesLinkPtr modes_link;
@ -625,18 +589,18 @@ i830xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
xf86configptr->conf_modes_lst);
if (modes_link->ml_modes)
modes = xf86ModesAdd (modes,
i830xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
}
return xf86ModesAdd (modes,
i830xf86GetConfigModes (conf_monitor->mon_modeline_lst));
xf86GetConfigModes (conf_monitor->mon_modeline_lst));
}
/**
* Build a mode list containing all of the default modes
*/
DisplayModePtr
i830xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
{
DisplayModePtr head = NULL, prev = NULL, mode;
int i;

View File

@ -29,67 +29,54 @@
#define _I830_XF86MODES_H_
#include "xorgVersion.h"
#include "xf86Parser.h"
#include "i830_xf86Rename.h"
#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
double i830_xf86ModeHSync(DisplayModePtr mode);
double i830_xf86ModeVRefresh(DisplayModePtr mode);
DisplayModePtr i830_xf86DuplicateMode(DisplayModePtr pMode);
DisplayModePtr i830_xf86DuplicateModes(ScrnInfoPtr pScrn,
double xf86ModeHSync(DisplayModePtr mode);
double xf86ModeVRefresh(DisplayModePtr mode);
DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
DisplayModePtr modeList);
void i830_xf86SetModeDefaultName(DisplayModePtr mode);
void i830_xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
Bool i830_xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
void i830_xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
DisplayModePtr i830_xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
void xf86SetModeDefaultName(DisplayModePtr mode);
void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
DisplayModePtr i830_xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
DisplayModePtr i830_xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
Bool Reduced, Bool Interlaced);
#define xf86ModeHSync i830_xf86ModeHSync
#define xf86ModeVRefresh i830_xf86ModeVRefresh
#define xf86DuplicateMode i830_xf86DuplicateMode
#define xf86DuplicateModes i830_xf86DuplicateModes
#define xf86SetModeDefaultName i830_xf86SetModeDefaultName
#define xf86SetModeCrtc i830_xf86SetModeCrtc
#define xf86ModesEqual i830_xf86ModesEqual
#define xf86PrintModeline i830_xf86PrintModeline
#define xf86ModesAdd i830_xf86ModesAdd
#define xf86DDCGetModes i830_xf86DDCGetModes
#define xf86CVTMode i830_xf86CVTMode
#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
Bool Reduced, Bool Interlaced);
void
i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags);
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags);
void
i830xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int *min, int *max, int n_ranges);
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int *min, int *max, int n_ranges);
void
i830xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int maxX, int maxY, int maxPitch);
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int maxX, int maxY, int maxPitch);
void
i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
MonPtr mon);
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
MonPtr mon);
void
i830xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
Bool verbose);
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
Bool verbose);
void
i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags);
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags);
void
i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
DisplayModePtr
i830xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
DisplayModePtr
i830xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
#endif /* _I830_XF86MODES_H_ */

66
src/i830_xf86Rename.h Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _XF86RENAME_H_
#define _XF86RENAME_H_
#include "local_xf86Rename.h"
#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
#define xf86CVTMode XF86NAME(xf86CVTMode)
#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
#define xf86DPMSSet XF86NAME(xf86DPMSSet)
#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
#define xf86DuplicateModes XF86NAME(xf86DuplicateModes)
#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes)
#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes)
#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration)
#define xf86ModeHSync XF86NAME(xf86ModeHSync)
#define xf86ModesAdd XF86NAME(xf86ModesAdd)
#define xf86ModesEqual XF86NAME(xf86ModesEqual)
#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh)
#define xf86OutputCreate XF86NAME(xf86OutputCreate)
#define xf86OutputDestroy XF86NAME(xf86OutputDestroy)
#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID)
#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
#define xf86OutputRename XF86NAME(xf86OutputRename)
#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
#define xf86PrintModeline XF86NAME(xf86PrintModeline)
#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks)
#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags)
#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
#endif /* _XF86RENAME_H_ */

402
src/i830_xf86Rotate.c Normal file
View File

@ -0,0 +1,402 @@
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include "xf86.h"
#include "xf86DDC.h"
#include "fb.h"
#include "windowstr.h"
#include "i830_xf86Crtc.h"
#include "i830_xf86Modes.h"
#include "i830_randr.h"
#include "X11/extensions/render.h"
#define DPMS_SERVER
#include "X11/extensions/dpms.h"
#include "X11/Xatom.h"
static int
mode_height (DisplayModePtr mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_180:
return mode->VDisplay;
case RR_Rotate_90:
case RR_Rotate_270:
return mode->HDisplay;
default:
return 0;
}
}
static int
mode_width (DisplayModePtr mode, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_180:
return mode->HDisplay;
case RR_Rotate_90:
case RR_Rotate_270:
return mode->VDisplay;
default:
return 0;
}
}
/* borrowed from composite extension, move to Render and publish? */
static VisualPtr
compGetWindowVisual (WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
VisualID vid = wVisual (pWin);
int i;
for (i = 0; i < pScreen->numVisuals; i++)
if (pScreen->visuals[i].vid == vid)
return &pScreen->visuals[i];
return 0;
}
static PictFormatPtr
compWindowFormat (WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
return PictureMatchVisual (pScreen, pWin->drawable.depth,
compGetWindowVisual (pWin));
}
static void
xf86RotateBox (BoxPtr dst, BoxPtr src, Rotation rotation,
int dest_width, int dest_height)
{
switch (rotation & 0xf) {
default:
case RR_Rotate_0:
*dst = *src;
break;
case RR_Rotate_90:
dst->x1 = src->y1;
dst->y1 = dest_height - src->x2;
dst->x2 = src->y2;
dst->y2 = dest_height - src->x1;
break;
case RR_Rotate_180:
dst->x1 = dest_width - src->x2;
dst->y1 = dest_height - src->y2;
dst->x2 = dest_width - src->x1;
dst->y2 = dest_height - src->y1;
break;
case RR_Rotate_270:
dst->x1 = dest_width - src->y2;
dst->y1 = src->x1;
dst->y2 = src->x2;
dst->x2 = dest_width - src->y1;
break;
}
if (rotation & RR_Reflect_X) {
int x1 = dst->x1;
dst->x1 = dest_width - dst->x2;
dst->x2 = dest_width - x1;
}
if (rotation & RR_Reflect_Y) {
int y1 = dst->y1;
dst->y1 = dest_height - dst->y2;
dst->y2 = dest_height - y1;
}
}
static void
xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
{
ScrnInfoPtr scrn = crtc->scrn;
ScreenPtr screen = scrn->pScreen;
WindowPtr root = WindowTable[screen->myNum];
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
int error;
PicturePtr src, dst;
PictTransform transform;
int n = REGION_NUM_RECTS(region);
BoxPtr b = REGION_RECTS(region);
XID include_inferiors = IncludeInferiors;
src = CreatePicture (None,
&root->drawable,
format,
CPSubwindowMode,
&include_inferiors,
serverClient,
&error);
if (!src) {
ErrorF("couldn't create src pict\n");
return;
}
dst = CreatePicture (None,
&dst_pixmap->drawable,
format,
0L,
NULL,
serverClient,
&error);
if (!dst) {
ErrorF("couldn't create src pict\n");
return;
}
memset (&transform, '\0', sizeof (transform));
transform.matrix[2][2] = IntToxFixed(1);
transform.matrix[0][2] = IntToxFixed(crtc->x);
transform.matrix[1][2] = IntToxFixed(crtc->y);
switch (crtc->rotation & 0xf) {
default:
case RR_Rotate_0:
transform.matrix[0][0] = IntToxFixed(1);
transform.matrix[1][1] = IntToxFixed(1);
break;
case RR_Rotate_90:
transform.matrix[0][1] = IntToxFixed(-1);
transform.matrix[1][0] = IntToxFixed(1);
transform.matrix[0][2] += IntToxFixed(crtc->mode.VDisplay);
break;
case RR_Rotate_180:
transform.matrix[0][0] = IntToxFixed(-1);
transform.matrix[1][1] = IntToxFixed(-1);
transform.matrix[0][2] += IntToxFixed(crtc->mode.HDisplay);
transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
break;
case RR_Rotate_270:
transform.matrix[0][1] = IntToxFixed(1);
transform.matrix[1][0] = IntToxFixed(-1);
transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
break;
}
/* handle reflection */
if (crtc->rotation & RR_Reflect_X)
{
/* XXX figure this out */
}
if (crtc->rotation & RR_Reflect_Y)
{
/* XXX figure this out too */
}
error = SetPictureTransform (src, &transform);
if (error) {
ErrorF("Couldn't set transform\n");
return;
}
while (n--)
{
BoxRec dst_box;
xf86RotateBox (&dst_box, b, crtc->rotation,
crtc->mode.HDisplay, crtc->mode.VDisplay);
CompositePicture (PictOpSrc,
src, NULL, dst,
dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
dst_box.x2 - dst_box.x1,
dst_box.y2 - dst_box.y1);
b++;
}
FreePicture (src, None);
FreePicture (dst, None);
}
static void
xf86RotateRedisplay(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
DamagePtr damage = xf86_config->rotationDamage;
RegionPtr region;
if (!damage)
return;
region = DamageRegion(damage);
if (REGION_NOTEMPTY(pScreen, region))
{
int c;
for (c = 0; c < xf86_config->num_crtc; c++)
{
xf86CrtcPtr crtc = xf86_config->crtc[c];
if (crtc->rotation != RR_Rotate_0)
{
BoxRec box;
RegionRec crtc_damage;
/* compute portion of damage that overlaps crtc */
box.x1 = crtc->x;
box.x2 = crtc->x + mode_width (&crtc->mode, crtc->rotation);
box.y1 = crtc->y;
box.y2 = crtc->y + mode_height (&crtc->mode, crtc->rotation);
REGION_INIT(pScreen, &crtc_damage, &box, 1);
REGION_INTERSECT (pScreen, &crtc_damage, &crtc_damage, region);
/* update damaged region */
if (REGION_NOTEMPTY(pScreen, &crtc_damage))
xf86RotateCrtcRedisplay (crtc, &crtc_damage);
REGION_UNINIT (pScreen, &crtc_damage);
}
}
DamageEmpty(damage);
}
}
static void
xf86RotateBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
{
ScreenPtr pScreen = (ScreenPtr) data;
xf86RotateRedisplay(pScreen);
}
static void
xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask)
{
}
Bool
xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
{
ScrnInfoPtr pScrn = crtc->scrn;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
ScreenPtr pScreen = pScrn->pScreen;
if (rotation == RR_Rotate_0)
{
/* Free memory from rotation */
if (crtc->rotatedPixmap)
{
crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap);
crtc->rotatedPixmap = NULL;
}
if (xf86_config->rotationDamage)
{
/* Free damage structure */
DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
xf86_config->rotationDamage);
DamageDestroy (xf86_config->rotationDamage);
xf86_config->rotationDamage = NULL;
/* Free block/wakeup handler */
RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler,
xf86RotateWakeupHandler,
(pointer) pScreen);
}
}
else
{
/*
* these are the size of the shadow pixmap, which
* matches the mode, not the pre-rotated copy in the
* frame buffer
*/
int width = mode->HDisplay;
int height = mode->VDisplay;
PixmapPtr shadow = crtc->rotatedPixmap;
int old_width = shadow ? shadow->drawable.width : 0;
int old_height = shadow ? shadow->drawable.height : 0;
BoxRec damage_box;
RegionRec damage_region;
/* Allocate memory for rotation */
if (old_width != width || old_height != height)
{
if (shadow)
{
crtc->funcs->shadow_destroy (crtc, shadow);
crtc->rotatedPixmap = NULL;
}
shadow = crtc->funcs->shadow_create (crtc, width, height);
if (!shadow)
goto bail1;
crtc->rotatedPixmap = shadow;
}
if (!xf86_config->rotationDamage)
{
/* Create damage structure */
xf86_config->rotationDamage = DamageCreate (NULL, NULL,
DamageReportNone,
TRUE, pScreen, pScreen);
if (!xf86_config->rotationDamage)
goto bail2;
/* Hook damage to screen pixmap */
DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
xf86_config->rotationDamage);
/* Assign block/wakeup handler */
if (!RegisterBlockAndWakeupHandlers (xf86RotateBlockHandler,
xf86RotateWakeupHandler,
(pointer) pScreen))
{
goto bail3;
}
damage_box.x1 = 0;
damage_box.y1 = 0;
damage_box.x2 = mode_width (mode, rotation);
damage_box.y2 = mode_height (mode, rotation);
REGION_INIT (pScreen, &damage_region, &damage_box, 1);
DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
&damage_region);
REGION_UNINIT (pScreen, &damage_region);
}
if (0)
{
bail3:
DamageDestroy (xf86_config->rotationDamage);
xf86_config->rotationDamage = NULL;
bail2:
if (shadow)
{
crtc->funcs->shadow_destroy (crtc, shadow);
crtc->rotatedPixmap = NULL;
}
bail1:
if (old_width && old_height)
crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
old_width,
old_height);
return FALSE;
}
}
/* All done */
return TRUE;
}

View File

@ -64,7 +64,7 @@ struct blendinfo {
CARD32 dst_blend;
};
static struct blendinfo I915BlendOp[] = {
static struct blendinfo i915_blend_op[] = {
/* Clear */
{0, 0, BLENDFACT_ZERO, BLENDFACT_ZERO},
/* Src */
@ -93,42 +93,42 @@ static struct blendinfo I915BlendOp[] = {
{0, 0, BLENDFACT_ONE, BLENDFACT_ONE},
};
static struct formatinfo I915TexFormats[] = {
{PICT_a8r8g8b8, MAPSURF_32BIT | MT_32BIT_ARGB8888 },
{PICT_x8r8g8b8, MAPSURF_32BIT | MT_32BIT_XRGB8888 },
{PICT_a8b8g8r8, MAPSURF_32BIT | MT_32BIT_ABGR8888 },
{PICT_x8b8g8r8, MAPSURF_32BIT | MT_32BIT_XBGR8888 },
{PICT_r5g6b5, MAPSURF_16BIT | MT_16BIT_RGB565 },
{PICT_a1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555 },
{PICT_x1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555 },
{PICT_a4r4g4b4, MAPSURF_16BIT | MT_16BIT_ARGB4444 },
{PICT_x4r4g4b4, MAPSURF_16BIT | MT_16BIT_ARGB4444 },
{PICT_a8, MAPSURF_8BIT | MT_8BIT_A8 },
static struct formatinfo i915_tex_formats[] = {
{PICT_a8r8g8b8, MAPSURF_32BIT | MT_32BIT_ARGB8888 },
{PICT_x8r8g8b8, MAPSURF_32BIT | MT_32BIT_XRGB8888 },
{PICT_a8b8g8r8, MAPSURF_32BIT | MT_32BIT_ABGR8888 },
{PICT_x8b8g8r8, MAPSURF_32BIT | MT_32BIT_XBGR8888 },
{PICT_r5g6b5, MAPSURF_16BIT | MT_16BIT_RGB565 },
{PICT_a1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555 },
{PICT_x1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555 },
{PICT_a4r4g4b4, MAPSURF_16BIT | MT_16BIT_ARGB4444 },
{PICT_x4r4g4b4, MAPSURF_16BIT | MT_16BIT_ARGB4444 },
{PICT_a8, MAPSURF_8BIT | MT_8BIT_A8 },
};
static CARD32 I915GetBlendCntl(int op, PicturePtr pMask, CARD32 dst_format)
static CARD32 i915_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format)
{
CARD32 sblend, dblend;
sblend = I915BlendOp[op].src_blend;
dblend = I915BlendOp[op].dst_blend;
sblend = i915_blend_op[op].src_blend;
dblend = i915_blend_op[op].dst_blend;
/* If there's no dst alpha channel, adjust the blend op so that we'll treat
* it as always 1.
*/
if (PICT_FORMAT_A(dst_format) == 0 && I915BlendOp[op].dst_alpha) {
if (PICT_FORMAT_A(dst_format) == 0 && i915_blend_op[op].dst_alpha) {
if (sblend == BLENDFACT_DST_ALPHA)
sblend = BLENDFACT_ONE;
else if (sblend == BLENDFACT_INV_DST_ALPHA)
sblend = BLENDFACT_ZERO;
}
/* If the source alpha is being used, then we should only be in a case where
* the source blend factor is 0, and the source blend value is the mask
* channels multiplied by the source picture's alpha.
/* If the source alpha is being used, then we should only be in a case
* where the source blend factor is 0, and the source blend value is the
* mask channels multiplied by the source picture's alpha.
*/
if (pMask && pMask->componentAlpha && PICT_FORMAT_RGB(pMask->format) &&
I915BlendOp[op].src_alpha)
i915_blend_op[op].src_alpha)
{
if (dblend == BLENDFACT_SRC_ALPHA) {
dblend = BLENDFACT_SRC_COLR;
@ -141,7 +141,7 @@ static CARD32 I915GetBlendCntl(int op, PicturePtr pMask, CARD32 dst_format)
(dblend << S6_CBUF_DST_BLEND_FACT_SHIFT);
}
static Bool I915GetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
static Bool i915_get_dest_format(PicturePtr pDstPicture, CARD32 *dst_format)
{
switch (pDstPicture->format) {
case PICT_a8r8g8b8:
@ -171,13 +171,13 @@ static Bool I915GetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
break;
default:
I830FALLBACK("Unsupported dest format 0x%x\n",
(int)pDstPicture->format);
(int)pDstPicture->format);
}
return TRUE;
}
static Bool I915CheckCompositeTexture(PicturePtr pPict, int unit)
static Bool i915_check_composite_texture(PicturePtr pPict, int unit)
{
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
@ -186,14 +186,15 @@ static Bool I915CheckCompositeTexture(PicturePtr pPict, int unit)
if ((w > 0x7ff) || (h > 0x7ff))
I830FALLBACK("Picture w/h too large (%dx%d)\n", w, h);
for (i = 0; i < sizeof(I915TexFormats) / sizeof(I915TexFormats[0]); i++)
for (i = 0; i < sizeof(i915_tex_formats) / sizeof(i915_tex_formats[0]);
i++)
{
if (I915TexFormats[i].fmt == pPict->format)
if (i915_tex_formats[i].fmt == pPict->format)
break;
}
if (i == sizeof(I915TexFormats) / sizeof(I915TexFormats[0]))
if (i == sizeof(i915_tex_formats) / sizeof(i915_tex_formats[0]))
I830FALLBACK("Unsupported picture format 0x%x\n",
(int)pPict->format);
(int)pPict->format);
if (pPict->repeat && pPict->repeatType != RepeatNormal)
I830FALLBACK("extended repeat (%d) not supported\n",
@ -207,13 +208,13 @@ static Bool I915CheckCompositeTexture(PicturePtr pPict, int unit)
}
Bool
I915EXACheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
i915_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
CARD32 tmp1;
/* Check for unsupported compositing operations. */
if (op >= sizeof(I915BlendOp) / sizeof(I915BlendOp[0]))
if (op >= sizeof(i915_blend_op) / sizeof(i915_blend_op[0]))
I830FALLBACK("Unsupported Composite op 0x%x\n", op);
if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
PICT_FORMAT_RGB(pMaskPicture->format))
@ -222,25 +223,25 @@ I915EXACheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
* the source value. We can only get one of those into the single
* source value that we get to blend with.
*/
if (I915BlendOp[op].src_alpha &&
(I915BlendOp[op].src_blend != BLENDFACT_ZERO))
if (i915_blend_op[op].src_alpha &&
(i915_blend_op[op].src_blend != BLENDFACT_ZERO))
I830FALLBACK("Component alpha not supported with source "
"alpha and source value blending.\n");
"alpha and source value blending.\n");
}
if (!I915CheckCompositeTexture(pSrcPicture, 0))
if (!i915_check_composite_texture(pSrcPicture, 0))
I830FALLBACK("Check Src picture texture\n");
if (pMaskPicture != NULL && !I915CheckCompositeTexture(pMaskPicture, 1))
if (pMaskPicture != NULL && !i915_check_composite_texture(pMaskPicture, 1))
I830FALLBACK("Check Mask picture texture\n");
if (!I915GetDestFormat(pDstPicture, &tmp1))
if (!i915_get_dest_format(pDstPicture, &tmp1))
I830FALLBACK("Get Color buffer format\n");
return TRUE;
}
static Bool
I915TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
{
ScrnInfoPtr pScrn = xf86Screens[pPict->pDrawable->pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@ -248,20 +249,22 @@ I915TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
int w, h, i;
CARD32 wrap_mode = TEXCOORDMODE_CLAMP_BORDER;
offset = exaGetPixmapOffset(pPix);
pitch = exaGetPixmapPitch(pPix);
offset = intel_get_pixmap_offset(pPix);
pitch = intel_get_pixmap_pitch(pPix);
w = pPict->pDrawable->width;
h = pPict->pDrawable->height;
pI830->scale_units[unit][0] = pPix->drawable.width;
pI830->scale_units[unit][1] = pPix->drawable.height;
for (i = 0; i < sizeof(I915TexFormats) / sizeof(I915TexFormats[0]); i++) {
if (I915TexFormats[i].fmt == pPict->format)
for (i = 0; i < sizeof(i915_tex_formats) / sizeof(i915_tex_formats[0]);
i++)
{
if (i915_tex_formats[i].fmt == pPict->format)
break;
}
if (i == sizeof(I915TexFormats)/ sizeof(I915TexFormats[0]))
if (i == sizeof(i915_tex_formats)/ sizeof(i915_tex_formats[0]))
I830FALLBACK("unknown texture format\n");
format = I915TexFormats[i].card_fmt;
format = i915_tex_formats[i].card_fmt;
if (pPict->repeat)
wrap_mode = TEXCOORDMODE_WRAP;
@ -269,11 +272,11 @@ I915TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
switch (pPict->filter) {
case PictFilterNearest:
filter = (FILTER_NEAREST << SS2_MAG_FILTER_SHIFT) |
(FILTER_NEAREST << SS2_MIN_FILTER_SHIFT);
(FILTER_NEAREST << SS2_MIN_FILTER_SHIFT);
break;
case PictFilterBilinear:
filter = (FILTER_LINEAR << SS2_MAG_FILTER_SHIFT) |
(FILTER_LINEAR << SS2_MIN_FILTER_SHIFT);
(FILTER_LINEAR << SS2_MIN_FILTER_SHIFT);
break;
default:
filter = 0;
@ -288,7 +291,8 @@ I915TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
pI830->samplerstate[unit * 3 + 1] |= MS3_USE_FENCE_REGS;
pI830->mapstate[unit * 3 + 2] = ((pitch / 4) - 1) << MS4_PITCH_SHIFT;
pI830->samplerstate[unit * 3 + 0] = (MIPFILTER_NONE << SS2_MIP_FILTER_SHIFT);
pI830->samplerstate[unit * 3 + 0] = (MIPFILTER_NONE <<
SS2_MIP_FILTER_SHIFT);
pI830->samplerstate[unit * 3 + 0] |= filter;
pI830->samplerstate[unit * 3 + 1] = SS3_NORMALIZED_COORDS;
pI830->samplerstate[unit * 3 + 1] |= wrap_mode << SS3_TCX_ADDR_MODE_SHIFT;
@ -296,20 +300,15 @@ I915TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
pI830->samplerstate[unit * 3 + 1] |= unit << SS3_TEXTUREMAP_INDEX_SHIFT;
pI830->samplerstate[unit * 3 + 2] = 0x00000000; /* border color */
if (pPict->transform != 0) {
pI830->is_transform[unit] = TRUE;
pI830->transform[unit] = pPict->transform;
} else {
pI830->is_transform[unit] = FALSE;
}
pI830->transform[unit] = pPict->transform;
return TRUE;
}
Bool
I915EXAPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
i915_prepare_composite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@ -322,18 +321,18 @@ I915EXAPrepareComposite(int op, PicturePtr pSrcPicture,
pI830->last_3d = LAST_3D_RENDER;
I915GetDestFormat(pDstPicture, &dst_format);
dst_offset = exaGetPixmapOffset(pDst);
dst_pitch = exaGetPixmapPitch(pDst);
i915_get_dest_format(pDstPicture, &dst_format);
dst_offset = intel_get_pixmap_offset(pDst);
dst_pitch = intel_get_pixmap_pitch(pDst);
FS_LOCALS(20);
if (!I915TextureSetup(pSrcPicture, pSrc, 0))
if (!i915_texture_setup(pSrcPicture, pSrc, 0))
I830FALLBACK("fail to setup src texture\n");
if (pMask != NULL) {
if (!I915TextureSetup(pMaskPicture, pMask, 1))
I830FALLBACK("fail to setup mask texture\n");
if (!i915_texture_setup(pMaskPicture, pMask, 1))
I830FALLBACK("fail to setup mask texture\n");
} else {
pI830->is_transform[1] = FALSE;
pI830->transform[1] = NULL;
pI830->scale_units[1][0] = -1;
pI830->scale_units[1][1] = -1;
}
@ -404,7 +403,7 @@ I915EXAPrepareComposite(int op, PicturePtr pSrcPicture,
OUT_RING(ss2);
OUT_RING((1 << S4_POINT_WIDTH_SHIFT) | S4_LINE_WIDTH_ONE |
S4_CULLMODE_NONE| S4_VFMT_XY);
blendctl = I915GetBlendCntl(op, pMaskPicture, pDstPicture->format);
blendctl = i915_get_blend_cntl(op, pMaskPicture, pDstPicture->format);
OUT_RING(0x00000000); /* Disable stencil buffer */
OUT_RING(S6_CBUF_BLEND_ENABLE | S6_COLOR_WRITE_ENABLE |
(BLENDFUNC_ADD << S6_CBUF_BLEND_FUNC_SHIFT) | blendctl);
@ -464,7 +463,7 @@ I915EXAPrepareComposite(int op, PicturePtr pSrcPicture,
if (pMaskPicture->componentAlpha &&
PICT_FORMAT_RGB(pMaskPicture->format))
{
if (I915BlendOp[op].src_alpha) {
if (i915_blend_op[op].src_alpha) {
i915_fs_mul(FS_OC, i915_fs_operand(FS_R0, W, W, W, W),
i915_fs_operand_reg(FS_R1));
} else {

View File

@ -39,18 +39,6 @@
#include "i915_reg.h"
#include "i915_3d.h"
union intfloat {
CARD32 ui;
float f;
};
#define OUT_RING_F(x) do { \
union intfloat _tmp; \
_tmp.f = x; \
OUT_RING(_tmp.ui); \
} while (0)
void
I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
RegionPtr dstRegion,

File diff suppressed because it is too large Load Diff

1109
src/i965_render.c Normal file

File diff suppressed because it is too large Load Diff

23
src/local_xf86Rename.h Normal file
View File

@ -0,0 +1,23 @@
/*
* Copyright © 2006 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#define XF86NAME(x) intel_##x

View File

@ -1,17 +0,0 @@
send (1) 0 g6<1>F g1.12<0,1,0>F math inv scalar mlen 1 rlen 1 { align1 };
send (1) 0 g6.4<1>F g1.20<0,1,0>F math inv scalar mlen 1 rlen 1 { align1 };
add (8) g7<1>F g4<8,8,1>F -g3<8,8,1>F { align1 };
mul (1) g7<1>F g7<0,1,0>F g6<0,1,0>F { align1 };
mul (1) g7.4<1>F g7.4<0,1,0>F g6.4<0,1,0>F { align1 };
mov (8) m1<1>F g7<0,1,0>F { align1 };
mov (8) m2<1>F g7.4<0,1,0>F { align1 };
mov (8) m3<1>F g3<8,8,1>F { align1 };
send (8) 0 null g0<8,8,1>F urb 0 transpose used complete mlen 4 rlen 0 { align1 EOT };
nop;
nop;
nop;
nop;
nop;
nop;
nop;
nop;

View File

@ -1,17 +0,0 @@
send (1) 0 g6<1>F g1.20<0,1,0>F math inv scalar mlen 1 rlen 1 { align1 };
send (1) 0 g6.4<1>F g1.12<0,1,0>F math inv scalar mlen 1 rlen 1 { align1 };
add (8) g7<1>F g4<8,8,1>F -g3<8,8,1>F { align1 };
mul (1) g7<1>F g7<0,1,0>F g6<0,1,0>F { align1 };
mul (1) g7.4<1>F g7.4<0,1,0>F g6.4<0,1,0>F { align1 };
mov (8) m1<1>F g7<0,1,0>F { align1 };
mov (8) m2<1>F g7.4<0,1,0>F { align1 };
mov (8) m3<1>F g3<8,8,1>F { align1 };
send (8) 0 null g0<8,8,1>F urb 0 transpose used complete mlen 4 rlen 0 { align1 EOT };
nop;
nop;
nop;
nop;
nop;
nop;
nop;
nop;

View File

@ -1,17 +0,0 @@
{ 0x00000031, 0x20c01fbd, 0x0000002c, 0x01110081 },
{ 0x00000031, 0x20c41fbd, 0x00000034, 0x01110081 },
{ 0x00600040, 0x20e077bd, 0x008d0080, 0x008d4060 },
{ 0x00000041, 0x20e077bd, 0x000000e0, 0x000000c0 },
{ 0x00000041, 0x20e477bd, 0x000000e4, 0x000000c4 },
{ 0x00600001, 0x202003be, 0x000000e0, 0x00000000 },
{ 0x00600001, 0x204003be, 0x000000e4, 0x00000000 },
{ 0x00600001, 0x206003be, 0x008d0060, 0x00000000 },
{ 0x00600031, 0x20001fbc, 0x008d0000, 0x8640c800 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },

View File

@ -1,17 +0,0 @@
{ 0x00000031, 0x20c01fbd, 0x00000034, 0x01110081 },
{ 0x00000031, 0x20c41fbd, 0x0000002c, 0x01110081 },
{ 0x00600040, 0x20e077bd, 0x008d0080, 0x008d4060 },
{ 0x00000041, 0x20e077bd, 0x000000e0, 0x000000c0 },
{ 0x00000041, 0x20e477bd, 0x000000e4, 0x000000c4 },
{ 0x00600001, 0x202003be, 0x000000e0, 0x00000000 },
{ 0x00600001, 0x204003be, 0x000000e4, 0x00000000 },
{ 0x00600001, 0x206003be, 0x008d0060, 0x00000000 },
{ 0x00600031, 0x20001fbc, 0x008d0000, 0x8640c800 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },

View File

@ -1,123 +0,0 @@
/* The initial payload of the thread is always g0.
* WM_URB (incoming URB entries) is g3
* X0_R is g4
* X1_R is g5
* Y0_R is g6
* Y1_R is g7
*/
/* Set up the X/Y screen coordinates of the pixels in our 4 subspans. Each
* subspan is a 2x2 rectangle, and the screen x/y of the upper left of each
* subspan are given in GRF register 1.2 through 1.5 (which, with the word
* addressing below, are 1.4 through 1.11).
*
* The result is WM_X*_R and WM_Y*R being:
*
* X0: {ss0.x, ss0.x+1, ss0.x, ss0.x+1, ss1.x, ss1.x+1, ss1.x, ss1.x+y}
* Y0: {ss0.y, ss0.y, ss0.y+1, ss0.y+1, ss1.y, ss1.y, ss1.y+1, ss1.y+1}
* X1: {ss2.x, ss2.x+1, ss2.x, ss2.x+1, ss3.x, ss3.x+1, ss3.x, ss3.x+y}
* Y1: {ss2.y, ss2.y, ss2.y+1, ss2.y+1, ss3.y, ss3.y, ss3.y+1, ss3.y+1}
*/
/* Set up ss0.x coordinates*/
mov (1) g4<1>F g1.8<0,1,0>UW { align1 };
add (1) g4.4<1>F g1.8<0,1,0>UW 1UB { align1 };
mov (1) g4.8<1>F g1.8<0,1,0>UW { align1 };
add (1) g4.12<1>F g1.8<0,1,0>UW 1UB { align1 };
/* Set up ss0.y coordinates */
mov (1) g6<1>F g1.10<0,1,0>UW { align1 };
mov (1) g6.4<1>F g1.10<0,1,0>UW { align1 };
add (1) g6.8<1>F g1.10<0,1,0>UW 1UB { align1 };
add (1) g6.12<1>F g1.10<0,1,0>UW 1UB { align1 };
/* set up ss1.x coordinates */
mov (1) g4.16<1>F g1.12<0,1,0>UW { align1 };
add (1) g4.20<1>F g1.12<0,1,0>UW 1UB { align1 };
mov (1) g4.24<1>F g1.12<0,1,0>UW { align1 };
add (1) g4.28<1>F g1.12<0,1,0>UW 1UB { align1 };
/* set up ss1.y coordinates */
mov (1) g6.16<1>F g1.14<0,1,0>UW { align1 };
mov (1) g6.20<1>F g1.14<0,1,0>UW { align1 };
add (1) g6.24<1>F g1.14<0,1,0>UW 1UB { align1 };
add (1) g6.28<1>F g1.14<0,1,0>UW 1UB { align1 };
/* Set up ss2.x coordinates */
mov (1) g5<1>F g1.16<0,1,0>UW { align1 };
add (1) g5.4<1>F g1.16<0,1,0>UW 1UB { align1 };
mov (1) g5.8<1>F g1.16<0,1,0>UW { align1 };
add (1) g5.12<1>F g1.16<0,1,0>UW 1UB { align1 };
/* Set up ss2.y coordinates */
mov (1) g7<1>F g1.18<0,1,0>UW { align1 };
mov (1) g7.4<1>F g1.18<0,1,0>UW { align1 };
add (1) g7.8<1>F g1.18<0,1,0>UW 1UB { align1 };
add (1) g7.12<1>F g1.18<0,1,0>UW 1UB { align1 };
/* Set up ss3.x coordinates */
mov (1) g5.16<1>F g1.20<0,1,0>UW { align1 };
add (1) g5.20<1>F g1.20<0,1,0>UW 1UB { align1 };
mov (1) g5.24<1>F g1.20<0,1,0>UW { align1 };
add (1) g5.28<1>F g1.20<0,1,0>UW 1UB { align1 };
/* Set up ss3.y coordinates */
mov (1) g7.16<1>F g1.22<0,1,0>UW { align1 };
mov (1) g7.20<1>F g1.22<0,1,0>UW { align1 };
add (1) g7.24<1>F g1.22<0,1,0>UW 1UB { align1 };
add (1) g7.28<1>F g1.22<0,1,0>UW 1UB { align1 };
/* Now, map these screen space coordinates into texture coordinates. */
/* subtract screen-space X origin of vertex 0. */
add (8) g4<1>F g4<8,8,1>F -g1<0,1,0>F { align1 };
add (8) g5<1>F g5<8,8,1>F -g1<0,1,0>F { align1 };
/* scale by texture X increment */
mul (8) g4<1>F g4<8,8,1>F g3<0,1,0>F { align1 };
mul (8) g5<1>F g5<8,8,1>F g3<0,1,0>F { align1 };
/* add in texture X offset */
add (8) g4<1>F g4<8,8,1>F g3.12<0,1,0>F { align1 };
add (8) g5<1>F g5<8,8,1>F g3.12<0,1,0>F { align1 };
/* subtract screen-space Y origin of vertex 0. */
add (8) g6<1>F g6<8,8,1>F -g1.4<0,1,0>F { align1 };
add (8) g7<1>F g7<8,8,1>F -g1.4<0,1,0>F { align1 };
/* scale by texture Y increment */
/* XXX: double check the fields in Cx,Cy,Co and attributes*/
mul (8) g6<1>F g6<8,8,1>F g3.20<0,1,0>F { align1 };
mul (8) g7<1>F g7<8,8,1>F g3.20<0,1,0>F { align1 };
/* add in texture Y offset */
add (8) g6<1>F g6<8,8,1>F g3.28<0,1,0>F { align1 };
add (8) g7<1>F g7<8,8,1>F g3.28<0,1,0>F { align1 };
/* sampler */
mov (8) m1<1>F g4<8,8,1>F { align1 };
mov (8) m2<1>F g5<8,8,1>F { align1 };
mov (8) m3<1>F g6<8,8,1>F { align1 };
mov (8) m4<1>F g7<8,8,1>F { align1 };
/*
* g0 holds the PS thread payload, which (oddly) contains
* precisely what the sampler wants to see in m0
*/
send (16) 0 g12<1>UW g0<8,8,1>UW sampler (1,0,F) mlen 5 rlen 8 { align1 };
mov (8) g19<1>UD g19<8,8,1>UD { align1 };
mov (8) m2<1>F g12<8,8,1>F { align1 };
mov (8) m3<1>F g14<8,8,1>F { align1 };
mov (8) m4<1>F g16<8,8,1>F { align1 };
mov (8) m5<1>F g18<8,8,1>F { align1 };
mov (8) m6<1>F g13<8,8,1>F { align1 };
mov (8) m7<1>F g15<8,8,1>F { align1 };
mov (8) m8<1>F g17<8,8,1>F { align1 };
mov (8) m9<1>F g19<8,8,1>F { align1 };
/* Pass through control information:
*/
mov (8) m1<1>UD g1<8,8,1>UD { align1 mask_disable };
/* Send framebuffer write message: XXX: acc0? */
send (16) 0 acc0<1>UW g0<8,8,1>UW write (
0, /* binding table index 0 */
8, /* pixel scoreboard clear */
4, /* render target write */
0 /* no write commit message */
) mlen 10 rlen 0 { align1 EOT };
/* padding */
nop;
nop;
nop;
nop;
nop;
nop;
nop;
nop;

View File

@ -1,127 +0,0 @@
/* The initial payload of the thread is always g0.
* WM_URB (incoming URB entries) is g3
* X0_R is g4
* X1_R is g5
* Y0_R is g6
* Y1_R is g7
*/
/* Set up the X/Y screen coordinates of the pixels in our 4 subspans. Each
* subspan is a 2x2 rectangle, and the screen x/y of the upper left of each
* subspan are given in GRF register 1.2 through 1.5 (which, with the word
* addressing below, are 1.4 through 1.11).
*
* The result is WM_X*_R and WM_Y*R being:
*
* X0: {ss0.x, ss0.x+1, ss0.x, ss0.x+1, ss1.x, ss1.x+1, ss1.x, ss1.x+y}
* Y0: {ss0.y, ss0.y, ss0.y+1, ss0.y+1, ss1.y, ss1.y, ss1.y+1, ss1.y+1}
* X1: {ss2.x, ss2.x+1, ss2.x, ss2.x+1, ss3.x, ss3.x+1, ss3.x, ss3.x+y}
* Y1: {ss2.y, ss2.y, ss2.y+1, ss2.y+1, ss3.y, ss3.y, ss3.y+1, ss3.y+1}
*/
/* Set up ss0.x coordinates*/
mov (1) g4<1>F g1.8<0,1,0>UW { align1 };
add (1) g4.4<1>F g1.8<0,1,0>UW 1UB { align1 };
mov (1) g4.8<1>F g1.8<0,1,0>UW { align1 };
add (1) g4.12<1>F g1.8<0,1,0>UW 1UB { align1 };
/* Set up ss0.y coordinates */
mov (1) g6<1>F g1.10<0,1,0>UW { align1 };
mov (1) g6.4<1>F g1.10<0,1,0>UW { align1 };
add (1) g6.8<1>F g1.10<0,1,0>UW 1UB { align1 };
add (1) g6.12<1>F g1.10<0,1,0>UW 1UB { align1 };
/* set up ss1.x coordinates */
mov (1) g4.16<1>F g1.12<0,1,0>UW { align1 };
add (1) g4.20<1>F g1.12<0,1,0>UW 1UB { align1 };
mov (1) g4.24<1>F g1.12<0,1,0>UW { align1 };
add (1) g4.28<1>F g1.12<0,1,0>UW 1UB { align1 };
/* set up ss1.y coordinates */
mov (1) g6.16<1>F g1.14<0,1,0>UW { align1 };
mov (1) g6.20<1>F g1.14<0,1,0>UW { align1 };
add (1) g6.24<1>F g1.14<0,1,0>UW 1UB { align1 };
add (1) g6.28<1>F g1.14<0,1,0>UW 1UB { align1 };
/* Set up ss2.x coordinates */
mov (1) g5<1>F g1.16<0,1,0>UW { align1 };
add (1) g5.4<1>F g1.16<0,1,0>UW 1UB { align1 };
mov (1) g5.8<1>F g1.16<0,1,0>UW { align1 };
add (1) g5.12<1>F g1.16<0,1,0>UW 1UB { align1 };
/* Set up ss2.y coordinates */
mov (1) g7<1>F g1.18<0,1,0>UW { align1 };
mov (1) g7.4<1>F g1.18<0,1,0>UW { align1 };
add (1) g7.8<1>F g1.18<0,1,0>UW 1UB { align1 };
add (1) g7.12<1>F g1.18<0,1,0>UW 1UB { align1 };
/* Set up ss3.x coordinates */
mov (1) g5.16<1>F g1.20<0,1,0>UW { align1 };
add (1) g5.20<1>F g1.20<0,1,0>UW 1UB { align1 };
mov (1) g5.24<1>F g1.20<0,1,0>UW { align1 };
add (1) g5.28<1>F g1.20<0,1,0>UW 1UB { align1 };
/* Set up ss3.y coordinates */
mov (1) g7.16<1>F g1.22<0,1,0>UW { align1 };
mov (1) g7.20<1>F g1.22<0,1,0>UW { align1 };
add (1) g7.24<1>F g1.22<0,1,0>UW 1UB { align1 };
add (1) g7.28<1>F g1.22<0,1,0>UW 1UB { align1 };
/* Now, map these screen space coordinates into texture coordinates. */
/* XXX: convert it to calculate (u,v) in 90 and 270 case */
/* subtract screen-space Y origin of vertex 0. */
add (8) g6<1>F g6<8,8,1>F -g1.4<0,1,0>F { align1 };
add (8) g7<1>F g7<8,8,1>F -g1.4<0,1,0>F { align1 };
/* (Yp - Ystart) * Cx */
mul (8) g6<1>F g6<8,8,1>F g3<0,1,0>F { align1 };
mul (8) g7<1>F g7<8,8,1>F g3<0,1,0>F { align1 };
/* scale by texture Y increment */
add (8) g6<1>F g6<8,8,1>F g3.12<0,1,0>F { align1 };
add (8) g7<1>F g7<8,8,1>F g3.12<0,1,0>F { align1 };
/* subtract screen-space X origin of vertex 0. */
add (8) g4<1>F g4<8,8,1>F -g1<0,1,0>F { align1 };
add (8) g5<1>F g5<8,8,1>F -g1<0,1,0>F { align1 };
/* scale by texture X increment */
mul (8) g4<1>F g4<8,8,1>F g3.20<0,1,0>F { align1 };
mul (8) g5<1>F g5<8,8,1>F g3.20<0,1,0>F { align1 };
/* add in texture X offset */
add (8) g4<1>F g4<8,8,1>F g3.28<0,1,0>F { align1 };
add (8) g5<1>F g5<8,8,1>F g3.28<0,1,0>F { align1 };
/* sampler */
mov (8) m1<1>F g6<8,8,1>F { align1 };
mov (8) m2<1>F g7<8,8,1>F { align1 };
mov (8) m3<1>F g4<8,8,1>F { align1 };
mov (8) m4<1>F g5<8,8,1>F { align1 };
/*
* g0 holds the PS thread payload, which (oddly) contains
* precisely what the sampler wants to see in m0
*/
send (16) 0 g12<1>UW g0<8,8,1>UW sampler (1,0,F) mlen 5 rlen 8 { align1 };
mov (8) g19<1>UD g19<8,8,1>UD { align1 };
mov (8) m2<1>F g12<8,8,1>F { align1 };
mov (8) m3<1>F g14<8,8,1>F { align1 };
mov (8) m4<1>F g16<8,8,1>F { align1 };
mov (8) m5<1>F g18<8,8,1>F { align1 };
mov (8) m6<1>F g13<8,8,1>F { align1 };
mov (8) m7<1>F g15<8,8,1>F { align1 };
mov (8) m8<1>F g17<8,8,1>F { align1 };
mov (8) m9<1>F g19<8,8,1>F { align1 };
/* Pass through control information:
*/
mov (8) m1<1>UD g1<8,8,1>UD { align1 mask_disable };
/* Send framebuffer write message: XXX: acc0? */
send (16) 0 acc0<1>UW g0<8,8,1>UW write (
0, /* binding table index 0 */
8, /* pixel scoreboard clear */
4, /* render target write */
0 /* no write commit message */
) mlen 10 rlen 0 { align1 EOT };
/* padding */
nop;
nop;
nop;
nop;
nop;
nop;
nop;
nop;

View File

@ -1,68 +0,0 @@
{ 0x00000001, 0x2080013d, 0x00000028, 0x00000000 },
{ 0x00000040, 0x20840d3d, 0x00000028, 0x00000001 },
{ 0x00000001, 0x2088013d, 0x00000028, 0x00000000 },
{ 0x00000040, 0x208c0d3d, 0x00000028, 0x00000001 },
{ 0x00000001, 0x20c0013d, 0x0000002a, 0x00000000 },
{ 0x00000001, 0x20c4013d, 0x0000002a, 0x00000000 },
{ 0x00000040, 0x20c80d3d, 0x0000002a, 0x00000001 },
{ 0x00000040, 0x20cc0d3d, 0x0000002a, 0x00000001 },
{ 0x00000001, 0x2090013d, 0x0000002c, 0x00000000 },
{ 0x00000040, 0x20940d3d, 0x0000002c, 0x00000001 },
{ 0x00000001, 0x2098013d, 0x0000002c, 0x00000000 },
{ 0x00000040, 0x209c0d3d, 0x0000002c, 0x00000001 },
{ 0x00000001, 0x20d0013d, 0x0000002e, 0x00000000 },
{ 0x00000001, 0x20d4013d, 0x0000002e, 0x00000000 },
{ 0x00000040, 0x20d80d3d, 0x0000002e, 0x00000001 },
{ 0x00000040, 0x20dc0d3d, 0x0000002e, 0x00000001 },
{ 0x00000001, 0x20a0013d, 0x00000030, 0x00000000 },
{ 0x00000040, 0x20a40d3d, 0x00000030, 0x00000001 },
{ 0x00000001, 0x20a8013d, 0x00000030, 0x00000000 },
{ 0x00000040, 0x20ac0d3d, 0x00000030, 0x00000001 },
{ 0x00000001, 0x20e0013d, 0x00000032, 0x00000000 },
{ 0x00000001, 0x20e4013d, 0x00000032, 0x00000000 },
{ 0x00000040, 0x20e80d3d, 0x00000032, 0x00000001 },
{ 0x00000040, 0x20ec0d3d, 0x00000032, 0x00000001 },
{ 0x00000001, 0x20b0013d, 0x00000034, 0x00000000 },
{ 0x00000040, 0x20b40d3d, 0x00000034, 0x00000001 },
{ 0x00000001, 0x20b8013d, 0x00000034, 0x00000000 },
{ 0x00000040, 0x20bc0d3d, 0x00000034, 0x00000001 },
{ 0x00000001, 0x20f0013d, 0x00000036, 0x00000000 },
{ 0x00000001, 0x20f4013d, 0x00000036, 0x00000000 },
{ 0x00000040, 0x20f80d3d, 0x00000036, 0x00000001 },
{ 0x00000040, 0x20fc0d3d, 0x00000036, 0x00000001 },
{ 0x00600040, 0x208077bd, 0x008d0080, 0x00004020 },
{ 0x00600040, 0x20a077bd, 0x008d00a0, 0x00004020 },
{ 0x00600041, 0x208077bd, 0x008d0080, 0x00000060 },
{ 0x00600041, 0x20a077bd, 0x008d00a0, 0x00000060 },
{ 0x00600040, 0x208077bd, 0x008d0080, 0x0000006c },
{ 0x00600040, 0x20a077bd, 0x008d00a0, 0x0000006c },
{ 0x00600040, 0x20c077bd, 0x008d00c0, 0x00004024 },
{ 0x00600040, 0x20e077bd, 0x008d00e0, 0x00004024 },
{ 0x00600041, 0x20c077bd, 0x008d00c0, 0x00000074 },
{ 0x00600041, 0x20e077bd, 0x008d00e0, 0x00000074 },
{ 0x00600040, 0x20c077bd, 0x008d00c0, 0x0000007c },
{ 0x00600040, 0x20e077bd, 0x008d00e0, 0x0000007c },
{ 0x00600001, 0x202003be, 0x008d0080, 0x00000000 },
{ 0x00600001, 0x204003be, 0x008d00a0, 0x00000000 },
{ 0x00600001, 0x206003be, 0x008d00c0, 0x00000000 },
{ 0x00600001, 0x208003be, 0x008d00e0, 0x00000000 },
{ 0x00800031, 0x21801d29, 0x008d0000, 0x02580001 },
{ 0x00600001, 0x22600021, 0x008d0260, 0x00000000 },
{ 0x00600001, 0x204003be, 0x008d0180, 0x00000000 },
{ 0x00600001, 0x206003be, 0x008d01c0, 0x00000000 },
{ 0x00600001, 0x208003be, 0x008d0200, 0x00000000 },
{ 0x00600001, 0x20a003be, 0x008d0240, 0x00000000 },
{ 0x00600001, 0x20c003be, 0x008d01a0, 0x00000000 },
{ 0x00600001, 0x20e003be, 0x008d01e0, 0x00000000 },
{ 0x00600001, 0x210003be, 0x008d0220, 0x00000000 },
{ 0x00600001, 0x212003be, 0x008d0260, 0x00000000 },
{ 0x00600201, 0x20200022, 0x008d0020, 0x00000000 },
{ 0x00800031, 0x24001d28, 0x008d0000, 0x85a04800 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },

View File

@ -1,68 +0,0 @@
{ 0x00000001, 0x2080013d, 0x00000028, 0x00000000 },
{ 0x00000040, 0x20840d3d, 0x00000028, 0x00000001 },
{ 0x00000001, 0x2088013d, 0x00000028, 0x00000000 },
{ 0x00000040, 0x208c0d3d, 0x00000028, 0x00000001 },
{ 0x00000001, 0x20c0013d, 0x0000002a, 0x00000000 },
{ 0x00000001, 0x20c4013d, 0x0000002a, 0x00000000 },
{ 0x00000040, 0x20c80d3d, 0x0000002a, 0x00000001 },
{ 0x00000040, 0x20cc0d3d, 0x0000002a, 0x00000001 },
{ 0x00000001, 0x2090013d, 0x0000002c, 0x00000000 },
{ 0x00000040, 0x20940d3d, 0x0000002c, 0x00000001 },
{ 0x00000001, 0x2098013d, 0x0000002c, 0x00000000 },
{ 0x00000040, 0x209c0d3d, 0x0000002c, 0x00000001 },
{ 0x00000001, 0x20d0013d, 0x0000002e, 0x00000000 },
{ 0x00000001, 0x20d4013d, 0x0000002e, 0x00000000 },
{ 0x00000040, 0x20d80d3d, 0x0000002e, 0x00000001 },
{ 0x00000040, 0x20dc0d3d, 0x0000002e, 0x00000001 },
{ 0x00000001, 0x20a0013d, 0x00000030, 0x00000000 },
{ 0x00000040, 0x20a40d3d, 0x00000030, 0x00000001 },
{ 0x00000001, 0x20a8013d, 0x00000030, 0x00000000 },
{ 0x00000040, 0x20ac0d3d, 0x00000030, 0x00000001 },
{ 0x00000001, 0x20e0013d, 0x00000032, 0x00000000 },
{ 0x00000001, 0x20e4013d, 0x00000032, 0x00000000 },
{ 0x00000040, 0x20e80d3d, 0x00000032, 0x00000001 },
{ 0x00000040, 0x20ec0d3d, 0x00000032, 0x00000001 },
{ 0x00000001, 0x20b0013d, 0x00000034, 0x00000000 },
{ 0x00000040, 0x20b40d3d, 0x00000034, 0x00000001 },
{ 0x00000001, 0x20b8013d, 0x00000034, 0x00000000 },
{ 0x00000040, 0x20bc0d3d, 0x00000034, 0x00000001 },
{ 0x00000001, 0x20f0013d, 0x00000036, 0x00000000 },
{ 0x00000001, 0x20f4013d, 0x00000036, 0x00000000 },
{ 0x00000040, 0x20f80d3d, 0x00000036, 0x00000001 },
{ 0x00000040, 0x20fc0d3d, 0x00000036, 0x00000001 },
{ 0x00600040, 0x20c077bd, 0x008d00c0, 0x00004024 },
{ 0x00600040, 0x20e077bd, 0x008d00e0, 0x00004024 },
{ 0x00600041, 0x20c077bd, 0x008d00c0, 0x00000060 },
{ 0x00600041, 0x20e077bd, 0x008d00e0, 0x00000060 },
{ 0x00600040, 0x20c077bd, 0x008d00c0, 0x0000006c },
{ 0x00600040, 0x20e077bd, 0x008d00e0, 0x0000006c },
{ 0x00600040, 0x208077bd, 0x008d0080, 0x00004020 },
{ 0x00600040, 0x20a077bd, 0x008d00a0, 0x00004020 },
{ 0x00600041, 0x208077bd, 0x008d0080, 0x00000074 },
{ 0x00600041, 0x20a077bd, 0x008d00a0, 0x00000074 },
{ 0x00600040, 0x208077bd, 0x008d0080, 0x0000007c },
{ 0x00600040, 0x20a077bd, 0x008d00a0, 0x0000007c },
{ 0x00600001, 0x202003be, 0x008d00c0, 0x00000000 },
{ 0x00600001, 0x204003be, 0x008d00e0, 0x00000000 },
{ 0x00600001, 0x206003be, 0x008d0080, 0x00000000 },
{ 0x00600001, 0x208003be, 0x008d00a0, 0x00000000 },
{ 0x00800031, 0x21801d29, 0x008d0000, 0x02580001 },
{ 0x00600001, 0x22600021, 0x008d0260, 0x00000000 },
{ 0x00600001, 0x204003be, 0x008d0180, 0x00000000 },
{ 0x00600001, 0x206003be, 0x008d01c0, 0x00000000 },
{ 0x00600001, 0x208003be, 0x008d0200, 0x00000000 },
{ 0x00600001, 0x20a003be, 0x008d0240, 0x00000000 },
{ 0x00600001, 0x20c003be, 0x008d01a0, 0x00000000 },
{ 0x00600001, 0x20e003be, 0x008d01e0, 0x00000000 },
{ 0x00600001, 0x210003be, 0x008d0220, 0x00000000 },
{ 0x00600001, 0x212003be, 0x008d0260, 0x00000000 },
{ 0x00600201, 0x20200022, 0x008d0020, 0x00000000 },
{ 0x00800031, 0x24001d28, 0x008d0000, 0x85a04800 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },