Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights: - Drop a few unneeded Makefiles. - Android support for libkms & modetest. Inspired by Benjamin Gaignard's work. - Private mmap/munmap wrappers to hide all the love that bionic has for us :)
The series is available in branch 'android-final-fixes' at https://github.com/evelikov/libdrm
Any comments, reviews, it builds or it works are appreciated.
-Emil
Rather than having two extra makefiles in order to ship ~10 headers just fold its 5 lines of code into the top one makefile.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- Android.mk | 8 +++----- Makefile.am | 10 +++++++++- Makefile.sources | 19 +++++++++++++++++++ configure.ac | 2 -- include/Makefile.am | 1 - include/drm/Makefile.am | 32 -------------------------------- include/drm/Makefile.sources | 18 ------------------ 7 files changed, 31 insertions(+), 59 deletions(-) delete mode 100644 include/Makefile.am delete mode 100644 include/drm/Makefile.am delete mode 100644 include/drm/Makefile.sources
diff --git a/Android.mk b/Android.mk index bb49b0b..97a7d75 100644 --- a/Android.mk +++ b/Android.mk @@ -26,10 +26,8 @@ include $(CLEAR_VARS)
LIBDRM_TOP := $(LOCAL_PATH)
-# Import variables LIBDRM_FILES, LIBDRM_H_FILES +# Import variables LIBDRM_{,H_,INCLUDE_H_,INCLUDE_VMWGFX_H_}FILES include $(LOCAL_PATH)/Makefile.sources -# Import variables LIBDRM_INCLUDE_H_FILES, LIBDRM_INCLUDE_VMWGFX_H_FILES -include $(LOCAL_PATH)/include/drm/Makefile.sources
LOCAL_MODULE := libdrm LOCAL_MODULE_TAGS := optional @@ -47,8 +45,8 @@ LOCAL_CFLAGS := \
LOCAL_COPY_HEADERS := \ $(LIBDRM_H_FILES) \ - $(addprefix include/drm/,$(LIBDRM_INCLUDE_H_FILES)) \ - $(addprefix include/drm/,$(LIBDRM_INCLUDE_VMWGFX_H_FILES)) + $(LIBDRM_INCLUDE_H_FILES) \ + $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
LOCAL_COPY_HEADERS_TO := libdrm include $(BUILD_SHARED_LIBRARY) diff --git a/Makefile.am b/Makefile.am index fab2a9a..083861f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,7 +53,7 @@ if HAVE_FREEDRENO FREEDRENO_SUBDIR = freedreno endif
-SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests include man +SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests man
libdrm_la_LTLIBRARIES = libdrm.la libdrm_ladir = $(libdir) @@ -71,6 +71,14 @@ libdrminclude_HEADERS = $(LIBDRM_H_FILES)
EXTRA_DIST = libdrm.pc.in include/drm/*
+klibdrmincludedir = ${includedir}/libdrm +klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) + +if HAVE_VMWGFX +klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES) +endif + + copy-headers : cp -r $(kernel_source)/usr/include/drm $(top_srcdir)/include
diff --git a/Makefile.sources b/Makefile.sources index d078ca9..d86fb2a 100644 --- a/Makefile.sources +++ b/Makefile.sources @@ -11,3 +11,22 @@ LIBDRM_FILES := \ LIBDRM_H_FILES := \ xf86drm.h \ xf86drmMode.h + +LIBDRM_INCLUDE_H_FILES := \ + include/drm/drm.h \ + include/drm/drm_fourcc.h \ + include/drm/drm_mode.h \ + include/drm/drm_sarea.h \ + include/drm/i915_drm.h \ + include/drm/mach64_drm.h \ + include/drm/mga_drm.h \ + include/drm/nouveau_drm.h \ + include/drm/qxl_drm.h \ + include/drm/r128_drm.h \ + include/drm/radeon_drm.h \ + include/drm/savage_drm.h \ + include/drm/sis_drm.h \ + include/drm/via_drm.h + +LIBDRM_INCLUDE_VMWGFX_H_FILES := \ + include/drm/vmwgfx_drm.h diff --git a/configure.ac b/configure.ac index bb0559a..16625a5 100644 --- a/configure.ac +++ b/configure.ac @@ -410,8 +410,6 @@ AC_CONFIG_FILES([ tests/radeon/Makefile tests/vbltest/Makefile tests/exynos/Makefile - include/Makefile - include/drm/Makefile man/Makefile libdrm.pc]) AC_OUTPUT diff --git a/include/Makefile.am b/include/Makefile.am deleted file mode 100644 index 55ea506..0000000 --- a/include/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = drm diff --git a/include/drm/Makefile.am b/include/drm/Makefile.am deleted file mode 100644 index 7a246ae..0000000 --- a/include/drm/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2005 Adam Jackson. -# -# 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 -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, 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 (including the next -# paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL -# ADAM JACKSON 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. - -# XXX airlied says, nothing besides *_drm.h and drm*.h should be necessary. -# however, r300 and via need their reg headers installed in order to build. -# better solutions are welcome. - -include Makefile.sources - -klibdrmincludedir = ${includedir}/libdrm -klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) - -if HAVE_VMWGFX -klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES) -endif diff --git a/include/drm/Makefile.sources b/include/drm/Makefile.sources deleted file mode 100644 index 8e1b585..0000000 --- a/include/drm/Makefile.sources +++ /dev/null @@ -1,18 +0,0 @@ -LIBDRM_INCLUDE_H_FILES := \ - drm.h \ - drm_mode.h \ - drm_fourcc.h \ - drm_sarea.h \ - i915_drm.h \ - mga_drm.h \ - nouveau_drm.h \ - r128_drm.h \ - radeon_drm.h \ - savage_drm.h \ - sis_drm.h \ - via_drm.h \ - mach64_drm.h \ - qxl_drm.h - -LIBDRM_INCLUDE_VMWGFX_H_FILES := \ - vmwgfx_drm.h
Both of these headers are not installed since they were imported. They are not even used internally. The latter does not exist in the kernel...
Note the * symbol in EXTRA_DIST causes 'make distcheck' fail. When was the last time we ran it ?
Cc: Ville Syrjälä ville.syrjala@linux.intel.com Cc: Damien Lespiau damien.lespiau@intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- Makefile.am | 2 +- include/drm/i810_drm.h | 281 ---------------------------------------- include/drm/i830_drm.h | 342 ------------------------------------------------- 3 files changed, 1 insertion(+), 624 deletions(-) delete mode 100644 include/drm/i810_drm.h delete mode 100644 include/drm/i830_drm.h
diff --git a/Makefile.am b/Makefile.am index 083861f..a9ec25b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,7 @@ libdrm_la_SOURCES = $(LIBDRM_FILES) libdrmincludedir = ${includedir} libdrminclude_HEADERS = $(LIBDRM_H_FILES)
-EXTRA_DIST = libdrm.pc.in include/drm/* +EXTRA_DIST = libdrm.pc.in
klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) diff --git a/include/drm/i810_drm.h b/include/drm/i810_drm.h deleted file mode 100644 index 7a10bb6..0000000 --- a/include/drm/i810_drm.h +++ /dev/null @@ -1,281 +0,0 @@ -#ifndef _I810_DRM_H_ -#define _I810_DRM_H_ - -/* WARNING: These defines must be the same as what the Xserver uses. - * if you change them, you must change the defines in the Xserver. - */ - -#ifndef _I810_DEFINES_ -#define _I810_DEFINES_ - -#define I810_DMA_BUF_ORDER 12 -#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER) -#define I810_DMA_BUF_NR 256 -#define I810_NR_SAREA_CLIPRECTS 8 - -/* Each region is a minimum of 64k, and there are at most 64 of them. - */ -#define I810_NR_TEX_REGIONS 64 -#define I810_LOG_MIN_TEX_REGION_SIZE 16 -#endif - -#define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */ -#define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */ -#define I810_UPLOAD_CTX 0x4 -#define I810_UPLOAD_BUFFERS 0x8 -#define I810_UPLOAD_TEX0 0x10 -#define I810_UPLOAD_TEX1 0x20 -#define I810_UPLOAD_CLIPRECTS 0x40 - -/* Indices into buf.Setup where various bits of state are mirrored per - * context and per buffer. These can be fired at the card as a unit, - * or in a piecewise fashion as required. - */ - -/* Destbuffer state - * - backbuffer linear offset and pitch -- invarient in the current dri - * - zbuffer linear offset and pitch -- also invarient - * - drawing origin in back and depth buffers. - * - * Keep the depth/back buffer state here to accommodate private buffers - * in the future. - */ -#define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */ -#define I810_DESTREG_DI1 1 -#define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */ -#define I810_DESTREG_DV1 3 -#define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */ -#define I810_DESTREG_DR1 5 -#define I810_DESTREG_DR2 6 -#define I810_DESTREG_DR3 7 -#define I810_DESTREG_DR4 8 -#define I810_DEST_SETUP_SIZE 10 - -/* Context state - */ -#define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */ -#define I810_CTXREG_CF1 1 -#define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */ -#define I810_CTXREG_ST1 3 -#define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */ -#define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */ -#define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */ -#define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */ -#define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */ -#define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */ -#define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */ -#define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */ -#define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */ -#define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */ -#define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */ -#define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */ -#define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */ -#define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */ -#define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */ -#define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */ -#define I810_CTX_SETUP_SIZE 20 - -/* Texture state (per tex unit) - */ -#define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */ -#define I810_TEXREG_MI1 1 -#define I810_TEXREG_MI2 2 -#define I810_TEXREG_MI3 3 -#define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */ -#define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */ -#define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */ -#define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */ -#define I810_TEX_SETUP_SIZE 8 - -/* Flags for clear ioctl - */ -#define I810_FRONT 0x1 -#define I810_BACK 0x2 -#define I810_DEPTH 0x4 - -typedef enum _drm_i810_init_func { - I810_INIT_DMA = 0x01, - I810_CLEANUP_DMA = 0x02, - I810_INIT_DMA_1_4 = 0x03 -} drm_i810_init_func_t; - -/* This is the init structure after v1.2 */ -typedef struct _drm_i810_init { - drm_i810_init_func_t func; - unsigned int mmio_offset; - unsigned int buffers_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int overlay_offset; - unsigned int overlay_physical; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; -} drm_i810_init_t; - -/* This is the init structure prior to v1.2 */ -typedef struct _drm_i810_pre12_init { - drm_i810_init_func_t func; - unsigned int mmio_offset; - unsigned int buffers_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; -} drm_i810_pre12_init_t; - -/* Warning: If you change the SAREA structure you must change the Xserver - * structure as well */ - -typedef struct _drm_i810_tex_region { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ -} drm_i810_tex_region_t; - -typedef struct _drm_i810_sarea { - unsigned int ContextState[I810_CTX_SETUP_SIZE]; - unsigned int BufferState[I810_DEST_SETUP_SIZE]; - unsigned int TexState[2][I810_TEX_SETUP_SIZE]; - unsigned int dirty; - - unsigned int nbox; - struct drm_clip_rect boxes[I810_NR_SAREA_CLIPRECTS]; - - /* Maintain an LRU of contiguous regions of texture space. If - * you think you own a region of texture memory, and it has an - * age different to the one you set, then you are mistaken and - * it has been stolen by another client. If global texAge - * hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained - * texture information of other clients - by maintaining them - * in the same lru which is used to age their own textures, - * clients have an approximate lru for the whole of global - * texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to - * kick out your own texture or someone else's - simply eject - * them all in LRU order. - */ - - drm_i810_tex_region_t texList[I810_NR_TEX_REGIONS + 1]; - /* Last elt is sentinal */ - int texAge; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - int ctxOwner; /* last context to upload state */ - - int vertex_prim; - - int pf_enabled; /* is pageflipping allowed? */ - int pf_active; - int pf_current_page; /* which buffer is being displayed? */ -} drm_i810_sarea_t; - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmMga.h) - */ - -/* i810 specific ioctls - * The device specific ioctl range is 0x40 to 0x79. - */ -#define DRM_I810_INIT 0x00 -#define DRM_I810_VERTEX 0x01 -#define DRM_I810_CLEAR 0x02 -#define DRM_I810_FLUSH 0x03 -#define DRM_I810_GETAGE 0x04 -#define DRM_I810_GETBUF 0x05 -#define DRM_I810_SWAP 0x06 -#define DRM_I810_COPY 0x07 -#define DRM_I810_DOCOPY 0x08 -#define DRM_I810_OV0INFO 0x09 -#define DRM_I810_FSTATUS 0x0a -#define DRM_I810_OV0FLIP 0x0b -#define DRM_I810_MC 0x0c -#define DRM_I810_RSTATUS 0x0d -#define DRM_I810_FLIP 0x0e - -#define DRM_IOCTL_I810_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I810_INIT, drm_i810_init_t) -#define DRM_IOCTL_I810_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I810_VERTEX, drm_i810_vertex_t) -#define DRM_IOCTL_I810_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I810_CLEAR, drm_i810_clear_t) -#define DRM_IOCTL_I810_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_I810_FLUSH) -#define DRM_IOCTL_I810_GETAGE DRM_IO( DRM_COMMAND_BASE + DRM_I810_GETAGE) -#define DRM_IOCTL_I810_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I810_GETBUF, drm_i810_dma_t) -#define DRM_IOCTL_I810_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_I810_SWAP) -#define DRM_IOCTL_I810_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I810_COPY, drm_i810_copy_t) -#define DRM_IOCTL_I810_DOCOPY DRM_IO( DRM_COMMAND_BASE + DRM_I810_DOCOPY) -#define DRM_IOCTL_I810_OV0INFO DRM_IOR( DRM_COMMAND_BASE + DRM_I810_OV0INFO, drm_i810_overlay_t) -#define DRM_IOCTL_I810_FSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FSTATUS) -#define DRM_IOCTL_I810_OV0FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_OV0FLIP) -#define DRM_IOCTL_I810_MC DRM_IOW( DRM_COMMAND_BASE + DRM_I810_MC, drm_i810_mc_t) -#define DRM_IOCTL_I810_RSTATUS DRM_IO ( DRM_COMMAND_BASE + DRM_I810_RSTATUS) -#define DRM_IOCTL_I810_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I810_FLIP) - -typedef struct _drm_i810_clear { - int clear_color; - int clear_depth; - int flags; -} drm_i810_clear_t; - -/* These may be placeholders if we have more cliprects than - * I810_NR_SAREA_CLIPRECTS. In that case, the client sets discard to - * false, indicating that the buffer will be dispatched again with a - * new set of cliprects. - */ -typedef struct _drm_i810_vertex { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - int discard; /* client is finished with the buffer? */ -} drm_i810_vertex_t; - -typedef struct _drm_i810_copy_t { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - void *address; /* Address to copy from */ -} drm_i810_copy_t; - -#define PR_TRIANGLES (0x0<<18) -#define PR_TRISTRIP_0 (0x1<<18) -#define PR_TRISTRIP_1 (0x2<<18) -#define PR_TRIFAN (0x3<<18) -#define PR_POLYGON (0x4<<18) -#define PR_LINES (0x5<<18) -#define PR_LINESTRIP (0x6<<18) -#define PR_RECTS (0x7<<18) -#define PR_MASK (0x7<<18) - -typedef struct drm_i810_dma { - void *virtual; - int request_idx; - int request_size; - int granted; -} drm_i810_dma_t; - -typedef struct _drm_i810_overlay_t { - unsigned int offset; /* Address of the Overlay Regs */ - unsigned int physical; -} drm_i810_overlay_t; - -typedef struct _drm_i810_mc { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - int num_blocks; /* number of GFXBlocks */ - int *length; /* List of lengths for GFXBlocks (FUTURE) */ - unsigned int last_render; /* Last Render Request */ -} drm_i810_mc_t; - -#endif /* _I810_DRM_H_ */ diff --git a/include/drm/i830_drm.h b/include/drm/i830_drm.h deleted file mode 100644 index e1b08e4..0000000 --- a/include/drm/i830_drm.h +++ /dev/null @@ -1,342 +0,0 @@ -#ifndef _I830_DRM_H_ -#define _I830_DRM_H_ - -/* WARNING: These defines must be the same as what the Xserver uses. - * if you change them, you must change the defines in the Xserver. - * - * KW: Actually, you can't ever change them because doing so would - * break backwards compatibility. - */ - -#ifndef _I830_DEFINES_ -#define _I830_DEFINES_ - -#define I830_DMA_BUF_ORDER 12 -#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) -#define I830_DMA_BUF_NR 256 -#define I830_NR_SAREA_CLIPRECTS 8 - -/* Each region is a minimum of 64k, and there are at most 64 of them. - */ -#define I830_NR_TEX_REGIONS 64 -#define I830_LOG_MIN_TEX_REGION_SIZE 16 - -/* KW: These aren't correct but someone set them to two and then - * released the module. Now we can't change them as doing so would - * break backwards compatibility. - */ -#define I830_TEXTURE_COUNT 2 -#define I830_TEXBLEND_COUNT I830_TEXTURE_COUNT - -#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ - -#define I830_UPLOAD_CTX 0x1 -#define I830_UPLOAD_BUFFERS 0x2 -#define I830_UPLOAD_CLIPRECTS 0x4 -#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ -#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ -#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ -#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ -#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ -#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ -#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ -#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ -#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) -#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) -#define I830_UPLOAD_TEXIMAGE_MASK 0xff00 -#define I830_UPLOAD_TEX0 0x10000 -#define I830_UPLOAD_TEX1 0x20000 -#define I830_UPLOAD_TEX2 0x40000 -#define I830_UPLOAD_TEX3 0x80000 -#define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) -#define I830_UPLOAD_TEX_MASK 0xf0000 -#define I830_UPLOAD_TEXBLEND0 0x100000 -#define I830_UPLOAD_TEXBLEND1 0x200000 -#define I830_UPLOAD_TEXBLEND2 0x400000 -#define I830_UPLOAD_TEXBLEND3 0x800000 -#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) -#define I830_UPLOAD_TEXBLEND_MASK 0xf00000 -#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) -#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 -#define I830_UPLOAD_STIPPLE 0x8000000 - -/* Indices into buf.Setup where various bits of state are mirrored per - * context and per buffer. These can be fired at the card as a unit, - * or in a piecewise fashion as required. - */ - -/* Destbuffer state - * - backbuffer linear offset and pitch -- invarient in the current dri - * - zbuffer linear offset and pitch -- also invarient - * - drawing origin in back and depth buffers. - * - * Keep the depth/back buffer state here to accommodate private buffers - * in the future. - */ - -#define I830_DESTREG_CBUFADDR 0 -#define I830_DESTREG_DBUFADDR 1 -#define I830_DESTREG_DV0 2 -#define I830_DESTREG_DV1 3 -#define I830_DESTREG_SENABLE 4 -#define I830_DESTREG_SR0 5 -#define I830_DESTREG_SR1 6 -#define I830_DESTREG_SR2 7 -#define I830_DESTREG_DR0 8 -#define I830_DESTREG_DR1 9 -#define I830_DESTREG_DR2 10 -#define I830_DESTREG_DR3 11 -#define I830_DESTREG_DR4 12 -#define I830_DEST_SETUP_SIZE 13 - -/* Context state - */ -#define I830_CTXREG_STATE1 0 -#define I830_CTXREG_STATE2 1 -#define I830_CTXREG_STATE3 2 -#define I830_CTXREG_STATE4 3 -#define I830_CTXREG_STATE5 4 -#define I830_CTXREG_IALPHAB 5 -#define I830_CTXREG_STENCILTST 6 -#define I830_CTXREG_ENABLES_1 7 -#define I830_CTXREG_ENABLES_2 8 -#define I830_CTXREG_AA 9 -#define I830_CTXREG_FOGCOLOR 10 -#define I830_CTXREG_BLENDCOLR0 11 -#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ -#define I830_CTXREG_VF 13 -#define I830_CTXREG_VF2 14 -#define I830_CTXREG_MCSB0 15 -#define I830_CTXREG_MCSB1 16 -#define I830_CTX_SETUP_SIZE 17 - -/* 1.3: Stipple state - */ -#define I830_STPREG_ST0 0 -#define I830_STPREG_ST1 1 -#define I830_STP_SETUP_SIZE 2 - -/* Texture state (per tex unit) - */ - -#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ -#define I830_TEXREG_MI1 1 -#define I830_TEXREG_MI2 2 -#define I830_TEXREG_MI3 3 -#define I830_TEXREG_MI4 4 -#define I830_TEXREG_MI5 5 -#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ -#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ -#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ -#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ -#define I830_TEX_SETUP_SIZE 10 - -#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */ -#define I830_TEXREG_TM0S0 1 -#define I830_TEXREG_TM0S1 2 -#define I830_TEXREG_TM0S2 3 -#define I830_TEXREG_TM0S3 4 -#define I830_TEXREG_TM0S4 5 -#define I830_TEXREG_NOP0 6 /* noop */ -#define I830_TEXREG_NOP1 7 /* noop */ -#define I830_TEXREG_NOP2 8 /* noop */ -#define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */ -#define __I830_TEX_SETUP_SIZE 10 - -#define I830_FRONT 0x1 -#define I830_BACK 0x2 -#define I830_DEPTH 0x4 - -#endif /* _I830_DEFINES_ */ - -typedef struct _drm_i830_init { - enum { - I830_INIT_DMA = 0x01, - I830_CLEANUP_DMA = 0x02 - } func; - unsigned int mmio_offset; - unsigned int buffers_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; - unsigned int back_pitch; - unsigned int depth_pitch; - unsigned int cpp; -} drm_i830_init_t; - -/* Warning: If you change the SAREA structure you must change the Xserver - * structure as well */ - -typedef struct _drm_i830_tex_region { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ -} drm_i830_tex_region_t; - -typedef struct _drm_i830_sarea { - unsigned int ContextState[I830_CTX_SETUP_SIZE]; - unsigned int BufferState[I830_DEST_SETUP_SIZE]; - unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; - unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; - unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; - unsigned int Palette[2][256]; - unsigned int dirty; - - unsigned int nbox; - struct drm_clip_rect boxes[I830_NR_SAREA_CLIPRECTS]; - - /* Maintain an LRU of contiguous regions of texture space. If - * you think you own a region of texture memory, and it has an - * age different to the one you set, then you are mistaken and - * it has been stolen by another client. If global texAge - * hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained - * texture information of other clients - by maintaining them - * in the same lru which is used to age their own textures, - * clients have an approximate lru for the whole of global - * texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to - * kick out your own texture or someone else's - simply eject - * them all in LRU order. - */ - - drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS + 1]; - /* Last elt is sentinal */ - int texAge; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - int ctxOwner; /* last context to upload state */ - - int vertex_prim; - - int pf_enabled; /* is pageflipping allowed? */ - int pf_active; - int pf_current_page; /* which buffer is being displayed? */ - - int perf_boxes; /* performance boxes to be displayed */ - - /* Here's the state for texunits 2,3: - */ - unsigned int TexState2[I830_TEX_SETUP_SIZE]; - unsigned int TexBlendState2[I830_TEXBLEND_SIZE]; - unsigned int TexBlendStateWordsUsed2; - - unsigned int TexState3[I830_TEX_SETUP_SIZE]; - unsigned int TexBlendState3[I830_TEXBLEND_SIZE]; - unsigned int TexBlendStateWordsUsed3; - - unsigned int StippleState[I830_STP_SETUP_SIZE]; -} drm_i830_sarea_t; - -/* Flags for perf_boxes - */ -#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ -#define I830_BOX_FLIP 0x2 /* populated by kernel */ -#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ -#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ -#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ - -/* I830 specific ioctls - * The device specific ioctl range is 0x40 to 0x79. - */ -#define DRM_I830_INIT 0x00 -#define DRM_I830_VERTEX 0x01 -#define DRM_I830_CLEAR 0x02 -#define DRM_I830_FLUSH 0x03 -#define DRM_I830_GETAGE 0x04 -#define DRM_I830_GETBUF 0x05 -#define DRM_I830_SWAP 0x06 -#define DRM_I830_COPY 0x07 -#define DRM_I830_DOCOPY 0x08 -#define DRM_I830_FLIP 0x09 -#define DRM_I830_IRQ_EMIT 0x0a -#define DRM_I830_IRQ_WAIT 0x0b -#define DRM_I830_GETPARAM 0x0c -#define DRM_I830_SETPARAM 0x0d - -#define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_INIT, drm_i830_init_t) -#define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_VERTEX, drm_i830_vertex_t) -#define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_CLEAR, drm_i830_clear_t) -#define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLUSH) -#define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_GETAGE) -#define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETBUF, drm_i830_dma_t) -#define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_SWAP) -#define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_COPY, drm_i830_copy_t) -#define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_DOCOPY) -#define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLIP) -#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_EMIT, drm_i830_irq_emit_t) -#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_WAIT, drm_i830_irq_wait_t) -#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETPARAM, drm_i830_getparam_t) -#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_SETPARAM, drm_i830_setparam_t) - -typedef struct _drm_i830_clear { - int clear_color; - int clear_depth; - int flags; - unsigned int clear_colormask; - unsigned int clear_depthmask; -} drm_i830_clear_t; - -/* These may be placeholders if we have more cliprects than - * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to - * false, indicating that the buffer will be dispatched again with a - * new set of cliprects. - */ -typedef struct _drm_i830_vertex { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - int discard; /* client is finished with the buffer? */ -} drm_i830_vertex_t; - -typedef struct _drm_i830_copy_t { - int idx; /* buffer index */ - int used; /* nr bytes in use */ - void *address; /* Address to copy from */ -} drm_i830_copy_t; - -typedef struct drm_i830_dma { - void *virtual; - int request_idx; - int request_size; - int granted; -} drm_i830_dma_t; - -/* 1.3: Userspace can request & wait on irq's: - */ -typedef struct drm_i830_irq_emit { - int *irq_seq; -} drm_i830_irq_emit_t; - -typedef struct drm_i830_irq_wait { - int irq_seq; -} drm_i830_irq_wait_t; - -/* 1.3: New ioctl to query kernel params: - */ -#define I830_PARAM_IRQ_ACTIVE 1 - -typedef struct drm_i830_getparam { - int param; - int *value; -} drm_i830_getparam_t; - -/* 1.3: New ioctl to set kernel params: - */ -#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 - -typedef struct drm_i830_setparam { - int param; - int value; -} drm_i830_setparam_t; - -#endif /* _I830_DRM_H_ */
Not too long ago the in-kernel drm public headers were moved. Since then we could no longer fetch/update the ones in libdrm using the command.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am index a9ec25b..884841f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -80,8 +80,8 @@ endif
copy-headers : - cp -r $(kernel_source)/usr/include/drm $(top_srcdir)/include + cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/
commit-headers : copy-headers - git add include + git add include/drm/*.h git commit -am "Copy headers from kernel $$(GIT_DIR=$(kernel_source)/.git git describe)"
Just have the check once, and let new drivers opt-in if they want to use them. Move the block further up the script, to tie nicely with the actual usage of $HW defines.
Move the final $HW users to be alongside their brethren.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- configure.ac | 167 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 82 insertions(+), 85 deletions(-)
diff --git a/configure.ac b/configure.ac index 16625a5..484084f 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,81 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [ AC_MSG_CHECKING([which warning flags were supported])]) WARN_CFLAGS="$libdrm_cv_warn_cflags"
+# Check for atomic intrinsics +AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [ + drm_cv_atomic_primitives="none" + + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); } + int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); } + ]],[[]])], [drm_cv_atomic_primitives="Intel"],[]) + + if test "x$drm_cv_atomic_primitives" = "xnone"; then + AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops") + fi + + # atomic functions defined in <atomic.h> & libc on Solaris + if test "x$drm_cv_atomic_primitives" = "xnone"; then + AC_CHECK_FUNC([atomic_cas_uint], drm_cv_atomic_primitives="Solaris") + fi +]) + +if test "x$drm_cv_atomic_primitives" = xIntel; then + AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1, + [Enable if your compiler supports the Intel __sync_* atomic primitives]) +fi +if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then + AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed]) +fi + +if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then + if test "x$drm_cv_atomic_primitives" = "xnone"; then + if test "x$INTEL" != "xauto"; then + if test "x$INTEL" != "xno"; then + AC_MSG_ERROR([libdrm_intel depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Intel GPUs by passing --disable-intel to ./configure]) + fi + else + AC_MSG_WARN([Disabling libdrm_intel. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) + INTEL=no + fi + if test "x$RADEON" != "xauto"; then + if test "x$RADEON" != "xno"; then + AC_MSG_ERROR([libdrm_radeon depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Radeon GPUs by passing --disable-radeon to ./configure]) + fi + else + AC_MSG_WARN([Disabling libdrm_radeon. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) + RADEON=no + fi + if test "x$NOUVEAU" != "xauto"; then + if test "x$NOUVEAU" != "xno"; then + AC_MSG_ERROR([libdrm_nouveau depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA GPUs by passing --disable-nouveau to ./configure]) + fi + else + AC_MSG_WARN([Disabling libdrm_nouveau. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) + NOUVEAU=no + fi + else + if test "x$INTEL" != "xno"; then + case $host_cpu in + i?86|x86_64) INTEL=yes ;; + *) INTEL=no ;; + esac + fi + if test "x$RADEON" != "xno"; then + RADEON=yes + fi + if test "x$NOUVEAU" != "xno"; then + NOUVEAU=yes + fi + fi +fi + +if test "x$INTEL" != "xno"; then + PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) +fi +AC_SUBST(PCIACCESS_CFLAGS) +AC_SUBST(PCIACCESS_LIBS) + if test "x$UDEV" = xyes; then AC_DEFINE(UDEV, 1, [Have UDEV support]) fi @@ -194,6 +269,8 @@ fi
AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])
+AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes]) + AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) if test "x$VMWGFX" = xyes; then AC_DEFINE(HAVE_VMWGFX, 1, [Have vmwgfx kernel headers]) @@ -219,6 +296,11 @@ if test "x$FREEDRENO" = xyes; then AC_DEFINE(HAVE_FREEDRENO, 1, [Have freedreno support]) fi
+AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes]) +if test "x$RADEON" = xyes; then + AC_DEFINE(HAVE_RADEON, 1, [Have radeon support]) +fi + AM_CONDITIONAL(HAVE_INSTALL_TESTS, [test "x$INSTALL_TESTS" = xyes]) if test "x$INSTALL_TESTS" = xyes; then AC_DEFINE(HAVE_INSTALL_TESTS, 1, [Install test programs]) @@ -270,96 +352,11 @@ else fi AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], [test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"])
-if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno" -o "x$OMAP" != "xno" -o "x$FREEDRENO" != "xno"; then - # Check for atomic intrinsics - AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, - [ - drm_cv_atomic_primitives="none" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); } - int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); } - ]],[[]])], - [drm_cv_atomic_primitives="Intel"],[]) - - if test "x$drm_cv_atomic_primitives" = "xnone"; then - AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops") - fi - - # atomic functions defined in <atomic.h> & libc on Solaris - if test "x$drm_cv_atomic_primitives" = "xnone"; then - AC_CHECK_FUNC([atomic_cas_uint], - drm_cv_atomic_primitives="Solaris") - fi - - ]) - if test "x$drm_cv_atomic_primitives" = xIntel; then - AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1, - [Enable if your compiler supports the Intel __sync_* atomic primitives]) - fi - if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then - AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed]) - fi - - if test "x$drm_cv_atomic_primitives" = "xnone"; then - if test "x$INTEL" != "xauto"; then - if test "x$INTEL" != "xno"; then - AC_MSG_ERROR([libdrm_intel depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Intel GPUs by passing --disable-intel to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_intel. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - INTEL=no - fi - if test "x$RADEON" != "xauto"; then - if test "x$RADEON" != "xno"; then - AC_MSG_ERROR([libdrm_radeon depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for Radeon support by passing --disable-radeon to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_radeon. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - RADEON=no - fi - if test "x$NOUVEAU" != "xauto"; then - if test "x$NOUVEAU" != "xno"; then - AC_MSG_ERROR([libdrm_nouveau depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA GPUs by passing --disable-nouveau to ./configure]) - fi - else - AC_MSG_WARN([Disabling libdrm_nouveau. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) - NOUVEAU=no - fi - else - if test "x$INTEL" != "xno"; then - case $host_cpu in - i?86|x86_64) INTEL=yes ;; - *) INTEL=no ;; - esac - fi - if test "x$RADEON" != "xno"; then - RADEON=yes - fi - if test "x$NOUVEAU" != "xno"; then - NOUVEAU=yes - fi - fi -fi - -if test "x$INTEL" != "xno"; then - PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) -fi -AC_SUBST(PCIACCESS_CFLAGS) -AC_SUBST(PCIACCESS_LIBS) - PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no]) if test "x$have_valgrind" = "xyes"; then AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings]) fi
-AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" != "xno"]) -AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" != "xno"]) -AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" != "xno"]) -if test "x$RADEON" = xyes; then - AC_DEFINE(HAVE_RADEON, 1, [Have radeon support]) -fi - AC_ARG_WITH([kernel-source], [AS_HELP_STRING([--with-kernel-source], [specify path to linux kernel source])],
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- configure.ac | 3 +++ libkms/Makefile.am | 5 ++++- libkms/linux.c | 16 +++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac index 484084f..f1d3451 100644 --- a/configure.ac +++ b/configure.ac @@ -270,6 +270,9 @@ fi AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])
AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes]) +if test "x$INTEL" = xyes; then + AC_DEFINE(HAVE_INTEL, 1, [Have intel support]) +fi
AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) if test "x$VMWGFX" = xyes; then diff --git a/libkms/Makefile.am b/libkms/Makefile.am index 449a73b..dae44e9 100644 --- a/libkms/Makefile.am +++ b/libkms/Makefile.am @@ -15,7 +15,6 @@ libkms_la_LIBADD = ../libdrm.la libkms_la_SOURCES = \ internal.h \ linux.c \ - intel.c \ dumb.c \ api.c
@@ -23,6 +22,10 @@ if HAVE_VMWGFX libkms_la_SOURCES += vmwgfx.c endif
+if HAVE_INTEL +libkms_la_SOURCES += intel.c +endif + if HAVE_NOUVEAU libkms_la_SOURCES += nouveau.c endif diff --git a/libkms/linux.c b/libkms/linux.c index 17e1d58..77a0bbe 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -103,25 +103,31 @@ linux_from_sysfs(int fd, struct kms_driver **out) if (ret) return ret;
+#ifdef HAVE_INTEL if (!strcmp(name, "intel")) ret = intel_create(fd, out); + else +#endif #ifdef HAVE_VMWGFX - else if (!strcmp(name, "vmwgfx")) + if (!strcmp(name, "vmwgfx")) ret = vmwgfx_create(fd, out); + else #endif #ifdef HAVE_NOUVEAU - else if (!strcmp(name, "nouveau")) + if (!strcmp(name, "nouveau")) ret = nouveau_create(fd, out); + else #endif #ifdef HAVE_RADEON - else if (!strcmp(name, "radeon")) + if (!strcmp(name, "radeon")) ret = radeon_create(fd, out); + else #endif #ifdef HAVE_EXYNOS - else if (!strcmp(name, "exynos")) + if (!strcmp(name, "exynos")) ret = exynos_create(fd, out); -#endif else +#endif ret = -ENOSYS;
free(name);
On Sun, Sep 7, 2014 at 11:30 PM, Emil Velikov emil.l.velikov@gmail.com wrote:
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com
configure.ac | 3 +++ libkms/Makefile.am | 5 ++++- libkms/linux.c | 16 +++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-)
Reviewed-by: Jakob Bornecrantz jakob@vmware.com
Cheers, Jakob.
diff --git a/configure.ac b/configure.ac index 484084f..f1d3451 100644 --- a/configure.ac +++ b/configure.ac @@ -270,6 +270,9 @@ fi AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])
AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes]) +if test "x$INTEL" = xyes; then
AC_DEFINE(HAVE_INTEL, 1, [Have intel support])
+fi
AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes]) if test "x$VMWGFX" = xyes; then diff --git a/libkms/Makefile.am b/libkms/Makefile.am index 449a73b..dae44e9 100644 --- a/libkms/Makefile.am +++ b/libkms/Makefile.am @@ -15,7 +15,6 @@ libkms_la_LIBADD = ../libdrm.la libkms_la_SOURCES = \ internal.h \ linux.c \
intel.c \ dumb.c \ api.c
@@ -23,6 +22,10 @@ if HAVE_VMWGFX libkms_la_SOURCES += vmwgfx.c endif
+if HAVE_INTEL +libkms_la_SOURCES += intel.c +endif
if HAVE_NOUVEAU libkms_la_SOURCES += nouveau.c endif diff --git a/libkms/linux.c b/libkms/linux.c index 17e1d58..77a0bbe 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -103,25 +103,31 @@ linux_from_sysfs(int fd, struct kms_driver **out) if (ret) return ret;
+#ifdef HAVE_INTEL if (!strcmp(name, "intel")) ret = intel_create(fd, out);
else
+#endif #ifdef HAVE_VMWGFX
else if (!strcmp(name, "vmwgfx"))
if (!strcmp(name, "vmwgfx")) ret = vmwgfx_create(fd, out);
else
#endif #ifdef HAVE_NOUVEAU
else if (!strcmp(name, "nouveau"))
if (!strcmp(name, "nouveau")) ret = nouveau_create(fd, out);
else
#endif #ifdef HAVE_RADEON
else if (!strcmp(name, "radeon"))
if (!strcmp(name, "radeon")) ret = radeon_create(fd, out);
else
#endif #ifdef HAVE_EXYNOS
else if (!strcmp(name, "exynos"))
if (!strcmp(name, "exynos")) ret = exynos_create(fd, out);
-#endif else +#endif ret = -ENOSYS;
free(name);
-- 2.0.2
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- libkms/Makefile.am | 20 +++++++++----------- libkms/Makefile.sources | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 libkms/Makefile.sources
diff --git a/libkms/Makefile.am b/libkms/Makefile.am index dae44e9..21c65ae 100644 --- a/libkms/Makefile.am +++ b/libkms/Makefile.am @@ -1,3 +1,5 @@ +include Makefile.sources + AM_CFLAGS = \ $(WARN_CFLAGS) \ -I$(top_srcdir)/include/drm \ @@ -12,35 +14,31 @@ libkms_la_LIBADD = ../libdrm.la #libkms_la_LIBADD += $(LIBUDEV_LIBS) #endif
-libkms_la_SOURCES = \ - internal.h \ - linux.c \ - dumb.c \ - api.c +libkms_la_SOURCES = $(LIBKMS_FILES)
if HAVE_VMWGFX -libkms_la_SOURCES += vmwgfx.c +libkms_la_SOURCES += $(LIBKMS_VMWGFX_FILES) endif
if HAVE_INTEL -libkms_la_SOURCES += intel.c +libkms_la_SOURCES += $(LIBKMS_INTEL_FILES) endif
if HAVE_NOUVEAU -libkms_la_SOURCES += nouveau.c +libkms_la_SOURCES += $(LIBKMS_NOUVEAU_FILES) endif
if HAVE_RADEON -libkms_la_SOURCES += radeon.c +libkms_la_SOURCES += $(LIBKMS_RADEON_FILES) endif
if HAVE_EXYNOS -libkms_la_SOURCES += exynos.c +libkms_la_SOURCES += $(LIBKMS_EXYNOS_FILES) AM_CFLAGS += -I$(top_srcdir)/exynos endif
libkmsincludedir = ${includedir}/libkms -libkmsinclude_HEADERS = libkms.h +libkmsinclude_HEADERS = $(LIBKMS_H_FILES)
pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libkms.pc diff --git a/libkms/Makefile.sources b/libkms/Makefile.sources new file mode 100644 index 0000000..3191f51 --- /dev/null +++ b/libkms/Makefile.sources @@ -0,0 +1,23 @@ +LIBKMS_FILES := \ + internal.h \ + linux.c \ + dumb.c \ + api.c + +LIBKMS_VMWGFX_FILES := \ + vmwgfx.c + +LIBKMS_INTEL_FILES := \ + intel.c + +LIBKMS_NOUVEAU_FILES := \ + nouveau.c + +LIBKMS_RADEON_FILES := \ + radeon.c + +LIBKMS_EXYNOS_FILES := \ + exynos.c + +LIBKMS_H_FILES := \ + libkms.h
Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- Android.mk | 3 ++- libkms/Android.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libkms/Android.mk
diff --git a/Android.mk b/Android.mk index 97a7d75..4d02b05 100644 --- a/Android.mk +++ b/Android.mk @@ -55,7 +55,8 @@ SUBDIRS := \ freedreno \ intel \ nouveau \ - radeon + radeon \ + libkms
mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles) diff --git a/libkms/Android.mk b/libkms/Android.mk new file mode 100644 index 0000000..d2df32a --- /dev/null +++ b/libkms/Android.mk @@ -0,0 +1,53 @@ +DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS))) + +intel_drivers := i915 i965 i915g ilo +radeon_drivers := r300g r600g radeonsi +nouveau_drivers := nouveau +vmwgfx_drivers := vmwgfx + +valid_drivers := \ + $(intel_drivers) \ + $(radeon_drivers) \ + $(nouveau_drivers) \ + $(vmwgfx_drivers) + +# warn about invalid drivers +invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS)) +ifneq ($(invalid_drivers),) +$(warning invalid GPU drivers: $(invalid_drivers)) +# tidy up +DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS)) +endif + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_SRC_FILES := $(LIBKMS_FILES) + +ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES) +endif + +ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES) +endif + +ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES) +endif + +ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES) +endif + +LOCAL_MODULE := libkms +LOCAL_SHARED_LIBRARIES := libdrm + +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm + +LOCAL_COPY_HEADERS_TO := libdrm +LOCAL_COPY_HEADERS := $(LIBKMS_H_FILES) + +include $(BUILD_SHARED_LIBRARY)
On Sun, Sep 7, 2014 at 11:30 PM, Emil Velikov emil.l.velikov@gmail.com wrote:
Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Signed-off-by: Emil Velikov emil.l.velikov@gmail.com
Android.mk | 3 ++- libkms/Android.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libkms/Android.mk
Not super familiar with Android build system but it looks good to me:
Reviewed-by: Jakob Bornecrantz jakob@vmware.com
Cheers, Jakob.
diff --git a/Android.mk b/Android.mk index 97a7d75..4d02b05 100644 --- a/Android.mk +++ b/Android.mk @@ -55,7 +55,8 @@ SUBDIRS := \ freedreno \ intel \ nouveau \
radeon
radeon \
libkms
mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles) diff --git a/libkms/Android.mk b/libkms/Android.mk new file mode 100644 index 0000000..d2df32a --- /dev/null +++ b/libkms/Android.mk @@ -0,0 +1,53 @@ +DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS)))
+intel_drivers := i915 i965 i915g ilo +radeon_drivers := r300g r600g radeonsi +nouveau_drivers := nouveau +vmwgfx_drivers := vmwgfx
+valid_drivers := \
$(intel_drivers) \
$(radeon_drivers) \
$(nouveau_drivers) \
$(vmwgfx_drivers)
+# warn about invalid drivers +invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS)) +ifneq ($(invalid_drivers),) +$(warning invalid GPU drivers: $(invalid_drivers)) +# tidy up +DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS)) +endif
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources
+LOCAL_SRC_FILES := $(LIBKMS_FILES)
+ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES) +endif
+ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES) +endif
+ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES) +endif
+ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),) +LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES) +endif
+LOCAL_MODULE := libkms +LOCAL_SHARED_LIBRARIES := libdrm
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
+LOCAL_COPY_HEADERS_TO := libdrm +LOCAL_COPY_HEADERS := $(LIBKMS_H_FILES)
+include $(BUILD_SHARED_LIBRARY)
2.0.2
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- tests/modetest/Makefile.am | 7 +++---- tests/modetest/Makefile.sources | 6 ++++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 tests/modetest/Makefile.sources
diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am index fd6ebb2..d551fe4 100644 --- a/tests/modetest/Makefile.am +++ b/tests/modetest/Makefile.am @@ -1,3 +1,5 @@ +include Makefile.sources + AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))
AM_CFLAGS += \ @@ -13,10 +15,7 @@ noinst_PROGRAMS = \ modetest endif
-modetest_SOURCES = \ - buffers.c buffers.h \ - cursor.c cursor.h \ - modetest.c +modetest_SOURCES = $(MODETEST_FILES)
modetest_LDADD = \ $(top_builddir)/libdrm.la \ diff --git a/tests/modetest/Makefile.sources b/tests/modetest/Makefile.sources new file mode 100644 index 0000000..399af0d --- /dev/null +++ b/tests/modetest/Makefile.sources @@ -0,0 +1,6 @@ +MODETEST_FILES := \ + buffers.c \ + buffers.h \ + cursor.c \ + cursor.h \ + modetest.c
Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- Android.mk | 3 ++- tests/modetest/Android.mk | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/modetest/Android.mk
diff --git a/Android.mk b/Android.mk index 4d02b05..63f031c 100644 --- a/Android.mk +++ b/Android.mk @@ -56,7 +56,8 @@ SUBDIRS := \ intel \ nouveau \ radeon \ - libkms + libkms \ + tests/modeset
mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles) diff --git a/tests/modetest/Android.mk b/tests/modetest/Android.mk new file mode 100644 index 0000000..0a32b5f --- /dev/null +++ b/tests/modetest/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_SRC_FILES := $(MODETEST_FILES) + +LOCAL_MODULE := modetest + +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm + +LOCAL_SHARED_LIBRARIES := libdrm libkms + +include $(BUILD_EXECUTABLE)
v2: include modetest rather than modeset. Spotted by Mauro Rossi and Paulo Sergio.
Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Signed-off-by: Emil Velikov emil.l.velikov@gmail.com Reviewed-by: Jakob Bornecrantz jakob@vmware.com (v1) --- Android.mk | 3 ++- tests/modetest/Android.mk | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/modetest/Android.mk
diff --git a/Android.mk b/Android.mk index 4d02b05..6f76113 100644 --- a/Android.mk +++ b/Android.mk @@ -56,7 +56,8 @@ SUBDIRS := \ intel \ nouveau \ radeon \ - libkms + libkms \ + tests/modetest
mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS)) include $(mkfiles) diff --git a/tests/modetest/Android.mk b/tests/modetest/Android.mk new file mode 100644 index 0000000..0a32b5f --- /dev/null +++ b/tests/modetest/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/Makefile.sources + +LOCAL_SRC_FILES := $(MODETEST_FILES) + +LOCAL_MODULE := modetest + +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm + +LOCAL_SHARED_LIBRARIES := libdrm libkms + +include $(BUILD_EXECUTABLE)
From: Benjamin Gaignard benjamin.gaignard@linaro.org
--- tests/modetest/modetest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 92efb82..6d06e3f 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1437,7 +1437,7 @@ int main(int argc, char **argv) int drop_master = 0; int test_vsync = 0; int test_cursor = 0; - const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", "tilcdc", "msm" }; + const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", "tilcdc", "msm", "sti" }; char *device = NULL; char *module = NULL; unsigned int i;
Autotools is already smart enough to pick the *.pc.in files but it needs some help with the Android.mk ones.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- Makefile.am | 2 +- freedreno/Makefile.am | 2 ++ intel/Makefile.am | 3 ++- libkms/Makefile.am | 2 +- nouveau/Makefile.am | 2 ++ radeon/Makefile.am | 2 +- tests/modetest/Makefile.am | 2 ++ 7 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 884841f..3952a88 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,7 @@ libdrm_la_SOURCES = $(LIBDRM_FILES) libdrmincludedir = ${includedir} libdrminclude_HEADERS = $(LIBDRM_H_FILES)
-EXTRA_DIST = libdrm.pc.in +EXTRA_DIST = Android.mk
klibdrmincludedir = ${includedir}/libdrm klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES) diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am index 0c7db81..4818431 100644 --- a/freedreno/Makefile.am +++ b/freedreno/Makefile.am @@ -21,3 +21,5 @@ libdrm_freedrenocommoninclude_HEADERS = $(LIBDRM_FREEDRENO_H_FILES)
pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_freedreno.pc + +EXTRA_DIST = Android.mk diff --git a/intel/Makefile.am b/intel/Makefile.am index 846695d..ca4ed84 100644 --- a/intel/Makefile.am +++ b/intel/Makefile.am @@ -68,7 +68,8 @@ EXTRA_DIST = \ $(BATCHES:.batch=.batch.sh) \ $(BATCHES:.batch=.batch-ref.txt) \ $(BATCHES:.batch=.batch-ref.txt) \ - tests/test-batch.sh + tests/test-batch.sh \ + Android.mk
test_decode_LDADD = libdrm_intel.la ../libdrm.la
diff --git a/libkms/Makefile.am b/libkms/Makefile.am index 21c65ae..4baf4fc 100644 --- a/libkms/Makefile.am +++ b/libkms/Makefile.am @@ -43,4 +43,4 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libkms.pc
-EXTRA_DIST = libkms.pc.in +EXTRA_DIST = Android.mk diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am index a7df1ab..7543e43 100644 --- a/nouveau/Makefile.am +++ b/nouveau/Makefile.am @@ -21,3 +21,5 @@ libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES)
pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_nouveau.pc + +EXTRA_DIST = Android.mk diff --git a/radeon/Makefile.am b/radeon/Makefile.am index aa66ca3..4575065 100644 --- a/radeon/Makefile.am +++ b/radeon/Makefile.am @@ -45,4 +45,4 @@ libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES) pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_radeon.pc
-EXTRA_DIST = libdrm_radeon.pc.in +EXTRA_DIST = Android.mk diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am index d551fe4..0a6af01 100644 --- a/tests/modetest/Makefile.am +++ b/tests/modetest/Makefile.am @@ -25,3 +25,5 @@ if HAVE_CAIRO AM_CFLAGS += $(CAIRO_CFLAGS) modetest_LDADD += $(CAIRO_LIBS) endif + +EXTRA_DIST = Android.mk
Unlike Linux, Android (bionic) has separate functions - mmap & mmap64. Add a local wrapper (inspired by gallium) that will be used throughout libdrm to combat this bionic feature.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- libdrm.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/libdrm.h b/libdrm.h index 23926e6..33acfa9 100644 --- a/libdrm.h +++ b/libdrm.h @@ -31,4 +31,49 @@ # define drm_public #endif
+ +/** + * Static (compile-time) assertion. + * Basically, use COND to dimension an array. If COND is false/zero the + * array size will be -1 and we'll get a compilation error. + */ +#define STATIC_ASSERT(COND) \ + do { \ + (void) sizeof(char [1 - 2*!(COND)]); \ + } while (0) + + +#include <sys/mman.h> + +#if defined(ANDROID) +#include <errno.h> /* for EINVAL */ + +extern void *__mmap2(void *, size_t, int, int, int, size_t); + +static inline void *drm_mmap(void *addr, size_t length, int prot, int flags, int fd, loff_t offset) +{ + /* offset must be aligned to 4096 (not necessarily the page size) */ + if (unlikely(offset & 4095)) { + errno = EINVAL; + return MAP_FAILED; + } + + return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12)); +} + +#else +/* assume large file support exists */ +# define drm_mmap(addr, length, prot, flags, fd, offset) mmap(addr, length, prot, flags, fd, offset) +#endif + +static inline int drm_munmap(void *addr, size_t length) +{ + /* Copied from configure code generated by AC_SYS_LARGEFILE */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + STATIC_ASSERT(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1); +#undef LARGE_OFF_T + + return munmap(addr, length); +} + #endif
Unlike Linux, Android (bionic) has separate functions - mmap & mmap64. Add a local wrapper (inspired by gallium) that will be used throughout libdrm to combat this bionic feature.
v2: - Drop the undefined unlikely macro. - Use macro for munmap under Android. - Wrap long lines.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com Reviewed-by: Jakob Bornecrantz jakob@vmware.com (v1) --- libdrm.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/libdrm.h b/libdrm.h index 23926e6..acfada5 100644 --- a/libdrm.h +++ b/libdrm.h @@ -31,4 +31,59 @@ # define drm_public #endif
+ +/** + * Static (compile-time) assertion. + * Basically, use COND to dimension an array. If COND is false/zero the + * array size will be -1 and we'll get a compilation error. + */ +#define STATIC_ASSERT(COND) \ + do { \ + (void) sizeof(char [1 - 2*!(COND)]); \ + } while (0) + + +#include <sys/mman.h> + +#if defined(ANDROID) +#include <errno.h> /* for EINVAL */ + +extern void *__mmap2(void *, size_t, int, int, int, size_t); + +static inline void *drm_mmap(void *addr, size_t length, int prot, int flags, + int fd, loff_t offset) +{ + /* offset must be aligned to 4096 (not necessarily the page size) */ + if (offset & 4095) { + errno = EINVAL; + return MAP_FAILED; + } + + return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12)); +} + +# define drm_munmap(addr, length) \ + munmap(addr, length) + + +#else + +/* assume large file support exists */ +# define drm_mmap(addr, length, prot, flags, fd, offset) \ + mmap(addr, length, prot, flags, fd, offset) + + +static inline int drm_munmap(void *addr, size_t length) +{ + /* Copied from configure code generated by AC_SYS_LARGEFILE */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + \ + (((off_t) 1 << 31) << 31)) + STATIC_ASSERT(LARGE_OFF_T % 2147483629 == 721 && + LARGE_OFF_T % 2147483647 == 1); +#undef LARGE_OFF_T + + return munmap(addr, length); +} +#endif + #endif
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- xf86drm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xf86drm.c b/xf86drm.c index 85beb8c..d900b4b 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -48,7 +48,6 @@ #include <sys/stat.h> #define stat_t struct stat #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/time.h> #include <stdarg.h>
@@ -58,6 +57,7 @@ #endif
#include "xf86drm.h" +#include "libdrm.h"
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #define DRM_MAJOR 145 @@ -1137,7 +1137,7 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)
size = (size + pagesize_mask) & ~pagesize_mask;
- *address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle); + *address = drm_mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle); if (*address == MAP_FAILED) return -errno; return 0; @@ -1157,7 +1157,7 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address) */ int drmUnmap(drmAddress address, drmSize size) { - return munmap(address, size); + return drm_munmap(address, size); }
drmBufInfoPtr drmGetBufInfo(int fd) @@ -1264,7 +1264,7 @@ int drmUnmapBufs(drmBufMapPtr bufs) int i;
for (i = 0; i < bufs->count; i++) { - munmap(bufs->list[i].address, bufs->list[i].total); + drm_munmap(bufs->list[i].address, bufs->list[i].total); }
drmFree(bufs->list);
... for all by exynos.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- libkms/dumb.c | 8 +++----- libkms/intel.c | 6 +++--- libkms/nouveau.c | 6 +++--- libkms/radeon.c | 8 ++++---- libkms/vmwgfx.c | 6 +++--- 5 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/libkms/dumb.c b/libkms/dumb.c index 5702543..f9c16e1 100644 --- a/libkms/dumb.c +++ b/libkms/dumb.c @@ -36,11 +36,9 @@ #include <string.h> #include "internal.h"
-#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" - -#include "i915_drm.h" +#include "libdrm.h"
struct dumb_bo { @@ -149,7 +147,7 @@ dumb_bo_map(struct kms_bo *_bo, void **out) if (ret) return ret;
- map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); + map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); if (map == MAP_FAILED) return -errno;
@@ -177,7 +175,7 @@ dumb_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) { /* XXX Sanity check map_count */ - munmap(bo->base.ptr, bo->base.size); + drm_munmap(bo->base.ptr, bo->base.size); bo->base.ptr = NULL; }
diff --git a/libkms/intel.c b/libkms/intel.c index b006ea4..51a7fd2 100644 --- a/libkms/intel.c +++ b/libkms/intel.c @@ -36,9 +36,9 @@ #include <string.h> #include "internal.h"
-#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" +#include "libdrm.h"
#include "i915_drm.h"
@@ -173,7 +173,7 @@ intel_bo_map(struct kms_bo *_bo, void **out) if (ret) return ret;
- map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); + map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); if (map == MAP_FAILED) return -errno;
@@ -201,7 +201,7 @@ intel_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) { /* XXX Sanity check map_count */ - munmap(bo->base.ptr, bo->base.size); + drm_munmap(bo->base.ptr, bo->base.size); bo->base.ptr = NULL; }
diff --git a/libkms/nouveau.c b/libkms/nouveau.c index 15c012e..228903f 100644 --- a/libkms/nouveau.c +++ b/libkms/nouveau.c @@ -36,9 +36,9 @@ #include <string.h> #include "internal.h"
-#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" +#include "libdrm.h"
#include "nouveau_drm.h"
@@ -155,7 +155,7 @@ nouveau_bo_map(struct kms_bo *_bo, void **out) return 0; }
- map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle); + map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle); if (map == MAP_FAILED) return -errno;
@@ -183,7 +183,7 @@ nouveau_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) { /* XXX Sanity check map_count */ - munmap(bo->base.ptr, bo->base.size); + drm_munmap(bo->base.ptr, bo->base.size); bo->base.ptr = NULL; }
diff --git a/libkms/radeon.c b/libkms/radeon.c index 938321b..9383a0a 100644 --- a/libkms/radeon.c +++ b/libkms/radeon.c @@ -36,9 +36,9 @@ #include <string.h> #include "internal.h"
-#include <sys/mman.h> #include <sys/ioctl.h> #include "xf86drm.h" +#include "libdrm.h"
#include "radeon_drm.h"
@@ -172,7 +172,7 @@ radeon_bo_map(struct kms_bo *_bo, void **out) if (ret) return -errno;
- map = mmap(0, arg.size, PROT_READ | PROT_WRITE, MAP_SHARED, + map = drm_mmap(0, arg.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.addr_ptr); if (map == MAP_FAILED) return -errno; @@ -189,7 +189,7 @@ radeon_bo_unmap(struct kms_bo *_bo) { struct radeon_bo *bo = (struct radeon_bo *)_bo; if (--bo->map_count == 0) { - munmap(bo->base.ptr, bo->base.size); + drm_munmap(bo->base.ptr, bo->base.size); bo->base.ptr = NULL; } return 0; @@ -204,7 +204,7 @@ radeon_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) { /* XXX Sanity check map_count */ - munmap(bo->base.ptr, bo->base.size); + drm_munmap(bo->base.ptr, bo->base.size); bo->base.ptr = NULL; }
diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c index 08163a1..bc04133 100644 --- a/libkms/vmwgfx.c +++ b/libkms/vmwgfx.c @@ -35,8 +35,8 @@ #include <string.h> #include "internal.h"
-#include <sys/mman.h> #include "xf86drm.h" +#include "libdrm.h" #include "vmwgfx_drm.h"
struct vmwgfx_bo @@ -146,7 +146,7 @@ vmwgfx_bo_map(struct kms_bo *_bo, void **out) return 0; }
- map = mmap(NULL, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle); + map = drm_mmap(NULL, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, bo->map_handle); if (map == MAP_FAILED) return -errno;
@@ -173,7 +173,7 @@ vmwgfx_bo_destroy(struct kms_bo *_bo)
if (bo->base.ptr) { /* XXX Sanity check map_count */ - munmap(bo->base.ptr, bo->base.size); + drm_munmap(bo->base.ptr, bo->base.size); bo->base.ptr = NULL; }
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- nouveau/nouveau.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c index 43f0d3c..da49e17 100644 --- a/nouveau/nouveau.c +++ b/nouveau/nouveau.c @@ -33,11 +33,11 @@ #include <stdbool.h> #include <assert.h> #include <errno.h> -#include <sys/mman.h> #include <fcntl.h>
#include <xf86drm.h> #include <xf86atomic.h> +#include "libdrm.h" #include "libdrm_lists.h" #include "nouveau_drm.h"
@@ -381,7 +381,7 @@ nouveau_bo_del(struct nouveau_bo *bo) drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req); } if (bo->map) - munmap(bo->map, bo->size); + drm_munmap(bo->map, bo->size); free(nvbo); }
@@ -607,7 +607,7 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t access, { struct nouveau_bo_priv *nvbo = nouveau_bo(bo); if (bo->map == NULL) { - bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, + bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->device->fd, nvbo->map_handle); if (bo->map == MAP_FAILED) { bo->map = NULL;
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- radeon/radeon_bo_gem.c | 7 +++---- radeon/radeon_cs_gem.c | 1 - radeon/radeon_surface.c | 1 - 3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c index 251ec1b..e78303a 100644 --- a/radeon/radeon_bo_gem.c +++ b/radeon/radeon_bo_gem.c @@ -36,7 +36,6 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> -#include <sys/mman.h> #include <errno.h> #include "libdrm.h" #include "xf86drm.h" @@ -135,7 +134,7 @@ static struct radeon_bo *bo_unref(struct radeon_bo_int *boi) return (struct radeon_bo *)boi; } if (bo_gem->priv_ptr) { - munmap(bo_gem->priv_ptr, boi->size); + drm_munmap(bo_gem->priv_ptr, boi->size); }
/* Zero out args to make valgrind happy */ @@ -179,7 +178,7 @@ static int bo_map(struct radeon_bo_int *boi, int write) boi, boi->handle, r); return r; } - ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, boi->bom->fd, args.addr_ptr); + ptr = drm_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, boi->bom->fd, args.addr_ptr); if (ptr == MAP_FAILED) return -errno; bo_gem->priv_ptr = ptr; @@ -198,7 +197,7 @@ static int bo_unmap(struct radeon_bo_int *boi) if (--bo_gem->map_count > 0) { return 0; } - //munmap(bo->ptr, bo->size); + //drm_munmap(bo->ptr, bo->size); boi->ptr = NULL; return 0; } diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c index 2020e1a..705ee05 100644 --- a/radeon/radeon_cs_gem.c +++ b/radeon/radeon_cs_gem.c @@ -37,7 +37,6 @@ #include <stdlib.h> #include <string.h> #include <pthread.h> -#include <sys/mman.h> #include <sys/ioctl.h> #include "radeon_cs.h" #include "radeon_cs_int.h" diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c index 40a544a..0723425 100644 --- a/radeon/radeon_surface.c +++ b/radeon/radeon_surface.c @@ -35,7 +35,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/mman.h> #include <sys/ioctl.h> #include "drm.h" #include "libdrm.h"
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- freedreno/freedreno_bo.c | 4 ++-- freedreno/freedreno_priv.h | 1 - freedreno/kgsl/kgsl_bo.c | 2 +- freedreno/kgsl/kgsl_ringbuffer.c | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 3a2e464..89d3330 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -288,7 +288,7 @@ out: static void bo_del(struct fd_bo *bo) { if (bo->map) - munmap(bo->map, bo->size); + drm_munmap(bo->map, bo->size);
/* TODO probably bo's in bucket list get removed from * handle table?? @@ -351,7 +351,7 @@ drm_public void * fd_bo_map(struct fd_bo *bo) return NULL; }
- bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, + bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->dev->fd, offset); if (bo->map == MAP_FAILED) { ERROR_MSG("mmap failed: %s", strerror(errno)); diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 416a3b3..48bff13 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -40,7 +40,6 @@ #include <errno.h> #include <fcntl.h> #include <sys/ioctl.h> -#include <sys/mman.h> #include <pthread.h> #include <stdio.h> #include <assert.h> diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c index c868097..4e492dd 100644 --- a/freedreno/kgsl/kgsl_bo.c +++ b/freedreno/kgsl/kgsl_bo.c @@ -186,7 +186,7 @@ fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size) * thinks the buffer hasn't be allocate and fails */ if (bo) { - void *fbmem = mmap(NULL, size, PROT_READ | PROT_WRITE, + void *fbmem = drm_mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0); struct kgsl_map_user_mem req = { .memtype = KGSL_USER_MEM_TYPE_ADDR, diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c index dc3c9c2..da99741 100644 --- a/freedreno/kgsl/kgsl_ringbuffer.c +++ b/freedreno/kgsl/kgsl_ringbuffer.c @@ -60,7 +60,7 @@ static void kgsl_rb_bo_del(struct kgsl_rb_bo *bo) }; int ret;
- munmap(bo->hostptr, bo->size); + drm_munmap(bo->hostptr, bo->size);
ret = ioctl(bo->pipe->fd, IOCTL_KGSL_SHAREDMEM_FREE, &req); if (ret) { @@ -93,7 +93,7 @@ static struct kgsl_rb_bo * kgsl_rb_bo_new(struct kgsl_pipe *pipe, uint32_t size) bo->pipe = pipe; bo->gpuaddr = req.gpuaddr; bo->size = size; - bo->hostptr = mmap(NULL, size, PROT_WRITE|PROT_READ, + bo->hostptr = drm_mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED, pipe->fd, req.gpuaddr);
return bo;
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- intel/intel_bufmgr_gem.c | 15 +++++++-------- intel/test_decode.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 0e1cb0d..a527f41 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -48,7 +48,6 @@ #include <assert.h> #include <pthread.h> #include <sys/ioctl.h> -#include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <stdbool.h> @@ -955,11 +954,11 @@ drm_intel_gem_bo_free(drm_intel_bo *bo) DRMLISTDEL(&bo_gem->vma_list); if (bo_gem->mem_virtual) { VG(VALGRIND_FREELIKE_BLOCK(bo_gem->mem_virtual, 0)); - munmap(bo_gem->mem_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size); bufmgr_gem->vma_count--; } if (bo_gem->gtt_virtual) { - munmap(bo_gem->gtt_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size); bufmgr_gem->vma_count--; }
@@ -1044,12 +1043,12 @@ static void drm_intel_gem_bo_purge_vma_cache(drm_intel_bufmgr_gem *bufmgr_gem) DRMLISTDELINIT(&bo_gem->vma_list);
if (bo_gem->mem_virtual) { - munmap(bo_gem->mem_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size); bo_gem->mem_virtual = NULL; bufmgr_gem->vma_count--; } if (bo_gem->gtt_virtual) { - munmap(bo_gem->gtt_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size); bo_gem->gtt_virtual = NULL; bufmgr_gem->vma_count--; } @@ -1271,9 +1270,9 @@ map_gtt(drm_intel_bo *bo) }
/* and mmap it */ - bo_gem->gtt_virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE, - MAP_SHARED, bufmgr_gem->fd, - mmap_arg.offset); + bo_gem->gtt_virtual = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, + MAP_SHARED, bufmgr_gem->fd, + mmap_arg.offset); if (bo_gem->gtt_virtual == MAP_FAILED) { bo_gem->gtt_virtual = NULL; ret = -errno; diff --git a/intel/test_decode.c b/intel/test_decode.c index bef9d99..d7025f0 100644 --- a/intel/test_decode.c +++ b/intel/test_decode.c @@ -32,9 +32,9 @@ #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> -#include <sys/mman.h> #include <err.h>
+#include "libdrm.h" #include "intel_bufmgr.h" #include "intel_chipset.h"
@@ -64,7 +64,7 @@ read_file(const char *filename, void **ptr, size_t *size) errx(1, "couldn't stat `%s'", filename);
*size = st.st_size; - *ptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + *ptr = drm_mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); if (*ptr == MAP_FAILED) errx(1, "couldn't map `%s'", filename);
On Sun, Sep 7, 2014 at 11:29 PM, Emil Velikov emil.l.velikov@gmail.com wrote:
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)
The series is available in branch 'android-final-fixes' at https://github.com/evelikov/libdrm
Any comments, reviews, it builds or it works are appreciated.
While I'm not that familiar with the Android build system patches 01, 02 and 03 - 18 are
Reviewed-by: Jakob Bornecrantz jakob@vmware.com
You will have to ask the intel people about 810 and 830 headers removal.
Cheers, Jakob.
On Mon, Sep 08, 2014 at 01:10:59PM +0200, Jakob Bornecrantz wrote:
On Sun, Sep 7, 2014 at 11:29 PM, Emil Velikov emil.l.velikov@gmail.com wrote:
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)
The series is available in branch 'android-final-fixes' at https://github.com/evelikov/libdrm
Any comments, reviews, it builds or it works are appreciated.
While I'm not that familiar with the Android build system patches 01, 02 and 03 - 18 are
Reviewed-by: Jakob Bornecrantz jakob@vmware.com
You will have to ask the intel people about 810 and 830 headers removal.
I've thought libdrm provides the canonical sources for drm headers, but grepping current mesa and intel ddx didn't show any hits. I have no idea whether we still need them and whether they've ever been part of the libdrm api. In case of doubt I'd keep them. -Daniel
On 07/09/14 22:29, Emil Velikov wrote:
Hello list,
Here is the final batch that I've been planning to get upstreamed. Everything else that remains are some custom downstream "hacks" that will get upstreamed by their original authors in due time :)
Highlights:
- Drop a few unneeded Makefiles.
- Android support for libkms & modetest. Inspired by Benjamin
Gaignard's work.
- Private mmap/munmap wrappers to hide all the love that bionic has for
us :)
The series is available in branch 'android-final-fixes' at https://github.com/evelikov/libdrm
Just sent out a couple of updates for patches 09 and 12. The updated series can be found at android-final-fixes-v2.
My plan is to push this over the weekend. So if you have any comments, suggestions or concerns please let me know :)
Cheers, Emil
Any comments, reviews, it builds or it works are appreciated.
-Emil
dri-devel@lists.freedesktop.org