[Mesa-dev] [PATCH 9/9] nouveau: s/nv04_surface_/nouveau_surface_/
Ilia Mirkin
imirkin at alum.mit.edu
Fri May 19 13:47:11 UTC 2017
I kinda see it both ways - yeah, the functions are the same and it's
all shared, so your patch makes sense. OTOH, all of these functions
(which do anything) have a nv04/nv10/nv20 prefix, which makes it
easier to separate stuff out by generation if need be. So I think in a
perfect world, the actual copy/fill functions would stay, while the
helpers would move up to nouveau_surface (esp if one were to grow a
nv10-specific impl). But this extends the API considerably, for
basically silly reasons. But the current state of the driver is that
there are no instances of BEGIN_NV04 or any pushbuf stuff in the
nouveau_* files.
Curro, since you're the original author of the driver, what do you
think about this and the previous patch?
On Fri, May 19, 2017 at 9:38 AM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> After moving the contents of nv04_surface.c to nouveau_surface.c, rename
> all the functions.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> src/mesa/drivers/dri/nouveau/nouveau_surface.c | 60 +++++++++++++-------------
> src/mesa/drivers/dri/nouveau/nouveau_surface.h | 18 ++++----
> src/mesa/drivers/dri/nouveau/nv04_context.c | 8 ++--
> src/mesa/drivers/dri/nouveau/nv10_context.c | 8 ++--
> src/mesa/drivers/dri/nouveau/nv20_context.c | 8 ++--
> 5 files changed, 51 insertions(+), 51 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.c b/src/mesa/drivers/dri/nouveau/nouveau_surface.c
> index af5c924..e3cd3c3 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_surface.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.c
> @@ -253,11 +253,11 @@ sifm_format(mesa_format format)
> }
>
> static void
> -nv04_surface_copy_swizzle(struct gl_context *ctx,
> - struct nouveau_surface *dst,
> - struct nouveau_surface *src,
> - int dx, int dy, int sx, int sy,
> - int w, int h)
> +nouveau_surface_copy_swizzle(struct gl_context *ctx,
> + struct nouveau_surface *dst,
> + struct nouveau_surface *src,
> + int dx, int dy, int sx, int sy,
> + int w, int h)
> {
> struct nouveau_pushbuf_refn refs[] = {
> { src->bo, NOUVEAU_BO_RD | NOUVEAU_BO_VRAM | NOUVEAU_BO_GART },
> @@ -334,11 +334,11 @@ nv04_surface_copy_swizzle(struct gl_context *ctx,
> }
>
> static void
> -nv04_surface_copy_m2mf(struct gl_context *ctx,
> - struct nouveau_surface *dst,
> - struct nouveau_surface *src,
> - int dx, int dy, int sx, int sy,
> - int w, int h)
> +nouveau_surface_copy_m2mf(struct gl_context *ctx,
> + struct nouveau_surface *dst,
> + struct nouveau_surface *src,
> + int dx, int dy, int sx, int sy,
> + int w, int h)
> {
> struct nouveau_pushbuf_refn refs[] = {
> { src->bo, NOUVEAU_BO_RD | NOUVEAU_BO_VRAM | NOUVEAU_BO_GART },
> @@ -422,11 +422,11 @@ get_swizzled_offset(struct nouveau_surface *s, unsigned x, unsigned y)
> }
>
> static void
> -nv04_surface_copy_cpu(struct gl_context *ctx,
> - struct nouveau_surface *dst,
> - struct nouveau_surface *src,
> - int dx, int dy, int sx, int sy,
> - int w, int h)
> +nouveau_surface_copy_cpu(struct gl_context *ctx,
> + struct nouveau_surface *dst,
> + struct nouveau_surface *src,
> + int dx, int dy, int sx, int sy,
> + int w, int h)
> {
> int x, y;
> get_offset_t get_dst = (dst->layout == SWIZZLED ?
> @@ -450,11 +450,11 @@ nv04_surface_copy_cpu(struct gl_context *ctx,
> }
>
> void
> -nv04_surface_copy(struct gl_context *ctx,
> - struct nouveau_surface *dst,
> - struct nouveau_surface *src,
> - int dx, int dy, int sx, int sy,
> - int w, int h)
> +nouveau_surface_copy(struct gl_context *ctx,
> + struct nouveau_surface *dst,
> + struct nouveau_surface *src,
> + int dx, int dy, int sx, int sy,
> + int w, int h)
> {
> if (_mesa_is_format_compressed(src->format)) {
> sx = get_format_blocksx(src->format, sx);
> @@ -468,26 +468,26 @@ nv04_surface_copy(struct gl_context *ctx,
> /* Linear texture copy. */
> if ((src->layout == LINEAR && dst->layout == LINEAR) ||
> dst->width <= 2 || dst->height <= 1) {
> - nv04_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
> + nouveau_surface_copy_m2mf(ctx, dst, src, dx, dy, sx, sy, w, h);
> return;
> }
>
> /* Swizzle using sifm+swzsurf. */
> if (src->layout == LINEAR && dst->layout == SWIZZLED &&
> dst->cpp != 1 && !(dst->offset & 63)) {
> - nv04_surface_copy_swizzle(ctx, dst, src, dx, dy, sx, sy, w, h);
> + nouveau_surface_copy_swizzle(ctx, dst, src, dx, dy, sx, sy, w, h);
> return;
> }
>
> /* Fallback to CPU copy. */
> - nv04_surface_copy_cpu(ctx, dst, src, dx, dy, sx, sy, w, h);
> + nouveau_surface_copy_cpu(ctx, dst, src, dx, dy, sx, sy, w, h);
> }
>
> void
> -nv04_surface_fill(struct gl_context *ctx,
> - struct nouveau_surface *dst,
> - unsigned mask, unsigned value,
> - int dx, int dy, int w, int h)
> +nouveau_surface_fill(struct gl_context *ctx,
> + struct nouveau_surface *dst,
> + unsigned mask, unsigned value,
> + int dx, int dy, int w, int h)
> {
> struct nouveau_pushbuf_refn refs[] = {
> { dst->bo, NOUVEAU_BO_WR | NOUVEAU_BO_VRAM | NOUVEAU_BO_GART },
> @@ -524,7 +524,7 @@ nv04_surface_fill(struct gl_context *ctx,
> }
>
> void
> -nv04_surface_takedown(struct gl_context *ctx)
> +nouveau_surface_takedown(struct gl_context *ctx)
> {
> struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
>
> @@ -539,7 +539,7 @@ nv04_surface_takedown(struct gl_context *ctx)
> }
>
> GLboolean
> -nv04_surface_init(struct gl_context *ctx)
> +nouveau_surface_init(struct gl_context *ctx)
> {
> struct nouveau_pushbuf *push = context_push(ctx);
> struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
> @@ -673,6 +673,6 @@ nv04_surface_init(struct gl_context *ctx)
> return GL_TRUE;
>
> fail:
> - nv04_surface_takedown(ctx);
> + nouveau_surface_takedown(ctx);
> return GL_FALSE;
> }
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_surface.h b/src/mesa/drivers/dri/nouveau/nouveau_surface.h
> index 0a6fcb0..59c88f7 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_surface.h
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_surface.h
> @@ -56,20 +56,20 @@ nouveau_surface_ref(struct nouveau_surface *src,
> struct nouveau_surface *dst);
>
> GLboolean
> -nv04_surface_init(struct gl_context *ctx);
> +nouveau_surface_init(struct gl_context *ctx);
>
> void
> -nv04_surface_takedown(struct gl_context *ctx);
> +nouveau_surface_takedown(struct gl_context *ctx);
>
> void
> -nv04_surface_copy(struct gl_context *ctx,
> - struct nouveau_surface *dst, struct nouveau_surface *src,
> - int dx, int dy, int sx, int sy, int w, int h);
> +nouveau_surface_copy(struct gl_context *ctx,
> + struct nouveau_surface *dst, struct nouveau_surface *src,
> + int dx, int dy, int sx, int sy, int w, int h);
>
> void
> -nv04_surface_fill(struct gl_context *ctx,
> - struct nouveau_surface *dst,
> - unsigned mask, unsigned value,
> - int dx, int dy, int w, int h);
> +nouveau_surface_fill(struct gl_context *ctx,
> + struct nouveau_surface *dst,
> + unsigned mask, unsigned value,
> + int dx, int dy, int w, int h);
>
> #endif
> diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
> index 3cc219b..b93ebbc 100644
> --- a/src/mesa/drivers/dri/nouveau/nv04_context.c
> +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
> @@ -125,7 +125,7 @@ nv04_context_destroy(struct gl_context *ctx)
> {
> struct nouveau_context *nctx = to_nouveau_context(ctx);
>
> - nv04_surface_takedown(ctx);
> + nouveau_surface_takedown(ctx);
> nv04_render_destroy(ctx);
> nouveau_surface_ref(NULL, &to_nv04_context(ctx)->dummy_texture);
>
> @@ -166,7 +166,7 @@ nv04_context_create(struct nouveau_screen *screen, gl_api api,
> ctx->Const.MaxTextureLodBias = 15;
>
> /* 2D engine. */
> - ret = nv04_surface_init(ctx);
> + ret = nouveau_surface_init(ctx);
> if (!ret)
> goto fail;
>
> @@ -203,8 +203,8 @@ fail:
> const struct nouveau_driver nv04_driver = {
> .context_create = nv04_context_create,
> .context_destroy = nv04_context_destroy,
> - .surface_copy = nv04_surface_copy,
> - .surface_fill = nv04_surface_fill,
> + .surface_copy = nouveau_surface_copy,
> + .surface_fill = nouveau_surface_fill,
> .emit = (nouveau_state_func[]) {
> nv04_defer_control,
> nouveau_emit_nothing,
> diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
> index 7a86ba2..cf63742 100644
> --- a/src/mesa/drivers/dri/nouveau/nv10_context.c
> +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
> @@ -416,7 +416,7 @@ nv10_context_destroy(struct gl_context *ctx)
> {
> struct nouveau_context *nctx = to_nouveau_context(ctx);
>
> - nv04_surface_takedown(ctx);
> + nouveau_surface_takedown(ctx);
> nv10_swtnl_destroy(ctx);
> nv10_vbo_destroy(ctx);
>
> @@ -466,7 +466,7 @@ nv10_context_create(struct nouveau_screen *screen, gl_api api,
> ctx->Driver.Clear = nv10_clear;
>
> /* 2D engine. */
> - ret = nv04_surface_init(ctx);
> + ret = nouveau_surface_init(ctx);
> if (!ret)
> goto fail;
>
> @@ -497,8 +497,8 @@ fail:
> const struct nouveau_driver nv10_driver = {
> .context_create = nv10_context_create,
> .context_destroy = nv10_context_destroy,
> - .surface_copy = nv04_surface_copy,
> - .surface_fill = nv04_surface_fill,
> + .surface_copy = nouveau_surface_copy,
> + .surface_fill = nouveau_surface_fill,
> .emit = (nouveau_state_func[]) {
> nv10_emit_alpha_func,
> nv10_emit_blend_color,
> diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
> index ec638c0..bc58e8f 100644
> --- a/src/mesa/drivers/dri/nouveau/nv20_context.c
> +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
> @@ -427,7 +427,7 @@ nv20_context_destroy(struct gl_context *ctx)
> {
> struct nouveau_context *nctx = to_nouveau_context(ctx);
>
> - nv04_surface_takedown(ctx);
> + nouveau_surface_takedown(ctx);
> nv20_swtnl_destroy(ctx);
> nv20_vbo_destroy(ctx);
>
> @@ -476,7 +476,7 @@ nv20_context_create(struct nouveau_screen *screen, gl_api api,
> ctx->Driver.Clear = nv20_clear;
>
> /* 2D engine. */
> - ret = nv04_surface_init(ctx);
> + ret = nouveau_surface_init(ctx);
> if (!ret)
> goto fail;
>
> @@ -505,8 +505,8 @@ fail:
> const struct nouveau_driver nv20_driver = {
> .context_create = nv20_context_create,
> .context_destroy = nv20_context_destroy,
> - .surface_copy = nv04_surface_copy,
> - .surface_fill = nv04_surface_fill,
> + .surface_copy = nouveau_surface_copy,
> + .surface_fill = nouveau_surface_fill,
> .emit = (nouveau_state_func[]) {
> nv10_emit_alpha_func,
> nv10_emit_blend_color,
> --
> 2.7.4
>
More information about the mesa-dev
mailing list