919 else |
919 else |
920 qWarning("QDirectFBScreen: Unknown flip argument: %s", |
920 qWarning("QDirectFBScreen: Unknown flip argument: %s", |
921 qPrintable(flip)); |
921 qPrintable(flip)); |
922 } |
922 } |
923 } else { |
923 } else { |
924 flipFlags = DSFLIP_BLIT; |
924 flipFlags = DSFLIP_BLIT|DSFLIP_ONSYNC; |
925 } |
925 } |
926 } |
926 } |
927 |
927 |
928 #ifdef QT_DIRECTFB_WM |
928 #ifdef QT_DIRECTFB_WM |
929 void QDirectFBScreenPrivate::onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event) |
929 void QDirectFBScreenPrivate::onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event) |
1124 } |
1124 } |
1125 } |
1125 } |
1126 |
1126 |
1127 if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) { |
1127 if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) { |
1128 d_ptr->directFBFlags |= BoundingRectFlip; |
1128 d_ptr->directFBFlags |= BoundingRectFlip; |
|
1129 } else if (displayArgs.contains(QLatin1String("nopartialflip"), Qt::CaseInsensitive)) { |
|
1130 d_ptr->directFBFlags |= NoPartialFlip; |
1129 } |
1131 } |
1130 |
1132 |
1131 #ifdef QT_DIRECTFB_IMAGECACHE |
1133 #ifdef QT_DIRECTFB_IMAGECACHE |
1132 int imageCacheSize = 4 * 1024 * 1024; // 4 MB |
1134 int imageCacheSize = 4 * 1024 * 1024; // 4 MB |
1133 setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize); |
1135 setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize); |
1136 |
1138 |
1137 #ifndef QT_NO_DIRECTFB_WM |
1139 #ifndef QT_NO_DIRECTFB_WM |
1138 if (displayArgs.contains(QLatin1String("fullscreen"))) |
1140 if (displayArgs.contains(QLatin1String("fullscreen"))) |
1139 #endif |
1141 #endif |
1140 d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN); |
1142 d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN); |
|
1143 |
|
1144 const bool forcePremultiplied = displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive); |
1141 |
1145 |
1142 DFBSurfaceDescription description; |
1146 DFBSurfaceDescription description; |
1143 memset(&description, 0, sizeof(DFBSurfaceDescription)); |
1147 memset(&description, 0, sizeof(DFBSurfaceDescription)); |
1144 IDirectFBSurface *surface; |
1148 IDirectFBSurface *surface; |
1145 |
1149 |
1165 for (int i=0; capabilities[i].name; ++i) { |
1169 for (int i=0; capabilities[i].name; ++i) { |
1166 if (displayArgs.contains(QString::fromLatin1(capabilities[i].name), Qt::CaseInsensitive)) |
1170 if (displayArgs.contains(QString::fromLatin1(capabilities[i].name), Qt::CaseInsensitive)) |
1167 description.caps |= capabilities[i].cap; |
1171 description.caps |= capabilities[i].cap; |
1168 } |
1172 } |
1169 |
1173 |
1170 if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) { |
1174 if (forcePremultiplied) { |
1171 description.caps |= DSCAPS_PREMULTIPLIED; |
1175 description.caps |= DSCAPS_PREMULTIPLIED; |
1172 } |
1176 } |
1173 |
1177 |
1174 // We don't track the primary surface as it's released in disconnect |
1178 // We don't track the primary surface as it's released in disconnect |
1175 d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result); |
1179 d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result); |
1215 case QImage::Format_RGB16: |
1219 case QImage::Format_RGB16: |
1216 case QImage::Format_RGB555: |
1220 case QImage::Format_RGB555: |
1217 d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied; |
1221 d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied; |
1218 break; |
1222 break; |
1219 case QImage::Format_ARGB32: |
1223 case QImage::Format_ARGB32: |
|
1224 if (forcePremultiplied) |
|
1225 d_ptr->alphaPixmapFormat = pixelFormat = QImage::Format_ARGB32_Premultiplied; |
1220 case QImage::Format_ARGB32_Premultiplied: |
1226 case QImage::Format_ARGB32_Premultiplied: |
1221 case QImage::Format_ARGB4444_Premultiplied: |
1227 case QImage::Format_ARGB4444_Premultiplied: |
1222 case QImage::Format_ARGB8555_Premultiplied: |
1228 case QImage::Format_ARGB8555_Premultiplied: |
1223 case QImage::Format_ARGB8565_Premultiplied: |
1229 case QImage::Format_ARGB8565_Premultiplied: |
1224 case QImage::Format_ARGB6666_Premultiplied: |
1230 case QImage::Format_ARGB6666_Premultiplied: |
1672 return true; |
1678 return true; |
1673 } |
1679 } |
1674 |
1680 |
1675 uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) |
1681 uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) |
1676 { |
1682 { |
1677 void *mem; |
1683 void *mem = 0; |
1678 const DFBResult result = surface->Lock(surface, flags, &mem, bpl); |
1684 const DFBResult result = surface->Lock(surface, flags, &mem, bpl); |
1679 if (result != DFB_OK) { |
1685 if (result != DFB_OK) { |
1680 DirectFBError("QDirectFBScreen::lockSurface()", result); |
1686 DirectFBError("QDirectFBScreen::lockSurface()", result); |
1681 } |
1687 } |
1682 |
1688 |
1683 return reinterpret_cast<uchar*>(mem); |
1689 return reinterpret_cast<uchar*>(mem); |
1684 } |
1690 } |
1685 |
1691 |
|
1692 static inline bool isFullUpdate(IDirectFBSurface *surface, const QRegion ®ion, const QPoint &offset) |
|
1693 { |
|
1694 if (offset == QPoint(0, 0) && region.rectCount() == 1) { |
|
1695 QSize size; |
|
1696 surface->GetSize(surface, &size.rwidth(), &size.rheight()); |
|
1697 if (region.boundingRect().size() == size) |
|
1698 return true; |
|
1699 } |
|
1700 return false; |
|
1701 } |
1686 |
1702 |
1687 void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, |
1703 void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, |
1688 const QRegion ®ion, const QPoint &offset) |
1704 const QRegion ®ion, const QPoint &offset) |
1689 { |
1705 { |
1690 if (!(flipFlags & DSFLIP_BLIT)) { |
1706 if (d_ptr->directFBFlags & NoPartialFlip |
|
1707 || (!(flipFlags & DSFLIP_BLIT) && QT_PREPEND_NAMESPACE(isFullUpdate(surface, region, offset)))) { |
1691 surface->Flip(surface, 0, flipFlags); |
1708 surface->Flip(surface, 0, flipFlags); |
1692 } else { |
1709 } else { |
1693 if (!(d_ptr->directFBFlags & BoundingRectFlip) && region.rectCount() > 1) { |
1710 if (!(d_ptr->directFBFlags & BoundingRectFlip) && region.rectCount() > 1) { |
1694 const QVector<QRect> rects = region.rects(); |
1711 const QVector<QRect> rects = region.rects(); |
1695 const DFBSurfaceFlipFlags nonWaitFlags = flipFlags & ~DSFLIP_WAIT; |
1712 const DFBSurfaceFlipFlags nonWaitFlags = flipFlags & ~DSFLIP_WAIT; |