From 9e4967aa9d166326e5f016dd9d768aa8e29116b2 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 6 Apr 2012 15:11:33 -0500 Subject: [PATCH] dp common: Build Fix, use get_pixel_size_for. * Thanks DeadYak for the tip --- src/add-ons/accelerants/common/dp.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/add-ons/accelerants/common/dp.cpp b/src/add-ons/accelerants/common/dp.cpp index a6a7adcb1a..8b9c5764fd 100644 --- a/src/add-ons/accelerants/common/dp.cpp +++ b/src/add-ons/accelerants/common/dp.cpp @@ -62,20 +62,18 @@ dp_decode_link_rate(uint32 rawLinkRate) uint32 dp_get_lane_count(dp_info* dpInfo, display_mode* mode) { - // TODO: Really need a function in GraphicDefs.h for this - uint32 bitsPerPixel; - switch (mode->space) { - case B_CMAP8: - bitsPerPixel = 8; - case B_RGB15_LITTLE: - bitsPerPixel = 15; - case B_RGB16_LITTLE: - bitsPerPixel = 16; - case B_RGB24_LITTLE: - case B_RGB32_LITTLE: - bitsPerPixel = 32; + size_t pixelChunk; + size_t pixelsPerChunk; + status_t result = get_pixel_size_for((color_space)mode->space, &pixelChunk, + NULL, &pixelsPerChunk); + + if (result != B_OK) { + TRACE("%s: Invalid color space!\n", __func__); + return 0; } + uint32 bitsPerPixel = (pixelChunk / pixelsPerChunk) * 8; + uint32 maxLaneCount = dpInfo->config[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK; uint32 maxLinkRate = dp_decode_link_rate(dpInfo->config[DP_MAX_LINK_RATE]);