xf86-video-intel: 3 commits - src/i830_cursor.c src/i830_dri.c src/i830.h src/i830_memory.c
Keith Packard
keithp at kemper.freedesktop.org
Sun Mar 18 06:33:45 EET 2007
src/i830.h | 5 ++++-
src/i830_cursor.c | 2 +-
src/i830_dri.c | 13 ++++++++++---
src/i830_memory.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 62 insertions(+), 7 deletions(-)
New commits:
diff-tree 9118122a232d4cf7760bcb0874fe970c25251378 (from 62a5399d70ac3f8579441d617f8d80c94942a32a)
Author: Keith Packard <keithp at guitar.keithp.com>
Date: Sat Mar 17 21:34:03 2007 -0700
Allocate 4 separate buffers for HW Cursors on Linux.
Linux cannot allocate a large fixed buffer for the HW cursors as needed for
FreeBSD; instead, allocate four separate buffers. The code now prefers to
allocate one buffer (less overhead) and falls back to separate buffers only
when necessary.
diff --git a/src/i830.h b/src/i830.h
index f8416de..e75eb89 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -226,7 +226,6 @@ typedef struct _I830CrtcPrivateRec {
#ifdef I830_USE_EXA
ExaOffscreenArea *rotate_mem_exa;
#endif
-
/* Card virtual address of the cursor */
unsigned long cursor_offset;
unsigned long cursor_argb_offset;
@@ -282,7 +281,11 @@ typedef struct _I830Rec {
i830_memory *front_buffer;
i830_memory *front_buffer_2;
+ /* One big buffer for all cursors for kernels that support this */
i830_memory *cursor_mem;
+ /* separate small buffers for kernels that support this */
+ i830_memory *cursor_mem_classic[2];
+ i830_memory *cursor_mem_argb[2];
i830_memory *xaa_scratch;
i830_memory *xaa_scratch_2;
#ifdef I830_USE_EXA
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 440618a..b26dd00 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -62,7 +62,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
* The allocations we might do:
*
* - Ring buffer
- * - HW cursor block
+ * - HW cursor block (either one block or four)
* - Overlay registers
* - XAA linear allocator (optional)
* - EXA 965 state buffer
@@ -211,6 +211,7 @@ void
i830_reset_allocations(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
+ int p;
/* While there is any memory between the start and end markers, free it. */
while (pI830->memory_list->next->next != NULL)
@@ -220,6 +221,10 @@ i830_reset_allocations(ScrnInfoPtr pScrn
* kind of gross, but at least it's just one place now.
*/
pI830->cursor_mem = NULL;
+ for (p = 0; p < 2; p++) {
+ pI830->cursor_mem_classic[p] = NULL;
+ pI830->cursor_mem_argb[p] = NULL;
+ }
pI830->front_buffer = NULL;
pI830->front_buffer_2 = NULL;
pI830->xaa_scratch = NULL;
@@ -882,7 +887,47 @@ i830_allocate_cursor_buffers(ScrnInfoPtr
return TRUE;
}
- return FALSE;
+ /*
+ * Allocate four separate buffers when the kernel doesn't support
+ * large allocations as on Linux. If any of these fail, just
+ * bail back to software cursors everywhere
+ */
+ for (i = 0; i < xf86_config->num_crtc; i++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
+
+ pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn,
+ "Core cursor",
+ HWCURSOR_SIZE,
+ GTT_PAGE_SIZE,
+ flags);
+ if (!pI830->cursor_mem_classic[i])
+ return FALSE;
+ pI830->cursor_mem_argb[i] = i830_allocate_memory (pScrn, "ARGB cursor",
+ HWCURSOR_SIZE_ARGB,
+ GTT_PAGE_SIZE,
+ flags);
+ if (!pI830->cursor_mem_argb[i])
+ return FALSE;
+
+ /*
+ * Set up the pointers into the allocations
+ */
+ if (pI830->CursorNeedsPhysical)
+ {
+ intel_crtc->cursor_addr = pI830->cursor_mem_classic[i]->bus_addr;
+ intel_crtc->cursor_argb_addr = pI830->cursor_mem_argb[i]->bus_addr;
+ }
+ else
+ {
+ intel_crtc->cursor_addr = pI830->cursor_mem_classic[i]->offset;
+ intel_crtc->cursor_argb_addr = pI830->cursor_mem_argb[i]->offset;
+ }
+ intel_crtc->cursor_offset = pI830->cursor_mem_classic[i]->offset;
+ intel_crtc->cursor_argb_offset = pI830->cursor_mem_argb[i]->offset;
+ }
+ return TRUE;
}
/*
diff-tree 62a5399d70ac3f8579441d617f8d80c94942a32a (from 05e0021147a89254182c277007236448f315231c)
Author: Keith Packard <keithp at guitar.keithp.com>
Date: Sat Mar 17 21:32:36 2007 -0700
Elide I830DRIClipNotify for older DRI versions.
I830DRIClipNotify is passed to newer versions of DRI; don't include it in
the server when building against older versions.
diff --git a/src/i830_dri.c b/src/i830_dri.c
index b24c839..0fcce58 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -126,7 +126,14 @@ static void I830DRITransitionTo2d(Screen
static void I830DRITransitionTo3d(ScreenPtr pScreen);
static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen);
static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen);
+#if DRIINFO_MAJOR_VERSION > 5 || \
+ (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)
+#define DRI_SUPPORTS_CLIP_NOTIFY 1
+#endif
+
+#ifdef DRI_SUPPORTS_CLIP_NOTIFY
static void I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num);
+#endif
extern void GlxSetVisualConfigs(int nconfigs,
__GLXvisualConfig * configs,
@@ -576,8 +583,7 @@ I830DRIScreenInit(ScreenPtr pScreen)
if (minor >= 1)
#endif
-#if DRIINFO_MAJOR_VERSION > 5 || \
- (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)
+#if DRI_SUPPORTS_CLIP_NOTIFY
pDRIInfo->ClipNotify = I830DRIClipNotify;
#endif
}
@@ -1547,6 +1553,7 @@ I830DRITransitionTo2d(ScreenPtr pScreen)
sPriv->pf_enabled = 0;
}
+#if DRI_SUPPORTS_CLIP_NOTIFY
static void
I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num)
{
@@ -1595,7 +1602,7 @@ I830DRIClipNotify(ScreenPtr pScreen, Win
I830DRISetPfMask(pScreen, pfMask);
}
-
+#endif /* DRI_SUPPORTS_CLIP_NOTIFY */
/**
* Update the SAREA fields with the most recent values.
diff-tree 05e0021147a89254182c277007236448f315231c (from d05bb5362e986c9d27bc03c7e1a939ba28824810)
Author: Keith Packard <keithp at guitar.keithp.com>
Date: Sat Mar 17 21:31:04 2007 -0700
Cast ARGB cursor address to CARD32 * to eliminate warning.
While we're just doing a memcpy, it's nice for the two argument types to
match.
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index dec619f..d97b246 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -154,7 +154,7 @@ i830_crtc_load_cursor_argb (xf86CrtcPtr
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
CARD32 *pcurs;
- pcurs = pI830->FbBase + intel_crtc->cursor_argb_offset;
+ pcurs = (CARD32 *) (pI830->FbBase + intel_crtc->cursor_argb_offset);
intel_crtc->cursor_is_argb = TRUE;
memcpy (pcurs, image, I810_CURSOR_Y * I810_CURSOR_X * 4);
More information about the xorg-commit
mailing list