Commit db56bc2c authored by Ken Mays's avatar Ken Mays Committed by Dylan Baker

haiku: fix Mesa build

1. The hgl.c file is a read-only file versus read-write.
Ref: src/gallium/state_trackers/hgl/hgl.c

2.  I've included the Haiku-specific patches I used to get a successful
build of Mesa 19.1.7 on Haiku using the meson/ninja build procedure.
Shows "[764/764] linking target ... libswpipe.so" at build completion.

v2:
Remove autotools files (Eric)

v3:
Update the patch
Reported-by: default avatarKen Mays <kmays2000@gmail.com>
Tested-by: default avatarKen Mays <kmays2000@gmail.com>
CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Alexander von Gluck IV's avatarAlexander von Gluck IV <kallisti5@unixzen.com>
(cherry picked from commit 4943c89d)
parent 4169d869
...@@ -44,7 +44,8 @@ hgl_st_context(struct st_context_iface *stctxi) ...@@ -44,7 +44,8 @@ hgl_st_context(struct st_context_iface *stctxi)
// Perform a safe void to hgl_buffer cast // Perform a safe void to hgl_buffer cast
static inline struct hgl_buffer* //static inline struct hgl_buffer*
struct hgl_buffer*
hgl_st_framebuffer(struct st_framebuffer_iface *stfbi) hgl_st_framebuffer(struct st_framebuffer_iface *stfbi)
{ {
struct hgl_buffer* buffer; struct hgl_buffer* buffer;
...@@ -62,7 +63,9 @@ hgl_st_framebuffer_flush_front(struct st_context_iface *stctxi, ...@@ -62,7 +63,9 @@ hgl_st_framebuffer_flush_front(struct st_context_iface *stctxi,
CALLED(); CALLED();
//struct hgl_context* context = hgl_st_context(stctxi); //struct hgl_context* context = hgl_st_context(stctxi);
//struct hgl_buffer* buffer = hgl_st_context(stfbi); // struct hgl_buffer* buffer = hgl_st_context(stfbi);
struct hgl_buffer* buffer = hgl_st_framebuffer(stfbi);
//buffer->surface
#if 0 #if 0
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb); struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
...@@ -281,7 +284,8 @@ hgl_create_st_manager(struct hgl_context* context) ...@@ -281,7 +284,8 @@ hgl_create_st_manager(struct hgl_context* context)
//manager->display = dpy; //manager->display = dpy;
manager->screen = context->screen; manager->screen = context->screen;
manager->get_param = hgl_st_manager_get_param; manager->get_param = hgl_st_manager_get_param;
manager->st_manager_private = (void *)context;
return manager; return manager;
} }
......
...@@ -39,6 +39,8 @@ struct hgl_buffer ...@@ -39,6 +39,8 @@ struct hgl_buffer
unsigned mask; unsigned mask;
struct pipe_screen* screen; struct pipe_screen* screen;
struct pipe_surface* surface;
enum pipe_texture_target target; enum pipe_texture_target target;
struct pipe_resource* textures[ST_ATTACHMENT_COUNT]; struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
...@@ -80,6 +82,8 @@ struct hgl_context ...@@ -80,6 +82,8 @@ struct hgl_context
struct hgl_buffer* read; struct hgl_buffer* read;
}; };
// hgl_buffer from statetracker interface
struct hgl_buffer* hgl_st_framebuffer(struct st_framebuffer_iface *stfbi);
// hgl state_tracker api // hgl state_tracker api
struct st_api* hgl_create_st_api(void); struct st_api* hgl_create_st_api(void);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "sw/hgl/hgl_sw_winsys.h" #include "sw/hgl/hgl_sw_winsys.h"
#include "util/u_atomic.h" #include "util/u_atomic.h"
#include "util/u_memory.h" #include "util/u_memory.h"
#include "util/u_framebuffer.h"
#include "target-helpers/inline_sw_helper.h" #include "target-helpers/inline_sw_helper.h"
#include "target-helpers/inline_debug_helper.h" #include "target-helpers/inline_debug_helper.h"
...@@ -332,36 +333,17 @@ GalliumContext::SwapBuffers(context_id contextID) ...@@ -332,36 +333,17 @@ GalliumContext::SwapBuffers(context_id contextID)
ERROR("%s: context not found\n", __func__); ERROR("%s: context not found\n", __func__);
return B_ERROR; 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); context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
struct st_context *stContext = (struct st_context*)context->st; struct hgl_buffer* buffer = hgl_st_framebuffer(context->draw->stfbi);
pipe_surface* surface = buffer->surface;
unsigned nColorBuffers = stContext->state.framebuffer.nr_cbufs; if (!surface) {
for (unsigned i = 0; i < nColorBuffers; i++) { ERROR("%s: Invalid drawable surface!\n", __func__);
pipe_surface* surface = stContext->state.framebuffer.cbufs[i]; return B_ERROR;
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);
} }
#if 0 fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 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); context->bitmap, NULL);
#endif
return B_OK; return B_OK;
} }
......
...@@ -51,6 +51,7 @@ BGLView::BGLView(BRect rect, const char* name, ulong resizingMode, ulong mode, ...@@ -51,6 +51,7 @@ BGLView::BGLView(BRect rect, const char* name, ulong resizingMode, ulong mode,
fDitherMap(NULL) fDitherMap(NULL)
{ {
fRoster = new GLRendererRoster(this, options); fRoster = new GLRendererRoster(this, options);
fRenderer = fRoster->GetRenderer();
} }
...@@ -68,7 +69,7 @@ BGLView::LockGL() ...@@ -68,7 +69,7 @@ BGLView::LockGL()
// TODO: acquire the OpenGL API lock it on this glview // TODO: acquire the OpenGL API lock it on this glview
fDisplayLock.Lock(); fDisplayLock.Lock();
if (fRenderer) if (fRenderer != NULL && fDisplayLock.CountLocks() == 1)
fRenderer->LockGL(); fRenderer->LockGL();
} }
...@@ -76,7 +77,7 @@ BGLView::LockGL() ...@@ -76,7 +77,7 @@ BGLView::LockGL()
void void
BGLView::UnlockGL() BGLView::UnlockGL()
{ {
if (fRenderer) if (fRenderer != NULL && fDisplayLock.CountLocks() == 1)
fRenderer->UnlockGL(); fRenderer->UnlockGL();
fDisplayLock.Unlock(); fDisplayLock.Unlock();
...@@ -189,7 +190,6 @@ BGLView::AttachedToWindow() ...@@ -189,7 +190,6 @@ BGLView::AttachedToWindow()
for (BView* view = this; view != NULL; view = view->Parent()) for (BView* view = this; view != NULL; view = view->Parent())
view->ConvertToParent(&fBounds); view->ConvertToParent(&fBounds);
fRenderer = fRoster->GetRenderer();
if (fRenderer != NULL) { if (fRenderer != NULL) {
// Jackburton: The following code was commented because it doesn't look // Jackburton: The following code was commented because it doesn't look
// good in "direct" mode: // good in "direct" mode:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment