Commit 182830a1 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: cleanup VCE coding style

Fix 80 chars issues and remove some dead code as well.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4f399a08
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "cikd.h" #include "cikd.h"
/* 1 second timeout */ /* 1 second timeout */
#define VCE_IDLE_TIMEOUT_MS 1000 #define VCE_IDLE_TIMEOUT msecs_to_jiffies(1000)
/* Firmware Names */ /* Firmware Names */
#ifdef CONFIG_DRM_AMDGPU_CIK #ifdef CONFIG_DRM_AMDGPU_CIK
...@@ -310,8 +310,7 @@ static void amdgpu_vce_idle_work_handler(struct work_struct *work) ...@@ -310,8 +310,7 @@ static void amdgpu_vce_idle_work_handler(struct work_struct *work)
amdgpu_asic_set_vce_clocks(adev, 0, 0); amdgpu_asic_set_vce_clocks(adev, 0, 0);
} }
} else { } else {
schedule_delayed_work(&adev->vce.idle_work, schedule_delayed_work(&adev->vce.idle_work, VCE_IDLE_TIMEOUT);
msecs_to_jiffies(VCE_IDLE_TIMEOUT_MS));
} }
} }
...@@ -324,17 +323,12 @@ static void amdgpu_vce_idle_work_handler(struct work_struct *work) ...@@ -324,17 +323,12 @@ static void amdgpu_vce_idle_work_handler(struct work_struct *work)
*/ */
static void amdgpu_vce_note_usage(struct amdgpu_device *adev) static void amdgpu_vce_note_usage(struct amdgpu_device *adev)
{ {
bool streams_changed = false;
bool set_clocks = !cancel_delayed_work_sync(&adev->vce.idle_work); bool set_clocks = !cancel_delayed_work_sync(&adev->vce.idle_work);
set_clocks &= schedule_delayed_work(&adev->vce.idle_work,
msecs_to_jiffies(VCE_IDLE_TIMEOUT_MS));
if (adev->pm.dpm_enabled) { set_clocks &= schedule_delayed_work(&adev->vce.idle_work,
/* XXX figure out if the streams changed */ VCE_IDLE_TIMEOUT);
streams_changed = false;
}
if (set_clocks || streams_changed) { if (set_clocks) {
if (adev->pm.dpm_enabled) { if (adev->pm.dpm_enabled) {
amdgpu_dpm_enable_vce(adev, true); amdgpu_dpm_enable_vce(adev, true);
} else { } else {
...@@ -357,6 +351,7 @@ void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp) ...@@ -357,6 +351,7 @@ void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
int i, r; int i, r;
for (i = 0; i < AMDGPU_MAX_VCE_HANDLES; ++i) { for (i = 0; i < AMDGPU_MAX_VCE_HANDLES; ++i) {
uint32_t handle = atomic_read(&adev->vce.handles[i]); uint32_t handle = atomic_read(&adev->vce.handles[i]);
if (!handle || adev->vce.filp[i] != filp) if (!handle || adev->vce.filp[i] != filp)
continue; continue;
...@@ -648,7 +643,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx) ...@@ -648,7 +643,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
} }
switch (cmd) { switch (cmd) {
case 0x00000001: // session case 0x00000001: /* session */
handle = amdgpu_get_ib_value(p, ib_idx, idx + 2); handle = amdgpu_get_ib_value(p, ib_idx, idx + 2);
session_idx = amdgpu_vce_validate_handle(p, handle, session_idx = amdgpu_vce_validate_handle(p, handle,
&allocated); &allocated);
...@@ -657,12 +652,12 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx) ...@@ -657,12 +652,12 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
size = &p->adev->vce.img_size[session_idx]; size = &p->adev->vce.img_size[session_idx];
break; break;
case 0x00000002: // task info case 0x00000002: /* task info */
fb_idx = amdgpu_get_ib_value(p, ib_idx, idx + 6); fb_idx = amdgpu_get_ib_value(p, ib_idx, idx + 6);
bs_idx = amdgpu_get_ib_value(p, ib_idx, idx + 7); bs_idx = amdgpu_get_ib_value(p, ib_idx, idx + 7);
break; break;
case 0x01000001: // create case 0x01000001: /* create */
created = true; created = true;
if (!allocated) { if (!allocated) {
DRM_ERROR("Handle already in use!\n"); DRM_ERROR("Handle already in use!\n");
...@@ -675,16 +670,16 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx) ...@@ -675,16 +670,16 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
8 * 3 / 2; 8 * 3 / 2;
break; break;
case 0x04000001: // config extension case 0x04000001: /* config extension */
case 0x04000002: // pic control case 0x04000002: /* pic control */
case 0x04000005: // rate control case 0x04000005: /* rate control */
case 0x04000007: // motion estimation case 0x04000007: /* motion estimation */
case 0x04000008: // rdo case 0x04000008: /* rdo */
case 0x04000009: // vui case 0x04000009: /* vui */
case 0x05000002: // auxiliary buffer case 0x05000002: /* auxiliary buffer */
break; break;
case 0x03000001: // encode case 0x03000001: /* encode */
r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 10, idx + 9, r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 10, idx + 9,
*size, 0); *size, 0);
if (r) if (r)
...@@ -696,18 +691,18 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx) ...@@ -696,18 +691,18 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
goto out; goto out;
break; break;
case 0x02000001: // destroy case 0x02000001: /* destroy */
destroyed = true; destroyed = true;
break; break;
case 0x05000001: // context buffer case 0x05000001: /* context buffer */
r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 3, idx + 2, r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 3, idx + 2,
*size * 2, 0); *size * 2, 0);
if (r) if (r)
goto out; goto out;
break; break;
case 0x05000004: // video bitstream buffer case 0x05000004: /* video bitstream buffer */
tmp = amdgpu_get_ib_value(p, ib_idx, idx + 4); tmp = amdgpu_get_ib_value(p, ib_idx, idx + 4);
r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 3, idx + 2, r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 3, idx + 2,
tmp, bs_idx); tmp, bs_idx);
...@@ -715,7 +710,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx) ...@@ -715,7 +710,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
goto out; goto out;
break; break;
case 0x05000005: // feedback buffer case 0x05000005: /* feedback buffer */
r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 3, idx + 2, r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 3, idx + 2,
4096, fb_idx); 4096, fb_idx);
if (r) if (r)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment