qt5.6.2 run segment fault in hw acceleration directfb



  • I used Qt5.6.2 + directfb 1.7.7 + hw acceleration
    The directfb example df_dok run well.
    while run qt example animatedtiles, segment fault occured.
    I found the function QBlitterPaintEnginePrivate::fillRect, it call QRasterPaintEngine::init ( d->rasterBuffer->prepare(static_cast<QImage *>(d->device)); will save address in Rasterbuffer)
    and alloc a buffer from directfb, then the buffer freed by directfb.
    after that It call QRasterPaintEngine::drawPolygon which call blend function and it segment fault because the Rasterbuffer address is old?
    how can I resovle this problem?



  • Dear expert,
    I attached some debug info:
    here mem=0x7f907a4010 is freed, I want to know if it is expected ?

    .....
    QDirectFbBlitter
    blittable:0x1cbc8280
    lock QBlittablePlatformPixmap::buffer
    blittable:0x1cbc8280
    QBlittable::lock
    doLock
    doLock, after getsize:w=512,h=682,mem=0x7f907a4010
    create1:d=0x1cbcd840,data=0x7f907a4010
    QImage5:d=0x1cbcd840
    QBlittable::lock d->cachedImg=0x1cbc8298,set d->locked true,d=0x1cbcda90
    QRasterPaintEngine::QRasterPaintEngine2
    QRasterPaintEngine::init:3
    QRasterBuffer::prepare: m_buffer:0x7f907a4010,image:0x1cbc8298
    ==QRasterPaintEngine::init:Image prepare format=5
    attachPainterPrivate
    QPainter::begin(), device=0x1cbce7b0, type=2
    call d->engine->begin(pd)
    QRasterPaintEngine::begin(0x1cbce7b0)
    lock QBlittablePlatformPixmap::buffer
    blittable:0x1cbc8280
    QBlittable::lock
    systemStateChanged 0x1cbd0100 deviceRect QRect(0,0 512x682) QRect(0,0 512x682) QRegion(null)
    QRasterPaintEngine::begin( 0x1cbce7b0 ) devType: 2 devRect: QRect(0,0 512x682)
    clip 0: 0 0 - 511 681
    QImage7:d=0x1cbc6420
    QRasterPaintEngine::penChanged(): QPen(1,QBrush(QColor(ARGB 1, 0, 0, 0),SolidPattern),SolidLine,16,64,QVector(),0,2)
    QRasterPaintEngine::compositionModeChanged() 3
    unlock QBlitterPaintEnginePrivate::fillRect
    blittable:0x1cbc8280
    doUnlock
    QBlittable::unlock,set d->locked = false,d=482138768
    QBlitterPaintEnginePrivate::unlock()
    blittable:0x1cbc8280
    alphaFillRect
    unlock QBlitterPaintEnginePrivate::fillRect
    blittable:0x1cbc8280
    QBlitterPaintEnginePrivate::unlock()
    blittable:0x1cbc8280
    alphaFillRect
    unlock QBlitterPaintEnginePrivate::fillRect
    blittable:0x1cbc8280
    QBlitterPaintEnginePrivate::unlock()
    blittable:0x1cbc8280
    alphaFillRect
    unlock QBlitterPaintEnginePrivate::fillRect
    blittable:0x1cbc8280
    QBlitterPaintEnginePrivate::unlock()
    blittable:0x1cbc8280
    alphaFillRect
    unlock QBlitterPaintEnginePrivate::fillRect
    blittable:0x1cbc8280
    QBlitterPaintEnginePrivate::unlock()
    blittable:0x1cbc8280
    alphaFillRect
    QRasterPaintEngine::compositionModeChanged() 0
    QPainter::end()
    QRasterPaintEngine::end
    QRasterPaintEngine::end devRect: QRect(0,0 512x682)
    clip 1: 0 0 - 511 681
    QImage7:d=0x1cbc7330
    attachPainterPrivate
    attachPainterPrivate
    QPainter::begin(), device=0x1cbce7b0, type=2
    call d->engine->begin(pd)
    QRasterPaintEngine::begin(0x1cbce7b0)
    lock QBlittablePlatformPixmap::buffer
    blittable:0x1cbc8280
    QBlittable::lock
    doLock
    doLock, after getsize:w=512,h=682,mem=0x7f958e9660
    create1:d=0x1cbd4ca0,data=0x7f958e9660
    QImage5:d=0x1cbd4ca0
    QBlittable::lock d->cachedImg=0x1cbc8298,set d->locked true,d=0x1cbcda90
    systemStateChanged 0x1cbd0100 deviceRect QRect(0,0 512x682) QRect(0,0 512x682) QRegion(size=6, bounds=(0,0 512x682) - [(0,0 512x2), (0,2 2x662), (510,2 2x662), (0,664 2x16), (494,664 18x16), (0,680 512x2)])
    QRasterPaintEngine::begin( 0x1cbce7b0 ) devType: 2 devRect: QRect(0,0 512x682)
    clip 2: 0 0 - 511 681
    QImage7:d=0x1cbcd840
    QRasterPaintEngine::penChanged(): QPen(1,QBrush(QColor(ARGB 1, 0, 0, 0),SolidPattern),SolidLine,16,64,QVector(),0,2)
    unlock QBlitterPaintEnginePrivate::fillRect
    blittable:0x1cbc8280
    doUnlock
    QBlittable::unlock,set d->locked = false,d=482138768
    QBlitterPaintEnginePrivate::unlock()
    blittable:0x1cbc8280
    alphaFillRect
    QPainter::end()
    QRasterPaintEngine::end
    QRasterPaintEngine::end devRect: QRect(0,0 512x682)
    clip 3: 0 0 - 511 681
    QImage7:d=0x1cbcff70
    attachPainterPrivate
    attachPainterPrivate
    QPainter::begin(), device=0x1cbce7b0, type=2
    call d->engine->begin(pd)
    QRasterPaintEngine::begin(0x1cbce7b0)
    lock QBlittablePlatformPixmap::buffer
    blittable:0x1cbc8280
    QBlittable::lock
    doLock
    doLock, after getsize:w=512,h=682,mem=0x7f958e9660
    create1:d=0x1cbcd840,data=0x7f958e9660
    QImage5:d=0x1cbcd840
    QBlittable::lock d->cachedImg=0x1cbc8298,set d->locked true,d=0x1cbcda90
    systemStateChanged 0x1cbd0100 deviceRect QRect(0,0 512x682) QRect(0,0 512x682) QRegion(size=6, bounds=(0,0 512x682) - [(0,0 512x2), (0,2 2x662), (510,2 2x662), (0,664 2x16), (494,664 18x16), (0,680 512x2)])
    QRasterPaintEngine::begin( 0x1cbce7b0 ) devType: 2 devRect: QRect(0,0 512x682)
    clip 4: 0 0 - 511 681
    QImage7:d=0x1cbc6790
    QRasterPaintEngine::penChanged(): QPen(1,QBrush(QColor(ARGB 1, 0, 0, 0),SolidPattern),SolidLine,16,64,QVector(),0,2)
    paintEvent, call drawFrame
    QPainter::setPen(), color=ff9f9d9a
    QRasterPaintEngine::penChanged(): QPen(1,QBrush(QColor(ARGB 1, 0.624826, 0.614374, 0.603906),SolidPattern),SolidLine,16,64,QVector(),0,2)
    QPainter::drawPolyline(), count=3
    QBlitterPaintEngine::drawPolygon20
    lock QBlitterPaintEngine::drawPolygon2
    QBlitterPaintEnginePrivate lock:pmData=(nil)
    blittable:0x1cbc8280
    d->locked=1,d=0x1cbcda90
    QRasterPaintEngine::drawPolygon21

    • QRasterPaintEngine::drawPolygon(I), pointCount=3
      • QPoint(0,680)
      • QPoint(0,0)
      • QPoint(510,0)
        QRasterPaintEngine::updatePen(): QPen(1,QBrush(QColor(ARGB 1, 0.624826, 0.614374, 0.603906),SolidPattern),SolidLine,16,64,QVector(),0,2)
        data=0x1cbc6150,rasterBuffer()=0x1cbcfe20,dest=0x7fd01d5340

    Thread 1 "animatedtiles" hit Breakpoint 1, destStore (rasterBuffer=0x1cbcfe20,
    x=0, y=0, buffer=0x7fd01d5340, length=1) at painting/qdrawhelper.cpp:1200
    1200 painting/qdrawhelper.cpp: No such file or directory.
    (gdb) bt  print *rasterBuffer
    $1 = {monoDestinationWithClut = false, destColor0 = 0, destColor1 = 0,
    compositionMode = QPainter::CompositionMode_SourceOver,
    format = QImage::Format_ARGB32, drawHelper = 0x7f9a8dca50 <qDrawHelper+240>,
    m_width = 512, m_height = 682, bytes_per_line = 2048, bytes_per_pixel = 4,
    m_buffer = 0x7f907a4010 <error: Cannot access memory at address 0x7f907a4010>}
    (gdb) bt
    #0 destStore (rasterBuffer=0x1cbcfe20, x=0, y=0, buffer=0x7fd01d5340,
    length=1) at painting/qdrawhelper.cpp:1200
    #1 0x0000007f9a7b3ed0 in blend_color_generic (count=<optimized out>,
    spans=0x7fd01d7390, userData=0x1cbc6150) at painting/qdrawhelper.cpp:3849
    #2 0x0000007f9a7d81e4 in qt_span_fill_clipped (spanCount=<optimized out>,
    spans=0x7fd01d8ec6, userData=0x1cbc6150)
    at painting/qpaintengine_raster.cpp:4010
    #3 0x0000007f9a7ad94c in drawPixel (stroker=0x7fd01d8658, x=0, y=255,
    coverage=255) at painting/qcosmeticstroker.cpp:149
    #4 0x0000007f9a7ac520 in drawLine<drawPixel, (anonymous namespace)::NoDasher>
    (stroker=0x7fd01d8658, rx1=2.7077441715526826e-312,
    ry1=2.3819263675291635e-315, rx2=2.3819676318919042e-315,
    ry2=1.4821969375237396e-323, caps=<optimized out>)
    at painting/qcosmeticstroker.cpp:811
    #5 0x0000007f9a7ad2d4 in QCosmeticStroker::drawPath (
    this=this@entry=0x7fd01d8658, path=...)
    at painting/qcosmeticstroker.cpp:608
    #6 0x0000007f9a7dda68 in QRasterPaintEngine::drawPolygon (this=0x1cbc8020,
    points=<optimized out>, pointCount=3, mode=<optimized out>)
    at painting/qpaintengine_raster.cpp:1989
    #7 0x0000007f9a7eaa0c in QPainter::drawPolyline (
    this=this@entry=0x7fd01d9778, points=0x7fd01d9000,
    points@entry=0x7fd01d9070, pointCount=pointCount@entry=3)
    ---Type <return> to continue, or q <return> to quit---q
    at painting/qpaintQuit
    (gdb) y



  • I also test directfb-1.7.7 hw acceleration + qt 4.8.7, no crash happened,
    anyone know it?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should check the bug report system.



  • @SGaist said in qt5.6.2 run segment fault in hw acceleration directfb:

    Hi and welcome to devnet,

    You should check the bug report system.

    Hi Dear SGaist,
    I checked 'Find existing bugs" about the key "directfb" one by one, no relative bugs information found.
    I want to know if directfb hw acceleration is worked well in this Qt5.6 ?


  • Lifetime Qt Champion

    AFAIK yes, you should be consider testing a more recent version of Qt, currently 5.9.1.



  • set directfb desktop-buffer-mode=backsystem, no segment fault occured.
    but it's not really fix the segment fault issue


  • Lifetime Qt Champion

    You may have found something.

    You should consider opening a new report providing all the details related to your device an installation as well as your current work-around.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.