[Mesa-dev] i965: fix cast in OA performance query code

Submitted by Mauro Rossi on May 1, 2017, 11:09 a.m.

Details

Message ID 1493636962-8892-1-git-send-email-issor.oruam@gmail.com
State New
Headers show
Series "i965: fix cast in OA performance query code" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Mauro Rossi May 1, 2017, 11:09 a.m.
Fixes the following building error happening on marshmallow-x86
with Ubuntu 16.04 LTS stock build essentials package
and by the book Android build system.

external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In function 'open_i915_perf_oa_stream':
external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25:
error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
       .properties_ptr = (uint64_t)properties
                         ^

Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
---
 src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
index 95f112e..7436b39 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -833,7 +833,7 @@  open_i915_perf_oa_stream(struct brw_context *brw,
                I915_PERF_FLAG_FD_NONBLOCK |
                I915_PERF_FLAG_DISABLED,
       .num_properties = ARRAY_SIZE(properties) / 2,
-      .properties_ptr = (uint64_t)properties
+      .properties_ptr = (uint64_t *)properties
    };
    int fd = drmIoctl(drm_fd, DRM_IOCTL_I915_PERF_OPEN, &param);
    if (fd == -1) {

Comments

On 1 May 2017 at 12:09, Mauro Rossi <issor.oruam@gmail.com> wrote:
> Fixes the following building error happening on marshmallow-x86
> with Ubuntu 16.04 LTS stock build essentials package
> and by the book Android build system.
>
> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In function 'open_i915_perf_oa_stream':
> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25:
> error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>        .properties_ptr = (uint64_t)properties
>                          ^
>
> Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
> ---
>  src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
> index 95f112e..7436b39 100644
> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
> @@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
>                 I915_PERF_FLAG_FD_NONBLOCK |
>                 I915_PERF_FLAG_DISABLED,
>        .num_properties = ARRAY_SIZE(properties) / 2,
> -      .properties_ptr = (uint64_t)properties
> +      .properties_ptr = (uint64_t *)properties
Rob, others - do we still need this?

Thanks
Emil
On 05/11/2017 02:23 PM, Emil Velikov wrote:
> On 1 May 2017 at 12:09, Mauro Rossi <issor.oruam@gmail.com> wrote:
>> Fixes the following building error happening on marshmallow-x86
>> with Ubuntu 16.04 LTS stock build essentials package
>> and by the book Android build system.
>>
>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In function 'open_i915_perf_oa_stream':
>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25:
>> error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>>         .properties_ptr = (uint64_t)properties
>>                           ^
>>
>> Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
>> ---
>>   src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c
>> index 95f112e..7436b39 100644
>> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
>> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
>> @@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
>>                  I915_PERF_FLAG_FD_NONBLOCK |
>>                  I915_PERF_FLAG_DISABLED,
>>         .num_properties = ARRAY_SIZE(properties) / 2,
>> -      .properties_ptr = (uint64_t)properties
>> +      .properties_ptr = (uint64_t *)properties
> Rob, others - do we still need this?

I did brief look here but not 100% sure if this is right fix, 
properties_ptr is uint64_t so I guess you might end up with another 
warning/error here, should uintptr_t be used instead?

> Thanks
> Emil
>
On 11/05/17 12:27, Tapani Pälli wrote:
>
>
> On 05/11/2017 02:23 PM, Emil Velikov wrote:
>> On 1 May 2017 at 12:09, Mauro Rossi <issor.oruam@gmail.com> wrote:
>>> Fixes the following building error happening on marshmallow-x86
>>> with Ubuntu 16.04 LTS stock build essentials package
>>> and by the book Android build system.
>>>
>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In 
>>> function 'open_i915_perf_oa_stream':
>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25:
>>> error: cast from pointer to integer of different size 
>>> [-Werror=pointer-to-int-cast]
>>>         .properties_ptr = (uint64_t)properties
>>>                           ^
>>>
>>> Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
>>> ---
>>>   src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
>>> b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>> index 95f112e..7436b39 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
>>> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>> @@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
>>>                  I915_PERF_FLAG_FD_NONBLOCK |
>>>                  I915_PERF_FLAG_DISABLED,
>>>         .num_properties = ARRAY_SIZE(properties) / 2,
>>> -      .properties_ptr = (uint64_t)properties
>>> +      .properties_ptr = (uint64_t *)properties
>> Rob, others - do we still need this?
>
> I did brief look here but not 100% sure if this is right fix, 
> properties_ptr is uint64_t so I guess you might end up with another 
> warning/error here, should uintptr_t be used instead?

Casting to uint64_t* doesn't seem right.
Maybe do it like this :

https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n687

>> Thanks
>> Emil
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
On 11/05/17 13:58, Lionel Landwerlin wrote:
> On 11/05/17 12:27, Tapani Pälli wrote:
>>
>>
>> On 05/11/2017 02:23 PM, Emil Velikov wrote:
>>> On 1 May 2017 at 12:09, Mauro Rossi <issor.oruam@gmail.com> wrote:
>>>> Fixes the following building error happening on marshmallow-x86
>>>> with Ubuntu 16.04 LTS stock build essentials package
>>>> and by the book Android build system.
>>>>
>>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In 
>>>> function 'open_i915_perf_oa_stream':
>>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25: 
>>>>
>>>> error: cast from pointer to integer of different size 
>>>> [-Werror=pointer-to-int-cast]
>>>>         .properties_ptr = (uint64_t)properties
>>>>                           ^
>>>>
>>>> Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
>>>> ---
>>>>   src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
>>>> b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>> index 95f112e..7436b39 100644
>>>> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>> @@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
>>>>                  I915_PERF_FLAG_FD_NONBLOCK |
>>>>                  I915_PERF_FLAG_DISABLED,
>>>>         .num_properties = ARRAY_SIZE(properties) / 2,
>>>> -      .properties_ptr = (uint64_t)properties
>>>> +      .properties_ptr = (uint64_t *)properties
>>> Rob, others - do we still need this?
>>
>> I did brief look here but not 100% sure if this is right fix, 
>> properties_ptr is uint64_t so I guess you might end up with another 
>> warning/error here, should uintptr_t be used instead?
>
> Casting to uint64_t* doesn't seem right.
> Maybe do it like this :
>
> https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n687 
>

Sorry, picked up the wrong line :

https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n862

>
>>> Thanks
>>> Emil
>>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
On 05/11/2017 04:00 PM, Lionel Landwerlin wrote:
> On 11/05/17 13:58, Lionel Landwerlin wrote:
>> On 11/05/17 12:27, Tapani Pälli wrote:
>>>
>>>
>>> On 05/11/2017 02:23 PM, Emil Velikov wrote:
>>>> On 1 May 2017 at 12:09, Mauro Rossi <issor.oruam@gmail.com> wrote:
>>>>> Fixes the following building error happening on marshmallow-x86
>>>>> with Ubuntu 16.04 LTS stock build essentials package
>>>>> and by the book Android build system.
>>>>>
>>>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In 
>>>>> function 'open_i915_perf_oa_stream':
>>>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25: 
>>>>>
>>>>> error: cast from pointer to integer of different size 
>>>>> [-Werror=pointer-to-int-cast]
>>>>>         .properties_ptr = (uint64_t)properties
>>>>>                           ^
>>>>>
>>>>> Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
>>>>> ---
>>>>>   src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
>>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
>>>>> b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>> index 95f112e..7436b39 100644
>>>>> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>> @@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
>>>>>                  I915_PERF_FLAG_FD_NONBLOCK |
>>>>>                  I915_PERF_FLAG_DISABLED,
>>>>>         .num_properties = ARRAY_SIZE(properties) / 2,
>>>>> -      .properties_ptr = (uint64_t)properties
>>>>> +      .properties_ptr = (uint64_t *)properties
>>>> Rob, others - do we still need this?
>>>
>>> I did brief look here but not 100% sure if this is right fix, 
>>> properties_ptr is uint64_t so I guess you might end up with another 
>>> warning/error here, should uintptr_t be used instead?
>>
>> Casting to uint64_t* doesn't seem right.
>> Maybe do it like this :
>>
>> https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n687 
>>
> 
> Sorry, picked up the wrong line :
> 
> https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n862 

Yes, this looks the correct solution.

> 
>>
>>>> Thanks
>>>> Emil
>>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
>
2017-05-12 8:18 GMT+02:00 Tapani Pälli <tapani.palli@intel.com>:
>
>
> On 05/11/2017 04:00 PM, Lionel Landwerlin wrote:
>>
>> On 11/05/17 13:58, Lionel Landwerlin wrote:
>>>
>>> On 11/05/17 12:27, Tapani Pälli wrote:
>>>>
>>>>
>>>>
>>>> On 05/11/2017 02:23 PM, Emil Velikov wrote:
>>>>>
>>>>> On 1 May 2017 at 12:09, Mauro Rossi <issor.oruam@gmail.com> wrote:
>>>>>>
>>>>>> Fixes the following building error happening on marshmallow-x86
>>>>>> with Ubuntu 16.04 LTS stock build essentials package
>>>>>> and by the book Android build system.
>>>>>>
>>>>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In
>>>>>> function 'open_i915_perf_oa_stream':
>>>>>>
>>>>>> external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25:
>>>>>> error: cast from pointer to integer of different size
>>>>>> [-Werror=pointer-to-int-cast]
>>>>>>         .properties_ptr = (uint64_t)properties
>>>>>>                           ^
>>>>>>
>>>>>> Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
>>>>>> ---
>>>>>>   src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
>>>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>>> b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>>> index 95f112e..7436b39 100644
>>>>>> --- a/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>>> +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
>>>>>> @@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
>>>>>>                  I915_PERF_FLAG_FD_NONBLOCK |
>>>>>>                  I915_PERF_FLAG_DISABLED,
>>>>>>         .num_properties = ARRAY_SIZE(properties) / 2,
>>>>>> -      .properties_ptr = (uint64_t)properties
>>>>>> +      .properties_ptr = (uint64_t *)properties
>>>>>
>>>>> Rob, others - do we still need this?
>>>>
>>>>
>>>> I did brief look here but not 100% sure if this is right fix,
>>>> properties_ptr is uint64_t so I guess you might end up with another
>>>> warning/error here, should uintptr_t be used instead?
>>>
>>>
>>> Casting to uint64_t* doesn't seem right.
>>> Maybe do it like this :
>>>
>>>
>>> https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n687
>>
>>
>> Sorry, picked up the wrong line :
>>
>>
>> https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n862
>
>
> Yes, this looks the correct solution.

I propose that Lionel sends a patch, or in any case is considered as
the real author.
Mauro