Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* It's painfully obvious to me now that we will need to manage our own framebuffers still in the latest gallium code. * GalliumFramebuffer works pretty cleanly as a class.. we have to remember to lock and unlock the Framebuffer object however when we access fBuffer directly. (which needs to occur by design) * I'm really starting to have problems with the amount of downcasting Gallium3D does now.
- Loading branch information
Showing
5 changed files
with
175 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Copyright 2012, Haiku, Inc. All Rights Reserved. | ||
* Distributed under the terms of the MIT License. | ||
* | ||
* Authors: | ||
* Artur Wyszynski, harakash@gmail.com | ||
* Alexander von Gluck IV, kallisti5@unixzen.com | ||
*/ | ||
|
||
|
||
#include "GalliumFramebuffer.h" | ||
|
||
extern "C" { | ||
#include "main/context.h" | ||
#include "main/framebuffer.h" | ||
#include "main/renderbuffer.h" | ||
#include "pipe/p_format.h" | ||
} | ||
|
||
|
||
#define TRACE_FRAMEBUFFER | ||
#ifdef TRACE_FRAEMBUFFER | ||
# define TRACE(x...) printf("GalliumFramebuffer: " x) | ||
# define CALLED() TRACE("CALLED: %s\n", __PRETTY_FUNCTION__) | ||
#else | ||
# define TRACE(x...) | ||
# define CALLED() | ||
#endif | ||
#define ERROR(x...) printf("GalliumFramebuffer: " x) | ||
|
||
|
||
static boolean | ||
hgl_framebuffer_flush_front(struct st_framebuffer_iface* stfb, | ||
enum st_attachment_type statt) | ||
{ | ||
CALLED(); | ||
// TODO: I have *NO* idea how we are going to access this data... | ||
|
||
#if 0 | ||
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb); | ||
pipe_mutex_lock(stwfb->fb->mutex); | ||
|
||
struct pipe_resource* resource = textures[statt]; | ||
if (resource) | ||
stw_framebuffer_present_locked(...); | ||
#endif | ||
|
||
return TRUE; | ||
} | ||
|
||
|
||
static boolean | ||
hgl_framebuffer_validate(struct st_framebuffer_iface* stfb, | ||
const enum st_attachment_type* statts, unsigned count, | ||
struct pipe_resource** out) | ||
{ | ||
CALLED(); | ||
|
||
return TRUE; | ||
} | ||
|
||
|
||
GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual) | ||
: | ||
fBuffer(NULL) | ||
{ | ||
CALLED(); | ||
fBuffer = CALLOC_STRUCT(st_framebuffer_iface); | ||
if (!fBuffer) { | ||
ERROR("%s: Couldn't calloc framebuffer!\n", __func__); | ||
return; | ||
} | ||
fBuffer->visual = visual; | ||
fBuffer->flush_front = hgl_framebuffer_flush_front; | ||
fBuffer->validate = hgl_framebuffer_validate; | ||
|
||
pipe_mutex_init(fMutex); | ||
} | ||
|
||
|
||
GalliumFramebuffer::~GalliumFramebuffer() | ||
{ | ||
CALLED(); | ||
// We lock and unlock to try and make sure we wait for anything | ||
// using the framebuffer to finish | ||
Lock(); | ||
if (!fBuffer) { | ||
ERROR("%s: Strange, no Gallium Framebuffer to free?\n", __func__); | ||
return; | ||
} | ||
FREE(fBuffer); | ||
Unlock(); | ||
|
||
pipe_mutex_destroy(fMutex); | ||
} | ||
|
||
|
||
status_t | ||
GalliumFramebuffer::Lock() | ||
{ | ||
CALLED(); | ||
pipe_mutex_lock(fMutex); | ||
return B_OK; | ||
} | ||
|
||
|
||
status_t | ||
GalliumFramebuffer::Unlock() | ||
{ | ||
CALLED(); | ||
pipe_mutex_unlock(fMutex); | ||
return B_OK; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2012, Haiku, Inc. All Rights Reserved. | ||
* Distributed under the terms of the MIT License. | ||
* | ||
* Authors: | ||
* Alexander von Gluck IV, kallisti5@unixzen.com | ||
*/ | ||
#ifndef GALLIUMFRAMEBUFFER_H | ||
#define GALLIUMFRAMEBUFFER_H | ||
|
||
|
||
extern "C" { | ||
#include "os/os_thread.h" | ||
#include "pipe/p_screen.h" | ||
#include "state_tracker/st_api.h" | ||
} | ||
|
||
|
||
class GalliumFramebuffer { | ||
public: | ||
GalliumFramebuffer(struct st_visual* visual); | ||
~GalliumFramebuffer(); | ||
status_t Lock(); | ||
status_t Unlock(); | ||
|
||
struct st_framebuffer_iface* fBuffer; | ||
|
||
private: | ||
pipe_mutex fMutex; | ||
}; | ||
|
||
|
||
#endif /* GALLIUMFRAMEBUFFER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters