Skip to contentSkip to conversation

drm/ttm: remove unused placement flags

PATCH In review Christian König 9 participants 14 messages Sep 8, 2016 – Sep 9, 2016 6 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/ttm: remove unused placement flags

From: Christian König <[email protected]>

Either never used or not used in quite a while.

---
 drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
 include/drm/ttm/ttm_placement.h | 19 -------------------
 2 files changed, 1 insertion(+), 20 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index bc37f02..4d2e8f2 100644
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
 {
 	int i;
 
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
 		if (place->flags & (1 << i)) {
 			*mem_type = i;
 			return 0;
include/drm/ttm/ttm_placement.h +0 -19
index 8ed44f9..20219d9 100644
@@ -40,10 +40,6 @@
 #define TTM_PL_PRIV0            3
 #define TTM_PL_PRIV1            4
 #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
 
 #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
 #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
 #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
 #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
 #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
 #define TTM_PL_MASK_MEM         0x0000FFFF
 
 /*
@@ -72,7 +64,6 @@
 #define TTM_PL_FLAG_CACHED      (1 << 16)
 #define TTM_PL_FLAG_UNCACHED    (1 << 17)
 #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
 #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
 #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
 
@@ -82,14 +73,4 @@
 
 #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
 
-/*
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
 #endif
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 drm/ttm: move placement structures into ttm_placement.h

From: Christian König <[email protected]>

Makes more sense to keep that together.

---
 include/drm/ttm/ttm_bo_api.h    | 32 +-------------------------------
 include/drm/ttm/ttm_placement.h | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 31 deletions(-)
include/drm/ttm/ttm_bo_api.h +1 -31
index 97aaf5c..d73c7c2 100644
@@ -45,37 +45,7 @@ struct ttm_bo_device;
 
 struct drm_mm_node;
 
-/**
- * struct ttm_place
- *
- * @fpfn:	first valid page frame number to put the object
- * @lpfn:	last valid page frame number to put the object
- * @flags:	memory domain and caching flags for the object
- *
- * Structure indicating a possible place to put an object.
- */
-struct ttm_place {
-	unsigned	fpfn;
-	unsigned	lpfn;
-	uint32_t	flags;
-};
-
-/**
- * struct ttm_placement
- *
- * @num_placement:	number of preferred placements
- * @placement:		preferred placements
- * @num_busy_placement:	number of preferred placements when need to evict buffer
- * @busy_placement:	preferred placements when need to evict buffer
- *
- * Structure indicating the placement you request for an object.
- */
-struct ttm_placement {
-	unsigned		num_placement;
-	const struct ttm_place	*placement;
-	unsigned		num_busy_placement;
-	const struct ttm_place	*busy_placement;
-};
+struct ttm_placement;
 
 /**
  * struct ttm_bus_placement
include/drm/ttm/ttm_placement.h +35 -0
index 20219d9..ff5195c 100644
@@ -30,6 +30,9 @@
 
 #ifndef _TTM_PLACEMENT_H_
 #define _TTM_PLACEMENT_H_
+
+#include <linux/types.h>
+
 /*
  * Memory regions for data placement.
  */
@@ -73,4 +76,36 @@
 
 #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
 
+/**
+ * struct ttm_place
+ *
+ * @fpfn:	first valid page frame number to put the object
+ * @lpfn:	last valid page frame number to put the object
+ * @flags:	memory domain and caching flags for the object
+ *
+ * Structure indicating a possible place to put an object.
+ */
+struct ttm_place {
+	unsigned	fpfn;
+	unsigned	lpfn;
+	uint32_t	flags;
+};
+
+/**
+ * struct ttm_placement
+ *
+ * @num_placement:	number of preferred placements
+ * @placement:		preferred placements
+ * @num_busy_placement:	number of preferred placements when need to evict buffer
+ * @busy_placement:	preferred placements when need to evict buffer
+ *
+ * Structure indicating the placement you request for an object.
+ */
+struct ttm_placement {
+	unsigned		num_placement;
+	const struct ttm_place	*placement;
+	unsigned		num_busy_placement;
+	const struct ttm_place	*busy_placement;
+};
+
 #endif
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/ttm: move placement structures into ttm_placement.h

Quoted 5 lines · Christian König

From: Christian König <[email protected]>

Makes more sense to keep that together.

Quoted 89 lines
---
  include/drm/ttm/ttm_bo_api.h    | 32 +-------------------------------
  include/drm/ttm/ttm_placement.h | 35 +++++++++++++++++++++++++++++++++++
  2 files changed, 36 insertions(+), 31 deletions(-)
include/drm/ttm/ttm_bo_api.h +1 -31
index 97aaf5c..d73c7c2 100644
@@ -45,37 +45,7 @@ struct ttm_bo_device;
 
  struct drm_mm_node;
 
-/**
- * struct ttm_place
- *
- * @fpfn:	first valid page frame number to put the object
- * @lpfn:	last valid page frame number to put the object
- * @flags:	memory domain and caching flags for the object
- *
- * Structure indicating a possible place to put an object.
- */
-struct ttm_place {
-	unsigned	fpfn;
-	unsigned	lpfn;
-	uint32_t	flags;
-};
-
-/**
- * struct ttm_placement
- *
- * @num_placement:	number of preferred placements
- * @placement:		preferred placements
- * @num_busy_placement:	number of preferred placements when need to evict buffer
- * @busy_placement:	preferred placements when need to evict buffer
- *
- * Structure indicating the placement you request for an object.
- */
-struct ttm_placement {
-	unsigned		num_placement;
-	const struct ttm_place	*placement;
-	unsigned		num_busy_placement;
-	const struct ttm_place	*busy_placement;
-};
+struct ttm_placement;
 
  /**
   * struct ttm_bus_placement
include/drm/ttm/ttm_placement.h +26 -0
index 20219d9..ff5195c 100644
@@ -30,6 +30,9 @@
 
  #ifndef _TTM_PLACEMENT_H_
  #define _TTM_PLACEMENT_H_
+
+#include <linux/types.h>
+
  /*
   * Memory regions for data placement.
   */
@@ -73,4 +76,36 @@
 
  #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
 
+/**
+ * struct ttm_place
+ *
+ * @fpfn:	first valid page frame number to put the object
+ * @lpfn:	last valid page frame number to put the object
+ * @flags:	memory domain and caching flags for the object
+ *
+ * Structure indicating a possible place to put an object.
+ */
+struct ttm_place {
+	unsigned	fpfn;
+	unsigned	lpfn;
+	uint32_t	flags;
+};
+
+/**
+ * struct ttm_placement
+ *
+ * @num_placement:	number of preferred placements
+ * @placement:		preferred placements
+ * @num_busy_placement:	number of preferred placements when need to evict buffer
+ * @busy_placement:	preferred placements when need to evict buffer
+ *

include/drm/ttm/ttm_placement.h line 111

Quoted 10 lines
include/drm/ttm/ttm_placement.h +9 -0
+ * Structure indicating the placement you request for an object.
+ */
+struct ttm_placement {
+	unsigned		num_placement;
+	const struct ttm_place	*placement;
+	unsigned		num_busy_placement;
+	const struct ttm_place	*busy_placement;
+};
+
  #endif

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1473342102-324-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#4 lore raw
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right? If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 59 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
  include/drm/ttm/ttm_placement.h | 19 -------------------
  2 files changed, 1 insertion(+), 20 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index bc37f02..4d2e8f2 100644
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
  {
  	int i;
 
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
  		if (place->flags & (1 << i)) {
  			*mem_type = i;
  			return 0;
include/drm/ttm/ttm_placement.h +0 -10
index 8ed44f9..20219d9 100644
@@ -40,10 +40,6 @@
  #define TTM_PL_PRIV0            3
  #define TTM_PL_PRIV1            4
  #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
 
  #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
  #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
  #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
  #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
  #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
  #define TTM_PL_MASK_MEM         0x0000FFFF
 
  /*
@@ -72,7 +64,6 @@
  #define TTM_PL_FLAG_CACHED      (1 << 16)
  #define TTM_PL_FLAG_UNCACHED    (1 << 17)
  #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
  #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
  #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
 
@@ -82,14 +73,4 @@
 
  #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
 
-/*

include/drm/ttm/ttm_placement.h line 76

Quoted 10 lines
include/drm/ttm/ttm_placement.h +0 -9
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
  #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

yes. please don't do this, I need them.

Quoted 75 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 60 lines
---
 drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
 include/drm/ttm/ttm_placement.h | 19 -------------------
 2 files changed, 1 insertion(+), 20 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index bc37f02..4d2e8f2 100644
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
 {
 	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
 		if (place->flags & (1 << i)) {
 			*mem_type = i;
 			return 0;
include/drm/ttm/ttm_placement.h +0 -17
index 8ed44f9..20219d9 100644
@@ -40,10 +40,6 @@
 #define TTM_PL_PRIV0            3
 #define TTM_PL_PRIV1            4
 #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
 #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
 #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
 #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
 #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
 #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
 #define TTM_PL_MASK_MEM         0x0000FFFF
 /*
@@ -72,7 +64,6 @@
 #define TTM_PL_FLAG_CACHED      (1 << 16)
 #define TTM_PL_FLAG_UNCACHED    (1 << 17)
 #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
 #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
 #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
 #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
-/*
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
Quoted 8 lines

include/drm/ttm/ttm_placement.h line 76

Quoted 3 lines
include/drm/ttm/ttm_placement.h +0 -2
-#define TTM_ACCESS_WRITE        (1 << 1)
-
 #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

In this case please just add them back in your tree. That should be a two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:

Quoted 83 lines

yes. please don't do this, I need them.

Quoted 80 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 52 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
  include/drm/ttm/ttm_placement.h | 19 -------------------
  2 files changed, 1 insertion(+), 20 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index bc37f02..4d2e8f2 100644
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
  {
  	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
  		if (place->flags & (1 << i)) {
  			*mem_type = i;
  			return 0;
include/drm/ttm/ttm_placement.h +0 -10
index 8ed44f9..20219d9 100644
@@ -40,10 +40,6 @@
  #define TTM_PL_PRIV0            3
  #define TTM_PL_PRIV1            4
  #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
  #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
  #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
  #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
  #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
  #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
  #define TTM_PL_MASK_MEM         0x0000FFFF
  /*
@@ -72,7 +64,6 @@
  #define TTM_PL_FLAG_CACHED      (1 << 16)
  #define TTM_PL_FLAG_UNCACHED    (1 << 17)
  #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
  #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
  #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
  #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
-/*

include/drm/ttm/ttm_placement.h line 74

Quoted 10 lines
include/drm/ttm/ttm_placement.h +0 -9
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
  #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 79675437-85ae-2fbf-93e1-b49321e6a41e-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#9 lore raw

Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

As you mentioned that it just a two liner. And there is actually no functionality break with these flags. Then how about keep these flags?

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <[email protected]>; Zhou, David(ChunMing) <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:

Quoted 83 lines

yes. please don't do this, I need them.

Quoted 80 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 52 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
  include/drm/ttm/ttm_placement.h | 19 -------------------
  2 files changed, 1 insertion(+), 20 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
  {
  	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
  		if (place->flags & (1 << i)) {
  			*mem_type = i;
  			return 0;
(quoted diff) +0 -0

b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

include/drm/ttm/ttm_placement.h +0 -10
@@ -40,10 +40,6 @@
  #define TTM_PL_PRIV0            3
  #define TTM_PL_PRIV1            4
  #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
  #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
  #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
  #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
  #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
  #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
  #define TTM_PL_MASK_MEM         0x0000FFFF
  /*
@@ -72,7 +64,6 @@
  #define TTM_PL_FLAG_CACHED      (1 << 16)
  #define TTM_PL_FLAG_UNCACHED    (1 << 17)
  #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
  #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
  #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
  #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
-/*

include/drm/ttm/ttm_placement.h line 74

Quoted 10 lines
include/drm/ttm/ttm_placement.h +0 -9
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
  #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw
In reply to a message not in the archive

Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

As you mentioned that it just a two liner. And there is actually no functionality break with these flags. Then how about keep these flags?

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <[email protected]>; Zhou, David(ChunMing) <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:

Quoted 83 lines

yes. please don't do this, I need them.

Quoted 80 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 52 lines
---
  drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
  include/drm/ttm/ttm_placement.h | 19 -------------------
  2 files changed, 1 insertion(+), 20 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
  {
  	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
  		if (place->flags & (1 << i)) {
  			*mem_type = i;
  			return 0;
(quoted diff) +0 -0

b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

include/drm/ttm/ttm_placement.h +0 -10
@@ -40,10 +40,6 @@
  #define TTM_PL_PRIV0            3
  #define TTM_PL_PRIV1            4
  #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
  #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
  #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
  #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
  #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
  #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
  #define TTM_PL_MASK_MEM         0x0000FFFF
  /*
@@ -72,7 +64,6 @@
  #define TTM_PL_FLAG_CACHED      (1 << 16)
  #define TTM_PL_FLAG_UNCACHED    (1 << 17)
  #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
  #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
  #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
  #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
-/*

include/drm/ttm/ttm_placement.h line 74

Quoted 10 lines
include/drm/ttm/ttm_placement.h +0 -9
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
  #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB120407ACA888A0E57CA16D7AFCFA0-/b2+HYfkarSdTuMsQheahAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#12 lore raw

Hi Hawking,

Quoted 1 line

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement.

And that is exactly the reason why I want to remove the unused flags.

Quoted 1 line

There is no guarantee that amdgpu would never introduce new memory domain in future.

Irrelevant, if any driver wants to use additional domains it should add them when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any need for that.

Quoted 1 line

Then how about keep these flags?

Actually we used to have automated scanners which complain about unused code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Regards,
Christian.

Am 09.09.2016 um 12:35 schrieb Zhang, Hawking:

Quoted 107 lines

Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

As you mentioned that it just a two liner. And there is actually no functionality break with these flags. Then how about keep these flags?

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <[email protected]>; Zhou, David(ChunMing) <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two liner.

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:

Quoted 82 lines

yes. please don't do this, I need them.

Quoted 79 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 52 lines
---
   drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
   include/drm/ttm/ttm_placement.h | 19 -------------------
   2 files changed, 1 insertion(+), 20 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
   {
   	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
   		if (place->flags & (1 << i)) {
   			*mem_type = i;
   			return 0;
(quoted diff) +0 -0

b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

include/drm/ttm/ttm_placement.h +0 -10
@@ -40,10 +40,6 @@
   #define TTM_PL_PRIV0            3
   #define TTM_PL_PRIV1            4
   #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
   #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
   #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
   #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
   #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
   #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
   #define TTM_PL_MASK_MEM         0x0000FFFF
   /*
@@ -72,7 +64,6 @@
   #define TTM_PL_FLAG_CACHED      (1 << 16)
   #define TTM_PL_FLAG_UNCACHED    (1 << 17)
   #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
   #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
   #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
   #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
-/*

include/drm/ttm/ttm_placement.h line 74

Quoted 10 lines
include/drm/ttm/ttm_placement.h +0 -9
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
   #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#13 lore raw
Quoted 16 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Friday, September 09, 2016 7:24 AM
To: Zhang, Hawking; Koenig, Christian; Cui, Flora; Zhou, David(ChunMing); [email protected]
Cc: [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

Hi Hawking,

Quoted 1 line

Removing the flag will make ttm_mem_type_from_place skip counting the

corresponding placement and thus have impact on mem region create and bo movement.
And that is exactly the reason why I want to remove the unused flags.

Quoted 7 lines
Quoted 1 line

There is no guarantee that amdgpu would never introduce new memory

domain in future.
Irrelevant, if any driver wants to use additional domains it should add them when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any need for that.

We need it for the hybrid driver in the near feature and the open driver may use it in the future depending on the use cases. Removing it just makes our lives more difficult for supporting dkms and distro integration for very minimal gain.

Alex

Quoted 139 lines
Quoted 2 lines

Then how about keep these flags?

Actually we used to have automated scanners which complain about unused code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Regards,
Christian.

Am 09.09.2016 um 12:35 schrieb Zhang, Hawking:

Quoted 3 lines

Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the

corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

Quoted 2 lines

As you mentioned that it just a two liner. And there is actually no

functionality break with these flags. Then how about keep these flags?

Quoted 6 lines

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf

Of Christian K?nig

Quoted 2 lines

Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <[email protected]>; Zhou, David(ChunMing)

<[email protected]>

Quoted 4 lines

Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two

liner.

Quoted 29 lines

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:

Quoted 22 lines

yes. please don't do this, I need them.

Quoted 19 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 6 lines
---
   drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
   include/drm/ttm/ttm_placement.h | 19 -------------------
   2 files changed, 1 insertion(+), 20 deletions(-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/ttm/ttm_bo.c static inline int ttm_mem_type_from_place(const

Quoted 5 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

drivers/gpu/drm/ttm/ttm_bo.c +0 -0
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const

struct ttm_place *place,

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
   {
   	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
   		if (place->flags & (1 << i)) {
   			*mem_type = i;
   			return 0;
(quoted diff) +0 -0

b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

include/drm/ttm/ttm_placement.h +0 -8
@@ -40,10 +40,6 @@
   #define TTM_PL_PRIV0            3
   #define TTM_PL_PRIV1            4
   #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
   #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
   #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
   #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
   #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
   #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
   #define TTM_PL_MASK_MEM         0x0000FFFF
   /*
@@ -72,7 +64,6 @@
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

include/drm/ttm/ttm_placement.h line 73

Quoted 8 lines
include/drm/ttm/ttm_placement.h +0 -1
   #define TTM_PL_FLAG_CACHED      (1 << 16)
   #define TTM_PL_FLAG_UNCACHED    (1 << 17)
   #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
   #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
   #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
   #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM |

TTM_PL_MASK_CACHING)

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
include/drm/ttm/ttm_placement.h +0 -7
-/*
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
Quoted 8 lines
Quoted 8 lines

include/drm/ttm/ttm_placement.h line 74

Quoted 4 lines
include/drm/ttm/ttm_placement.h +0 -3
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
   #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): MWHPR12MB1694DB49A6A9336A654384C3F7FA0-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#15 lore raw

Am 09.09.2016 um 15:41 schrieb Deucher, Alexander:

Quoted 16 lines
Quoted 16 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Friday, September 09, 2016 7:24 AM
To: Zhang, Hawking; Koenig, Christian; Cui, Flora; Zhou, David(ChunMing); [email protected]
Cc: [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

Hi Hawking,

Quoted 1 line

Removing the flag will make ttm_mem_type_from_place skip counting the

corresponding placement and thus have impact on mem region create and bo movement.
And that is exactly the reason why I want to remove the unused flags.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

There is no guarantee that amdgpu would never introduce new memory

domain in future.
Irrelevant, if any driver wants to use additional domains it should add them when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any need for that.

We need it for the hybrid driver in the near feature and the open driver may use it in the future depending on the use cases. Removing it just makes our lives more difficult for supporting dkms and distro integration for very minimal gain.

Yeah, agree. The problem is I already did so without knowing that.

I will send out a V2 only removing the stuff we explicitly don't need.

Hopefully nobody will notice and question further, Christian.

Quoted 140 lines

Alex

Quoted 137 lines
Quoted 1 line

Then how about keep these flags?

Actually we used to have automated scanners which complain about unused code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Regards,
Christian.

Am 09.09.2016 um 12:35 schrieb Zhang, Hawking:

Quoted 3 lines

Hi Chris,

Removing the flag will make ttm_mem_type_from_place skip counting the

corresponding placement and thus have impact on mem region create and bo movement. There is no guarantee that amdgpu would never introduce new memory domain in future. In such case, I'd like to vote for keeping these flags instead of adding them back when amdgpu need to add new memory domain.

Quoted 1 line

As you mentioned that it just a two liner. And there is actually no

functionality break with these flags. Then how about keep these flags?

Quoted 5 lines

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf

Of Christian K?nig

Quoted 2 lines

Sent: Friday, September 09, 2016 17:07
To: Cui, Flora <[email protected]>; Zhou, David(ChunMing)

<[email protected]>

Quoted 4 lines

Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/2] drm/ttm: remove unused placement flags

In this case please just add them back in your tree. That should be a two

liner.

Quoted 28 lines

For upstream it certainly doesn't make sense to keep them.

Regards,
Christian.

Am 09.09.2016 um 09:01 schrieb Flora Cui:

Quoted 22 lines

yes. please don't do this, I need them.

Quoted 19 lines · On Fri, Sep 09, 2016 at 02:41:16PM +0800, zhoucm1 wrote:
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

Either never used or not used in quite a while.

No, I remember Flora's Direct GMA is using them like GDS use PRIV0-2. And you cannot make sure there isn't no one using them in other closed projects, right?
If you removed now, that obviously will break her implementation and brings her many troubles.

Regards,
David Zhou

Quoted 6 lines
---
    drivers/gpu/drm/ttm/ttm_bo.c    |  2 +-
    include/drm/ttm/ttm_placement.h | 19 -------------------
    2 files changed, 1 insertion(+), 20 deletions(-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/ttm/ttm_bo.c static inline int ttm_mem_type_from_place(const

Quoted 5 lines
(quoted diff) +0 -0

b/drivers/gpu/drm/ttm/ttm_bo.c index bc37f02..4d2e8f2 100644

drivers/gpu/drm/ttm/ttm_bo.c +0 -0
@@ -59,7 +59,7 @@ static inline int ttm_mem_type_from_place(const

struct ttm_place *place,

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
    {
    	int i;
-	for (i = 0; i <= TTM_PL_PRIV5; i++)
+	for (i = 0; i <= TTM_PL_PRIV2; i++)
    		if (place->flags & (1 << i)) {
    			*mem_type = i;
    			return 0;
(quoted diff) +0 -0

b/include/drm/ttm/ttm_placement.h index 8ed44f9..20219d9 100644

include/drm/ttm/ttm_placement.h +0 -8
@@ -40,10 +40,6 @@
    #define TTM_PL_PRIV0            3
    #define TTM_PL_PRIV1            4
    #define TTM_PL_PRIV2            5
-#define TTM_PL_PRIV3            6
-#define TTM_PL_PRIV4            7
-#define TTM_PL_PRIV5            8
-#define TTM_PL_SWAPPED          15
    #define TTM_PL_FLAG_SYSTEM      (1 << TTM_PL_SYSTEM)
    #define TTM_PL_FLAG_TT          (1 << TTM_PL_TT)
@@ -51,10 +47,6 @@
    #define TTM_PL_FLAG_PRIV0       (1 << TTM_PL_PRIV0)
    #define TTM_PL_FLAG_PRIV1       (1 << TTM_PL_PRIV1)
    #define TTM_PL_FLAG_PRIV2       (1 << TTM_PL_PRIV2)
-#define TTM_PL_FLAG_PRIV3       (1 << TTM_PL_PRIV3)
-#define TTM_PL_FLAG_PRIV4       (1 << TTM_PL_PRIV4)
-#define TTM_PL_FLAG_PRIV5       (1 << TTM_PL_PRIV5)
-#define TTM_PL_FLAG_SWAPPED     (1 << TTM_PL_SWAPPED)
    #define TTM_PL_MASK_MEM         0x0000FFFF
    /*
@@ -72,7 +64,6 @@
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

include/drm/ttm/ttm_placement.h line 73

Quoted 8 lines
include/drm/ttm/ttm_placement.h +0 -1
    #define TTM_PL_FLAG_CACHED      (1 << 16)
    #define TTM_PL_FLAG_UNCACHED    (1 << 17)
    #define TTM_PL_FLAG_WC          (1 << 18)
-#define TTM_PL_FLAG_SHARED      (1 << 20)
    #define TTM_PL_FLAG_NO_EVICT    (1 << 21)
    #define TTM_PL_FLAG_TOPDOWN     (1 << 22)
@@ -82,14 +73,4 @@
    #define TTM_PL_MASK_MEMTYPE     (TTM_PL_MASK_MEM |

TTM_PL_MASK_CACHING)

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
include/drm/ttm/ttm_placement.h +0 -7
-/*
- * Access flags to be used for CPU- and GPU- mappings.
- * The idea is that the TTM synchronization mechanism will
- * allow concurrent READ access and exclusive write access.
- * Currently GPU- and CPU accesses are exclusive.
- */
-
Quoted 8 lines
Quoted 8 lines

include/drm/ttm/ttm_placement.h line 74

Quoted 4 lines
include/drm/ttm/ttm_placement.h +0 -3
-#define TTM_ACCESS_READ         (1 << 0)
-#define TTM_ACCESS_WRITE        (1 << 1)
-
    #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#16 lore raw
In reply to Christian König
Quoted 17 lines · Christian König

Hi Hawking,

Quoted 3 lines

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement.

And that is exactly the reason why I want to remove the unused flags.

Quoted 2 lines

There is no guarantee that amdgpu would never introduce new memory domain in future.

Irrelevant, if any driver wants to use additional domains it should add them when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any need for that.

Quoted 7 lines
Quoted 1 line

Then how about keep these flags?

Actually we used to have automated scanners which complain about unused code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Fwiw I second Christian here. If they are unused in open-source drivers there's no reason to keep them.
If/as that changes the (newly introduced) user can add back the relevant code.

If closed-source driver(s) use them, then they can keep it as part of their blob. Upstream kernel does not cater for closed-source drivers, period.
I realise that's not the answer some are hoping for, so if you want to question it take it up with Linus and co.

Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): CACvgo53AAEsxAoQvAe=ffMnQiZiE=MPWne2Abg=rAt4bRkK8NQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#18 lore raw

Am 09.09.2016 um 15:54 schrieb Emil Velikov:

Quoted 17 lines · Christian König
Quoted 16 lines

Hi Hawking,

Quoted 3 lines

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement.

And that is exactly the reason why I want to remove the unused flags.

Quoted 2 lines

There is no guarantee that amdgpu would never introduce new memory domain in future.

Irrelevant, if any driver wants to use additional domains it should add them when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any need for that.

Quoted 1 line

Then how about keep these flags?

Quoted 8 lines
Quoted 5 lines

Actually we used to have automated scanners which complain about unused code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Fwiw I second Christian here. If they are unused in open-source drivers there's no reason to keep them.
If/as that changes the (newly introduced) user can add back the relevant code.

Crap to late :( I was about to send a V2 of the patch to keep the PRIV flags.

Quoted 5 lines

If closed-source driver(s) use them, then they can keep it as part of their blob. Upstream kernel does not cater for closed-source drivers, period.
I realise that's not the answer some are hoping for, so if you want to question it take it up with Linus and co.

It's not an issue between closed vs. open, but rather additional work of rebasing the open code when we start to use additional domains.

But on the other hand I still haven't seen a good reason for using those. As far as I know we have covered all resource in the current and next hardware generation with the existing flags.

Regards,
Christian.

Quoted 2 lines

Regards,
Emil

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#19 lore raw
Quoted 31 lines · Christian König

Am 09.09.2016 um 15:54 schrieb Emil Velikov:

Quoted 30 lines
Quoted 27 lines · Christian König

Hi Hawking,

Quoted 3 lines

Removing the flag will make ttm_mem_type_from_place skip counting the corresponding placement and thus have impact on mem region create and bo movement.

And that is exactly the reason why I want to remove the unused flags.

Quoted 3 lines

There is no guarantee that amdgpu would never introduce new memory domain
in future.

Irrelevant, if any driver wants to use additional domains it should add them
when they are used.

BTW: Why would we want to add another TTM domain? I really don't see any need for that.

Quoted 1 line

Then how about keep these flags?

Actually we used to have automated scanners which complain about unused code. I'm wondering why they don't detected that earlier.

Anyway any code which isn't used in a while should be removed.

Quoted 9 lines
Quoted 4 lines

Fwiw I second Christian here. If they are unused in open-source drivers there's no reason to keep them.
If/as that changes the (newly introduced) user can add back the relevant code.

Crap to late :( I was about to send a V2 of the patch to keep the PRIV flags.

Oops, sorry :-)

Quoted 10 lines
Quoted 5 lines

If closed-source driver(s) use them, then they can keep it as part of their blob. Upstream kernel does not cater for closed-source drivers, period.
I realise that's not the answer some are hoping for, so if you want to question it take it up with Linus and co.

It's not an issue between closed vs. open, but rather additional work of rebasing the open code when we start to use additional domains.

This should serve as a greater initiative to develop and upstream things in a gradual manner, no ?
We all get carried away sometimes creating a massive branch which just cannot go in at once.

Quoted 4 lines

But on the other hand I still haven't seen a good reason for using those. As far as I know we have covered all resource in the current and next hardware generation with the existing flags.

This in itself is a pretty good point as well, considering you know the hardware fairly well and you've worked in the kernel for quite a while now.

Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel