Some debug work on the video driver, shows an error in the BG's vertical placement gsoc2008_nds
authorDarren Alton <dalton@stevens.edu>
Sat, 26 Jul 2008 05:52:59 +0000
branchgsoc2008_nds
changeset 2682f7594fc66bda
parent 2681 c15b6c758be5
child 2683 e858ac8868b6
Some debug work on the video driver, shows an error in the BG's vertical placement
src/video/nds/SDL_ndsrender.c
src/video/nds/SDL_ndsvideo.c
     1.1 --- a/src/video/nds/SDL_ndsrender.c	Fri Jul 25 23:39:14 2008 +0000
     1.2 +++ b/src/video/nds/SDL_ndsrender.c	Sat Jul 26 05:52:59 2008 +0000
     1.3 @@ -100,7 +100,6 @@
     1.4      bg_attribute *bg;
     1.5      u8 bg_taken[4];
     1.6      int sub;
     1.7 -    SDL_DirtyRectList dirty;
     1.8  } NDS_RenderData;
     1.9  
    1.10  typedef struct
    1.11 @@ -249,6 +248,7 @@
    1.12  {
    1.13      NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
    1.14      NDS_TextureData *txdat = NULL;
    1.15 +    int i;
    1.16  printf("+NDS_CreateTexture\n");
    1.17      if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
    1.18          SDL_SetError("Unsupported texture format");
    1.19 @@ -299,6 +299,10 @@
    1.20                  txdat->dim.bpp = bpp;
    1.21                  txdat->vram = (u16*)(data->sub ?
    1.22                      BG_BMP_RAM_SUB(whichbg) : BG_BMP_RAM(whichbg));
    1.23 +                for(i = 0; i < 256*256; ++i) {
    1.24 +                    txdat->vram[i] = 0x8000|RGB15(0,31,31);
    1.25 +                }
    1.26 +                for(i = 0; i < 60; ++i) swiWaitForVBlank();
    1.27              } else {
    1.28                  SDL_SetError("Out of NDS backgrounds.");
    1.29              }
    1.30 @@ -439,7 +443,7 @@
    1.31          NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
    1.32  
    1.33          if (markDirty) {
    1.34 -            SDL_AddDirtyRect(&txdat->dirty, rect);
    1.35 +            /*SDL_AddDirtyRect(&txdat->dirty, rect);*/
    1.36          }
    1.37  
    1.38          *pixels = (void *) ((u8 *)txdat->vram + rect->y * txdat->dim.pitch
    1.39 @@ -496,9 +500,13 @@
    1.40      NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
    1.41  //    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
    1.42  //    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
    1.43 -
    1.44 +    int i;
    1.45  printf("+NDS_RenderCopy\n");
    1.46 -
    1.47 +    for(i = 0; i <= 0xFFFF; ++i) {
    1.48 +        txdat->vram[i] = 0x8000|i;
    1.49 +    }
    1.50 +    printf("/txdat->hw_index = %d\n", txdat->hw_index);
    1.51 +#if 0
    1.52      if (txdat->dirty.list) {
    1.53          SDL_DirtyRect *dirty;
    1.54          void *pixels;
    1.55 @@ -518,9 +526,9 @@
    1.56          }
    1.57          SDL_ClearDirtyRects(&txdat->dirty);
    1.58      }
    1.59 -
    1.60 +#endif
    1.61  printf("-NDS_RenderCopy\n");
    1.62 -    return status;
    1.63 +    return 0;
    1.64  }
    1.65  
    1.66  
    1.67 @@ -547,7 +555,7 @@
    1.68      } else {
    1.69          /* free anything else allocated for texture */
    1.70          NDS_TextureData *txdat = texture->driverdata;
    1.71 -        SDL_FreeDirtyRects(&txdat->dirty);
    1.72 +        /*SDL_FreeDirtyRects(&txdat->dirty);*/
    1.73          SDL_free(txdat);
    1.74      }
    1.75  printf("-NDS_DestroyTexture\n");
     2.1 --- a/src/video/nds/SDL_ndsvideo.c	Fri Jul 25 23:39:14 2008 +0000
     2.2 +++ b/src/video/nds/SDL_ndsvideo.c	Sat Jul 26 05:52:59 2008 +0000
     2.3 @@ -199,11 +199,11 @@
     2.4  printf("+NDS_SetDisplayMode\n");
     2.5      /* right now this function is just hard-coded for 256x192 ABGR1555 */
     2.6      videoSetMode(MODE_5_2D |
     2.7 -        DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE
     2.8 +        DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE |
     2.9          DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_ACTIVE); /* display on main core */
    2.10      videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */
    2.11      vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000,
    2.12 -                     VRAM_C_SUB_BG_0x06200000,  VRAM_D_SUB_BG_0x06220000);
    2.13 +                     VRAM_C_SUB_BG_0x06200000,  VRAM_D_MAIN_BG_0x06040000);
    2.14      vramSetBankE(VRAM_E_MAIN_SPRITE);
    2.15      /* set up console for debug text 'n stuff */
    2.16      SUB_BG0_CR = BG_MAP_BASE(31);