Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'drm-etnaviv-next' of git://git.pengutronix.de/lst/linux into drm-next

- fix dma-buf export path to return correct SG table
- trivially implement direct dma-buf mapping
- allow DRAW_INSTANCED commands in validator
- make the driver work on i.MX6SX, yielding a working 2D/3D stack
together with Mareks MXS DRM driver

* 'drm-etnaviv-next' of git://git.pengutronix.de/lst/linux:
MAINTAINERS: add etnaviv mailinglist
drm/etnaviv: move linear window on MC1.0 parts if necessary
drm/etnaviv: don't invoke OOM killer from dump code
drm/etnaviv: fix gem_prime_get_sg_table to return new SG table
drm/etnaviv: Allow DRAW_INSTANCED commands
drm/etnaviv: implement dma-buf mmap

+83 -6
+1
MAINTAINERS
··· 4285 4285 M: Lucas Stach <l.stach@pengutronix.de> 4286 4286 R: Russell King <linux+etnaviv@armlinux.org.uk> 4287 4287 R: Christian Gmeiner <christian.gmeiner@gmail.com> 4288 + L: etnaviv@lists.freedesktop.org 4288 4289 L: dri-devel@lists.freedesktop.org 4289 4290 S: Maintained 4290 4291 F: drivers/gpu/drm/etnaviv/
+55 -3
drivers/gpu/drm/etnaviv/cmdstream.xml.h
··· 8 8 git clone git://0x04.net/rules-ng-ng 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 - - cmdstream.xml ( 12589 bytes, from 2014-02-17 14:57:56) 12 - - common.xml ( 18437 bytes, from 2015-03-25 11:27:41) 11 + - cmdstream.xml ( 14094 bytes, from 2016-11-11 06:55:14) 12 + - copyright.xml ( 1597 bytes, from 2016-10-29 07:29:22) 13 + - common.xml ( 23344 bytes, from 2016-11-10 15:14:07) 13 14 14 - Copyright (C) 2014 15 + Copyright (C) 2012-2016 by the following authors: 16 + - Wladimir J. van der Laan <laanwj@gmail.com> 17 + - Christian Gmeiner <christian.gmeiner@gmail.com> 18 + - Lucas Stach <l.stach@pengutronix.de> 19 + - Russell King <rmk@arm.linux.org.uk> 20 + 21 + Permission is hereby granted, free of charge, to any person obtaining a 22 + copy of this software and associated documentation files (the "Software"), 23 + to deal in the Software without restriction, including without limitation 24 + the rights to use, copy, modify, merge, publish, distribute, sub license, 25 + and/or sell copies of the Software, and to permit persons to whom the 26 + Software is furnished to do so, subject to the following conditions: 27 + 28 + The above copyright notice and this permission notice (including the 29 + next paragraph) shall be included in all copies or substantial portions 30 + of the Software. 31 + 32 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 + FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 35 + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 37 + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 38 + DEALINGS IN THE SOFTWARE. 15 39 */ 16 40 17 41 ··· 50 26 #define FE_OPCODE_STALL 0x00000009 51 27 #define FE_OPCODE_CALL 0x0000000a 52 28 #define FE_OPCODE_RETURN 0x0000000b 29 + #define FE_OPCODE_DRAW_INSTANCED 0x0000000c 53 30 #define FE_OPCODE_CHIP_SELECT 0x0000000d 54 31 #define PRIMITIVE_TYPE_POINTS 0x00000001 55 32 #define PRIMITIVE_TYPE_LINES 0x00000002 ··· 238 213 #define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP2 0x00000004 239 214 #define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP1 0x00000002 240 215 #define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP0 0x00000001 216 + 217 + #define VIV_FE_DRAW_INSTANCED 0x00000000 218 + 219 + #define VIV_FE_DRAW_INSTANCED_HEADER 0x00000000 220 + #define VIV_FE_DRAW_INSTANCED_HEADER_OP__MASK 0xf8000000 221 + #define VIV_FE_DRAW_INSTANCED_HEADER_OP__SHIFT 27 222 + #define VIV_FE_DRAW_INSTANCED_HEADER_OP_DRAW_INSTANCED 0x60000000 223 + #define VIV_FE_DRAW_INSTANCED_HEADER_INDEXED 0x00100000 224 + #define VIV_FE_DRAW_INSTANCED_HEADER_TYPE__MASK 0x000f0000 225 + #define VIV_FE_DRAW_INSTANCED_HEADER_TYPE__SHIFT 16 226 + #define VIV_FE_DRAW_INSTANCED_HEADER_TYPE(x) (((x) << VIV_FE_DRAW_INSTANCED_HEADER_TYPE__SHIFT) & VIV_FE_DRAW_INSTANCED_HEADER_TYPE__MASK) 227 + #define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__MASK 0x0000ffff 228 + #define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__SHIFT 0 229 + #define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO(x) (((x) << VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__SHIFT) & VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__MASK) 230 + 231 + #define VIV_FE_DRAW_INSTANCED_COUNT 0x00000004 232 + #define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__MASK 0xff000000 233 + #define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__SHIFT 24 234 + #define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI(x) (((x) << VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__SHIFT) & VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__MASK) 235 + #define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__MASK 0x00ffffff 236 + #define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__SHIFT 0 237 + #define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT(x) (((x) << VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__SHIFT) & VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__MASK) 238 + 239 + #define VIV_FE_DRAW_INSTANCED_START 0x00000008 240 + #define VIV_FE_DRAW_INSTANCED_START_INDEX__MASK 0xffffffff 241 + #define VIV_FE_DRAW_INSTANCED_START_INDEX__SHIFT 0 242 + #define VIV_FE_DRAW_INSTANCED_START_INDEX(x) (((x) << VIV_FE_DRAW_INSTANCED_START_INDEX__SHIFT) & VIV_FE_DRAW_INSTANCED_START_INDEX__MASK) 241 243 242 244 243 245 #endif /* CMDSTREAM_XML */
+1
drivers/gpu/drm/etnaviv/etnaviv_cmd_parser.c
··· 143 143 static uint8_t cmd_length[32] = { 144 144 [FE_OPCODE_DRAW_PRIMITIVES] = 4, 145 145 [FE_OPCODE_DRAW_INDEXED_PRIMITIVES] = 6, 146 + [FE_OPCODE_DRAW_INSTANCED] = 4, 146 147 [FE_OPCODE_NOP] = 2, 147 148 [FE_OPCODE_STALL] = 2, 148 149 };
+1
drivers/gpu/drm/etnaviv/etnaviv_drv.c
··· 504 504 .gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table, 505 505 .gem_prime_vmap = etnaviv_gem_prime_vmap, 506 506 .gem_prime_vunmap = etnaviv_gem_prime_vunmap, 507 + .gem_prime_mmap = etnaviv_gem_prime_mmap, 507 508 #ifdef CONFIG_DEBUG_FS 508 509 .debugfs_init = etnaviv_debugfs_init, 509 510 .debugfs_cleanup = etnaviv_debugfs_cleanup,
+2
drivers/gpu/drm/etnaviv/etnaviv_drv.h
··· 78 78 struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj); 79 79 void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj); 80 80 void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); 81 + int etnaviv_gem_prime_mmap(struct drm_gem_object *obj, 82 + struct vm_area_struct *vma); 81 83 struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, 82 84 struct dma_buf_attachment *attach, struct sg_table *sg); 83 85 int etnaviv_gem_prime_pin(struct drm_gem_object *obj);
+2 -1
drivers/gpu/drm/etnaviv/etnaviv_dump.c
··· 160 160 file_size += sizeof(*iter.hdr) * n_obj; 161 161 162 162 /* Allocate the file in vmalloc memory, it's likely to be big */ 163 - iter.start = vmalloc(file_size); 163 + iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_HIGHMEM | 164 + __GFP_NOWARN | __GFP_NORETRY, PAGE_KERNEL); 164 165 if (!iter.start) { 165 166 dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); 166 167 return;
+17 -2
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
··· 23 23 struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj) 24 24 { 25 25 struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); 26 + int npages = obj->size >> PAGE_SHIFT; 26 27 27 - BUG_ON(!etnaviv_obj->sgt); /* should have already pinned! */ 28 + if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */ 29 + return NULL; 28 30 29 - return etnaviv_obj->sgt; 31 + return drm_prime_pages_to_sg(etnaviv_obj->pages, npages); 30 32 } 31 33 32 34 void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj) ··· 39 37 void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) 40 38 { 41 39 /* TODO msm_gem_vunmap() */ 40 + } 41 + 42 + int etnaviv_gem_prime_mmap(struct drm_gem_object *obj, 43 + struct vm_area_struct *vma) 44 + { 45 + struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); 46 + int ret; 47 + 48 + ret = drm_gem_mmap_obj(obj, obj->size, vma); 49 + if (ret < 0) 50 + return ret; 51 + 52 + return etnaviv_obj->ops->mmap(etnaviv_obj, vma); 42 53 } 43 54 44 55 int etnaviv_gem_prime_pin(struct drm_gem_object *obj)
+4
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
··· 639 639 gpu->memory_base = PHYS_OFFSET; 640 640 else 641 641 gpu->memory_base = dma_mask - SZ_2G + 1; 642 + } else if (PHYS_OFFSET >= SZ_2G) { 643 + dev_info(gpu->dev, "Need to move linear window on MC1.0, disabling TS\n"); 644 + gpu->memory_base = PHYS_OFFSET; 645 + gpu->identity.features &= ~chipFeatures_FAST_CLEAR; 642 646 } 643 647 644 648 ret = etnaviv_hw_reset(gpu);