drm: Fix drm.h uapi header for Windows
Subsystems (2)
Attempting to submit patch in response to https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712454
This will allow Mesa to port code to Windows more easily.
Hide BSD header and drm_handle_t behind _WIN32 check.
Change __volatile__ to volatile, which is standard.
James Park (1):
drm: Fix drm.h uapi header for Windows
include/uapi/drm/drm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: Fix drm.h uapi header for Windows
This will allow Mesa to port code to Windows more easily.
Hide BSD header and drm_handle_t behind _WIN32 check.
Change __volatile__ to volatile, which is standard.
--- include/uapi/drm/drm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
include/uapi/drm/drm.h +8 -3
@@ -48,10 +48,9 @@ typedef unsigned int drm_handle_t;#include <asm/ioctl.h> typedef unsigned int drm_handle_t ; -#else /* One of the BSDs */ +#else #include <stdint.h> -#include <sys/ioccom.h> #include <sys/types.h> typedef int8_t __s8 ;typedef uint8_t __u8 ;
@@ -62,10 +61,16 @@ typedef uint32_t __u32;typedef int64_t __s64 ;typedef uint64_t __u64 ;typedef size_t __kernel_size_t ; + +#ifndef _WIN32/* One of the BSDs */ + +#include <sys/ioccom.h> typedef unsigned long drm_handle_t ;#endif +#endif +#if defined(__cplusplus)extern "C" {#endif
@@ -128,7 +133,7 @@ struct drm_tex_region {* other data stored in the same cache line. */ struct drm_hw_lock { - __volatile__ unsigned int lock; /**< lock variable */ +volatile unsigned int lock;/**< lock variable */ char padding[60 ];/**< Pad to cache line */ };
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Can you add a Signed-off-by line to your commit message? This means you agree to the Developer Certificate of Origin [1].
[1]: https://developercertificate.org/
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: Fix drm.h uapi header for Windows
Attempting to submit patch in response to https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712454
This will allow Mesa to port code to Windows more easily.
Hide BSD header and drm_handle_t behind _WIN32 check.
Change __volatile__ to volatile, which is standard.
James Park (1):
drm: Fix drm.h uapi header for Windows
include/uapi/drm/drm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: Fix drm.h uapi header for Windows
This will allow Mesa to port code to Windows more easily.
Hide BSD header and drm_handle_t behind _WIN32 check.
Change __volatile__ to volatile, which is standard.
--- include/uapi/drm/drm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
include/uapi/drm/drm.h +8 -3
@@ -48,10 +48,9 @@ typedef unsigned int drm_handle_t;#include <asm/ioctl.h> typedef unsigned int drm_handle_t ; -#else /* One of the BSDs */ +#else #include <stdint.h> -#include <sys/ioccom.h> #include <sys/types.h> typedef int8_t __s8 ;typedef uint8_t __u8 ;
@@ -62,10 +61,16 @@ typedef uint32_t __u32;typedef int64_t __s64 ;typedef uint64_t __u64 ;typedef size_t __kernel_size_t ; + +#ifndef _WIN32/* One of the BSDs */ + +#include <sys/ioccom.h> typedef unsigned long drm_handle_t ;#endif +#endif +#if defined(__cplusplus)extern "C" {#endif
@@ -128,7 +133,7 @@ struct drm_tex_region {* other data stored in the same cache line. */ struct drm_hw_lock { - __volatile__ unsigned int lock; /**< lock variable */ +volatile unsigned int lock;/**< lock variable */ char padding[60 ];/**< Pad to cache line */ };
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 1 line · James Park
This will allow Mesa to port code to Windows more easily.
As discussed in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712779 , including drm.h makes no sense when building for Windows.
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Michel Dänzer
Quoted 1 line · James Park
This will allow Mesa to port code to Windows more easily.
As discussed in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712779
, includingdrm.hmakes no sense when building for Windows.
Yeah I think it'd be cleanest if we can avoid this. If not I think the right fix would be to split out the actually needed parts from drm.h into a new header (still included by drm.h for backwards compat reasons) which mesa can use. Since it looks like the problematic parts are the legacy gunk, and not the new ioctl structures. Pulling out drm_render.h for all the render stuff and mabe drm_vblank.h for the vblank stuff (which would fit better in drm_mode.h but mistakes were made, oops).
-Daniel
Quoted 8 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Michel Dänzer
Quoted 1 line · James Park
This will allow Mesa to port code to Windows more easily.
As discussed in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712779
, includingdrm.hmakes no sense when building for Windows.
Quoted 8 lines
Yeah I think it'd be cleanest if we can avoid this. If not I think the right fix would be to split out the actually needed parts from
drm.hinto a new header (still included bydrm.hfor backwards compat reasons) which mesa can use. Since it looks like the problematic parts are the legacy gunk, and not the new ioctl structures. Pulling outdrm_render.hfor all the render stuff and mabedrm_vblank.hfor the vblank stuff (which would fit better indrm_mode.hbut mistakes were made, oops).
If anything currently in drm.h is needed while building for Windows, it points to a broken abstraction somewhere in userspace. (Specifically, the Mesa Gallium/Vulkan winsys is supposed to abstract away platform details like these)
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
I can avoid modifying drm.h by doing this to drm_fourcc.h:
#ifdef _WIN32
#include <stdint.h>
typedef uint64_t __u64;
#else
#include "drm.h"
#endif
And this to amdgpu_drm.h:
#ifdef _WIN32
#include <stdint.h>
typedef int32_t __s32;
typedef uint32_t __u32;
typedef uint64_t __u64;
#else
#include "drm.h"
#endif
But now I'm touching two files under drm-uapi instead of one, and weirdly.
If we're trying to cut ties with the drm-uapi folder entirely, the stuff ac_surface.c need includes the AMD_FMT_MOD stuff in drm_fourcc.h, and AMDGPU_TILING_* under amdgpu_drm.h. Is there a better spot for these definitions?
Thanks,
James
Quoted 27 lines · Michel Dänzer
Quoted 1 line · Daniel Vetter
On Wed, Dec 2, 2020 at 12:43 PM Michel Dänzer <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines · James Park
Quoted 1 line
This will allow Mesa to port code to Windows more easily.
As discussed in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712779
Quoted 10 lines
Quoted 1 line
, including
drm.hmakes no sense when building for Windows.Yeah I think it'd be cleanest if we can avoid this. If not I think the right fix would be to split out the actually needed parts from
drm.hinto a new header (still included bydrm.hfor backwards compat reasons) which mesa can use. Since it looks like the problematic parts are the legacy gunk, and not the new ioctl structures. Pulling outdrm_render.hfor all the render stuff and mabedrm_vblank.hfor the vblank stuff (which would fit better indrm_mode.hbut mistakes were made, oops).If anything currently in
drm.his needed while building for Windows, it points to a broken abstraction somewhere in userspace. (Specifically, the Mesa Gallium/Vulkan winsys is supposed to abstract away platform details like these)
Quoted 4 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines · James Park
I can avoid modifying
drm.hby doing this todrm_fourcc.h:#ifdef
_WIN32
#include <stdint.h>
typedefuint64_t__u64;
#else
#include "drm.h"
#endifAnd this to
amdgpu_drm.h:#ifdef
_WIN32
#include <stdint.h>
typedefint32_t__s32;
typedefuint32_t__u32;
typedefuint64_t__u64;
#else
#include "drm.h"
#endif
Quoted 3 lines
But now I'm touching two files under drm-uapi instead of one, and weirdly.
If we're trying to cut ties with the drm-uapi folder entirely, the stuff
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot for these definitions?
The drm_fourcc.h maybe makes some sense (I think in some places mesa uses these internally, and many drivers use the modifiers directly in the main driver). But the amdgpu header should be all ioctl stuff, which should be all entirely in the winsys only.
Also kinda disappointing that drm_fourcc.h includes drm.h and isn't standalone, but I guess that sailed (at least for linux). -Daniel
Quoted 33 lines
Thanks,
JamesQuoted 29 lines · Michel Dänzer
Quoted 9 lines · Daniel Vetter
Quoted 7 lines · Michel Dänzer
Quoted 1 line · James Park
This will allow Mesa to port code to Windows more easily.
As discussed in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712779
, includingdrm.hmakes no sense when building for Windows.Quoted 8 lines
Yeah I think it'd be cleanest if we can avoid this. If not I think the right fix would be to split out the actually needed parts from
drm.hinto a new header (still included bydrm.hfor backwards compat reasons) which mesa can use. Since it looks like the problematic parts are the legacy gunk, and not the new ioctl structures. Pulling outdrm_render.hfor all the render stuff and mabedrm_vblank.hfor the vblank stuff (which would fit better indrm_mode.hbut mistakes were made, oops).If anything currently in
drm.his needed while building for Windows, it points to a broken abstraction somewhere in userspace. (Specifically, the Mesa Gallium/Vulkan winsys is supposed to abstract away platform details like these)--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
If the definitions in drm_fourcc.h make sense to live there, and we can't remove drm.h from that header for backward compatibility, and the code that I'm trying to compile on Windows needs the definitions in drm_fourcc.h, then doesn't it make sense to adjust drm.h?
The patch that I'm proposing doesn't change very much. It might be easier to read here:
https://github.com/jpark37/linux/commit/648e9281824ddc943c3ea6b34d6d6c154717a0a3
Thanks,
James
Quoted 76 lines · Daniel Vetter
Quoted 21 lines · James Park
I can avoid modifying
drm.hby doing this todrm_fourcc.h:#ifdef
_WIN32
#include <stdint.h>
typedefuint64_t__u64;
#else
#include "drm.h"
#endifAnd this to
amdgpu_drm.h:#ifdef
_WIN32
#include <stdint.h>
typedefint32_t__s32;
typedefuint32_t__u32;
typedefuint64_t__u64;
#else
#include "drm.h"
#endifQuoted 1 line
But now I'm touching two files under drm-uapi instead of one, and
weirdly.
Quoted 2 lines
If we're trying to cut ties with the drm-uapi folder entirely, the stuff
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot for these definitions?The
drm_fourcc.hmaybe makes some sense (I think in some places mesa uses these internally, and many drivers use the modifiers directly in the main driver). But the amdgpu header should be all ioctl stuff, which should be all entirely in the winsys only.Also kinda disappointing that
drm_fourcc.hincludesdrm.hand isn't standalone, but I guess that sailed (at least for linux). -DanielQuoted 4 lines
Thanks,
JamesOn Wed, Dec 2, 2020 at 10:06 AM Michel Dänzer <[email protected]>
Quoted 3 lines · wrote:
Quoted 3 lines · Daniel Vetter
Quoted 1 line
On Wed, Dec 2, 2020 at 12:43 PM Michel Dänzer <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · James Park
Quoted 1 line
This will allow Mesa to port code to Windows more easily.
As discussed in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162#note_712779
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 1 line
, including
drm.hmakes no sense when building for Windows.Yeah I think it'd be cleanest if we can avoid this. If not I think the right fix would be to split out the actually needed parts from
drm.hinto a new header (still included bydrm.hfor backwards compat reasons) which mesa can use. Since it looks like the problematic parts are the legacy gunk, and not the new ioctl structures. Pulling outdrm_render.hfor all the render stuff and mabedrm_vblank.hfor the vblank stuff (which would fit better indrm_mode.hbut mistakes were made, oops).Quoted 8 lines
Quoted 8 lines
If anything currently in
drm.his needed while building for Windows, it points to a broken abstraction somewhere in userspace. (Specifically, the Mesa Gallium/Vulkan winsys is supposed to abstract away platform details like these)--
Earthling Michel Dänzer |
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Libre software enthusiast | Mesa and X developer
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · On Wed, 2 Dec 2020 23:25:58 +0100 Daniel Vetter <[email protected]> wrote:
Also kinda disappointing that
drm_fourcc.hincludesdrm.hand isn't standalone, but I guess that sailed (at least for linux).
Hi,
FWIW, libweston core needs drm_fourcc.h too, even if nothing would ever use DRM or need libdrm otherwise. A stand-alone drm_fourcc.h replacement would make sense, although distributing it through libdrm would still make libweston require libdrm headers at build time, even if it doesn't need libdrm.so. Not a big deal, and I don't know if anyone actually builds libweston without DRM-backend.
Inventing yet another pixel format enumeration just because you don't want to depend on a specific piece of other software really sucks, so libweston went with DRM formats as the canonical enumeration. And Wayland protocols use it too - Wayland clients rarely have any use for libdrm otherwise.
Maybe a new header drm_formats.h that is what drm_fourcc.h should have been, and make drm_fourcc.h include that to be backwards API compatible?
Thanks,
pq
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 26 lines · Daniel Vetter
Quoted 21 lines · James Park
I can avoid modifying
drm.hby doing this todrm_fourcc.h:#ifdef
_WIN32
#include <stdint.h>
typedefuint64_t__u64;
#else
#include "drm.h"
#endifAnd this to
amdgpu_drm.h:#ifdef
_WIN32
#include <stdint.h>
typedefint32_t__s32;
typedefuint32_t__u32;
typedefuint64_t__u64;
#else
#include "drm.h"
#endifQuoted 3 lines
But now I'm touching two files under drm-uapi instead of one, and weirdly.
If we're trying to cut ties with the drm-uapi folder entirely, the stuff
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot for these definitions?
Quoted 7 lines
The
drm_fourcc.hmaybe makes some sense (I think in some places mesa uses these internally, and many drivers use the modifiers directly in the main driver). But the amdgpu header should be all ioctl stuff, which should be all entirely in the winsys only.Also kinda disappointing that
drm_fourcc.hincludesdrm.hand isn't standalone, but I guess that sailed (at least for linux).
Isn't the only thing it needs the __u32? I would think we could just replace those with unsigned int (DRM_FORMAT_BIG_ENDIAN already assumes int is 32bit it seems) and drop the drm.h.
Or are we're worried something already depends on getting drm.h via just including drm_fourcc.h?
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Ville Syrjälä
Quoted 6 lines
The
drm_fourcc.hmaybe makes some sense (I think in some places mesa uses these internally, and many drivers use the modifiers directly in the main driver). But the amdgpu header should be all ioctl stuff, which should be all entirely in the winsys only.
Also kinda disappointing thatdrm_fourcc.hincludesdrm.hand isn't standalone, but I guess that sailed (at least for linux).
Quoted 6 lines
Isn't the only thing it needs the
__u32? I would think we could just replace those with unsigned int (DRM_FORMAT_BIG_ENDIANalready assumes int is 32bit it seems) and drop thedrm.h.Or are we're worried something already depends on getting
drm.hvia just includingdrm_fourcc.h?
Yes, some user-space might only include drm_fourcc.h and use stuff coming from drm.h.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · James Park
If we're trying to cut ties with the drm-uapi folder entirely, the stuff
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot for these definitions?
The Mesa src/amd/ code should use platform-neutral abstractions for these. This wasn't deemed necessary before, because nobody was trying to build these drivers for non-UNIX OSes. But now you are.
Signature · 6 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Michel Dänzer
Quoted 5 lines · James Park
If we're trying to cut ties with the drm-uapi folder entirely, the stuff
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot for these definitions?The Mesa src/amd/ code should use platform-neutral abstractions for these. This wasn't deemed necessary before, because nobody was trying to build these drivers for non-UNIX OSes. But now you are.
I think that's a bit much busy work for not much gain. drm_fourcc.h is even included as the official source of truth of some khr extensions, making that header stand-alone and useable cross-platform sounds like a good idea to me. Something like the below is imo perfectly fine:
include/uapi/drm/drm_fourcc.h +0 -0
@@ -24,7 +24,11 @@
#ifndef DRM_FOURCC_H
#define DRM_FOURCC_H
+#ifndef DRM_FOURCC_STANDALONE_
+/* include the linux uapi types here */
+#else
#include "drm.h"
+#endif
#if defined(__cplusplus)
extern "C" {
Cheers, Daniel
Quoted 9 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
The trailing underscore for DRM_FOURCC_STANDALONE_ isn't intentional, right? Should I put all the integer types, or just the ones that are used in that file?
Thanks,
James
Quoted 52 lines · Daniel Vetter
Quoted 4 lines · Michel Dänzer
Quoted 2 lines · James Park
If we're trying to cut ties with the drm-uapi folder entirely, the
stuff
Quoted 2 lines
Quoted 2 lines
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot forthese
Quoted 5 lines
Quoted 1 line
definitions?
The Mesa src/amd/ code should use platform-neutral abstractions for these. This wasn't deemed necessary before, because nobody was trying to build these drivers for non-UNIX OSes. But now you are.
I think that's a bit much busy work for not much gain.
drm_fourcc.his even included as the official source of truth of some khr extensions, making that header stand-alone and useable cross-platform sounds like a good idea to me. Something like the below is imo perfectly fine:include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifndef DRM_FOURCC_STANDALONE_ +/* include the linux uapi types here */ +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {Cheers, Daniel
Quoted 9 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · James Park
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or just the ones that are used in that file?
Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than __u32 (for drm fourcc) and __u64 (for drm modifier) is needed.
-Daniel
Quoted 60 lines
Thanks,
JamesQuoted 55 lines · Daniel Vetter
Quoted 11 lines · Michel Dänzer
Quoted 5 lines · James Park
If we're trying to cut ties with the drm-uapi folder entirely, the stuff
ac_surface.cneed includes theAMD_FMT_MODstuff indrm_fourcc.h, and AMDGPU_TILING_* underamdgpu_drm.h. Is there a better spot for these definitions?The Mesa src/amd/ code should use platform-neutral abstractions for these. This wasn't deemed necessary before, because nobody was trying to build these drivers for non-UNIX OSes. But now you are.
I think that's a bit much busy work for not much gain.
drm_fourcc.his even included as the official source of truth of some khr extensions, making that header stand-alone and useable cross-platform sounds like a good idea to me. Something like the below is imo perfectly fine:include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifndef DRM_FOURCC_STANDALONE_ +/* include the linux uapi types here */ +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {Cheers, Daniel
Quoted 9 lines
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · On Thu, 3 Dec 2020 21:45:14 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 4 lines · James Park
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or just the ones that are used in that file?Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than
__u32(for drm fourcc) and__u64(for drm modifier) is needed.
Hi,
can that create conflicts if userspace first includes drm_fourcc.h and then drm.h?
I would find it natural to userspace have generic headers including drm_fourcc.h and then DRM-specific C-files including drm.h as well (through libdrm headers). I think Weston might already do this.
The generic userspace (weston) header would obviously #define DRM_FOURCC_STANDALONE, because it is used by non-DRM C-files as well.
Thanks,
pq
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Pekka Paalanen
Quoted 9 lines · On Thu, 3 Dec 2020 21:45:14 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 4 lines · James Park
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or just the ones that are used in that file?Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than
__u32(for drm fourcc) and__u64(for drm modifier) is needed.Hi,
can that create conflicts if userspace first includes
drm_fourcc.hand thendrm.h?
Quoted 6 lines
I would find it natural to userspace have generic headers including
drm_fourcc.hand then DRM-specific C-files includingdrm.has well (through libdrm headers). I think Weston might already do this.The generic userspace (weston) header would obviously #define
DRM_FOURCC_STANDALONE, because it is used by non-DRM C-files as well.
Hm yes that would break. I guess we could just include the linux types header for this. And I guess on windows you'd need to have that from somewhere. Or we just require that users of the standalone header pull the right header or defines in first?
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
I could adjust the block to look like this:
#ifdef DRM_FOURCC_STANDALONE
#if defined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedef uint32_t __u32;
typedef uint64_t __u64;
#endif
#else
#include "drm.h"
#endif
Alternatively, I could create a new common header to be included from both drm.h and drm_fourcc.h, drm_base_types.h or something like that:
#ifdef DRM_FOURCC_STANDALONE
#include "drm_base_types.h"
#else
#include "drm.h"
#endif
Quoted 28 lines · Daniel Vetter
Quoted 5 lines · Pekka Paalanen
Quoted 1 line · On Thu, 3 Dec 2020 21:45:14 +0100 Daniel Vetter <[email protected]> wrote:
On Thu, Dec 3, 2020 at 7:55 PM James Park <[email protected]>
Quoted 14 lines · wrote:
Quoted 8 lines
Quoted 4 lines
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or just the ones that are used in that file?Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than
__u32(for drm fourcc) and__u64(for drm modifier) is needed.Hi,
can that create conflicts if userspace first includes
drm_fourcc.hand thendrm.h?Quoted 6 lines
I would find it natural to userspace have generic headers including
drm_fourcc.hand then DRM-specific C-files includingdrm.has well (through libdrm headers). I think Weston might already do this.The generic userspace (weston) header would obviously #define
DRM_FOURCC_STANDALONE, because it is used by non-DRM C-files as well.
Quoted 10 lines
Hm yes that would break. I guess we could just include the linux types header for this. And I guess on windows you'd need to have that from somewhere. Or we just require that users of the standalone header pull the right header or defines in first?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 14 lines · On Fri, 4 Dec 2020 11:07:41 -0800 James Park <[email protected]>…
I could adjust the block to look like this:
#ifdef
DRM_FOURCC_STANDALONE
#ifdefined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedefuint32_t__u32;
typedefuint64_t__u64;
#endif
#else
#include "drm.h"
#endif
Quoted 8 lines
Alternatively, I could create a new common header to be included from both
drm.handdrm_fourcc.h,drm_base_types.hor something like that:#ifdef
DRM_FOURCC_STANDALONE
#include "drm_base_types.h"
#else
#include "drm.h"
#endif
Hi,
my point is, any solution relying on DRM_FOURCC_STANDALONE will fail sometimes, because there is no reason why userspace would *not* #define DRM_FOURCC_STANDALONE. Hence, #ifdef DRM_FOURCC_STANDALONE is completely moot, you have to make the headers work in any include order when DRM_FOURCC_STANDALONE is defined anyway.
Thanks.
pq
Quoted 30 lines · Daniel Vetter
Quoted 29 lines · Pekka Paalanen
Quoted 5 lines
Quoted 1 line · On Thu, 3 Dec 2020 21:45:14 +0100 Daniel Vetter <[email protected]> wrote:
On Thu, Dec 3, 2020 at 7:55 PM James Park <[email protected]>
Quoted 20 lines · wrote:
Quoted 8 lines
Quoted 4 lines
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or just the ones that are used in that file?Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than
__u32(for drm fourcc) and__u64(for drm modifier) is needed.Hi,
can that create conflicts if userspace first includes
drm_fourcc.hand thendrm.h?I would find it natural to userspace have generic headers including
drm_fourcc.hand then DRM-specific C-files includingdrm.has well (through libdrm headers). I think Weston might already do this.The generic userspace (weston) header would obviously #define
DRM_FOURCC_STANDALONE, because it is used by non-DRM C-files as well.
Quoted 10 lines
Quoted 10 lines
Hm yes that would break. I guess we could just include the linux types header for this. And I guess on windows you'd need to have that from somewhere. Or we just require that users of the standalone header pull the right header or defines in first?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
I'm not completely sure what you're saying, but doesn't drm_base_types.h (now drm_basic_types.h) make things robust to header order? The patch is in another email. You can also see it here:
https://github.com/jpark37/linux/commit/0cc8ae750bfd9eab7e31c7de6aa84f24682f4f18
Thanks,
James
Quoted 67 lines · Pekka Paalanen
Quoted 14 lines · On Fri, 4 Dec 2020 11:07:41 -0800 James Park <[email protected]>…
I could adjust the block to look like this:
#ifdef
DRM_FOURCC_STANDALONE
#ifdefined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedefuint32_t__u32;
typedefuint64_t__u64;
#endif
#else
#include "drm.h"
#endifQuoted 1 line
Alternatively, I could create a new common header to be included from
both
Quoted 7 lines
drm.handdrm_fourcc.h,drm_base_types.hor something like that:#ifdef
DRM_FOURCC_STANDALONE
#include "drm_base_types.h"
#else
#include "drm.h"
#endifHi,
my point is, any solution relying on
DRM_FOURCC_STANDALONEwill fail sometimes, because there is no reason why userspace would *not* #defineDRM_FOURCC_STANDALONE. Hence, #ifdefDRM_FOURCC_STANDALONEis completely moot, you have to make the headers work in any include order whenDRM_FOURCC_STANDALONEis defined anyway.Thanks.
pqQuoted 3 lines · Daniel Vetter
Quoted 2 lines
On Fri, Dec 4, 2020 at 9:12 AM Pekka Paalanen <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 1 line · On Thu, 3 Dec 2020 21:45:14 +0100 Daniel Vetter <[email protected]> wrote:
On Thu, Dec 3, 2020 at 7:55 PM James Park <
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or justthe
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
ones that are used in that file?
Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than
__u32(for drmfourcc)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
and
__u64(for drm modifier) is needed.Hi,
can that create conflicts if userspace first includes
drm_fourcc.hand
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
then
drm.h?
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I would find it natural to userspace have generic headers including
drm_fourcc.hand then DRM-specific C-files includingdrm.has well (through libdrm headers). I think Weston might already do this.The generic userspace (weston) header would obviously #define
DRM_FOURCC_STANDALONE, because it is used by non-DRM C-files aswell.
Quoted 11 lines
Quoted 11 lines
Hm yes that would break. I guess we could just include the linux types header for this. And I guess on windows you'd need to have that from somewhere. Or we just require that users of the standalone header pull the right header or defines in first?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · On Mon, 7 Dec 2020 01:08:58 -0800 James Park <[email protected]>…
I'm not completely sure what you're saying, but doesn't
drm_base_types.h(nowdrm_basic_types.h) make things robust to header order? The patch is in another email. You can also see it here:
https://github.com/jpark37/linux/commit/0cc8ae750bfd9eab7e31c7de6aa84f24682f4f18
If that is robust (I don't know if it is, I haven't checked), then why do you have #ifdef DRM_FOURCC_STANDALONE in it at all?
Like Simon said:
Quoted 3 lines · On Mon, 07 Dec 2020 10:02:36 +0000 Simon Ser <[email protected]> wrote:
In my compositors I'd like to globally define
DRM_FOURCC_STANDALONE(to make sure I don't miss any #define) but I still may includedrm.hin the same files as well.
If any project #defines it globally, then what good does checking for it do? Why not assume that everyone will always want what DRM_FOURCC_STANDALONE would bring?
Thanks,
pq
Quoted 93 lines
Thanks,
JamesQuoted 87 lines · Pekka Paalanen
Quoted 14 lines · On Fri, 4 Dec 2020 11:07:41 -0800 James Park <[email protected]>…
I could adjust the block to look like this:
#ifdef
DRM_FOURCC_STANDALONE
#ifdefined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedefuint32_t__u32;
typedefuint64_t__u64;
#endif
#else
#include "drm.h"
#endifQuoted 1 line
Alternatively, I could create a new common header to be included from
both
Quoted 7 lines
drm.handdrm_fourcc.h,drm_base_types.hor something like that:#ifdef
DRM_FOURCC_STANDALONE
#include "drm_base_types.h"
#else
#include "drm.h"
#endifHi,
my point is, any solution relying on
DRM_FOURCC_STANDALONEwill fail sometimes, because there is no reason why userspace would *not* #defineDRM_FOURCC_STANDALONE. Hence, #ifdefDRM_FOURCC_STANDALONEis completely moot, you have to make the headers work in any include order whenDRM_FOURCC_STANDALONEis defined anyway.Thanks.
pqQuoted 3 lines · Daniel Vetter
Quoted 2 lines
On Fri, Dec 4, 2020 at 9:12 AM Pekka Paalanen <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 1 line · On Thu, 3 Dec 2020 21:45:14 +0100 Daniel Vetter <[email protected]> wrote:
On Thu, Dec 3, 2020 at 7:55 PM James Park <
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
The trailing underscore for
DRM_FOURCC_STANDALONE_isn't intentional, right? Should I put all the integer types, or justthe
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
ones that are used in that file?
Yeah that trailing _ just slipped in. And I'd just do the types already used. I don't think anything else than
__u32(for drmfourcc)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
and
__u64(for drm modifier) is needed.Hi,
can that create conflicts if userspace first includes
drm_fourcc.hand
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
then
drm.h?I would find it natural to userspace have generic headers including
drm_fourcc.hand then DRM-specific C-files includingdrm.has well (through libdrm headers). I think Weston might already do this.The generic userspace (weston) header would obviously #define
DRM_FOURCC_STANDALONE, because it is used by non-DRM C-files aswell.
Quoted 11 lines
Quoted 11 lines
Hm yes that would break. I guess we could just include the linux types header for this. And I guess on windows you'd need to have that from somewhere. Or we just require that users of the standalone header pull the right header or defines in first?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · On Mon, 7 Dec 2020 12:35:14 +0200 Pekka Paalanen <[email protected]> wrote:
Quoted 4 lines · On Mon, 7 Dec 2020 01:08:58 -0800 James Park <[email protected]>…
I'm not completely sure what you're saying, but doesn't
drm_base_types.h(nowdrm_basic_types.h) make things robust to header order? The patch is in another email. You can also see it here:
https://github.com/jpark37/linux/commit/0cc8ae750bfd9eab7e31c7de6aa84f24682f4f18If that is robust (I don't know if it is, I haven't checked), then why do you have #ifdef
DRM_FOURCC_STANDALONEin it at all?Like Simon said:
On Mon, 07 Dec 2020 10:02:36 +0000
Simon Ser <[email protected]> wrote:
Quoted 7 lines
Quoted 3 lines
In my compositors I'd like to globally define
DRM_FOURCC_STANDALONE(to make sure I don't miss any #define) but I still may includedrm.hin the same files as well.If any project #defines it globally, then what good does checking for it do? Why not assume that everyone will always want what
DRM_FOURCC_STANDALONEwould bring?
Sorry! Now I got it.
DRM_FOURCC_STANDALONE is a promise that the user is not relying on drm_foucc.h to pull in drm.h. Nothing else. That's fine.
But then, the code in the header should be literally
#ifndef DRM_FOURCC_STANDALONE
#include "drm.h"
#endif
without an #else branch.
Thanks,
pq
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Pekka Paalanen
But then, the code in the header should be literally
#ifndef
DRM_FOURCC_STANDALONE
#include "drm.h"
#endifwithout an #else branch.
As long as there is a #include "drm_basic_types.h" right before (drm_fourcc.h needs __u32 and __u64), I believe this can work too indeed.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
That would work, but that's kind of an annoying requirement. I would prefer the header to be self-sufficient.
Thanks,
James
Quoted 9 lines · Simon Ser
Quoted 6 lines · Pekka Paalanen
But then, the code in the header should be literally
#ifndef
DRM_FOURCC_STANDALONE
#include "drm.h"
#endif
Quoted 6 lines
Quoted 1 line
without an #else branch.
As long as there is a #include "
drm_basic_types.h" right before (drm_fourcc.hneeds__u32and__u64), I believe this can work too indeed.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · James Park
That would work, but that's kind of an annoying requirement. I would prefer the header to be self-sufficient.
I don't want to make it more confusing than before, but here Pekka (I think) suggests to replace this:
include/uapi/drm/drm_fourcc.h +4 -0
@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
With this:
include/uapi/drm/drm_fourcc.h +4 -0
@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
That wouldn't change whether the header is self-sufficient or not, would it?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 44 lines · On Mon, 07 Dec 2020 10:53:49 +0000 Simon Ser <[email protected]> wrote:
Quoted 2 lines · James Park
That would work, but that's kind of an annoying requirement. I would prefer the header to be self-sufficient.
I don't want to make it more confusing than before, but here Pekka (I think) suggests to replace this:
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {With this:
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Quoted 2 lines
That wouldn't change whether the header is self-sufficient or not, would it?
Exactly this.
This communicates properly that DRM_FOURCC_STANDALONE only affects whether drm.h gets pulled in or not, and there are no other effects.
This also makes testing better: when you unconditionally include drm_basic_types.h, you are more likely to catch breakage there.
For functionality, it makes no difference. Whether userspace does
#include "drm.h"
#define DRM_FOURCC_STANDALONE
#include "drm_fourcc.h"
or
#define DRM_FOURCC_STANDALONE
#include "drm_fourcc.h"
#include "drm.h"
the result must always be good.
Thanks,
pq
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
I updated the patch earlier today incorporating the suggestions. I also had to bring back "#include <linux/types.h>" to drm.h because there's some sanity check that fails, as if it doesn't scan past the first level of #includes..
- James
Quoted 73 lines · Pekka Paalanen
Quoted 1 line · On Mon, 07 Dec 2020 10:53:49 +0000 Simon Ser <[email protected]> wrote:
On Monday, December 7th, 2020 at 11:49 AM, James Park <
Review
Quoted 8 lines · [email protected]> wrote:
Quoted 3 lines
That would work, but that's kind of an annoying requirement. I would prefer the header to be self-sufficient.
I don't want to make it more confusing than before, but here Pekka (I think) suggests to replace this:
(quoted diff) +0
-0
b/include/uapi/drm/drm_fourcc.hQuoted 16 lines
index 82f3278..5eb07a5 100644
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {Review
Quoted 3 lines
With this:
(quoted diff) +0
-0
b/include/uapi/drm/drm_fourcc.hQuoted 16 lines
index 82f3278..5eb07a5 100644
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {Quoted 2 lines
That wouldn't change whether the header is self-sufficient or not, would it?
Exactly this.
This communicates properly that
DRM_FOURCC_STANDALONEonly affects whetherdrm.hgets pulled in or not, and there are no other effects.This also makes testing better: when you unconditionally include
drm_basic_types.h, you are more likely to catch breakage there.For functionality, it makes no difference. Whether userspace does
#include "
drm.h"
#defineDRM_FOURCC_STANDALONE
#include "drm_fourcc.h"or
#define
DRM_FOURCC_STANDALONE
#include "drm_fourcc.h"
#include "drm.h"
Quoted 6 lines
the result must always be good.
Thanks,
pq
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
I'd really like this for Mesa so we can pull drm_fourcc.h into common WSI code. Why has it stalled?
--Jason
Quoted 87 lines · James Park
I updated the patch earlier today incorporating the suggestions. I also had to bring back "#include <
linux/types.h>" todrm.hbecause there's some sanity check that fails, as if it doesn't scan past the first level of #includes..- James
Quoted 71 lines · Pekka Paalanen
Quoted 44 lines · On Mon, 07 Dec 2020 10:53:49 +0000 Simon Ser <[email protected]> wrote:
Quoted 2 lines · James Park
That would work, but that's kind of an annoying requirement. I would prefer the header to be self-sufficient.
I don't want to make it more confusing than before, but here Pekka (I think) suggests to replace this:
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {With this:
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {Quoted 2 lines
That wouldn't change whether the header is self-sufficient or not, would it?
Exactly this.
This communicates properly that
DRM_FOURCC_STANDALONEonly affects whetherdrm.hgets pulled in or not, and there are no other effects.This also makes testing better: when you unconditionally include
drm_basic_types.h, you are more likely to catch breakage there.For functionality, it makes no difference. Whether userspace does
#include "
drm.h"
#defineDRM_FOURCC_STANDALONE
#include "drm_fourcc.h"or
#define
DRM_FOURCC_STANDALONE
#include "drm_fourcc.h"
#include "drm.h"Quoted 5 lines
the result must always be good.
Thanks,
pq_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Oh, I thought you meant:
#include "drm_basic_types.h"
#include "drm_fourcc.h"
Yours should work too. I don't have a preference vs. what I already have, so if no one says anything, I can switch over to yours.
Thanks,
James
Quoted 45 lines · Simon Ser
Quoted 2 lines · James Park
That would work, but that's kind of an annoying requirement. I would prefer the header to be self-sufficient.
I don't want to make it more confusing than before, but here Pekka (I think) suggests to replace this:
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {With this:
include/uapi/drm/drm_fourcc.h +4
-0@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Quoted 3 lines
That wouldn't change whether the header is self-sufficient or not, would it?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
In reply to James ParkCreate drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h, replacing drm.h dependency with drm_basic_types.h.
This will allow Mesa to port code to Windows more easily.
James Park (1):
drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
include/uapi/drm/drm.h | 14 ++-------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h, replacing drm.h dependency with drm_basic_types.h.
This will allow Mesa to port code to Windows more easily.
--- include/uapi/drm/drm.h | 14 ++-------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
include/uapi/drm/drm.h +2 -12
@@ -36,32 +36,22 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__) -#include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t ;#elif defined(__linux__) -#include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t ;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif
include/uapi/drm/drm_basic_types.h new file +52 -0
52 lines not on this page · raw message
include/uapi/drm/drm_fourcc.h +4 -0
@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 4 lines · James Park
Create
drm_basic_types.hto define types previously defined bydrm.h.Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.h, replacingdrm.hdependency withdrm_basic_types.h.
This approach looks better to me than the other alternatives.
Quoted 78 lines
This will allow Mesa to port code to Windows more easily.
Signed-off-by James Park <[email protected]>--- include/uapi/drm/drm.h | 14 ++-------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.hinclude/uapi/drm/drm.h +2
-12@@ -36,32 +36,22 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__) -#include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t ;#elif defined(__linux__) -#include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t ;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif include/uapi/drm/drm_basic_types.h new file +23
-0@@ -0,0 +1,52 @@ +/* +* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +* All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE.
include/uapi/drm/drm_basic_types.h line 33
Quoted 10 lines
include/uapi/drm/drm_basic_types.h new file +10
-0+*/ + +#ifndef _DRM_BASIC_TYPES_H_ +#define _DRM_BASIC_TYPES_H_ + +#if defined(__KERNEL__) + +#include <linux/types.h> + +#elif defined(__linux__)
Nit: these two #ifs can be combined together.
include/uapi/drm/drm_basic_types.h line 37
Quoted 3 lines
include/uapi/drm/drm_basic_types.h new file +3
-0+#include <linux/types.h> + +#else /* One of the BSDs */
Maybe replace with /* Not Linux */?
Quoted 33 lines
include/uapi/drm/drm_basic_types.h new file +14
-0+#include <stdint.h> +typedef int8_t __s8 ; +typedef uint8_t __u8 ; +typedef int16_t __s16 ; +typedef uint16_t __u16 ; +typedef int32_t __s32 ; +typedef uint32_t __u32 ; +typedef int64_t __s64 ; +typedef uint64_t __u64 ; +typedef size_t __kernel_size_t ; + +#endif + +#endif include/uapi/drm/drm_fourcc.h +4
-1@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" { --2.7.4
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
I'd noticed the #if could be combined, but they weren't in drm,h when they could have been, so I didn't want to depart from the existing pattern.
I think "One of the BSDs" is more informative than "Not Linux" if that statement is still true. Given the aversion to making drm.h robust to Windows, I don't think we want to imply compatibility that isn't there.
Thanks,
James
Quoted 153 lines · Simon Ser
Quoted 4 lines · James Park
Create
drm_basic_types.hto define types previously defined bydrm.h.Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.h, replacingdrm.hdependency withdrm_basic_types.h.This approach looks better to me than the other alternatives.
Quoted 6 lines
This will allow Mesa to port code to Windows more easily.
Signed-off-by James Park <[email protected]>--- include/uapi/drm/drm.h | 14 ++-------- include/uapi/drm/drm_basic_types.h | 52++++++++++++++++++++++++++++++++++++++
Review
Quoted 44 lines
include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.hinclude/uapi/drm/drm.h +2
-12@@ -36,32 +36,22 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__) -#include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t ;#elif defined(__linux__) -#include <linux/types.h> #include <asm/ioctl.h> typedef unsigned int drm_handle_t ;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif (quoted diff) +0
-0
b/include/uapi/drm/drm_basic_types.hinclude/uapi/drm/drm_basic_types.h line 6
Quoted 11 lines
new file mode 100644
index 0000000..b3c00bbinclude/uapi/drm/drm_basic_types.h new file +6
-0@@ -0,0 +1,52 @@ +/* +* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +* All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a
include/uapi/drm/drm_basic_types.h line 7
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* copy of this software and associated documentation files (the "Software"),
include/uapi/drm/drm_basic_types.h line 8
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* to deal in the Software without restriction, including without limitation
include/uapi/drm/drm_basic_types.h line 9
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
include/uapi/drm/drm_basic_types.h
Quoted 4 lines
include/uapi/drm/drm_basic_types.h new file +4
-0+* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next
include/uapi/drm/drm_basic_types.h line 14
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* paragraph) shall be included in all copies or substantial portions of the
include/uapi/drm/drm_basic_types.h
Quoted 3 lines
include/uapi/drm/drm_basic_types.h new file +3
-0+* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
include/uapi/drm/drm_basic_types.h line 18
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
include/uapi/drm/drm_basic_types.h line 19
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
include/uapi/drm/drm_basic_types.h line 20
Quoted 1 line
include/uapi/drm/drm_basic_types.h new file +1
-0+* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
include/uapi/drm/drm_basic_types.h line 33
Quoted 13 lines
include/uapi/drm/drm_basic_types.h new file +13
-0+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _DRM_BASIC_TYPES_H_ +#define _DRM_BASIC_TYPES_H_ + +#if defined(__KERNEL__) + +#include <linux/types.h> + +#elif defined(__linux__)Nit: these two #ifs can be combined together.
include/uapi/drm/drm_basic_types.h line 37
Quoted 3 lines
include/uapi/drm/drm_basic_types.h new file +3
-0+#include <linux/types.h> + +#else /* One of the BSDs */ Maybe replace with /* Not Linux */?
Review
Quoted 15 lines
include/uapi/drm/drm_basic_types.h new file +14
-0+#include <stdint.h> +typedef int8_t __s8 ; +typedef uint8_t __u8 ; +typedef int16_t __s16 ; +typedef uint16_t __u16 ; +typedef int32_t __s32 ; +typedef uint32_t __u32 ; +typedef int64_t __s64 ; +typedef uint64_t __u64 ; +typedef size_t __kernel_size_t ; + +#endif + +#endif (quoted diff) +0
-0
b/include/uapi/drm/drm_fourcc.hQuoted 18 lines
index 82f3278..5eb07a5 100644
include/uapi/drm/drm_fourcc.h +4
-1@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include "drm_basic_types.h" +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" { --2.7.4
Quoted 5 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 3 lines · James Park
I'd noticed the #if could be combined, but they weren't in drm,h when they could have been, so I didn't want to depart from the existing pattern.
I see. The original code really needed the two branches and drm_basic_types.h doesn't. But let's see what others think.
Quoted 4 lines
I think "One of the BSDs" is more informative than "Not Linux" if that statement is still true. Given the aversion to making
drm.hrobust to Windows, I don't think we want to imply compatibility that isn't there.
Well, drm_basic_types.h would be included on Windows as well from drm_fourcc.h, right?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
The original code blocks in drm.h look identical to me. I see:
#include <linux/types.h>
#include <asm/ioctl.h>
typedef unsigned int drm_handle_t;
Good point about drm_basic_types.h. I'll change it to say "Not Linux" after waiting a bit for more feedback.
Thanks,
James
Quoted 10 lines · Simon Ser
Quoted 3 lines · James Park
I'd noticed the #if could be combined, but they weren't in drm,h when they could have been, so I didn't want to depart from the existing pattern.
I see. The original code really needed the two branches and
drm_basic_types.hdoesn't. But let's see what others think.
Quoted 8 lines
Quoted 4 lines
I think "One of the BSDs" is more informative than "Not Linux" if that statement is still true. Given the aversion to making
drm.hrobust to Windows, I don't think we want to imply compatibility that isn't there.Well,
drm_basic_types.hwould be included on Windows as well fromdrm_fourcc.h, right?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 5 lines · James Park
The original code blocks in
drm.hlook identical to me. I see:#include <
linux/types.h>
#include <asm/ioctl.h>
typedef unsigned intdrm_handle_t;
Hmm. Actually you're completely right, it turns out it's necessary to duplicate the branches like this to make make headers_install work properly. See 00c9672606f7 ("drm: Untangle __KERNEL__ guards").
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
kernel test robot
build botRe: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
In reply to James ParkThank you for the patch! Perhaps something to improve:
Hi James,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm/drm-next v5.10-rc7 next-20201207] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/James-Park/drm-drm_basic_types-h-DRM_FOURCC_STANDALONE/20201207-165922 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/c614dbde0c1dc422490fb22281d3e6dcc6355f66 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review James-Park/drm-drm_basic_types-h-DRM_FOURCC_STANDALONE/20201207-165922 git checkout c614dbde0c1dc422490fb22281d3e6dcc6355f66 # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> usr/include/linux/kfd_ioctl.h:37: found __[us]{8,16,32,64} type without #include <linux/types.h>---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
This will allow Mesa to port code to Windows more easily.
James Park (1):
drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
This will allow Mesa to port code to Windows more easily.
--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
include/uapi/drm/drm.h +2 -10
@@ -36,6 +36,8 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__)#include <linux/types.h>
@@ -50,18 +52,8 @@ typedef unsigned int drm_handle_t;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif
include/uapi/drm/drm_basic_types.h new file +52 -0
52 lines not on this page · raw message
include/uapi/drm/drm_fourcc.h +4 -0
@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
May I ask what exactly fails when you drop #include <linux/types.h> from drm.h?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
This was the message from kernel test robot.
Quoted 1 line
Quoted 1 line
usr/include/linux/kfd_ioctl.h:37: found __[us]{8,16,32,64} type without
#include <linux/types.h>
Quoted 3 lines · Simon Ser
May I ask what exactly fails when you drop #include <
linux/types.h> fromdrm.h?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 3 lines · James Park
This was the message from kernel test robot.
Quoted 1 line
Quoted 1 line
usr/include/linux/kfd_ioctl.h:37: found __[us]{8,16,32,64} type without #include <linux/types.h>
Interesting that the warning comes from linux/kfd_ioctl.h. I guess keeping the linux/types.h isn't that of a big deal anyways.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
In reply to James ParkQuoted 5 lines · James Park
Create
drm_basic_types.hto define types previously defined bydrm.h. UseDRM_FOURCC_STANDALONEto includedrm_fourcc.hwithoutdrm.h. This will allow Mesa to port code to Windows more easily.Signed-off-by James Park <[email protected]>
This version sounds fine to me, thanks.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
James Park
Acked-by Simon SerRe: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
This will allow Mesa to port code to Windows more easily.
James Park (1):
drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
This will allow Mesa to port code to Windows more easily.
--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
include/uapi/drm/drm.h +2 -10
@@ -36,6 +36,8 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__)#include <linux/types.h>
@@ -50,18 +52,8 @@ typedef unsigned int drm_handle_t;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif
include/uapi/drm/drm_basic_types.h new file +52 -0
52 lines not on this page · raw message
include/uapi/drm/drm_fourcc.h +4 -0
@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 8 lines · On Wed, 9 Dec 2020 03:03:10 -0800 James Park <[email protected]> wrote:
Create
drm_basic_types.hto define types previously defined bydrm.h.Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.hwithoutdrm.h.This will allow Mesa to port code to Windows more easily.
Signed-off-by James Park <[email protected]>Acked-by Simon Ser <[email protected]>
Looks good to me.
But with the caveat that I didn't actually test this.
Thanks,
pq
Quoted 103 lines
--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.hinclude/uapi/drm/drm.h +2
-10@@ -36,6 +36,8 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__)#include <linux/types.h> @@ -50,18 +52,8 @@ typedef unsigned int drm_handle_t;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif include/uapi/drm/drm_basic_types.h new file +52
-0@@ -0,0 +1,52 @@ +/* +* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +* All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef _DRM_BASIC_TYPES_H_ +#define _DRM_BASIC_TYPES_H_ + +#if defined(__KERNEL__) + +#include <linux/types.h> + +#elif defined(__linux__) + +#include <linux/types.h> + +#else /* Not Linux */ + +#include <stdint.h> +typedef int8_t __s8 ; +typedef uint8_t __u8 ; +typedef int16_t __s16 ; +typedef uint16_t __u16 ; +typedef int32_t __s32 ; +typedef uint32_t __u32 ; +typedef int64_t __s64 ; +typedef uint64_t __u64 ; +typedef size_t __kernel_size_t ; + +#endif + +#endif include/uapi/drm/drm_fourcc.h +0
-0@@ -24,7 +24,11 @@#ifndef DRM_FOURCC_H
include/uapi/drm/drm_fourcc.h line 34
Quoted 10 lines
include/uapi/drm/drm_fourcc.h +4
-0#define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus)extern "C" {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
This will allow Mesa to port code to Windows more easily.
James Park (1):
drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Create drm_basic_types.h to define types previously defined by drm.h.
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
This will allow Mesa to port code to Windows more easily.
--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
include/uapi/drm/drm.h +2 -10
@@ -36,6 +36,8 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__)#include <linux/types.h>
@@ -50,18 +52,8 @@ typedef unsigned int drm_handle_t;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif
include/uapi/drm/drm_basic_types.h new file +52 -0
52 lines not on this page · raw message
include/uapi/drm/drm_fourcc.h +4 -0
@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Hello,
Is there something I can do to help move this patch along?
Thanks,
James Park
Quoted 134 lines · James Park
Create
drm_basic_types.hto define types previously defined bydrm.h.Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.hwithoutdrm.h.This will allow Mesa to port code to Windows more easily.
Signed-off-by James Park <[email protected]>Acked-by Simon Ser <[email protected]>Reviewed-by Pekka Paalanen <[email protected]>--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.hinclude/uapi/drm/drm.h +2
-10@@ -36,6 +36,8 @@#ifndef _DRM_H_#define _DRM_H_ +#include "drm_basic_types.h" +#if defined(__KERNEL__)#include <linux/types.h> @@ -50,18 +52,8 @@ typedef unsigned int drm_handle_t;#else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.h> -typedef int8_t __s8 ; -typedef uint8_t __u8 ; -typedef int16_t __s16 ; -typedef uint16_t __u16 ; -typedef int32_t __s32 ; -typedef uint32_t __u32 ; -typedef int64_t __s64 ; -typedef uint64_t __u64 ; -typedef size_t __kernel_size_t ;typedef unsigned long drm_handle_t ;#endif include/uapi/drm/drm_basic_types.h new file +7
-0@@ -0,0 +1,52 @@ +/* +* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. +* All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */include/uapi/drm/drm_basic_types.h new file +28
-0+ +#ifndef _DRM_BASIC_TYPES_H_ +#define _DRM_BASIC_TYPES_H_ + +#if defined(__KERNEL__) + +#include <linux/types.h> + +#elif defined(__linux__) + +#include <linux/types.h> + +#else /* Not Linux */ + +#include <stdint.h> +typedef int8_t __s8 ; +typedef uint8_t __u8 ; +typedef int16_t __s16 ; +typedef uint16_t __u16 ; +typedef int32_t __s32 ; +typedef uint32_t __u32 ; +typedef int64_t __s64 ; +typedef uint64_t __u64 ; +typedef size_t __kernel_size_t ; + +#endif + +#endif include/uapi/drm/drm_fourcc.h +4
-1@@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" { --
Quoted 3 lines
2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Hi James,
Quoted 26 lines · James Park
Hello,
Is there something I can do to help move this patch along?
Thanks,
James ParkQuoted 17 lines · James Park
Create
drm_basic_types.hto define types previously defined bydrm.h.Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.hwithoutdrm.h.This will allow Mesa to port code to Windows more easily.
Signed-off-by James Park <[email protected]>Acked-by Simon Ser <[email protected]>Reviewed-by Pekka Paalanen <[email protected]>--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h
Have you considered the possibility of having the ifdef block inlined within drm_fourcc.h?
Sure some users might need to add an drm.h include in their code. At the same time they also need to explicitly define DRM_FOURCC_STANDALONE, so that is fine.
We had all sorts of issues with these headers in the past, so adding another one might end up repeating some of those yet again.
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
I'm not sure what your suggestion is. Move which #ifdef block where?
I don't think everyone is of the opinion that adding drm.h and pulling in unnecessary kernel structures is fine. If I'm not mistaken, the reason people are making me jump through hoops in the first place is to avoid that.
I appreciate the feedback though.
- James
Quoted 35 lines · Emil Velikov
Hi James,
Quoted 9 lines · James Park
Hello,
Is there something I can do to help move this patch along?
Thanks,
James ParkOn Thu, Dec 10, 2020 at 1:13 AM James Park <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Create
drm_basic_types.hto define types previously defined bydrm.h.Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.hwithoutdrm.h.Quoted 8 lines
Quoted 8 lines
This will allow Mesa to port code to Windows more easily.
Signed-off-by James Park <[email protected]>Acked-by Simon Ser <[email protected]>Reviewed-by Pekka Paalanen <[email protected]>--- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52++++++++++++++++++++++++++++++++++++++
Quoted 4 lines
Quoted 4 lines
include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.hHave you considered the possibility of having the ifdef block inlined within
drm_fourcc.h?
Quoted 9 lines
Sure some users might need to add an
drm.hinclude in their code. At the same time they also need to explicitly defineDRM_FOURCC_STANDALONE, so that is fine.
We had all sorts of issues with these headers in the past, so adding another one might end up repeating some of those yet again.Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Hi james,
Quoted 3 lines · James Park
I'm not sure what your suggestion is. Move which #ifdef block where?
Fair enough. Just sent out a patch which demonstrates what I have in mind.
Thanks
Emil
P.S. Please try to avoid top-posting and HTML emails in public discussions.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 1 line · Emil Velikov
P.S. Please try to avoid top-posting and HTML emails in public discussions.
(James: as a side note, here is a guide to configure your e-mail client to use plain-text: https://useplaintext.email/)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
In reply to James Parkinclude/uapi/drm/drm_basic_types.h line 27
Quoted 2 lines · James Park
include/uapi/drm/drm_basic_types.h new file +2
-0+#ifndef _DRM_BASIC_TYPES_H_ +#define _DRM_BASIC_TYPES_H_
Nit: the rest of the kernel doesn't use an underscore prefix for these defines. Note that anything starting with an underscore followed by an upper-case letter is a reserved identifier in C.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Quoted 8 lines · Simon Ser
Review
Quoted 2 lines · On Thursday, December 10th, 2020 at 10:12 AM, James Park…
(quoted diff) +2
-0+#ifndef _DRM_BASIC_TYPES_H +#define _DRM_BASIC_TYPES_HNit: the rest of the kernel doesn't use an underscore prefix for these defines. Note that anything starting with an underscore followed by an upper-case letter is a reserved identifier in C.
Hm, please disregard, it seems some files still use an underscore.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · James Park
I could adjust the block to look like this:
#ifdef
DRM_FOURCC_STANDALONE
#ifdefined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedefuint32_t__u32;
typedefuint64_t__u64;
#endif
#else
#include "drm.h"
#endif
This approach still breaks on BSDs when DRM_FOURCC_STANDALONE is defined and drm.h is included afterwards.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Not to make too big a deal of it, but the idea was that if you went out of your way to define DRM_FOURCC_STANDALONE in your code base, that you would also go through the pain of removing drm.h includes elsewhere. It's too annoying of an implication to document/communicate, so I'm happier with the other DRM_FOURCC_STANDALONE solution that pulls the basic types into a common header.
Thanks,
James
Quoted 17 lines · Simon Ser
Quoted 13 lines · James Park
I could adjust the block to look like this:
#ifdef
DRM_FOURCC_STANDALONE
#ifdefined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedefuint32_t__u32;
typedefuint64_t__u64;
#endif
#else
#include "drm.h"
#endif
Quoted 4 lines
This approach still breaks on BSDs when
DRM_FOURCC_STANDALONEis defined anddrm.his included afterwards.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · James Park
Not to make too big a deal of it, but the idea was that if you went out of your way to define
DRM_FOURCC_STANDALONEin your code base, that you would also go through the pain of removingdrm.hincludes elsewhere. It's too annoying of an implication to document/communicate, so I'm happier with the otherDRM_FOURCC_STANDALONEsolution that pulls the basic types into a common header.
In my compositors I'd like to globally define DRM_FOURCC_STANDALONE (to make sure I don't miss any #define) but I still may include drm.h in the same files as well.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: Allow drm_fourcc.h without including drm.h
In reply to Daniel VetterAdd DRM_FOURCC_STANDALONE guard to skip drm.h dependency.
This will allow Mesa to port code to Windows more easily.
James Park (1):
drm: Allow drm_fourcc.h without including drm.h
include/uapi/drm/drm_fourcc.h | 6 ++++++ 1 file changed, 6 insertions(+)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm: Allow drm_fourcc.h without including drm.h
Add DRM_FOURCC_STANDALONE guard to skip drm.h dependency.
This will allow Mesa to port code to Windows more easily.
--- include/uapi/drm/drm_fourcc.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/uapi/drm/drm_fourcc.h +6 -0
@@ -24,7 +24,13 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#ifdef DRM_FOURCC_STANDALONE +#include <stdint.h> +typedef uint32_t __u32; +typedef uint64_t __u64; +#else #include "drm.h" +#endif #if defined(__cplusplus) extern "C" {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: Allow drm_fourcc.h without including drm.h
Quoted 8 lines · James Park
include/uapi/drm/drm_fourcc.h +5
-0+#ifdef DRM_FOURCC_STANDALONE +#include <stdint.h> +typedef uint32_t __u32 ; +typedef uint64_t __u64 ; +#else #include "
drm.h"
+#endif
C11 allows duplicate typedefs, but older versions of the standard don't AFAIK. If this is a concern, a solution would be to guard the typedefs.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: Allow drm_fourcc.h without including drm.h
The typedefs might also conflict on Linux if DRM_FOURCC_STANDALONE is enabled with whatever LInux declared __u32/__u64 as, but I think the implication is that once DRM_FOURCC_STANDALONE has been declared, that's kind of a promise not to include drm.h.
I'm fine with this, but I'm not married to it if someone has a problem where they want to define DRM_FOURCC_STANDALONE, but also can't avoid including drm.h for some reason.
Quoted 6 lines · Simon Ser
Quoted 3 lines · James Park
include/uapi/drm/drm_fourcc.h +2
-0+#ifdef DRM_FOURCC_STANDALONE +#include <stdint.h>
Quoted 10 lines
Quoted 5 lines
include/uapi/drm/drm_fourcc.h +3
-0+typedef uint32_t __u32 ; +typedef uint64_t __u64 ; +#else #include "
drm.h"
+#endifC11 allows duplicate typedefs, but older versions of the standard don't AFAIK. If this is a concern, a solution would be to guard the typedefs.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm: Allow drm_fourcc.h without including drm.h
I suppose I should do this to avoid fighting with <linux/types.h>
#ifdef DRM_FOURCC_STANDALONE
#if defined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedef uint32_t __u32;
typedef uint64_t __u64;
#endif
#else
#include "drm.h"
#endif
I'll wait for more feedback before updating the patch though.
Quoted 5 lines · James Park
The typedefs might also conflict on Linux if
DRM_FOURCC_STANDALONEis enabled with whatever LInux declared __u32/__u64 as, but I think the implication is that onceDRM_FOURCC_STANDALONEhas been declared, that's kind of a promise not to includedrm.h.
Quoted 23 lines
I'm fine with this, but I'm not married to it if someone has a problem where they want to define
DRM_FOURCC_STANDALONE, but also can't avoid includingdrm.hfor some reason.Quoted 16 lines · Simon Ser
Quoted 8 lines · James Park
include/uapi/drm/drm_fourcc.h +5
-0+#ifdef DRM_FOURCC_STANDALONE +#include <stdint.h> +typedef uint32_t __u32 ; +typedef uint64_t __u64 ; +#else #include "
drm.h"
+#endifC11 allows duplicate typedefs, but older versions of the standard don't AFAIK. If this is a concern, a solution would be to guard the typedefs.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
kernel test robot
build botRe: [PATCH] drm: Allow drm_fourcc.h without including drm.h
In reply to James ParkThank you for the patch! Perhaps something to improve:
Hi James,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master drm/drm-next v5.10-rc6 next-20201204] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-c002-20201204 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/444ac999e27a36307f741eb0ef60d630b0b8946a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753 git checkout 444ac999e27a36307f741eb0ef60d630b0b8946a # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> usr/include/drm/drm_fourcc.h:29: found __[us]{8,16,32,64} type without #include <linux/types.h>---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH] drm: Allow drm_fourcc.h without including drm.h
In reply to James ParkThank you for the patch! Perhaps something to improve:
Hi James,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master v5.10-rc6 next-20201204] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-a014-20201204 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 32c501dd88b62787d3a5ffda7aabcf4650dbe3cd)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/444ac999e27a36307f741eb0ef60d630b0b8946a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review James-Park/drm-Allow-drm_fourcc-h-without-including-drm-h/20201204-163753 git checkout 444ac999e27a36307f741eb0ef60d630b0b8946a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> usr/include/drm/drm_fourcc.h:29: found __[us]{8,16,32,64} type without #include <linux/types.h>---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org