All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android
@ 2018-03-20 17:36 Emil Velikov
  2018-03-20 17:36 ` [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64" Emil Velikov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Emil Velikov @ 2018-03-20 17:36 UTC (permalink / raw)
  To: dri-devel; +Cc: Tomasz Figa, emil.l.velikov, Rob Herring

From: Tomasz Figa <tfiga@google.com>

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.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Tomasz Figa <tfiga@google.com>
Signed-off-by: Tomasz Figa <tfiga@google.com>
[Emil Velikov: rebase against master]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
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(-)

diff --git a/intel/Android.mk b/intel/Android.mk
index 3f9db785..dd881688 100644
--- a/intel/Android.mk
+++ b/intel/Android.mk
@@ -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)
diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index a2853400..42f5f62c 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -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)
-- 
2.16.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64"
  2018-03-20 17:36 [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Emil Velikov
@ 2018-03-20 17:36 ` Emil Velikov
  2018-03-26 23:28   ` John Stultz
  2018-03-20 18:47 ` [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Eric Engestrom
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Emil Velikov @ 2018-03-20 17:36 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov, Rob Herring

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.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>
Cc: John Stultz <john.stultz@linaro.org>
---
 intel/Android.mk | 2 --
 1 file changed, 2 deletions(-)

diff --git a/intel/Android.mk b/intel/Android.mk
index dd881688..f45312dd 100644
--- a/intel/Android.mk
+++ b/intel/Android.mk
@@ -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
-- 
2.16.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android
  2018-03-20 17:36 [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Emil Velikov
  2018-03-20 17:36 ` [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64" Emil Velikov
@ 2018-03-20 18:47 ` Eric Engestrom
  2018-03-21 15:16   ` Emil Velikov
  2018-03-26 23:27 ` John Stultz
  2018-03-27  2:50 ` Tomasz Figa
  3 siblings, 1 reply; 8+ messages in thread
From: Eric Engestrom @ 2018-03-20 18:47 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Tomasz Figa, dri-devel, Rob Herring

On Tuesday, 2018-03-20 17:36:51 +0000, Emil Velikov wrote:
> From: Tomasz Figa <tfiga@google.com>
> 
> 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.
> 
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Rob Herring <rob.herring@linaro.org>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Tomasz Figa <tfiga@google.com>
> Signed-off-by: Tomasz Figa <tfiga@google.com>
> [Emil Velikov: rebase against master]
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
> 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(-)
> 
> diff --git a/intel/Android.mk b/intel/Android.mk
> index 3f9db785..dd881688 100644
> --- a/intel/Android.mk
> +++ b/intel/Android.mk
> @@ -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)
> diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
> index a2853400..42f5f62c 100644
> --- a/intel/intel_bufmgr.c
> +++ b/intel/intel_bufmgr.c
> @@ -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");

Guessing there's a __func__ missing at the end there ^

> +	return 64 * 1024 * 1024;
> +}
> +#endif
>  
>  int
>  drm_intel_get_aperture_sizes(int fd, size_t *mappable, size_t *total)
> -- 
> 2.16.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android
  2018-03-20 18:47 ` [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Eric Engestrom
@ 2018-03-21 15:16   ` Emil Velikov
  0 siblings, 0 replies; 8+ messages in thread
From: Emil Velikov @ 2018-03-21 15:16 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: Tomasz Figa, ML dri-devel, Rob Herring

On 20 March 2018 at 18:47, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> On Tuesday, 2018-03-20 17:36:51 +0000, Emil Velikov wrote:
>> From: Tomasz Figa <tfiga@google.com>
>>
>> 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.
>>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Rob Herring <rob.herring@linaro.org>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Tomasz Figa <tfiga@google.com>
>> Signed-off-by: Tomasz Figa <tfiga@google.com>
>> [Emil Velikov: rebase against master]
>> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
>> ---
>> 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(-)
>>
>> diff --git a/intel/Android.mk b/intel/Android.mk
>> index 3f9db785..dd881688 100644
>> --- a/intel/Android.mk
>> +++ b/intel/Android.mk
>> @@ -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)
>> diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
>> index a2853400..42f5f62c 100644
>> --- a/intel/intel_bufmgr.c
>> +++ b/intel/intel_bufmgr.c
>> @@ -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");
>
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android
  2018-03-20 17:36 [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Emil Velikov
  2018-03-20 17:36 ` [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64" Emil Velikov
  2018-03-20 18:47 ` [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Eric Engestrom
@ 2018-03-26 23:27 ` John Stultz
  2018-03-28 16:16   ` Emil Velikov
  2018-03-27  2:50 ` Tomasz Figa
  3 siblings, 1 reply; 8+ messages in thread
From: John Stultz @ 2018-03-26 23:27 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Rob Herring, dri-devel, Tomasz Figa

On Tue, Mar 20, 2018 at 10:36 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> From: Tomasz Figa <tfiga@google.com>
>
> 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.
>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Rob Herring <rob.herring@linaro.org>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Tomasz Figa <tfiga@google.com>
> Signed-off-by: Tomasz Figa <tfiga@google.com>
> [Emil Velikov: rebase against master]
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
> 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:
Acked-by: John Stultz <john.stultz@linaro.org>

Emil: Do you mind respinning with the fix so Rob or someone can apply?

thanks
-john
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64"
  2018-03-20 17:36 ` [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64" Emil Velikov
@ 2018-03-26 23:28   ` John Stultz
  0 siblings, 0 replies; 8+ messages in thread
From: John Stultz @ 2018-03-26 23:28 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Rob Herring, dri-devel

On Tue, Mar 20, 2018 at 10:36 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> 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.
>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Rob Herring <rob.herring@linaro.org>
> Cc: John Stultz <john.stultz@linaro.org>

Acked-by: John Stultz <john.stultz@linaro.org>

Thanks so much for sending these out!
-john
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android
  2018-03-20 17:36 [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Emil Velikov
                   ` (2 preceding siblings ...)
  2018-03-26 23:27 ` John Stultz
@ 2018-03-27  2:50 ` Tomasz Figa
  3 siblings, 0 replies; 8+ messages in thread
From: Tomasz Figa @ 2018-03-27  2:50 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Rob Herring, dri-devel

On Wed, Mar 21, 2018 at 2:36 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> From: Tomasz Figa <tfiga@google.com>
>
> 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.
>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Rob Herring <rob.herring@linaro.org>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Tomasz Figa <tfiga@google.com>
> Signed-off-by: Tomasz Figa <tfiga@google.com>
> [Emil Velikov: rebase against master]
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android
  2018-03-26 23:27 ` John Stultz
@ 2018-03-28 16:16   ` Emil Velikov
  0 siblings, 0 replies; 8+ messages in thread
From: Emil Velikov @ 2018-03-28 16:16 UTC (permalink / raw)
  To: John Stultz; +Cc: Rob Herring, dri-devel, Tomasz Figa

On 27 March 2018 at 00:27, John Stultz <john.stultz@linaro.org> wrote:
> On Tue, Mar 20, 2018 at 10:36 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> From: Tomasz Figa <tfiga@google.com>
>>
>> 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.
>>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Rob Herring <rob.herring@linaro.org>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Tomasz Figa <tfiga@google.com>
>> Signed-off-by: Tomasz Figa <tfiga@google.com>
>> [Emil Velikov: rebase against master]
>> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
>> ---
>> 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:
> Acked-by: John Stultz <john.stultz@linaro.org>
>
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-28 16:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20 17:36 [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Emil Velikov
2018-03-20 17:36 ` [PATCH libdrm 2/2] Revert "libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86/x86_64" Emil Velikov
2018-03-26 23:28   ` John Stultz
2018-03-20 18:47 ` [PATCH libdrm 1/2] intel: Do not use libpciaccess on Android Eric Engestrom
2018-03-21 15:16   ` Emil Velikov
2018-03-26 23:27 ` John Stultz
2018-03-28 16:16   ` Emil Velikov
2018-03-27  2:50 ` Tomasz Figa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.