mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
frontend/dri: inline __DRIdrawable in dri_drawable, make __DRIdrawable opaque
This cleanup removes the dri_util structure __DRIdrawable(Rec) that is difficult to follow, and switches all code to using dri_drawable directly. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>
This commit is contained in:
parent
449a35a397
commit
c65bde7b1e
9 changed files with 299 additions and 392 deletions
|
|
@ -73,7 +73,9 @@ dri2_buffer(__DRIbuffer * driBufferPriv)
|
|||
static void
|
||||
dri2_flush_drawable(__DRIdrawable *dPriv)
|
||||
{
|
||||
dri_flush(dPriv->driContextPriv, dPriv, __DRI2_FLUSH_DRAWABLE, -1);
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
|
||||
dri_flush(drawable->driContextPriv, dPriv, __DRI2_FLUSH_DRAWABLE, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -103,7 +105,7 @@ dri2_invalidate_drawable(__DRIdrawable *dPriv)
|
|||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
|
||||
drawable->dPriv->lastStamp++;
|
||||
drawable->lastStamp++;
|
||||
drawable->texture_mask = 0; /* mark all attachments as invalid */
|
||||
|
||||
p_atomic_inc(&drawable->base.stamp);
|
||||
|
|
@ -125,7 +127,6 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
|
|||
const enum st_attachment_type *atts,
|
||||
unsigned *count)
|
||||
{
|
||||
__DRIdrawable *dri_drawable = drawable->dPriv;
|
||||
const __DRIdri2LoaderExtension *loader = drawable->sPriv->dri2.loader;
|
||||
boolean with_format;
|
||||
__DRIbuffer *buffers;
|
||||
|
|
@ -213,16 +214,16 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
|
|||
|
||||
if (with_format) {
|
||||
num_attachments /= 2;
|
||||
buffers = loader->getBuffersWithFormat(dri_drawable,
|
||||
&dri_drawable->w, &dri_drawable->h,
|
||||
buffers = loader->getBuffersWithFormat(opaque_dri_drawable(drawable),
|
||||
&drawable->w, &drawable->h,
|
||||
attachments, num_attachments,
|
||||
&num_buffers, dri_drawable->loaderPrivate);
|
||||
&num_buffers, drawable->loaderPrivate);
|
||||
}
|
||||
else {
|
||||
buffers = loader->getBuffers(dri_drawable,
|
||||
&dri_drawable->w, &dri_drawable->h,
|
||||
buffers = loader->getBuffers(opaque_dri_drawable(drawable),
|
||||
&drawable->w, &drawable->h,
|
||||
attachments, num_attachments,
|
||||
&num_buffers, dri_drawable->loaderPrivate);
|
||||
&num_buffers, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
if (buffers)
|
||||
|
|
@ -242,7 +243,6 @@ dri_image_drawable_get_buffers(struct dri_drawable *drawable,
|
|||
const enum st_attachment_type *statts,
|
||||
unsigned statts_count)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
unsigned int image_format = __DRI_IMAGE_FORMAT_NONE;
|
||||
enum pipe_format pf;
|
||||
|
|
@ -323,9 +323,10 @@ dri_image_drawable_get_buffers(struct dri_drawable *drawable,
|
|||
* st_api_make_current
|
||||
* st_manager_validate_framebuffers (part of st_validate_state)
|
||||
*/
|
||||
return sPriv->image.loader->getBuffers(dPriv, image_format,
|
||||
return sPriv->image.loader->getBuffers(opaque_dri_drawable(drawable),
|
||||
image_format,
|
||||
(uint32_t *)&drawable->base.stamp,
|
||||
dPriv->loaderPrivate, buffer_mask,
|
||||
drawable->loaderPrivate, buffer_mask,
|
||||
images);
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +476,6 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
unsigned statts_count)
|
||||
{
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
__DRIdrawable *dri_drawable = drawable->dPriv;
|
||||
struct dri_screen *screen = dri_screen(sPriv);
|
||||
struct pipe_resource templ;
|
||||
boolean alloc_depthstencil = FALSE;
|
||||
|
|
@ -505,8 +505,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
else {
|
||||
buffers = dri2_drawable_get_buffers(drawable, statts, &num_buffers);
|
||||
if (!buffers || (drawable->old_num == num_buffers &&
|
||||
drawable->old_w == dri_drawable->w &&
|
||||
drawable->old_h == dri_drawable->h &&
|
||||
drawable->old_w == drawable->w &&
|
||||
drawable->old_h == drawable->h &&
|
||||
memcmp(drawable->old, buffers,
|
||||
sizeof(__DRIbuffer) * num_buffers) == 0))
|
||||
return;
|
||||
|
|
@ -572,8 +572,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
&drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
|
||||
struct pipe_resource *texture = images.front->texture;
|
||||
|
||||
dri_drawable->w = texture->width0;
|
||||
dri_drawable->h = texture->height0;
|
||||
drawable->w = texture->width0;
|
||||
drawable->h = texture->height0;
|
||||
|
||||
pipe_resource_reference(buf, texture);
|
||||
handle_in_fence(ctx->cPriv, images.front);
|
||||
|
|
@ -584,8 +584,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
&drawable->textures[ST_ATTACHMENT_BACK_LEFT];
|
||||
struct pipe_resource *texture = images.back->texture;
|
||||
|
||||
dri_drawable->w = texture->width0;
|
||||
dri_drawable->h = texture->height0;
|
||||
drawable->w = texture->width0;
|
||||
drawable->h = texture->height0;
|
||||
|
||||
pipe_resource_reference(buf, texture);
|
||||
handle_in_fence(ctx->cPriv, images.back);
|
||||
|
|
@ -596,8 +596,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
&drawable->textures[ST_ATTACHMENT_BACK_LEFT];
|
||||
struct pipe_resource *texture = images.back->texture;
|
||||
|
||||
dri_drawable->w = texture->width0;
|
||||
dri_drawable->h = texture->height0;
|
||||
drawable->w = texture->width0;
|
||||
drawable->h = texture->height0;
|
||||
|
||||
pipe_resource_reference(buf, texture);
|
||||
handle_in_fence(ctx->cPriv, images.back);
|
||||
|
|
@ -610,8 +610,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
/* Note: if there is both a back and a front buffer,
|
||||
* then they have the same size.
|
||||
*/
|
||||
templ.width0 = dri_drawable->w;
|
||||
templ.height0 = dri_drawable->h;
|
||||
templ.width0 = drawable->w;
|
||||
templ.height0 = drawable->h;
|
||||
}
|
||||
else {
|
||||
memset(&whandle, 0, sizeof(whandle));
|
||||
|
|
@ -644,8 +644,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
|
||||
/* dri2_drawable_get_buffers has already filled dri_drawable->w
|
||||
* and dri_drawable->h */
|
||||
templ.width0 = dri_drawable->w;
|
||||
templ.height0 = dri_drawable->h;
|
||||
templ.width0 = drawable->w;
|
||||
templ.height0 = drawable->h;
|
||||
templ.format = format;
|
||||
templ.bind = bind;
|
||||
whandle.handle = buf->name;
|
||||
|
|
@ -767,8 +767,8 @@ dri2_allocate_textures(struct dri_context *ctx,
|
|||
*/
|
||||
if (!image) {
|
||||
drawable->old_num = num_buffers;
|
||||
drawable->old_w = dri_drawable->w;
|
||||
drawable->old_h = dri_drawable->h;
|
||||
drawable->old_w = drawable->w;
|
||||
drawable->old_h = drawable->h;
|
||||
memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * num_buffers);
|
||||
}
|
||||
}
|
||||
|
|
@ -778,7 +778,6 @@ dri2_flush_frontbuffer(struct dri_context *ctx,
|
|||
struct dri_drawable *drawable,
|
||||
enum st_attachment_type statt)
|
||||
{
|
||||
__DRIdrawable *dri_drawable = drawable->dPriv;
|
||||
const __DRIimageLoaderExtension *image = drawable->sPriv->image.loader;
|
||||
const __DRIdri2LoaderExtension *loader = drawable->sPriv->dri2.loader;
|
||||
const __DRImutableRenderBufferLoaderExtension *shared_buffer_loader =
|
||||
|
|
@ -820,19 +819,22 @@ dri2_flush_frontbuffer(struct dri_context *ctx,
|
|||
}
|
||||
|
||||
if (image) {
|
||||
image->flushFrontBuffer(dri_drawable, dri_drawable->loaderPrivate);
|
||||
image->flushFrontBuffer(opaque_dri_drawable(drawable),
|
||||
drawable->loaderPrivate);
|
||||
if (ctx->is_shared_buffer_bound) {
|
||||
if (fence)
|
||||
fence_fd = pipe->screen->fence_get_fd(pipe->screen, fence);
|
||||
|
||||
shared_buffer_loader->displaySharedBuffer(dri_drawable, fence_fd,
|
||||
dri_drawable->loaderPrivate);
|
||||
shared_buffer_loader->displaySharedBuffer(opaque_dri_drawable(drawable),
|
||||
fence_fd,
|
||||
drawable->loaderPrivate);
|
||||
|
||||
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
|
||||
}
|
||||
}
|
||||
else if (loader->flushFrontBuffer) {
|
||||
loader->flushFrontBuffer(dri_drawable, dri_drawable->loaderPrivate);
|
||||
loader->flushFrontBuffer(opaque_dri_drawable(drawable),
|
||||
drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -845,11 +847,11 @@ static void
|
|||
dri2_flush_swapbuffers(struct dri_context *ctx,
|
||||
struct dri_drawable *drawable)
|
||||
{
|
||||
__DRIdrawable *dri_drawable = drawable->dPriv;
|
||||
const __DRIimageLoaderExtension *image = drawable->sPriv->image.loader;
|
||||
|
||||
if (image && image->base.version >= 3 && image->flushSwapBuffers) {
|
||||
image->flushSwapBuffers(dri_drawable, dri_drawable->loaderPrivate);
|
||||
image->flushSwapBuffers(opaque_dri_drawable(drawable),
|
||||
drawable->loaderPrivate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2054,7 +2056,7 @@ dri2_set_damage_region(__DRIdrawable *dPriv, unsigned int nrects, int *rects)
|
|||
drawable->num_damage_rects = nrects;
|
||||
|
||||
/* Only apply the damage region if the BACK_LEFT texture is up-to-date. */
|
||||
if (drawable->texture_stamp == drawable->dPriv->lastStamp &&
|
||||
if (drawable->texture_stamp == drawable->lastStamp &&
|
||||
(drawable->texture_mask & (1 << ST_ATTACHMENT_BACK_LEFT))) {
|
||||
struct pipe_screen *screen = drawable->screen->base.screen;
|
||||
struct pipe_resource *resource;
|
||||
|
|
@ -2407,24 +2409,21 @@ release_pipe:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static boolean
|
||||
dri2_create_buffer(__DRIscreen * sPriv,
|
||||
__DRIdrawable * dPriv,
|
||||
const struct gl_config * visual, boolean isPixmap)
|
||||
static struct dri_drawable *
|
||||
dri2_create_buffer(__DRIscreen *sPriv, const struct gl_config *visual,
|
||||
boolean isPixmap, void *loaderPrivate)
|
||||
{
|
||||
struct dri_drawable *drawable = NULL;
|
||||
|
||||
if (!dri_create_buffer(sPriv, dPriv, visual, isPixmap))
|
||||
return FALSE;
|
||||
|
||||
drawable = dPriv->driverPrivate;
|
||||
struct dri_drawable *drawable = dri_create_buffer(sPriv, visual, isPixmap,
|
||||
loaderPrivate);
|
||||
if (!drawable)
|
||||
return NULL;
|
||||
|
||||
drawable->allocate_textures = dri2_allocate_textures;
|
||||
drawable->flush_frontbuffer = dri2_flush_frontbuffer;
|
||||
drawable->update_tex_buffer = dri2_update_tex_buffer;
|
||||
drawable->flush_swapbuffers = dri2_flush_swapbuffers;
|
||||
|
||||
return TRUE;
|
||||
return drawable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -281,21 +281,19 @@ dri_unbind_context(__DRIcontext * cPriv)
|
|||
|
||||
st_api_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
ctx->dPriv = NULL;
|
||||
ctx->rPriv = NULL;
|
||||
ctx->draw = NULL;
|
||||
ctx->read = NULL;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
GLboolean
|
||||
dri_make_current(__DRIcontext * cPriv,
|
||||
__DRIdrawable * driDrawPriv,
|
||||
__DRIdrawable * driReadPriv)
|
||||
struct dri_drawable *draw,
|
||||
struct dri_drawable *read)
|
||||
{
|
||||
/* dri_util.c ensures cPriv is not null */
|
||||
struct dri_context *ctx = dri_context(cPriv);
|
||||
struct dri_drawable *draw = dri_drawable(driDrawPriv);
|
||||
struct dri_drawable *read = dri_drawable(driReadPriv);
|
||||
|
||||
/* Wait for glthread to finish because we can't use st_context from
|
||||
* multiple threads.
|
||||
|
|
@ -308,13 +306,13 @@ dri_make_current(__DRIcontext * cPriv,
|
|||
else if (!draw || !read)
|
||||
return GL_FALSE;
|
||||
|
||||
if (ctx->dPriv != driDrawPriv) {
|
||||
ctx->dPriv = driDrawPriv;
|
||||
draw->texture_stamp = driDrawPriv->lastStamp - 1;
|
||||
if (ctx->draw != draw) {
|
||||
ctx->draw = draw;
|
||||
draw->texture_stamp = draw->lastStamp - 1;
|
||||
}
|
||||
if (ctx->rPriv != driReadPriv) {
|
||||
ctx->rPriv = driReadPriv;
|
||||
read->texture_stamp = driReadPriv->lastStamp - 1;
|
||||
if (ctx->read != read) {
|
||||
ctx->read = read;
|
||||
read->texture_stamp = read->lastStamp - 1;
|
||||
}
|
||||
|
||||
st_api_make_current(ctx->st, &draw->base, &read->base);
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ struct dri_context
|
|||
/* dri */
|
||||
__DRIscreen *sPriv;
|
||||
__DRIcontext *cPriv;
|
||||
__DRIdrawable *dPriv;
|
||||
__DRIdrawable *rPriv;
|
||||
struct dri_drawable *draw;
|
||||
struct dri_drawable *read;
|
||||
|
||||
/**
|
||||
* True if the __DRIdrawable's current __DRIimageBufferMask is
|
||||
* True if the dri_drawable's current __DRIimageBufferMask is
|
||||
* __DRI_IMAGE_BUFFER_SHARED.
|
||||
*/
|
||||
bool is_shared_buffer_bound;
|
||||
|
|
@ -78,8 +78,8 @@ boolean dri_unbind_context(__DRIcontext * driContextPriv);
|
|||
|
||||
boolean
|
||||
dri_make_current(__DRIcontext * driContextPriv,
|
||||
__DRIdrawable * driDrawPriv,
|
||||
__DRIdrawable * driReadPriv);
|
||||
struct dri_drawable *draw,
|
||||
struct dri_drawable *read);
|
||||
|
||||
struct dri_context *
|
||||
dri_get_current(__DRIscreen * driScreenPriv);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ dri_st_framebuffer_validate(struct st_context_iface *stctx,
|
|||
new_mask = (statt_mask & ~drawable->texture_mask);
|
||||
|
||||
do {
|
||||
lastStamp = drawable->dPriv->lastStamp;
|
||||
lastStamp = drawable->lastStamp;
|
||||
new_stamp = (drawable->texture_stamp != lastStamp);
|
||||
|
||||
if (new_stamp || new_mask) {
|
||||
|
|
@ -85,7 +85,7 @@ dri_st_framebuffer_validate(struct st_context_iface *stctx,
|
|||
drawable->texture_stamp = lastStamp;
|
||||
drawable->texture_mask = statt_mask;
|
||||
}
|
||||
} while (lastStamp != drawable->dPriv->lastStamp);
|
||||
} while (lastStamp != drawable->lastStamp);
|
||||
|
||||
/* Flush the pending set_damage_region request. */
|
||||
struct pipe_screen *pscreen = screen->base.screen;
|
||||
|
|
@ -142,10 +142,9 @@ dri_st_framebuffer_flush_swapbuffers(struct st_context_iface *stctx,
|
|||
/**
|
||||
* This is called when we need to set up GL rendering to a new X window.
|
||||
*/
|
||||
bool
|
||||
dri_create_buffer(__DRIscreen * sPriv,
|
||||
__DRIdrawable * dPriv,
|
||||
const struct gl_config * visual, bool isPixmap)
|
||||
struct dri_drawable *
|
||||
dri_create_buffer(__DRIscreen *sPriv, const struct gl_config *visual,
|
||||
bool isPixmap, void *loaderPrivate)
|
||||
{
|
||||
struct dri_screen *screen = sPriv->driverPrivate;
|
||||
struct dri_drawable *drawable = NULL;
|
||||
|
|
@ -157,6 +156,14 @@ dri_create_buffer(__DRIscreen * sPriv,
|
|||
if (drawable == NULL)
|
||||
goto fail;
|
||||
|
||||
drawable->loaderPrivate = loaderPrivate;
|
||||
drawable->sPriv = sPriv;
|
||||
drawable->driContextPriv = NULL;
|
||||
drawable->refcount = 1;
|
||||
drawable->lastStamp = 0;
|
||||
drawable->w = 0;
|
||||
drawable->h = 0;
|
||||
|
||||
dri_fill_st_visual(&drawable->stvis, screen, visual);
|
||||
|
||||
/* setup the st_framebuffer_iface */
|
||||
|
|
@ -168,23 +175,20 @@ dri_create_buffer(__DRIscreen * sPriv,
|
|||
|
||||
drawable->screen = screen;
|
||||
drawable->sPriv = sPriv;
|
||||
drawable->dPriv = dPriv;
|
||||
|
||||
dPriv->driverPrivate = (void *)drawable;
|
||||
p_atomic_set(&drawable->base.stamp, 1);
|
||||
drawable->base.ID = p_atomic_inc_return(&drifb_ID);
|
||||
drawable->base.state_manager = &screen->base;
|
||||
|
||||
return true;
|
||||
return drawable;
|
||||
fail:
|
||||
FREE(drawable);
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
dri_destroy_buffer(__DRIdrawable * dPriv)
|
||||
dri_destroy_buffer(struct dri_drawable *drawable)
|
||||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_screen *screen = drawable->screen;
|
||||
int i;
|
||||
|
||||
|
|
@ -227,7 +231,7 @@ dri_drawable_validate_att(struct dri_context *ctx,
|
|||
}
|
||||
statts[count++] = statt;
|
||||
|
||||
drawable->texture_stamp = drawable->dPriv->lastStamp - 1;
|
||||
drawable->texture_stamp = drawable->lastStamp - 1;
|
||||
|
||||
drawable->base.validate(ctx->st, &drawable->base, statts, count, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@ struct dri_drawable
|
|||
struct st_visual stvis;
|
||||
|
||||
struct dri_screen *screen;
|
||||
|
||||
/* dri */
|
||||
__DRIdrawable *dPriv;
|
||||
__DRIscreen *sPriv;
|
||||
|
||||
__DRIbuffer old[__DRI_BUFFER_COUNT];
|
||||
|
|
@ -64,6 +61,36 @@ struct dri_drawable
|
|||
struct pipe_fence_handle *throttle_fence;
|
||||
bool flushing; /* prevents recursion in dri_flush */
|
||||
|
||||
/**
|
||||
* Private data from the loader. We just hold on to it and pass
|
||||
* it back when calling into loader provided functions.
|
||||
*/
|
||||
void *loaderPrivate;
|
||||
|
||||
/**
|
||||
* Pointer to context to which this drawable is currently bound.
|
||||
*/
|
||||
__DRIcontext *driContextPriv;
|
||||
|
||||
/**
|
||||
* Reference count for number of context's currently bound to this
|
||||
* drawable.
|
||||
*
|
||||
* Once it reaches zero, the drawable can be destroyed.
|
||||
*
|
||||
* \note This behavior will change with GLX 1.3.
|
||||
*/
|
||||
int refcount;
|
||||
|
||||
/**
|
||||
* Increased when the loader calls invalidate.
|
||||
*
|
||||
* If this changes, the drawable information (below) should be retrieved
|
||||
* from the loader.
|
||||
*/
|
||||
unsigned int lastStamp;
|
||||
int w, h;
|
||||
|
||||
/* hooks filled in by dri2 & drisw */
|
||||
void (*allocate_textures)(struct dri_context *ctx,
|
||||
struct dri_drawable *drawable,
|
||||
|
|
@ -83,22 +110,28 @@ struct dri_drawable
|
|||
struct dri_drawable *drawable);
|
||||
};
|
||||
|
||||
/* Typecast the opaque pointer to our own type. */
|
||||
static inline struct dri_drawable *
|
||||
dri_drawable(__DRIdrawable * driDrawPriv)
|
||||
dri_drawable(__DRIdrawable *drawable)
|
||||
{
|
||||
return (struct dri_drawable *) (driDrawPriv)
|
||||
? driDrawPriv->driverPrivate : NULL;
|
||||
return (struct dri_drawable *)drawable;
|
||||
}
|
||||
|
||||
/* Typecast our own type to the opaque pointer. */
|
||||
static inline __DRIdrawable *
|
||||
opaque_dri_drawable(struct dri_drawable *drawable)
|
||||
{
|
||||
return (__DRIdrawable *)drawable;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dri_drawable.c
|
||||
*/
|
||||
bool
|
||||
dri_create_buffer(__DRIscreen * sPriv,
|
||||
__DRIdrawable * dPriv,
|
||||
const struct gl_config * visual, bool isPixmap);
|
||||
struct dri_drawable *
|
||||
dri_create_buffer(__DRIscreen *sPriv, const struct gl_config *visual,
|
||||
bool isPixmap, void *loaderPrivate);
|
||||
|
||||
void dri_destroy_buffer(__DRIdrawable * dPriv);
|
||||
void dri_destroy_buffer(struct dri_drawable *drawable);
|
||||
|
||||
void
|
||||
dri_drawable_get_format(struct dri_drawable *drawable,
|
||||
|
|
|
|||
|
|
@ -637,8 +637,8 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
|
|||
context->loaderPrivate = data;
|
||||
|
||||
context->driScreenPriv = screen;
|
||||
context->driDrawablePriv = NULL;
|
||||
context->driReadablePriv = NULL;
|
||||
context->draw = NULL;
|
||||
context->read = NULL;
|
||||
|
||||
if (!dri_create_context(mesa_api, modes, context, &ctx_config, error,
|
||||
shareCtx)) {
|
||||
|
|
@ -702,8 +702,8 @@ driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask)
|
|||
/*****************************************************************/
|
||||
/*@{*/
|
||||
|
||||
static void dri_get_drawable(__DRIdrawable *pdp);
|
||||
static void dri_put_drawable(__DRIdrawable *pdp);
|
||||
static void dri_get_drawable(struct dri_drawable *drawable);
|
||||
static void dri_put_drawable(struct dri_drawable *drawable);
|
||||
|
||||
/**
|
||||
* This function takes both a read buffer and a draw buffer. This is needed
|
||||
|
|
@ -714,7 +714,7 @@ static int driBindContext(__DRIcontext *pcp,
|
|||
__DRIdrawable *pdp,
|
||||
__DRIdrawable *prp)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
** Assume error checking is done properly in glXMakeCurrent before
|
||||
** calling driUnbindContext.
|
||||
*/
|
||||
|
|
@ -722,18 +722,22 @@ static int driBindContext(__DRIcontext *pcp,
|
|||
if (!pcp)
|
||||
return GL_FALSE;
|
||||
|
||||
struct dri_drawable *draw = dri_drawable(pdp);
|
||||
struct dri_drawable *read = dri_drawable(prp);
|
||||
|
||||
/* Bind the drawable to the context */
|
||||
pcp->driDrawablePriv = pdp;
|
||||
pcp->driReadablePriv = prp;
|
||||
if (pdp) {
|
||||
pdp->driContextPriv = pcp;
|
||||
dri_get_drawable(pdp);
|
||||
pcp->draw = draw;
|
||||
pcp->read = read;
|
||||
|
||||
if (draw) {
|
||||
draw->driContextPriv = pcp;
|
||||
dri_get_drawable(draw);
|
||||
}
|
||||
if (prp && pdp != prp) {
|
||||
dri_get_drawable(prp);
|
||||
dri_get_drawable(read);
|
||||
}
|
||||
|
||||
return dri_make_current(pcp, pdp, prp);
|
||||
return dri_make_current(pcp, draw, read);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -746,7 +750,7 @@ static int driBindContext(__DRIcontext *pcp,
|
|||
*
|
||||
* \internal
|
||||
* This function calls __DriverAPIRec::UnbindContext, and then decrements
|
||||
* __DRIdrawableRec::refcount which must be non-zero for a successful
|
||||
* dri_drawable::refcount which must be non-zero for a successful
|
||||
* return.
|
||||
*
|
||||
* While casting the opaque private pointers associated with the parameters
|
||||
|
|
@ -754,9 +758,6 @@ static int driBindContext(__DRIcontext *pcp,
|
|||
*/
|
||||
static int driUnbindContext(__DRIcontext *pcp)
|
||||
{
|
||||
__DRIdrawable *pdp;
|
||||
__DRIdrawable *prp;
|
||||
|
||||
/*
|
||||
** Assume error checking is done properly in glXMakeCurrent before
|
||||
** calling driUnbindContext.
|
||||
|
|
@ -771,32 +772,32 @@ static int driUnbindContext(__DRIcontext *pcp)
|
|||
*/
|
||||
dri_unbind_context(pcp);
|
||||
|
||||
pdp = pcp->driDrawablePriv;
|
||||
prp = pcp->driReadablePriv;
|
||||
struct dri_drawable *draw = pcp->draw;
|
||||
struct dri_drawable *read = pcp->read;
|
||||
|
||||
/* already unbound */
|
||||
if (!pdp && !prp)
|
||||
if (!draw && !read)
|
||||
return GL_TRUE;
|
||||
|
||||
assert(pdp);
|
||||
if (pdp->refcount == 0) {
|
||||
assert(draw);
|
||||
if (draw->refcount == 0) {
|
||||
/* ERROR!!! */
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
dri_put_drawable(pdp);
|
||||
dri_put_drawable(draw);
|
||||
|
||||
if (prp != pdp) {
|
||||
if (prp->refcount == 0) {
|
||||
if (read != draw) {
|
||||
if (read->refcount == 0) {
|
||||
/* ERROR!!! */
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
dri_put_drawable(prp);
|
||||
dri_put_drawable(read);
|
||||
}
|
||||
|
||||
pcp->driDrawablePriv = NULL;
|
||||
pcp->driReadablePriv = NULL;
|
||||
pcp->draw = NULL;
|
||||
pcp->read = NULL;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
@ -804,20 +805,19 @@ static int driUnbindContext(__DRIcontext *pcp)
|
|||
/*@}*/
|
||||
|
||||
|
||||
static void dri_get_drawable(__DRIdrawable *pdp)
|
||||
static void dri_get_drawable(struct dri_drawable *drawable)
|
||||
{
|
||||
pdp->refcount++;
|
||||
drawable->refcount++;
|
||||
}
|
||||
|
||||
static void dri_put_drawable(__DRIdrawable *pdp)
|
||||
static void dri_put_drawable(struct dri_drawable *drawable)
|
||||
{
|
||||
if (pdp) {
|
||||
pdp->refcount--;
|
||||
if (pdp->refcount)
|
||||
if (drawable) {
|
||||
drawable->refcount--;
|
||||
if (drawable->refcount)
|
||||
return;
|
||||
|
||||
dri_destroy_buffer(pdp);
|
||||
free(pdp);
|
||||
dri_destroy_buffer(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -826,48 +826,18 @@ driCreateNewDrawable(__DRIscreen *screen,
|
|||
const __DRIconfig *config,
|
||||
void *data)
|
||||
{
|
||||
__DRIdrawable *pdraw;
|
||||
|
||||
assert(data != NULL);
|
||||
|
||||
pdraw = malloc(sizeof *pdraw);
|
||||
if (!pdraw)
|
||||
return NULL;
|
||||
struct dri_drawable *drawable =
|
||||
screen->driver->CreateBuffer(screen, &config->modes, GL_FALSE, data);
|
||||
|
||||
pdraw->loaderPrivate = data;
|
||||
|
||||
pdraw->driScreenPriv = screen;
|
||||
pdraw->driContextPriv = NULL;
|
||||
pdraw->refcount = 0;
|
||||
pdraw->lastStamp = 0;
|
||||
pdraw->w = 0;
|
||||
pdraw->h = 0;
|
||||
|
||||
dri_get_drawable(pdraw);
|
||||
|
||||
if (!screen->driver->CreateBuffer(screen, pdraw, &config->modes,
|
||||
GL_FALSE)) {
|
||||
free(pdraw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pdraw;
|
||||
return opaque_dri_drawable(drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
driDestroyDrawable(__DRIdrawable *pdp)
|
||||
{
|
||||
/*
|
||||
* The loader's data structures are going away, even if pdp itself stays
|
||||
* around for the time being because it is currently bound. This happens
|
||||
* when a currently bound GLX pixmap is destroyed.
|
||||
*
|
||||
* Clear out the pointer back into the loader's data structures to avoid
|
||||
* accessing an outdated pointer.
|
||||
*/
|
||||
pdp->loaderPrivate = NULL;
|
||||
|
||||
dri_put_drawable(pdp);
|
||||
dri_put_drawable(dri_drawable(pdp));
|
||||
}
|
||||
|
||||
static __DRIbuffer *
|
||||
|
|
@ -946,9 +916,11 @@ driGetAPIMask(__DRIscreen *screen)
|
|||
static void
|
||||
driSwapBuffers(__DRIdrawable *pdp)
|
||||
{
|
||||
assert(pdp->driScreenPriv->swrast_loader);
|
||||
struct dri_drawable *drawable = dri_drawable(pdp);
|
||||
|
||||
pdp->driScreenPriv->driver->SwapBuffers(pdp);
|
||||
assert(drawable->sPriv->swrast_loader);
|
||||
|
||||
drawable->sPriv->driver->SwapBuffers(drawable);
|
||||
}
|
||||
|
||||
/** Core interface */
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ typedef struct __DRIDriverVtableExtensionRec {
|
|||
|
||||
const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
|
||||
|
||||
GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
|
||||
__DRIdrawable *driDrawPriv,
|
||||
const struct gl_config *glVis,
|
||||
GLboolean pixmapBuffer);
|
||||
struct dri_drawable *(*CreateBuffer)(__DRIscreen *driScrnPriv,
|
||||
const struct gl_config *glVis,
|
||||
GLboolean pixmapBuffer,
|
||||
void *loaderPrivate);
|
||||
|
||||
void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
|
||||
void (*SwapBuffers)(struct dri_drawable *drawable);
|
||||
|
||||
__DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
|
||||
unsigned int attachment,
|
||||
|
|
@ -224,12 +224,12 @@ struct __DRIcontextRec {
|
|||
/**
|
||||
* Pointer to drawable currently bound to this context for drawing.
|
||||
*/
|
||||
__DRIdrawable *driDrawablePriv;
|
||||
struct dri_drawable *draw;
|
||||
|
||||
/**
|
||||
* Pointer to drawable currently bound to this context for reading.
|
||||
*/
|
||||
__DRIdrawable *driReadablePriv;
|
||||
struct dri_drawable *read;
|
||||
|
||||
/**
|
||||
* Pointer to screen on which this context was created.
|
||||
|
|
@ -242,54 +242,6 @@ struct __DRIcontextRec {
|
|||
} dri2;
|
||||
};
|
||||
|
||||
/**
|
||||
* Per-drawable private DRI driver information.
|
||||
*/
|
||||
struct __DRIdrawableRec {
|
||||
/**
|
||||
* Driver's private drawable information.
|
||||
*
|
||||
* This structure is opaque.
|
||||
*/
|
||||
void *driverPrivate;
|
||||
|
||||
/**
|
||||
* Private data from the loader. We just hold on to it and pass
|
||||
* it back when calling into loader provided functions.
|
||||
*/
|
||||
void *loaderPrivate;
|
||||
|
||||
/**
|
||||
* Pointer to context to which this drawable is currently bound.
|
||||
*/
|
||||
__DRIcontext *driContextPriv;
|
||||
|
||||
/**
|
||||
* Pointer to screen on which this drawable was created.
|
||||
*/
|
||||
__DRIscreen *driScreenPriv;
|
||||
|
||||
/**
|
||||
* Reference count for number of context's currently bound to this
|
||||
* drawable.
|
||||
*
|
||||
* Once it reaches zero, the drawable can be destroyed.
|
||||
*
|
||||
* \note This behavior will change with GLX 1.3.
|
||||
*/
|
||||
int refcount;
|
||||
|
||||
/**
|
||||
* Increased when the loader calls invalidate.
|
||||
*
|
||||
* If this changes, the drawable information (below) should be retrieved
|
||||
* from the loader.
|
||||
*/
|
||||
unsigned int lastStamp;
|
||||
|
||||
int w, h;
|
||||
};
|
||||
|
||||
extern uint32_t
|
||||
driGLFormatToImageFormat(mesa_format format);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,89 +44,89 @@
|
|||
DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", FALSE);
|
||||
|
||||
static inline void
|
||||
get_drawable_info(__DRIdrawable *dPriv, int *x, int *y, int *w, int *h)
|
||||
get_drawable_info(struct dri_drawable *drawable, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
loader->getDrawableInfo(dPriv,
|
||||
loader->getDrawableInfo(opaque_dri_drawable(drawable),
|
||||
x, y, w, h,
|
||||
dPriv->loaderPrivate);
|
||||
drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline void
|
||||
put_image(__DRIdrawable *dPriv, void *data, unsigned width, unsigned height)
|
||||
put_image(struct dri_drawable *drawable, void *data, unsigned width, unsigned height)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
loader->putImage(opaque_dri_drawable(drawable), __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
0, 0, width, height,
|
||||
data, dPriv->loaderPrivate);
|
||||
data, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline void
|
||||
put_image2(__DRIdrawable *dPriv, void *data, int x, int y,
|
||||
put_image2(struct dri_drawable *drawable, void *data, int x, int y,
|
||||
unsigned width, unsigned height, unsigned stride)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
loader->putImage2(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
loader->putImage2(opaque_dri_drawable(drawable), __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
x, y, width, height, stride,
|
||||
data, dPriv->loaderPrivate);
|
||||
data, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline void
|
||||
put_image_shm(__DRIdrawable *dPriv, int shmid, char *shmaddr,
|
||||
put_image_shm(struct dri_drawable *drawable, int shmid, char *shmaddr,
|
||||
unsigned offset, unsigned offset_x, int x, int y,
|
||||
unsigned width, unsigned height, unsigned stride)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
/* if we have the newer interface, don't have to add the offset_x here. */
|
||||
if (loader->base.version > 4 && loader->putImageShm2)
|
||||
loader->putImageShm2(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
loader->putImageShm2(opaque_dri_drawable(drawable), __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
x, y, width, height, stride,
|
||||
shmid, shmaddr, offset, dPriv->loaderPrivate);
|
||||
shmid, shmaddr, offset, drawable->loaderPrivate);
|
||||
else
|
||||
loader->putImageShm(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
loader->putImageShm(opaque_dri_drawable(drawable), __DRI_SWRAST_IMAGE_OP_SWAP,
|
||||
x, y, width, height, stride,
|
||||
shmid, shmaddr, offset + offset_x, dPriv->loaderPrivate);
|
||||
shmid, shmaddr, offset + offset_x, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_image(__DRIdrawable *dPriv, int x, int y, int width, int height, void *data)
|
||||
get_image(struct dri_drawable *drawable, int x, int y, int width, int height, void *data)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
loader->getImage(dPriv,
|
||||
loader->getImage(opaque_dri_drawable(drawable),
|
||||
x, y, width, height,
|
||||
data, dPriv->loaderPrivate);
|
||||
data, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_image2(__DRIdrawable *dPriv, int x, int y, int width, int height, int stride, void *data)
|
||||
get_image2(struct dri_drawable *drawable, int x, int y, int width, int height, int stride, void *data)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
/* getImage2 support is only in version 3 or newer */
|
||||
if (loader->base.version < 3)
|
||||
return;
|
||||
|
||||
loader->getImage2(dPriv,
|
||||
loader->getImage2(opaque_dri_drawable(drawable),
|
||||
x, y, width, height, stride,
|
||||
data, dPriv->loaderPrivate);
|
||||
data, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
get_image_shm(__DRIdrawable *dPriv, int x, int y, int width, int height,
|
||||
get_image_shm(struct dri_drawable *drawable, int x, int y, int width, int height,
|
||||
struct pipe_resource *res)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
struct winsys_handle whandle;
|
||||
|
||||
|
|
@ -139,19 +139,18 @@ get_image_shm(__DRIdrawable *dPriv, int x, int y, int width, int height,
|
|||
return FALSE;
|
||||
|
||||
if (loader->base.version > 5 && loader->getImageShm2)
|
||||
return loader->getImageShm2(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate);
|
||||
return loader->getImageShm2(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
|
||||
|
||||
loader->getImageShm(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate);
|
||||
loader->getImageShm(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
drisw_update_drawable_info(struct dri_drawable *drawable)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
int x, y;
|
||||
|
||||
get_drawable_info(dPriv, &x, &y, &dPriv->w, &dPriv->h);
|
||||
get_drawable_info(drawable, &x, &y, &drawable->w, &drawable->h);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -159,20 +158,17 @@ drisw_get_image(struct dri_drawable *drawable,
|
|||
int x, int y, unsigned width, unsigned height, unsigned stride,
|
||||
void *data)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
int draw_x, draw_y, draw_w, draw_h;
|
||||
|
||||
get_drawable_info(dPriv, &draw_x, &draw_y, &draw_w, &draw_h);
|
||||
get_image2(dPriv, x, y, draw_w, draw_h, stride, data);
|
||||
get_drawable_info(drawable, &draw_x, &draw_y, &draw_w, &draw_h);
|
||||
get_image2(drawable, x, y, draw_w, draw_h, stride, data);
|
||||
}
|
||||
|
||||
static void
|
||||
drisw_put_image(struct dri_drawable *drawable,
|
||||
void *data, unsigned width, unsigned height)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
|
||||
put_image(dPriv, data, width, height);
|
||||
put_image(drawable, data, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -180,9 +176,7 @@ drisw_put_image2(struct dri_drawable *drawable,
|
|||
void *data, int x, int y, unsigned width, unsigned height,
|
||||
unsigned stride)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
|
||||
put_image2(dPriv, data, x, y, width, height, stride);
|
||||
put_image2(drawable, data, x, y, width, height, stride);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -192,16 +186,13 @@ drisw_put_image_shm(struct dri_drawable *drawable,
|
|||
int x, int y, unsigned width, unsigned height,
|
||||
unsigned stride)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
|
||||
put_image_shm(dPriv, shmid, shmaddr, offset, offset_x, x, y, width, height, stride);
|
||||
put_image_shm(drawable, shmid, shmaddr, offset, offset_x, x, y, width, height, stride);
|
||||
}
|
||||
|
||||
static inline void
|
||||
drisw_present_texture(struct pipe_context *pipe, __DRIdrawable *dPriv,
|
||||
drisw_present_texture(struct pipe_context *pipe, struct dri_drawable *drawable,
|
||||
struct pipe_resource *ptex, struct pipe_box *sub_box)
|
||||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_screen *screen = dri_screen(drawable->sPriv);
|
||||
|
||||
if (screen->swrast_no_present)
|
||||
|
|
@ -211,23 +202,21 @@ drisw_present_texture(struct pipe_context *pipe, __DRIdrawable *dPriv,
|
|||
}
|
||||
|
||||
static inline void
|
||||
drisw_invalidate_drawable(__DRIdrawable *dPriv)
|
||||
drisw_invalidate_drawable(struct dri_drawable *drawable)
|
||||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
|
||||
drawable->texture_stamp = dPriv->lastStamp - 1;
|
||||
drawable->texture_stamp = drawable->lastStamp - 1;
|
||||
|
||||
p_atomic_inc(&drawable->base.stamp);
|
||||
}
|
||||
|
||||
static inline void
|
||||
drisw_copy_to_front(struct pipe_context *pipe,
|
||||
__DRIdrawable * dPriv,
|
||||
struct dri_drawable *drawable,
|
||||
struct pipe_resource *ptex)
|
||||
{
|
||||
drisw_present_texture(pipe, dPriv, ptex, NULL);
|
||||
drisw_present_texture(pipe, drawable, ptex, NULL);
|
||||
|
||||
drisw_invalidate_drawable(dPriv);
|
||||
drisw_invalidate_drawable(drawable);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -235,10 +224,9 @@ drisw_copy_to_front(struct pipe_context *pipe,
|
|||
*/
|
||||
|
||||
static void
|
||||
drisw_swap_buffers(__DRIdrawable *dPriv)
|
||||
drisw_swap_buffers(struct dri_drawable *drawable)
|
||||
{
|
||||
struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_context *ctx = dri_get_current(drawable->sPriv);
|
||||
struct dri_screen *screen = dri_screen(drawable->sPriv);
|
||||
struct pipe_resource *ptex;
|
||||
|
||||
|
|
@ -273,7 +261,7 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
|
|||
screen->base.screen->fence_finish(screen->base.screen, ctx->st->pipe,
|
||||
fence, PIPE_TIMEOUT_INFINITE);
|
||||
screen->base.screen->fence_reference(screen->base.screen, &fence, NULL);
|
||||
drisw_copy_to_front(ctx->st->pipe, dPriv, ptex);
|
||||
drisw_copy_to_front(ctx->st->pipe, drawable, ptex);
|
||||
|
||||
/* TODO: remove this if the framebuffer state doesn't change. */
|
||||
ctx->st->invalidate_state(ctx->st, ST_INVALIDATE_FB_STATE);
|
||||
|
|
@ -281,11 +269,10 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
|
|||
}
|
||||
|
||||
static void
|
||||
drisw_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y,
|
||||
drisw_copy_sub_buffer(struct dri_drawable *drawable, int x, int y,
|
||||
int w, int h)
|
||||
{
|
||||
struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_context *ctx = dri_get_current(drawable->sPriv);
|
||||
struct dri_screen *screen = dri_screen(drawable->sPriv);
|
||||
struct pipe_resource *ptex;
|
||||
struct pipe_box box;
|
||||
|
|
@ -318,8 +305,8 @@ drisw_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y,
|
|||
drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]);
|
||||
}
|
||||
|
||||
u_box_2d(x, dPriv->h - y - h, w, h, &box);
|
||||
drisw_present_texture(ctx->st->pipe, dPriv, ptex, &box);
|
||||
u_box_2d(x, drawable->h - y - h, w, h, &box);
|
||||
drisw_present_texture(ctx->st->pipe, drawable, ptex, &box);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +335,7 @@ drisw_flush_frontbuffer(struct dri_context *ctx,
|
|||
ptex = drawable->textures[statt];
|
||||
|
||||
if (ptex) {
|
||||
drisw_copy_to_front(ctx->st->pipe, ctx->dPriv, ptex);
|
||||
drisw_copy_to_front(ctx->st->pipe, ctx->draw, ptex);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -368,7 +355,7 @@ drisw_allocate_textures(struct dri_context *stctx,
|
|||
unsigned count)
|
||||
{
|
||||
struct dri_screen *screen = dri_screen(drawable->sPriv);
|
||||
const __DRIswrastLoaderExtension *loader = drawable->dPriv->driScreenPriv->swrast_loader;
|
||||
const __DRIswrastLoaderExtension *loader = drawable->sPriv->swrast_loader;
|
||||
struct pipe_resource templ;
|
||||
unsigned width, height;
|
||||
boolean resized;
|
||||
|
|
@ -380,8 +367,8 @@ drisw_allocate_textures(struct dri_context *stctx,
|
|||
if (stctx->st->thread_finish)
|
||||
stctx->st->thread_finish(stctx->st);
|
||||
|
||||
width = drawable->dPriv->w;
|
||||
height = drawable->dPriv->h;
|
||||
width = drawable->w;
|
||||
height = drawable->h;
|
||||
|
||||
resized = (drawable->old_w != width ||
|
||||
drawable->old_h != height);
|
||||
|
|
@ -456,8 +443,6 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
|
|||
struct dri_context *ctx,
|
||||
struct pipe_resource *res)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
|
||||
struct st_context *st_ctx = (struct st_context *)ctx->st;
|
||||
struct pipe_context *pipe = st_ctx->pipe;
|
||||
struct pipe_transfer *transfer;
|
||||
|
|
@ -472,7 +457,7 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
|
|||
if (ctx->st->thread_finish)
|
||||
ctx->st->thread_finish(ctx->st);
|
||||
|
||||
get_drawable_info(dPriv, &x, &y, &w, &h);
|
||||
get_drawable_info(drawable, &x, &y, &w, &h);
|
||||
|
||||
map = pipe_texture_map(pipe, res,
|
||||
0, 0, // level, layer,
|
||||
|
|
@ -480,8 +465,8 @@ drisw_update_tex_buffer(struct dri_drawable *drawable,
|
|||
x, y, w, h, &transfer);
|
||||
|
||||
/* Copy the Drawable content to the mapped texture buffer */
|
||||
if (!get_image_shm(dPriv, x, y, w, h, res))
|
||||
get_image(dPriv, x, y, w, h, map);
|
||||
if (!get_image_shm(drawable, x, y, w, h, res))
|
||||
get_image(drawable, x, y, w, h, map);
|
||||
|
||||
/* The pipe transfer has a pitch rounded up to the nearest 64 pixels.
|
||||
get_image() has a pitch rounded up to 4 bytes. */
|
||||
|
|
@ -615,24 +600,21 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static boolean
|
||||
drisw_create_buffer(__DRIscreen * sPriv,
|
||||
__DRIdrawable * dPriv,
|
||||
const struct gl_config * visual, boolean isPixmap)
|
||||
static struct dri_drawable *
|
||||
drisw_create_buffer(__DRIscreen * sPriv, const struct gl_config * visual,
|
||||
boolean isPixmap, void *loaderPrivate)
|
||||
{
|
||||
struct dri_drawable *drawable = NULL;
|
||||
|
||||
if (!dri_create_buffer(sPriv, dPriv, visual, isPixmap))
|
||||
return FALSE;
|
||||
|
||||
drawable = dPriv->driverPrivate;
|
||||
struct dri_drawable *drawable = dri_create_buffer(sPriv, visual, isPixmap,
|
||||
loaderPrivate);
|
||||
if (!drawable)
|
||||
return NULL;
|
||||
|
||||
drawable->allocate_textures = drisw_allocate_textures;
|
||||
drawable->update_drawable_info = drisw_update_drawable_info;
|
||||
drawable->flush_frontbuffer = drisw_flush_frontbuffer;
|
||||
drawable->update_tex_buffer = drisw_update_tex_buffer;
|
||||
|
||||
return TRUE;
|
||||
return drawable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -651,9 +633,11 @@ static const struct __DRIDriverVtableExtensionRec galliumsw_vtable = {
|
|||
static void driswCopySubBuffer(__DRIdrawable *pdp, int x, int y,
|
||||
int w, int h)
|
||||
{
|
||||
assert(pdp->driScreenPriv->swrast_loader);
|
||||
struct dri_drawable *drawable = dri_drawable(pdp);
|
||||
|
||||
drisw_copy_sub_buffer(pdp, x, y, w, h);
|
||||
assert(drawable->sPriv->swrast_loader);
|
||||
|
||||
drisw_copy_sub_buffer(drawable, x, y, w, h);
|
||||
}
|
||||
|
||||
/* for swrast only */
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ extern const __DRIimageExtension driVkImageExtensionSw;
|
|||
static void
|
||||
kopper_flush_drawable(__DRIdrawable *dPriv)
|
||||
{
|
||||
dri_flush(dPriv->driContextPriv, dPriv, __DRI2_FLUSH_DRAWABLE, -1);
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
|
||||
dri_flush(drawable->driContextPriv, dPriv, __DRI2_FLUSH_DRAWABLE, -1);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -81,7 +83,7 @@ kopper_invalidate_drawable(__DRIdrawable *dPriv)
|
|||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
|
||||
drawable->texture_stamp = dPriv->lastStamp - 1;
|
||||
drawable->texture_stamp = drawable->lastStamp - 1;
|
||||
|
||||
p_atomic_inc(&drawable->base.stamp);
|
||||
}
|
||||
|
|
@ -200,16 +202,6 @@ fail:
|
|||
|
||||
// copypasta alert
|
||||
|
||||
static inline void
|
||||
drisw_present_texture(struct pipe_context *pipe, __DRIdrawable *dPriv,
|
||||
struct pipe_resource *ptex, struct pipe_box *sub_box)
|
||||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_screen *screen = dri_screen(drawable->sPriv);
|
||||
|
||||
screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, sub_box);
|
||||
}
|
||||
|
||||
extern bool
|
||||
dri_image_drawable_get_buffers(struct dri_drawable *drawable,
|
||||
struct __DRIimageList *images,
|
||||
|
|
@ -475,8 +467,8 @@ kopper_get_pixmap_buffer(struct kopper_drawable *cdraw,
|
|||
free(bp_reply);
|
||||
}
|
||||
|
||||
cdraw->base.dPriv->w = width;
|
||||
cdraw->base.dPriv->h = height;
|
||||
cdraw->base.w = width;
|
||||
cdraw->base.h = height;
|
||||
|
||||
return cdraw->image->texture;
|
||||
}
|
||||
|
|
@ -494,7 +486,6 @@ kopper_allocate_textures(struct dri_context *ctx,
|
|||
boolean resized;
|
||||
unsigned i;
|
||||
struct __DRIimageList images;
|
||||
__DRIdrawable *dri_drawable = drawable->dPriv;
|
||||
const __DRIimageLoaderExtension *image = drawable->sPriv->image.loader;
|
||||
struct kopper_drawable *cdraw = (struct kopper_drawable *)drawable;
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
|
|
@ -504,8 +495,8 @@ kopper_allocate_textures(struct dri_context *ctx,
|
|||
bool is_window = cdraw->is_window;
|
||||
bool is_pixmap = !is_window && cdraw->info.bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
|
||||
width = drawable->dPriv->w;
|
||||
height = drawable->dPriv->h;
|
||||
width = drawable->w;
|
||||
height = drawable->h;
|
||||
|
||||
resized = (drawable->old_w != width ||
|
||||
drawable->old_h != height);
|
||||
|
|
@ -529,8 +520,8 @@ kopper_allocate_textures(struct dri_context *ctx,
|
|||
&drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
|
||||
struct pipe_resource *texture = images.front->texture;
|
||||
|
||||
dri_drawable->w = texture->width0;
|
||||
dri_drawable->h = texture->height0;
|
||||
drawable->w = texture->width0;
|
||||
drawable->h = texture->height0;
|
||||
|
||||
pipe_resource_reference(buf, texture);
|
||||
}
|
||||
|
|
@ -540,8 +531,8 @@ kopper_allocate_textures(struct dri_context *ctx,
|
|||
&drawable->textures[ST_ATTACHMENT_BACK_LEFT];
|
||||
struct pipe_resource *texture = images.back->texture;
|
||||
|
||||
dri_drawable->w = texture->width0;
|
||||
dri_drawable->h = texture->height0;
|
||||
drawable->w = texture->width0;
|
||||
drawable->h = texture->height0;
|
||||
|
||||
pipe_resource_reference(buf, texture);
|
||||
}
|
||||
|
|
@ -551,8 +542,8 @@ kopper_allocate_textures(struct dri_context *ctx,
|
|||
&drawable->textures[ST_ATTACHMENT_BACK_LEFT];
|
||||
struct pipe_resource *texture = images.back->texture;
|
||||
|
||||
dri_drawable->w = texture->width0;
|
||||
dri_drawable->h = texture->height0;
|
||||
drawable->w = texture->width0;
|
||||
drawable->h = texture->height0;
|
||||
|
||||
pipe_resource_reference(buf, texture);
|
||||
|
||||
|
|
@ -664,22 +655,21 @@ XXX do this once swapinterval is hooked up
|
|||
}
|
||||
|
||||
static inline void
|
||||
get_drawable_info(__DRIdrawable *dPriv, int *x, int *y, int *w, int *h)
|
||||
get_drawable_info(struct dri_drawable *drawable, int *x, int *y, int *w, int *h)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
if (loader)
|
||||
loader->getDrawableInfo(dPriv,
|
||||
loader->getDrawableInfo(opaque_dri_drawable(drawable),
|
||||
x, y, w, h,
|
||||
dPriv->loaderPrivate);
|
||||
drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
kopper_update_drawable_info(struct dri_drawable *drawable)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
struct kopper_drawable *cdraw = (struct kopper_drawable *)drawable;
|
||||
bool is_window = cdraw->info.bos.sType != 0;
|
||||
int x, y;
|
||||
|
|
@ -691,16 +681,15 @@ kopper_update_drawable_info(struct dri_drawable *drawable)
|
|||
|
||||
bool do_kopper_update = is_window && ptex && kscreen->base.fd == -1;
|
||||
if (cdraw->info.bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR && do_kopper_update)
|
||||
zink_kopper_update(screen, ptex, &dPriv->w, &dPriv->h);
|
||||
zink_kopper_update(screen, ptex, &drawable->w, &drawable->h);
|
||||
else
|
||||
get_drawable_info(dPriv, &x, &y, &dPriv->w, &dPriv->h);
|
||||
get_drawable_info(drawable, &x, &y, &drawable->w, &drawable->h);
|
||||
}
|
||||
|
||||
static inline void
|
||||
kopper_present_texture(struct pipe_context *pipe, __DRIdrawable *dPriv,
|
||||
kopper_present_texture(struct pipe_context *pipe, struct dri_drawable *drawable,
|
||||
struct pipe_resource *ptex, struct pipe_box *sub_box)
|
||||
{
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_screen *screen = dri_screen(drawable->sPriv);
|
||||
|
||||
screen->base.screen->flush_frontbuffer(screen->base.screen, pipe, ptex, 0, 0, drawable, sub_box);
|
||||
|
|
@ -708,12 +697,12 @@ kopper_present_texture(struct pipe_context *pipe, __DRIdrawable *dPriv,
|
|||
|
||||
static inline void
|
||||
kopper_copy_to_front(struct pipe_context *pipe,
|
||||
__DRIdrawable * dPriv,
|
||||
struct dri_drawable *drawable,
|
||||
struct pipe_resource *ptex)
|
||||
{
|
||||
kopper_present_texture(pipe, dPriv, ptex, NULL);
|
||||
kopper_present_texture(pipe, drawable, ptex, NULL);
|
||||
|
||||
kopper_invalidate_drawable(dPriv);
|
||||
kopper_invalidate_drawable(opaque_dri_drawable(drawable));
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -767,28 +756,28 @@ kopper_flush_frontbuffer(struct dri_context *ctx,
|
|||
screen->fence_reference(screen, &drawable->throttle_fence, NULL);
|
||||
}
|
||||
drawable->throttle_fence = new_fence;
|
||||
kopper_copy_to_front(st->pipe, ctx->dPriv, ptex);
|
||||
kopper_copy_to_front(st->pipe, ctx->draw, ptex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_image(__DRIdrawable *dPriv, int x, int y, int width, int height, void *data)
|
||||
get_image(struct dri_drawable *drawable, int x, int y, int width, int height, void *data)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
|
||||
loader->getImage(dPriv,
|
||||
loader->getImage(opaque_dri_drawable(drawable),
|
||||
x, y, width, height,
|
||||
data, dPriv->loaderPrivate);
|
||||
data, drawable->loaderPrivate);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
get_image_shm(__DRIdrawable *dPriv, int x, int y, int width, int height,
|
||||
get_image_shm(struct dri_drawable *drawable, int x, int y, int width, int height,
|
||||
struct pipe_resource *res)
|
||||
{
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
|
||||
struct winsys_handle whandle;
|
||||
|
||||
|
|
@ -801,9 +790,9 @@ get_image_shm(__DRIdrawable *dPriv, int x, int y, int width, int height,
|
|||
return FALSE;
|
||||
|
||||
if (loader->base.version > 5 && loader->getImageShm2)
|
||||
return loader->getImageShm2(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate);
|
||||
return loader->getImageShm2(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
|
||||
|
||||
loader->getImageShm(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate);
|
||||
loader->getImageShm(opaque_dri_drawable(drawable), x, y, width, height, whandle.handle, drawable->loaderPrivate);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -812,8 +801,7 @@ kopper_update_tex_buffer(struct dri_drawable *drawable,
|
|||
struct dri_context *ctx,
|
||||
struct pipe_resource *res)
|
||||
{
|
||||
__DRIdrawable *dPriv = drawable->dPriv;
|
||||
__DRIscreen *sPriv = dPriv->driScreenPriv;
|
||||
__DRIscreen *sPriv = drawable->sPriv;
|
||||
struct kopper_screen *kscreen = (struct kopper_screen*)sPriv->driverPrivate;
|
||||
struct kopper_drawable *cdraw = (struct kopper_drawable *)drawable;
|
||||
struct st_context *st_ctx = (struct st_context *)ctx->st;
|
||||
|
|
@ -832,7 +820,7 @@ kopper_update_tex_buffer(struct dri_drawable *drawable,
|
|||
if (ctx->st->thread_finish)
|
||||
ctx->st->thread_finish(ctx->st);
|
||||
|
||||
get_drawable_info(dPriv, &x, &y, &w, &h);
|
||||
get_drawable_info(drawable, &x, &y, &w, &h);
|
||||
|
||||
map = pipe_texture_map(pipe, res,
|
||||
0, 0, // level, layer,
|
||||
|
|
@ -840,8 +828,8 @@ kopper_update_tex_buffer(struct dri_drawable *drawable,
|
|||
x, y, w, h, &transfer);
|
||||
|
||||
/* Copy the Drawable content to the mapped texture buffer */
|
||||
if (!get_image_shm(dPriv, x, y, w, h, res))
|
||||
get_image(dPriv, x, y, w, h, map);
|
||||
if (!get_image_shm(drawable, x, y, w, h, res))
|
||||
get_image(drawable, x, y, w, h, map);
|
||||
|
||||
/* The pipe transfer has a pitch rounded up to the nearest 64 pixels.
|
||||
get_image() has a pitch rounded up to 4 bytes. */
|
||||
|
|
@ -866,7 +854,7 @@ kopper_flush_swapbuffers(struct dri_context *ctx,
|
|||
// - since the point is to use it as the superclass initializer before we add
|
||||
// our own state. kindagross but easier than fixing the object model first.
|
||||
static struct kopper_drawable *
|
||||
kopper_create_drawable(__DRIdrawable *dPriv, struct dri_drawable *base)
|
||||
kopper_create_drawable(struct dri_drawable *base)
|
||||
{
|
||||
struct kopper_drawable *_ret = CALLOC_STRUCT(kopper_drawable);
|
||||
|
||||
|
|
@ -880,7 +868,6 @@ kopper_create_drawable(__DRIdrawable *dPriv, struct dri_drawable *base)
|
|||
// relocate references to the old struct
|
||||
ret->base.visual = &ret->stvis;
|
||||
ret->base.st_manager_private = (void *) ret;
|
||||
dPriv->driverPrivate = ret;
|
||||
|
||||
// and fill in the vtable
|
||||
ret->allocate_textures = kopper_allocate_textures;
|
||||
|
|
@ -894,35 +881,34 @@ out:
|
|||
return _ret;
|
||||
}
|
||||
|
||||
static boolean
|
||||
kopper_create_buffer(__DRIscreen * sPriv,
|
||||
__DRIdrawable * dPriv,
|
||||
const struct gl_config *visual, boolean isPixmap)
|
||||
static struct dri_drawable *
|
||||
kopper_create_buffer(__DRIscreen *sPriv, const struct gl_config *visual,
|
||||
boolean isPixmap, void *loaderPrivate)
|
||||
{
|
||||
struct kopper_drawable *drawable = NULL;
|
||||
|
||||
/* always pass !pixmap because it isn't "handled" or relevant */
|
||||
if (!dri_create_buffer(sPriv, dPriv, visual, false))
|
||||
return FALSE;
|
||||
struct dri_drawable *base_drawable = dri_create_buffer(sPriv, visual, false,
|
||||
loaderPrivate);
|
||||
if (!base_drawable)
|
||||
return NULL;
|
||||
|
||||
drawable = kopper_create_drawable(dPriv, dPriv->driverPrivate);
|
||||
struct kopper_drawable *drawable = kopper_create_drawable(base_drawable);
|
||||
if (!drawable)
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
drawable->info.has_alpha = visual->alphaBits > 0;
|
||||
if (sPriv->kopper_loader->SetSurfaceCreateInfo)
|
||||
sPriv->kopper_loader->SetSurfaceCreateInfo(dPriv->loaderPrivate,
|
||||
sPriv->kopper_loader->SetSurfaceCreateInfo(drawable->base.loaderPrivate,
|
||||
&drawable->info);
|
||||
drawable->is_window = !isPixmap && drawable->info.bos.sType != 0;
|
||||
|
||||
return TRUE;
|
||||
return &drawable->base;
|
||||
}
|
||||
|
||||
static int64_t
|
||||
kopperSwapBuffers(__DRIdrawable *dPriv)
|
||||
{
|
||||
struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_context *ctx = dri_get_current(drawable->sPriv);
|
||||
struct kopper_drawable *kdraw = (struct kopper_drawable *)drawable;
|
||||
struct pipe_resource *ptex;
|
||||
|
||||
|
|
@ -939,9 +925,9 @@ kopperSwapBuffers(__DRIdrawable *dPriv)
|
|||
if (ctx->st->thread_finish)
|
||||
ctx->st->thread_finish(ctx->st);
|
||||
|
||||
drawable->texture_stamp = dPriv->lastStamp - 1;
|
||||
dri_flush(ctx->cPriv, dPriv, __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT, __DRI2_THROTTLE_SWAPBUFFER);
|
||||
kopper_copy_to_front(ctx->st->pipe, dPriv, ptex);
|
||||
drawable->texture_stamp = drawable->lastStamp - 1;
|
||||
dri_flush(ctx->cPriv, opaque_dri_drawable(drawable), __DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT, __DRI2_THROTTLE_SWAPBUFFER);
|
||||
kopper_copy_to_front(ctx->st->pipe, drawable, ptex);
|
||||
if (kdraw->is_window && !zink_kopper_check(ptex))
|
||||
return -1;
|
||||
if (!drawable->textures[ST_ATTACHMENT_FRONT_LEFT]) {
|
||||
|
|
@ -956,9 +942,9 @@ kopperSwapBuffers(__DRIdrawable *dPriv)
|
|||
}
|
||||
|
||||
static void
|
||||
kopper_swap_buffers(__DRIdrawable *dPriv)
|
||||
kopper_swap_buffers(struct dri_drawable *drawable)
|
||||
{
|
||||
kopperSwapBuffers(dPriv);
|
||||
kopperSwapBuffers(opaque_dri_drawable(drawable));
|
||||
}
|
||||
|
||||
static __DRIdrawable *
|
||||
|
|
@ -967,33 +953,12 @@ kopperCreateNewDrawable(__DRIscreen *screen,
|
|||
void *data,
|
||||
int is_pixmap)
|
||||
{
|
||||
__DRIdrawable *pdraw;
|
||||
|
||||
assert(data != NULL);
|
||||
|
||||
pdraw = malloc(sizeof *pdraw);
|
||||
if (!pdraw)
|
||||
return NULL;
|
||||
struct dri_drawable *drawable =
|
||||
screen->driver->CreateBuffer(screen, &config->modes, is_pixmap, data);
|
||||
|
||||
pdraw->loaderPrivate = data;
|
||||
|
||||
pdraw->driScreenPriv = screen;
|
||||
pdraw->driContextPriv = NULL;
|
||||
pdraw->refcount = 0;
|
||||
pdraw->lastStamp = 0;
|
||||
pdraw->w = 0;
|
||||
pdraw->h = 0;
|
||||
|
||||
//dri_get_drawable(pdraw);
|
||||
pdraw->refcount++;
|
||||
|
||||
if (!screen->driver->CreateBuffer(screen, pdraw, &config->modes,
|
||||
is_pixmap)) {
|
||||
free(pdraw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pdraw;
|
||||
return opaque_dri_drawable(drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1020,8 +985,8 @@ kopperSetSwapInterval(__DRIdrawable *dPriv, int interval)
|
|||
static int
|
||||
kopperQueryBufferAge(__DRIdrawable *dPriv)
|
||||
{
|
||||
struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
|
||||
struct dri_drawable *drawable = dri_drawable(dPriv);
|
||||
struct dri_context *ctx = dri_get_current(drawable->sPriv);
|
||||
struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT] ?
|
||||
drawable->textures[ST_ATTACHMENT_BACK_LEFT] :
|
||||
drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue