OSDN Git Service

intel: get gen once for gen >= 9
authorLucas De Marchi <lucas.demarchi@intel.com>
Wed, 5 Sep 2018 18:32:00 +0000 (11:32 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Wed, 5 Sep 2018 23:14:48 +0000 (16:14 -0700)
We don't need to call IS_GEN() for each gen >= 9: we can rather use the
new intel_is_genx() helper to iterate the pciids array once.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
intel/intel_bufmgr_gem.c
intel/intel_decode.c

index 8c3a4b2..d6587b7 100644 (file)
@@ -3656,13 +3656,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
                bufmgr_gem->gen = 7;
        else if (IS_GEN8(bufmgr_gem->pci_device))
                bufmgr_gem->gen = 8;
-       else if (IS_GEN9(bufmgr_gem->pci_device))
-               bufmgr_gem->gen = 9;
-       else if (IS_GEN10(bufmgr_gem->pci_device))
-               bufmgr_gem->gen = 10;
-       else if (IS_GEN11(bufmgr_gem->pci_device))
-               bufmgr_gem->gen = 11;
-       else {
+       else if (!intel_get_genx(bufmgr_gem->pci_device, &bufmgr_gem->gen)) {
                free(bufmgr_gem);
                bufmgr_gem = NULL;
                goto exit;
index b24861b..0ff095b 100644 (file)
@@ -3823,12 +3823,8 @@ drm_intel_decode_context_alloc(uint32_t devid)
        ctx->devid = devid;
        ctx->out = stdout;
 
-       if (IS_GEN11(devid))
-               ctx->gen = 11;
-       else if (IS_GEN10(devid))
-               ctx->gen = 10;
-       else if (IS_GEN9(devid))
-               ctx->gen = 9;
+       if (intel_get_genx(devid, &ctx->gen))
+               ;
        else if (IS_GEN8(devid))
                ctx->gen = 8;
        else if (IS_GEN7(devid))