Skip to contentSkip to conversation

drm/amdgpu: add JPEG check to VCN idle handler and begin use

PATCH In review Leo Liu 6 participants 12 messages Dec 11, 2019 – Dec 13, 2019

Subsystems (2)
lore
Share & tools
lore

Leo Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: add JPEG check to VCN idle handler and begin use

Since it's only needed with VCN1.0 when HW has no its own JPEG HW IP block

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  2 ++
 2 files changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +18 -11
index 428cfd58b37d..95ac721f2de0 100644
@@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 		}
 	}
 
+	adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
+		true : false;
+
 	return 0;
 }
 
@@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
 			else
 				new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-			if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-				new_state.jpeg = VCN_DPG_STATE__PAUSE;
-			else
-				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
+			if (!adev->vcn.has_jpeg_block) {
+				if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
+					new_state.jpeg = VCN_DPG_STATE__PAUSE;
+				else
+					new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+			}
 			adev->vcn.pause_dpg_mode(adev, &new_state);
 		}
 
-		fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
+		if (!adev->vcn.has_jpeg_block)
+			fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
 		fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec);
 		fences += fence[j];
 	}
@@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 		else
 			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-		if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
-			new_state.jpeg = VCN_DPG_STATE__PAUSE;
-		else
-			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+		if (!adev->vcn.has_jpeg_block) {
+			if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
+				new_state.jpeg = VCN_DPG_STATE__PAUSE;
+			else
+				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+		}
 
 		if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
 			new_state.fw_based = VCN_DPG_STATE__PAUSE;
-		else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+		else if (!adev->vcn.has_jpeg_block && ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
 			new_state.jpeg = VCN_DPG_STATE__PAUSE;
 
 		adev->vcn.pause_dpg_mode(adev, &new_state);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2 -0
index 402a5046b985..9a2381d006c6 100644
@@ -192,6 +192,8 @@ struct amdgpu_vcn {
 	unsigned	harvest_config;
 	int (*pause_dpg_mode)(struct amdgpu_device *adev,
 		struct dpg_pause_state *new_state);
+
+	bool has_jpeg_block;
 };
 
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Leo Liu

Since it's only needed with VCN1.0 when HW has no its own JPEG HW IP block

typo "HW does not have its own"
With that fixed:

Quoted 83 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  2 ++
 2 files changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +18 -11
index 428cfd58b37d..95ac721f2de0 100644
@@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
                }
        }
 
+       adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
+               true : false;
+
        return 0;
 }
 
@@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
                        else
                                new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-                       if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-                               new_state.jpeg = VCN_DPG_STATE__PAUSE;
-                       else
-                               new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
+                       if (!adev->vcn.has_jpeg_block) {
+                               if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
+                                       new_state.jpeg = VCN_DPG_STATE__PAUSE;
+                               else
+                                       new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+                       }
                        adev->vcn.pause_dpg_mode(adev, &new_state);
                }
 
-               fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
+               if (!adev->vcn.has_jpeg_block)
+                       fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
                fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec);
                fences += fence[j];
        }
@@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
                else
                        new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-               if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
-                       new_state.jpeg = VCN_DPG_STATE__PAUSE;
-               else
-                       new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+               if (!adev->vcn.has_jpeg_block) {
+                       if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
+                               new_state.jpeg = VCN_DPG_STATE__PAUSE;
+                       else
+                               new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+               }
 
                if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
                        new_state.fw_based = VCN_DPG_STATE__PAUSE;
-               else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+               else if (!adev->vcn.has_jpeg_block && ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
                        new_state.jpeg = VCN_DPG_STATE__PAUSE;
 
                adev->vcn.pause_dpg_mode(adev, &new_state);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2 -1
index 402a5046b985..9a2381d006c6 100644
@@ -192,6 +192,8 @@ struct amdgpu_vcn {
        unsigned        harvest_config;
        int (*pause_dpg_mode)(struct amdgpu_device *adev,
                struct dpg_pause_state *new_state);
+
+       bool has_jpeg_block;
 };
 
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
--

2.17.1

Quoted 4 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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Leo Liu

This patch is

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Leo Liu
Sent: December 11, 2019 2:48 PM
To: [email protected]
Cc: Liu, Leo <[email protected]>
Subject: [PATCH] drm/amdgpu: add JPEG check to VCN idle handler and begin use

Since it's only needed with VCN1.0 when HW has no its own JPEG HW IP block

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++----------  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  2 ++
 2 files changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +12 -6
index 428cfd58b37d..95ac721f2de0 100644
@@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 		}
 	}
 
+	adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
+		true : false;
+
 	return 0;
 }
 
@@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
 			else
 				new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-			if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-				new_state.jpeg = VCN_DPG_STATE__PAUSE;
-			else
-				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
+			if (!adev->vcn.has_jpeg_block) {
+				if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
+					new_state.jpeg = VCN_DPG_STATE__PAUSE;
+				else
+					new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+			}
 			adev->vcn.pause_dpg_mode(adev, &new_state);
 		}
 
-		fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
+		if (!adev->vcn.has_jpeg_block)
+			fence[j] += 
+amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
 		fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec);
 		fences += fence[j];

}
@@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
else
new_state.fw_based = VCN_DPG_STATE__UNPAUSE;

- if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
- new_state.jpeg = VCN_DPG_STATE__PAUSE;
- else
- new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+ if (!adev->vcn.has_jpeg_block) {
+ if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
+ new_state.jpeg = VCN_DPG_STATE__PAUSE;
+ else
+ new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+ }

if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
new_state.fw_based = VCN_DPG_STATE__PAUSE;
- else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+ else if (!adev->vcn.has_jpeg_block && ring->funcs->type ==
+AMDGPU_RING_TYPE_VCN_JPEG)
new_state.jpeg = VCN_DPG_STATE__PAUSE;

adev->vcn.pause_dpg_mode(adev, &new_state); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
index 402a5046b985..9a2381d006c6 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2 -0
@@ -192,6 +192,8 @@ struct amdgpu_vcn {
 	unsigned	harvest_config;
 	int (*pause_dpg_mode)(struct amdgpu_device *adev,
 		struct dpg_pause_state *new_state);
+
+	bool has_jpeg_block;
 };
 
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);

--
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cboyuan.zhang%40amd.com%7C141d98480bb4442c6dff08d77e733651%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637116905879102653&amp;sdata=6Ce6RR2jvpsESZs1I%2FOsYTX1cmImmftEBqfqpN8cp4s%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to Leo Liu

Am 11.12.19 um 20:48 schrieb Leo Liu:

Quoted 2 lines

Since it's only needed with VCN1.0 when HW has no its own JPEG HW IP block

Wouldn't it be simpler/cleaner to just define a vcn_v1_0_ring_begin_use() and vcn_v1_0_idle_work_handler() instead?

Regards,
Christian.

Quoted 72 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++----------
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  2 ++
  2 files changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +18 -11
index 428cfd58b37d..95ac721f2de0 100644
@@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
  		}
  	}
 
+	adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
+		true : false;
+
  	return 0;
  }
 
@@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
  			else
  				new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-			if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-				new_state.jpeg = VCN_DPG_STATE__PAUSE;
-			else
-				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
+			if (!adev->vcn.has_jpeg_block) {
+				if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
+					new_state.jpeg = VCN_DPG_STATE__PAUSE;
+				else
+					new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+			}
  			adev->vcn.pause_dpg_mode(adev, &new_state);
  		}
 
-		fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
+		if (!adev->vcn.has_jpeg_block)
+			fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
  		fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec);
  		fences += fence[j];
  	}
@@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
  		else
  			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-		if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
-			new_state.jpeg = VCN_DPG_STATE__PAUSE;
-		else
-			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+		if (!adev->vcn.has_jpeg_block) {
+			if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
+				new_state.jpeg = VCN_DPG_STATE__PAUSE;
+			else
+				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+		}
 
  		if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
  			new_state.fw_based = VCN_DPG_STATE__PAUSE;
-		else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+		else if (!adev->vcn.has_jpeg_block && ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
  			new_state.jpeg = VCN_DPG_STATE__PAUSE;
 
  		adev->vcn.pause_dpg_mode(adev, &new_state);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +0 -0
index 402a5046b985..9a2381d006c6 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h struct amdgpu_vcn { · line 199

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2 -0
@@ -192,6 +192,8 @@ struct amdgpu_vcn {
  	unsigned	harvest_config;
  	int (*pause_dpg_mode)(struct amdgpu_device *adev,
  		struct dpg_pause_state *new_state);
+
+	bool has_jpeg_block;
  };
 
  int amdgpu_vcn_sw_init(struct amdgpu_device *adev);

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

author
#4 lore raw
Quoted 5 lines · Christian König

Am 11.12.19 um 20:48 schrieb Leo Liu:

Quoted 2 lines

Since it's only needed with VCN1.0 when HW has no its own JPEG HW IP block

Wouldn't it be simpler/cleaner to just define a vcn_v1_0_ring_begin_use() and vcn_v1_0_idle_work_handler() instead?

Yeah, this way should be cleaner, even though the changes got bigger, the new set will be sent shortly.

Thanks,

Leo

Quoted 73 lines

Regards,
Christian.

Quoted 69 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29 +++++++++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  2 ++

  2 files changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -0
index 428cfd58b37d..95ac721f2de0 100644
@@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
           }
       }

  +    adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ? +        true : false;
+
      return 0;
  }
  @@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work) else
                  new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
  -            if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-                new_state.jpeg = VCN_DPG_STATE__PAUSE;
-            else
-                new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
+            if (!adev->vcn.has_jpeg_block) {
+                if
(amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
+                    new_state.jpeg = VCN_DPG_STATE__PAUSE;
+                else
+                    new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+            }
              adev->vcn.pause_dpg_mode(adev, &new_state);
          }
  -        fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec); +        if (!adev->vcn.has_jpeg_block)
+            fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
          fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec); fences += fence[j];
      }

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -0
@@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct 
 amdgpu_ring *ring)

          else
              new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
  -        if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec)) -            new_state.jpeg = VCN_DPG_STATE__PAUSE;
-        else
-            new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+        if (!adev->vcn.has_jpeg_block) {
+            if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec)) +                new_state.jpeg = VCN_DPG_STATE__PAUSE;
+            else
+                new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+        }
            if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC) new_state.fw_based = VCN_DPG_STATE__PAUSE;
-        else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) +        else if (!adev->vcn.has_jpeg_block && ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
              new_state.jpeg = VCN_DPG_STATE__PAUSE; adev->vcn.pause_dpg_mode(adev, &new_state);

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +0 -0
index 402a5046b985..9a2381d006c6 100644
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h struct amdgpu_vcn { · line 198

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2 -0
@@ -192,6 +192,8 @@ struct amdgpu_vcn {
       unsigned    harvest_config;
       int (*pause_dpg_mode)(struct amdgpu_device *adev,
           struct dpg_pause_state *new_state);
+
+    bool has_jpeg_block;
   };
     int amdgpu_vcn_sw_init(struct amdgpu_device *adev);

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

maintainer
#5 lore raw

Am 12.12.19 um 16:57 schrieb Leo Liu:

Quoted 9 lines · Christian König
Quoted 5 lines

Am 11.12.19 um 20:48 schrieb Leo Liu:

Quoted 2 lines

Since it's only needed with VCN1.0 when HW has no its own JPEG HW IP block

Wouldn't it be simpler/cleaner to just define a vcn_v1_0_ring_begin_use() and vcn_v1_0_idle_work_handler() instead?

Yeah, this way should be cleaner, even though the changes got bigger, the new set will be sent shortly.

Keep in mind that you don't need to fully clone the code.

You probably can still call the common VCN helper code quite a bit.

Christian.

Quoted 90 lines

Thanks,

Leo

Quoted 83 lines

Regards,
Christian.

Quoted 78 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 29
+++++++++++++++----------
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  2 ++

  2 files changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -0
index 428cfd58b37d..95ac721f2de0 100644
@@ -186,6 +186,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
           }
       }

  +    adev->vcn.has_jpeg_block = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ? +        true : false;
+
      return 0;
  }
  @@ -306,15 +309,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work) else
                  new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
  -            if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-                new_state.jpeg = VCN_DPG_STATE__PAUSE;
-            else
-                new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
+            if (!adev->vcn.has_jpeg_block) {
+                if
(amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
+                    new_state.jpeg = VCN_DPG_STATE__PAUSE;
+                else
+                    new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+            }
              adev->vcn.pause_dpg_mode(adev, &new_state);
          }
  -        fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec); +        if (!adev->vcn.has_jpeg_block)
+            fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
          fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec); fences += fence[j];
      }

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -0
@@ -358,14 +363,16 @@ void amdgpu_vcn_ring_begin_use(struct 
 amdgpu_ring *ring)

          else
              new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
  -        if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec)) -            new_state.jpeg = VCN_DPG_STATE__PAUSE;
-        else
-            new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+        if (!adev->vcn.has_jpeg_block) {
+            if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec)) +                new_state.jpeg = VCN_DPG_STATE__PAUSE;
+            else
+                new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+        }
            if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC) new_state.fw_based = VCN_DPG_STATE__PAUSE;
-        else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG) +        else if (!adev->vcn.has_jpeg_block && ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
              new_state.jpeg = VCN_DPG_STATE__PAUSE; adev->vcn.pause_dpg_mode(adev, &new_state);

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2 -0
index 402a5046b985..9a2381d006c6 100644
@@ -192,6 +192,8 @@ struct amdgpu_vcn {
       unsigned    harvest_config;
       int (*pause_dpg_mode)(struct amdgpu_device *adev,
           struct dpg_pause_state *new_state);
+
+    bool has_jpeg_block;
   };
     int amdgpu_vcn_sw_init(struct amdgpu_device *adev);

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

author
#6 lore raw

PATCH 1/2 drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs

In reply to Leo Liu

Because VCN1.0 power management and DPG mode are managed together with JPEG1.0 under both HW and FW, so separated them from general VCN code. Also the multiple instances case got removed, since VCN1.0 HW just have a single instance.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c |  7 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  3 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c  |  3 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   | 88 ++++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h   |  2 +
 5 files changed, 96 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -4
index 428cfd58b37d..e962c87d04cf 100644
@@ -39,9 +39,6 @@
 #include "vcn/vcn_1_0_offset.h"
 #include "vcn/vcn_1_0_sh_mask.h"
 
-/* 1 second timeout */
-#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
-
 /* Firmware Names */
 #define FIRMWARE_RAVEN		"amdgpu/raven_vcn.bin"
 #define FIRMWARE_PICASSO	"amdgpu/picasso_vcn.bin"
@@ -71,7 +68,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 	unsigned char fw_check;
 	int i, r;
 
-	INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
+	/* For VCN2.0 and above */
+	if (adev->asic_type >= CHIP_ARCTURUS)
+		INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
 
 	switch (adev->asic_type) {
 	case CHIP_RAVEN:
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
index 402a5046b985..3484ead62046 100644
@@ -56,6 +56,9 @@
 #define VCN_VID_IP_ADDRESS_2_0		0x0
 #define VCN_AON_IP_ADDRESS_2_0		0x30000
 
+/* 1 second timeout */
+#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
+
 #define RREG32_SOC15_DPG_MODE(ip, inst, reg, mask, sram_sel) 				\
 	({	WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_MASK, mask); 			\
 		WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_CTL, 				\
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +2 -1
index a141408dfb23..0debfd9f428c 100644
@@ -25,6 +25,7 @@
 #include "amdgpu_jpeg.h"
 #include "soc15.h"
 #include "soc15d.h"
+#include "vcn_v1_0.h"
 
 #include "vcn/vcn_1_0_offset.h"
 #include "vcn/vcn_1_0_sh_mask.h"
@@ -561,7 +562,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
 	.insert_start = jpeg_v1_0_decode_ring_insert_start,
 	.insert_end = jpeg_v1_0_decode_ring_insert_end,
 	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
 	.end_use = amdgpu_vcn_ring_end_use,
 	.emit_wreg = jpeg_v1_0_decode_ring_emit_wreg,
 	.emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +86 -2

124 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +2 -0
index 2a497a7a4840..f67d7391fc21 100644
@@ -24,6 +24,8 @@
 #ifndef __VCN_V1_0_H__
 #define __VCN_V1_0_H__
 
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
+
 extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
 
 #endif
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#7 lore raw

PATCH 2/2 drm/amdgpu/vcn: remove JPEG related code from idle handler and begin use

For VCN2.0 and above, VCN has been separated from JPEG

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 28 +++++--------------------
 1 file changed, 5 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -23
index e962c87d04cf..2ff04d0047ed 100644
@@ -293,6 +293,7 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
 	for (j = 0; j < adev->vcn.num_vcn_inst; ++j) {
 		if (adev->vcn.harvest_config & (1 << j))
 			continue;
+
 		for (i = 0; i < adev->vcn.num_enc_rings; ++i) {
 			fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_enc[i]);
 		}
@@ -305,26 +306,17 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
 			else
 				new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-			if (amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec))
-				new_state.jpeg = VCN_DPG_STATE__PAUSE;
-			else
-				new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
 			adev->vcn.pause_dpg_mode(adev, &new_state);
 		}
 
-		fence[j] += amdgpu_fence_count_emitted(&adev->jpeg.inst[j].ring_dec);
 		fence[j] += amdgpu_fence_count_emitted(&adev->vcn.inst[j].ring_dec);
 		fences += fence[j];
 	}
 
 	if (fences == 0) {
 		amdgpu_gfx_off_ctrl(adev, true);
-		if (adev->asic_type < CHIP_ARCTURUS && adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_uvd(adev, false);
-		else
-			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
-							       AMD_PG_STATE_GATE);
+		amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+		       AMD_PG_STATE_GATE);
 	} else {
 		schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
 	}
@@ -337,11 +329,8 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 
 	if (set_clocks) {
 		amdgpu_gfx_off_ctrl(adev, false);
-		if (adev->asic_type < CHIP_ARCTURUS && adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_uvd(adev, true);
-		else
-			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
-							       AMD_PG_STATE_UNGATE);
+		amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+		       AMD_PG_STATE_UNGATE);
 	}
 
 	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)	{
@@ -357,15 +346,8 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 		else
 			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
 
-		if (amdgpu_fence_count_emitted(&adev->jpeg.inst[ring->me].ring_dec))
-			new_state.jpeg = VCN_DPG_STATE__PAUSE;
-		else
-			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
-
 		if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
 			new_state.fw_based = VCN_DPG_STATE__PAUSE;
-		else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
-			new_state.jpeg = VCN_DPG_STATE__PAUSE;
 
 		adev->vcn.pause_dpg_mode(adev, &new_state);
 	}
Signature · 6 lines
2.17.1

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

Re: [PATCH 1/2] drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs

In reply to Leo Liu
Quoted 213 lines · Leo Liu

Because VCN1.0 power management and DPG mode are managed together with JPEG1.0 under both HW and FW, so separated them from general VCN code. Also the multiple instances case got removed, since VCN1.0 HW just have a single instance.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c |  7 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  3 +
  drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c  |  3 +-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   | 88 ++++++++++++++++++++++++-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h   |  2 +
  5 files changed, 96 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -4
index 428cfd58b37d..e962c87d04cf 100644
@@ -39,9 +39,6 @@
  #include "vcn/vcn_1_0_offset.h"
  #include "vcn/vcn_1_0_sh_mask.h"
 
-/* 1 second timeout */
-#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
-
  /* Firmware Names */
  #define FIRMWARE_RAVEN		"amdgpu/raven_vcn.bin"
  #define FIRMWARE_PICASSO	"amdgpu/picasso_vcn.bin"
@@ -71,7 +68,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
  	unsigned char fw_check;
  	int i, r;
 
-	INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
+	/* For VCN2.0 and above */
+	if (adev->asic_type >= CHIP_ARCTURUS)
+		INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
 
  	switch (adev->asic_type) {
  	case CHIP_RAVEN:
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
index 402a5046b985..3484ead62046 100644
@@ -56,6 +56,9 @@
  #define VCN_VID_IP_ADDRESS_2_0		0x0
  #define VCN_AON_IP_ADDRESS_2_0		0x30000
 
+/* 1 second timeout */
+#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
+
  #define RREG32_SOC15_DPG_MODE(ip, inst, reg, mask, sram_sel) 				\
  	({	WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_MASK, mask); 			\
  		WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_CTL, 				\
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +2 -1
index a141408dfb23..0debfd9f428c 100644
@@ -25,6 +25,7 @@
  #include "amdgpu_jpeg.h"
  #include "soc15.h"
  #include "soc15d.h"
+#include "vcn_v1_0.h"
 
  #include "vcn/vcn_1_0_offset.h"
  #include "vcn/vcn_1_0_sh_mask.h"
@@ -561,7 +562,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
  	.insert_start = jpeg_v1_0_decode_ring_insert_start,
  	.insert_end = jpeg_v1_0_decode_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = jpeg_v1_0_decode_ring_emit_wreg,
  	.emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +86 -2
index 652cecc030b3..7395286540e1 100644
@@ -25,6 +25,7 @@
 
  #include "amdgpu.h"
  #include "amdgpu_vcn.h"
+#include "amdgpu_pm.h"
  #include "soc15.h"
  #include "soc15d.h"
  #include "soc15_common.h"
@@ -51,6 +52,8 @@ static int vcn_v1_0_set_powergating_state(void *handle, enum amd_powergating_sta
  static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
  				struct dpg_pause_state *new_state);
 
+static void vcn_v1_0_idle_work_handler(struct work_struct *work);
+
  /**
   * vcn_v1_0_early_init - set function pointers
   *
@@ -101,6 +104,7 @@ static int vcn_v1_0_sw_init(void *handle)
  			return r;
  	}
 
+	INIT_DELAYED_WORK(&adev->vcn.idle_work, vcn_v1_0_idle_work_handler);
  	r = amdgpu_vcn_sw_init(adev);
  	if (r)
  		return r;
@@ -1758,6 +1762,86 @@ static int vcn_v1_0_set_powergating_state(void *handle,
  	return ret;
  }
 
+static void vcn_v1_0_idle_work_handler(struct work_struct *work)
+{
+	struct amdgpu_device *adev =
+		container_of(work, struct amdgpu_device, vcn.idle_work.work);
+	unsigned int fences = 0, i;
+
+	for (i = 0; i < adev->vcn.num_enc_rings; ++i)
+		fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_enc[i]);
+
+	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
+		struct dpg_pause_state new_state;
+
+		if (fences)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+
+		if (amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec))
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
+		adev->vcn.pause_dpg_mode(adev, &new_state);
+	}
+
+	fences += amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec);
+	fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_dec);
+
+	if (fences == 0) {
+		amdgpu_gfx_off_ctrl(adev, true);
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_uvd(adev, false);
+		else
+			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+			       AMD_PG_STATE_GATE);
+	} else {
+		schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
+	}
+}
+
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring)
+{
+	struct amdgpu_device *adev = ring->adev;
+	bool set_clocks = !cancel_delayed_work_sync(&adev->vcn.idle_work);
+
+	if (set_clocks) {
+		amdgpu_gfx_off_ctrl(adev, false);
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_uvd(adev, true);
+		else
+			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+			       AMD_PG_STATE_UNGATE);
+	}
+
+	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
+		struct dpg_pause_state new_state;
+		unsigned int fences = 0, i;
+
+		for (i = 0; i < adev->vcn.num_enc_rings; ++i)
+			fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_enc[i]);
+
+		if (fences)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+
+		if (amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec))
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
+		if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+
+		adev->vcn.pause_dpg_mode(adev, &new_state);
+	}
+}
+
  static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
  	.name = "vcn_v1_0",
  	.early_init = vcn_v1_0_early_init,
@@ -1804,7 +1888,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_dec_ring_vm_funcs = {
  	.insert_start = vcn_v1_0_dec_ring_insert_start,
  	.insert_end = vcn_v1_0_dec_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = vcn_v1_0_dec_ring_emit_wreg,
  	.emit_reg_wait = vcn_v1_0_dec_ring_emit_reg_wait,
@@ -1836,7 +1920,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_enc_ring_vm_funcs = {
  	.insert_nop = amdgpu_ring_insert_nop,
  	.insert_end = vcn_v1_0_enc_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = vcn_v1_0_enc_ring_emit_wreg,
  	.emit_reg_wait = vcn_v1_0_enc_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +0 -0
index 2a497a7a4840..f67d7391fc21 100644

drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h line 31

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +2 -0
@@ -24,6 +24,8 @@
  #ifndef __VCN_V1_0_H__
  #define __VCN_V1_0_H__
 
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
+
  extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
 
  #endif

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

#9 lore raw

Re: [PATCH 1/2] drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs

In reply to Leo Liu

Am 12.12.19 um 17:06 schrieb Leo Liu:

Quoted 29 lines

Because VCN1.0 power management and DPG mode are managed together with JPEG1.0 under both HW and FW, so separated them from general VCN code. Also the multiple instances case got removed, since VCN1.0 HW just have a single instance.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c |  7 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  3 +
  drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c  |  3 +-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   | 88 ++++++++++++++++++++++++-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h   |  2 +
  5 files changed, 96 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -3
index 428cfd58b37d..e962c87d04cf 100644
@@ -39,9 +39,6 @@
  #include "vcn/vcn_1_0_offset.h"
  #include "vcn/vcn_1_0_sh_mask.h"
 
-/* 1 second timeout */
-#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
-
  /* Firmware Names */
  #define FIRMWARE_RAVEN		"amdgpu/raven_vcn.bin"
  #define FIRMWARE_PICASSO	"amdgpu/picasso_vcn.bin"

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c int amdgpu_vcn_sw_init(struct amdgpu_device *adev) · line 73

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -1
@@ -71,7 +68,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
  	unsigned char fw_check;
  	int i, r;
 
-	INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
+	/* For VCN2.0 and above */
+	if (adev->asic_type >= CHIP_ARCTURUS)
+		INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);

Initializing the work structure twice is indeed not a good idea, but I think we could just override the work function in vcn_v1_0_sw_init() after calling vcn_v1_0_sw_init().

Apart from that the series looks good to me,
Christian.

Quoted 177 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -0
  	switch (adev->asic_type) {
  	case CHIP_RAVEN:
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
index 402a5046b985..3484ead62046 100644
@@ -56,6 +56,9 @@
  #define VCN_VID_IP_ADDRESS_2_0		0x0
  #define VCN_AON_IP_ADDRESS_2_0		0x30000
 
+/* 1 second timeout */
+#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
+
  #define RREG32_SOC15_DPG_MODE(ip, inst, reg, mask, sram_sel) 				\
  	({	WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_MASK, mask); 			\
  		WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_CTL, 				\
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +2 -1
index a141408dfb23..0debfd9f428c 100644
@@ -25,6 +25,7 @@
  #include "amdgpu_jpeg.h"
  #include "soc15.h"
  #include "soc15d.h"
+#include "vcn_v1_0.h"
 
  #include "vcn/vcn_1_0_offset.h"
  #include "vcn/vcn_1_0_sh_mask.h"
@@ -561,7 +562,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
  	.insert_start = jpeg_v1_0_decode_ring_insert_start,
  	.insert_end = jpeg_v1_0_decode_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = jpeg_v1_0_decode_ring_emit_wreg,
  	.emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +86 -2
index 652cecc030b3..7395286540e1 100644
@@ -25,6 +25,7 @@
 
  #include "amdgpu.h"
  #include "amdgpu_vcn.h"
+#include "amdgpu_pm.h"
  #include "soc15.h"
  #include "soc15d.h"
  #include "soc15_common.h"
@@ -51,6 +52,8 @@ static int vcn_v1_0_set_powergating_state(void *handle, enum amd_powergating_sta
  static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
  				struct dpg_pause_state *new_state);
 
+static void vcn_v1_0_idle_work_handler(struct work_struct *work);
+
  /**
   * vcn_v1_0_early_init - set function pointers
   *
@@ -101,6 +104,7 @@ static int vcn_v1_0_sw_init(void *handle)
  			return r;
  	}
 
+	INIT_DELAYED_WORK(&adev->vcn.idle_work, vcn_v1_0_idle_work_handler);
  	r = amdgpu_vcn_sw_init(adev);
  	if (r)
  		return r;
@@ -1758,6 +1762,86 @@ static int vcn_v1_0_set_powergating_state(void *handle,
  	return ret;
  }
 
+static void vcn_v1_0_idle_work_handler(struct work_struct *work)
+{
+	struct amdgpu_device *adev =
+		container_of(work, struct amdgpu_device, vcn.idle_work.work);
+	unsigned int fences = 0, i;
+
+	for (i = 0; i < adev->vcn.num_enc_rings; ++i)
+		fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_enc[i]);
+
+	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
+		struct dpg_pause_state new_state;
+
+		if (fences)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+
+		if (amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec))
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
+		adev->vcn.pause_dpg_mode(adev, &new_state);
+	}
+
+	fences += amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec);
+	fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_dec);
+
+	if (fences == 0) {
+		amdgpu_gfx_off_ctrl(adev, true);
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_uvd(adev, false);
+		else
+			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+			       AMD_PG_STATE_GATE);
+	} else {
+		schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
+	}
+}
+
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring)
+{
+	struct amdgpu_device *adev = ring->adev;
+	bool set_clocks = !cancel_delayed_work_sync(&adev->vcn.idle_work);
+
+	if (set_clocks) {
+		amdgpu_gfx_off_ctrl(adev, false);
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_uvd(adev, true);
+		else
+			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+			       AMD_PG_STATE_UNGATE);
+	}
+
+	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
+		struct dpg_pause_state new_state;
+		unsigned int fences = 0, i;
+
+		for (i = 0; i < adev->vcn.num_enc_rings; ++i)
+			fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_enc[i]);
+
+		if (fences)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+
+		if (amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec))
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
+		if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+
+		adev->vcn.pause_dpg_mode(adev, &new_state);
+	}
+}
+
  static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
  	.name = "vcn_v1_0",
  	.early_init = vcn_v1_0_early_init,
@@ -1804,7 +1888,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_dec_ring_vm_funcs = {
  	.insert_start = vcn_v1_0_dec_ring_insert_start,
  	.insert_end = vcn_v1_0_dec_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = vcn_v1_0_dec_ring_emit_wreg,
  	.emit_reg_wait = vcn_v1_0_dec_ring_emit_reg_wait,
@@ -1836,7 +1920,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_enc_ring_vm_funcs = {
  	.insert_nop = amdgpu_ring_insert_nop,
  	.insert_end = vcn_v1_0_enc_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = vcn_v1_0_enc_ring_emit_wreg,
  	.emit_reg_wait = vcn_v1_0_enc_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +0 -0
index 2a497a7a4840..f67d7391fc21 100644

drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h line 31

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +2 -0
@@ -24,6 +24,8 @@
  #ifndef __VCN_V1_0_H__
  #define __VCN_V1_0_H__
 
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
+
  extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
 
  #endif

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

author
#10 lore raw

PATCH 1/2 drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs

In reply to Leo Liu

Because VCN1.0 power management and DPG mode are managed together with JPEG1.0 under both HW and FW, so separated them from general VCN code. Also the multiple instances case got removed, since VCN1.0 HW just have a single instance.

v2: override work func with vcn1.0's own

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c |  3 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  3 +
 drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c  |  3 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   | 90 ++++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h   |  2 +
 5 files changed, 95 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -3
index 428cfd58b37d..717f0a218c5d 100644
@@ -39,9 +39,6 @@
 #include "vcn/vcn_1_0_offset.h"
 #include "vcn/vcn_1_0_sh_mask.h"
 
-/* 1 second timeout */
-#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
-
 /* Firmware Names */
 #define FIRMWARE_RAVEN		"amdgpu/raven_vcn.bin"
 #define FIRMWARE_PICASSO	"amdgpu/picasso_vcn.bin"
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
index 402a5046b985..3484ead62046 100644
@@ -56,6 +56,9 @@
 #define VCN_VID_IP_ADDRESS_2_0		0x0
 #define VCN_AON_IP_ADDRESS_2_0		0x30000
 
+/* 1 second timeout */
+#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
+
 #define RREG32_SOC15_DPG_MODE(ip, inst, reg, mask, sram_sel) 				\
 	({	WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_MASK, mask); 			\
 		WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_CTL, 				\
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +2 -1
index a141408dfb23..0debfd9f428c 100644
@@ -25,6 +25,7 @@
 #include "amdgpu_jpeg.h"
 #include "soc15.h"
 #include "soc15d.h"
+#include "vcn_v1_0.h"
 
 #include "vcn/vcn_1_0_offset.h"
 #include "vcn/vcn_1_0_sh_mask.h"
@@ -561,7 +562,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
 	.insert_start = jpeg_v1_0_decode_ring_insert_start,
 	.insert_end = jpeg_v1_0_decode_ring_insert_end,
 	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
 	.end_use = amdgpu_vcn_ring_end_use,
 	.emit_wreg = jpeg_v1_0_decode_ring_emit_wreg,
 	.emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +88 -2

126 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +2 -0
index 2a497a7a4840..f67d7391fc21 100644
@@ -24,6 +24,8 @@
 #ifndef __VCN_V1_0_H__
 #define __VCN_V1_0_H__
 
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
+
 extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
 
 #endif
Signature · 6 lines
2.17.1

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

Re: [PATCH 1/2] drm/amdgpu/vcn1.0: use its own idle handler and begin use funcs

Am 13.12.19 um 15:42 schrieb Leo Liu:

Quoted 8 lines

Because VCN1.0 power management and DPG mode are managed together with JPEG1.0 under both HW and FW, so separated them from general VCN code. Also the multiple instances case got removed, since VCN1.0 HW just have a single instance.

v2: override work func with vcn1.0's own

Quoted 198 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c |  3 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  3 +
  drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c  |  3 +-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c   | 90 ++++++++++++++++++++++++-
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h   |  2 +
  5 files changed, 95 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -3
index 428cfd58b37d..717f0a218c5d 100644
@@ -39,9 +39,6 @@
  #include "vcn/vcn_1_0_offset.h"
  #include "vcn/vcn_1_0_sh_mask.h"
 
-/* 1 second timeout */
-#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
-
  /* Firmware Names */
  #define FIRMWARE_RAVEN		"amdgpu/raven_vcn.bin"
  #define FIRMWARE_PICASSO	"amdgpu/picasso_vcn.bin"
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
index 402a5046b985..3484ead62046 100644
@@ -56,6 +56,9 @@
  #define VCN_VID_IP_ADDRESS_2_0		0x0
  #define VCN_AON_IP_ADDRESS_2_0		0x30000
 
+/* 1 second timeout */
+#define VCN_IDLE_TIMEOUT	msecs_to_jiffies(1000)
+
  #define RREG32_SOC15_DPG_MODE(ip, inst, reg, mask, sram_sel) 				\
  	({	WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_MASK, mask); 			\
  		WREG32_SOC15(ip, inst, mmUVD_DPG_LMA_CTL, 				\
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +2 -1
index a141408dfb23..0debfd9f428c 100644
@@ -25,6 +25,7 @@
  #include "amdgpu_jpeg.h"
  #include "soc15.h"
  #include "soc15d.h"
+#include "vcn_v1_0.h"
 
  #include "vcn/vcn_1_0_offset.h"
  #include "vcn/vcn_1_0_sh_mask.h"
@@ -561,7 +562,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
  	.insert_start = jpeg_v1_0_decode_ring_insert_start,
  	.insert_end = jpeg_v1_0_decode_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = jpeg_v1_0_decode_ring_emit_wreg,
  	.emit_reg_wait = jpeg_v1_0_decode_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +88 -2
index 652cecc030b3..3b025a3f8c7d 100644
@@ -25,6 +25,7 @@
 
  #include "amdgpu.h"
  #include "amdgpu_vcn.h"
+#include "amdgpu_pm.h"
  #include "soc15.h"
  #include "soc15d.h"
  #include "soc15_common.h"
@@ -51,6 +52,8 @@ static int vcn_v1_0_set_powergating_state(void *handle, enum amd_powergating_sta
  static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
  				struct dpg_pause_state *new_state);
 
+static void vcn_v1_0_idle_work_handler(struct work_struct *work);
+
  /**
   * vcn_v1_0_early_init - set function pointers
   *
@@ -105,6 +108,9 @@ static int vcn_v1_0_sw_init(void *handle)
  	if (r)
  		return r;
 
+	/* Override the work func */
+	adev->vcn.idle_work.work.func = vcn_v1_0_idle_work_handler;
+
  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
  		const struct common_firmware_header *hdr;
  		hdr = (const struct common_firmware_header *)adev->vcn.fw->data;
@@ -1758,6 +1764,86 @@ static int vcn_v1_0_set_powergating_state(void *handle,
  	return ret;
  }
 
+static void vcn_v1_0_idle_work_handler(struct work_struct *work)
+{
+	struct amdgpu_device *adev =
+		container_of(work, struct amdgpu_device, vcn.idle_work.work);
+	unsigned int fences = 0, i;
+
+	for (i = 0; i < adev->vcn.num_enc_rings; ++i)
+		fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_enc[i]);
+
+	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
+		struct dpg_pause_state new_state;
+
+		if (fences)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+
+		if (amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec))
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
+		adev->vcn.pause_dpg_mode(adev, &new_state);
+	}
+
+	fences += amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec);
+	fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_dec);
+
+	if (fences == 0) {
+		amdgpu_gfx_off_ctrl(adev, true);
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_uvd(adev, false);
+		else
+			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+			       AMD_PG_STATE_GATE);
+	} else {
+		schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
+	}
+}
+
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring)
+{
+	struct amdgpu_device *adev = ring->adev;
+	bool set_clocks = !cancel_delayed_work_sync(&adev->vcn.idle_work);
+
+	if (set_clocks) {
+		amdgpu_gfx_off_ctrl(adev, false);
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_uvd(adev, true);
+		else
+			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
+			       AMD_PG_STATE_UNGATE);
+	}
+
+	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
+		struct dpg_pause_state new_state;
+		unsigned int fences = 0, i;
+
+		for (i = 0; i < adev->vcn.num_enc_rings; ++i)
+			fences += amdgpu_fence_count_emitted(&adev->vcn.inst->ring_enc[i]);
+
+		if (fences)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.fw_based = VCN_DPG_STATE__UNPAUSE;
+
+		if (amdgpu_fence_count_emitted(&adev->jpeg.inst->ring_dec))
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+		else
+			new_state.jpeg = VCN_DPG_STATE__UNPAUSE;
+
+		if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_ENC)
+			new_state.fw_based = VCN_DPG_STATE__PAUSE;
+		else if (ring->funcs->type == AMDGPU_RING_TYPE_VCN_JPEG)
+			new_state.jpeg = VCN_DPG_STATE__PAUSE;
+
+		adev->vcn.pause_dpg_mode(adev, &new_state);
+	}
+}
+
  static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
  	.name = "vcn_v1_0",
  	.early_init = vcn_v1_0_early_init,
@@ -1804,7 +1890,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_dec_ring_vm_funcs = {
  	.insert_start = vcn_v1_0_dec_ring_insert_start,
  	.insert_end = vcn_v1_0_dec_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = vcn_v1_0_dec_ring_emit_wreg,
  	.emit_reg_wait = vcn_v1_0_dec_ring_emit_reg_wait,
@@ -1836,7 +1922,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_enc_ring_vm_funcs = {
  	.insert_nop = amdgpu_ring_insert_nop,
  	.insert_end = vcn_v1_0_enc_ring_insert_end,
  	.pad_ib = amdgpu_ring_generic_pad_ib,
-	.begin_use = amdgpu_vcn_ring_begin_use,
+	.begin_use = vcn_v1_0_ring_begin_use,
  	.end_use = amdgpu_vcn_ring_end_use,
  	.emit_wreg = vcn_v1_0_enc_ring_emit_wreg,
  	.emit_reg_wait = vcn_v1_0_enc_ring_emit_reg_wait,
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +0 -0
index 2a497a7a4840..f67d7391fc21 100644

drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h line 31

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.h +2 -0
@@ -24,6 +24,8 @@
  #ifndef __VCN_V1_0_H__
  #define __VCN_V1_0_H__
 
+void vcn_v1_0_ring_begin_use(struct amdgpu_ring *ring);
+
  extern const struct amdgpu_ip_block_version vcn_v1_0_ip_block;
 
  #endif

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