[Mesa-dev] [PATCH 2/2] llvmpipe: replace LP_MAX_THREADS with screen->num_threads in query code

Brian Paul brianp at vmware.com
Fri Apr 26 15:24:10 PDT 2013


On 04/26/2013 04:11 PM, Roland Scheidegger wrote:
> Am 27.04.2013 00:03, schrieb Brian Paul:
>> ---
>>   src/gallium/drivers/llvmpipe/lp_query.c |    6 ++++--
>>   1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
>> index 96e1e3f..fcb5c6a 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_query.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_query.c
>> @@ -38,6 +38,7 @@
>>   #include "lp_flush.h"
>>   #include "lp_fence.h"
>>   #include "lp_query.h"
>> +#include "lp_screen.h"
>>   #include "lp_state.h"
>>
>>
>> @@ -92,6 +93,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
>>                             boolean wait,
>>                             union pipe_query_result *vresult)
>>   {
>> +   struct llvmpipe_screen *screen = llvmpipe_screen(pipe->screen);
>>      struct llvmpipe_query *pq = llvmpipe_query(q);
>>      uint64_t *result = (uint64_t *)vresult;
>>      int i;
>> @@ -118,12 +120,12 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
>>
>>      switch (pq->type) {
>>      case PIPE_QUERY_OCCLUSION_COUNTER:
>> -      for (i = 0; i<  LP_MAX_THREADS; i++) {
>> +      for (i = 0; i<  screen->num_threads; i++) {
>>            *result += pq->count[i];
>>         }
>>         break;
>>      case PIPE_QUERY_TIMESTAMP:
>> -      for (i = 0; i<  LP_MAX_THREADS; i++) {
>> +      for (i = 0; i<  screen->num_threads; i++) {
>>            if (pq->count[i]>  *result) {
>>               *result = pq->count[i];
>>            }
>>
>
> Series looks good to me, though I'm not entirely sure how far we expect
> scaling that way to make sense.

Yes, I reminded him of Amdahl's Law.

-Brian



More information about the mesa-dev mailing list