Commit fbba036a authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs

drm/nv50/gr: enable ctxprog xfer only when we need it to save power

This patch adds instructions to ctxprog and by doing, impacts context
switching performance.  My testcase showed a 1% performance cost using
glxgears that is a context-switch bound application.

Please test and report bugs/performance/power/other.

Many thanks to Maxim Levitsky for his dedicated work on lowering power
consumption with nouveau.

More patches are coming thanks to his work:

https://bugs.freedesktop.org/show_bug.cgi?id=37922Signed-off-by: default avatarMartin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent c16a3a35
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
#define CP_FLAG_UNK0B ((0 * 32) + 0xb) #define CP_FLAG_UNK0B ((0 * 32) + 0xb)
#define CP_FLAG_UNK0B_CLEAR 0 #define CP_FLAG_UNK0B_CLEAR 0
#define CP_FLAG_UNK0B_SET 1 #define CP_FLAG_UNK0B_SET 1
#define CP_FLAG_XFER_SWITCH ((0 * 32) + 0xe)
#define CP_FLAG_XFER_SWITCH_DISABLE 0
#define CP_FLAG_XFER_SWITCH_ENABLE 1
#define CP_FLAG_STATE ((0 * 32) + 0x1c) #define CP_FLAG_STATE ((0 * 32) + 0x1c)
#define CP_FLAG_STATE_STOPPED 0 #define CP_FLAG_STATE_STOPPED 0
#define CP_FLAG_STATE_RUNNING 1 #define CP_FLAG_STATE_RUNNING 1
...@@ -199,6 +202,7 @@ nv50_grctx_init(struct nouveau_grctx *ctx) ...@@ -199,6 +202,7 @@ nv50_grctx_init(struct nouveau_grctx *ctx)
} }
cp_set (ctx, STATE, RUNNING); cp_set (ctx, STATE, RUNNING);
cp_set (ctx, XFER_SWITCH, ENABLE);
/* decide whether we're loading/unloading the context */ /* decide whether we're loading/unloading the context */
cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save); cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save);
cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save); cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save);
...@@ -265,6 +269,7 @@ nv50_grctx_init(struct nouveau_grctx *ctx) ...@@ -265,6 +269,7 @@ nv50_grctx_init(struct nouveau_grctx *ctx)
cp_name(ctx, cp_exit); cp_name(ctx, cp_exit);
cp_set (ctx, USER_SAVE, NOT_PENDING); cp_set (ctx, USER_SAVE, NOT_PENDING);
cp_set (ctx, USER_LOAD, NOT_PENDING); cp_set (ctx, USER_LOAD, NOT_PENDING);
cp_set (ctx, XFER_SWITCH, DISABLE);
cp_set (ctx, STATE, STOPPED); cp_set (ctx, STATE, STOPPED);
cp_out (ctx, CP_END); cp_out (ctx, CP_END);
ctx->ctxvals_pos += 0x400; /* padding... no idea why you need it */ ctx->ctxvals_pos += 0x400; /* padding... no idea why you need it */
......
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