Use ${PARALLEL_MAKE} instead of -j16 for ninja
[scm/bb/meta-tizen.git] / meta-tizen-adaptation / meta / recipes-graphics / mesa / files / 0001-intel:-FixinitialMakeCurrentfordrawablesofmultiscreens.patch
1 From 7f23dd58a4f0a7e4340b6a592af5de62dcd7a292 Mon Sep 17 00:00:00 2001
2 From: Xiong Zhang <xiong.y.zhang@intel.com>
3 Date: Mon, 9 Jun 2014 10:35:55 +0800
4 Subject: [PATCH] intel: Fix initial MakeCurrent for drawables of multi screens
5
6 This patch fix a regression caused by commit 11baad35.
7
8 Multi screens share one context. When the first screen call
9 intel_prepare_render(), it will set ctx->ViewportInitialized to
10 true, so the following screens don't have chance to call intel
11 _prepare_render().
12 If all screens run following gl command:
13 eglMakeCurrent()
14 glClearColor()
15 glClear()
16 eglSwapBuffers()
17 The first screen can run above command successfully. But the
18 following screen will occur segment fault error on eglSwapBuffers().
19 Because when following screens run:
20 eglMakeCurrent() won't call intel_prepare_render(); the width and
21 height of Draw buffer is zero, this causes glClear() return early
22 without calling Driver.Clear(); finaly Draw buffer doesn't have
23 bo, so eglSwapBuffers() occur segment fault error.
24
25 Change-Id: Ib2513488eaa148d2ebd45a4aa19686aea8eab899
26 Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
27 ---
28  src/mesa/drivers/dri/i965/brw_context.c | 10 ++++++----
29  1 file changed, 6 insertions(+), 4 deletions(-)
30
31 diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
32 index 619f2d5..c819801 100644
33 --- a/src/mesa/drivers/dri/i965/brw_context.c
34 +++ b/src/mesa/drivers/dri/i965/brw_context.c
35 @@ -984,6 +984,7 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
36     if (driContextPriv) {
37        struct gl_context *ctx = &brw->ctx;
38        struct gl_framebuffer *fb, *readFb;
39 +      struct intel_renderbuffer *rb = NULL;
40  
41        if (driDrawPriv == NULL && driReadPriv == NULL) {
42           fb = _mesa_get_incomplete_framebuffer();
43 @@ -991,6 +992,7 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
44        } else {
45           fb = driDrawPriv->driverPrivate;
46           readFb = driReadPriv->driverPrivate;
47 +        rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
48           driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1;
49           driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1;
50        }
51 @@ -1002,10 +1004,10 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
52        intel_gles3_srgb_workaround(brw, fb);
53        intel_gles3_srgb_workaround(brw, readFb);
54  
55 -      /* If the context viewport hasn't been initialized, force a call out to
56 -       * the loader to get buffers so we have a drawable size for the initial
57 -       * viewport. */
58 -      if (!brw->ctx.ViewportInitialized)
59 +      /* If the context viewport or buffers haven't been initialized, force
60 +       * a call out to the loader to get buffers so we have a drawable size
61 +       * for the initial viewport. */
62 +      if (!brw->ctx.ViewportInitialized || (rb && !rb->mt))
63           intel_prepare_render(brw);
64  
65        _mesa_make_current(ctx, fb, readFb);
66 -- 
67 1.8.1.4
68