summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 028715e)
raw | patch | inline | side by side (parent: 028715e)
author | Eric Anholt <eric@anholt.net> | |
Wed, 4 Jan 2012 20:00:59 +0000 (12:00 -0800) | ||
committer | Eric Anholt <eric@anholt.net> | |
Fri, 27 Jan 2012 21:21:19 +0000 (13:21 -0800) |
It's a lot nicer than using IS_WHATEVER(devid) all over the place, and
we have this in our other projects too.
we have this in our other projects too.
intel/intel_decode.c | patch | blob | history |
diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index 97820b353fb03881310776f17665dc87631e994e..3548f574c5a6c4cc4a6504025d609a83fe2b60a9 100644 (file)
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
* IN THE SOFTWARE.
*/
+#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
/** PCI device ID. */
uint32_t devid;
+ /**
+ * Shorthand device identifier: 3 is 915, 4 is 965, 5 is
+ * Ironlake, etc.
+ */
+ int gen;
+
/** GPU address of the start of the current packet. */
uint32_t hw_offset;
/** CPU virtual address of the start of the current packet. */
int unsigned min_len;
int unsigned max_len;
const char *name;
+ int gen;
} opcodes_3d[] = {
{ 0x6000, 3, 3, "URB_FENCE" },
{ 0x6001, 2, 2, "CS_URB_STATE" },
for (idx = 0; idx < ARRAY_SIZE(opcodes_3d); idx++) {
opcode_3d = &opcodes_3d[idx];
+
+ /* If it's marked as only for a specific gen, skip. */
+ if (opcode_3d->gen && opcode_3d->gen != ctx->gen)
+ continue;
+
if ((data[0] & 0xffff0000) >> 16 == opcode_3d->opcode) {
unsigned int i;
len = 1;
ctx->devid = devid;
ctx->out = stdout;
+ if (IS_GEN7(devid))
+ ctx->gen = 7;
+ else if (IS_GEN6(devid))
+ ctx->gen = 6;
+ else if (IS_GEN5(devid))
+ ctx->gen = 5;
+ else if (IS_GEN4(devid))
+ ctx->gen = 4;
+ else if (IS_9XX(devid))
+ ctx->gen = 3;
+ else {
+ assert(IS_GEN2(devid));
+ ctx->gen = 2;
+ }
+
return ctx;
}