Bug 109268 - Compilation of xf86-video-intel fails because byteswap.h is not available on OpenBSD
Summary: Compilation of xf86-video-intel fails because byteswap.h is not available on ...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: git
Hardware: x86-64 (AMD64) OpenBSD
: medium normal
Assignee: Chris Wilson
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-10 06:12 UTC by Mikolaj
Modified: 2019-01-10 12:40 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
0001-sna-fix-of-byteswap.h-absence-on-bsd.patch (1.19 KB, patch)
2019-01-10 09:14 UTC, Sergii Romantsov
no flags Details | Splinter Review

Description Mikolaj 2019-01-10 06:12:24 UTC
File src/sna/sna_video.c includes byteswap.h which is not present on OpenBSD and compilation fails. This problem is visible for me on commit e5ff8e1828f97891c819c919d7115c6e18b2eb1f (date Mon Dec 3 08:58:39 2018 +0000, latest as of my testing) and git log says that usage of bswap_32() function was introduced in 746ab3bb131dea8ad015e7804bfcdd6b4cc4f44e (date Tue Nov 13 09:45:02 2018 +0200). I'm using git checkout from:

https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel.git

of the driver. Other than bswap_32() problem, the code works and compiles on OpenBSD -current.
Comment 1 Mikolaj 2019-01-10 06:26:55 UTC
I should mention that this was only tested on amd64 architecture.
Comment 2 Mikolaj 2019-01-10 06:43:08 UTC
Gist of the error message:

/home/mkucharski/openbsd/xenocara/driver/xf86-video-intel/src/sna/sna_video.c:62:10: fatal error: 'byteswap.h' file not found
#include <byteswap.h>
         ^~~~~~~~~~~~
1 error generated.
Comment 3 Sergii Romantsov 2019-01-10 09:14:18 UTC
Created attachment 143053 [details] [review]
0001-sna-fix-of-byteswap.h-absence-on-bsd.patch

Hello, Mikolaj
Please, try patch 0001-sna-fix-of-byteswap.h-absence-on-bsd.patch
Don't have OpenBSD installed, but also will try to check soon
Comment 4 Stanislav Lisovskiy 2019-01-10 09:49:32 UTC
A bit offtopic, but I noticed that there are lots of issues like this: 

http://lists.busybox.net/pipermail/busybox/2010-August/073031.html

Just wondering why there is still no common standard here, looks stupid.
Comment 5 Chris Wilson 2019-01-10 10:03:52 UTC
commit 985553dff9d9de255edb6acb0ae85117ceb3e76c
Author: Sergii Romantsov <sergii.romantsov@gmail.com>
Date:   Thu Jan 10 11:42:45 2019 +0200

    sna: fix of byteswap.h absence on bsd
    
    OpenBSD, FreeBSD and NetBSD don't contains file byteswap.h.
    Used specifics of them.
    
    Fixes: 746ab3bb131d (sna: Added AYUV format support for textured and sprite video adapters.)
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109268
    CC: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
    CC: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Comment 6 Mikolaj 2019-01-10 12:40:26 UTC
Hi,

Instead of taking the patch from this bug report, I `git pull -r` the repo up to commit c37c7ee0748ba828ec5d2c7304cd2a17af2c8109 which also includes:

commit 985553dff9d9de255edb6acb0ae85117ceb3e76c
Author: Sergii Romantsov <sergii.romantsov@gmail.com>
Date:   Thu Jan 10 11:42:45 2019 +0200

    sna: fix of byteswap.h absence on bsd
...

and I don't see anymore issues with inclusion of byteswap.h file. Thanks Sergii for quick fix. Compilation succeeded on OpenBSD -current without any patches.

$ sysctl -n kern.version                                                                                                    
OpenBSD 6.4-current (GENERIC.MP) #592: Wed Jan  9 22:34:22 MST 2019
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.