summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300
diff options
context:
space:
mode:
authorJerome Glisse <glisse@freedesktop.org>2006-11-01 16:18:08 +0000
committerJerome Glisse <glisse@freedesktop.org>2006-11-01 16:18:08 +0000
commit8d87196c12fc9ec8886f5b590f4cfb3c7c1b28aa (patch)
tree4c98728cfd5039a03b0b23c58a61ee3aa8edb6ff /src/mesa/drivers/dri/r300
parent351feae13086f01dc9a2a1e252fee1d507974c38 (diff)
Remove deprecated GetBufferSize interface.
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.c28
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.h10
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.c44
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.c64
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.h2
5 files changed, 76 insertions, 72 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c
index 09321126d6..62a6e1e5f7 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.c
+++ b/src/mesa/drivers/dri/r300/radeon_context.c
@@ -98,27 +98,11 @@ static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name)
}
}
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize(GLframebuffer * buffer,
- GLuint * width, GLuint * height)
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE(radeon);
- *width = radeon->dri.drawable->w;
- *height = radeon->dri.drawable->h;
- UNLOCK_HARDWARE(radeon);
-}
-
-
/* Initialize the driver's misc functions.
*/
static void radeonInitDriverFuncs(struct dd_function_table *functions)
{
- functions->GetBufferSize = radeonGetBufferSize;
+ functions->GetBufferSize = NULL;
functions->GetString = radeonGetString;
}
@@ -158,7 +142,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
/* DRI fields */
radeon->dri.context = driContextPriv;
radeon->dri.screen = sPriv;
- radeon->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
+ radeon->dri.drawable = NULL;
+ radeon->dri.readable = NULL;
radeon->dri.hwContext = driContextPriv->hHWContext;
radeon->dri.hwLock = &sPriv->pSAREA->lock;
radeon->dri.fd = sPriv->fd;
@@ -282,12 +267,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
radeon->glCtx);
- if (radeon->dri.drawable != driDrawPriv) {
+ if ( (radeon->dri.drawable != driDrawPriv)
+ || (radeon->dri.readable != driReadPriv) ) {
+
driDrawableInitVBlank(driDrawPriv,
radeon->vblank_flags,
&radeon->vbl_seq);
radeon->dri.drawable = driDrawPriv;
-
+ radeon->dri.readable = driReadPriv;
+
r300UpdateWindow(radeon->glCtx);
r300UpdateViewportOffset(radeon->glCtx);
}
diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h
index 0ec6466e44..07a0c7cbd6 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.h
+++ b/src/mesa/drivers/dri/r300/radeon_context.h
@@ -120,7 +120,15 @@ extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
struct radeon_dri_mirror {
__DRIcontextPrivate *context; /* DRI context */
__DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
+ /**
+ * DRI drawable bound to this context for drawing.
+ */
+ __DRIdrawablePrivate *drawable;
+
+ /**
+ * DRI drawable bound to this context for reading.
+ */
+ __DRIdrawablePrivate *readable;
drm_context_t hwContext;
drm_hw_lock_t *hwLock;
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c
index 0e1e6512db..a00da6c8bc 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.c
+++ b/src/mesa/drivers/dri/r300/radeon_lock.c
@@ -75,34 +75,30 @@ static void radeonUpdatePageFlipping(radeonContextPtr radeon)
* Called by radeonGetLock() after the lock has been obtained.
*/
static void r300RegainedLock(radeonContextPtr radeon)
-{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
+{
int i;
+ __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
r300ContextPtr r300 = (r300ContextPtr)radeon;
+ drm_radeon_sarea_t *sarea = radeon->sarea;
- if (radeon->lastStamp != dPriv->lastStamp) {
- _mesa_resize_framebuffer(radeon->glCtx,
- (GLframebuffer*)dPriv->driverPrivate,
- dPriv->w, dPriv->h);
-
+ if ( radeon->lastStamp != drawable->lastStamp ) {
radeonUpdatePageFlipping(radeon);
-
- if (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- radeonSetCliprects(radeon, GL_BACK_LEFT);
- else
- radeonSetCliprects(radeon, GL_FRONT_LEFT);
-
+ radeonSetCliprects(radeon);
#if 1
r300UpdateViewportOffset( radeon->glCtx );
- driUpdateFramebufferSize(radeon->glCtx, dPriv);
+ driUpdateFramebufferSize(radeon->glCtx, drawable);
#else
radeonUpdateScissor(radeon->glCtx);
#endif
- radeon->lastStamp = dPriv->lastStamp;
+ radeon->lastStamp = drawable->lastStamp;
}
- for (i = 0; i < r300->nr_heaps; i++) {
- DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+ if (sarea->ctx_owner != radeon->dri.hwContext) {
+ sarea->ctx_owner = radeon->dri.hwContext;
+
+ for (i = 0; i < r300->nr_heaps; i++) {
+ DRI_AGE_TEXTURES(r300->texture_heaps[i]);
+ }
}
}
@@ -116,11 +112,11 @@ static void r300RegainedLock(radeonContextPtr radeon)
*/
void radeonGetLock(radeonContextPtr radeon, GLuint flags)
{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
+ __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
+ __DRIdrawablePrivate *const readable = radeon->dri.readable;
__DRIscreenPrivate *sPriv = radeon->dri.screen;
- drm_radeon_sarea_t *sarea = radeon->sarea;
- assert (dPriv != NULL);
+ assert (drawable != NULL);
drmGetLock(radeon->dri.fd, radeon->dri.hwContext, flags);
@@ -132,10 +128,10 @@ void radeonGetLock(radeonContextPtr radeon, GLuint flags)
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
- if (sarea->ctx_owner != radeon->dri.hwContext)
- sarea->ctx_owner = radeon->dri.hwContext;
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, drawable );
+ if (drawable != readable) {
+ DRI_VALIDATE_DRAWABLE_INFO( sPriv, readable );
+ }
if (IS_R300_CLASS(radeon->radeonScreen))
r300RegainedLock(radeon);
diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c
index 917acb7243..3142fee98a 100644
--- a/src/mesa/drivers/dri/r300/radeon_state.c
+++ b/src/mesa/drivers/dri/r300/radeon_state.c
@@ -49,7 +49,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_ioctl.h"
#include "radeon_state.h"
#include "r300_ioctl.h"
-
+#include "framebuffer.h"
/* =============================================================
* Scissoring
@@ -134,12 +134,9 @@ void radeonUpdateScissor(GLcontext* ctx)
static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
if (ctx->Scissor.Enabled) {
/* We don't pipeline cliprect changes */
r300Flush(ctx);
-
radeonUpdateScissor(ctx);
}
}
@@ -148,31 +145,46 @@ static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h
/**
* Update cliprects and scissors.
*/
-void radeonSetCliprects(radeonContextPtr radeon, GLenum mode)
+void radeonSetCliprects(radeonContextPtr radeon)
{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
-
- switch (mode) {
- case GL_FRONT_LEFT:
- radeon->numClipRects = dPriv->numClipRects;
- radeon->pClipRects = dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if (dPriv->numBackClipRects == 0 || radeon->doPageFlip) {
- radeon->numClipRects = dPriv->numClipRects;
- radeon->pClipRects = dPriv->pClipRects;
+ __DRIdrawablePrivate *const drawable = radeon->dri.drawable;
+ __DRIdrawablePrivate *const readable = radeon->dri.readable;
+ GLframebuffer *const draw_fb = (GLframebuffer*)drawable->driverPrivate;
+ GLframebuffer *const read_fb = (GLframebuffer*)readable->driverPrivate;
+
+ if (draw_fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
+ /* Can't ignore 2d windows if we are page flipping. */
+ if (drawable->numBackClipRects == 0 || radeon->doPageFlip) {
+ radeon->numClipRects = drawable->numClipRects;
+ radeon->pClipRects = drawable->pClipRects;
} else {
- radeon->numClipRects = dPriv->numBackClipRects;
- radeon->pClipRects = dPriv->pBackClipRects;
+ radeon->numClipRects = drawable->numBackClipRects;
+ radeon->pClipRects = drawable->pBackClipRects;
+ }
+ } else {
+ /* front buffer (or none, or multiple buffers */
+ radeon->numClipRects = drawable->numClipRects;
+ radeon->pClipRects = drawable->pClipRects;
+ }
+
+ if ((draw_fb->Width != drawable->w) ||
+ (draw_fb->Height != drawable->h)) {
+ printf("w,h %d %d\n",
+ radeon->glCtx->DrawBuffer->Width,
+ radeon->glCtx->DrawBuffer->Height);
+
+ _mesa_resize_framebuffer(radeon->glCtx, draw_fb,
+ drawable->w, drawable->h);
+ draw_fb->Initialized = GL_TRUE;
+ }
+
+ if (drawable != readable) {
+ if ((read_fb->Width != readable->w) ||
+ (read_fb->Height != readable->h)) {
+ _mesa_resize_framebuffer(radeon->glCtx, read_fb,
+ readable->w, readable->h);
+ read_fb->Initialized = GL_TRUE;
}
- break;
- default:
- fprintf(stderr, "bad mode in radeonSetCliprects\n");
- radeon->numClipRects = 0;
- radeon->pClipRects = 0;
- return;
}
if (radeon->state.scissor.enabled)
diff --git a/src/mesa/drivers/dri/r300/radeon_state.h b/src/mesa/drivers/dri/r300/radeon_state.h
index 636bf5d008..c2d041eb4a 100644
--- a/src/mesa/drivers/dri/r300/radeon_state.h
+++ b/src/mesa/drivers/dri/r300/radeon_state.h
@@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_context.h"
extern void radeonRecalcScissorRects(radeonContextPtr radeon);
-extern void radeonSetCliprects(radeonContextPtr radeon, GLenum mode);
+extern void radeonSetCliprects(radeonContextPtr radeon);
extern void radeonUpdateScissor(GLcontext* ctx);
extern void radeonEnable(GLcontext* ctx, GLenum cap, GLboolean state);