[haiku-commits] haiku: hrev43899 - src/add-ons/accelerants/radeon_hd

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 29 Mar 2012 19:08:37 +0200 (CEST)

hrev43899 adds 1 changeset to branch 'master'
old head: 66bcbd98fcaae65f9ea5592ff4949a50fac9eba8
new head: 7e9cb0275587be51109118f9ffcf6b6f385a070e

----------------------------------------------------------------------------

7e9cb02: radeon_hd: Correct framebuffer pixel pitch alignment

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev43899
Commit:      7e9cb0275587be51109118f9ffcf6b6f385a070e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7e9cb02
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Thu Mar 29 08:33:07 2012 UTC

----------------------------------------------------------------------------

1 files changed, 25 insertions(+), 7 deletions(-)
src/add-ons/accelerants/radeon_hd/display.cpp |   32 ++++++++++++++++----

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp 
b/src/add-ons/accelerants/radeon_hd/display.cpp
index ac5a36c..8e59b4b 100644
--- a/src/add-ons/accelerants/radeon_hd/display.cpp
+++ b/src/add-ons/accelerants/radeon_hd/display.cpp
@@ -599,8 +599,6 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode)
                        break;
        }
 
-       uint32 bytesPerRow = mode->virtual_width * bytesPerPixel;
-
        Write32(OUT, regs->vgaControl, 0);
 
        uint64 fbAddress = gInfo->fb.vramStart;
@@ -628,25 +626,45 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode)
                Write32(CRT, regs->grphSwapControl, fbSwap);
        }
 
+       // Align our framebuffer width
+       int widthAligned = mode->virtual_width;
+       int pitchMask = 0;
+
+       switch (bytesPerPixel) {
+               case 1:
+                       pitchMask = 255;
+                       break;
+               case 2:
+                       pitchMask = 127;
+                       break;
+               case 3:
+               case 4:
+                       pitchMask = 63;
+                       break;
+       }
+       widthAligned += pitchMask;
+       widthAligned &= ~pitchMask;
+
+
        Write32(CRT, regs->grphSurfaceOffsetX, 0);
        Write32(CRT, regs->grphSurfaceOffsetY, 0);
        Write32(CRT, regs->grphXStart, 0);
        Write32(CRT, regs->grphYStart, 0);
        Write32(CRT, regs->grphXEnd, mode->virtual_width);
        Write32(CRT, regs->grphYEnd, mode->virtual_height);
-       Write32(CRT, regs->grphPitch, (bytesPerRow / 4));
+       Write32(CRT, regs->grphPitch, widthAligned * bytesPerPixel / 4);
 
        Write32(CRT, regs->grphEnable, 1);
                // Enable Frame buffer
 
        Write32(CRT, regs->modeDesktopHeight, mode->virtual_height);
 
-       uint32 viewport_w = mode->timing.h_display;
-       uint32 viewport_h = (mode->timing.v_display + 1) & ~1;
+       uint32 viewportWidth = mode->timing.h_display;
+       uint32 viewportHeight = (mode->timing.v_display + 1) & ~1;
 
        Write32(CRT, regs->viewportStart, 0);
        Write32(CRT, regs->viewportSize,
-               (viewport_w << 16) | viewport_h);
+               (viewportWidth << 16) | viewportHeight);
 
        // Pageflip setup
        if (info.dceMajor >= 4) {
@@ -668,7 +686,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode)
        }
 
        // update shared info
-       gInfo->shared_info->bytes_per_row = bytesPerRow;
+       gInfo->shared_info->bytes_per_row = mode->virtual_width * bytesPerPixel;
        gInfo->shared_info->current_mode = *mode;
        gInfo->shared_info->bits_per_pixel = bitsPerPixel;
 }


Other related posts:

  • » [haiku-commits] haiku: hrev43899 - src/add-ons/accelerants/radeon_hd - kallisti5