Commit 770ac204 authored by Dave Airlie's avatar Dave Airlie

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
parents 9ac63d99 c4ae94a3
...@@ -4285,6 +4285,7 @@ DRM DRIVERS FOR VIVANTE GPU IP ...@@ -4285,6 +4285,7 @@ DRM DRIVERS FOR VIVANTE GPU IP
M: Lucas Stach <l.stach@pengutronix.de> M: Lucas Stach <l.stach@pengutronix.de>
R: Russell King <linux+etnaviv@armlinux.org.uk> R: Russell King <linux+etnaviv@armlinux.org.uk>
R: Christian Gmeiner <christian.gmeiner@gmail.com> R: Christian Gmeiner <christian.gmeiner@gmail.com>
L: etnaviv@lists.freedesktop.org
L: dri-devel@lists.freedesktop.org L: dri-devel@lists.freedesktop.org
S: Maintained S: Maintained
F: drivers/gpu/drm/etnaviv/ F: drivers/gpu/drm/etnaviv/
......
...@@ -8,10 +8,34 @@ This file was generated by the rules-ng-ng headergen tool in this git repository ...@@ -8,10 +8,34 @@ This file was generated by the rules-ng-ng headergen tool in this git repository
git clone git://0x04.net/rules-ng-ng git clone git://0x04.net/rules-ng-ng
The rules-ng-ng source files this header was generated from are: The rules-ng-ng source files this header was generated from are:
- cmdstream.xml ( 12589 bytes, from 2014-02-17 14:57:56) - cmdstream.xml ( 14094 bytes, from 2016-11-11 06:55:14)
- common.xml ( 18437 bytes, from 2015-03-25 11:27:41) - copyright.xml ( 1597 bytes, from 2016-10-29 07:29:22)
- common.xml ( 23344 bytes, from 2016-11-10 15:14:07)
Copyright (C) 2014
Copyright (C) 2012-2016 by the following authors:
- Wladimir J. van der Laan <laanwj@gmail.com>
- Christian Gmeiner <christian.gmeiner@gmail.com>
- Lucas Stach <l.stach@pengutronix.de>
- Russell King <rmk@arm.linux.org.uk>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, 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
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/ */
...@@ -26,6 +50,7 @@ Copyright (C) 2014 ...@@ -26,6 +50,7 @@ Copyright (C) 2014
#define FE_OPCODE_STALL 0x00000009 #define FE_OPCODE_STALL 0x00000009
#define FE_OPCODE_CALL 0x0000000a #define FE_OPCODE_CALL 0x0000000a
#define FE_OPCODE_RETURN 0x0000000b #define FE_OPCODE_RETURN 0x0000000b
#define FE_OPCODE_DRAW_INSTANCED 0x0000000c
#define FE_OPCODE_CHIP_SELECT 0x0000000d #define FE_OPCODE_CHIP_SELECT 0x0000000d
#define PRIMITIVE_TYPE_POINTS 0x00000001 #define PRIMITIVE_TYPE_POINTS 0x00000001
#define PRIMITIVE_TYPE_LINES 0x00000002 #define PRIMITIVE_TYPE_LINES 0x00000002
...@@ -214,5 +239,32 @@ Copyright (C) 2014 ...@@ -214,5 +239,32 @@ Copyright (C) 2014
#define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP1 0x00000002 #define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP1 0x00000002
#define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP0 0x00000001 #define VIV_FE_CHIP_SELECT_HEADER_ENABLE_CHIP0 0x00000001
#define VIV_FE_DRAW_INSTANCED 0x00000000
#define VIV_FE_DRAW_INSTANCED_HEADER 0x00000000
#define VIV_FE_DRAW_INSTANCED_HEADER_OP__MASK 0xf8000000
#define VIV_FE_DRAW_INSTANCED_HEADER_OP__SHIFT 27
#define VIV_FE_DRAW_INSTANCED_HEADER_OP_DRAW_INSTANCED 0x60000000
#define VIV_FE_DRAW_INSTANCED_HEADER_INDEXED 0x00100000
#define VIV_FE_DRAW_INSTANCED_HEADER_TYPE__MASK 0x000f0000
#define VIV_FE_DRAW_INSTANCED_HEADER_TYPE__SHIFT 16
#define VIV_FE_DRAW_INSTANCED_HEADER_TYPE(x) (((x) << VIV_FE_DRAW_INSTANCED_HEADER_TYPE__SHIFT) & VIV_FE_DRAW_INSTANCED_HEADER_TYPE__MASK)
#define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__MASK 0x0000ffff
#define VIV_FE_DRAW_INSTANCED_HEADER_INSTANCE_COUNT_LO__SHIFT 0
#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)
#define VIV_FE_DRAW_INSTANCED_COUNT 0x00000004
#define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__MASK 0xff000000
#define VIV_FE_DRAW_INSTANCED_COUNT_INSTANCE_COUNT_HI__SHIFT 24
#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)
#define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__MASK 0x00ffffff
#define VIV_FE_DRAW_INSTANCED_COUNT_VERTEX_COUNT__SHIFT 0
#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)
#define VIV_FE_DRAW_INSTANCED_START 0x00000008
#define VIV_FE_DRAW_INSTANCED_START_INDEX__MASK 0xffffffff
#define VIV_FE_DRAW_INSTANCED_START_INDEX__SHIFT 0
#define VIV_FE_DRAW_INSTANCED_START_INDEX(x) (((x) << VIV_FE_DRAW_INSTANCED_START_INDEX__SHIFT) & VIV_FE_DRAW_INSTANCED_START_INDEX__MASK)
#endif /* CMDSTREAM_XML */ #endif /* CMDSTREAM_XML */
...@@ -143,6 +143,7 @@ static bool etnaviv_validate_load_state(struct etna_validation_state *state, ...@@ -143,6 +143,7 @@ static bool etnaviv_validate_load_state(struct etna_validation_state *state,
static uint8_t cmd_length[32] = { static uint8_t cmd_length[32] = {
[FE_OPCODE_DRAW_PRIMITIVES] = 4, [FE_OPCODE_DRAW_PRIMITIVES] = 4,
[FE_OPCODE_DRAW_INDEXED_PRIMITIVES] = 6, [FE_OPCODE_DRAW_INDEXED_PRIMITIVES] = 6,
[FE_OPCODE_DRAW_INSTANCED] = 4,
[FE_OPCODE_NOP] = 2, [FE_OPCODE_NOP] = 2,
[FE_OPCODE_STALL] = 2, [FE_OPCODE_STALL] = 2,
}; };
......
...@@ -504,6 +504,7 @@ static struct drm_driver etnaviv_drm_driver = { ...@@ -504,6 +504,7 @@ static struct drm_driver etnaviv_drm_driver = {
.gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table, .gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table,
.gem_prime_vmap = etnaviv_gem_prime_vmap, .gem_prime_vmap = etnaviv_gem_prime_vmap,
.gem_prime_vunmap = etnaviv_gem_prime_vunmap, .gem_prime_vunmap = etnaviv_gem_prime_vunmap,
.gem_prime_mmap = etnaviv_gem_prime_mmap,
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
.debugfs_init = etnaviv_debugfs_init, .debugfs_init = etnaviv_debugfs_init,
.debugfs_cleanup = etnaviv_debugfs_cleanup, .debugfs_cleanup = etnaviv_debugfs_cleanup,
......
...@@ -78,6 +78,8 @@ int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset); ...@@ -78,6 +78,8 @@ int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset);
struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj); struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj);
void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj); void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj);
void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
int etnaviv_gem_prime_mmap(struct drm_gem_object *obj,
struct vm_area_struct *vma);
struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg); struct dma_buf_attachment *attach, struct sg_table *sg);
int etnaviv_gem_prime_pin(struct drm_gem_object *obj); int etnaviv_gem_prime_pin(struct drm_gem_object *obj);
......
...@@ -160,7 +160,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu) ...@@ -160,7 +160,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
file_size += sizeof(*iter.hdr) * n_obj; file_size += sizeof(*iter.hdr) * n_obj;
/* Allocate the file in vmalloc memory, it's likely to be big */ /* Allocate the file in vmalloc memory, it's likely to be big */
iter.start = vmalloc(file_size); iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_HIGHMEM |
__GFP_NOWARN | __GFP_NORETRY, PAGE_KERNEL);
if (!iter.start) { if (!iter.start) {
dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
return; return;
......
...@@ -23,10 +23,12 @@ ...@@ -23,10 +23,12 @@
struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj) struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj)
{ {
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
int npages = obj->size >> PAGE_SHIFT;
BUG_ON(!etnaviv_obj->sgt); /* should have already pinned! */ if (WARN_ON(!etnaviv_obj->pages)) /* should have already pinned! */
return NULL;
return etnaviv_obj->sgt; return drm_prime_pages_to_sg(etnaviv_obj->pages, npages);
} }
void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj) void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj)
...@@ -39,6 +41,19 @@ void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) ...@@ -39,6 +41,19 @@ void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
/* TODO msm_gem_vunmap() */ /* TODO msm_gem_vunmap() */
} }
int etnaviv_gem_prime_mmap(struct drm_gem_object *obj,
struct vm_area_struct *vma)
{
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
int ret;
ret = drm_gem_mmap_obj(obj, obj->size, vma);
if (ret < 0)
return ret;
return etnaviv_obj->ops->mmap(etnaviv_obj, vma);
}
int etnaviv_gem_prime_pin(struct drm_gem_object *obj) int etnaviv_gem_prime_pin(struct drm_gem_object *obj)
{ {
if (!obj->import_attach) { if (!obj->import_attach) {
......
...@@ -639,6 +639,10 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) ...@@ -639,6 +639,10 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
gpu->memory_base = PHYS_OFFSET; gpu->memory_base = PHYS_OFFSET;
else else
gpu->memory_base = dma_mask - SZ_2G + 1; gpu->memory_base = dma_mask - SZ_2G + 1;
} else if (PHYS_OFFSET >= SZ_2G) {
dev_info(gpu->dev, "Need to move linear window on MC1.0, disabling TS\n");
gpu->memory_base = PHYS_OFFSET;
gpu->identity.features &= ~chipFeatures_FAST_CLEAR;
} }
ret = etnaviv_hw_reset(gpu); ret = etnaviv_hw_reset(gpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment