Skip to contentSkip to conversation

nouveau/vieux: only advertise supported texture formats

PATCH In review Lucas Stach 5 participants 7 messages Apr 30, 2012 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau/vieux: only advertise supported texture formats

Fixes an assertion seen by users.

Tested-by JohnDoe_71Rus on irc
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    9 +++++++++
 1 file changed, 9 insertions(+)
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
index 4845767..46c0d70 100644
@@ -117,6 +117,15 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nouveau_span_functions_init(ctx);
 	_mesa_allow_light_in_model(ctx, GL_FALSE);
 
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+
 	/* Allocate a hardware channel. */
 	ret = nouveau_object_new(&context_dev(ctx)->object, 0xbeef0000,
 				 NOUVEAU_FIFO_CHANNEL_CLASS,
Signature · 1 line
1.7.10

A message that is not in the archive (sent off-list or not yet received): 1335806214-13903-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org

#2 lore raw
Quoted 15 lines · Lucas Stach

Fixes an assertion seen by users.

Tested-by JohnDoe_71Rus on irc
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    9 +++++++++
 1 file changed, 9 insertions(+)
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
index 4845767..46c0d70 100644
@@ -117,6 +117,15 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nouveau_span_functions_init(ctx);
 	_mesa_allow_light_in_model(ctx, GL_FALSE);

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 128

Quoted 10 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
 
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+

But it also seems to support ARGB1555, L8, A8 and I8, see nouveau_choose_tex_format ...

Quoted 3 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
 	/* Allocate a hardware channel. */
 	ret = nouveau_object_new(&context_dev(ctx)->object, 0xbeef0000,
 				 NOUVEAU_FIFO_CHANNEL_CLASS,

A message that is not in the archive (sent off-list or not yet received): 1335809942.9221.13.camel@tellur

#4 lore raw

And I managed to hit "reply privately" two times in a row. -.-

Am Montag, den 30.04.2012, 20:19 +0200 schrieb Lucas Stach:

Quoted 49 lines

Am Montag, den 30.04.2012, 19:54 +0200 schrieb Christoph Bumiller:

Quoted 17 lines · Lucas Stach
Quoted 16 lines

Fixes an assertion seen by users.

Tested-by JohnDoe_71Rus on irc
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    9 +++++++++
 1 file changed, 9 insertions(+)
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
index 4845767..46c0d70 100644
@@ -117,6 +117,15 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nouveau_span_functions_init(ctx);
 	_mesa_allow_light_in_model(ctx, GL_FALSE);
 
Quoted 12 lines

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 128

Quoted 9 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+

But it also seems to support ARGB1555, L8, A8 and I8, see nouveau_choose_tex_format ...

Right, but I have no idea if we are able to render to those formats, which seems unlikely. Sadly I see no way to specify a texture format only for sampling in TextureFormatSupported, that's why I opted for the safe option here. We may have to revisit this at the latest when considering the S3TC work.

In any case this patch fixes an actual problem, which breaks every application that doesn't by luck choose one of the safe formats, so I would really like to see this patch pushed, even if it's only a stop gap.

-- Lucas

Quoted 5 lines
Quoted 4 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
 	/* Allocate a hardware channel. */
 	ret = nouveau_object_new(&context_dev(ctx)->object, 0xbeef0000,
 				 NOUVEAU_FIFO_CHANNEL_CLASS,
#5 lore raw
In reply to Lucas Stach
Quoted 15 lines · Lucas Stach

Fixes an assertion seen by users.

Tested-by JohnDoe_71Rus on irc
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    9 +++++++++
 1 file changed, 9 insertions(+)
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
index 4845767..46c0d70 100644
@@ -117,6 +117,15 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nouveau_span_functions_init(ctx);
 	_mesa_allow_light_in_model(ctx, GL_FALSE);

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 128

Quoted 10 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
 
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+

Hi Lucas,

It's not obvious to me how this works. AFAIK nouveau doesn't make use of this array. And even if it did, the texture formats you're listing aren't the supported ones.

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 131

Quoted 3 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
 	/* Allocate a hardware channel. */
 	ret = nouveau_object_new(&context_dev(ctx)->object, 0xbeef0000,
 				 NOUVEAU_FIFO_CHANNEL_CLASS,

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

A message that is not in the archive (sent off-list or not yet received): 1335810158.9221.16.camel@tellur

#7 lore raw

And I managed to hit "reply privately" two times in a row. -.-

Am Montag, den 30.04.2012, 20:22 +0200 schrieb Lucas Stach:

Quoted 50 lines

Am Montag, den 30.04.2012, 20:08 +0200 schrieb Francisco Jerez:

Quoted 29 lines
Quoted 15 lines · Lucas Stach

Fixes an assertion seen by users.

Tested-by JohnDoe_71Rus on irc
---
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    9 +++++++++
 1 file changed, 9 insertions(+)
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
index 4845767..46c0d70 100644
@@ -117,6 +117,15 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
 	nouveau_span_functions_init(ctx);
 	_mesa_allow_light_in_model(ctx, GL_FALSE);

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 128

Quoted 10 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
 
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+

Hi Lucas,

Quoted 3 lines

It's not obvious to me how this works. AFAIK nouveau doesn't make use of this array. And even if it did, the texture formats you're listing aren't the supported ones.

Hello Francisco,

The core mesa code decides what texture formats to advertise based on this array. And obviously someone thought it would be a good idea to init this array to "everything supported" if the driver doesn't overrides this.

I opted to only advertise renderable texture formats, for reasons explained in my mail a minute ago.

-- Lucas

Quoted 4 lines
Quoted 4 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +0 -0
 	/* Allocate a hardware channel. */
 	ret = nouveau_object_new(&context_dev(ctx)->object, 0xbeef0000,
 				 NOUVEAU_FIFO_CHANNEL_CLASS,
#8 lore raw
In reply to a message not in the archive
Quoted 14 lines · Lucas Stach

Am Montag, den 30.04.2012, 20:08 +0200 schrieb Francisco Jerez:

Quoted 13 lines

Lucas Stach <[email protected]> writes:
[...]

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 128

Quoted 9 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+

Hi Lucas,

Quoted 8 lines
Quoted 3 lines

It's not obvious to me how this works. AFAIK nouveau doesn't make use of this array. And even if it did, the texture formats you're listing aren't the supported ones.

Hello Francisco,

The core mesa code decides what texture formats to advertise based on this array.

Are you sure? TextureFormatSupported doesn't seem to have any effect except in drivers that use mesa's default for the ChooseTextureFormat hook.

Quoted 6 lines

And obviously someone thought it would be a good idea to init this array to "everything supported" if the driver doesn't overrides this.

I opted to only advertise renderable texture formats, for reasons explained in my mail a minute ago.

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Am Montag, den 30.04.2012, 21:42 +0200 schrieb Francisco Jerez:

Quoted 20 lines
Quoted 18 lines · Lucas Stach

Am Montag, den 30.04.2012, 20:08 +0200 schrieb Francisco Jerez:

Quoted 16 lines

Lucas Stach <[email protected]> writes:
[...]

src/mesa/drivers/dri/nouveau/nouveau_context.c nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, · line 128

Quoted 9 lines
src/mesa/drivers/dri/nouveau/nouveau_context.c +9 -0
+	/* only advertise supported texture formats */
+	memset(&ctx->TextureFormatSupported, 0,
+	       sizeof(ctx->TextureFormatSupported));
+	ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+	ctx->TextureFormatSupported[MESA_FORMAT_Z24_S8] = true;
+

Hi Lucas,

It's not obvious to me how this works. AFAIK nouveau doesn't make use of this array. And even if it did, the texture formats you're listing aren't the supported ones.

Quoted 8 lines
Quoted 4 lines

Hello Francisco,

The core mesa code decides what texture formats to advertise based on this array.

Are you sure? TextureFormatSupported doesn't seem to have any effect except in drivers that use mesa's default for the ChooseTextureFormat hook.

I'm not able to test it myself, as I don't have any vieux hardware, but I made sure that the patch got tested by the reporter of the bug [1], before posting it to the list.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=49148

Quoted 7 lines
Quoted 7 lines

And obviously someone thought it would be a good idea to init this array to "everything supported" if the driver doesn't overrides this.

I opted to only advertise renderable texture formats, for reasons explained in my mail a minute ago.