[PATCH 2/3] drm: align #include directives with libdrm in uapi headers

Emil Velikov emil.l.velikov at gmail.com
Wed Mar 30 15:22:51 UTC 2016


On 30 March 2016 at 16:11, Daniel Vetter <daniel at ffwll.ch> wrote:
> On Wed, Mar 30, 2016 at 04:05:20PM +0100, Emil Velikov wrote:
>> On 30 March 2016 at 15:19, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
>> > We can't use <drm/*.h> because that upsets the serach paths in libdrm.
>> > Also, drop the circular inclusion in drm_mode.h.
>> >
>> > v2: Actually change the right headers.
>> >
>> > Cc: Emil Velikov <emil.l.velikov at gmail.com>
>> > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
>> > ---
>> >  include/uapi/drm/drm.h      | 2 +-
>> >  include/uapi/drm/drm_mode.h | 2 --
>> >  2 files changed, 1 insertion(+), 3 deletions(-)
>> >
>> > diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
>> > index d299c7749091..c7ecc3abff03 100644
>> > --- a/include/uapi/drm/drm.h
>> > +++ b/include/uapi/drm/drm.h
>> > @@ -685,7 +685,7 @@ struct drm_prime_handle {
>> >         __s32 fd;
>> >  };
>> >
>> > -#include <drm/drm_mode.h>
>> > +#include "drm_mode.h"
>> >
>> >  #define DRM_IOCTL_BASE                 'd'
>> >  #define DRM_IO(nr)                     _IO(DRM_IOCTL_BASE,nr)
>> > diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> > index c0217434d28d..db106ab01039 100644
>> > --- a/include/uapi/drm/drm_mode.h
>> > +++ b/include/uapi/drm/drm_mode.h
>> > @@ -27,8 +27,6 @@
>> >  #ifndef _DRM_MODE_H
>> >  #define _DRM_MODE_H
>> >
>> > -#include "drm.h"
>> > -
>> I'm thinking about the complete inverse actually.
>>
>> Any program that depends on drm_mode.h but does not include it
>> explicitly is severely broken. On the other hand, we rely on the drm.h
>> to resolve the linux specific types (for non-linux platforms).
>>
>> Unfortunately I've not looked how much busted userspace there is in
>> either case (this patch vs my suggestion).
>
> Well I was just blindly aligning the #includes to match what we have right
> now in libdrm. That's the safest option really. It would be nice to
> untangle this, but I think it's too late for that now :(
Sadly that's the case. As I doubt anyone is interested in seeing
existing userspace burn (fail to build), so let's keep the drm_mode.h.
Although let's also keep the drm.h include - it's a way to of being
nice to devs so that they don't need nasty workarounds.

Thanks
Emil


More information about the dri-devel mailing list