Re: [PATCH] drm/radeon: track global bo name and always return the same

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27.11.2012 20:02, j.glisse@xxxxxxxxx wrote:
From: Jerome Glisse <jglisse@xxxxxxxxxx>

To avoid kernel rejecting cs if we return different global name
for same bo keep track of global name and always return the same.
Seems to fix issue with suspend/resume failing and repeatly printing
following message :
[drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation -35!

There might still be way for a rogue program to trigger this issue.

Signed-off-by: Jerome Glisse <jglisse@xxxxxxxxxx>

Reviewed-by: Christian König <christian.koenig@xxxxxxx>

---
  radeon/radeon_bo_gem.c | 16 +++++++++++-----
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c
index 265f177..fca0aaf 100644
--- a/radeon/radeon_bo_gem.c
+++ b/radeon/radeon_bo_gem.c
@@ -47,11 +47,11 @@
  #include "radeon_bo_gem.h"
  #include <fcntl.h>
  struct radeon_bo_gem {
-    struct radeon_bo_int base;
-    uint32_t            name;
-    int                 map_count;
-    atomic_t            reloc_in_cs;
-    void *priv_ptr;
+    struct radeon_bo_int    base;
+    uint32_t                name;
+    int                     map_count;
+    atomic_t                reloc_in_cs;
+    void                    *priv_ptr;
  };
struct bo_manager_gem {
@@ -320,15 +320,21 @@ void *radeon_gem_get_reloc_in_cs(struct radeon_bo *bo)
int radeon_gem_get_kernel_name(struct radeon_bo *bo, uint32_t *name)
  {
+    struct radeon_bo_gem *bo_gem = (struct radeon_bo_gem*)bo;
      struct radeon_bo_int *boi = (struct radeon_bo_int *)bo;
      struct drm_gem_flink flink;
      int r;
+ if (bo_gem->name) {
+        *name = bo_gem->name;
+        return 0;
+    }
      flink.handle = bo->handle;
      r = drmIoctl(boi->bom->fd, DRM_IOCTL_GEM_FLINK, &flink);
      if (r) {
          return r;
      }
+    bo_gem->name = flink.name;
      *name = flink.name;
      return 0;
  }

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux