[Mesa-dev] [PATCH 6/8] i965: Actually check whether the opcode is supported.

Matt Turner mattst88 at gmail.com
Sun May 1 18:42:24 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_eu.c          | 4 ++--
 src/mesa/drivers/dri/i965/brw_eu_validate.c | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index fbcc6ad..5490738 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -583,12 +583,12 @@ gen_from_devinfo(const struct brw_device_info *devinfo)
 
 /* Return the matching opcode_desc for the specified opcode number and
  * hardware generation, or NULL if the opcode is not supported by the device.
- * XXX -- Actually check whether the opcode is supported.
  */
 const struct opcode_desc *
 brw_opcode_desc(const struct brw_device_info *devinfo, enum opcode opcode)
 {
-   if (opcode_descs[opcode].name)
+   enum gen gen = gen_from_devinfo(devinfo);
+   if ((opcode_descs[opcode].gens & gen) != 0)
       return &opcode_descs[opcode];
    else
       return NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_eu_validate.c b/src/mesa/drivers/dri/i965/brw_eu_validate.c
index 6f55df9..dbf75e4 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_validate.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_validate.c
@@ -121,8 +121,7 @@ static bool
 is_unsupported_inst(const struct brw_device_info *devinfo,
                     const brw_inst *inst)
 {
-   int gen = gen_from_devinfo(devinfo);
-   return (opcode_descs[brw_inst_opcode(devinfo, inst)].gens & gen) == 0;
+   return brw_opcode_desc(devinfo, brw_inst_opcode(devinfo, inst)) == NULL;
 }
 
 bool
-- 
2.7.3



More information about the mesa-dev mailing list