xf86-video-ati: Branch 'master'
Dave Airlie
airlied at kemper.freedesktop.org
Thu Oct 9 16:47:13 PDT 2008
src/Makefile.am | 2
src/radeon.h | 14 ++---
src/radeon_crtc.c | 4 -
src/radeon_cursor.c | 2
src/radeon_legacy_memory.c | 117 ++++++++++++++++++++++++++++++++++++++++++++
src/radeon_memory.c | 117 --------------------------------------------
src/radeon_textured_video.c | 14 ++---
src/radeon_video.c | 30 +++++------
8 files changed, 150 insertions(+), 150 deletions(-)
New commits:
commit 0975e007ec7933acf9cd8ad2f281313ef8d32ac9
Author: Dave Airlie <airlied at redhat.com>
Date: Thu Oct 9 17:16:28 2008 +1100
radeon: rename radeon_memory to radeon_legacy_memory.
This is a setup patch for the kms/memory management code.
diff --git a/src/Makefile.am b/src/Makefile.am
index c79b635..d65a3e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,7 +88,7 @@ radeon_drv_la_LTLIBRARIES = radeon_drv.la
radeon_drv_la_LDFLAGS = -module -avoid-version
radeon_drv_ladir = @moduledir@/drivers
radeon_drv_la_SOURCES = \
- radeon_accel.c radeon_cursor.c radeon_dga.c radeon_memory.c \
+ radeon_accel.c radeon_cursor.c radeon_dga.c radeon_legacy_memory.c \
radeon_driver.c radeon_video.c radeon_bios.c radeon_mm_i2c.c \
radeon_vip.c radeon_misc.c radeon_probe.c \
legacy_crtc.c legacy_output.c \
diff --git a/src/radeon.h b/src/radeon.h
index aec8a25..f7ae1a8 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1068,15 +1068,15 @@ extern void RADEONUpdateHVPosition(xf86OutputPtr output, DisplayModePtr mode);
extern void RADEONInitVideo(ScreenPtr pScreen);
extern void RADEONResetVideo(ScrnInfoPtr pScrn);
-/* radeon_memory.c */
+/* radeon_legacy_memory.c */
extern uint32_t
-radeon_allocate_memory(ScrnInfoPtr pScrn,
- void **mem_struct,
- int size,
- int align);
+radeon_legacy_allocate_memory(ScrnInfoPtr pScrn,
+ void **mem_struct,
+ int size,
+ int align);
extern void
-radeon_free_memory(ScrnInfoPtr pScrn,
- void *mem_struct);
+radeon_legacy_free_memory(ScrnInfoPtr pScrn,
+ void *mem_struct);
#ifdef XF86DRI
# ifdef USE_XAA
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index 99992fc..9040bae 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -418,7 +418,7 @@ radeon_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
* setter for offscreen area locking in EXA currently. So, we just
* allocate offscreen memory and fake up a pixmap header for it.
*/
- rotate_offset = radeon_allocate_memory(pScrn, &radeon_crtc->crtc_rotate_mem, size, align);
+ rotate_offset = radeon_legacy_allocate_memory(pScrn, &radeon_crtc->crtc_rotate_mem, size, align);
if (rotate_offset == 0)
return NULL;
@@ -466,7 +466,7 @@ radeon_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data
FreeScratchPixmapHeader(rotate_pixmap);
if (data) {
- radeon_free_memory(pScrn, radeon_crtc->crtc_rotate_mem);
+ radeon_legacy_free_memory(pScrn, radeon_crtc->crtc_rotate_mem);
radeon_crtc->crtc_rotate_mem = NULL;
}
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index 22a33d6..08bfddf 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -341,7 +341,7 @@ Bool RADEONCursorInit(ScreenPtr pScreen)
RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
radeon_crtc->cursor_offset =
- radeon_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align);
+ radeon_legacy_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align);
if (radeon_crtc->cursor_offset == 0)
return FALSE;
diff --git a/src/radeon_legacy_memory.c b/src/radeon_legacy_memory.c
new file mode 100644
index 0000000..2a9ee94
--- /dev/null
+++ b/src/radeon_legacy_memory.c
@@ -0,0 +1,117 @@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* 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
+ * returned.
+ */
+uint32_t
+radeon_legacy_allocate_memory(ScrnInfoPtr pScrn,
+ void **mem_struct,
+ int size,
+ int align)
+{
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ uint32_t offset = 0;
+
+#ifdef USE_EXA
+ if (info->useEXA) {
+ ExaOffscreenArea *area = *mem_struct;
+
+ if (area != NULL) {
+ if (area->size >= size)
+ return area->offset;
+
+ exaOffscreenFree(pScreen, area);
+ }
+
+ area = exaOffscreenAlloc(pScreen, size, align, TRUE,
+ NULL, NULL);
+
+ *mem_struct = area;
+ if (area == NULL)
+ return 0;
+ offset = area->offset;
+ }
+#endif /* USE_EXA */
+#ifdef USE_XAA
+ if (!info->useEXA) {
+ FBLinearPtr linear = *mem_struct;
+ int cpp = info->CurrentLayout.bitsPerPixel / 8;
+
+ /* XAA allocates in units of pixels at the screen bpp, so adjust size
+ * appropriately.
+ */
+ size = (size + cpp - 1) / cpp;
+ align = (align + cpp - 1) / cpp;
+
+ if (linear) {
+ if(linear->size >= size)
+ return linear->offset * cpp;
+
+ if(xf86ResizeOffscreenLinear(linear, size))
+ return linear->offset * cpp;
+
+ xf86FreeOffscreenLinear(linear);
+ }
+
+ linear = xf86AllocateOffscreenLinear(pScreen, size, align,
+ NULL, NULL, NULL);
+ *mem_struct = linear;
+
+ if (!linear) {
+ int max_size;
+
+ xf86QueryLargestOffscreenLinear(pScreen, &max_size, align,
+ PRIORITY_EXTREME);
+
+ if (max_size < size)
+ return 0;
+
+ xf86PurgeUnlockedOffscreenAreas(pScreen);
+ linear = xf86AllocateOffscreenLinear(pScreen, size, align,
+ NULL, NULL, NULL);
+ *mem_struct = linear;
+ if (!linear)
+ return 0;
+ }
+ offset = linear->offset * cpp;
+ }
+#endif /* USE_XAA */
+
+ return offset;
+}
+
+void
+radeon_legacy_free_memory(ScrnInfoPtr pScrn,
+ void *mem_struct)
+{
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+#ifdef USE_EXA
+ if (info->useEXA) {
+ ExaOffscreenArea *area = mem_struct;
+
+ if (area != NULL)
+ exaOffscreenFree(pScreen, area);
+ area = NULL;
+ }
+#endif /* USE_EXA */
+#ifdef USE_XAA
+ if (!info->useEXA) {
+ FBLinearPtr linear = mem_struct;
+
+ if (linear != NULL)
+ xf86FreeOffscreenLinear(linear);
+ linear = NULL;
+ }
+#endif /* USE_XAA */
+}
diff --git a/src/radeon_memory.c b/src/radeon_memory.c
deleted file mode 100644
index f965cb4..0000000
--- a/src/radeon_memory.c
+++ /dev/null
@@ -1,117 +0,0 @@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* 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
- * returned.
- */
-uint32_t
-radeon_allocate_memory(ScrnInfoPtr pScrn,
- void **mem_struct,
- int size,
- int align)
-{
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- RADEONInfoPtr info = RADEONPTR(pScrn);
- uint32_t offset = 0;
-
-#ifdef USE_EXA
- if (info->useEXA) {
- ExaOffscreenArea *area = *mem_struct;
-
- if (area != NULL) {
- if (area->size >= size)
- return area->offset;
-
- exaOffscreenFree(pScreen, area);
- }
-
- area = exaOffscreenAlloc(pScreen, size, align, TRUE,
- NULL, NULL);
-
- *mem_struct = area;
- if (area == NULL)
- return 0;
- offset = area->offset;
- }
-#endif /* USE_EXA */
-#ifdef USE_XAA
- if (!info->useEXA) {
- FBLinearPtr linear = *mem_struct;
- int cpp = info->CurrentLayout.bitsPerPixel / 8;
-
- /* XAA allocates in units of pixels at the screen bpp, so adjust size
- * appropriately.
- */
- size = (size + cpp - 1) / cpp;
- align = (align + cpp - 1) / cpp;
-
- if (linear) {
- if(linear->size >= size)
- return linear->offset * cpp;
-
- if(xf86ResizeOffscreenLinear(linear, size))
- return linear->offset * cpp;
-
- xf86FreeOffscreenLinear(linear);
- }
-
- linear = xf86AllocateOffscreenLinear(pScreen, size, align,
- NULL, NULL, NULL);
- *mem_struct = linear;
-
- if (!linear) {
- int max_size;
-
- xf86QueryLargestOffscreenLinear(pScreen, &max_size, align,
- PRIORITY_EXTREME);
-
- if (max_size < size)
- return 0;
-
- xf86PurgeUnlockedOffscreenAreas(pScreen);
- linear = xf86AllocateOffscreenLinear(pScreen, size, align,
- NULL, NULL, NULL);
- *mem_struct = linear;
- if (!linear)
- return 0;
- }
- offset = linear->offset * cpp;
- }
-#endif /* USE_XAA */
-
- return offset;
-}
-
-void
-radeon_free_memory(ScrnInfoPtr pScrn,
- void *mem_struct)
-{
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- RADEONInfoPtr info = RADEONPTR(pScrn);
-
-#ifdef USE_EXA
- if (info->useEXA) {
- ExaOffscreenArea *area = mem_struct;
-
- if (area != NULL)
- exaOffscreenFree(pScreen, area);
- area = NULL;
- }
-#endif /* USE_EXA */
-#ifdef USE_XAA
- if (!info->useEXA) {
- FBLinearPtr linear = mem_struct;
-
- if (linear != NULL)
- xf86FreeOffscreenLinear(linear);
- linear = NULL;
- }
-#endif /* USE_XAA */
-}
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 4005df9..c185b46 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -197,14 +197,14 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
dstPitch = (dstPitch + 15) & ~15;
if (pPriv->video_memory != NULL && size != pPriv->size) {
- radeon_free_memory(pScrn, pPriv->video_memory);
+ radeon_legacy_free_memory(pScrn, pPriv->video_memory);
pPriv->video_memory = NULL;
}
if (pPriv->video_memory == NULL) {
- pPriv->video_offset = radeon_allocate_memory(pScrn,
- &pPriv->video_memory,
- size * 2, 64);
+ pPriv->video_offset = radeon_legacy_allocate_memory(pScrn,
+ &pPriv->video_memory,
+ size * 2, 64);
if (pPriv->video_offset == 0)
return BadAlloc;
}
@@ -213,9 +213,9 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
if (!IS_R500_3D)
pPriv->bicubic_enabled = FALSE;
if (pPriv->bicubic_memory == NULL && pPriv->bicubic_enabled) {
- pPriv->bicubic_offset = radeon_allocate_memory(pScrn,
- &pPriv->bicubic_memory,
- sizeof(bicubic_tex_512), 64);
+ pPriv->bicubic_offset = radeon_legacy_allocate_memory(pScrn,
+ &pPriv->bicubic_memory,
+ sizeof(bicubic_tex_512), 64);
pPriv->bicubic_src_offset = pPriv->bicubic_offset + info->fbLocation + pScrn->fbOffset;
if (pPriv->bicubic_offset == 0)
pPriv->bicubic_enabled = FALSE;
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 47b0497..6249cea 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -1638,11 +1638,11 @@ RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
if (pPriv->textured) {
if (cleanup) {
if (pPriv->bicubic_memory != NULL) {
- radeon_free_memory(pScrn, pPriv->bicubic_memory);
+ radeon_legacy_free_memory(pScrn, pPriv->bicubic_memory);
pPriv->bicubic_memory = NULL;
}
if (pPriv->video_memory != NULL) {
- radeon_free_memory(pScrn, pPriv->video_memory);
+ radeon_legacy_free_memory(pScrn, pPriv->video_memory);
pPriv->video_memory = NULL;
}
}
@@ -1667,7 +1667,7 @@ RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
if(pPriv->i2c != NULL) RADEON_board_setmisc(pPriv);
}
if (pPriv->video_memory != NULL) {
- radeon_free_memory(pScrn, pPriv->video_memory);
+ radeon_legacy_free_memory(pScrn, pPriv->video_memory);
pPriv->video_memory = NULL;
}
pPriv->videoStatus = 0;
@@ -2937,9 +2937,9 @@ RADEONPutImage(
if (idconv == FOURCC_YV12 || id == FOURCC_I420) {
new_size += (dstPitch >> 1) * ((height + 1) & ~1);
}
- pPriv->video_offset = radeon_allocate_memory(pScrn, &pPriv->video_memory,
- (pPriv->doubleBuffer ?
- (new_size * 2) : new_size), 64);
+ pPriv->video_offset = radeon_legacy_allocate_memory(pScrn, &pPriv->video_memory,
+ (pPriv->doubleBuffer ?
+ (new_size * 2) : new_size), 64);
if (pPriv->video_offset == 0)
return BadAlloc;
@@ -3133,7 +3133,7 @@ RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now)
} else { /* FREE_TIMER */
if(pPriv->freeTime < now) {
if (pPriv->video_memory != NULL) {
- radeon_free_memory(pScrn, pPriv->video_memory);
+ radeon_legacy_free_memory(pScrn, pPriv->video_memory);
pPriv->video_memory = NULL;
}
pPriv->videoStatus = 0;
@@ -3168,7 +3168,7 @@ RADEONAllocateSurface(
pitch = ((w << 1) + 15) & ~15;
size = pitch * h;
- offset = radeon_allocate_memory(pScrn, &surface_memory, size, 64);
+ offset = radeon_legacy_allocate_memory(pScrn, &surface_memory, size, 64);
if (offset == 0)
return BadAlloc;
@@ -3176,18 +3176,18 @@ RADEONAllocateSurface(
surface->height = h;
if(!(surface->pitches = xalloc(sizeof(int)))) {
- radeon_free_memory(pScrn, surface_memory);
+ radeon_legacy_free_memory(pScrn, surface_memory);
return BadAlloc;
}
if(!(surface->offsets = xalloc(sizeof(int)))) {
xfree(surface->pitches);
- radeon_free_memory(pScrn, surface_memory);
+ radeon_legacy_free_memory(pScrn, surface_memory);
return BadAlloc;
}
if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
xfree(surface->pitches);
xfree(surface->offsets);
- radeon_free_memory(pScrn, surface_memory);
+ radeon_legacy_free_memory(pScrn, surface_memory);
return BadAlloc;
}
@@ -3228,7 +3228,7 @@ RADEONFreeSurface(
if(pPriv->isOn)
RADEONStopSurface(surface);
- radeon_free_memory(pScrn, pPriv->surface_memory);
+ radeon_legacy_free_memory(pScrn, pPriv->surface_memory);
pPriv->surface_memory = NULL;
xfree(surface->pitches);
xfree(surface->offsets);
@@ -3504,9 +3504,9 @@ RADEONPutVideo(
if (pPriv->capture_vbi_data)
alloc_size += 2 * 2 * vbi_line_width * 21;
- pPriv->video_offset = radeon_allocate_memory(pScrn, &pPriv->video_memory,
- (pPriv->doubleBuffer ?
- (new_size * 2) : new_size), 64);
+ pPriv->video_offset = radeon_legacy_allocate_memory(pScrn, &pPriv->video_memory,
+ (pPriv->doubleBuffer ?
+ (new_size * 2) : new_size), 64);
if (pPriv->video_offset == 0)
return BadAlloc;
More information about the xorg-commit
mailing list