diff options
48 files changed, 761 insertions, 855 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..c71c0cf72ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*~ +*.a +*.o +*.so +depend +depend.bak +lib +lib64 diff --git a/configs/.gitignore b/configs/.gitignore new file mode 100644 index 00000000000..5b9023a315a --- /dev/null +++ b/configs/.gitignore @@ -0,0 +1 @@ +current diff --git a/docs/lists.html b/docs/lists.html index 76ebf32c3fe..0ff1650f558 100644 --- a/docs/lists.html +++ b/docs/lists.html @@ -9,47 +9,52 @@ <H1>Mailing Lists</H1> -<p>There are four Mesa mailing lists:</p> +<p>There are four Mesa mailing lists: +</p> + <ul> -<li><b>mesa3d-users</b> - intended for users of the Mesa library. -Newbie questions are appropriate, but please try reading the Mesa documentation first. -</li><li><b>mesa3d-dev</b> - intended for developers of the Mesa library. -This is not for beginners. -</li><li><b>mesa3d-cvs</b> - CVS check-in messages are sent to this list. -This is useful for tracking ongoing development changes. -</li><li><b>mesa3d-announce</b> - announcements of new Mesa versions are sent to this list. -</li></ul> +<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-announce" +target="_parent">mesa3d-announce</a> - announcements of new Mesa +versions are sent to this list. +</li> +<br> +<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users" +target="_parent">mesa3d-users</a> - intended for users of the Mesa library. +Newbie questions are appropriate, but please try the general OpenGL +resources and Mesa documentation first. +</li> +<br> +<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev" +target="_parent">mesa3d-dev</a> - for discussion of Mesa development. +Not for beginners. +</li> +<br> +<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit" +target="_parent">mesa-commit</a> - relays git check-in messages +(for developers). +</li> +</ul> -<p> -To subscribe or unsubscribe, go to the -<a href="http://www.sourceforge.net/mail/?group_id=3" target="_parent"> -SourceForge lists page.</a> -</p> +<p>Note: the old mesa3d-cvs list is no longer in use.</p> -<p>The mailing lists are managed by SourceForge. If you're having trouble -with the mailing lists please contact the SourceForge administrators for help.</p> +<br> -<p>Archives of the old Mesa mailing list which was hosted by unicamp.br -are available <a href="http://groups.yahoo.com/group/mesa/messages/" -target="_parent">here</a>.</p> +<H1>OpenGL Forums</H1> <p> Here are some other OpenGL-related forums you might find useful: </p> -<p> -Usenet newsgroups: <ul> -<li>comp.graphics.algorithms -<li>comp.graphics.api.opengl -<li>comp.os.linux.x +<li><a href="http://www.opengl.org/cgi-bin/ubb/ultimatebb.cgi" +target="_parent">OpenGL discussion forums</A> at www.opengl.org</li> +<li>Usenet newsgroups: +<ul> +<li>comp.graphics.algorithms</li> +<li>comp.graphics.api.opengl</li> +<li>comp.os.linux.x</li> +</ul> </ul> -</p> - -<p> -<a href="http://www.opengl.org/" target="_parent">OpenGL discussion forums</A> -at www.opengl.org -</p> </HTML> </BODY> diff --git a/doxygen/.cvsignore b/doxygen/.gitignore index 1b0edf90a6d..1b0edf90a6d 100644 --- a/doxygen/.cvsignore +++ b/doxygen/.gitignore diff --git a/progs/demos/.cvsignore b/progs/demos/.gitignore index f764b3d117e..f764b3d117e 100644 --- a/progs/demos/.cvsignore +++ b/progs/demos/.gitignore diff --git a/progs/redbook/.cvsignore b/progs/redbook/.gitignore index 8ed3efe3e23..8ed3efe3e23 100644 --- a/progs/redbook/.cvsignore +++ b/progs/redbook/.gitignore diff --git a/progs/samples/.cvsignore b/progs/samples/.gitignore index 12b0650567b..12b0650567b 100644 --- a/progs/samples/.cvsignore +++ b/progs/samples/.gitignore diff --git a/progs/tests/.cvsignore b/progs/tests/.gitignore index 2c0e16c35ec..2c0e16c35ec 100644 --- a/progs/tests/.cvsignore +++ b/progs/tests/.gitignore diff --git a/progs/xdemos/.cvsignore b/progs/xdemos/.gitignore index 4adffda2d1e..4adffda2d1e 100644 --- a/progs/xdemos/.cvsignore +++ b/progs/xdemos/.gitignore diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile index 4ca8b107a24..ec85464bec0 100644 --- a/progs/xdemos/Makefile +++ b/progs/xdemos/Makefile @@ -24,11 +24,11 @@ PROGS = glthreads \ pbinfo \ pbdemo \ wincopy \ - xdemo \ xfont \ xrotfontdemo \ yuvrect_client +# omit this XMesa API demo: xdemo ##### RULES ##### diff --git a/progs/xdemos/glthreads.c b/progs/xdemos/glthreads.c index 83413383dd4..989697fbcaa 100644 --- a/progs/xdemos/glthreads.c +++ b/progs/xdemos/glthreads.c @@ -473,7 +473,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(displayName); if (!dpy) { - fprintf(stderr, "Unable to open display %s\n", displayName); + fprintf(stderr, "Unable to open display %s\n", XDisplayName(displayName)); return -1; } } diff --git a/progs/xdemos/glxcontexts.c b/progs/xdemos/glxcontexts.c index fbc296ef625..a9ff326ed5e 100644 --- a/progs/xdemos/glxcontexts.c +++ b/progs/xdemos/glxcontexts.c @@ -587,8 +587,8 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", - dpyName ? dpyName : getenv("DISPLAY")); + fprintf(stderr, "Error: couldn't open display %s\n", + XDisplayName(dpyName)); return -1; } diff --git a/progs/xdemos/glxgears_fbconfig.c b/progs/xdemos/glxgears_fbconfig.c index acbadd21ac5..2dac00b75d1 100644 --- a/progs/xdemos/glxgears_fbconfig.c +++ b/progs/xdemos/glxgears_fbconfig.c @@ -575,7 +575,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); return -1; } diff --git a/progs/xdemos/glxheads.c b/progs/xdemos/glxheads.c index 0145a70e91c..b3290e90d51 100644 --- a/progs/xdemos/glxheads.c +++ b/progs/xdemos/glxheads.c @@ -57,7 +57,7 @@ static int NumHeads = 0; static void Error(const char *display, const char *msg) { - fprintf(stderr, "Error on display %s - %s\n", display, msg); + fprintf(stderr, "Error on display %s - %s\n", XDisplayName(display), msg); exit(1); } diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c index fdd1c0523f6..3e8e0be5203 100644 --- a/progs/xdemos/glxinfo.c +++ b/progs/xdemos/glxinfo.c @@ -456,7 +456,19 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits) } printf("display: %s screen: %d\n", displayName, scrnum); free(displayName); - printf("direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No"); + printf("direct rendering: "); + if (glXIsDirect(dpy, ctx)) { + printf("Yes\n"); + } else { + if (!allowDirect) { + printf("No (-i specified)\n"); + } else if (getenv("LIBGL_ALWAYS_INDIRECT")) { + printf("No (LIBGL_ALWAYS_INDIRECT set)\n"); + } else { + printf("No (If you want to find out why, try setting " + "LIBGL_DEBUG=verbose)\n"); + } + } printf("server glx vendor string: %s\n", serverVendor); printf("server glx version string: %s\n", serverVersion); printf("server glx extensions:\n"); @@ -927,7 +939,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(displayName); if (!dpy) { - fprintf(stderr, "Error: unable to open display %s\n", displayName); + fprintf(stderr, "Error: unable to open display %s\n", XDisplayName(displayName)); return -1; } diff --git a/progs/xdemos/glxswapcontrol.c b/progs/xdemos/glxswapcontrol.c index 0ed5ebe4722..d9be984be57 100644 --- a/progs/xdemos/glxswapcontrol.c +++ b/progs/xdemos/glxswapcontrol.c @@ -749,7 +749,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); return -1; } diff --git a/progs/xdemos/manywin.c b/progs/xdemos/manywin.c index c9cca751341..cfea555210a 100644 --- a/progs/xdemos/manywin.c +++ b/progs/xdemos/manywin.c @@ -59,7 +59,7 @@ static GLuint TexObj = 0; static void Error(const char *display, const char *msg) { - fprintf(stderr, "Error on display %s - %s\n", display, msg); + fprintf(stderr, "Error on display %s - %s\n", XDisplayName(display), msg); exit(1); } diff --git a/progs/xdemos/opencloseopen.c b/progs/xdemos/opencloseopen.c index 2e4de24c71d..0b8d0618431 100644 --- a/progs/xdemos/opencloseopen.c +++ b/progs/xdemos/opencloseopen.c @@ -91,7 +91,7 @@ make_window( const char * dpyName, const char *name, dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); exit(1); } diff --git a/progs/xdemos/pbinfo.c b/progs/xdemos/pbinfo.c index 88d93c8da62..b43adf1bb70 100644 --- a/progs/xdemos/pbinfo.c +++ b/progs/xdemos/pbinfo.c @@ -95,7 +95,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { - printf("Error: couldn't open display %s\n", dpyName ? dpyName : ":0"); + printf("Error: couldn't open display %s\n", XDisplayName(dpyName)); return 1; } diff --git a/progs/xdemos/yuvrect_client.c b/progs/xdemos/yuvrect_client.c index 48f82cb7599..e2b79a7c0e1 100644 --- a/progs/xdemos/yuvrect_client.c +++ b/progs/xdemos/yuvrect_client.c @@ -296,7 +296,7 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(dpyName); if (!dpy) { printf("Error: couldn't open display %s\n", - dpyName ? dpyName : getenv("DISPLAY")); + XDisplayName(dpyName)); return -1; } diff --git a/src/glx/x11/.gitignore b/src/glx/x11/.gitignore new file mode 100644 index 00000000000..ffc14ab7660 --- /dev/null +++ b/src/glx/x11/.gitignore @@ -0,0 +1 @@ +glcontextmodes.c diff --git a/src/mesa/.gitignore b/src/mesa/.gitignore new file mode 100644 index 00000000000..b83498b1d9d --- /dev/null +++ b/src/mesa/.gitignore @@ -0,0 +1,2 @@ +*/gen_matypes +*/matypes.h diff --git a/src/mesa/drivers/dri/common/xmlpool/.gitignore b/src/mesa/drivers/dri/common/xmlpool/.gitignore new file mode 100644 index 00000000000..a5a437849ba --- /dev/null +++ b/src/mesa/drivers/dri/common/xmlpool/.gitignore @@ -0,0 +1,5 @@ +de +es +fr +nl +sv diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile b/src/mesa/drivers/dri/common/xmlpool/Makefile index ef94541c374..b077809cd18 100644 --- a/src/mesa/drivers/dri/common/xmlpool/Makefile +++ b/src/mesa/drivers/dri/common/xmlpool/Makefile @@ -41,7 +41,7 @@ # - info gettext # The set of supported languages. Add languages as needed. -POS=de.po es.po nl.po fr.po +POS=de.po es.po nl.po fr.po sv.po # # Don't change anything below, unless you know what you're doing. diff --git a/src/mesa/drivers/dri/common/xmlpool/options.h b/src/mesa/drivers/dri/common/xmlpool/options.h index 5cef72867b1..d5f4fc34917 100644 --- a/src/mesa/drivers/dri/common/xmlpool/options.h +++ b/src/mesa/drivers/dri/common/xmlpool/options.h @@ -58,7 +58,8 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(de,"Fehlersuche") \ DRI_CONF_DESC(es,"Depurando") \ DRI_CONF_DESC(nl,"Debuggen") \ - DRI_CONF_DESC(fr,"Debogage") + DRI_CONF_DESC(fr,"Debogage") \ + DRI_CONF_DESC(sv,"Felsökning") #define DRI_CONF_NO_RAST(def) \ DRI_CONF_OPT_BEGIN(no_rast,bool,def) \ @@ -67,6 +68,7 @@ DRI_CONF_OPT_BEGIN(no_rast,bool,def) \ DRI_CONF_DESC(es,"Desactivar aceleración 3D") \ DRI_CONF_DESC(nl,"3D versnelling uitschakelen") \ DRI_CONF_DESC(fr,"Désactiver l'accélération 3D") \ + DRI_CONF_DESC(sv,"Inaktivera 3D-accelerering") \ DRI_CONF_OPT_END #define DRI_CONF_PERFORMANCE_BOXES(def) \ @@ -76,6 +78,7 @@ DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \ DRI_CONF_DESC(es,"Mostrar cajas de rendimiento") \ DRI_CONF_DESC(nl,"Laat prestatie boxjes zien") \ DRI_CONF_DESC(fr,"Afficher les boîtes de performance") \ + DRI_CONF_DESC(sv,"Visa prestandarutor") \ DRI_CONF_OPT_END @@ -86,7 +89,8 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(de,"Bildqualität") \ DRI_CONF_DESC(es,"Calidad de imagen") \ DRI_CONF_DESC(nl,"Beeldkwaliteit") \ - DRI_CONF_DESC(fr,"Qualité d'image") + DRI_CONF_DESC(fr,"Qualité d'image") \ + DRI_CONF_DESC(sv,"Bildkvalitet") #define DRI_CONF_EXCESS_MIPMAP(def) \ DRI_CONF_OPT_BEGIN(excess_mipmap,bool,def) \ @@ -129,6 +133,12 @@ DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \ DRI_CONF_ENUM(2,"Prérérer 16 bits par texel") \ DRI_CONF_ENUM(3,"Forcer 16 bits par texel") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Färgdjup för texturer") \ + DRI_CONF_ENUM(0,"Föredra färgdjupet för framebuffer") \ + DRI_CONF_ENUM(1,"Föredra 32 bitar per texel") \ + DRI_CONF_ENUM(2,"Föredra 16 bitar per texel") \ + DRI_CONF_ENUM(3,"Tvinga 16 bitar per texel") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_DEF_MAX_ANISOTROPY(def,range) \ @@ -138,6 +148,7 @@ DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \ DRI_CONF_DESC(es,"Valor máximo inicial para filtrado anisotrópico de textura") \ DRI_CONF_DESC(nl,"Initïele maximum waarde voor anisotrophische textuur filtering") \ DRI_CONF_DESC(fr,"Valeur maximale initiale pour le filtrage anisotropique de texture") \ + DRI_CONF_DESC(sv,"Initialt maximalt värde för anisotropisk texturfiltrering") \ DRI_CONF_OPT_END #define DRI_CONF_NO_NEG_LOD_BIAS(def) \ @@ -147,6 +158,7 @@ DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \ DRI_CONF_DESC(es,"Prohibir valores negativos de Nivel De Detalle (LOD) de texturas") \ DRI_CONF_DESC(nl,"Verbied negatief niveau detailonderscheid (LOD) van texturen") \ DRI_CONF_DESC(fr,"Interdire le LOD bias negatif") \ + DRI_CONF_DESC(sv,"Förbjud negativ LOD-kompensation för texturer") \ DRI_CONF_OPT_END #define DRI_CONF_FORCE_S3TC_ENABLE(def) \ @@ -156,6 +168,7 @@ DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \ DRI_CONF_DESC(es,"Activar la compresión de texturas S3TC incluso si el soporte por software no está disponible") \ DRI_CONF_DESC(nl,"Schakel S3TC textuurcompressie in, zelfs als softwareondersteuning niet aanwezig is") \ DRI_CONF_DESC(fr,"Activer la compression de texture S3TC même si le support logiciel est absent") \ + DRI_CONF_DESC(sv,"Aktivera S3TC-texturkomprimering även om programvarustöd saknas") \ DRI_CONF_OPT_END #define DRI_CONF_COLOR_REDUCTION_ROUND 0 @@ -182,6 +195,10 @@ DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \ DRI_CONF_ENUM(0,"Arrondir les valeurs de couleur") \ DRI_CONF_ENUM(1,"Tramer les couleurs") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Initial färgminskningsmetod") \ + DRI_CONF_ENUM(0,"Avrunda färger") \ + DRI_CONF_ENUM(1,"Utjämna färger") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_ROUND_TRUNC 0 @@ -208,6 +225,10 @@ DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \ DRI_CONF_ENUM(0,"Arrondi à l'inférieur") \ DRI_CONF_ENUM(1,"Arrondi au plus proche") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Färgavrundningsmetod") \ + DRI_CONF_ENUM(0,"Avrunda färdkomponenter nedåt") \ + DRI_CONF_ENUM(1,"Avrunda till närmsta färg") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_DITHER_XERRORDIFF 0 @@ -240,6 +261,11 @@ DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \ DRI_CONF_ENUM(1,"Diffusion d'erreur horizontale, réinitialisé pour chaque ligne") \ DRI_CONF_ENUM(2,"Tramage ordonné des couleurs") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Färgutjämningsmetod") \ + DRI_CONF_ENUM(0,"Horisontell felspridning") \ + DRI_CONF_ENUM(1,"Horisontell felspridning, återställ fel vid radbörjan") \ + DRI_CONF_ENUM(2,"Ordnad 2D-färgutjämning") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_FLOAT_DEPTH(def) \ @@ -249,6 +275,7 @@ DRI_CONF_OPT_BEGIN(float_depth,bool,def) \ DRI_CONF_DESC(es,"Búfer de profundidad en coma flotante") \ DRI_CONF_DESC(nl,"Dieptebuffer als commagetal") \ DRI_CONF_DESC(fr,"Z-buffer en virgule flottante") \ + DRI_CONF_DESC(sv,"Buffert för flytande punktdjup") \ DRI_CONF_OPT_END /** \brief Performance-related options */ @@ -258,7 +285,8 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(de,"Leistung") \ DRI_CONF_DESC(es,"Rendimiento") \ DRI_CONF_DESC(nl,"Prestatie") \ - DRI_CONF_DESC(fr,"Performance") + DRI_CONF_DESC(fr,"Performance") \ + DRI_CONF_DESC(sv,"Prestanda") #define DRI_CONF_TCL_SW 0 #define DRI_CONF_TCL_PIPELINED 1 @@ -296,6 +324,12 @@ DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \ DRI_CONF_ENUM(2,"Court-circuiter le pipeline TCL") \ DRI_CONF_ENUM(3,"Court-circuiter le pipeline TCL par une machine à états qui génère le codede TCL à la volée") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"TCL-läge (Transformation, Clipping, Lighting)") \ + DRI_CONF_ENUM(0,"Använd programvaru-TCL-rörledning") \ + DRI_CONF_ENUM(1,"Använd maskinvaru-TCL som första TCL-rörledningssteg") \ + DRI_CONF_ENUM(2,"Kringgå TCL-rörledningen") \ + DRI_CONF_ENUM(3,"Kringgå TCL-rörledningen med tillståndsbaserad maskinkod som direktgenereras") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_FTHROTTLE_BUSY 0 @@ -328,6 +362,11 @@ DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \ DRI_CONF_ENUM(1,"Attente utilisant usleep()") \ DRI_CONF_ENUM(2,"Utiliser les interruptions") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Metod för att begränsa renderingslatens") \ + DRI_CONF_ENUM(0,"Upptagen med att vänta på grafikhårdvaran") \ + DRI_CONF_ENUM(1,"Sov i korta intervall under väntan på grafikhårdvaran") \ + DRI_CONF_ENUM(2,"Låt grafikhårdvaran sända ut ett programvaruavbrott och sov") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_VBLANK_NEVER 0 @@ -366,6 +405,12 @@ DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \ DRI_CONF_ENUM(2,"Synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application") \ DRI_CONF_ENUM(3,"Toujours synchroniser avec le balayage vertical, l'application choisit l'intervalle minimal") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Synkronisering med vertikal uppdatering (växlingsintervall)") \ + DRI_CONF_ENUM(0,"Synkronisera aldrig med vertikal uppdatering, ignorera programmets val") \ + DRI_CONF_ENUM(1,"Initialt växlingsintervall 0, följ programmets val") \ + DRI_CONF_ENUM(2,"Initialt växlingsintervall 1, följ programmets val") \ + DRI_CONF_ENUM(3,"Synkronisera alltid med vertikal uppdatering, programmet väljer den minsta växlingsintervallen") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_HYPERZ_DISABLED 0 @@ -377,6 +422,7 @@ DRI_CONF_OPT_BEGIN(hyperz,bool,def) \ DRI_CONF_DESC(es,"Usar HyperZ para potenciar rendimiento") \ DRI_CONF_DESC(nl,"Gebruik HyperZ om de prestaties te verbeteren") \ DRI_CONF_DESC(fr,"Utiliser le HyperZ pour améliorer les performances") \ + DRI_CONF_DESC(sv,"Använd HyperZ för att maximera prestandan") \ DRI_CONF_OPT_END #define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \ @@ -386,6 +432,7 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \ DRI_CONF_DESC(es,"Número de unidades de textura usadas") \ DRI_CONF_DESC(nl,"Aantal textuureenheden in gebruik") \ DRI_CONF_DESC(fr,"Nombre d'unités de texture") \ + DRI_CONF_DESC(sv,"Antal använda texturenheter") \ DRI_CONF_OPT_END #define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \ @@ -415,6 +462,11 @@ DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \ DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \ DRI_CONF_ENUM(2,"Announce hardware limits") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Stöd för större texturer är inte garanterat att passa i grafikminnet") \ + DRI_CONF_ENUM(0,"Nej") \ + DRI_CONF_ENUM(1,"Åtminstone en textur måste passa för antaget sämsta förhållande") \ + DRI_CONF_ENUM(2,"Annonsera hårdvarubegränsningar") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \ @@ -424,6 +476,7 @@ DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \ DRI_CONF_DESC(es,"Calidad de filtrado de textura vs. velocidad, alias filtrado ”brilinear“ de textura") \ DRI_CONF_DESC(nl,"Textuurfilterkwaliteit versus -snelheid, ookwel bekend als “brilineaire” textuurfiltering") \ DRI_CONF_DESC(fr,"Qualité/performance du filtrage trilinéaire de texture (filtrage brilinéaire)") \ + DRI_CONF_DESC(sv,"Texturfiltreringskvalitet mot hastighet, även kallad ”brilinear”-texturfiltrering") \ DRI_CONF_OPT_END #define DRI_CONF_TEXTURE_HEAPS_ALL 0 @@ -456,6 +509,11 @@ DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \ DRI_CONF_ENUM(1,"Utiliser uniquement la mémoire graphique (si disponible)") \ DRI_CONF_ENUM(2,"Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)") \ DRI_CONF_DESC_END \ + DRI_CONF_DESC_BEGIN(sv,"Använda typer av texturminne") \ + DRI_CONF_ENUM(0,"Allt tillgängligt minne") \ + DRI_CONF_ENUM(1,"Endast kortminne (om tillgängligt)") \ + DRI_CONF_ENUM(2,"Endast GART-minne (AGP/PCIE) (om tillgängligt)") \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END /* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program @@ -466,7 +524,8 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(de,"Funktionalität, die nicht hardwarebeschleunigt ist") \ DRI_CONF_DESC(es,"Características no aceleradas por hardware") \ DRI_CONF_DESC(nl,"Eigenschappen die niet hardwareversneld zijn") \ - DRI_CONF_DESC(fr,"Fonctionnalités ne bénéficiant pas d'une accélération matérielle") + DRI_CONF_DESC(fr,"Fonctionnalités ne bénéficiant pas d'une accélération matérielle") \ + DRI_CONF_DESC(sv,"Funktioner som inte är hårdvaruaccelererade") #define DRI_CONF_ARB_VERTEX_PROGRAM(def) \ DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \ @@ -475,6 +534,7 @@ DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \ DRI_CONF_DESC(es,"Activar la extensión GL_ARB_vertex_program") \ DRI_CONF_DESC(nl,"Zet uitbreiding GL_ARB_vertex_program aan") \ DRI_CONF_DESC(fr,"Activer l'extension GL_ARB_vertex_program") \ + DRI_CONF_DESC(sv,"Aktivera tillägget GL_ARB_vertex_program") \ DRI_CONF_OPT_END #define DRI_CONF_NV_VERTEX_PROGRAM(def) \ @@ -484,4 +544,5 @@ DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \ DRI_CONF_DESC(es,"Activar extensión GL_NV_vertex_program") \ DRI_CONF_DESC(nl,"Zet uitbreiding GL_NV_vertex_program aan") \ DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \ + DRI_CONF_DESC(sv,"Aktivera tillägget GL_NV_vertex_program") \ DRI_CONF_OPT_END diff --git a/src/mesa/drivers/dri/common/xmlpool/sv.po b/src/mesa/drivers/dri/common/xmlpool/sv.po new file mode 100644 index 00000000000..ba32b2ff15a --- /dev/null +++ b/src/mesa/drivers/dri/common/xmlpool/sv.po @@ -0,0 +1,226 @@ +# Swedish translation of DRI driver options. +# Copyright (C) Free Software Foundation, Inc. +# This file is distributed under the same license as the Mesa package. +# Daniel Nylander <[email protected]>, 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: Mesa DRI\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-04-11 23:19+0200\n" +"PO-Revision-Date: 2006-09-18 10:56+0100\n" +"Last-Translator: Daniel Nylander <[email protected]>\n" +"Language-Team: Swedish <[email protected]>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: t_options.h:53 +msgid "Debugging" +msgstr "Felsökning" + +#: t_options.h:57 +msgid "Disable 3D acceleration" +msgstr "Inaktivera 3D-accelerering" + +#: t_options.h:62 +msgid "Show performance boxes" +msgstr "Visa prestandarutor" + +#: t_options.h:69 +msgid "Image Quality" +msgstr "Bildkvalitet" + +#: t_options.h:77 +msgid "Texture color depth" +msgstr "Färgdjup för texturer" + +#: t_options.h:78 +msgid "Prefer frame buffer color depth" +msgstr "Föredra färgdjupet för framebuffer" + +#: t_options.h:79 +msgid "Prefer 32 bits per texel" +msgstr "Föredra 32 bitar per texel" + +#: t_options.h:80 +msgid "Prefer 16 bits per texel" +msgstr "Föredra 16 bitar per texel" + +#: t_options.h:81 +msgid "Force 16 bits per texel" +msgstr "Tvinga 16 bitar per texel" + +#: t_options.h:87 +msgid "Initial maximum value for anisotropic texture filtering" +msgstr "Initialt maximalt värde för anisotropisk texturfiltrering" + +#: t_options.h:92 +msgid "Forbid negative texture LOD bias" +msgstr "Förbjud negativ LOD-kompensation för texturer" + +#: t_options.h:97 +msgid "Enable S3TC texture compression even if software support is not available" +msgstr "Aktivera S3TC-texturkomprimering även om programvarustöd saknas" + +#: t_options.h:104 +msgid "Initial color reduction method" +msgstr "Initial färgminskningsmetod" + +#: t_options.h:105 +msgid "Round colors" +msgstr "Avrunda färger" + +#: t_options.h:106 +msgid "Dither colors" +msgstr "Utjämna färger" + +#: t_options.h:114 +msgid "Color rounding method" +msgstr "Färgavrundningsmetod" + +#: t_options.h:115 +msgid "Round color components downward" +msgstr "Avrunda färdkomponenter nedåt" + +#: t_options.h:116 +msgid "Round to nearest color" +msgstr "Avrunda till närmsta färg" + +#: t_options.h:125 +msgid "Color dithering method" +msgstr "Färgutjämningsmetod" + +#: t_options.h:126 +msgid "Horizontal error diffusion" +msgstr "Horisontell felspridning" + +#: t_options.h:127 +msgid "Horizontal error diffusion, reset error at line start" +msgstr "Horisontell felspridning, återställ fel vid radbörjan" + +#: t_options.h:128 +msgid "Ordered 2D color dithering" +msgstr "Ordnad 2D-färgutjämning" + +#: t_options.h:134 +msgid "Floating point depth buffer" +msgstr "Buffert för flytande punktdjup" + +#: t_options.h:140 +msgid "Performance" +msgstr "Prestanda" + +#: t_options.h:148 +msgid "TCL mode (Transformation, Clipping, Lighting)" +msgstr "TCL-läge (Transformation, Clipping, Lighting)" + +#: t_options.h:149 +msgid "Use software TCL pipeline" +msgstr "Använd programvaru-TCL-rörledning" + +#: t_options.h:150 +msgid "Use hardware TCL as first TCL pipeline stage" +msgstr "Använd maskinvaru-TCL som första TCL-rörledningssteg" + +#: t_options.h:151 +msgid "Bypass the TCL pipeline" +msgstr "Kringgå TCL-rörledningen" + +#: t_options.h:152 +msgid "Bypass the TCL pipeline with state-based machine code generated on-the-fly" +msgstr "Kringgå TCL-rörledningen med tillståndsbaserad maskinkod som direktgenereras" + +#: t_options.h:161 +msgid "Method to limit rendering latency" +msgstr "Metod för att begränsa renderingslatens" + +#: t_options.h:162 +msgid "Busy waiting for the graphics hardware" +msgstr "Upptagen med att vänta på grafikhårdvaran" + +#: t_options.h:163 +msgid "Sleep for brief intervals while waiting for the graphics hardware" +msgstr "Sov i korta intervall under väntan på grafikhårdvaran" + +#: t_options.h:164 +msgid "Let the graphics hardware emit a software interrupt and sleep" +msgstr "Låt grafikhårdvaran sända ut ett programvaruavbrott och sov" + +#: t_options.h:174 +msgid "Synchronization with vertical refresh (swap intervals)" +msgstr "Synkronisering med vertikal uppdatering (växlingsintervall)" + +#: t_options.h:175 +msgid "Never synchronize with vertical refresh, ignore application's choice" +msgstr "Synkronisera aldrig med vertikal uppdatering, ignorera programmets val" + +#: t_options.h:176 +msgid "Initial swap interval 0, obey application's choice" +msgstr "Initialt växlingsintervall 0, följ programmets val" + +#: t_options.h:177 +msgid "Initial swap interval 1, obey application's choice" +msgstr "Initialt växlingsintervall 1, följ programmets val" + +#: t_options.h:178 +msgid "Always synchronize with vertical refresh, application chooses the minimum swap interval" +msgstr "Synkronisera alltid med vertikal uppdatering, programmet väljer den minsta växlingsintervallen" + +#: t_options.h:186 +msgid "Use HyperZ to boost performance" +msgstr "Använd HyperZ för att maximera prestandan" + +#: t_options.h:191 +msgid "Number of texture units used" +msgstr "Antal använda texturenheter" + +#: t_options.h:196 +msgid "Support larger textures not guaranteed to fit into graphics memory" +msgstr "Stöd för större texturer är inte garanterat att passa i grafikminnet" + +#: t_options.h:197 +msgid "No" +msgstr "Nej" + +#: t_options.h:198 +msgid "At least 1 texture must fit under worst-case assumptions" +msgstr "Åtminstone en textur måste passa för antaget sämsta förhållande" + +#: t_options.h:199 +msgid "Announce hardware limits" +msgstr "Annonsera hårdvarubegränsningar" + +#: t_options.h:205 +msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering" +msgstr "Texturfiltreringskvalitet mot hastighet, även kallad \"brilinear\"-texturfiltrering" + +#: t_options.h:213 +msgid "Used types of texture memory" +msgstr "Använda typer av texturminne" + +#: t_options.h:214 +msgid "All available memory" +msgstr "Allt tillgängligt minne" + +#: t_options.h:215 +msgid "Only card memory (if available)" +msgstr "Endast kortminne (om tillgängligt)" + +#: t_options.h:216 +msgid "Only GART (AGP/PCIE) memory (if available)" +msgstr "Endast GART-minne (AGP/PCIE) (om tillgängligt)" + +#: t_options.h:224 +msgid "Features that are not hardware-accelerated" +msgstr "Funktioner som inte är hårdvaruaccelererade" + +#: t_options.h:228 +msgid "Enable extension GL_ARB_vertex_program" +msgstr "Aktivera tillägget GL_ARB_vertex_program" + +#: t_options.h:233 +msgid "Enable extension GL_NV_vertex_program" +msgstr "Aktivera tillägget GL_NV_vertex_program" + diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c index a6b32986233..1ded0b5417f 100644 --- a/src/mesa/drivers/dri/i915tex/intel_buffers.c +++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c @@ -36,6 +36,7 @@ #include "intel_batchbuffer.h" #include "context.h" #include "utils.h" +#include "drirenderbuffer.h" #include "framebuffer.h" #include "swrast/swrast.h" #include "vblank.h" @@ -183,6 +184,8 @@ void intelWindowMoved(struct intel_context *intel) { GLcontext *ctx = &intel->ctx; + __DRIdrawablePrivate *dPriv = intel->driDrawable; + GLframebuffer *drawFb = (GLframebuffer *) dPriv->driverPrivate; if (!intel->ctx.DrawBuffer) { /* when would this happen? -BP */ @@ -194,7 +197,7 @@ intelWindowMoved(struct intel_context *intel) } else { /* drawing to a window */ - switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) { + switch (drawFb->_ColorDrawBufferMask[0]) { case BUFFER_BIT_FRONT_LEFT: intelSetFrontClipRects(intel); break; @@ -207,14 +210,11 @@ intelWindowMoved(struct intel_context *intel) } } - /* this update Mesa's notion of window size */ - if (ctx->WinSysDrawBuffer) { - _mesa_resize_framebuffer(ctx, ctx->WinSysDrawBuffer, - intel->driDrawable->w, intel->driDrawable->h); - } + /* Update Mesa's notion of window size */ + driUpdateFramebufferSize(ctx, dPriv); + drawFb->Initialized = GL_TRUE; /* XXX remove someday */ - if (intel->intelScreen->driScrnPriv->ddxMinor >= 7 && intel->driDrawable) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; + if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) { drmI830Sarea *sarea = intel->sarea; drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w, .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h }; @@ -245,6 +245,9 @@ intelWindowMoved(struct intel_context *intel) /* Update hardware scissor */ ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, ctx->Scissor.Width, ctx->Scissor.Height); + + /* Re-calculate viewport related state */ + ctx->Driver.DepthRange( ctx, ctx->Viewport.Near, ctx->Viewport.Far ); } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a57c794834f..cac4d86d3ab 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -599,6 +599,7 @@ struct brw_context struct { struct brw_wm_prog_data *prog_data; + struct brw_wm_compile *compile_data; /* Input sizes, calculated from active vertex program: */ diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 6a6c4503c74..d5779680ffc 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -88,10 +88,10 @@ static void upload_drawing_rect(struct brw_context *brw) if (brw->intel.numClipRects > 1) return; - x1 = dPriv->x; - y1 = dPriv->y; - x2 = dPriv->x + dPriv->w; - y2 = dPriv->y + dPriv->h; + x1 = brw->intel.pClipRects[0].x1; + y1 = brw->intel.pClipRects[0].y1; + x2 = brw->intel.pClipRects[0].x2; + y2 = brw->intel.pClipRects[0].y2; if (x1 < 0) x1 = 0; if (y1 < 0) y1 = 0; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 3e2f2d06b81..0f842d289d7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -138,64 +138,75 @@ static void do_wm_prog( struct brw_context *brw, struct brw_fragment_program *fp, struct brw_wm_prog_key *key) { - struct brw_wm_compile c; + struct brw_wm_compile *c; const GLuint *program; GLuint program_size; - memset(&c, 0, sizeof(c)); - memcpy(&c.key, key, sizeof(*key)); + c = brw->wm.compile_data; + if (c == NULL) { + brw->wm.compile_data = calloc(1, sizeof(*brw->wm.compile_data)); + c = brw->wm.compile_data; + } else { + memset(c, 0, sizeof(*brw->wm.compile_data)); + } + memcpy(&c->key, key, sizeof(*key)); - c.fp = fp; - c.env_param = brw->intel.ctx.FragmentProgram.Parameters; + c->fp = fp; + c->env_param = brw->intel.ctx.FragmentProgram.Parameters; /* Augment fragment program. Add instructions for pre- and * post-fragment-program tasks such as interpolation and fogging. */ - brw_wm_pass_fp(&c); + brw_wm_pass_fp(c); /* Translate to intermediate representation. Build register usage * chains. */ - brw_wm_pass0(&c); + brw_wm_pass0(c); /* Dead code removal. */ - brw_wm_pass1(&c); + brw_wm_pass1(c); /* Hal optimization */ - brw_wm_pass_hal (&c); + brw_wm_pass_hal (c); /* Register allocation. */ - c.grf_limit = BRW_WM_MAX_GRF/2; + c->grf_limit = BRW_WM_MAX_GRF/2; /* This is where we start emitting gen4 code: */ - brw_init_compile(&c.func); + brw_init_compile(&c->func); - brw_wm_pass2(&c); + brw_wm_pass2(c); - c.prog_data.total_grf = c.max_wm_grf; - c.prog_data.total_scratch = c.last_scratch ? c.last_scratch + 0x40 : 0; + c->prog_data.total_grf = c->max_wm_grf; + if (c->last_scratch) { + c->prog_data.total_scratch = + c->last_scratch + 0x40; + } else { + c->prog_data.total_scratch = 0; + } /* Emit GEN4 code. */ - brw_wm_emit(&c); + brw_wm_emit(c); /* get the program */ - program = brw_get_program(&c.func, &program_size); + program = brw_get_program(&c->func, &program_size); /* */ brw->wm.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_WM_PROG], - &c.key, - sizeof(c.key), + &c->key, + sizeof(c->key), program, program_size, - &c.prog_data, + &c->prog_data, &brw->wm.prog_data ); } diff --git a/src/mesa/drivers/dri/i965/intel_ioctl.c b/src/mesa/drivers/dri/i965/intel_ioctl.c index d8176c559e5..4da31277ea2 100644 --- a/src/mesa/drivers/dri/i965/intel_ioctl.c +++ b/src/mesa/drivers/dri/i965/intel_ioctl.c @@ -95,7 +95,7 @@ void intelWaitIrq( struct intel_context *intel, int seq ) { if (!intel->no_hw) { drmI830IrqWait iw; - int ret; + int ret, lastdispatch; if (0) fprintf(stderr, "%s %d\n", __FUNCTION__, seq ); @@ -103,11 +103,12 @@ void intelWaitIrq( struct intel_context *intel, int seq ) iw.irq_seq = seq; do { + lastdispatch = intel->sarea->last_dispatch; ret = drmCommandWrite( intel->driFd, DRM_I830_IRQ_WAIT, &iw, sizeof(iw) ); /* This seems quite often to return before it should!?! */ - } while (ret == -EAGAIN || ret == -EINTR || (ret == 0 && seq > intel->sarea->last_dispatch)); + } while (ret == -EAGAIN || ret == -EINTR || (ret == -EBUSY && lastdispatch != intel->sarea->last_dispatch) || (ret == 0 && seq > intel->sarea->last_dispatch)); if ( ret ) { diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 03ec96a222e..2ab1cf2617e 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -102,6 +102,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, mach64ContextPtr mmesa; mach64ScreenPtr mach64Screen; int i, heap; + GLuint *c_textureSwapsPtr = NULL; #if DO_DEBUG MACH64_DEBUG = driParseDebugString(getenv("MACH64_DEBUG"), debug_control); @@ -153,15 +154,28 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, mmesa->CurrentTexObj[0] = NULL; mmesa->CurrentTexObj[1] = NULL; - make_empty_list( &mmesa->SwappedOut ); + (void) memset( mmesa->texture_heaps, 0, sizeof( mmesa->texture_heaps ) ); + make_empty_list( &mmesa->swapped ); mmesa->firstTexHeap = mach64Screen->firstTexHeap; mmesa->lastTexHeap = mach64Screen->firstTexHeap + mach64Screen->numTexHeaps; for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) { - make_empty_list( &mmesa->TexObjList[i] ); - mmesa->texHeap[i] = mmInit( 0, mach64Screen->texSize[i] ); - mmesa->lastTexAge[i] = -1; + mmesa->texture_heaps[i] = driCreateTextureHeap( i, mmesa, + mach64Screen->texSize[i], + 6, /* align to 64-byte boundary, use 12 for page-size boundary */ + MACH64_NR_TEX_REGIONS, + (drmTextureRegionPtr)mmesa->sarea->tex_list[i], + &mmesa->sarea->tex_age[i], + &mmesa->swapped, + sizeof( mach64TexObj ), + (destroy_texture_object_t *) mach64DestroyTexObj ); + +#if ENABLE_PERF_BOXES + c_textureSwapsPtr = & mmesa->c_textureSwaps; +#endif + driSetTextureSwapCounterLocation( mmesa->texture_heaps[i], + c_textureSwapsPtr ); } mmesa->RenderIndex = -1; /* Impossible value */ @@ -176,17 +190,25 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, * Test for 2 textures * bytes/texel * size * size. There's no * need to account for mipmaps since we only upload one level. */ - heap = mach64Screen->IsPCI ? MACH64_CARD_HEAP : MACH64_AGP_HEAP; - - if ( mach64Screen->texSize[heap] >= 2 * mach64Screen->cpp * 1024*1024 ) { - ctx->Const.MaxTextureLevels = 11; /* 1024x1024 */ - } else if ( mach64Screen->texSize[heap] >= 2 * mach64Screen->cpp * 512*512 ) { - ctx->Const.MaxTextureLevels = 10; /* 512x512 */ - } else { - ctx->Const.MaxTextureLevels = 9; /* 256x256 */ - } ctx->Const.MaxTextureUnits = 2; + ctx->Const.MaxTextureImageUnits = 2; + ctx->Const.MaxTextureCoordUnits = 2; + + heap = mach64Screen->IsPCI ? MACH64_CARD_HEAP : MACH64_AGP_HEAP; + + driCalculateMaxTextureLevels( & mmesa->texture_heaps[heap], + 1, + & ctx->Const, + mach64Screen->cpp, + 10, /* max 2D texture size is 1024x1024 */ + 0, /* 3D textures unsupported. */ + 0, /* cube textures unsupported. */ + 0, /* texture rectangles unsupported. */ + 1, /* mipmapping unsupported. */ + GL_TRUE, /* need to have both textures in + either local or AGP memory */ + 0 ); #if ENABLE_PERF_BOXES mmesa->boxes = ( getenv( "LIBGL_PERFORMANCE_BOXES" ) != NULL ); @@ -250,31 +272,29 @@ void mach64DestroyContext( __DRIcontextPrivate *driContextPriv ) assert(mmesa); /* should never be null */ if ( mmesa ) { - if (mmesa->glCtx->Shared->RefCount == 1) { + GLboolean release_texture_heaps; + + release_texture_heaps = (mmesa->glCtx->Shared->RefCount == 1); + + _swsetup_DestroyContext( mmesa->glCtx ); + _tnl_DestroyContext( mmesa->glCtx ); + _ac_DestroyContext( mmesa->glCtx ); + _swrast_DestroyContext( mmesa->glCtx ); + + if (release_texture_heaps) { /* This share group is about to go away, free our private * texture object data. */ - mach64TexObjPtr t, next_t; int i; for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) { - foreach_s ( t, next_t, &mmesa->TexObjList[i] ) { - mach64DestroyTexObj( mmesa, t ); - } - mmDestroy( mmesa->texHeap[i] ); - mmesa->texHeap[i] = NULL; + driDestroyTextureHeap( mmesa->texture_heaps[i] ); + mmesa->texture_heaps[i] = NULL; } - foreach_s ( t, next_t, &mmesa->SwappedOut ) { - mach64DestroyTexObj( mmesa, t ); - } + assert( is_empty_list( & mmesa->swapped ) ); } - _swsetup_DestroyContext( mmesa->glCtx ); - _tnl_DestroyContext( mmesa->glCtx ); - _ac_DestroyContext( mmesa->glCtx ); - _swrast_DestroyContext( mmesa->glCtx ); - mach64FreeVB( mmesa->glCtx ); /* Free the vertex buffer */ diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index e718b96c188..8d89452412b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -134,46 +134,17 @@ typedef void (*mach64_line_func)( mach64ContextPtr, typedef void (*mach64_point_func)( mach64ContextPtr, mach64Vertex * ); -#ifdef TEXMEM struct mach64_texture_object { driTextureObject base; - GLuint offset; + GLuint bufAddr; - GLuint dirty; - GLuint age; + GLint heap; /* same as base.heap->heapId */ - GLint widthLog2; - GLint heightLog2; - GLint maxLog2; - - GLint hasAlpha; - GLint textureFormat; - - /* Have to keep these separate due to how they are programmed. - * FIXME: Why don't we just use the tObj values? + /* For communicating values from mach64AllocTexObj(), mach64SetTexImages() + * to mach64UpdateTextureUnit(). Alternately, we can use the tObj values or + * set the context registers directly. */ - GLboolean BilinearMin; - GLboolean BilinearMag; - GLboolean ClampS; - GLboolean ClampT; -}; -#else -struct mach64_texture_object { - struct mach64_texture_object *next; - struct mach64_texture_object *prev; - struct gl_texture_object *tObj; - - struct mem_block *memBlock; - GLuint offset; - GLuint size; - - GLuint dirty; - GLuint age; - - GLint bound; - GLint heap; - GLint widthLog2; GLint heightLog2; GLint maxLog2; @@ -181,19 +152,14 @@ struct mach64_texture_object { GLint hasAlpha; GLint textureFormat; - /* Have to keep these separate due to how they are programmed. - * FIXME: Why don't we just use the tObj values? - */ GLboolean BilinearMin; GLboolean BilinearMag; GLboolean ClampS; GLboolean ClampT; }; -#endif typedef struct mach64_texture_object mach64TexObj, *mach64TexObjPtr; - struct mach64_context { GLcontext *glCtx; @@ -229,17 +195,10 @@ struct mach64_context { /* Texture object bookkeeping */ mach64TexObjPtr CurrentTexObj[2]; -#ifdef TEXMEM - unsigned nr_heaps; - driTexHeap * texture_heaps[ R128_NR_TEX_HEAPS ]; - driTextureObject swapped; -#else - mach64TexObj TexObjList[MACH64_NR_TEX_HEAPS]; - mach64TexObj SwappedOut; - struct mem_block *texHeap[MACH64_NR_TEX_HEAPS]; - GLuint lastTexAge[MACH64_NR_TEX_HEAPS]; + GLint firstTexHeap, lastTexHeap; -#endif + driTexHeap *texture_heaps[MACH64_NR_TEX_HEAPS]; + driTextureObject swapped; /* Fallback rasterization functions */ diff --git a/src/mesa/drivers/dri/mach64/mach64_lock.c b/src/mesa/drivers/dri/mach64/mach64_lock.c index b214495d9a6..b73e350111f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_lock.c +++ b/src/mesa/drivers/dri/mach64/mach64_lock.c @@ -82,14 +82,15 @@ void mach64GetLock( mach64ContextPtr mmesa, GLuint flags ) | MACH64_UPLOAD_MISC | MACH64_UPLOAD_CLIPRECTS); + /* EXA render acceleration uses the texture engine, so restore it */ + mmesa->dirty |= (MACH64_UPLOAD_TEXTURE); + if ( sarea->ctx_owner != mmesa->hHWContext ) { sarea->ctx_owner = mmesa->hHWContext; mmesa->dirty = MACH64_UPLOAD_ALL; } for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) { - if ( mmesa->texHeap[i] && (sarea->tex_age[i] != mmesa->lastTexAge[i]) ) { - mach64AgeTextures( mmesa, i ); - } + DRI_AGE_TEXTURES( mmesa->texture_heaps[i] ); } } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index b17de01acc5..1014b8acd52 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -305,7 +305,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64Screen->texSize[MACH64_AGP_HEAP] = 0; mach64Screen->logTexGranularity[MACH64_AGP_HEAP] = 0; } else { - if (mach64Screen->texSize[MACH64_CARD_HEAP] > 0) { + if (serverInfo->textureSize > 0) { mach64Screen->numTexHeaps = MACH64_NR_TEX_HEAPS; mach64Screen->firstTexHeap = MACH64_CARD_HEAP; } else { diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 6459deef784..5288d321ced 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -116,21 +116,20 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) fprintf( stderr, "%s( %p )\n", __FUNCTION__, texObj ); t = (mach64TexObjPtr) CALLOC_STRUCT( mach64_texture_object ); + texObj->DriverData = t; if ( !t ) return NULL; /* Initialize non-image-dependent parts of the state: */ - t->tObj = texObj; + t->base.tObj = texObj; + t->base.dirty_images[0] = (1 << 0); - t->offset = 0; + t->bufAddr = 0; - t->dirty = 1; - - make_empty_list( t ); + make_empty_list( (driTextureObject *) t ); mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT ); - /*mach64SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/ mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); mach64SetTexBorderColor( t, texObj->_BorderChan ); @@ -251,18 +250,17 @@ static void mach64TexImage1D( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); - mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData; + driTextureObject * t = (driTextureObject *) texObj->DriverData; if ( t ) { - mach64SwapOutTexObj( mmesa, t ); + driSwapOutTextureObject( t ); } else { - t = mach64AllocTexObj(texObj); + t = (driTextureObject *) mach64AllocTexObj(texObj); if (!t) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); return; } - texObj->DriverData = t; } /* Note, this will call mach64ChooseTextureFormat */ @@ -285,19 +283,18 @@ static void mach64TexSubImage1D( GLcontext *ctx, struct gl_texture_image *texImage ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); - mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData; + driTextureObject * t = (driTextureObject *) texObj->DriverData; assert( t ); /* this _should_ be true */ if ( t ) { - mach64SwapOutTexObj( mmesa, t ); + driSwapOutTextureObject( t ); } else { - t = mach64AllocTexObj(texObj); + t = (driTextureObject *) mach64AllocTexObj(texObj); if (!t) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D"); return; } - texObj->DriverData = t; } _mesa_store_texsubimage1d(ctx, target, level, xoffset, width, @@ -316,18 +313,17 @@ static void mach64TexImage2D( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); - mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData; + driTextureObject * t = (driTextureObject *) texObj->DriverData; if ( t ) { - mach64SwapOutTexObj( mmesa, t ); + driSwapOutTextureObject( t ); } else { - t = mach64AllocTexObj(texObj); + t = (driTextureObject *) mach64AllocTexObj(texObj); if (!t) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); return; } - texObj->DriverData = t; } /* Note, this will call mach64ChooseTextureFormat */ @@ -350,19 +346,18 @@ static void mach64TexSubImage2D( GLcontext *ctx, struct gl_texture_image *texImage ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); - mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData; + driTextureObject * t = (driTextureObject *) texObj->DriverData; assert( t ); /* this _should_ be true */ if ( t ) { - mach64SwapOutTexObj( mmesa, t ); + driSwapOutTextureObject( t ); } else { - t = mach64AllocTexObj(texObj); + t = (driTextureObject *) mach64AllocTexObj(texObj); if (!t) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D"); return; } - texObj->DriverData = t; } _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width, @@ -372,44 +367,6 @@ static void mach64TexSubImage2D( GLcontext *ctx, mmesa->new_state |= MACH64_NEW_TEXTURE; } -/* Due to the way we must program texture state into the Rage Pro, - * we must leave these calculations to the absolute last minute. - */ -void mach64EmitTexStateLocked( mach64ContextPtr mmesa, - mach64TexObjPtr t0, - mach64TexObjPtr t1 ) -{ - drm_mach64_sarea_t *sarea = mmesa->sarea; - drm_mach64_context_regs_t *regs = &(mmesa->setup); - - /* for multitex, both textures must be local or AGP */ - if ( t0 && t1 ) - assert(t0->heap == t1->heap); - - if ( t0 ) { - if (t0->heap == MACH64_CARD_HEAP) { -#if ENABLE_PERF_BOXES - mmesa->c_texsrc_card++; -#endif - mmesa->setup.tex_cntl &= ~MACH64_TEX_SRC_AGP; - } else { -#if ENABLE_PERF_BOXES - mmesa->c_texsrc_agp++; -#endif - mmesa->setup.tex_cntl |= MACH64_TEX_SRC_AGP; - } - mmesa->setup.tex_offset = t0->offset; - } - - if ( t1 ) { - mmesa->setup.secondary_tex_off = t1->offset; - } - - memcpy( &sarea->context_state.tex_size_pitch, ®s->tex_size_pitch, - MACH64_NR_TEXTURE_REGS * sizeof(GLuint) ); -} - - /* ================================================================ * Device Driver API texture functions */ @@ -491,24 +448,23 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target, _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexParameter"); return; } - tObj->DriverData = t; } switch ( pname ) { case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: - if ( t->bound ) FLUSH_BATCH( mmesa ); + if ( t->base.bound ) FLUSH_BATCH( mmesa ); mach64SetTexFilter( t, tObj->MinFilter, tObj->MagFilter ); break; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: - if ( t->bound ) FLUSH_BATCH( mmesa ); + if ( t->base.bound ) FLUSH_BATCH( mmesa ); mach64SetTexWrap( t, tObj->WrapS, tObj->WrapT ); break; case GL_TEXTURE_BORDER_COLOR: - if ( t->bound ) FLUSH_BATCH( mmesa ); + if ( t->base.bound ) FLUSH_BATCH( mmesa ); mach64SetTexBorderColor( t, tObj->_BorderChan ); break; @@ -522,8 +478,8 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target, * For mach64 we're only concerned with the base level * since that's the only texture we upload. */ - if ( t->bound ) FLUSH_BATCH( mmesa ); - mach64SwapOutTexObj( mmesa, t ); + if ( t->base.bound ) FLUSH_BATCH( mmesa ); + driSwapOutTextureObject( (driTextureObject *) t ); break; default: @@ -547,7 +503,7 @@ static void mach64DDBindTexture( GLcontext *ctx, GLenum target, FLUSH_BATCH( mmesa ); if ( mmesa->CurrentTexObj[unit] ) { - mmesa->CurrentTexObj[unit]->bound &= ~(unit+1); + mmesa->CurrentTexObj[unit]->base.bound &= ~(1 << unit); mmesa->CurrentTexObj[unit] = NULL; } @@ -558,33 +514,37 @@ static void mach64DDDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) { mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); - mach64TexObjPtr t = (mach64TexObjPtr)tObj->DriverData; + driTextureObject * t = (driTextureObject *) tObj->DriverData; if ( t ) { if ( t->bound && mmesa ) { FLUSH_BATCH( mmesa ); - mmesa->CurrentTexObj[t->bound-1] = 0; mmesa->new_state |= MACH64_NEW_TEXTURE; } - mach64DestroyTexObj( mmesa, t ); - tObj->DriverData = NULL; + driDestroyTextureObject( t ); + /* Free mipmap images and the texture object itself */ _mesa_delete_texture_object(ctx, tObj); - } } -static GLboolean mach64DDIsTextureResident( GLcontext *ctx, - struct gl_texture_object *tObj ) +/** + * Allocate a new texture object. + * Called via ctx->Driver.NewTextureObject. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object. Not done at this time. + */ +static struct gl_texture_object * +mach64NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { - mach64TexObjPtr t = (mach64TexObjPtr)tObj->DriverData; - - return ( t && t->memBlock ); + struct gl_texture_object *obj; + obj = _mesa_new_texture_object(ctx, name, target); + mach64AllocTexObj( obj ); + return obj; } - void mach64InitTextureFuncs( struct dd_function_table *functions ) { functions->TexEnv = mach64DDTexEnv; @@ -593,18 +553,15 @@ void mach64InitTextureFuncs( struct dd_function_table *functions ) functions->TexSubImage1D = mach64TexSubImage1D; functions->TexImage2D = mach64TexImage2D; functions->TexSubImage2D = mach64TexSubImage2D; - functions->TexImage3D = _mesa_store_teximage3d; - functions->TexSubImage3D = _mesa_store_texsubimage3d; - functions->CopyTexImage1D = _swrast_copy_teximage1d; - functions->CopyTexImage2D = _swrast_copy_teximage2d; - functions->CopyTexSubImage1D = _swrast_copy_texsubimage1d; - functions->CopyTexSubImage2D = _swrast_copy_texsubimage2d; - functions->CopyTexSubImage3D = _swrast_copy_texsubimage3d; functions->TexParameter = mach64DDTexParameter; functions->BindTexture = mach64DDBindTexture; + functions->NewTextureObject = mach64NewTextureObject; functions->DeleteTexture = mach64DDDeleteTexture; + functions->IsTextureResident = driIsTextureResident; + functions->UpdateTexturePalette = NULL; functions->ActiveTexture = NULL; - functions->IsTextureResident = mach64DDIsTextureResident; - functions->PrioritizeTexture = NULL; + functions->PrioritizeTexture = NULL; + + driInitTextureFormats(); } diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.h b/src/mesa/drivers/dri/mach64/mach64_tex.h index d950dd12b44..f6cf1cf8020 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.h +++ b/src/mesa/drivers/dri/mach64/mach64_tex.h @@ -34,25 +34,15 @@ extern void mach64UpdateTextureState( GLcontext *ctx ); -extern void mach64SwapOutTexObj( mach64ContextPtr mach64ctx, - mach64TexObjPtr t ); - extern void mach64UploadTexImages( mach64ContextPtr mach64ctx, mach64TexObjPtr t ); extern void mach64UploadMultiTexImages( mach64ContextPtr mach64ctx, mach64TexObjPtr t0, mach64TexObjPtr t1 ); -extern void mach64AgeTextures( mach64ContextPtr mach64ctx, int heap ); extern void mach64DestroyTexObj( mach64ContextPtr mach64ctx, mach64TexObjPtr t ); -extern void mach64UpdateTexLRU( mach64ContextPtr mach64ctx, - mach64TexObjPtr t ); - -extern void mach64PrintLocalLRU( mach64ContextPtr mach64ctx, int heap ); -extern void mach64PrintGlobalLRU( mach64ContextPtr mach64ctx, int heap ); - extern void mach64EmitTexStateLocked( mach64ContextPtr mmesa, mach64TexObjPtr t0, mach64TexObjPtr t1 ); diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c index 017fd3535d5..3b7b93b9842 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texmem.c +++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c @@ -49,333 +49,19 @@ */ void mach64DestroyTexObj( mach64ContextPtr mmesa, mach64TexObjPtr t ) { -#if ENABLE_PERF_BOXES - /* Bump the performace counter */ - if (mmesa) - mmesa->c_textureSwaps++; -#endif - if ( !t ) return; - -#if 0 - if ( t->tObj && t->memBlock && mmesa ) { - /* not a placeholder, so release from global LRU if necessary */ - int heap = t->heap; - drmTextureRegion *list = mmesa->sarea->tex_list[heap]; - int log2sz = mmesa->mach64Screen->logTexGranularity[heap]; - int start = t->memBlock->ofs >> log2sz; - int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz; - int i; - - mmesa->lastTexAge[heap] = ++mmesa->sarea->tex_age[heap]; - - /* Update the global LRU */ - for ( i = start ; i <= end ; i++ ) { - /* do we own this block? */ - if (list[i].in_use == mmesa->hHWContext) { - list[i].in_use = 0; - list[i].age = mmesa->lastTexAge[heap]; - - /* remove_from_list(i) */ - list[(GLuint)list[i].next].prev = list[i].prev; - list[(GLuint)list[i].prev].next = list[i].next; - } - } - } -#endif - - if ( t->memBlock ) { - mmFreeMem( t->memBlock ); - t->memBlock = NULL; - } - - if ( t->tObj ) { - t->tObj->DriverData = NULL; - } - - if ( t->bound && mmesa ) - mmesa->CurrentTexObj[t->bound-1] = NULL; - - remove_from_list( t ); - FREE( t ); -} - -/* Keep track of swapped out texture objects. - */ -void mach64SwapOutTexObj( mach64ContextPtr mmesa, - mach64TexObjPtr t ) -{ -#if ENABLE_PERF_BOXES - /* Bump the performace counter */ - if (mmesa) - mmesa->c_textureSwaps++; -#endif - -#if 0 - if ( t->tObj && t->memBlock && mmesa ) { - /* not a placeholder, so release from global LRU if necessary */ - int heap = t->heap; - drmTextureRegion *list = mmesa->sarea->tex_list[heap]; - int log2sz = mmesa->mach64Screen->logTexGranularity[heap]; - int start = t->memBlock->ofs >> log2sz; - int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz; - int i; - - mmesa->lastTexAge[heap] = ++mmesa->sarea->tex_age[heap]; - - /* Update the global LRU */ - for ( i = start ; i <= end ; i++ ) { - /* do we own this block? */ - if (list[i].in_use == mmesa->hHWContext) { - list[i].in_use = 0; - list[i].age = mmesa->lastTexAge[heap]; - - /* remove_from_list(i) */ - list[(GLuint)list[i].next].prev = list[i].prev; - list[(GLuint)list[i].prev].next = list[i].next; - } - } - } -#endif - - if ( t->memBlock ) { - mmFreeMem( t->memBlock ); - t->memBlock = NULL; - } - - t->dirty = ~0; - move_to_tail( &mmesa->SwappedOut, t ); -} - -/* Print out debugging information about texture LRU. - */ -void mach64PrintLocalLRU( mach64ContextPtr mmesa, int heap ) -{ - mach64TexObjPtr t; - int sz = 1 << (mmesa->mach64Screen->logTexGranularity[heap]); - - fprintf( stderr, "\nLocal LRU, heap %d:\n", heap ); - - foreach( t, &mmesa->TexObjList[heap] ) { - if ( !t->tObj ) { - fprintf( stderr, "Placeholder %d at 0x%x sz 0x%x\n", - t->memBlock->ofs / sz, - t->memBlock->ofs, - t->memBlock->size ); - } else { - fprintf( stderr, "Texture (bound %d) at 0x%x sz 0x%x\n", - t->bound, - t->memBlock->ofs, - t->memBlock->size ); - } - } - - fprintf( stderr, "\n" ); -} - -void mach64PrintGlobalLRU( mach64ContextPtr mmesa, int heap ) -{ - drm_tex_region_t *list = mmesa->sarea->tex_list[heap]; - int i, j; - - fprintf( stderr, "\nGlobal LRU, heap %d list %p:\n", heap, list ); - - for ( i = 0, j = MACH64_NR_TEX_REGIONS ; i < MACH64_NR_TEX_REGIONS ; i++ ) { - fprintf( stderr, "list[%d] age %d in_use %d next %d prev %d\n", - j, list[j].age, list[j].in_use, list[j].next, list[j].prev ); - j = list[j].next; - if ( j == MACH64_NR_TEX_REGIONS ) break; - } - - if ( j != MACH64_NR_TEX_REGIONS ) { - fprintf( stderr, "Loop detected in global LRU\n" ); - for ( i = 0 ; i < MACH64_NR_TEX_REGIONS ; i++ ) { - fprintf( stderr, "list[%d] age %d in_use %d next %d prev %d\n", - i, list[i].age, list[i].in_use, list[i].next, list[i].prev ); - } - } + unsigned i; - fprintf( stderr, "\n" ); -} - -/* Reset the global texture LRU. - */ -/* NOTE: This function is only called while holding the hardware lock */ -static void mach64ResetGlobalLRU( mach64ContextPtr mmesa, int heap ) -{ - drm_tex_region_t *list = mmesa->sarea->tex_list[heap]; - int sz = 1 << mmesa->mach64Screen->logTexGranularity[heap]; - int i; - - /* (Re)initialize the global circular LRU list. The last element in - * the array (MACH64_NR_TEX_REGIONS) is the sentinal. Keeping it at - * the end of the array allows it to be addressed rationally when - * looking up objects at a particular location in texture memory. + /* See if it was the driver's current object. */ - for ( i = 0 ; (i+1) * sz <= mmesa->mach64Screen->texSize[heap] ; i++ ) { - list[i].prev = i-1; - list[i].next = i+1; - list[i].age = 0; - list[i].in_use = 0; - } - - i--; - list[0].prev = MACH64_NR_TEX_REGIONS; - list[i].prev = i-1; - list[i].next = MACH64_NR_TEX_REGIONS; - list[MACH64_NR_TEX_REGIONS].prev = i; - list[MACH64_NR_TEX_REGIONS].next = 0; - mmesa->sarea->tex_age[heap] = 0; -} - -/* Update the local and global texture LRUs. - */ -/* NOTE: This function is only called while holding the hardware lock */ -void mach64UpdateTexLRU( mach64ContextPtr mmesa, - mach64TexObjPtr t ) -{ - int heap = t->heap; - drm_tex_region_t *list = mmesa->sarea->tex_list[heap]; - int log2sz = mmesa->mach64Screen->logTexGranularity[heap]; - int start = t->memBlock->ofs >> log2sz; - int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz; - int i; - - mmesa->lastTexAge[heap] = ++mmesa->sarea->tex_age[heap]; - - if ( !t->memBlock ) { - fprintf( stderr, "no memblock\n\n" ); - return; - } - - /* Update our local LRU */ - move_to_head( &mmesa->TexObjList[heap], t ); - - /* Update the global LRU */ - for ( i = start ; i <= end ; i++ ) { - list[i].in_use = mmesa->hHWContext; - list[i].age = mmesa->lastTexAge[heap]; - -#if 0 - /* if this is the last region, it's not in the list */ - if ( !(i*(1<<log2sz) > mmesa->mach64Screen->texSize[heap] ) ) { -#endif - /* remove_from_list(i) */ - list[(GLuint)list[i].next].prev = list[i].prev; - list[(GLuint)list[i].prev].next = list[i].next; -#if 0 - } -#endif - - /* insert_at_head(list, i) */ - list[i].prev = MACH64_NR_TEX_REGIONS; - list[i].next = list[MACH64_NR_TEX_REGIONS].next; - list[(GLuint)list[MACH64_NR_TEX_REGIONS].next].prev = i; - list[MACH64_NR_TEX_REGIONS].next = i; - } - - if ( MACH64_DEBUG & DEBUG_VERBOSE_LRU ) { - mach64PrintGlobalLRU( mmesa, t->heap ); - mach64PrintLocalLRU( mmesa, t->heap ); - } -} - -/* Update our notion of what textures have been changed since we last - * held the lock. This pertains to both our local textures and the - * textures belonging to other clients. Keep track of other client's - * textures by pushing a placeholder texture onto the LRU list -- these - * are denoted by (tObj == NULL). - */ -/* NOTE: This function is only called while holding the hardware lock */ -static void mach64TexturesGone( mach64ContextPtr mmesa, int heap, - int offset, int size, int in_use ) -{ - mach64TexObjPtr t, tmp; - - foreach_s ( t, tmp, &mmesa->TexObjList[heap] ) { - if ( t->memBlock->ofs >= offset + size || - t->memBlock->ofs + t->memBlock->size <= offset ) - continue; - - /* It overlaps - kick it out. Need to hold onto the currently - * bound objects, however. - */ - if ( t->bound ) { - mach64SwapOutTexObj( mmesa, t ); - } else { - mach64DestroyTexObj( mmesa, t ); - } - } - - if ( in_use > 0 && in_use != mmesa->hHWContext ) { - t = (mach64TexObjPtr) CALLOC( sizeof(*t) ); - if (!t) return; - - t->memBlock = mmAllocMem( mmesa->texHeap[heap], size, 0, offset ); - if ( !t->memBlock ) { - fprintf( stderr, "Couldn't alloc placeholder sz %x ofs %x\n", - (int)size, (int)offset ); - mmDumpMemInfo( mmesa->texHeap[heap] ); - return; - } - insert_at_head( &mmesa->TexObjList[heap], t ); - } -} - -/* Update our client's shared texture state. If another client has - * modified a region in which we have textures, then we need to figure - * out which of our textures has been removed, and update our global - * LRU. - */ -void mach64AgeTextures( mach64ContextPtr mmesa, int heap ) -{ - drm_mach64_sarea_t *sarea = mmesa->sarea; - - if ( sarea->tex_age[heap] != mmesa->lastTexAge[heap] ) { - int sz = 1 << mmesa->mach64Screen->logTexGranularity[heap]; - int nr = 0; - int idx; - - /* Have to go right round from the back to ensure stuff ends up - * LRU in our local list... Fix with a cursor pointer. - */ - for ( idx = sarea->tex_list[heap][MACH64_NR_TEX_REGIONS].prev ; - idx != MACH64_NR_TEX_REGIONS && nr < MACH64_NR_TEX_REGIONS ; - idx = sarea->tex_list[heap][idx].prev, nr++ ) + if ( mmesa != NULL ) + { + for ( i = 0 ; i < mmesa->glCtx->Const.MaxTextureUnits ; i++ ) { - /* If switching texturing schemes, then the SAREA might not - * have been properly cleared, so we need to reset the - * global texture LRU. - */ - if ( idx * sz > mmesa->mach64Screen->texSize[heap] ) { - nr = MACH64_NR_TEX_REGIONS; - break; - } - - if ( sarea->tex_list[heap][idx].age > mmesa->lastTexAge[heap] ) { - mach64TexturesGone( mmesa, heap, idx * sz, sz, - sarea->tex_list[heap][idx].in_use ); - } - } - - /* If switching texturing schemes, then the SAREA might not - * have been properly cleared, so we need to reset the - * global texture LRU. - */ - if ( nr == MACH64_NR_TEX_REGIONS ) { - mach64TexturesGone( mmesa, heap, 0, - mmesa->mach64Screen->texSize[heap], 0 ); - mach64ResetGlobalLRU( mmesa, heap ); + if ( t == mmesa->CurrentTexObj[ i ] ) { + assert( t->base.bound & (1 << i) ); + mmesa->CurrentTexObj[ i ] = NULL; + } } - - if ( 0 ) { - mach64PrintGlobalLRU( mmesa, heap ); - mach64PrintLocalLRU( mmesa, heap ); - } - - mmesa->dirty |= (MACH64_UPLOAD_CONTEXT | - MACH64_UPLOAD_TEX0IMAGE | - MACH64_UPLOAD_TEX1IMAGE); - mmesa->lastTexAge[heap] = sarea->tex_age[heap]; } } @@ -395,7 +81,7 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) ) return; - image = t->tObj->Image[0][level]; + image = t->base.tObj->Image[0][level]; if ( !image ) return; @@ -424,14 +110,13 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, fprintf( stderr, "mach64UploadSubImage: %d,%d of %d,%d at %d,%d\n", width, height, image->Width, image->Height, x, y ); fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d\n", - (GLuint)t->offset, (GLint)width, dwords ); - mmDumpMemInfo( mmesa->texHeap[t->heap] ); + (GLuint)t->bufAddr, (GLint)width, dwords ); } assert(image->Data); { - CARD32 *dst = (CARD32 *)((char *)mach64Screen->agpTextures.map + t->memBlock->ofs); + CARD32 *dst = (CARD32 *)((char *)mach64Screen->agpTextures.map + t->base.memBlock->ofs); const GLubyte *src = (const GLubyte *) image->Data + (y * image->Width + x) * image->TexFormat->TexelBytes; const GLuint bytes = width * height * image->TexFormat->TexelBytes; @@ -460,7 +145,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) ) return; - image = t->tObj->Image[0][level]; + image = t->base.tObj->Image[0][level]; if ( !image ) return; @@ -543,7 +228,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, } dwords = width * height / texelsPerDword; - offset = t->offset; + offset = t->bufAddr; #if ENABLE_PERF_BOXES /* Bump the performance counter */ @@ -555,7 +240,6 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, width, height, image->Width, image->Height, x, y ); fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d\n", (GLuint)offset, (GLint)width, dwords ); - mmDumpMemInfo( mmesa->texHeap[t->heap] ); } /* Subdivide the texture if required (account for the registers added by the drm) */ @@ -594,78 +278,32 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, */ void mach64UploadTexImages( mach64ContextPtr mmesa, mach64TexObjPtr t ) { - GLint heap; - if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) { fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, mmesa->glCtx, t ); } assert(t); - assert(t->tObj); - - /* Choose the heap appropriately */ - heap = MACH64_CARD_HEAP; + assert(t->base.tObj); - if ( !mmesa->mach64Screen->IsPCI && - t->size > mmesa->mach64Screen->texSize[heap] ) { - heap = MACH64_AGP_HEAP; - } - - /* Do we need to eject LRU texture objects? */ - if ( !t->memBlock ) { - t->heap = heap; + if ( !t->base.memBlock ) { + int heap; - /* Allocate a memory block on a 64-byte boundary */ - t->memBlock = mmAllocMem( mmesa->texHeap[heap], t->size, 6, 0 ); + /* NULL heaps are skipped */ + heap = driAllocateTexture( mmesa->texture_heaps, MACH64_NR_TEX_HEAPS, + (driTextureObject *) t ); - /* Try AGP before kicking anything out of local mem */ - if ( !mmesa->mach64Screen->IsPCI && !t->memBlock && heap == MACH64_CARD_HEAP ) { - t->memBlock = mmAllocMem( mmesa->texHeap[MACH64_AGP_HEAP], - t->size, 6, 0 ); - - if ( t->memBlock ) - heap = t->heap = MACH64_AGP_HEAP; + if ( heap == -1 ) { + fprintf( stderr, "%s: upload texture failure, sz=%d\n", __FUNCTION__, + t->base.totalSize ); + exit(-1); + return; } - /* Kick out textures until the requested texture fits */ - while ( !t->memBlock ) { - if ( mmesa->TexObjList[heap].prev->bound ) { - fprintf( stderr, - "mach64UploadTexImages: ran into bound texture\n" ); - return; - } - if ( mmesa->TexObjList[heap].prev == &mmesa->TexObjList[heap] ) { - if ( mmesa->mach64Screen->IsPCI ) { - fprintf( stderr, "%s: upload texture failure on " - "local texture heaps, sz=%d\n", __FUNCTION__, - t->size ); - return; - } else if ( heap == MACH64_CARD_HEAP ) { - heap = t->heap = MACH64_AGP_HEAP; - continue; - } else { - int i; - fprintf( stderr, "%s: upload texture failure on " - "%sAGP texture heaps, sz=%d\n", __FUNCTION__, - mmesa->firstTexHeap == MACH64_CARD_HEAP ? "both local and " : "", - t->size ); - for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) { - mach64PrintLocalLRU( mmesa, i ); - mmDumpMemInfo( mmesa->texHeap[i] ); - } - exit(-1); - return; - } - } - - mach64SwapOutTexObj( mmesa, mmesa->TexObjList[heap].prev ); - - t->memBlock = mmAllocMem( mmesa->texHeap[heap], t->size, 6, 0 ); - } + t->heap = heap; /* Set the base offset of the texture image */ - t->offset = mmesa->mach64Screen->texOffset[heap] + t->memBlock->ofs; + t->bufAddr = mmesa->mach64Screen->texOffset[heap] + t->base.memBlock->ofs; /* Force loading the new state into the hardware */ mmesa->dirty |= (MACH64_UPLOAD_SCALE_3D_CNTL | @@ -673,142 +311,152 @@ void mach64UploadTexImages( mach64ContextPtr mmesa, mach64TexObjPtr t ) } /* Let the world know we've used this memory recently */ - mach64UpdateTexLRU( mmesa, t ); + driUpdateTextureLRU( (driTextureObject *) t ); /* Upload any images that are new */ - if ( t->dirty ) { + if ( t->base.dirty_images[0] ) { + const GLint j = t->base.tObj->BaseLevel; if (t->heap == MACH64_AGP_HEAP) { /* Need to make sure any vertex buffers in the queue complete */ mach64WaitForIdleLocked( mmesa ); - mach64UploadAGPSubImage( mmesa, t, t->tObj->BaseLevel, 0, 0, - t->tObj->Image[0][t->tObj->BaseLevel]->Width, - t->tObj->Image[0][t->tObj->BaseLevel]->Height ); + mach64UploadAGPSubImage( mmesa, t, j, 0, 0, + t->base.tObj->Image[0][j]->Width, + t->base.tObj->Image[0][j]->Height ); } else { - mach64UploadLocalSubImage( mmesa, t, t->tObj->BaseLevel, 0, 0, - t->tObj->Image[0][t->tObj->BaseLevel]->Width, - t->tObj->Image[0][t->tObj->BaseLevel]->Height ); + mach64UploadLocalSubImage( mmesa, t, j, 0, 0, + t->base.tObj->Image[0][j]->Width, + t->base.tObj->Image[0][j]->Height ); } mmesa->setup.tex_cntl |= MACH64_TEX_CACHE_FLUSH; + t->base.dirty_images[0] = 0; } mmesa->dirty |= MACH64_UPLOAD_TEXTURE; +} + + +/* Allocate memory from the same texture heap `heap' for both textures + * `u0' and `u1'. + */ +static int mach64AllocateMultiTex( mach64ContextPtr mmesa, + mach64TexObjPtr u0, + mach64TexObjPtr u1, + int heap, GLboolean alloc_u0 ) +{ + /* Both objects should be bound */ + assert( u0->base.bound && u1->base.bound ); + + if ( alloc_u0 ) { + /* Evict u0 from its current heap */ + if ( u0->base.memBlock ) { + assert( u0->heap != heap ); + driSwapOutTextureObject( (driTextureObject *) u0 ); + } + + /* Try to allocate u0 in the chosen heap */ + u0->heap = driAllocateTexture( &mmesa->texture_heaps[heap], 1, + (driTextureObject *) u0 ); + + if ( u0->heap == -1 ) { + return -1; + } + } + + /* Evict u1 from its current heap */ + if ( u1->base.memBlock ) { + assert( u1->heap != heap ); + driSwapOutTextureObject( (driTextureObject *) u1 ); + } + + /* Try to allocate u1 in the same heap as u0 */ + u1->heap = driAllocateTexture( &mmesa->texture_heaps[heap], 1, + (driTextureObject *) u1 ); + + if ( u1->heap == -1 ) { + return -1; + } - t->dirty = 0; + /* Bound objects are not evicted */ + assert( u0->base.memBlock && u1->base.memBlock ); + assert( u0->heap == u1->heap ); + + return heap; } /* The mach64 needs to have both primary and secondary textures in either * local or AGP memory, so we need a "buddy system" to make sure that allocation * succeeds or fails for both textures. - * FIXME: This needs to be optimized better. */ void mach64UploadMultiTexImages( mach64ContextPtr mmesa, mach64TexObjPtr t0, mach64TexObjPtr t1 ) { - GLint heap; - if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) { fprintf( stderr, "%s( %p, %p %p )\n", __FUNCTION__, mmesa->glCtx, t0, t1 ); } assert(t0 && t1); - assert(t0->tObj && t1->tObj); + assert(t0->base.tObj && t1->base.tObj); - /* Choose the heap appropriately */ - heap = MACH64_CARD_HEAP; + if ( !t0->base.memBlock || !t1->base.memBlock || t0->heap != t1->heap ) { + mach64TexObjPtr u0 = NULL; + mach64TexObjPtr u1 = NULL; + unsigned totalSize = t0->base.totalSize + t1->base.totalSize; - if ( !mmesa->mach64Screen->IsPCI && - ((t0->size + t1->size) > mmesa->mach64Screen->texSize[heap]) ) { - heap = MACH64_AGP_HEAP; - } + int heap, ret; - /* Do we need to eject LRU texture objects? */ - if ( !t0->memBlock || !t1->memBlock || t0->heap != t1->heap ) { - /* FIXME: starting from scratch for now to keep it simple */ - if ( t0->memBlock ) { - mach64SwapOutTexObj( mmesa, t0 ); - } - if ( t1->memBlock ) { - mach64SwapOutTexObj( mmesa, t1 ); - } - t0->heap = t1->heap = heap; - /* Allocate a memory block on a 64-byte boundary */ - t0->memBlock = mmAllocMem( mmesa->texHeap[heap], t0->size, 6, 0 ); - if ( t0->memBlock ) { - t1->memBlock = mmAllocMem( mmesa->texHeap[heap], t1->size, 6, 0 ); - if ( !t1->memBlock ) { - mmFreeMem( t0->memBlock ); - t0->memBlock = NULL; - } + /* Check if one of the textures is already swapped in a heap and the + * other texture fits in that heap. + */ + if ( t0->base.memBlock && totalSize <= t0->base.heap->size ) { + u0 = t0; + u1 = t1; + } else if ( t1->base.memBlock && totalSize <= t1->base.heap->size ) { + u0 = t1; + u1 = t0; } - /* Try AGP before kicking anything out of local mem */ - if ( (!t0->memBlock || !t1->memBlock) && heap == MACH64_CARD_HEAP ) { - t0->memBlock = mmAllocMem( mmesa->texHeap[MACH64_AGP_HEAP], t0->size, 6, 0 ); - if ( t0->memBlock ) { - t1->memBlock = mmAllocMem( mmesa->texHeap[MACH64_AGP_HEAP], t1->size, 6, 0 ); - if ( !t1->memBlock ) { - mmFreeMem( t0->memBlock ); - t0->memBlock = NULL; - } + + if ( u0 ) { + heap = u0->heap; + + ret = mach64AllocateMultiTex( mmesa, u0, u1, heap, GL_FALSE ); + } else { + /* Both textures are swapped out or collocation is impossible */ + u0 = t0; + u1 = t1; + + /* Choose the heap appropriately */ + heap = MACH64_CARD_HEAP; + + if ( totalSize > mmesa->texture_heaps[heap]->size ) { + heap = MACH64_AGP_HEAP; } - if ( t0->memBlock && t1->memBlock ) - heap = t0->heap = t1->heap = MACH64_AGP_HEAP; + ret = mach64AllocateMultiTex( mmesa, u0, u1, heap, GL_TRUE ); } - /* Kick out textures until the requested texture fits */ - while ( !t0->memBlock || !t1->memBlock ) { - if ( mmesa->TexObjList[heap].prev->bound ) { - fprintf( stderr, - "%s: ran into bound texture\n", __FUNCTION__ ); - return; - } - if ( mmesa->TexObjList[heap].prev == &mmesa->TexObjList[heap] ) { - if ( mmesa->mach64Screen->IsPCI ) { - fprintf( stderr, "%s: upload texture failure on local " - "texture heaps, tex0 sz=%d tex1 sz=%d\n", __FUNCTION__, - t0->size, t1->size ); - return; - } else if ( heap == MACH64_CARD_HEAP ) { - /* If only one allocation succeeded, start over again in AGP */ - if (t0->memBlock) { - mmFreeMem( t0->memBlock ); - t0->memBlock = NULL; - } - if (t1->memBlock) { - mmFreeMem( t1->memBlock ); - t1->memBlock = NULL; - } - heap = t0->heap = t1->heap = MACH64_AGP_HEAP; - continue; - } else { - int i; - fprintf( stderr, "%s: upload texture failure on %s" - "AGP texture heaps, tex0 sz=%d tex1 sz=%d\n", __FUNCTION__, - mmesa->firstTexHeap == MACH64_CARD_HEAP ? "both local and " : "", - t0->size, t1->size ); - for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) { - mach64PrintLocalLRU( mmesa, i ); - mmDumpMemInfo( mmesa->texHeap[i] ); - } - exit(-1); - return; - } - } + if ( ret == -1 && heap == MACH64_CARD_HEAP ) { + /* Try AGP if local memory failed */ + heap = MACH64_AGP_HEAP; - mach64SwapOutTexObj( mmesa, mmesa->TexObjList[heap].prev ); - - if (!t0->memBlock) - t0->memBlock = mmAllocMem( mmesa->texHeap[heap], t0->size, 6, 0 ); - if (!t1->memBlock) - t1->memBlock = mmAllocMem( mmesa->texHeap[heap], t1->size, 6, 0 ); + ret = mach64AllocateMultiTex( mmesa, u0, u1, heap, GL_TRUE ); + } + + if ( ret == -1 ) { + /* FIXME: + * Swap out all textures from the AGP heap and re-run allocation, this + * should succeed in all cases. + */ + fprintf( stderr, "%s: upload multi-texture failure, sz0=%d sz1=%d\n", + __FUNCTION__, t0->base.totalSize, t1->base.totalSize ); + exit(-1); } /* Set the base offset of the texture image */ - t0->offset = mmesa->mach64Screen->texOffset[heap] + t0->memBlock->ofs; - t1->offset = mmesa->mach64Screen->texOffset[heap] + t1->memBlock->ofs; + t0->bufAddr = mmesa->mach64Screen->texOffset[heap] + t0->base.memBlock->ofs; + t1->bufAddr = mmesa->mach64Screen->texOffset[heap] + t1->base.memBlock->ofs; /* Force loading the new state into the hardware */ mmesa->dirty |= (MACH64_UPLOAD_SCALE_3D_CNTL | @@ -816,42 +464,43 @@ void mach64UploadMultiTexImages( mach64ContextPtr mmesa, } /* Let the world know we've used this memory recently */ - mach64UpdateTexLRU( mmesa, t0 ); - mach64UpdateTexLRU( mmesa, t1 ); + driUpdateTextureLRU( (driTextureObject *) t0 ); + driUpdateTextureLRU( (driTextureObject *) t1 ); /* Upload any images that are new */ - if ( t0->dirty ) { + if ( t0->base.dirty_images[0] ) { + const GLint j0 = t0->base.tObj->BaseLevel; if (t0->heap == MACH64_AGP_HEAP) { /* Need to make sure any vertex buffers in the queue complete */ mach64WaitForIdleLocked( mmesa ); - mach64UploadAGPSubImage( mmesa, t0, t0->tObj->BaseLevel, 0, 0, - t0->tObj->Image[0][t0->tObj->BaseLevel]->Width, - t0->tObj->Image[0][t0->tObj->BaseLevel]->Height ); + mach64UploadAGPSubImage( mmesa, t0, j0, 0, 0, + t0->base.tObj->Image[0][j0]->Width, + t0->base.tObj->Image[0][j0]->Height ); } else { - mach64UploadLocalSubImage( mmesa, t0, t0->tObj->BaseLevel, 0, 0, - t0->tObj->Image[0][t0->tObj->BaseLevel]->Width, - t0->tObj->Image[0][t0->tObj->BaseLevel]->Height ); + mach64UploadLocalSubImage( mmesa, t0, j0, 0, 0, + t0->base.tObj->Image[0][j0]->Width, + t0->base.tObj->Image[0][j0]->Height ); } mmesa->setup.tex_cntl |= MACH64_TEX_CACHE_FLUSH; + t0->base.dirty_images[0] = 0; } - if ( t1->dirty ) { + if ( t1->base.dirty_images[0] ) { + const GLint j1 = t1->base.tObj->BaseLevel; if (t1->heap == MACH64_AGP_HEAP) { /* Need to make sure any vertex buffers in the queue complete */ mach64WaitForIdleLocked( mmesa ); - mach64UploadAGPSubImage( mmesa, t1, t1->tObj->BaseLevel, 0, 0, - t1->tObj->Image[0][t1->tObj->BaseLevel]->Width, - t1->tObj->Image[0][t1->tObj->BaseLevel]->Height ); + mach64UploadAGPSubImage( mmesa, t1, j1, 0, 0, + t1->base.tObj->Image[0][j1]->Width, + t1->base.tObj->Image[0][j1]->Height ); } else { - mach64UploadLocalSubImage( mmesa, t1, t1->tObj->BaseLevel, 0, 0, - t1->tObj->Image[0][t1->tObj->BaseLevel]->Width, - t1->tObj->Image[0][t1->tObj->BaseLevel]->Height ); + mach64UploadLocalSubImage( mmesa, t1, j1, 0, 0, + t1->base.tObj->Image[0][j1]->Width, + t1->base.tObj->Image[0][j1]->Height ); } mmesa->setup.tex_cntl |= MACH64_TEX_CACHE_FLUSH; + t1->base.dirty_images[0] = 0; } mmesa->dirty |= MACH64_UPLOAD_TEXTURE; - - t0->dirty = 0; - t1->dirty = 0; } diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index b6a9e3f931e..3ace370d70d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -47,11 +47,6 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, { mach64TexObjPtr t = (mach64TexObjPtr) tObj->DriverData; struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; -#if 0 - int log2Pitch, log2Height, log2Size, log2MinSize; - int i; - GLint firstLevel, lastLevel; -#endif int totalSize; assert(t); @@ -92,77 +87,17 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, _mesa_problem(mmesa->glCtx, "Bad texture format in %s", __FUNCTION__); }; -#if 0 - /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. - */ - firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ - - log2Pitch = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - log2Size = MAX2(log2Pitch, log2Height); - log2MinSize = log2Size; - - t->dirty = 0; - totalSize = 0; - for ( i = firstLevel; i <= lastLevel; i++ ) { - const struct gl_texture_image *texImage; - - texImage = tObj->Image[i]; - if ( !texImage || !texImage->Data ) { - lastLevel = i - 1; - break; - } - - log2MinSize = texImage->MaxLog2; - - t->image[i - firstLevel].offset = totalSize; - t->image[i - firstLevel].width = tObj->Image[i]->Width; - t->image[i - firstLevel].height = tObj->Image[i]->Height; + totalSize = ( baseImage->Height * + baseImage->Width * + baseImage->TexFormat->TexelBytes ); - t->dirty |= (1 << i); - - totalSize += (tObj->Image[i]->Height * - tObj->Image[i]->Width * - tObj->Image[i]->TexFormat->TexelBytes); - - /* Offsets must be 32-byte aligned for host data blits and tiling */ - totalSize = (totalSize + 31) & ~31; - } + totalSize = (totalSize + 31) & ~31; - t->totalSize = totalSize; - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; + t->base.totalSize = totalSize; + t->base.firstLevel = tObj->BaseLevel; + t->base.lastLevel = tObj->BaseLevel; /* Set the texture format */ - t->setup.tex_cntl &= ~(0xf << 16); - t->setup.tex_cntl |= t->textureFormat; - - t->setup.tex_combine_cntl = 0x00000000; /* XXX is this right? */ - - t->setup.tex_size_pitch = ((log2Pitch << R128_TEX_PITCH_SHIFT) | - (log2Size << R128_TEX_SIZE_SHIFT) | - (log2Height << R128_TEX_HEIGHT_SHIFT) | - (log2MinSize << R128_TEX_MIN_SIZE_SHIFT)); - - for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { - t->setup.tex_offset[i] = 0x00000000; - } - - if (firstLevel == lastLevel) - t->setup.tex_cntl |= R128_MIP_MAP_DISABLE; - else - t->setup.tex_cntl &= ~R128_MIP_MAP_DISABLE; - -#else if ( ( baseImage->_BaseFormat == GL_RGBA ) || ( baseImage->_BaseFormat == GL_ALPHA ) || ( baseImage->_BaseFormat == GL_LUMINANCE_ALPHA ) ) { @@ -171,15 +106,9 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, t->hasAlpha = 0; } - totalSize = ( baseImage->Width * baseImage->Height * - baseImage->TexFormat->TexelBytes ); - totalSize = (totalSize + 31) & ~31; - t->size = totalSize; t->widthLog2 = baseImage->WidthLog2; t->heightLog2 = baseImage->HeightLog2; t->maxLog2 = baseImage->MaxLog2; - -#endif } static void mach64UpdateTextureEnv( GLcontext *ctx, int unit ) @@ -387,17 +316,17 @@ static void mach64UpdateTextureUnit( GLcontext *ctx, int unit ) } /* Upload teximages */ - if (t->dirty) { + if (t->base.dirty_images[0]) { mach64SetTexImages( mmesa, tObj ); mmesa->dirty |= (MACH64_UPLOAD_TEX0IMAGE << unit); } /* Bind to the given texture unit */ mmesa->CurrentTexObj[unit] = t; - t->bound |= (1 << unit); + t->base.bound |= (1 << unit); - if ( t->memBlock ) - mach64UpdateTexLRU( mmesa, t ); + if ( t->base.memBlock ) + driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */ /* register setup */ if ( unit == 0 ) { @@ -515,8 +444,8 @@ void mach64UpdateTextureState( GLcontext *ctx ) FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_FALSE ); /* Unbind any currently bound textures */ - if ( mmesa->CurrentTexObj[0] ) mmesa->CurrentTexObj[0]->bound = 0; - if ( mmesa->CurrentTexObj[1] ) mmesa->CurrentTexObj[1]->bound = 0; + if ( mmesa->CurrentTexObj[0] ) mmesa->CurrentTexObj[0]->base.bound = 0; + if ( mmesa->CurrentTexObj[1] ) mmesa->CurrentTexObj[1]->base.bound = 0; mmesa->CurrentTexObj[0] = NULL; mmesa->CurrentTexObj[1] = NULL; @@ -556,3 +485,41 @@ void mach64UpdateTextureState( GLcontext *ctx ) MACH64_UPLOAD_TEXTURE); } + +/* Due to the way we must program texture state into the Rage Pro, + * we must leave these calculations to the absolute last minute. + */ +void mach64EmitTexStateLocked( mach64ContextPtr mmesa, + mach64TexObjPtr t0, + mach64TexObjPtr t1 ) +{ + drm_mach64_sarea_t *sarea = mmesa->sarea; + drm_mach64_context_regs_t *regs = &(mmesa->setup); + + /* for multitex, both textures must be local or AGP */ + if ( t0 && t1 ) + assert(t0->heap == t1->heap); + + if ( t0 ) { + if (t0->heap == MACH64_CARD_HEAP) { +#if ENABLE_PERF_BOXES + mmesa->c_texsrc_card++; +#endif + mmesa->setup.tex_cntl &= ~MACH64_TEX_SRC_AGP; + } else { +#if ENABLE_PERF_BOXES + mmesa->c_texsrc_agp++; +#endif + mmesa->setup.tex_cntl |= MACH64_TEX_SRC_AGP; + } + mmesa->setup.tex_offset = t0->bufAddr; + } + + if ( t1 ) { + mmesa->setup.secondary_tex_off = t1->bufAddr; + } + + memcpy( &sarea->context_state.tex_size_pitch, ®s->tex_size_pitch, + MACH64_NR_TEXTURE_REGS * sizeof(GLuint) ); +} + diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index 4a0044be88c..08cc1849a12 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -1583,7 +1583,10 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, mach64ContextPtr mmesa = MACH64_CONTEXT( ctx ); const GLuint vertsize = mmesa->vertex_size; GLint a; - GLfloat ooa; + union { + GLfloat f; + CARD32 u; + } ooa; GLuint xy; const GLuint xyoffset = 9; GLint xx[3], yy[3]; /* 2 fractional bits for hardware */ @@ -1621,7 +1624,7 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, return; } - ooa = 16.0 / a; + ooa.f = 16.0 / a; vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * sizeof(CARD32) ); vbchk = vb + vbsiz; @@ -1629,7 +1632,7 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, COPY_VERTEX( vb, vertsize, v0, 1 ); COPY_VERTEX( vb, vertsize, v1, 2 ); COPY_VERTEX_OOA( vb, vertsize, v2, 3 ); - LE32_OUT( vb++, *(CARD32 *)&ooa ); + LE32_OUT( vb++, ooa.u ); i = 3; while (1) { @@ -1644,10 +1647,10 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, a = (xx[0] - xx[2]) * (yy[1] - yy[2]) - (yy[0] - yy[2]) * (xx[1] - xx[2]); - ooa = 16.0 / a; + ooa.f = 16.0 / a; COPY_VERTEX_OOA( vb, vertsize, v0, 1 ); - LE32_OUT( vb++, *(CARD32 *)&ooa ); + LE32_OUT( vb++, ooa.u ); if (i >= n) break; @@ -1660,10 +1663,10 @@ static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, a = (xx[0] - xx[2]) * (yy[1] - yy[2]) - (yy[0] - yy[2]) * (xx[1] - xx[2]); - ooa = 16.0 / a; + ooa.f = 16.0 / a; COPY_VERTEX_OOA( vb, vertsize, v1, 2 ); - LE32_OUT( vb++, *(CARD32 *)&ooa ); + LE32_OUT( vb++, ooa.u ); } assert( vb == vbchk ); diff --git a/src/mesa/drivers/dri/r200/.gitignore b/src/mesa/drivers/dri/r200/.gitignore new file mode 100644 index 00000000000..3773d8ea73f --- /dev/null +++ b/src/mesa/drivers/dri/r200/.gitignore @@ -0,0 +1,3 @@ +radeon_chipset.h +radeon_screen.* +server diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index fa38a78e263..44c67b68cbc 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -735,6 +735,7 @@ struct r200_tcl_info { GLuint *Elts; struct r200_dma_region indexed_verts; + struct r200_dma_region weight; struct r200_dma_region obj; struct r200_dma_region rgba; struct r200_dma_region spec; diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 39c1f68911f..270dc35a46a 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -423,7 +423,21 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) count ); } component[nr++] = &rmesa->tcl.generic[geninput]; - vfmt0 |= R200_VTX_W0 | R200_VTX_Z0; + vfmt0 |= R200_VTX_W0 | R200_VTX_Z0; + } + + if (inputs & VERT_BIT_WEIGHT) { + if (!rmesa->tcl.weight.buf) + emit_vector( ctx, + &rmesa->tcl.weight, + (char *)VB->AttribPtr[VERT_ATTRIB_WEIGHT]->data, + VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size, + VB->AttribPtr[VERT_ATTRIB_WEIGHT]->stride, + count); + + assert(VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size <= 4); + vfmt0 |= VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size << R200_VTX_WEIGHT_COUNT_SHIFT; + component[nr++] = &rmesa->tcl.weight; } if (inputs & VERT_BIT_NORMAL) { @@ -672,6 +686,9 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs ) if (newinputs & VERT_BIT_POS) r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ ); + if (newinputs & VERT_BIT_WEIGHT) + r200ReleaseDmaRegion( rmesa, &rmesa->tcl.weight, __FUNCTION__ ); + if (newinputs & VERT_BIT_NORMAL) r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ ); diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 899e84caa0f..491701b796e 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -503,7 +503,6 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte array_count++; } if (mesa_vp->Base.InputsRead & VERT_BIT_WEIGHT) { - /* we don't actually handle that later. Then again, we don't have to... */ vp->inputs[VERT_ATTRIB_WEIGHT] = 12; array_count++; } diff --git a/src/mesa/drivers/dri/r300/.gitignore b/src/mesa/drivers/dri/r300/.gitignore new file mode 100644 index 00000000000..3773d8ea73f --- /dev/null +++ b/src/mesa/drivers/dri/r300/.gitignore @@ -0,0 +1,3 @@ +radeon_chipset.h +radeon_screen.* +server diff --git a/src/mesa/drivers/ggi/default/.cvsignore b/src/mesa/drivers/ggi/default/.gitignore index c8a526b14d7..c8a526b14d7 100644 --- a/src/mesa/drivers/ggi/default/.cvsignore +++ b/src/mesa/drivers/ggi/default/.gitignore diff --git a/src/mesa/drivers/ggi/display/.cvsignore b/src/mesa/drivers/ggi/display/.gitignore index 98858db2c0e..98858db2c0e 100644 --- a/src/mesa/drivers/ggi/display/.cvsignore +++ b/src/mesa/drivers/ggi/display/.gitignore diff --git a/src/mesa/glapi/.cvsignore b/src/mesa/glapi/.gitignore index e706bc23cab..e706bc23cab 100644 --- a/src/mesa/glapi/.cvsignore +++ b/src/mesa/glapi/.gitignore |