From: Eric Anholt Subject: [PATCH 09/17] intel: Put the "gen" shorthand chipset identifier in the context. Date: Wed, 4 Jan 2012 14:54:51 -0800 Message-ID: <1325717699-5953-10-git-send-email-eric@anholt.net> References: <1325717699-5953-1-git-send-email-eric@anholt.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1325717699-5953-1-git-send-email-eric@anholt.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org It's a lot nicer than using IS_WHATEVER(devid) all over the place, and we have this in our other projects too. --- intel/intel_decode.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/intel/intel_decode.c b/intel/intel_decode.c index 97820b3..3548f57 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -21,6 +21,7 @@ * IN THE SOFTWARE. */ +#include #include #include #include @@ -39,6 +40,12 @@ struct drm_intel_decode { /** 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. */ @@ -2711,6 +2718,7 @@ decode_3d_965(struct drm_intel_decode *ctx) 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" }, @@ -3327,6 +3335,11 @@ decode_3d_965(struct drm_intel_decode *ctx) 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; @@ -3434,6 +3447,21 @@ drm_intel_decode_context_alloc(uint32_t devid) 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; } -- 1.7.7.3