summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2008-07-11 17:28:03 -0400
committerAlex Deucher <alexdeucher@gmail.com>2008-08-25 10:05:50 -0400
commit4dff54a3c8d7c9f2d6ec50354ff0b92f1b7fcbdf (patch)
treea51f0192a20346ab3aad697011b94fd5d9d3606a /src
parent5b1978a4796bcc31ac2f01d303dc8f8f44323025 (diff)
Switch cursors over to generic allocator
Diffstat (limited to 'src')
-rw-r--r--src/radeon_cursor.c43
-rw-r--r--src/radeon_exa.c25
-rw-r--r--src/radeon_memory.c4
-rw-r--r--src/radeon_probe.h1
4 files changed, 15 insertions, 58 deletions
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index 13c2b9cb..11fd4984 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -327,49 +327,30 @@ Bool RADEONCursorInit(ScreenPtr pScreen)
int width_bytes;
int height;
int size_bytes;
- uint32_t cursor_offset = 0;
int c;
size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT;
width = pScrn->displayWidth;
width_bytes = width * (pScrn->bitsPerPixel / 8);
height = ((size_bytes * xf86_config->num_crtc) + width_bytes - 1) / width_bytes;
+ int align = IS_AVIVO_VARIANT ? 4096 : 256;
-#ifdef USE_XAA
- if (!info->useEXA) {
- int align = IS_AVIVO_VARIANT ? 4096 : 256;
- FBAreaPtr fbarea;
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
- fbarea = xf86AllocateOffscreenArea(pScreen, width, height,
- align, NULL, NULL, NULL);
+ radeon_crtc->cursor_offset =
+ radeon_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align);
- if (!fbarea) {
- cursor_offset = 0;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Hardware cursor disabled"
- " due to insufficient offscreen memory\n");
+ if (radeon_crtc->cursor_offset == 0)
return FALSE;
- } else {
- cursor_offset = RADEON_ALIGN((fbarea->box.x1 +
- fbarea->box.y1 * width) *
- info->CurrentLayout.pixel_bytes,
- align);
- for (c = 0; c < xf86_config->num_crtc; c++) {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
- RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
-
- radeon_crtc->cursor_offset = cursor_offset + (c * size_bytes);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using hardware cursor %d (scanline %u)\n", c,
- (unsigned)(radeon_crtc->cursor_offset / pScrn->displayWidth
- / info->CurrentLayout.pixel_bytes));
- }
-
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Will use %d kb for hardware cursor %d at offset 0x%08x\n",
+ (size_bytes * xf86_config->num_crtc) / 1024,
+ c,
+ (unsigned int)radeon_crtc->cursor_offset);
}
-#endif
return xf86_cursors_init (pScreen, CURSOR_WIDTH, CURSOR_HEIGHT,
(HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 8beaed71..a1b93b52 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -386,7 +386,6 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RADEONInfoPtr info = RADEONPTR(pScrn);
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int cpp = info->CurrentLayout.pixel_bytes;
int screen_size;
int byteStride = pScrn->displayWidth * cpp;
@@ -415,30 +414,6 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen)
info->accel_state->exa->memorySize / 1024);
- /* Reserve static area for hardware cursor */
- if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
- int cursor_size = 64 * 4 * 64;
- int align = IS_AVIVO_VARIANT ? 4096 : 256;
- int c;
-
- for (c = 0; c < xf86_config->num_crtc; c++) {
- xf86CrtcPtr crtc = xf86_config->crtc[c];
- RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
-
- radeon_crtc->cursor_offset =
- RADEON_ALIGN(info->accel_state->exa->offScreenBase, align);
- info->accel_state->exa->offScreenBase = radeon_crtc->cursor_offset + cursor_size;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Will use %d kb for hardware cursor %d at offset 0x%08x\n",
- (cursor_size * xf86_config->num_crtc) / 1024,
- c,
- (unsigned int)radeon_crtc->cursor_offset);
- }
-
-
- }
-
#if defined(XF86DRI)
if (info->directRenderingEnabled) {
int depthCpp = (info->dri->depthBits - 8) / 4, l, next, depth_size;
diff --git a/src/radeon_memory.c b/src/radeon_memory.c
index d9e6403e..178eed03 100644
--- a/src/radeon_memory.c
+++ b/src/radeon_memory.c
@@ -6,7 +6,6 @@
/* Driver data structures */
#include "radeon.h"
-
/* Allocates memory, either by resizing the allocation pointed to by mem_struct,
* or by freeing mem_struct (if non-NULL) and allocating a new space. The size
* is measured in bytes, and the offset from the beginning of card space is
@@ -20,9 +19,10 @@ radeon_allocate_memory(ScrnInfoPtr pScrn,
{
ScreenPtr pScreen;
RADEONInfoPtr info = RADEONPTR(pScrn);
- int offset = 0;
+ uint32_t offset = 0;
pScreen = screenInfo.screens[pScrn->scrnIndex];
+
#ifdef USE_EXA
if (info->useEXA) {
ExaOffscreenArea *area = *mem_struct;
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 8e01b0f8..ce4ba931 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -184,6 +184,7 @@ typedef struct
typedef struct _RADEONCrtcPrivateRec {
void *crtc_rotate_mem;
+ void *cursor_mem;
int crtc_id;
int binding;
uint32_t cursor_offset;