summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Barnes <jesse.barnes@intel.com>2007-07-06 16:10:52 -0700
committerJesse Barnes <jesse.barnes@intel.com>2007-07-06 16:10:52 -0700
commitca593a5219549df94a6d234ebbcf9e7c44723c9b (patch)
treeadc394d8f2005d975abb43b5aeaa038773ca5d54 /src
parent8798ef11321ee6957919279076758d47ad956cf3 (diff)
FBC and tiling changes
- change framebuffer option name to "FramebufferCompression" - add new "Tiling" option (controls all tiling, not just front buffer) - add debug message to fb compression enable/disable routines - update man page with new options
Diffstat (limited to 'src')
-rw-r--r--src/i830.h18
-rw-r--r--src/i830_display.c4
-rw-r--r--src/i830_driver.c38
-rw-r--r--src/i830_memory.c8
-rw-r--r--src/i915_render.c2
-rw-r--r--src/i915_video.c8
6 files changed, 59 insertions, 19 deletions
diff --git a/src/i830.h b/src/i830.h
index 1358e3ee..4748b815 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -343,7 +343,7 @@ typedef struct _I830Rec {
Bool NeedRingBufferLow;
Bool allowPageFlip;
Bool TripleBuffer;
- Bool disableTiling;
+ Bool tiling;
Bool fb_compression;
int backPitch;
@@ -718,6 +718,22 @@ i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform,
void i830_enter_render(ScrnInfoPtr);
+static inline int i830_tiling_supported(I830Ptr pI830)
+{
+ if (IS_I965G(pI830))
+ return FALSE;
+ return TRUE;
+}
+
+static inline int i830_fb_compression_supported(I830Ptr pI830)
+{
+ if (!IS_MOBILE(pI830))
+ return FALSE;
+ if (IS_I810(pI830) || IS_I815(pI830) || IS_I830(pI830))
+ return FALSE;
+ return TRUE;
+}
+
extern const int I830PatternROP[16];
extern const int I830CopyROP[16];
diff --git a/src/i830_display.c b/src/i830_display.c
index 0befef9d..c79676da 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -728,6 +728,9 @@ i830_enable_fb_compression(xf86CrtcPtr crtc)
fbc_ctl |= (compressed_stride & 0xff) << FBC_CTL_STRIDE_SHIFT;
fbc_ctl |= (interval & 0x2fff) << FBC_CTL_INTERVAL_SHIFT;
OUTREG(FBC_CONTROL, fbc_ctl);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc enabled on pipe %c\n", pipe ?
+ "a" : "b");
}
static void
@@ -745,6 +748,7 @@ i830_disable_fb_compression(xf86CrtcPtr crtc)
/* Wait for compressing bit to clear */
while (INREG(FBC_STATUS) & FBC_STAT_COMPRESSING)
; /* nothing */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc disabled\n");
}
static void
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 5f934fee..a380971a 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -287,6 +287,7 @@ typedef enum {
OPTION_CHECKDEVICES,
OPTION_MODEDEBUG,
OPTION_FBC,
+ OPTION_TILING,
#ifdef XF86DRI_MM
OPTION_INTELTEXPOOL,
OPTION_INTELMMSIZE,
@@ -308,7 +309,8 @@ static OptionInfoRec I830Options[] = {
{OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE},
{OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_FBC, "FrameBufferCompression", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_FBC, "FramebufferCompression", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_TILING, "Tiling", OPTV_BOOLEAN, {0}, TRUE},
#ifdef XF86DRI_MM
{OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE},
@@ -2318,12 +2320,34 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->CacheLines = -1;
}
- if (xf86ReturnOptValBool(pI830->Options, OPTION_FBC, FALSE))
+ /* Enable tiling by default where supported or if the user forced it on */
+ if (i830_tiling_supported(pI830))
+ pI830->tiling = TRUE;
+ else
+ pI830->tiling = FALSE;
+
+ if (xf86ReturnOptValBool(pI830->Options, OPTION_TILING, FALSE))
+ pI830->tiling = TRUE;
+
+ /* Enable FB compression if possible */
+ if (i830_fb_compression_supported(pI830))
pI830->fb_compression = TRUE;
else
pI830->fb_compression = FALSE;
+ /* ... but disable if requested */
+ if (!xf86ReturnOptValBool(pI830->Options, OPTION_FBC, TRUE))
+ pI830->fb_compression = FALSE;
- pI830->disableTiling = FALSE;
+ if (pI830->fb_compression) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Framebuffer compression enabled, "
+ "forcing tiling on.\n");
+ pI830->tiling = TRUE;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Framebuffer compression %sabled\n",
+ pI830->fb_compression ? "en" : "dis");
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Tiling %sabled\n", pI830->tiling ?
+ "en" : "dis");
if (I830IsPrimary(pScrn)) {
/* Alloc our pointers for the primary head */
@@ -2413,7 +2437,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* 3: untiled, small
*/
- pI830->disableTiling = FALSE;
#ifdef XF86DRI_MM
savedMMSize = pI830->mmSize;
#define MM_TURNS 4
@@ -2426,7 +2449,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (i >= MM_TURNS/2) {
/* For further allocations, disable tiling */
- pI830->disableTiling = TRUE;
+ pI830->tiling = FALSE;
pScrn->displayWidth = savedDisplayWidth;
if (pI830->allowPageFlip)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -2481,9 +2504,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#endif
pI830->directRenderingDisabled = TRUE;
}
- } else
+ }
#endif
- pI830->disableTiling = TRUE; /* no DRI - so disableTiling */
if (!allocation_done) {
if (!i830_allocate_2d_memory(pScrn)) {
@@ -2501,7 +2523,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!IS_I965G(pI830) && pScrn->displayWidth > 2048) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Cannot support DRI with frame buffer width > 2048.\n");
- pI830->disableTiling = TRUE;
+ pI830->tiling = FALSE;
pI830->directRenderingDisabled = TRUE;
}
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 71346004..a589738d 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -903,9 +903,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
name = secondary ? "secondary front buffer" : "front buffer";
/* Attempt to allocate it tiled first if we have page flipping on. */
- if ((!pI830->disableTiling && pI830->allowPageFlip &&
- IsTileable(pScrn, pitch)) || pI830->fb_compression)
- {
+ if (pI830->tiling && IsTileable(pScrn, pitch)) {
/* XXX: probably not the case on 965 */
if (IS_I9XX(pI830))
align = MB(1);
@@ -1253,7 +1251,7 @@ i830_allocate_backbuffer(ScrnInfoPtr pScrn, i830_memory **buffer,
height = pScrn->virtualX;
/* Try to allocate on the best tile-friendly boundaries. */
- if (!pI830->disableTiling && IsTileable(pScrn, pitch))
+ if (pI830->tiling && IsTileable(pScrn, pitch))
{
size = ROUND_TO_PAGE(pitch * ALIGN(height, 16));
*buffer = i830_allocate_memory_tiled(pScrn, name, size, pitch,
@@ -1294,7 +1292,7 @@ i830_allocate_depthbuffer(ScrnInfoPtr pScrn)
height = pScrn->virtualX;
/* First try allocating it tiled */
- if (!pI830->disableTiling && IsTileable(pScrn, pitch))
+ if (pI830->tiling && IsTileable(pScrn, pitch))
{
enum tile_format tile_format;
diff --git a/src/i915_render.c b/src/i915_render.c
index b2dacfe7..2148883a 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -287,7 +287,7 @@ i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
pI830->mapstate[unit * 3 + 1] = format |
((pPix->drawable.height - 1) << MS3_HEIGHT_SHIFT) |
((pPix->drawable.width - 1) << MS3_WIDTH_SHIFT);
- if (!pI830->disableTiling)
+ if (pI830->tiling)
pI830->samplerstate[unit * 3 + 1] |= MS3_USE_FENCE_REGS;
pI830->mapstate[unit * 3 + 2] = ((pitch / 4) - 1) << MS4_PITCH_SHIFT;
diff --git a/src/i915_video.c b/src/i915_video.c
index f1bf4ccb..e116fe23 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -160,7 +160,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
}
ms3 |= (height - 1) << MS3_HEIGHT_SHIFT;
ms3 |= (width - 1) << MS3_WIDTH_SHIFT;
- if (!pI830->disableTiling)
+ if (pI830->tiling)
ms3 |= MS3_USE_FENCE_REGS;
OUT_RING(ms3);
OUT_RING(((video_pitch / 4) - 1) << MS4_PITCH_SHIFT);
@@ -251,7 +251,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
ms3 = MAPSURF_8BIT | MT_8BIT_I8;
ms3 |= (height - 1) << MS3_HEIGHT_SHIFT;
ms3 |= (width - 1) << MS3_WIDTH_SHIFT;
- if (!pI830->disableTiling)
+ if (pI830->tiling)
ms3 |= MS3_USE_FENCE_REGS;
OUT_RING(ms3);
OUT_RING(((video_pitch * 2 / 4) - 1) << MS4_PITCH_SHIFT);
@@ -260,7 +260,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
ms3 = MAPSURF_8BIT | MT_8BIT_I8;
ms3 |= (height / 2 - 1) << MS3_HEIGHT_SHIFT;
ms3 |= (width / 2 - 1) << MS3_WIDTH_SHIFT;
- if (!pI830->disableTiling)
+ if (pI830->tiling)
ms3 |= MS3_USE_FENCE_REGS;
OUT_RING(ms3);
OUT_RING(((video_pitch / 4) - 1) << MS4_PITCH_SHIFT);
@@ -269,7 +269,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
ms3 = MAPSURF_8BIT | MT_8BIT_I8;
ms3 |= (height / 2 - 1) << MS3_HEIGHT_SHIFT;
ms3 |= (width / 2 - 1) << MS3_WIDTH_SHIFT;
- if (!pI830->disableTiling)
+ if (pI830->tiling)
ms3 |= MS3_USE_FENCE_REGS;
OUT_RING(ms3);
OUT_RING(((video_pitch / 4) - 1) << MS4_PITCH_SHIFT);