Re: [Mesa-dev] [PATCH 9/9] nouveau: s/nv04_surface_/nouveau_surface_/

2017-05-19 Thread Francisco Jerez
Ilia Mirkin  writes:

> 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?
>

My intention here (and in most of the dri/nouveau driver codebase) was
to reserve the nouveau_ prefix for source files and functions managing
driver-wide hardware-independent data structures, and the nvXX_ prefixes
for the source files doing the actual hardware poking for generation
nvXX and later.  Does this explanation make the current split between
nv04_ and nouveau_surface seem more reasonable to you, Ian?

> On Fri, May 19, 2017 at 9:38 AM, Ian Romanick  wrote:
>> From: Ian Romanick 
>>
>> After moving the contents of nv04_surface.c to nouveau_surface.c, rename
>> all the functions.
>>
>> Signed-off-by: Ian Romanick 
>> Cc: Ilia Mirkin 
>> ---
>>  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,
>> + 

Re: [Mesa-dev] [PATCH 9/9] nouveau: s/nv04_surface_/nouveau_surface_/

2017-05-19 Thread Ilia Mirkin
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  wrote:
> From: Ian Romanick 
>
> After moving the contents of nv04_surface.c to nouveau_surface.c, rename
> all the functions.
>
> Signed-off-by: Ian Romanick 
> Cc: Ilia Mirkin 
> ---
>  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, 

[Mesa-dev] [PATCH 9/9] nouveau: s/nv04_surface_/nouveau_surface_/

2017-05-19 Thread Ian Romanick
From: Ian Romanick 

After moving the contents of nv04_surface.c to nouveau_surface.c, rename
all the functions.

Signed-off-by: Ian Romanick 
Cc: Ilia Mirkin 
---
 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