intel: Do not use libpciaccess on Android
PATCH 1/2 intel: Do not use libpciaccess on Android
From: Tomasz Figa <[email protected]>
This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate ioperm() and iopl() syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code in drm_gralloc and Mesa.
---
Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind.
--- intel/Android.mk | 3 +-- intel/intel_bufmgr.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)
intel/Android.mk +1 -2
@@ -33,8 +33,7 @@ LOCAL_MODULE := libdrm_intel LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) LOCAL_SHARED_LIBRARIES := \ - libdrm \ - libpciaccess + libdrm include $(LIBDRM_COMMON_MK) include $(BUILD_SHARED_LIBRARY)
intel/intel_bufmgr.c +12 -0
@@ -36,7 +36,9 @@#include <errno.h> #include <drm.h> #include <i915_drm.h> +#ifndef __ANDROID__#include <pciaccess.h> +#endif #include "libdrm_macros.h" #include "intel_bufmgr.h" #include "intel_bufmgr_priv.h"
@@ -326,6 +328,7 @@ drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)return -1 ; } +#ifndef __ANDROID__static size_t drm_intel_probe_agp_aperture_size (int fd) {
@@ -351,6 +354,15 @@ err:pci_system_cleanup (); return size; } +#else +static size_t +drm_intel_probe_agp_aperture_size (int fd) +{ +/* Nothing seems to rely on this value on Android anyway... */ +fprintf (stderr,"%s: Mappable aperture size hardcoded to 64MiB\n" ); +return 64 *1024 *1024 ; +} +#endif int drm_intel_get_aperture_sizes (int fd,size_t *mappable,size_t *total)
Signature · 6 lines
2.16.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64"
This reverts commit ed07718ae7bab596297abf210bb0c37c6dba58ed.
The commit added a guard since libpciaccess may be missing on some setups. As of last commit there are no traces of the project, from Android POV.
Hence, we can revert this workaround - which caused similar breakage to the one it's trying to fix. This time in Mesa.
--- intel/Android.mk | 2 -- 1 file changed, 2 deletions(-)
intel/Android.mk +0 -2
@@ -21,7 +21,6 @@ # IN THE SOFTWARE. # -ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS)
@@ -37,4 +36,3 @@ LOCAL_SHARED_LIBRARIES := \ include $(LIBDRM_COMMON_MK) include $(BUILD_SHARED_LIBRARY) -endif
Signature · 6 lines
2.16.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64"
Quoted 6 lines · Emil Velikov
This reverts commit
ed07718ae7bab596297abf210bb0c37c6dba58ed.The commit added a guard since libpciaccess may be missing on some setups. As of last commit there are no traces of the project, from Android POV.
Quoted 6 lines
Hence, we can revert this workaround - which caused similar breakage to the one it's trying to fix. This time in Mesa.
Cc John Stultz <[email protected]>Cc Rob Herring <[email protected]>Cc John Stultz <[email protected]>
Thanks so much for sending these out!
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 60 lines · Emil Velikov
From: Tomasz Figa <[email protected]>
This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate
ioperm()andiopl()syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code indrm_grallocand Mesa.Cc John Stultz <[email protected]>Cc Rob Herring <[email protected]>Cc John Stultz <[email protected]>Cc Tomasz Figa <[email protected]>Signed-off-by Tomasz Figa <[email protected]>[Emil Velikov: rebase against master]Signed-off-by Emil Velikov <[email protected]>---
Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind.--- intel/Android.mk | 3 +-- intel/intel_bufmgr.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)intel/Android.mk +1
-2@@ -33,8 +33,7 @@ LOCAL_MODULE := libdrm_intel LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) LOCAL_SHARED_LIBRARIES := \ - libdrm \ - libpciaccess + libdrm include $(LIBDRM_COMMON_MK) include $(BUILD_SHARED_LIBRARY)intel/intel_bufmgr.c +3
-0@@ -36,7 +36,9 @@#include <errno.h> #include <drm.h> #include <i915_drm.h> +#ifndef __ANDROID__#include <pciaccess.h> +#endif #include "libdrm_macros.h" #include "intel_bufmgr.h" #include "intel_bufmgr_priv.h" @@ -326,6 +328,7 @@ drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)return -1 ; } +#ifndef __ANDROID__static size_t drm_intel_probe_agp_aperture_size (int fd) {
intel/intel_bufmgr.c err: · line 362
Quoted 9 lines
intel/intel_bufmgr.c +6
-0@@ -351,6 +354,15 @@ err:pci_system_cleanup (); return size; } +#else +static size_t +drm_intel_probe_agp_aperture_size (int fd) +{ +/* Nothing seems to rely on this value on Android anyway... */ +fprintf (stderr,"%s: Mappable aperture size hardcoded to 64MiB\n" );
Guessing there's a __func__ missing at the end there ^
Quoted 13 lines
intel/intel_bufmgr.c +3
-0+ return 64 * 1024 * 1024; +} +#endif int drm_intel_get_aperture_sizes (int fd,size_t *mappable,size_t *total)Signature · 6 lines
2.16.0 _______________________________________________ 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
Quoted 56 lines · Eric Engestrom
Quoted 55 lines · Emil Velikov
From: Tomasz Figa <[email protected]>
This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate
ioperm()andiopl()syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code indrm_grallocand Mesa.Cc John Stultz <[email protected]>Cc Rob Herring <[email protected]>Cc John Stultz <[email protected]>Cc Tomasz Figa <[email protected]>Signed-off-by Tomasz Figa <[email protected]>[Emil Velikov: rebase against master]Signed-off-by Emil Velikov <[email protected]>---
Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind.--- intel/Android.mk | 3 +-- intel/intel_bufmgr.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)intel/Android.mk +1
-2@@ -33,8 +33,7 @@ LOCAL_MODULE := libdrm_intel LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES) LOCAL_SHARED_LIBRARIES := \ - libdrm \ - libpciaccess + libdrm include $(LIBDRM_COMMON_MK) include $(BUILD_SHARED_LIBRARY)intel/intel_bufmgr.c +2
-0@@ -36,7 +36,9 @@#include <errno.h> #include <drm.h> #include <i915_drm.h> +#ifndef __ANDROID__#include <pciaccess.h> +#endif #include "libdrm_macros.h" #include "intel_bufmgr.h" #include "intel_bufmgr_priv.h" @@ -326,6 +328,7 @@ drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)return -1 ; }
Quoted 17 lines
Quoted 5 lines
intel/intel_bufmgr.c +1
-0+#ifndef __ANDROID__static size_t drm_intel_probe_agp_aperture_size (int fd) {intel/intel_bufmgr.c err: · line 362
Quoted 9 lines
intel/intel_bufmgr.c +6
-0@@ -351,6 +354,15 @@ err:pci_system_cleanup (); return size; } +#else +static size_t +drm_intel_probe_agp_aperture_size (int fd) +{ +/* Nothing seems to rely on this value on Android anyway... */ +fprintf (stderr,"%s: Mappable aperture size hardcoded to 64MiB\n" );Guessing there's a
__func__missing at the end there ^
Indeed - fixed locally. Can resent if the Android related people are keen on the overall idea.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Emil Velikov
From: Tomasz Figa <[email protected]>
This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate
ioperm()andiopl()syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code indrm_grallocand Mesa.Cc John Stultz <[email protected]>Cc Rob Herring <[email protected]>Cc John Stultz <[email protected]>Cc Tomasz Figa <[email protected]>Signed-off-by Tomasz Figa <[email protected]>[Emil Velikov: rebase against master]Signed-off-by Emil Velikov <[email protected]>
Quoted 4 lines
---
Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind.
---
Sorry, being abroad for a conference last week slowed me down and I didn't get to validate this.
Many thanks for sending this out, I do agree its cleaner then my filtering fix.
I've got this patch (along with the __func__ fix EricE noticed) built and tested for the HiKey boards and it works ok for me.
Feel free to add my:
Emil: Do you mind respinning with the fix so Rob or someone can apply?
thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 26 lines · John Stultz
Quoted 15 lines · Emil Velikov
From: Tomasz Figa <[email protected]>
This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate
ioperm()andiopl()syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code indrm_grallocand Mesa.Cc John Stultz <[email protected]>Cc Rob Herring <[email protected]>Cc John Stultz <[email protected]>Cc Tomasz Figa <[email protected]>Signed-off-by Tomasz Figa <[email protected]>[Emil Velikov: rebase against master]Signed-off-by Emil Velikov <[email protected]>Quoted 4 lines
---
Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind.
---Sorry, being abroad for a conference last week slowed me down and I didn't get to validate this.
Many thanks for sending this out, I do agree its cleaner then my filtering fix.
Quoted 8 lines
I've got this patch (along with the
__func__fix EricE noticed) built and tested for the HiKey boards and it works ok for me.Feel free to add my:
Acked-by John Stultz <[email protected]>Emil: Do you mind respinning with the fix so Rob or someone can apply?
Added the __func__ piece and pushed the series.
Thanks guys!
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Emil Velikov
From: Tomasz Figa <[email protected]>
This patch makes the code not rely anymore on libpciaccess when compiled for Android to eliminate
ioperm()andiopl()syscalls required by that library. As a side effect, the mappable aperture size is hardcoded to 64 MiB on Android, however nothing seems to rely on this value anyway, as checked be grepping relevant code indrm_grallocand Mesa.Cc John Stultz <[email protected]>Cc Rob Herring <[email protected]>Cc John Stultz <[email protected]>Cc Tomasz Figa <[email protected]>Signed-off-by Tomasz Figa <[email protected]>[Emil Velikov: rebase against master]Signed-off-by Emil Velikov <[email protected]>
Quoted 3 lines
---
Tomasz, I've taken the liberty of pulling the patch from the Android tree. Hope you don't mind.
Thanks Emil for digging it up. I have no objections.
For reference, we used this as a quick hack before moving build of graphics components to Chrome OS side. After that, for short time, we had libpciaccess being built with autotools (and some small patch disabling port IO related stuff). Eventually we got rid of it completely, as Mesa stopped using libdrm_intel for i965 (and we don't use i915).
Best regards,
Tomasz
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel