[PATCH 1/4] dmm_buffer: fix for DSP_API=2

9 views
Skip to first unread message

Felipe Contreras

unread,
Feb 14, 2012, 2:40:47 PM2/14/12
to gst-dsp, Felipe Contreras
From: Felipe Contreras <felipe.c...@gmail.com>

Signed-off-by: Felipe Contreras <felipe.c...@gmail.com>
---
dmm_buffer.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dmm_buffer.h b/dmm_buffer.h
index bd33c4e..72dfe03 100644
--- a/dmm_buffer.h
+++ b/dmm_buffer.h
@@ -91,9 +91,9 @@ dmm_buffer_begin(dmm_buffer_t *b,
if (b->dma_len == (size_t) -1)
return;
if (dsp_begin_dma(b->handle, b->proc, b->data, len, b->dir))
- b->dma_len = (size_t) -1;
- else
b->dma_len = len;
+ else
+ b->dma_len = (size_t) -1;
#endif
}

--
1.7.9

Felipe Contreras

unread,
Feb 14, 2012, 2:40:50 PM2/14/12
to gst-dsp, Felipe Contreras
It doesn't make any sense, but the DSP socket-node seems to be writing
back on these buffers.

Tests require thousands of runs, but so far they all point out this is
the issue.

Signed-off-by: Felipe Contreras <felipe.c...@nokia.com>
---
gstdspipp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gstdspipp.c b/gstdspipp.c
index e84b5a2..a01acbc 100644
--- a/gstdspipp.c
+++ b/gstdspipp.c
@@ -632,7 +632,7 @@ static dmm_buffer_t *str_to_ipp_str(GstDspIpp *self, const char *s)
struct ipp_name_string *ipp_s;
dmm_buffer_t *tmp;

- tmp = ipp_calloc(self, sizeof(*ipp_s), DMA_TO_DEVICE);
+ tmp = ipp_calloc(self, sizeof(*ipp_s), DMA_BIDIRECTIONAL);
ipp_s = tmp->data;
ipp_s->size = strlen(s);
memcpy(ipp_s->str, s, ipp_s->size);
--
1.7.9

Felipe Contreras

unread,
Feb 14, 2012, 2:40:46 PM2/14/12
to gst-dsp, Felipe Contreras
Hi,

Looks like v0.10.1 was less than stellar. Here's the fix that makes it work
again (with DSP_API=2), and and other regression fixes.

I'll make a new release probably tomorrow.

Felipe Contreras (4):
dmm_buffer: fix for DSP_API=2
util: fix map_buffer() warning message
base: fix access to correct dmm_buffer data
ipp: fix alignment of strings

dmm_buffer.h | 4 ++--
gstdspbase.c | 7 +++++--
gstdspipp.c | 2 +-
util.c | 2 +-
4 files changed, 9 insertions(+), 6 deletions(-)

--
1.7.9

Felipe Contreras

unread,
Feb 14, 2012, 2:40:49 PM2/14/12
to gst-dsp, Felipe Contreras
As Ивайло Димитров pointed out; the new size/len semantics cause the
'len' to be overwritten when the buffer is mapped, so we have to save it
to avoid that.

Independently, but also correctly, Mark Nauwelaerts found the same
problem whil accessing the 'need_copy' field, and probably 'data', so
essentially the whole dmm_buffer.

A simple way to fix the issues is to delay the map_buffer() call until
we have accessed all the fields we care about.

Signed-off-by: Felipe Contreras <felipe.c...@nokia.com>
---

gstdspbase.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gstdspbase.c b/gstdspbase.c
index 8e6e8ec..6b89390 100644
--- a/gstdspbase.c
+++ b/gstdspbase.c
@@ -475,8 +475,6 @@ output_loop(gpointer data)
if (tb->user_data) {
out_buf = tb->user_data;
tb->user_data = NULL;
- map_buffer(self, new_buf, tb);
- gst_buffer_unref(new_buf);
}
else
out_buf = new_buf;
@@ -487,6 +485,11 @@ output_loop(gpointer data)
}

GST_BUFFER_SIZE(out_buf) = b->len;
+
+ if (out_buf != new_buf) {
+ map_buffer(self, new_buf, tb);
+ gst_buffer_unref(new_buf);
+ }
}
else {
out_buf = gst_dsp_buffer_new(self, tb);
--
1.7.9

Felipe Contreras

unread,
Feb 14, 2012, 2:40:48 PM2/14/12
to gst-dsp, Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.c...@nokia.com>
---
util.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/util.c b/util.c
index 87c1172..7390fe8 100644
--- a/util.c
+++ b/util.c
@@ -70,7 +70,7 @@ bool gstdsp_map_buffer(void *self,
buf->data,
(size_t)buf->data % alignment,
buf->data + buf->size,
- (size_t)buf->data + buf->size % alignment,
+ (size_t)(buf->data + buf->size) % alignment,
dma_dir_to_str(b->dir));
}

--
1.7.9

Reply all
Reply to author
Forward
0 new messages