Re: [Mesa-dev] [PATCH 1/3] dri: add dri_get_extensions_name(..) helper

2016-11-03 Thread Emil Velikov
On 3 November 2016 at 17:53, Christian Gmeiner
 wrote:
> Hi Emil,
>
> 2016-11-03 17:02 GMT+01:00 Emil Velikov :
>> On 3 November 2016 at 14:25, Christian Gmeiner
>>  wrote:
>>> Signed-off-by: Christian Gmeiner 
>>> ---
>>>  include/GL/internal/dri_interface.h | 14 ++
>>>  1 file changed, 14 insertions(+)
>>>
>>> diff --git a/include/GL/internal/dri_interface.h 
>>> b/include/GL/internal/dri_interface.h
>>> index d0b1bc6..36ba65e 100644
>>> --- a/include/GL/internal/dri_interface.h
>>> +++ b/include/GL/internal/dri_interface.h
>>> @@ -40,6 +40,9 @@
>>>  #ifndef DRI_INTERFACE_H
>>>  #define DRI_INTERFACE_H
>>>
>>> +#include 
>>> +#include 
>>> +#include 
>>>  #ifdef HAVE_LIBDRM
>>>  #include 
>>>  #else
>>> @@ -606,6 +609,17 @@ struct __DRIuseInvalidateExtensionRec {
>>>   */
>>>  #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
>>>
>>> +static inline char *
>>> +dri_get_extensions_name(const char *driver_name)
>>> +{
>>> +   char *name = NULL;
>>> +
>>> +   if (asprintf(, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, 
>>> driver_name) < 0)
>>> +   return NULL;
>>> +
>> asprintf is a GNU extension and is missing on MSVC at least. I'm not
>> sure if the includes are ok/needed.
>>
>
> I can rewrite it to use malloc() and snprintf() directly and MSVC
> should be happy to.
>
>> Please move that anywhere in src/loader/ - be that new or existing file.
>>
>
> I can try to put the function directly into loader.[hc] and could rename it to
> loader_get_extensions_name(..).
>
Please do with the loader option.

Thanks
Emil

P.S. Related task for anyone bored: Refactor/move
driOpenDriver/driGetDriverExtensions/dri_bind_extensions and alike to
the loader.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] dri: add dri_get_extensions_name(..) helper

2016-11-03 Thread Christian Gmeiner
Hi Emil,

2016-11-03 17:02 GMT+01:00 Emil Velikov :
> On 3 November 2016 at 14:25, Christian Gmeiner
>  wrote:
>> Signed-off-by: Christian Gmeiner 
>> ---
>>  include/GL/internal/dri_interface.h | 14 ++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/include/GL/internal/dri_interface.h 
>> b/include/GL/internal/dri_interface.h
>> index d0b1bc6..36ba65e 100644
>> --- a/include/GL/internal/dri_interface.h
>> +++ b/include/GL/internal/dri_interface.h
>> @@ -40,6 +40,9 @@
>>  #ifndef DRI_INTERFACE_H
>>  #define DRI_INTERFACE_H
>>
>> +#include 
>> +#include 
>> +#include 
>>  #ifdef HAVE_LIBDRM
>>  #include 
>>  #else
>> @@ -606,6 +609,17 @@ struct __DRIuseInvalidateExtensionRec {
>>   */
>>  #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
>>
>> +static inline char *
>> +dri_get_extensions_name(const char *driver_name)
>> +{
>> +   char *name = NULL;
>> +
>> +   if (asprintf(, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, 
>> driver_name) < 0)
>> +   return NULL;
>> +
> asprintf is a GNU extension and is missing on MSVC at least. I'm not
> sure if the includes are ok/needed.
>

I can rewrite it to use malloc() and snprintf() directly and MSVC
should be happy to.

> Please move that anywhere in src/loader/ - be that new or existing file.
>

I can try to put the function directly into loader.[hc] and could rename it to
loader_get_extensions_name(..).

greets
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] dri: add dri_get_extensions_name(..) helper

2016-11-03 Thread Emil Velikov
On 3 November 2016 at 14:25, Christian Gmeiner
 wrote:
> Signed-off-by: Christian Gmeiner 
> ---
>  include/GL/internal/dri_interface.h | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/include/GL/internal/dri_interface.h 
> b/include/GL/internal/dri_interface.h
> index d0b1bc6..36ba65e 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -40,6 +40,9 @@
>  #ifndef DRI_INTERFACE_H
>  #define DRI_INTERFACE_H
>
> +#include 
> +#include 
> +#include 
>  #ifdef HAVE_LIBDRM
>  #include 
>  #else
> @@ -606,6 +609,17 @@ struct __DRIuseInvalidateExtensionRec {
>   */
>  #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
>
> +static inline char *
> +dri_get_extensions_name(const char *driver_name)
> +{
> +   char *name = NULL;
> +
> +   if (asprintf(, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, 
> driver_name) < 0)
> +   return NULL;
> +
asprintf is a GNU extension and is missing on MSVC at least. I'm not
sure if the includes are ok/needed.

Please move that anywhere in src/loader/ - be that new or existing file.

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] dri: add dri_get_extensions_name(..) helper

2016-11-03 Thread Christian Gmeiner
Signed-off-by: Christian Gmeiner 
---
 include/GL/internal/dri_interface.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index d0b1bc6..36ba65e 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -40,6 +40,9 @@
 #ifndef DRI_INTERFACE_H
 #define DRI_INTERFACE_H
 
+#include 
+#include 
+#include 
 #ifdef HAVE_LIBDRM
 #include 
 #else
@@ -606,6 +609,17 @@ struct __DRIuseInvalidateExtensionRec {
  */
 #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
 
+static inline char *
+dri_get_extensions_name(const char *driver_name)
+{
+   char *name = NULL;
+
+   if (asprintf(, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, driver_name) 
< 0)
+   return NULL;
+
+   return name;
+}
+
 /**
  * Tokens for __DRIconfig attribs.  A number of attributes defined by
  * GLX or EGL standards are not in the table, as they must be provided
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev