On Tue, Nov 26, 2013 at 08:51:22AM -0800, bradley.d.volkin@xxxxxxxxx wrote: > +static const struct drm_i915_cmd_descriptor* > +find_cmd_in_table(const struct drm_i915_cmd_table *table, > + u32 cmd_header) > +{ > + int i; > + > + for (i = 0; i < table->count; i++) { > + const struct drm_i915_cmd_descriptor *desc = &table->table[i]; > + u32 masked_cmd = desc->cmd.mask & cmd_header; > + u32 masked_value = desc->cmd.value & desc->cmd.mask; > + > + if (masked_cmd == masked_value) > + return desc; Maybe pre-sort the cmd table and use bsearch? And a runtime test on module load to check that the table is sorted correctly. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx