Support 16-bit modes.
authorAapo Tahkola <aet@rasterburn.org>
Thu, 16 Jun 2005 10:40:39 +0000 (10:40 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Thu, 16 Jun 2005 10:40:39 +0000 (10:40 +0000)
src/mesa/drivers/dri/r300/r300_ioctl.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_state.c

index 6f8a7129e06f72626b8c0b9c7b85f726e9106503..8d752f90b75c0420fbe65aa629192d4a4efa5610 100644 (file)
@@ -125,9 +125,14 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
        r300->hw.bld.cmd[R300_BLD_CBLEND] = 0;
        r300->hw.bld.cmd[R300_BLD_ABLEND] = 0;
        
+       if (r300->radeon.radeonScreen->cpp == 4)
+               cbpitch |= R300_COLOR_FORMAT_ARGB8888;
+       else
+               cbpitch |= R300_COLOR_FORMAT_RGB565;
+       
        R300_STATECHANGE(r300, cb);
        r300->hw.cb.cmd[R300_CB_OFFSET] = cboffset;
-       r300->hw.cb.cmd[R300_CB_PITCH] = cbpitch | R300_COLOR_UNKNOWN_22_23;
+       r300->hw.cb.cmd[R300_CB_PITCH] = cbpitch;
 
        R300_STATECHANGE(r300, unk221C);
        r300->hw.unk221C.cmd[1] = R300_221C_CLEAR;
@@ -257,8 +262,13 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
        reg_start(R300_RB3D_COLOROFFSET0, 0);
        e32(cboffset);
        
+       if (r300->radeon.radeonScreen->cpp == 4)
+               cbpitch |= R300_COLOR_FORMAT_ARGB8888;
+       else
+               cbpitch |= R300_COLOR_FORMAT_RGB565;
+       
        reg_start(R300_RB3D_COLORPITCH0, 0);
-       e32(cbpitch | R300_COLOR_UNKNOWN_22_23);
+       e32(cbpitch);
 
        R300_STATECHANGE(r300, cmk);
        reg_start(R300_RB3D_COLORMASK, 0);
index 5b979dbe81a59743018714d18fdbd1fb0a6e2fcf..3321954ca892698be26bc2ee9ad3494f503b3019 100644 (file)
@@ -1147,7 +1147,8 @@ I am fairly certain that they are correct unless stated otherwise in comments.
 #       define R300_COLOR_ENDIAN_NO_SWAP         (0 << 18) /* GUESS */
 #       define R300_COLOR_ENDIAN_WORD_SWAP       (1 << 18) /* GUESS */
 #       define R300_COLOR_ENDIAN_DWORD_SWAP      (2 << 18) /* GUESS */
-#       define R300_COLOR_UNKNOWN_22_23          (3 << 22) /* GUESS: Format? - (6<<21) for RGBA? */
+#       define R300_COLOR_FORMAT_RGB565          (2 << 22)
+#       define R300_COLOR_FORMAT_ARGB8888        (3 << 22)
 #define R300_RB3D_COLORPITCH1               0x4E3C /* GUESS */
 #define R300_RB3D_COLORPITCH2               0x4E40 /* GUESS */
 #define R300_RB3D_COLORPITCH3               0x4E44 /* GUESS */
index 72418154c469b9f88a2c8c8b20e6d4df363d4748..1c0ccc198601eabccb0d5b9e29601a1b8b777146 100644 (file)
@@ -2146,17 +2146,20 @@ void r300ResetHwState(r300ContextPtr r300)
                r300->hw.cb.cmd[R300_CB_OFFSET] =
                        r300->radeon.radeonScreen->backOffset +
                        r300->radeon.radeonScreen->fbLocation;
-               r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->backPitch
-                       | R300_COLOR_UNKNOWN_22_23;
+               r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->backPitch;
        } else {
                r300->hw.cb.cmd[R300_CB_OFFSET] =
                        r300->radeon.radeonScreen->frontOffset +
                        r300->radeon.radeonScreen->fbLocation;
-               r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->frontPitch
-                       | R300_COLOR_UNKNOWN_22_23;
+               r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->frontPitch;
                
        }
        
+       if (r300->radeon.radeonScreen->cpp == 4)
+               r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_ARGB8888;
+       else
+               r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_RGB565;
+       
        r300->hw.unk4E50.cmd[1] = 0;
        r300->hw.unk4E50.cmd[2] = 0;
        r300->hw.unk4E50.cmd[3] = 0;