aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2016-11-09 08:02:09 -0600
committerRob Clark2016-11-26 11:51:38 -0600
commit23d10b82440f59f2a685db34d3662d75f4a3784b (patch)
treeaf78910485035ae59a2b707ab81a0c96ad4eb8fc /freedreno
parentd15515aea3c3e51336f9ab29691162c69acc9807 (diff)
downloadexternal-libgbm-23d10b82440f59f2a685db34d3662d75f4a3784b.tar.gz
external-libgbm-23d10b82440f59f2a685db34d3662d75f4a3784b.tar.xz
external-libgbm-23d10b82440f59f2a685db34d3662d75f4a3784b.zip
freedreno: 64bit support
a5xx and later are 64bit devices.. make reloc's handle that. A new public symbol is introduced to avoid silent problems with new mesa and old libdrm (since on 64b reloc consumes two dwords). Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rwxr-xr-xfreedreno/freedreno-symbol-check1
-rw-r--r--freedreno/freedreno_pipe.c4
-rw-r--r--freedreno/freedreno_priv.h1
-rw-r--r--freedreno/freedreno_ringbuffer.c9
-rw-r--r--freedreno/freedreno_ringbuffer.h6
-rw-r--r--freedreno/kgsl/kgsl_pipe.c5
-rw-r--r--freedreno/msm/msm_ringbuffer.c27
7 files changed, 49 insertions, 4 deletions
diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check
index ad367fc3..42f2c439 100755
--- a/freedreno/freedreno-symbol-check
+++ b/freedreno/freedreno-symbol-check
@@ -43,6 +43,7 @@ fd_ringbuffer_flush
43fd_ringbuffer_grow 43fd_ringbuffer_grow
44fd_ringbuffer_new 44fd_ringbuffer_new
45fd_ringbuffer_reloc 45fd_ringbuffer_reloc
46fd_ringbuffer_reloc2
46fd_ringbuffer_reset 47fd_ringbuffer_reset
47fd_ringbuffer_set_parent 48fd_ringbuffer_set_parent
48fd_ringbuffer_timestamp 49fd_ringbuffer_timestamp
diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c
index 4a756d70..3f8c8342 100644
--- a/freedreno/freedreno_pipe.c
+++ b/freedreno/freedreno_pipe.c
@@ -37,6 +37,7 @@ struct fd_pipe *
37fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) 37fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id)
38{ 38{
39 struct fd_pipe *pipe = NULL; 39 struct fd_pipe *pipe = NULL;
40 uint64_t val;
40 41
41 if (id > FD_PIPE_MAX) { 42 if (id > FD_PIPE_MAX) {
42 ERROR_MSG("invalid pipe id: %d", id); 43 ERROR_MSG("invalid pipe id: %d", id);
@@ -52,6 +53,9 @@ fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id)
52 pipe->dev = dev; 53 pipe->dev = dev;
53 pipe->id = id; 54 pipe->id = id;
54 55
56 fd_pipe_get_param(pipe, FD_GPU_ID, &val);
57 pipe->gpu_id = val;
58
55 return pipe; 59 return pipe;
56fail: 60fail:
57 if (pipe) 61 if (pipe)
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 86da83b9..32170391 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -123,6 +123,7 @@ struct fd_pipe_funcs {
123struct fd_pipe { 123struct fd_pipe {
124 struct fd_device *dev; 124 struct fd_device *dev;
125 enum fd_pipe_id id; 125 enum fd_pipe_id id;
126 uint32_t gpu_id;
126 const struct fd_pipe_funcs *funcs; 127 const struct fd_pipe_funcs *funcs;
127}; 128};
128 129
diff --git a/freedreno/freedreno_ringbuffer.c b/freedreno/freedreno_ringbuffer.c
index c132145a..7310f1fd 100644
--- a/freedreno/freedreno_ringbuffer.c
+++ b/freedreno/freedreno_ringbuffer.c
@@ -115,6 +115,13 @@ uint32_t fd_ringbuffer_timestamp(struct fd_ringbuffer *ring)
115void fd_ringbuffer_reloc(struct fd_ringbuffer *ring, 115void fd_ringbuffer_reloc(struct fd_ringbuffer *ring,
116 const struct fd_reloc *reloc) 116 const struct fd_reloc *reloc)
117{ 117{
118 assert(ring->pipe->gpu_id < 500);
119 ring->funcs->emit_reloc(ring, reloc);
120}
121
122void fd_ringbuffer_reloc2(struct fd_ringbuffer *ring,
123 const struct fd_reloc *reloc)
124{
118 ring->funcs->emit_reloc(ring, reloc); 125 ring->funcs->emit_reloc(ring, reloc);
119} 126}
120 127
@@ -123,6 +130,8 @@ void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
123{ 130{
124 uint32_t submit_offset, size; 131 uint32_t submit_offset, size;
125 132
133 /* This function is deprecated and not supported on 64b devices: */
134 assert(ring->pipe->gpu_id < 500);
126 assert(target->ring == end->ring); 135 assert(target->ring == end->ring);
127 136
128 submit_offset = offset_bytes(target->cur, target->ring->start); 137 submit_offset = offset_bytes(target->cur, target->ring->start);
diff --git a/freedreno/freedreno_ringbuffer.h b/freedreno/freedreno_ringbuffer.h
index 108d5a6d..c501fbad 100644
--- a/freedreno/freedreno_ringbuffer.h
+++ b/freedreno/freedreno_ringbuffer.h
@@ -78,9 +78,13 @@ struct fd_reloc {
78 uint32_t offset; 78 uint32_t offset;
79 uint32_t or; 79 uint32_t or;
80 int32_t shift; 80 int32_t shift;
81 uint32_t orhi; /* used for a5xx+ */
81}; 82};
82 83
83void fd_ringbuffer_reloc(struct fd_ringbuffer *ring, const struct fd_reloc *reloc); 84/* NOTE: relocs are 2 dwords on a5xx+ */
85
86void fd_ringbuffer_reloc2(struct fd_ringbuffer *ring, const struct fd_reloc *reloc);
87will_be_deprecated void fd_ringbuffer_reloc(struct fd_ringbuffer *ring, const struct fd_reloc *reloc);
84will_be_deprecated void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, 88will_be_deprecated void fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
85 struct fd_ringmarker *target, struct fd_ringmarker *end); 89 struct fd_ringmarker *target, struct fd_ringmarker *end);
86uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring); 90uint32_t fd_ringbuffer_cmd_count(struct fd_ringbuffer *ring);
diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c
index 3546718d..8a39eb49 100644
--- a/freedreno/kgsl/kgsl_pipe.c
+++ b/freedreno/kgsl/kgsl_pipe.c
@@ -255,6 +255,11 @@ drm_private struct fd_pipe * kgsl_pipe_new(struct fd_device *dev,
255 GETPROP(fd, VERSION, kgsl_pipe->version); 255 GETPROP(fd, VERSION, kgsl_pipe->version);
256 GETPROP(fd, DEVICE_INFO, kgsl_pipe->devinfo); 256 GETPROP(fd, DEVICE_INFO, kgsl_pipe->devinfo);
257 257
258 if (kgsl_pipe->devinfo.gpu_id >= 500) {
259 ERROR_MSG("64b unsupported with kgsl");
260 goto fail;
261 }
262
258 INFO_MSG("Pipe Info:"); 263 INFO_MSG("Pipe Info:");
259 INFO_MSG(" Device: %s", paths[id]); 264 INFO_MSG(" Device: %s", paths[id]);
260 INFO_MSG(" Chip-id: %d.%d.%d.%d", 265 INFO_MSG(" Chip-id: %d.%d.%d.%d",
diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c
index 5117df1a..17194f4c 100644
--- a/freedreno/msm/msm_ringbuffer.c
+++ b/freedreno/msm/msm_ringbuffer.c
@@ -487,11 +487,32 @@ static void msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring,
487 reloc->submit_offset = offset_bytes(ring->cur, ring->start); 487 reloc->submit_offset = offset_bytes(ring->cur, ring->start);
488 488
489 addr = msm_bo->presumed; 489 addr = msm_bo->presumed;
490 if (r->shift < 0) 490 if (reloc->shift < 0)
491 addr >>= -r->shift; 491 addr >>= -reloc->shift;
492 else 492 else
493 addr <<= r->shift; 493 addr <<= reloc->shift;
494 (*ring->cur++) = addr | r->or; 494 (*ring->cur++) = addr | r->or;
495
496 if (ring->pipe->gpu_id >= 500) {
497 struct drm_msm_gem_submit_reloc *reloc_hi;
498
499 idx = APPEND(cmd, relocs);
500
501 reloc_hi = &cmd->relocs[idx];
502
503 reloc_hi->reloc_idx = reloc->reloc_idx;
504 reloc_hi->reloc_offset = r->offset;
505 reloc_hi->or = r->orhi;
506 reloc_hi->shift = r->shift - 32;
507 reloc_hi->submit_offset = offset_bytes(ring->cur, ring->start);
508
509 addr = msm_bo->presumed >> 32;
510 if (reloc_hi->shift < 0)
511 addr >>= -reloc_hi->shift;
512 else
513 addr <<= reloc_hi->shift;
514 (*ring->cur++) = addr | r->orhi;
515 }
495} 516}
496 517
497static uint32_t msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, 518static uint32_t msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,