radeon_ms: fix fence
authorJerome Glisse <glisse@freedesktop.org>
Thu, 20 Mar 2008 16:43:43 +0000 (17:43 +0100)
committerJohn Doe <glisse@freedesktop.org>
Thu, 20 Mar 2008 16:43:43 +0000 (17:43 +0100)
linux-core/amd_legacy_fence.h [new symlink]
shared-core/amd_legacy_fence.h [new file with mode: 0644]
shared-core/radeon_ms.h
shared-core/radeon_ms_drm.c
shared-core/radeon_ms_fence.c

diff --git a/linux-core/amd_legacy_fence.h b/linux-core/amd_legacy_fence.h
new file mode 120000 (symlink)
index 0000000..e7b30f2
--- /dev/null
@@ -0,0 +1 @@
+../shared-core/amd_legacy_fence.h
\ No newline at end of file
diff --git a/shared-core/amd_legacy_fence.h b/shared-core/amd_legacy_fence.h
new file mode 100644 (file)
index 0000000..d82138b
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2007 Jérôme Glisse
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Dave Airlie
+ *    Jerome Glisse <glisse@freedesktop.org>
+ */
+#ifndef __AMD_LEGACY_FENCE_H__
+#define __AMD_LEGACY_FENCE_H__
+
+struct legacy_fence
+{
+       uint32_t sequence;
+       uint32_t sequence_last_reported;
+       uint32_t sequence_last_flush;
+       uint32_t fence_reg;
+};
+
+#endif
index 12c945f..d9aa035 100644 (file)
@@ -31,7 +31,6 @@
 #define __RADEON_MS_H__
 
 #include "radeon_ms_drv.h"
-#include "amd_r3xx_fence.h"
 #include "radeon_ms_reg.h"
 #include "radeon_ms_drm.h"
 #include "radeon_ms_rom.h"
index b9245d9..40f5d79 100644 (file)
@@ -29,6 +29,7 @@
  */
 #include "drm_pciids.h"
 #include "radeon_ms.h"
+#include "amd_legacy_fence.h"
 
 
 static uint32_t radeon_ms_mem_prios[] = {
@@ -116,12 +117,12 @@ int radeon_ms_driver_load(struct drm_device *dev, unsigned long flags)
                return ret;
        }
 
-       dev_priv->fence = drm_alloc(sizeof(struct r3xx_fence), DRM_MEM_DRIVER);
+       dev_priv->fence = drm_alloc(sizeof(struct legacy_fence), DRM_MEM_DRIVER);
        if (dev_priv->fence == NULL) {
                radeon_ms_driver_unload(dev);
                return -ENOMEM;
        }
-       memset(dev_priv->fence, 0, sizeof(struct r3xx_fence));
+       memset(dev_priv->fence, 0, sizeof(struct legacy_fence));
 
        /* we don't want userspace to be able to map this so don't use
         * drm_addmap */
@@ -305,7 +306,7 @@ int radeon_ms_driver_unload(struct drm_device *dev)
                drm_core_ioremapfree(&dev_priv->vram, dev);
        }
        DRM_INFO("[radeon_ms] map released\n");
-       drm_free(dev_priv->fence, sizeof(struct r3xx_fence), DRM_MEM_DRIVER);
+       drm_free(dev_priv->fence, sizeof(struct legacy_fence), DRM_MEM_DRIVER);
        drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
        dev->dev_private = NULL;
 
index 162d37d..994c3e4 100644 (file)
@@ -27,7 +27,7 @@
  *    Jerome Glisse <glisse@freedesktop.org>
  */
 #include "radeon_ms.h"
-#include "amd_r3xx_fence.h"
+#include "amd_legacy_fence.h"
 
 #define R3XX_FENCE_SEQUENCE_RW_FLUSH   0x80000000u
 
@@ -35,7 +35,7 @@ static inline int r3xx_fence_emit_sequence(struct drm_device *dev,
                                           struct drm_radeon_private *dev_priv,
                                           uint32_t sequence)
 {
-       struct r3xx_fence *r3xx_fence = dev_priv->fence;
+       struct legacy_fence *r3xx_fence = dev_priv->fence;
        uint32_t cmd[2];
        int i, r;
 
@@ -58,7 +58,7 @@ static inline int r3xx_fence_emit_sequence(struct drm_device *dev,
        return -EBUSY;
 }
 
-static inline uint32_t r3xx_fence_sequence(struct r3xx_fence *r3xx_fence)
+static inline uint32_t r3xx_fence_sequence(struct legacy_fence *r3xx_fence)
 {
        r3xx_fence->sequence += 1;
        if (unlikely(r3xx_fence->sequence > 0x7fffffffu)) {
@@ -69,7 +69,7 @@ static inline uint32_t r3xx_fence_sequence(struct r3xx_fence *r3xx_fence)
 
 static inline void r3xx_fence_report(struct drm_device *dev,
                                     struct drm_radeon_private *dev_priv,
-                                    struct r3xx_fence *r3xx_fence)
+                                    struct legacy_fence *r3xx_fence)
 {
        uint32_t fence_types = DRM_FENCE_TYPE_EXE;
        uint32_t sequence;
@@ -95,7 +95,7 @@ static inline void r3xx_fence_report(struct drm_device *dev,
 static void r3xx_fence_flush(struct drm_device *dev, uint32_t class)
 {
        struct drm_radeon_private *dev_priv = dev->dev_private;
-       struct r3xx_fence *r3xx_fence = dev_priv->fence;
+       struct legacy_fence *r3xx_fence = dev_priv->fence;
        uint32_t sequence;
 
        sequence = r3xx_fence_sequence(r3xx_fence);
@@ -109,7 +109,7 @@ static void r3xx_fence_poll(struct drm_device *dev, uint32_t fence_class,
        struct drm_radeon_private *dev_priv = dev->dev_private;
        struct drm_fence_manager *fm = &dev->fm;
        struct drm_fence_class_manager *fc = &fm->fence_class[fence_class];
-       struct r3xx_fence *r3xx_fence = dev_priv->fence;
+       struct legacy_fence *r3xx_fence = dev_priv->fence;
 
        if (unlikely(!dev_priv)) {
                return;
@@ -129,7 +129,7 @@ static int r3xx_fence_emit(struct drm_device *dev, uint32_t class,
                           uint32_t *native_type)
 {
        struct drm_radeon_private *dev_priv = dev->dev_private;
-       struct r3xx_fence *r3xx_fence = dev_priv->fence;
+       struct legacy_fence *r3xx_fence = dev_priv->fence;
        uint32_t tmp;
 
        if (!dev_priv || dev_priv->cp_ready != 1) {
@@ -162,7 +162,7 @@ static uint32_t r3xx_fence_needed_flush(struct drm_fence_object *fence)
 {
        struct drm_device *dev = fence->dev;
        struct drm_radeon_private *dev_priv = dev->dev_private;
-       struct r3xx_fence *r3xx_fence = dev_priv->fence;
+       struct legacy_fence *r3xx_fence = dev_priv->fence;
        struct drm_fence_driver *driver = dev->driver->fence_driver;
        uint32_t flush_types, diff;