Displaying 20 results from an estimated 40 matches for "nr_buffer".
Did you mean:
nr_buffers
2019 Jul 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...ad of relying on the cookie, passes a pointer to
&buffers[i], so the callback no longer needs to search the list of
buffers (this is also quicker).
This necessitated another change however: previously we were copying
buffers around to ensure that the next free buffer was always at
&buffers[nr_buffers]. Instead of that introduce a new state
(BUFFER_UNUSED) and search the short list of buffers once when looking
for a free buffer.
Thanks: Eric Blake.
---
examples/glib-main-loop.c | 96 +++++++++++++--------------------------
1 file changed, 32 insertions(+), 64 deletions(-)
diff --git a/examp...
2019 Jul 15
2
[PATCH libnbd] examples: Include an example of integrating with the glibc main loop.
** NOT WORKING **
This patch shows how to integrate libnbd and the glib main loop.
Posted mainly as a point of discussion as it doesn't quite work yet.
Rich.
2019 Jul 30
4
[PATCH libnbd] examples: Fix theoretical cookie race in example.
Previously discussed here:
https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
It turns out that deferring callbacks is a PITA. (It would be a bit
easier if C has closures.) However by rewriting the example we can
avoid the need to use the cookie at all and make it run a bit more
efficiently, so let's do that instead.
Rich.
2019 Jul 17
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...+ BUFFER_READING,
> + BUFFER_READ_COMPLETED,
> + BUFFER_WRITING,
> +};
> +
> +struct buffer {
> + uint64_t offset;
> + int64_t cookie;
> + enum buffer_state state;
> + char *data;
> +};
> +
> +static struct buffer buffers[MAX_BUFFERS];
> +static size_t nr_buffers;
> +
> +static bool finished, reader_paused;
> +
> +static GMainLoop *loop;
> +
> +static void connected (struct NBDSource *source);
> +static gboolean read_data (gpointer user_data);
> +static int finished_read (void *vp, int64_t cookie, int *error);
> +static gboolean...
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...MAX_BUFFERS 16
+#define BUFFER_SIZE 65536
+
+enum buffer_state {
+ BUFFER_READING,
+ BUFFER_READ_COMPLETED,
+ BUFFER_WRITING,
+};
+
+struct buffer {
+ uint64_t offset;
+ int64_t cookie;
+ enum buffer_state state;
+ char *data;
+};
+
+static struct buffer buffers[MAX_BUFFERS];
+static size_t nr_buffers;
+
+static bool finished, reader_paused;
+
+static GMainLoop *loop;
+
+static void connected (struct NBDSource *source);
+static gboolean read_data (gpointer user_data);
+static int finished_read (void *vp, int64_t cookie, int *error);
+static gboolean write_data (gpointer user_data);
+static int...
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...e two handles but we must look up completed commands
+ * in the buffer table by cookie we must maintain separate read and
+ * write cookies.
+ */
+ int64_t rcookie;
+ int64_t wcookie;
+ enum buffer_state state;
+ char *data;
+};
+
+static struct buffer buffers[MAX_BUFFERS];
+static size_t nr_buffers;
+
+static bool finished, reader_paused;
+
+static GMainLoop *loop;
+
+static void connected (struct NBDSource *source);
+static gboolean read_data (gpointer user_data);
+static int finished_read (void *vp, int64_t rcookie, int *error);
+static gboolean write_data (gpointer user_data);
+static int...
2019 Aug 21
2
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...&b->presumed, sizeof(b->presumed)))
- return -EFAULT;
}
}
@@ -545,8 +538,8 @@ static int
nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
struct drm_file *file_priv,
struct drm_nouveau_gem_pushbuf_bo *pbbo,
- uint64_t user_buffers, int nr_buffers,
- struct validate_op *op, int *apply_relocs)
+ int nr_buffers,
+ struct validate_op *op, bool *apply_relocs)
{
struct nouveau_cli *cli = nouveau_cli(file_priv);
int ret;
@@ -563,7 +556,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
return ret;
}
-...
2019 Jul 17
2
[PATCH libnbd v2] examples: Include an example of integrating with glib main loop.
This is working now, and incorporates all of the changes in Eric's
review, *except* that it still doesn't retire commands (although this
seems to make no obvious difference, except possibly a performance and
memory impact).
Rich.
2018 Jan 11
0
[PATCH libdrm] nouveau: Support fence FDs
...SHBUF_FENCE_WAIT (1 << 0)
+#define NOUVEAU_GEM_PUSHBUF_FENCE_EMIT (1 << 1)
+#define NOUVEAU_GEM_PUSHBUF_FLAGS (NOUVEAU_GEM_PUSHBUF_FENCE_WAIT | \
+ NOUVEAU_GEM_PUSHBUF_FENCE_EMIT)
+
+struct drm_nouveau_gem_pushbuf2 {
+ uint32_t channel;
+ uint32_t nr_buffers;
+ uint64_t buffers;
+ uint32_t nr_relocs;
+ uint32_t nr_push;
+ uint64_t relocs;
+ uint64_t push;
+ uint32_t suffix0;
+ uint32_t suffix1;
+ uint64_t vram_available;
+ uint64_t gart_available;
+ uint32_t flags;
+ int32_t fence;
+ uint64_t reserved;
+};
+
#defin...
2018 Jul 03
0
[PATCH] drm/nouveau/gem: off by one bugs in nouveau_gem_pushbuf_reloc_apply()
The bo array has req->nr_buffers elements so the > should be >= so we
don't read beyond the end of the array.
Fixes: a1606a9596e5 ("drm/nouveau: new gem pushbuf interface, bump to 0.0.16")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/dr...
2019 Oct 21
1
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...&b->presumed, sizeof(b->presumed)))
- return -EFAULT;
}
}
@@ -547,8 +540,8 @@ static int
nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
struct drm_file *file_priv,
struct drm_nouveau_gem_pushbuf_bo *pbbo,
- uint64_t user_buffers, int nr_buffers,
- struct validate_op *op, int *apply_relocs)
+ int nr_buffers,
+ struct validate_op *op, bool *apply_relocs)
{
struct nouveau_cli *cli = nouveau_cli(file_priv);
int ret;
@@ -565,7 +558,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
return ret;
}
-...
2019 Nov 04
2
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...&b->presumed, sizeof(b->presumed)))
- return -EFAULT;
}
}
@@ -547,8 +540,8 @@ static int
nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
struct drm_file *file_priv,
struct drm_nouveau_gem_pushbuf_bo *pbbo,
- uint64_t user_buffers, int nr_buffers,
- struct validate_op *op, int *apply_relocs)
+ int nr_buffers,
+ struct validate_op *op, bool *apply_relocs)
{
struct nouveau_cli *cli = nouveau_cli(file_priv);
int ret;
@@ -565,7 +558,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
return ret;
}
-...
2019 Aug 20
0
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...&b->presumed, sizeof(b->presumed)))
- return -EFAULT;
}
}
@@ -545,8 +538,8 @@ static int
nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
struct drm_file *file_priv,
struct drm_nouveau_gem_pushbuf_bo *pbbo,
- uint64_t user_buffers, int nr_buffers,
- struct validate_op *op, int *apply_relocs)
+ int nr_buffers,
+ struct validate_op *op, bool *apply_relocs)
{
struct nouveau_cli *cli = nouveau_cli(file_priv);
int ret;
@@ -563,7 +556,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
return ret;
}
-...
2018 Aug 30
3
[PATCH 0/2] drm/nouveau: Use more standard logging styles
Reduces object size ~4kb
Joe Perches (2):
drm/nouveau: Add new logging function nv_cli_printk
drm/nouveau: Convert NV_PRINTK macros and uses to new nv_cli_<level> macros
drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_chan.c | 12 +++----
drivers/gpu/drm/nouveau/nouveau_drm.c | 21 +++++++++++
drivers/gpu/drm/nouveau/nouveau_drv.h | 44
2019 Sep 03
0
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...sumed)))
> - return -EFAULT;
> }
> }
>
> @@ -545,8 +538,8 @@ static int
> nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
> struct drm_file *file_priv,
> struct drm_nouveau_gem_pushbuf_bo *pbbo,
> - uint64_t user_buffers, int nr_buffers,
> - struct validate_op *op, int *apply_relocs)
> + int nr_buffers,
> + struct validate_op *op, bool *apply_relocs)
> {
> struct nouveau_cli *cli = nouveau_cli(file_priv);
> int ret;
> @@ -563,7 +556,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_ch...
2019 Nov 05
0
[PATCH 2/3] drm/nouveau: slowpath for pushbuf ioctl
...sumed)))
> - return -EFAULT;
> }
> }
>
> @@ -547,8 +540,8 @@ static int
> nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
> struct drm_file *file_priv,
> struct drm_nouveau_gem_pushbuf_bo *pbbo,
> - uint64_t user_buffers, int nr_buffers,
> - struct validate_op *op, int *apply_relocs)
> + int nr_buffers,
> + struct validate_op *op, bool *apply_relocs)
> {
> struct nouveau_cli *cli = nouveau_cli(file_priv);
> int ret;
> @@ -565,7 +558,7 @@ nouveau_gem_pushbuf_validate(struct nouveau_ch...
2013 Nov 12
6
[PATCH 1/7] drm/nouveau: fix m2mf copy to tiled gart
From: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Commit de7b7d59d54852c introduced tiled GART, but a linear copy is
still performed. This may result in errors on eviction, fix it by
checking tiling from memtype.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Cc: stable at vger.kernel.org #3.10+
---
drivers/gpu/drm/nouveau/nouveau_bo.c | 33
2016 Oct 24
1
[PATCH] nouveau: hide gcc-4.9 -Wmaybe-uninitialized
gcc-4.9 notices that the validate_init() function returns unintialized
data when called with a zero 'nr_buffers' argument, when called with the
-Wmaybe-uninitialized flag:
drivers/gpu/drm/nouveau/nouveau_gem.c: In function ‘validate_init.isra.6’:
drivers/gpu/drm/nouveau/nouveau_gem.c:457:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
However, the only caller o...
2009 Aug 18
1
[PATCH 1/2] drm/nouveau: minor gem cleanups
...veau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 64e59fb..75cae79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -595,7 +595,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
bo = u_memcpya(req->buffers, req->nr_buffers, sizeof(*bo));
if (IS_ERR(bo))
- return (unsigned long)bo;
+ return PTR_ERR(bo);
mutex_lock(&dev->struct_mutex);
@@ -622,7 +622,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
ret = -EINVAL;
goto out;
}
- pbbo = gem->driver_private;
+ pbbo = nouv...
2010 Jan 29
2
[PATCH 1/2] libdrm/nouveau: new optimized libdrm pushbuffer ABI
...0;
req.suffix1 = nvpb->cal_suffix1;
@@ -229,7 +225,7 @@ restart_cal:
restart_push:
req.channel = chan->id;
- req.nr_dwords = nvpb->size - nvpb->base.remaining;
+ req.nr_dwords = chan->cur - nvpb->pushbuf;
req.dwords = (uint64_t)(unsigned long)nvpb->pushbuf;
req.nr_buffers = nvpb->nr_buffers;
req.buffers = (uint64_t)(unsigned long)nvpb->buffers;
@@ -281,7 +277,7 @@ int
nouveau_pushbuf_marker_emit(struct nouveau_channel *chan,
unsigned wait_dwords, unsigned wait_relocs)
{
- struct nouveau_pushbuf_priv *nvpb = nouveau_pushbuf(chan->pushbuf);
+ st...