Path: blob/21.2-virgl/src/freedreno/decode/rnnutil.h
4565 views
/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */12/*3* Copyright (C) 2014 Rob Clark <[email protected]>4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* the rights to use, copy, modify, merge, publish, distribute, sublicense,9* and/or sell copies of the Software, and to permit persons to whom the10* Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice (including the next13* paragraph) shall be included in all copies or substantial portions of the14* Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL19* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE22* SOFTWARE.23*24* Authors:25* Rob Clark <[email protected]>26*/2728#ifndef RNNUTIL_H_29#define RNNUTIL_H_3031#include <assert.h>32#include <stdint.h>33#include <string.h>3435#include "rnn.h"36#include "rnndec.h"3738struct rnn {39struct rnndb *db;40struct rnndeccontext *vc, *vc_nocolor;41struct rnndomain *dom[2];42const char *variant;43};4445union rnndecval {46uint32_t u;47int32_t i;48float f;49};5051void _rnn_init(struct rnn *rnn, int nocolor);52struct rnn *rnn_new(int nocolor);53void rnn_load_file(struct rnn *rnn, char *file, char *domain);54void rnn_load(struct rnn *rnn, const char *gpuname);55uint32_t rnn_regbase(struct rnn *rnn, const char *name);56const char *rnn_regname(struct rnn *rnn, uint32_t regbase, int color);57struct rnndecaddrinfo *rnn_reginfo(struct rnn *rnn, uint32_t regbase);58const char *rnn_enumname(struct rnn *rnn, const char *name, uint32_t val);5960struct rnndelem *rnn_regelem(struct rnn *rnn, const char *name);61struct rnndelem *rnn_regoff(struct rnn *rnn, uint32_t offset);62enum rnnttype rnn_decodelem(struct rnn *rnn, struct rnntypeinfo *info,63uint32_t regval, union rnndecval *val);6465#endif /* RNNUTIL_H_ */666768