xf86-video-ati: Branch 'kms-only'

Dave Airlie airlied at kemper.freedesktop.org
Fri Jun 15 09:33:44 PDT 2012


 src/Makefile.am                  |    2 
 src/radeon.h                     |   14 -----
 src/radeon_legacy_memory.c       |   44 ------------------
 src/radeon_textured_video.c      |   92 ++++++++++++++++++++++++++++++---------
 src/radeon_textured_videofuncs.c |   12 +----
 src/radeon_video.c               |   28 -----------
 src/radeon_video.h               |    4 -
 7 files changed, 80 insertions(+), 116 deletions(-)

New commits:
commit 85711a0a6a553232b603dbbb2b2d234c35391578
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jun 15 17:26:50 2012 +0100

    radeon: drop legacy memory, merge into radeon video
    
    This merges these two functions into textured video code.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/Makefile.am b/src/Makefile.am
index ce0888b..3755e82 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,7 +57,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_legacy_memory.c \
+	radeon_accel.c \
 	radeon_driver.c radeon_video.c \
 	radeon_misc.c radeon_probe.c \
 	radeon_textured_video.c radeon_xvmc.c \
diff --git a/src/radeon.h b/src/radeon.h
index 7ed6405..76af641 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -497,8 +497,7 @@ typedef struct {
 
     /* Xv bicubic filtering */
     struct radeon_bo *bicubic_bo;
-    void             *bicubic_memory;
-    int               bicubic_offset;
+
     /* kms pageflipping */
     Bool allowPageFlip;
 
@@ -551,17 +550,6 @@ extern Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn);
 extern xf86CrtcPtr radeon_pick_best_crtc(ScrnInfoPtr pScrn,
 					 int x1, int x2, int y1, int y2);
 
-/* radeon_legacy_memory.c */
-extern uint32_t
-radeon_legacy_allocate_memory(ScrnInfoPtr pScrn,
-			      void **mem_struct,
-			      int size,
-			      int align,
-			      int domain);
-extern void
-radeon_legacy_free_memory(ScrnInfoPtr pScrn,
-		          void *mem_struct);
-
 extern void radeon_cs_flush_indirect(ScrnInfoPtr pScrn);
 extern void radeon_ddx_cs_start(ScrnInfoPtr pScrn,
 				int num, const char *file,
diff --git a/src/radeon_legacy_memory.c b/src/radeon_legacy_memory.c
deleted file mode 100644
index c5ba8e8..0000000
--- a/src/radeon_legacy_memory.c
+++ /dev/null
@@ -1,44 +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_legacy_allocate_memory(ScrnInfoPtr pScrn,
-		       void **mem_struct,
-		       int size,
-		       int align,
-		       int domain)
-{
-    RADEONInfoPtr info = RADEONPTR(pScrn);
-    struct radeon_bo *video_bo;
-
-    if (*mem_struct)
-        radeon_legacy_free_memory(pScrn, *mem_struct);
-
-    video_bo = radeon_bo_open(info->bufmgr, 0, size, align, domain, 0);
-
-    *mem_struct = video_bo;
-
-    if (!video_bo)
-        return 0;
-
-    return (uint32_t)-1;
-}
-
-void
-radeon_legacy_free_memory(ScrnInfoPtr pScrn,
-			  void *mem_struct)
-{
-    struct radeon_bo *bo = mem_struct;
-    radeon_bo_unref(bo);
-    return;
-}
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 80650c3..4544a08 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -122,6 +122,62 @@ static REF_TRANSFORM trans[2] =
 };
 
 
+/* 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.
+ */
+static Bool
+radeon_allocate_video_bo(ScrnInfoPtr pScrn,
+			 struct radeon_bo **video_bo_p,
+			 int size,
+			 int align,
+			 int domain)
+{
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+    struct radeon_bo *video_bo;
+
+    if (*video_bo_p)
+        radeon_bo_unref(*video_bo_p);
+
+    video_bo = radeon_bo_open(info->bufmgr, 0, size, align, domain, 0);
+
+    *video_bo_p = video_bo;
+
+    if (!video_bo)
+        return FALSE;
+
+    return TRUE;
+}
+
+static void
+RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
+{
+    if (pPriv->video_memory != NULL) {
+	radeon_bo_unref(pPriv->video_memory);
+	pPriv->video_memory = NULL;
+
+	if (pPriv->textured) {
+	    pPriv->src_bo[0] = NULL;
+	    radeon_bo_unref(pPriv->src_bo[1]);
+	    pPriv->src_bo[1] = NULL;
+	}
+    }
+}
+
+static void
+RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
+{
+  RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data;
+
+  if (pPriv->textured) {
+      if (cleanup) {
+	  RADEONFreeVideoMemory(pScrn, pPriv);
+      }
+      return;
+  }
+}
+
 #define OUT_ACCEL_REG_F(reg, val)	OUT_RING_REG(reg, F_TO_DW(val))
 
 #include "radeon_textured_videofuncs.c"
@@ -257,23 +313,23 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
     }
 
     if (pPriv->video_memory == NULL) {
-      int ret;
-      ret = radeon_legacy_allocate_memory(pScrn,
-					  &pPriv->video_memory,
-					  size, pPriv->hw_align,
-					  RADEON_GEM_DOMAIN_GTT);
-      if (ret == 0)
+      Bool ret;
+      ret = radeon_allocate_video_bo(pScrn,
+				     &pPriv->video_memory,
+				     size, pPriv->hw_align,
+				     RADEON_GEM_DOMAIN_GTT);
+      if (ret == FALSE)
 	  return BadAlloc;
 
       pPriv->src_bo[0] = pPriv->video_memory;
-      radeon_legacy_allocate_memory(pScrn, (void*)&pPriv->src_bo[1], size,
-				    pPriv->hw_align,
-				    RADEON_GEM_DOMAIN_GTT);
+      radeon_allocate_video_bo(pScrn, (void*)&pPriv->src_bo[1], size,
+			       pPriv->hw_align,
+			       RADEON_GEM_DOMAIN_GTT);
     }
 
     /* Bicubic filter loading */
     if (pPriv->bicubic_enabled) {
-	if (info->bicubic_offset == 0)
+	if (info->bicubic_bo == NULL)
 	    pPriv->bicubic_enabled = FALSE;
     }
 
@@ -632,17 +688,15 @@ RADEONSetTexPortAttribute(ScrnInfoPtr  pScrn,
 Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr    info = RADEONPTR(pScrn);
-
+    int ret;
     /* Bicubic filter loading */
-    info->bicubic_offset = radeon_legacy_allocate_memory(pScrn,
-							 &info->bicubic_memory,
-							 sizeof(bicubic_tex_512), 64,
-							 RADEON_GEM_DOMAIN_VRAM);
-    if (info->bicubic_offset == 0)
+    ret = radeon_allocate_video_bo(pScrn,
+				   &info->bicubic_bo,
+				   sizeof(bicubic_tex_512), 64,
+				   RADEON_GEM_DOMAIN_VRAM);
+    if (ret == FALSE)
 	return FALSE;
 
-    info->bicubic_bo = info->bicubic_memory;
-
     /* Upload bicubic filter tex */
     if (info->ChipFamily < CHIP_FAMILY_R600) {
 	uint8_t *bicubic_addr;
@@ -672,7 +726,7 @@ static void radeon_unload_bicubic_texture(ScrnInfoPtr pScrn)
     RADEONInfoPtr    info = RADEONPTR(pScrn);
 
     if (info->bicubic_memory != NULL) {
-	radeon_legacy_free_memory(pScrn, info->bicubic_memory);
+	radeon_bo_unref(info->bicubic_memory);
 	info->bicubic_memory = NULL;
     }
 
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 722e8be..d30f734 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -949,7 +949,7 @@ R300PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
     struct radeon_bo *src_bo = pPriv->src_bo[pPriv->currentBuffer];
     uint32_t txfilter, txformat0, txformat1, txpitch;
     uint32_t dst_pitch, dst_format;
-    uint32_t txenable, colorpitch, bicubic_offset;
+    uint32_t txenable, colorpitch;
     uint32_t output_fmt;
     int pixel_shift;
     int ret;
@@ -1097,15 +1097,13 @@ R300PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
 		    R300_TX_MAG_FILTER_NEAREST |
 		    (1 << R300_TX_ID_SHIFT));
 
-	bicubic_offset = 0;
-
 	BEGIN_ACCEL_RELOC(6, 1);
 	OUT_RING_REG(R300_TX_FILTER0_1, txfilter);
 	OUT_RING_REG(R300_TX_FILTER1_1, 0);
 	OUT_RING_REG(R300_TX_FORMAT0_1, txformat0);
 	OUT_RING_REG(R300_TX_FORMAT1_1, txformat1);
 	OUT_RING_REG(R300_TX_FORMAT2_1, txpitch);
-	OUT_TEXTURE_REG(R300_TX_OFFSET_1, bicubic_offset, info->bicubic_bo);
+	OUT_TEXTURE_REG(R300_TX_OFFSET_1, 0, info->bicubic_bo);
 	ADVANCE_RING();
 
 	/* Enable tex 1 */
@@ -2369,7 +2367,7 @@ R500PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
     struct radeon_bo *src_bo = pPriv->src_bo[pPriv->currentBuffer];
     uint32_t txfilter, txformat0, txformat1, txpitch, us_format = 0;
     uint32_t dst_pitch, dst_format;
-    uint32_t txenable, colorpitch, bicubic_offset;
+    uint32_t txenable, colorpitch;
     uint32_t output_fmt;
     int pixel_shift, out_size = 6;
     int ret;
@@ -2541,15 +2539,13 @@ R500PrepareTexturedVideo(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
 		    R300_TX_MAG_FILTER_NEAREST |
 		    (1 << R300_TX_ID_SHIFT));
 
-	bicubic_offset = 0;
-
 	BEGIN_ACCEL_RELOC(6, 1);
 	OUT_RING_REG(R300_TX_FILTER0_1, txfilter);
 	OUT_RING_REG(R300_TX_FILTER1_1, 0);
 	OUT_RING_REG(R300_TX_FORMAT0_1, txformat0);
 	OUT_RING_REG(R300_TX_FORMAT1_1, txformat1);
 	OUT_RING_REG(R300_TX_FORMAT2_1, txpitch);
-	OUT_TEXTURE_REG(R300_TX_OFFSET_1, bicubic_offset, info->bicubic_bo);
+	OUT_TEXTURE_REG(R300_TX_OFFSET_1, 0, info->bicubic_bo);
 	ADVANCE_RING();
 
 	/* Enable tex 1 */
diff --git a/src/radeon_video.c b/src/radeon_video.c
index 50a8355..2422779 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -336,34 +336,6 @@ void RADEONInitVideo(ScreenPtr pScreen)
 #endif
 
 void
-RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
-{
-    if (pPriv->video_memory != NULL) {
-	radeon_legacy_free_memory(pScrn, pPriv->video_memory);
-	pPriv->video_memory = NULL;
-
-	if (pPriv->textured) {
-	    pPriv->src_bo[0] = NULL;
-	    radeon_legacy_free_memory(pScrn, pPriv->src_bo[1]);
-	    pPriv->src_bo[1] = NULL;
-	}
-    }
-}
-
-void
-RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
-{
-  RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data;
-
-  if (pPriv->textured) {
-      if (cleanup) {
-	  RADEONFreeVideoMemory(pScrn, pPriv);
-      }
-      return;
-  }
-}
-
-void
 RADEONQueryBestSize(
   ScrnInfoPtr pScrn,
   Bool motion,
diff --git a/src/radeon_video.h b/src/radeon_video.h
index 463f91d..ea61ece 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -30,7 +30,7 @@ typedef struct {
 
    int           size;
 
-   void         *video_memory;
+   struct radeon_bo *video_memory;
 
    int           planeu_offset;
    int           planev_offset;
@@ -81,8 +81,6 @@ typedef struct tagREF_TRANSFORM
 #define RTFContrast(a)   (1.0 + ((a)*1.0)/1000.0)
 #define RTFHue(a)   (((a)*3.1416)/1000.0)
 
-void RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
-void RADEONStopVideo(ScrnInfoPtr, pointer, Bool);
 void RADEONQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short,
 			 unsigned int *, unsigned int *, pointer);
 int  RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,


More information about the xorg-commit mailing list