Skip to content

Commit

Permalink
drm/i915: copy installed kernel headers
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dvrogozh authored and Sherry-Lin committed Jan 29, 2019
1 parent cece877 commit e61f5c5
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 80 deletions.
2 changes: 1 addition & 1 deletion media_driver/linux/common/ddi/media_libva_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <pthread.h>

#include "xf86drm.h"
#include "drm_header.h"
#include "drm.h"
#include "i915_drm.h"
#include "mos_bufmgr.h"
#include "mos_context.h"
Expand Down
7 changes: 6 additions & 1 deletion media_driver/linux/common/os/i915/include/uapi/README
Original file line number Diff line number Diff line change
Expand Up @@ -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 :

Expand Down
42 changes: 17 additions & 25 deletions media_driver/linux/common/os/i915/include/uapi/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@
#ifndef _DRM_H_
#define _DRM_H_

#if defined(__KERNEL__)

#include <linux/types.h>
#include <asm/ioctl.h>
typedef unsigned int drm_handle_t;

#elif defined(__linux__)
#if defined(__linux__)

#include <linux/types.h>
#include <asm/ioctl.h>
Expand Down Expand Up @@ -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 */
};

/**
Expand All @@ -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 {
Expand Down Expand Up @@ -355,15 +349,15 @@ struct drm_buf_desc {
*/
struct drm_buf_info {
int count; /**< Entries in list */
struct drm_buf_desc __user *list;
struct drm_buf_desc *list;
};

/**
* DRM_IOCTL_FREE_BUFS ioctl argument type.
*/
struct drm_buf_free {
int count;
int __user *list;
int *list;
};

/**
Expand All @@ -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 */
};

/**
Expand All @@ -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 */
};

/**
Expand All @@ -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 */
};

Expand All @@ -431,7 +425,7 @@ struct drm_ctx {
*/
struct drm_ctx_res {
int count;
struct drm_ctx __user *contexts;
struct drm_ctx *contexts;
};

/**
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
Expand Down
32 changes: 0 additions & 32 deletions media_driver/linux/common/os/i915/include/uapi/drm_header.h

This file was deleted.

2 changes: 0 additions & 2 deletions media_driver/linux/common/os/i915/include/uapi/drm_sarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
18 changes: 9 additions & 9 deletions media_driver/linux/common/os/i915/include/uapi/i915_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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:
Expand All @@ -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 {
Expand Down Expand Up @@ -1743,4 +1743,4 @@ struct drm_i915_query_topology_info {
}
#endif

#endif /* _UAPI_I915_DRM_H_ */
#endif /* _I915_DRM_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/common/os/i915/include/xf86drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <stdarg.h>
#include <sys/types.h>
#include <stdint.h>
#include "drm_header.h"
#include "drm.h"
#include "libdrm_macros.h"
#if defined(__cplusplus)
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/common/os/i915/include/xf86drmMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
extern "C" {
#endif

#include <drm_header.h>
#include <drm.h>

/*
* This is the interface for modesetting for drm.
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/common/os/i915/mos_bufmgr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <stdint.h>
#include <assert.h>
#include <errno.h>
#include <drm_header.h>
#include <drm.h>
#include <i915_drm.h>
#include <pciaccess.h>
#include "libdrm_macros.h"
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/common/os/mos_auxtable_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 0 additions & 3 deletions media_driver/linux/common/os/mos_os_specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
#ifdef ANDROID
#include <utils/Log.h>
#endif
#ifndef __user
#define __user
#endif
#include "i915_drm.h"
#include "mos_bufmgr.h"
#include "xf86drm.h"
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/ult/libdrm_mock/mos_bufmgr_api_mock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <stdint.h>
#include <assert.h>
#include <errno.h>
#include "drm_header.h"
#include "drm.h"
#include "i915_drm.h"
#include <pciaccess.h>
#include "libdrm_macros.h"
Expand Down
2 changes: 1 addition & 1 deletion media_driver/linux/ult/libdrm_mock/xf86drmMode_mock.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

#include "xf86drmMode.h"
#include "xf86drm.h"
#include "drm_header.h"
#include "drm.h"
#include <string.h>
#include <dirent.h>
#include <unistd.h>
Expand Down

0 comments on commit e61f5c5

Please sign in to comment.