Loading drivers/gpu/msm/adreno.c +46 −19 Original line number Diff line number Diff line Loading @@ -602,6 +602,18 @@ int adreno_perfcounter_query_group(struct adreno_device *adreno_dev, return 0; } static inline void refcount_group(struct adreno_perfcount_group *group, unsigned int reg, unsigned int flags, unsigned int *lo) { if (flags & PERFCOUNTER_FLAG_KERNEL) group->regs[reg].kernelcount++; else group->regs[reg].usercount++; if (lo) *lo = group->regs[reg].offset; } /** * adreno_perfcounter_get: Try to put a countable in an available counter * @adreno_dev: Adreno device to configure Loading @@ -621,7 +633,7 @@ int adreno_perfcounter_get(struct adreno_device *adreno_dev, { struct adreno_perfcounters *counters = adreno_dev->gpudev->perfcounters; struct adreno_perfcount_group *group; unsigned int i, empty = -1; unsigned int empty = -1; int ret = 0; /* always clear return variables */ Loading @@ -636,21 +648,35 @@ int adreno_perfcounter_get(struct adreno_device *adreno_dev, group = &(counters->groups[groupid]); if (group->flags & ADRENO_PERFCOUNTER_GROUP_FIXED) { /* * In fixed groups the countable equals the fixed register the * user wants. First make sure it is in range */ if (countable >= group->reg_count) return -EINVAL; /* If it is already reserved, just increase the refcounts */ if ((group->regs[countable].kernelcount != 0) || (group->regs[countable].usercount != 0)) { refcount_group(group, countable, flags, offset); return 0; } empty = countable; } else { unsigned int i; /* * Check if the countable is already associated with a counter. * Refcount and return the offset, otherwise, try and find an empty * counter and assign the countable to it. * Refcount and return the offset, otherwise, try and find an * empty counter and assign the countable to it. */ for (i = 0; i < group->reg_count; i++) { if (group->regs[i].countable == countable) { /* Countable already associated with counter */ if (flags & PERFCOUNTER_FLAG_KERNEL) group->regs[i].kernelcount++; else group->regs[i].usercount++; if (offset) *offset = group->regs[i].offset; refcount_group(group, i, flags, offset); return 0; } else if (group->regs[i].countable == KGSL_PERFCOUNTER_NOT_USED) { Loading @@ -658,6 +684,7 @@ int adreno_perfcounter_get(struct adreno_device *adreno_dev, empty = i; } } } /* no available counters, so do nothing else */ if (empty == -1) Loading drivers/gpu/msm/adreno.h +17 −2 Original line number Diff line number Diff line Loading @@ -242,8 +242,19 @@ struct adreno_perfcount_group { struct adreno_perfcount_register *regs; unsigned int reg_count; const char *name; unsigned long flags; }; /* * ADRENO_PERFCOUNTER_GROUP_FIXED indicates that a perfcounter group is fixed - * instead of having configurable countables like the other groups, registers in * fixed groups have a hardwired countable. So when the user requests a * countable in one of these groups, that countable should be used as the * register offset to return */ #define ADRENO_PERFCOUNTER_GROUP_FIXED BIT(0) /** * adreno_perfcounts: all available perfcounter groups * @groups: available groups for this device Loading @@ -265,11 +276,15 @@ struct adreno_invalid_countables { }; #define ADRENO_PERFCOUNTER_GROUP(core, name) { core##_perfcounters_##name, \ ARRAY_SIZE(core##_perfcounters_##name), __stringify(name) } ARRAY_SIZE(core##_perfcounters_##name), __stringify(name), 0 } #define ADRENO_PERFCOUNTER_GROUP_FLAGS(core, name, flags) \ { core##_perfcounters_##name, \ ARRAY_SIZE(core##_perfcounters_##name), __stringify(name), flags } #define ADRENO_PERFCOUNTER_GROUP_OFF(core, name, offset) \ [KGSL_PERFCOUNTER_GROUP_##offset] = { core##_perfcounters_##name, \ ARRAY_SIZE(core##_perfcounters_##name), __stringify(name) } ARRAY_SIZE(core##_perfcounters_##name), __stringify(name), 0 } #define ADRENO_PERFCOUNTER_INVALID_COUNTABLE(name, off) \ [KGSL_PERFCOUNTER_GROUP_##off] = { name##_invalid_countables, \ Loading drivers/gpu/msm/adreno_a3xx.c +4 −2 Original line number Diff line number Diff line Loading @@ -1807,9 +1807,11 @@ static struct adreno_perfcount_group a3xx_perfcounter_groups[] = { ADRENO_PERFCOUNTER_GROUP(a3xx, tp), ADRENO_PERFCOUNTER_GROUP(a3xx, sp), ADRENO_PERFCOUNTER_GROUP(a3xx, rb), ADRENO_PERFCOUNTER_GROUP(a3xx, pwr), ADRENO_PERFCOUNTER_GROUP_FLAGS(a3xx, pwr, ADRENO_PERFCOUNTER_GROUP_FIXED), ADRENO_PERFCOUNTER_GROUP(a3xx, vbif), ADRENO_PERFCOUNTER_GROUP(a3xx, vbif_pwr), ADRENO_PERFCOUNTER_GROUP_FLAGS(a3xx, vbif_pwr, ADRENO_PERFCOUNTER_GROUP_FIXED), }; static struct adreno_perfcounters a3xx_perfcounters = { Loading Loading
drivers/gpu/msm/adreno.c +46 −19 Original line number Diff line number Diff line Loading @@ -602,6 +602,18 @@ int adreno_perfcounter_query_group(struct adreno_device *adreno_dev, return 0; } static inline void refcount_group(struct adreno_perfcount_group *group, unsigned int reg, unsigned int flags, unsigned int *lo) { if (flags & PERFCOUNTER_FLAG_KERNEL) group->regs[reg].kernelcount++; else group->regs[reg].usercount++; if (lo) *lo = group->regs[reg].offset; } /** * adreno_perfcounter_get: Try to put a countable in an available counter * @adreno_dev: Adreno device to configure Loading @@ -621,7 +633,7 @@ int adreno_perfcounter_get(struct adreno_device *adreno_dev, { struct adreno_perfcounters *counters = adreno_dev->gpudev->perfcounters; struct adreno_perfcount_group *group; unsigned int i, empty = -1; unsigned int empty = -1; int ret = 0; /* always clear return variables */ Loading @@ -636,21 +648,35 @@ int adreno_perfcounter_get(struct adreno_device *adreno_dev, group = &(counters->groups[groupid]); if (group->flags & ADRENO_PERFCOUNTER_GROUP_FIXED) { /* * In fixed groups the countable equals the fixed register the * user wants. First make sure it is in range */ if (countable >= group->reg_count) return -EINVAL; /* If it is already reserved, just increase the refcounts */ if ((group->regs[countable].kernelcount != 0) || (group->regs[countable].usercount != 0)) { refcount_group(group, countable, flags, offset); return 0; } empty = countable; } else { unsigned int i; /* * Check if the countable is already associated with a counter. * Refcount and return the offset, otherwise, try and find an empty * counter and assign the countable to it. * Refcount and return the offset, otherwise, try and find an * empty counter and assign the countable to it. */ for (i = 0; i < group->reg_count; i++) { if (group->regs[i].countable == countable) { /* Countable already associated with counter */ if (flags & PERFCOUNTER_FLAG_KERNEL) group->regs[i].kernelcount++; else group->regs[i].usercount++; if (offset) *offset = group->regs[i].offset; refcount_group(group, i, flags, offset); return 0; } else if (group->regs[i].countable == KGSL_PERFCOUNTER_NOT_USED) { Loading @@ -658,6 +684,7 @@ int adreno_perfcounter_get(struct adreno_device *adreno_dev, empty = i; } } } /* no available counters, so do nothing else */ if (empty == -1) Loading
drivers/gpu/msm/adreno.h +17 −2 Original line number Diff line number Diff line Loading @@ -242,8 +242,19 @@ struct adreno_perfcount_group { struct adreno_perfcount_register *regs; unsigned int reg_count; const char *name; unsigned long flags; }; /* * ADRENO_PERFCOUNTER_GROUP_FIXED indicates that a perfcounter group is fixed - * instead of having configurable countables like the other groups, registers in * fixed groups have a hardwired countable. So when the user requests a * countable in one of these groups, that countable should be used as the * register offset to return */ #define ADRENO_PERFCOUNTER_GROUP_FIXED BIT(0) /** * adreno_perfcounts: all available perfcounter groups * @groups: available groups for this device Loading @@ -265,11 +276,15 @@ struct adreno_invalid_countables { }; #define ADRENO_PERFCOUNTER_GROUP(core, name) { core##_perfcounters_##name, \ ARRAY_SIZE(core##_perfcounters_##name), __stringify(name) } ARRAY_SIZE(core##_perfcounters_##name), __stringify(name), 0 } #define ADRENO_PERFCOUNTER_GROUP_FLAGS(core, name, flags) \ { core##_perfcounters_##name, \ ARRAY_SIZE(core##_perfcounters_##name), __stringify(name), flags } #define ADRENO_PERFCOUNTER_GROUP_OFF(core, name, offset) \ [KGSL_PERFCOUNTER_GROUP_##offset] = { core##_perfcounters_##name, \ ARRAY_SIZE(core##_perfcounters_##name), __stringify(name) } ARRAY_SIZE(core##_perfcounters_##name), __stringify(name), 0 } #define ADRENO_PERFCOUNTER_INVALID_COUNTABLE(name, off) \ [KGSL_PERFCOUNTER_GROUP_##off] = { name##_invalid_countables, \ Loading
drivers/gpu/msm/adreno_a3xx.c +4 −2 Original line number Diff line number Diff line Loading @@ -1807,9 +1807,11 @@ static struct adreno_perfcount_group a3xx_perfcounter_groups[] = { ADRENO_PERFCOUNTER_GROUP(a3xx, tp), ADRENO_PERFCOUNTER_GROUP(a3xx, sp), ADRENO_PERFCOUNTER_GROUP(a3xx, rb), ADRENO_PERFCOUNTER_GROUP(a3xx, pwr), ADRENO_PERFCOUNTER_GROUP_FLAGS(a3xx, pwr, ADRENO_PERFCOUNTER_GROUP_FIXED), ADRENO_PERFCOUNTER_GROUP(a3xx, vbif), ADRENO_PERFCOUNTER_GROUP(a3xx, vbif_pwr), ADRENO_PERFCOUNTER_GROUP_FLAGS(a3xx, vbif_pwr, ADRENO_PERFCOUNTER_GROUP_FIXED), }; static struct adreno_perfcounters a3xx_perfcounters = { Loading