0004-sdl-fbdev-blit32.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c
  2. index 81830b6..1399140 100644
  3. --- a/src/video/fbcon/SDL_fbvideo.c
  4. +++ b/src/video/fbcon/SDL_fbvideo.c
  5. @@ -165,6 +165,10 @@ static void FB_RestorePalette(_THIS);
  6. static FB_bitBlit FB_blit16;
  7. static FB_bitBlit FB_blit16blocked;
  8. +static FB_bitBlit FB_blit32;
  9. +static FB_bitBlit FB_blit32blocked;
  10. +
  11. +
  12. static int SDL_getpagesize(void)
  13. {
  14. #ifdef HAVE_GETPAGESIZE
  15. @@ -1119,6 +1123,10 @@ static SDL_Surface *FB_SetVideoMode(_THIS, SDL_Surface *current,
  16. blitFunc = (rotate == FBCON_ROTATE_NONE ||
  17. rotate == FBCON_ROTATE_UD) ?
  18. FB_blit16 : FB_blit16blocked;
  19. + } else if (vinfo.bits_per_pixel == 32) {
  20. + blitFunc = (rotate == FBCON_ROTATE_NONE ||
  21. + rotate == FBCON_ROTATE_UD) ?
  22. + FB_blit32 : FB_blit32blocked;
  23. } else {
  24. #ifdef FBCON_DEBUG
  25. fprintf(stderr, "Init vinfo:\n");
  26. @@ -1495,6 +1503,57 @@ static void FB_blit16blocked(Uint8 *byte_src_pos, int src_right_delta, int src_d
  27. }
  28. }
  29. +static void FB_blit32(Uint8 *byte_src_pos, int src_right_delta, int src_down_delta,
  30. + Uint8 *byte_dst_pos, int dst_linebytes, int width, int height)
  31. +{
  32. + int w;
  33. + Uint32 *src_pos = (Uint32 *)byte_src_pos;
  34. + Uint32 *dst_pos = (Uint32 *)byte_dst_pos;
  35. +
  36. + while (height) {
  37. + Uint32 *src = src_pos;
  38. + Uint32 *dst = dst_pos;
  39. + for (w = width; w != 0; w--) {
  40. + *dst = *src;
  41. + src += src_right_delta;
  42. + dst++;
  43. + }
  44. + dst_pos = (Uint32 *)((Uint8 *)dst_pos + dst_linebytes);
  45. + src_pos += src_down_delta;
  46. + height--;
  47. + }
  48. +}
  49. +
  50. +#define BLOCKSIZE_W 32
  51. +#define BLOCKSIZE_H 32
  52. +
  53. +static void FB_blit32blocked(Uint8 *byte_src_pos, int src_right_delta, int src_down_delta,
  54. + Uint8 *byte_dst_pos, int dst_linebytes, int width, int height)
  55. +{
  56. + int w;
  57. + Uint32 *src_pos = (Uint32 *)byte_src_pos;
  58. + Uint32 *dst_pos = (Uint32 *)byte_dst_pos;
  59. +
  60. + while (height > 0) {
  61. + Uint32 *src = src_pos;
  62. + Uint32 *dst = dst_pos;
  63. + for (w = width; w > 0; w -= BLOCKSIZE_W) {
  64. + FB_blit32((Uint8 *)src,
  65. + src_right_delta,
  66. + src_down_delta,
  67. + (Uint8 *)dst,
  68. + dst_linebytes,
  69. + min(w, BLOCKSIZE_W),
  70. + min(height, BLOCKSIZE_H));
  71. + src += src_right_delta * BLOCKSIZE_W;
  72. + dst += BLOCKSIZE_W;
  73. + }
  74. + dst_pos = (Uint32 *)((Uint8 *)dst_pos + dst_linebytes * BLOCKSIZE_H);
  75. + src_pos += src_down_delta * BLOCKSIZE_H;
  76. + height -= BLOCKSIZE_H;
  77. + }
  78. +}
  79. +
  80. static void FB_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
  81. {
  82. int width = cache_vinfo.xres;
  83. @@ -1507,10 +1566,10 @@ static void FB_DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
  84. return;
  85. }
  86. - if (cache_vinfo.bits_per_pixel != 16) {
  87. - SDL_SetError("Shadow copy only implemented for 16 bpp");
  88. - return;
  89. - }
  90. +// if (cache_vinfo.bits_per_pixel != 16) {
  91. +// SDL_SetError("Shadow copy only implemented for 16 bpp");
  92. +// return;
  93. +// }
  94. for (i = 0; i < numrects; i++) {
  95. int x1, y1, x2, y2;