Bug 74083 - [regression,i965] 11baad35 breaks switching drawables
Summary: [regression,i965] 11baad35 breaks switching drawables
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Kristian Høgsberg
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Reported: 2014-01-26 13:18 UTC by Alexander Monakov
Modified: 2014-02-05 19:50 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

reproducer (1.42 KB, text/plain)
2014-01-26 13:18 UTC, Alexander Monakov

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Monakov 2014-01-26 13:18:35 UTC
Created attachment 92812 [details]

The following commit introduced a regression in case an application thread attempted to bind a GLX context to two different drawables in succession.  When the second drawable is bound, brw->ctx.ViewportInitialized is not reset, so intel_prepare_render is not called.  A standalone testcase is attached.

commit 11baad35088dfd4bdabc1710df650dbfb413e7a3
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Tue Jan 21 12:17:03 2014 -0800

    intel: Fix initial MakeCurrent for single-buffer drawables
    Commit 05da4a7a5e7d5bd988cb31f94ed8e1f053d9ee39 attempts to eliminate the
    call to intel_update_renderbuffer() in the case where we already have a
    drawbuffer for the drawable.  Unfortunately this only checks the
    back left renderbuffer, which breaks in case of single buffer drawables.
    This means that the initial viewport will not be set in that case.  Instead,
    we now check whether the initial viewport has not been set, in which case
    we call out to intel_update_renderbuffer().
    Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Comment 1 Nazar Mokrynskyi 2014-01-27 12:00:39 UTC
There was a discussion with additional confirmation of bug on GitHub:
Comment 2 Alexander Monakov 2014-01-27 12:03:08 UTC
(In reply to comment #1)
> There was a discussion with additional confirmation of bug on GitHub:
> https://github.com/amonakov/primus/issues/129

It doesn't provide any more useful information than already supplied here.
Comment 3 Kristian Høgsberg 2014-02-05 19:50:59 UTC
Pushed to master:

commit 44338cd826623ae0675861015a56c528261f3fd3
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Wed Feb 5 10:59:02 2014 -0800

    i965: Move intel_prepare_render() above first buffer access
    The driver is supposed to ensure buffers before any drawing operation, but in
    do_blit_drawpixels() and do_blit_copypixels() we inspect the buffer format
    before calling intel_prepare_render().  That was covered up by the
    unconditional call to intel_prepare_render() in intelMakeCurrent(), but we
    now only do this on the initial intelMakeCurrent call for a context
    (to get the size for the initial viewport values).
    Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
    Tested-by: Alexander Monakov <amonakov@gmail.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.