From c8998259fd683e7cc7c6dee88067baa9af477a03 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 1 Mar 2013 17:08:40 +0100 Subject: Initial import Signed-off-by: Laurent Pinchart --- ...rn-a-negative-error-code-in-kms_bo_create.patch | 32 ++++++ .../drm/0002-kms-Make-libkms.h-usable-in-C.patch | 40 +++++++ ...ow-compiling-libkms-without-Intel-support.patch | 51 +++++++++ ...bdrm-Add-support-for-Android-build-system.patch | 119 +++++++++++++++++++++ 4 files changed, 242 insertions(+) create mode 100644 external/drm/0001-kms-Return-a-negative-error-code-in-kms_bo_create.patch create mode 100644 external/drm/0002-kms-Make-libkms.h-usable-in-C.patch create mode 100644 external/drm/0003-kms-Allow-compiling-libkms-without-Intel-support.patch create mode 100644 external/drm/0004-libdrm-Add-support-for-Android-build-system.patch (limited to 'external') diff --git a/external/drm/0001-kms-Return-a-negative-error-code-in-kms_bo_create.patch b/external/drm/0001-kms-Return-a-negative-error-code-in-kms_bo_create.patch new file mode 100644 index 0000000..f781bfd --- /dev/null +++ b/external/drm/0001-kms-Return-a-negative-error-code-in-kms_bo_create.patch @@ -0,0 +1,32 @@ +From 9890239c820e31fde9d10fc66d2899ed7fbc60ef Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Thu, 1 Nov 2012 10:32:05 +0100 +Subject: [PATCH 1/4] kms: Return a negative error code in kms_bo_create() + +The function returns returns 0 on success or a negative value in case of an +error, except when given invalid attributes in which case it returns the +positive EINVAL value. Replace that with -EINVAL to allow the caller to detect +errors with a < 0 check. + +Signed-off-by: Laurent Pinchart +Reviewed-by: Jakob Bornecrantz +--- + libkms/api.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libkms/api.c b/libkms/api.c +index 4a05f3d..5befaa0 100644 +--- a/libkms/api.c ++++ b/libkms/api.c +@@ -80,7 +80,7 @@ int kms_bo_create(struct kms_driver *kms, const unsigned *attr, struct kms_bo ** + type = value; + break; + default: +- return EINVAL; ++ return -EINVAL; + } + } + +-- +1.7.12.4 + diff --git a/external/drm/0002-kms-Make-libkms.h-usable-in-C.patch b/external/drm/0002-kms-Make-libkms.h-usable-in-C.patch new file mode 100644 index 0000000..6906e66 --- /dev/null +++ b/external/drm/0002-kms-Make-libkms.h-usable-in-C.patch @@ -0,0 +1,40 @@ +From a2d68da6fe8557cab6ab14d84d86722fdb733314 Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Thu, 1 Nov 2012 10:39:18 +0100 +Subject: [PATCH 2/4] kms: Make libkms.h usable in C++ + +Wrap the header in extern "C" { ... };. + +Signed-off-by: Laurent Pinchart +Reviewed-by: Jakob Bornecrantz +--- + libkms/libkms.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libkms/libkms.h b/libkms/libkms.h +index 4664442..c00b159 100644 +--- a/libkms/libkms.h ++++ b/libkms/libkms.h +@@ -29,6 +29,10 @@ + #ifndef _LIBKMS_H_ + #define _LIBKMS_H_ + ++#if defined(__cplusplus) || defined(c_plusplus) ++extern "C" { ++#endif ++ + /** + * \file + * +@@ -71,4 +75,8 @@ int kms_bo_map(struct kms_bo *bo, void **out); + int kms_bo_unmap(struct kms_bo *bo); + int kms_bo_destroy(struct kms_bo **bo); + ++#if defined(__cplusplus) || defined(c_plusplus) ++}; ++#endif ++ + #endif +-- +1.7.12.4 + diff --git a/external/drm/0003-kms-Allow-compiling-libkms-without-Intel-support.patch b/external/drm/0003-kms-Allow-compiling-libkms-without-Intel-support.patch new file mode 100644 index 0000000..666a4f6 --- /dev/null +++ b/external/drm/0003-kms-Allow-compiling-libkms-without-Intel-support.patch @@ -0,0 +1,51 @@ +From ee82d3e79496926270663f155ca1e4217a025358 Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Thu, 1 Nov 2012 10:41:29 +0100 +Subject: [PATCH 3/4] kms: Allow compiling libkms without Intel support + +Signed-off-by: Laurent Pinchart +--- + libkms/Makefile.am | 5 ++++- + libkms/linux.c | 6 +++++- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libkms/Makefile.am b/libkms/Makefile.am +index 215450a..518021f 100644 +--- a/libkms/Makefile.am ++++ b/libkms/Makefile.am +@@ -15,10 +15,13 @@ libkms_la_LIBADD = ../libdrm.la + libkms_la_SOURCES = \ + internal.h \ + linux.c \ +- intel.c \ + dumb.c \ + api.c + ++if HAVE_INTEL ++libkms_la_SOURCES += intel.c ++endif ++ + if HAVE_VMWGFX + libkms_la_SOURCES += vmwgfx.c + endif +diff --git a/libkms/linux.c b/libkms/linux.c +index eec0162..d160bc8 100644 +--- a/libkms/linux.c ++++ b/libkms/linux.c +@@ -101,8 +101,12 @@ linux_from_sysfs(int fd, struct kms_driver **out) + if (ret) + return ret; + +- if (!strcmp(name, "intel")) ++ if (0) ++ {} ++#ifdef HAVE_INTEL ++ else if (!strcmp(name, "intel")) + ret = intel_create(fd, out); ++#endif + #ifdef HAVE_VMWGFX + else if (!strcmp(name, "vmwgfx")) + ret = vmwgfx_create(fd, out); +-- +1.7.12.4 + diff --git a/external/drm/0004-libdrm-Add-support-for-Android-build-system.patch b/external/drm/0004-libdrm-Add-support-for-Android-build-system.patch new file mode 100644 index 0000000..08e8067 --- /dev/null +++ b/external/drm/0004-libdrm-Add-support-for-Android-build-system.patch @@ -0,0 +1,119 @@ +From 56a17581945bcf63038c6200e5637322b48eb4cc Mon Sep 17 00:00:00 2001 +From: Laurent Pinchart +Date: Sat, 15 Sep 2012 04:44:06 +0200 +Subject: [PATCH 4/4] libdrm: Add support for Android build system + +Signed-off-by: Laurent Pinchart +--- + Android.mk | 37 +++++++++++++++++++++++++++++++++++++ + libkms/Android.mk | 23 +++++++++++++++++++++++ + libkms/api.c | 3 ++- + libkms/linux.c | 3 ++- + 4 files changed, 64 insertions(+), 2 deletions(-) + create mode 100644 Android.mk + create mode 100644 libkms/Android.mk + +diff --git a/Android.mk b/Android.mk +new file mode 100644 +index 0000000..39ba22c +--- /dev/null ++++ b/Android.mk +@@ -0,0 +1,37 @@ ++LOCAL_PATH := $(call my-dir) ++ ++# ++# DRM ++# ++ ++include $(CLEAR_VARS) ++ ++LOCAL_SRC_FILES := \ ++ xf86drm.c \ ++ xf86drmHash.c \ ++ xf86drmRandom.c \ ++ xf86drmSL.c \ ++ xf86drmMode.c ++ ++LOCAL_MODULE := libdrm ++LOCAL_MODULE_TAGS := optional ++ ++LOCAL_C_INCLUDES += \ ++ $(LOCAL_PATH)/include/drm ++ ++LOCAL_COPY_HEADERS_TO := libdrm ++LOCAL_COPY_HEADERS := \ ++ xf86drm.h \ ++ xf86drmMode.h \ ++ include/drm/drm.h \ ++ include/drm/drm_fourcc.h \ ++ include/drm/drm_mode.h \ ++ include/drm/drm_sarea.h ++ ++include $(BUILD_SHARED_LIBRARY) ++ ++# ++# KMS ++# ++ ++include $(LOCAL_PATH)/libkms/Android.mk +diff --git a/libkms/Android.mk b/libkms/Android.mk +new file mode 100644 +index 0000000..f7e060a +--- /dev/null ++++ b/libkms/Android.mk +@@ -0,0 +1,22 @@ ++LOCAL_PATH := $(call my-dir) ++ ++include $(CLEAR_VARS) ++ ++LOCAL_SRC_FILES := \ ++ linux.c \ ++ dumb.c \ ++ api.c ++ ++LOCAL_MODULE := libkms ++LOCAL_MODULE_TAGS := optional ++LOCAL_SHARED_LIBRARIES := libdrm ++ ++LOCAL_C_INCLUDES += \ ++ $(LOCAL_PATH)/.. \ ++ $(LOCAL_PATH)/../include/drm ++ ++LOCAL_COPY_HEADERS_TO := libdrm ++LOCAL_COPY_HEADERS := \ ++ libkms.h ++ ++include $(BUILD_SHARED_LIBRARY) +diff --git a/libkms/api.c b/libkms/api.c +index 5befaa0..c3dac75 100644 +--- a/libkms/api.c ++++ b/libkms/api.c +@@ -25,8 +25,9 @@ + * + **************************************************************************/ + +- ++#ifdef HAVE_CONFIG_H + #include "config.h" ++#endif + #include + #include + #include +diff --git a/libkms/linux.c b/libkms/linux.c +index 4f86121..2e1b10d 100644 +--- a/libkms/linux.c ++++ b/libkms/linux.c +@@ -29,8 +29,9 @@ + * going from fd to pci id via fstat and udev. + */ + +- ++#ifdef HAVE_CONFIG_H + #include "config.h" ++#endif + #include + #include + #include +-- +1.7.8.6 + -- cgit v1.2.3