From e61f5c5806ffa906628721343cfe79e6d3ff2c0d Mon Sep 17 00:00:00 2001 From: Dmitry Rogozhkin Date: Fri, 25 Jan 2019 14:36:05 -0800 Subject: [PATCH] drm/i915: copy installed kernel headers Fixes: #504 We copied drm/i915 headers from kernel sources rather than from install location. As it occurs kernel build system strips out headers during installation removing certain kernel-internal stuff. So, right way to do is copy headers from install location. Change-Id: Ib83fd20d19dda0bc4805095edadef0547aeb4c2a Signed-off-by: Dmitry Rogozhkin --- .../linux/common/ddi/media_libva_common.h | 2 +- .../linux/common/os/i915/include/uapi/README | 7 +++- .../linux/common/os/i915/include/uapi/drm.h | 42 ++++++++----------- .../common/os/i915/include/uapi/drm_header.h | 32 -------------- .../common/os/i915/include/uapi/drm_sarea.h | 2 - .../common/os/i915/include/uapi/i915_drm.h | 18 ++++---- .../os/i915/include/uapi/media_srcs.cmake | 1 - .../linux/common/os/i915/include/xf86drm.h | 2 +- .../common/os/i915/include/xf86drmMode.h | 2 +- .../linux/common/os/i915/mos_bufmgr_api.c | 2 +- .../linux/common/os/mos_auxtable_mgr.h | 2 +- .../linux/common/os/mos_os_specific.h | 3 -- .../ult/libdrm_mock/mos_bufmgr_api_mock.c | 2 +- .../linux/ult/libdrm_mock/xf86drmMode_mock.c | 2 +- 14 files changed, 39 insertions(+), 80 deletions(-) delete mode 100644 media_driver/linux/common/os/i915/include/uapi/drm_header.h diff --git a/media_driver/linux/common/ddi/media_libva_common.h b/media_driver/linux/common/ddi/media_libva_common.h index 4bcecd3123f..660f057c68e 100644 --- a/media_driver/linux/common/ddi/media_libva_common.h +++ b/media_driver/linux/common/ddi/media_libva_common.h @@ -31,7 +31,7 @@ #include #include "xf86drm.h" -#include "drm_header.h" +#include "drm.h" #include "i915_drm.h" #include "mos_bufmgr.h" #include "mos_context.h" diff --git a/media_driver/linux/common/os/i915/include/uapi/README b/media_driver/linux/common/os/i915/include/uapi/README index 445e0888035..b45a1dc9040 100644 --- a/media_driver/linux/common/os/i915/include/uapi/README +++ b/media_driver/linux/common/os/i915/include/uapi/README @@ -4,7 +4,12 @@ Whenever driver needs new definitions for new kernel APIs, these files should be updated. These files in master should only be updated once the changes have landed -in the drm-next repo, https://anongit.freedesktop.org/git/drm/drm.git. +in the drm-next tree (see https://cgit.freedesktop.org/drm/drm/). + +You can copy files installed after running this from the kernel +repository, at version the driver require: + +$ make headers_install INSTALL_HDR_PATH=/path/to/install The last update was done at the following kernel commit : diff --git a/media_driver/linux/common/os/i915/include/uapi/drm.h b/media_driver/linux/common/os/i915/include/uapi/drm.h index cebdb2541eb..02b4169555a 100644 --- a/media_driver/linux/common/os/i915/include/uapi/drm.h +++ b/media_driver/linux/common/os/i915/include/uapi/drm.h @@ -36,13 +36,7 @@ #ifndef _DRM_H_ #define _DRM_H_ -#if defined(__KERNEL__) - -#include -#include -typedef unsigned int drm_handle_t; - -#elif defined(__linux__) +#if defined(__linux__) #include #include @@ -141,11 +135,11 @@ struct drm_version { int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ __kernel_size_t name_len; /**< Length of name buffer */ - char __user *name; /**< Name of driver */ + char *name; /**< Name of driver */ __kernel_size_t date_len; /**< Length of date buffer */ - char __user *date; /**< User-space buffer to hold date */ + char *date; /**< User-space buffer to hold date */ __kernel_size_t desc_len; /**< Length of desc buffer */ - char __user *desc; /**< User-space buffer to hold desc */ + char *desc; /**< User-space buffer to hold desc */ }; /** @@ -155,12 +149,12 @@ struct drm_version { */ struct drm_unique { __kernel_size_t unique_len; /**< Length of unique */ - char __user *unique; /**< Unique name for driver instantiation */ + char *unique; /**< Unique name for driver instantiation */ }; struct drm_list { int count; /**< Length of user-space structures */ - struct drm_version __user *version; + struct drm_version *version; }; struct drm_block { @@ -355,7 +349,7 @@ struct drm_buf_desc { */ struct drm_buf_info { int count; /**< Entries in list */ - struct drm_buf_desc __user *list; + struct drm_buf_desc *list; }; /** @@ -363,7 +357,7 @@ struct drm_buf_info { */ struct drm_buf_free { int count; - int __user *list; + int *list; }; /** @@ -375,7 +369,7 @@ struct drm_buf_pub { int idx; /**< Index into the master buffer list */ int total; /**< Buffer size */ int used; /**< Amount of buffer in use (for DMA) */ - void __user *address; /**< Address of buffer */ + void *address; /**< Address of buffer */ }; /** @@ -384,11 +378,11 @@ struct drm_buf_pub { struct drm_buf_map { int count; /**< Length of the buffer list */ #ifdef __cplusplus - void __user *virt; + void *virt; #else - void __user *virtual; /**< Mmap'd area in user-virtual */ + void *virtual; /**< Mmap'd area in user-virtual */ #endif - struct drm_buf_pub __user *list; /**< Buffer information */ + struct drm_buf_pub *list; /**< Buffer information */ }; /** @@ -401,13 +395,13 @@ struct drm_buf_map { struct drm_dma { int context; /**< Context handle */ int send_count; /**< Number of buffers to send */ - int __user *send_indices; /**< List of handles to buffers */ - int __user *send_sizes; /**< Lengths of data to send */ + int *send_indices; /**< List of handles to buffers */ + int *send_sizes; /**< Lengths of data to send */ enum drm_dma_flags flags; /**< Flags */ int request_count; /**< Number of buffers requested */ int request_size; /**< Desired size for buffers */ - int __user *request_indices; /**< Buffer information */ - int __user *request_sizes; + int *request_indices; /**< Buffer information */ + int *request_sizes; int granted_count; /**< Number of buffers granted */ }; @@ -431,7 +425,7 @@ struct drm_ctx { */ struct drm_ctx_res { int count; - struct drm_ctx __user *contexts; + struct drm_ctx *contexts; }; /** @@ -962,7 +956,6 @@ struct drm_event_crtc_sequence { }; /* typedef area */ -#ifndef __KERNEL__ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; typedef struct drm_tex_region drm_tex_region_t; @@ -1004,7 +997,6 @@ typedef struct drm_agp_binding drm_agp_binding_t; typedef struct drm_agp_info drm_agp_info_t; typedef struct drm_scatter_gather drm_scatter_gather_t; typedef struct drm_set_version drm_set_version_t; -#endif #if defined(__cplusplus) } diff --git a/media_driver/linux/common/os/i915/include/uapi/drm_header.h b/media_driver/linux/common/os/i915/include/uapi/drm_header.h deleted file mode 100644 index 8f8a2eb0160..00000000000 --- a/media_driver/linux/common/os/i915/include/uapi/drm_header.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2011-2018, Intel Corporation -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -//! -//! \file drm_header.h -//! \brief wrapper for drm.h. -//! -#ifndef _DRM_HEADER_H_ -#define _DRM_HEADER_H_ -#ifndef __user -#define __user -#endif -#include "drm.h" -#endif// _DRM_HEADER_H_ diff --git a/media_driver/linux/common/os/i915/include/uapi/drm_sarea.h b/media_driver/linux/common/os/i915/include/uapi/drm_sarea.h index a951ced60eb..93025be8bdc 100644 --- a/media_driver/linux/common/os/i915/include/uapi/drm_sarea.h +++ b/media_driver/linux/common/os/i915/include/uapi/drm_sarea.h @@ -81,11 +81,9 @@ struct drm_sarea { drm_context_t dummy_context; }; -#ifndef __KERNEL__ typedef struct drm_sarea_drawable drm_sarea_drawable_t; typedef struct drm_sarea_frame drm_sarea_frame_t; typedef struct drm_sarea drm_sarea_t; -#endif #if defined(__cplusplus) } diff --git a/media_driver/linux/common/os/i915/include/uapi/i915_drm.h b/media_driver/linux/common/os/i915/include/uapi/i915_drm.h index a4446f45204..268b585f8a4 100644 --- a/media_driver/linux/common/os/i915/include/uapi/i915_drm.h +++ b/media_driver/linux/common/os/i915/include/uapi/i915_drm.h @@ -24,8 +24,8 @@ * */ -#ifndef _UAPI_I915_DRM_H_ -#define _UAPI_I915_DRM_H_ +#ifndef _I915_DRM_H_ +#define _I915_DRM_H_ #include "drm.h" @@ -387,25 +387,25 @@ typedef struct drm_i915_batchbuffer { int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ - struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ + struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ } drm_i915_batchbuffer_t; /* As above, but pass a pointer to userspace buffer which can be * validated by the kernel prior to sending to hardware. */ typedef struct _drm_i915_cmdbuffer { - char __user *buf; /* pointer to userspace command buffer */ + char *buf; /* pointer to userspace command buffer */ int sz; /* nr bytes in buf */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ - struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ + struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ } drm_i915_cmdbuffer_t; /* Userspace can request & wait on irq's: */ typedef struct drm_i915_irq_emit { - int __user *irq_seq; + int *irq_seq; } drm_i915_irq_emit_t; typedef struct drm_i915_irq_wait { @@ -557,7 +557,7 @@ typedef struct drm_i915_getparam { * WARNING: Using pointers instead of fixed-size u64 means we need to write * compat32 code. Don't repeat this mistake. */ - int __user *value; + int *value; } drm_i915_getparam_t; /* Ioctl to set kernel params: @@ -580,7 +580,7 @@ typedef struct drm_i915_mem_alloc { int region; int alignment; int size; - int __user *region_offset; /* offset from start of fb or agp */ + int *region_offset; /* offset from start of fb or agp */ } drm_i915_mem_alloc_t; typedef struct drm_i915_mem_free { @@ -1743,4 +1743,4 @@ struct drm_i915_query_topology_info { } #endif -#endif /* _UAPI_I915_DRM_H_ */ +#endif /* _I915_DRM_H_ */ diff --git a/media_driver/linux/common/os/i915/include/uapi/media_srcs.cmake b/media_driver/linux/common/os/i915/include/uapi/media_srcs.cmake index f5823c6908b..f6744057728 100644 --- a/media_driver/linux/common/os/i915/include/uapi/media_srcs.cmake +++ b/media_driver/linux/common/os/i915/include/uapi/media_srcs.cmake @@ -26,7 +26,6 @@ set(TMP_HEADERS_ ${CMAKE_CURRENT_LIST_DIR}/drm_mode.h ${CMAKE_CURRENT_LIST_DIR}/drm_sarea.h ${CMAKE_CURRENT_LIST_DIR}/i915_drm.h - ${CMAKE_CURRENT_LIST_DIR}/drm_header.h ) # no source in this folder diff --git a/media_driver/linux/common/os/i915/include/xf86drm.h b/media_driver/linux/common/os/i915/include/xf86drm.h index fcddd76259c..5efd6a2229e 100644 --- a/media_driver/linux/common/os/i915/include/xf86drm.h +++ b/media_driver/linux/common/os/i915/include/xf86drm.h @@ -37,7 +37,7 @@ #include #include #include -#include "drm_header.h" +#include "drm.h" #include "libdrm_macros.h" #if defined(__cplusplus) extern "C" { diff --git a/media_driver/linux/common/os/i915/include/xf86drmMode.h b/media_driver/linux/common/os/i915/include/xf86drmMode.h index 16e0efcc619..92333641387 100644 --- a/media_driver/linux/common/os/i915/include/xf86drmMode.h +++ b/media_driver/linux/common/os/i915/include/xf86drmMode.h @@ -40,7 +40,7 @@ extern "C" { #endif -#include +#include /* * This is the interface for modesetting for drm. diff --git a/media_driver/linux/common/os/i915/mos_bufmgr_api.c b/media_driver/linux/common/os/i915/mos_bufmgr_api.c index f0a3f450557..4bae4548e34 100644 --- a/media_driver/linux/common/os/i915/mos_bufmgr_api.c +++ b/media_driver/linux/common/os/i915/mos_bufmgr_api.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include "libdrm_macros.h" diff --git a/media_driver/linux/common/os/mos_auxtable_mgr.h b/media_driver/linux/common/os/mos_auxtable_mgr.h index a6288ec9cee..b6c45c016d8 100644 --- a/media_driver/linux/common/os/mos_auxtable_mgr.h +++ b/media_driver/linux/common/os/mos_auxtable_mgr.h @@ -28,7 +28,7 @@ #define MOS_AUXTABLE_MGR_H #include "xf86drm.h" -#include "drm_header.h" +#include "drm.h" #include "i915_drm.h" #include "mos_bufmgr.h" #include "mos_os.h" diff --git a/media_driver/linux/common/os/mos_os_specific.h b/media_driver/linux/common/os/mos_os_specific.h index b47a561911a..bb1f7342323 100644 --- a/media_driver/linux/common/os/mos_os_specific.h +++ b/media_driver/linux/common/os/mos_os_specific.h @@ -35,9 +35,6 @@ #ifdef ANDROID #include #endif -#ifndef __user -#define __user -#endif #include "i915_drm.h" #include "mos_bufmgr.h" #include "xf86drm.h" diff --git a/media_driver/linux/ult/libdrm_mock/mos_bufmgr_api_mock.c b/media_driver/linux/ult/libdrm_mock/mos_bufmgr_api_mock.c index ad5b97b99dd..5b067f43181 100644 --- a/media_driver/linux/ult/libdrm_mock/mos_bufmgr_api_mock.c +++ b/media_driver/linux/ult/libdrm_mock/mos_bufmgr_api_mock.c @@ -34,7 +34,7 @@ #include #include #include -#include "drm_header.h" +#include "drm.h" #include "i915_drm.h" #include #include "libdrm_macros.h" diff --git a/media_driver/linux/ult/libdrm_mock/xf86drmMode_mock.c b/media_driver/linux/ult/libdrm_mock/xf86drmMode_mock.c index bce1b660d2e..4e19f71e62f 100644 --- a/media_driver/linux/ult/libdrm_mock/xf86drmMode_mock.c +++ b/media_driver/linux/ult/libdrm_mock/xf86drmMode_mock.c @@ -43,7 +43,7 @@ #include "xf86drmMode.h" #include "xf86drm.h" -#include "drm_header.h" +#include "drm.h" #include #include #include