summaryrefslogtreecommitdiff
path: root/src/i830_memory.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-01-17 16:01:18 -0800
committerEric Anholt <eric@anholt.net>2007-01-17 16:05:55 -0800
commitf256243fff195f73bc8aa72e8dd2c6f7b33446cf (patch)
treecb75b9c7e13edf6865b8d9210402033a27c8cd61 /src/i830_memory.c
parentd17c386aee55bd223297adf78cf0fc1db43baf2d (diff)
downloadxorg-driver-xf86-video-intel-f256243fff195f73bc8aa72e8dd2c6f7b33446cf.tar.gz
Allocate per-crtc rotation buffers and hook up RandR 1.2 per-CRTC rotation.
It currently displays garbage.
Diffstat (limited to 'src/i830_memory.c')
-rw-r--r--src/i830_memory.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 426242a9..ae14c06c 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -769,6 +769,63 @@ I830AllocateFramebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
return TRUE;
}
+/**
+ * Allocates memory for the rotated shadow buffers.
+ *
+ * This memory would be better allocated normally through the linear allocator,
+ * but it gets rotation working for now.
+ */
+static Bool
+I830AllocateRotateBuffers(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);
+ unsigned long avail, lineSize;
+ int verbosity = dryrun ? 4 : 1;
+ const char *s = dryrun ? "[dryrun] " : "";
+ int align, alignflags;
+ long size, alloced;
+ int rotate_width, rotate_height;
+
+ memset(&intel_crtc->rotate_mem, 0, sizeof(intel_crtc->rotate_mem));
+
+ rotate_width = pScrn->displayWidth;
+ if (pScrn->virtualX > pScrn->virtualY)
+ rotate_height = pScrn->virtualX;
+ else
+ rotate_height = pScrn->virtualY;
+
+ lineSize = pScrn->displayWidth * pI830->cpp;
+ avail = pScrn->videoRam * 1024;
+
+ align = KB(64);
+ alignflags = 0;
+
+ size = lineSize * rotate_height;
+ size = ROUND_TO_PAGE(size);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
+ "%sInitial %sshadow framebuffer allocation size: "
+ "%ld kByte\n",
+ s, (intel_crtc->pipe == 0) ? "" : "secondary ",
+ size / 1024);
+ alloced = I830AllocVidMem(pScrn, &intel_crtc->rotate_mem,
+ &pI830->StolenPool, size, align,
+ flags | alignflags |
+ FROM_ANYWHERE | ALLOCATE_AT_BOTTOM);
+ if (alloced < size) {
+ if (!dryrun) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to allocate "
+ "%sshadow framebuffer. Is your VideoRAM set too low?\n",
+ (intel_crtc->pipe == 0) ? "" : "secondary ");
+ }
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/*
* Allocate memory for 2D operation. This includes the (front) framebuffer,
* ring buffer, scratch memory, HW cursor.
@@ -782,7 +839,7 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
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,6 +871,7 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
pI830->StolenPool.Free.Size);
if (flags & ALLOC_INITIAL) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
if (pI830->NeedRingBufferLow)
AllocateRingBuffer(pScrn, flags | FORCE_LOW);
@@ -839,6 +897,10 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
return FALSE;
}
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ I830AllocateRotateBuffers(xf86_config->crtc[i], flags);
+ }
+
#ifdef I830_USE_EXA
if (pI830->useEXA) {
/* Default EXA to having 3 screens worth of offscreen memory space