Ticket #12668: 0001-radeon_hd-Add-updated-missing-atombios-opcodes.patch

File 0001-radeon_hd-Add-updated-missing-atombios-opcodes.patch, 3.4 KB (added by kallisti5, 8 years ago)
  • src/add-ons/accelerants/radeon_hd/atombios/atom.cpp

    From 6ee79741207fd227e82b3d9e084e4f53263b8ba1 Mon Sep 17 00:00:00 2001
    From: Alexander von Gluck IV <kallisti5@unixzen.com>
    Date: Fri, 4 Mar 2016 17:58:32 -0600
    Subject: [PATCH] radeon_hd: Add updated / missing atombios opcodes
    
    * Newer cards introduce two new opcodes mul32 and div32
    * Add completely missing processds opcode
    ---
     .../accelerants/radeon_hd/atombios/atom.cpp        | 59 ++++++++++++++++++++++
     src/add-ons/accelerants/radeon_hd/atombios/atom.h  |  2 +-
     2 files changed, 60 insertions(+), 1 deletion(-)
    
    diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp
    index 2afcd26..bc4a62e 100644
    a b atom_op_div(atom_exec_context *ctx, int *ptr, int arg)  
    622622
    623623
    624624static void
     625atom_op_div32(atom_exec_context *ctx, int *ptr, int arg)
     626{
     627    uint64 val64;
     628    uint8 attr = U8((*ptr)++);
     629    uint32 dst, src;
     630    dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1);
     631    src = atom_get_src(ctx, attr, ptr);
     632    if (src != 0) {
     633        val64 = dst;
     634        val64 |= ((uint64)ctx->ctx->divmul[1]) << 32;
     635        do_div(val64, src);
     636        ctx->ctx->divmul[0] = lower_32_bits(val64);
     637        ctx->ctx->divmul[1] = upper_32_bits(val64);
     638    } else {
     639        ctx->ctx->divmul[0] = 0;
     640        ctx->ctx->divmul[1] = 0;
     641    }
     642    #ifdef ATOM_TRACE
     643    TRACE("%s: 0x%" B_PRIX32 " / 0x%" B_PRIX32 " is"
     644        " 0x%" B_PRIX32 " + 0x%" B_PRIX32 "\n", __func__, dst, src,
     645        ctx->ctx->divmul[0], ctx->ctx->divmul[1]);
     646    #endif
     647}
     648
     649
     650static void
    625651atom_op_eot(atom_exec_context *ctx, int *ptr, int arg)
    626652{
    627653    /* functionally, a nop */
    atom_op_mul(atom_exec_context *ctx, int *ptr, int arg)  
    730756
    731757
    732758static void
     759atom_op_mul32(atom_exec_context *ctx, int *ptr, int arg)
     760{
     761    uint64 val64;
     762    uint8 attr = U8((*ptr)++);
     763    uint32 dst, src;
     764    dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1);
     765    src = atom_get_src(ctx, attr, ptr);
     766    val64 = (uint64)dst * (uint64)src;
     767    ctx->ctx->divmul[0] = lower_32_bits(val64);
     768    ctx->ctx->divmul[1] = upper_32_bits(val64);
     769    #ifdef ATOM_TRACE
     770    TRACE("%s: 0x%" B_PRIX32 " * 0x%" B_PRIX32 " is"
     771        " 0x%" B_PRIX32 " + 0x%" B_PRIX32 "\n", __func__, dst, src,
     772        ctx->ctx->divmul[0], ctx->ctx->divmul[1]);
     773    #endif
     774}
     775
     776
     777static void
    733778atom_op_nop(atom_exec_context *ctx, int *ptr, int arg)
    734779{
    735780    /* nothing */
    atom_op_debug(atom_exec_context *ctx, int *ptr, int arg)  
    10041049}
    10051050
    10061051
     1052static void
     1053atom_op_processds(atom_exec_context *ctx, int *ptr, int arg)
     1054{
     1055    uint16 val = U16(*ptr);
     1056    (*ptr) += val + 2;
     1057    TRACE("%s: Processds output: 0x%02X\n", __func__, val);
     1058}
     1059
     1060
    10071061static struct {
    10081062    void (*func)(atom_exec_context *, int *, int);
    10091063    int arg;
    static struct {  
    11301184    { atom_op_shr, ATOM_ARG_PLL },
    11311185    { atom_op_shr, ATOM_ARG_MC },
    11321186    { atom_op_debug, 0 },
     1187    { atom_op_processds, 0},
     1188    { atom_op_mul32, ATOM_ARG_PS},
     1189    { atom_op_mul32, ATOM_ARG_WS},
     1190    { atom_op_div32, ATOM_ARG_PS},
     1191    { atom_op_div32, ATOM_ARG_WS}
    11331192};
    11341193
    11351194
  • src/add-ons/accelerants/radeon_hd/atombios/atom.h

    diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.h b/src/add-ons/accelerants/radeon_hd/atombios/atom.h
    index 9e4ee72..18b91a6 100644
    a b struct card_info {  
    7878#define ATOM_CT_PS_MASK     0x7F
    7979#define ATOM_CT_CODE_PTR    6
    8080
    81 #define ATOM_OP_CNT     123
     81#define ATOM_OP_CNT     127
    8282#define ATOM_OP_EOT     91
    8383
    8484#define ATOM_CASE_MAGIC     0x63