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

File 0001-radeon_hd-Add-updated-missing-atombios-opcodes.2.patch, 3.8 KB (added by kallisti5, 8 years ago)

v2, now builds

  • src/add-ons/accelerants/radeon_hd/atombios/atom.cpp

    From ed88c48badbd51ecfdb4cbf7a9770934ca891709 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        | 63 +++++++++++++++++++++-
     src/add-ons/accelerants/radeon_hd/atombios/atom.h  |  2 +-
     2 files changed, 63 insertions(+), 2 deletions(-)
    
    diff --git a/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp b/src/add-ons/accelerants/radeon_hd/atombios/atom.cpp
    index 2afcd26..376b721 100644
    a b  
    11/*
    2  * Copyright 2008 Advanced Micro Devices, Inc. 
     2 * Copyright 2008 Advanced Micro Devices, Inc.
    33 *
    44 * Permission is hereby granted, free of charge, to any person obtaining a
    55 * copy of this software and associated documentation files (the "Software"),
    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        val64 /= src;
     636        // Lower and upper 32 bits
     637        ctx->ctx->divmul[0] = (uint32)val64;
     638        ctx->ctx->divmul[1] = (uint32)(((val64) >> 16) >> 16);
     639    } else {
     640        ctx->ctx->divmul[0] = 0;
     641        ctx->ctx->divmul[1] = 0;
     642    }
     643    #ifdef ATOM_TRACE
     644    TRACE("%s: 0x%" B_PRIX32 " / 0x%" B_PRIX32 " is"
     645        " 0x%" B_PRIX32 " + 0x%" B_PRIX32 "\n", __func__, dst, src,
     646        ctx->ctx->divmul[0], ctx->ctx->divmul[1]);
     647    #endif
     648}
     649
     650
     651static void
    625652atom_op_eot(atom_exec_context *ctx, int *ptr, int arg)
    626653{
    627654    /* functionally, a nop */
    atom_op_mul(atom_exec_context *ctx, int *ptr, int arg)  
    730757
    731758
    732759static void
     760atom_op_mul32(atom_exec_context *ctx, int *ptr, int arg)
     761{
     762    uint64 val64;
     763    uint8 attr = U8((*ptr)++);
     764    uint32 dst, src;
     765    dst = atom_get_dst(ctx, arg, attr, ptr, NULL, 1);
     766    src = atom_get_src(ctx, attr, ptr);
     767    val64 = (uint64)dst * (uint64)src;
     768    // Lower and upper 32 bits
     769    ctx->ctx->divmul[0] = (uint32)val64;
     770    ctx->ctx->divmul[1] = (uint32)(((val64) >> 16) >> 16);
     771    #ifdef ATOM_TRACE
     772    TRACE("%s: 0x%" B_PRIX32 " * 0x%" B_PRIX32 " is"
     773        " 0x%" B_PRIX32 " + 0x%" B_PRIX32 "\n", __func__, dst, src,
     774        ctx->ctx->divmul[0], ctx->ctx->divmul[1]);
     775    #endif
     776}
     777
     778
     779static void
    733780atom_op_nop(atom_exec_context *ctx, int *ptr, int arg)
    734781{
    735782    /* nothing */
    atom_op_debug(atom_exec_context *ctx, int *ptr, int arg)  
    10041051}
    10051052
    10061053
     1054static void
     1055atom_op_processds(atom_exec_context *ctx, int *ptr, int arg)
     1056{
     1057    uint16 val = U16(*ptr);
     1058    (*ptr) += val + 2;
     1059    TRACE("%s: Processds output: 0x%02X\n", __func__, val);
     1060}
     1061
     1062
    10071063static struct {
    10081064    void (*func)(atom_exec_context *, int *, int);
    10091065    int arg;
    static struct {  
    11301186    { atom_op_shr, ATOM_ARG_PLL },
    11311187    { atom_op_shr, ATOM_ARG_MC },
    11321188    { atom_op_debug, 0 },
     1189    { atom_op_processds, 0},
     1190    { atom_op_mul32, ATOM_ARG_PS},
     1191    { atom_op_mul32, ATOM_ARG_WS},
     1192    { atom_op_div32, ATOM_ARG_PS},
     1193    { atom_op_div32, ATOM_ARG_WS}
    11331194};
    11341195
    11351196
  • 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