Skip to contentSkip to conversation

texture dimension limits in ddx

DISCUSSION Xavier Chantry 2 participants 3 messages Feb 9, 2010 – Feb 10, 2010 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

in nv10_exa.c :
check_texture does :

       if (w > 2046 || h > 2046)
                NOUVEAU_FALLBACK("picture too large, %dx%d\n", w, h);
check_render_target does :
        if (w > 4096 || h > 4096)
                return FALSE;

So we have different size limits for the source and the destination ?

Another thing is that nv20 uses nv10_exa.c code, and the limit in check_texture could be increased for nv20 according to curro :
01:03 < curro_> shining: btw, about the 2048x2048 fallback, i'm quite sure it's wrong for nv2x
01:05 < curro_> shining: it can do 4096x4096 with no problems, IIRC

And finally I saw that nouveau_exa_init does this :

       if (pNv->Architecture >= NV_ARCH_50) {
                exa->maxX = 8192;
                exa->maxY = 8192;
        } else
        if (pNv->Architecture >= NV_ARCH_20) {
                exa->maxX = 4096;
                exa->maxY = 4096;
        } else {
                exa->maxX = 2048;
                exa->maxY = 2048;
        }

But these 3 values are hardcoded everywhere in the code.
It might not be possible to use exa->maxX/Y directly as some functions like check_texture / check_render_target above don't seem to have access to them.
Maybe some constants could be defined instead and used everywhere ? #define NV04_MAX 2048
#define NV20_MAX 4096
#define NV50_MAX 8192
or something.

#2 lore raw
In reply to a message not in the archive
Quoted 29 lines · Xavier Chantry

in nv10_exa.c :
check_texture does :
      if (w > 2046 || h > 2046)
               NOUVEAU_FALLBACK("picture too large, %dx%d\n", w, h); check_render_target does :
       if (w > 4096 || h > 4096)
               return FALSE;

So we have different size limits for the source and the destination ?

Another thing is that nv20 uses nv10_exa.c code, and the limit in check_texture could be increased for nv20 according to curro :
01:03 < curro_> shining: btw, about the 2048x2048 fallback, i'm quite sure it's wrong for nv2x
01:05 < curro_> shining: it can do 4096x4096 with no problems, IIRC

And finally I saw that nouveau_exa_init does this :
      if (pNv->Architecture >= NV_ARCH_50) { exa->maxX = 8192;
               exa->maxY = 8192;
       } else
       if (pNv->Architecture >= NV_ARCH_20) { exa->maxX = 4096;
               exa->maxY = 4096;
       } else {
               exa->maxX = 2048;
               exa->maxY = 2048;
       }

Quoted 10 lines

But these 3 values are hardcoded everywhere in the code.
It might not be possible to use exa->maxX/Y directly as some functions like check_texture / check_render_target above don't seem to have access to them.
Maybe some constants could be defined instead and used everywhere ? #define NV04_MAX 2048
#define NV20_MAX 4096
#define NV50_MAX 8192
or something.

Or to put this another way, I would like to give a name to all the values below. Actually nouveau_xv.c already defines some constants, but I have no idea if it would make any sense to use them in the other source files.

src/nouveau_exa.c: exa->maxX = 8192;
src/nouveau_exa.c: exa->maxY = 8192;
src/nouveau_exa.c: exa->maxX = 4096;
src/nouveau_exa.c: exa->maxY = 4096;
src/nouveau_exa.c: exa->maxX = 2048;
src/nouveau_exa.c: exa->maxY = 2048;
src/nouveau_xv.c:#define IMAGE_MAX_W 2046
src/nouveau_xv.c:#define IMAGE_MAX_H 2046
src/nouveau_xv.c:#define TEX_IMAGE_MAX_W 4096
src/nouveau_xv.c:#define TEX_IMAGE_MAX_H 4096

src/nv10_exa.c:	if (w > 2046 || h > 2046)
src/nv10_exa.c:	if (w > 4096 || h > 4096)

src/nv30_exa.c: if ((w > 4096) || (h > 4096))
src/nv30_exa.c: int w=4096;
src/nv30_exa.c: int h=4096;
src/nv30_exa.c: int pitch=4096*4;
src/nv30_xv_tex.c: if (drw_w > 4096 || drw_h > 4096) {
src/nv40_exa.c: if ((w > 4096) || (h > 4096))
src/nv40_xv_tex.c: if (drw_w > 4096 || drw_h > 4096) {
src/nv50_exa.c: if (ppict->pDrawable->width > 8192 ||
src/nv50_exa.c: ppict->pDrawable->height > 8192)
src/nv50_exa.c: if (ppict->pDrawable->width > 8192 ||
src/nv50_exa.c: ppict->pDrawable->height > 8192)
src/vl_hwmc.c: 2048,
src/vl_hwmc.c: 2048,
src/vl_hwmc.c: 2048,
src/vl_hwmc.c: 2048,

#4 lore raw
In reply to a message not in the archive
Quoted 64 lines · Xavier Chantry
Quoted 29 lines · Xavier Chantry

in nv10_exa.c :
check_texture does :

      if (w > 2046 || h > 2046)
               NOUVEAU_FALLBACK("picture too large, %dx%d\n", w, h);
check_render_target does :
       if (w > 4096 || h > 4096)
               return FALSE;

So we have different size limits for the source and the destination ?

Another thing is that nv20 uses nv10_exa.c code, and the limit in check_texture could be increased for nv20 according to curro :
01:03 < curro_> shining: btw, about the 2048x2048 fallback, i'm quite sure it's wrong for nv2x
01:05 < curro_> shining: it can do 4096x4096 with no problems, IIRC

And finally I saw that nouveau_exa_init does this :

      if (pNv->Architecture >= NV_ARCH_50) {
               exa->maxX = 8192;
               exa->maxY = 8192;
       } else
       if (pNv->Architecture >= NV_ARCH_20) {
               exa->maxX = 4096;
               exa->maxY = 4096;
       } else {
               exa->maxX = 2048;
               exa->maxY = 2048;
       }
Quoted 10 lines

But these 3 values are hardcoded everywhere in the code.
It might not be possible to use exa->maxX/Y directly as some functions like check_texture / check_render_target above don't seem to have access to them.
Maybe some constants could be defined instead and used everywhere ? #define NV04_MAX 2048
#define NV20_MAX 4096
#define NV50_MAX 8192
or something.

Or to put this another way, I would like to give a name to all the values below. Actually nouveau_xv.c already defines some constants, but I have no idea if it would make any sense to use them in the other source files.

src/nouveau_exa.c:              exa->maxX = 8192;
src/nouveau_exa.c:              exa->maxY = 8192;
src/nouveau_exa.c:              exa->maxX = 4096;
src/nouveau_exa.c:              exa->maxY = 4096;
src/nouveau_exa.c:              exa->maxX = 2048;
src/nouveau_exa.c:              exa->maxY = 2048;

src/nouveau_xv.c:#define IMAGE_MAX_W 2046
src/nouveau_xv.c:#define IMAGE_MAX_H 2046
src/nouveau_xv.c:#define TEX_IMAGE_MAX_W 4096
src/nouveau_xv.c:#define TEX_IMAGE_MAX_H 4096

src/nv10_exa.c: if (w > 2046 || h > 2046)
src/nv10_exa.c: if (w > 4096 || h > 4096)
src/nv30_exa.c: if ((w > 4096) || (h > 4096))
src/nv30_exa.c: int w=4096;
src/nv30_exa.c: int h=4096;
src/nv30_exa.c: int pitch=4096*4;
src/nv30_xv_tex.c:      if (drw_w > 4096 || drw_h > 4096) {
src/nv40_exa.c: if ((w > 4096) || (h > 4096))
src/nv40_xv_tex.c:      if (drw_w > 4096 || drw_h > 4096) {
Quoted 8 lines
src/nv50_exa.c: if (ppict->pDrawable->width > 8192 ||
src/nv50_exa.c:     ppict->pDrawable->height > 8192)
src/nv50_exa.c: if (ppict->pDrawable->width > 8192 ||
src/nv50_exa.c:     ppict->pDrawable->height > 8192)
src/vl_hwmc.c:  2048,
src/vl_hwmc.c:  2048,
src/vl_hwmc.c:  2048,
src/vl_hwmc.c:  2048,

It makes sense to clean this up if you're up to it. Some are max texture sizes and others are max render target sizes like you said. If you can figure out the limits of the various HW classes you can substitute them into the code. Just remember, if a surface is both a texture and a render target you'll have to use the smaller of the two limits.

Maybe it makes sense to add it to nouveau_class.h if it's not already there in some form so it can be used everywhere.

The value in vl_hwmc.c is for XvMC surfaces, which are used both as textures and RTs and I just chose the a small reasonable value, it's not based on any HW limits.