diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-01-19 12:38:48 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2010-01-20 17:19:55 -0500 |
commit | 9f53e7931610cbd1715fd2d2c0f9a853e17f02d8 (patch) | |
tree | 469c4db5900da5bc93aa158c4d9f33dff6e03a84 | |
parent | 07bec2df01cde5590a1700b992d12de3f46b12bc (diff) |
drm/radeon/kms/atom: fix some parser bugs
- add support for inline src params
- fix shift_left/shift_right and shl/shr ops
shift_* ops use inline src params, shl/r use full params
- fix mask op (uses inline params)
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r-- | drivers/gpu/drm/radeon/atom.c | 90 |
1 files changed, 74 insertions, 16 deletions
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 388140a7e651..9a3378184e1b 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -385,6 +385,32 @@ static uint32_t atom_get_src(atom_exec_context *ctx, uint8_t attr, int *ptr) | |||
385 | return atom_get_src_int(ctx, attr, ptr, NULL, 1); | 385 | return atom_get_src_int(ctx, attr, ptr, NULL, 1); |
386 | } | 386 | } |
387 | 387 | ||
388 | static uint32_t atom_get_src_direct(atom_exec_context *ctx, uint8_t align, int *ptr) | ||
389 | { | ||
390 | uint32_t val = 0xCDCDCDCD; | ||
391 | |||
392 | switch (align) { | ||
393 | case ATOM_SRC_DWORD: | ||
394 | val = U32(*ptr); | ||
395 | (*ptr) += 4; | ||
396 | break; | ||
397 | case ATOM_SRC_WORD0: | ||
398 | case ATOM_SRC_WORD8: | ||
399 | case ATOM_SRC_WORD16: | ||
400 | val = U16(*ptr); | ||
401 | (*ptr) += 2; | ||
402 | break; | ||
403 | case ATOM_SRC_BYTE0: | ||
404 | case ATOM_SRC_BYTE8: | ||
405 | case ATOM_SRC_BYTE16: | ||
406 | case ATOM_SRC_BYTE24: | ||
407 | val = U8(*ptr); | ||
408 | (*ptr)++; | ||
409 | break; | ||
410 | } | ||
411 | return val; | ||
412 | } | ||
413 | |||
388 | static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr, | 414 | static uint32_t atom_get_dst(atom_exec_context *ctx, int arg, uint8_t attr, |
389 | int *ptr, uint32_t *saved, int print) | 415 | int *ptr, uint32_t *saved, int print) |
390 | { | 416 | { |
@@ -677,9 +703,9 @@ static void atom_op_mask(atom_exec_context *ctx, int *ptr, int arg) | |||
677 | SDEBUG(" dst: "); | 703 | SDEBUG(" dst: "); |
678 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); | 704 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
679 | SDEBUG(" src1: "); | 705 | SDEBUG(" src1: "); |
680 | src1 = atom_get_src(ctx, attr, ptr); | 706 | src1 = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr); |
681 | SDEBUG(" src2: "); | 707 | SDEBUG(" src2: "); |
682 | src2 = atom_get_src(ctx, attr, ptr); | 708 | src2 = atom_get_src_direct(ctx, ((attr >> 3) & 7), ptr); |
683 | dst &= src1; | 709 | dst &= src1; |
684 | dst |= src2; | 710 | dst |= src2; |
685 | SDEBUG(" dst: "); | 711 | SDEBUG(" dst: "); |
@@ -809,6 +835,38 @@ static void atom_op_setregblock(atom_exec_context *ctx, int *ptr, int arg) | |||
809 | SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); | 835 | SDEBUG(" base: 0x%04X\n", ctx->ctx->reg_block); |
810 | } | 836 | } |
811 | 837 | ||
838 | static void atom_op_shift_left(atom_exec_context *ctx, int *ptr, int arg) | ||
839 | { | ||
840 | uint8_t attr = U8((*ptr)++), shift; | ||
841 | uint32_t saved, dst; | ||
842 | int dptr = *ptr; | ||
843 | attr &= 0x38; | ||
844 | attr |= atom_def_dst[attr >> 3] << 6; | ||
845 | SDEBUG(" dst: "); | ||
846 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); | ||
847 | shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr); | ||
848 | SDEBUG(" shift: %d\n", shift); | ||
849 | dst <<= shift; | ||
850 | SDEBUG(" dst: "); | ||
851 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); | ||
852 | } | ||
853 | |||
854 | static void atom_op_shift_right(atom_exec_context *ctx, int *ptr, int arg) | ||
855 | { | ||
856 | uint8_t attr = U8((*ptr)++), shift; | ||
857 | uint32_t saved, dst; | ||
858 | int dptr = *ptr; | ||
859 | attr &= 0x38; | ||
860 | attr |= atom_def_dst[attr >> 3] << 6; | ||
861 | SDEBUG(" dst: "); | ||
862 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); | ||
863 | shift = atom_get_src_direct(ctx, ATOM_SRC_BYTE0, ptr); | ||
864 | SDEBUG(" shift: %d\n", shift); | ||
865 | dst >>= shift; | ||
866 | SDEBUG(" dst: "); | ||
867 | atom_put_dst(ctx, arg, attr, &dptr, dst, saved); | ||
868 | } | ||
869 | |||
812 | static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) | 870 | static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) |
813 | { | 871 | { |
814 | uint8_t attr = U8((*ptr)++), shift; | 872 | uint8_t attr = U8((*ptr)++), shift; |
@@ -818,7 +876,7 @@ static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) | |||
818 | attr |= atom_def_dst[attr >> 3] << 6; | 876 | attr |= atom_def_dst[attr >> 3] << 6; |
819 | SDEBUG(" dst: "); | 877 | SDEBUG(" dst: "); |
820 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); | 878 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
821 | shift = U8((*ptr)++); | 879 | shift = atom_get_src(ctx, attr, ptr); |
822 | SDEBUG(" shift: %d\n", shift); | 880 | SDEBUG(" shift: %d\n", shift); |
823 | dst <<= shift; | 881 | dst <<= shift; |
824 | SDEBUG(" dst: "); | 882 | SDEBUG(" dst: "); |
@@ -834,7 +892,7 @@ static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) | |||
834 | attr |= atom_def_dst[attr >> 3] << 6; | 892 | attr |= atom_def_dst[attr >> 3] << 6; |
835 | SDEBUG(" dst: "); | 893 | SDEBUG(" dst: "); |
836 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); | 894 | dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); |
837 | shift = U8((*ptr)++); | 895 | shift = atom_get_src(ctx, attr, ptr); |
838 | SDEBUG(" shift: %d\n", shift); | 896 | SDEBUG(" shift: %d\n", shift); |
839 | dst >>= shift; | 897 | dst >>= shift; |
840 | SDEBUG(" dst: "); | 898 | SDEBUG(" dst: "); |
@@ -937,18 +995,18 @@ static struct { | |||
937 | atom_op_or, ATOM_ARG_FB}, { | 995 | atom_op_or, ATOM_ARG_FB}, { |
938 | atom_op_or, ATOM_ARG_PLL}, { | 996 | atom_op_or, ATOM_ARG_PLL}, { |
939 | atom_op_or, ATOM_ARG_MC}, { | 997 | atom_op_or, ATOM_ARG_MC}, { |
940 | atom_op_shl, ATOM_ARG_REG}, { | 998 | atom_op_shift_left, ATOM_ARG_REG}, { |
941 | atom_op_shl, ATOM_ARG_PS}, { | 999 | atom_op_shift_left, ATOM_ARG_PS}, { |
942 | atom_op_shl, ATOM_ARG_WS}, { | 1000 | atom_op_shift_left, ATOM_ARG_WS}, { |
943 | atom_op_shl, ATOM_ARG_FB}, { | 1001 | atom_op_shift_left, ATOM_ARG_FB}, { |
944 | atom_op_shl, ATOM_ARG_PLL}, { | 1002 | atom_op_shift_left, ATOM_ARG_PLL}, { |
945 | atom_op_shl, ATOM_ARG_MC}, { | 1003 | atom_op_shift_left, ATOM_ARG_MC}, { |
946 | atom_op_shr, ATOM_ARG_REG}, { | 1004 | atom_op_shift_right, ATOM_ARG_REG}, { |
947 | atom_op_shr, ATOM_ARG_PS}, { | 1005 | atom_op_shift_right, ATOM_ARG_PS}, { |
948 | atom_op_shr, ATOM_ARG_WS}, { | 1006 | atom_op_shift_right, ATOM_ARG_WS}, { |
949 | atom_op_shr, ATOM_ARG_FB}, { | 1007 | atom_op_shift_right, ATOM_ARG_FB}, { |
950 | atom_op_shr, ATOM_ARG_PLL}, { | 1008 | atom_op_shift_right, ATOM_ARG_PLL}, { |
951 | atom_op_shr, ATOM_ARG_MC}, { | 1009 | atom_op_shift_right, ATOM_ARG_MC}, { |
952 | atom_op_mul, ATOM_ARG_REG}, { | 1010 | atom_op_mul, ATOM_ARG_REG}, { |
953 | atom_op_mul, ATOM_ARG_PS}, { | 1011 | atom_op_mul, ATOM_ARG_PS}, { |
954 | atom_op_mul, ATOM_ARG_WS}, { | 1012 | atom_op_mul, ATOM_ARG_WS}, { |