<div dir="ltr">
<pre>From 5e91f6e5585c0d8db4183fb15f77a484b397044c Mon Sep 17 00:00:00 2001
From: kenmays <<a href="mailto:maybird1776@yahoo.com">maybird1776@yahoo.com</a>>
Date: Fri, 20 Sep 2019 19:06:42 +0000
Subject: [PATCH] GalliumContext.cpp: fix hgl_st_framebuffer build issue

---
 .../targets/haiku-softpipe/GalliumContext.cpp | 35 +++++--------------
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index 0356f65417c..c182e356e2d 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -26,6 +26,7 @@
 #include "sw/hgl/hgl_sw_winsys.h"
 #include "util/u_atomic.h"
 #include "util/u_memory.h"
+#include "util/u_framebuffer.h"
 
 #include "target-helpers/inline_sw_helper.h"
 #include "target-helpers/inline_debug_helper.h"
@@ -333,35 +334,15 @@ GalliumContext::SwapBuffers(context_id contextID)
                return B_ERROR;
        }
 
-       // TODO: Where did st_notify_swapbuffers go?
-       //st_notify_swapbuffers(context->draw->stfbi);
-
-       context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
-
-       struct st_context *stContext = (struct st_context*)context->st;
-
-       unsigned nColorBuffers = stContext->state.framebuffer.nr_cbufs;
-       for (unsigned i = 0; i < nColorBuffers; i++) {
-               pipe_surface* surface = stContext->state.framebuffer.cbufs[i];
-               if (!surface) {
-                       ERROR("%s: Color buffer %d invalid!\n", __func__, i);
-                       continue;
-               }
-
-               TRACE("%s: Flushing color buffer #%d\n", __func__, i);
-
-               // We pass our destination bitmap to flush_fronbuffer which passes it
-               // to the private winsys display call.
-               fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
-                       context->bitmap, NULL);
+       struct hgl_buffer* buffer = hgl_st_framebuffer(context->draw->stfbi);
+       pipe_surface* surface = buffer->surface;
+       if (!surface) {
+               ERROR("%s: Invalid drawable surface!\n", __func__);
+               return B_ERROR;
        }
 
-       #if 0
-       // TODO... should we flush the z stencil buffer?
-       pipe_surface* zSurface = stContext->state.framebuffer.zsbuf;
-       fScreen->flush_frontbuffer(fScreen, zSurface->texture, 0, 0,
-               context->bitmap, NULL);
-       #endif
+       fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
+               context->bitmap, NULL);
 
        return B_OK;
 }
-- 
2.22.0

</pre>

</div>