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);
}
/**
{
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);
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;
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)
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;
* 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);
}
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;
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;
&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);
&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);
&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);
/* 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));
/* 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;
*/
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);
}
}
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 =
}
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;
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);
}
}
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;
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;
}
/**
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.
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);
/* 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;
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);
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) {
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;
/**
* 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;
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 */
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;
}
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);
}
struct st_visual stvis;
struct dri_screen *screen;
-
- /* dri */
- __DRIdrawable *dPriv;
__DRIscreen *sPriv;
__DRIbuffer old[__DRI_BUFFER_COUNT];
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,
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 *)drawable;
+}
+
+/* Typecast our own type to the opaque pointer. */
+static inline __DRIdrawable *
+opaque_dri_drawable(struct dri_drawable *drawable)
{
- return (struct dri_drawable *) (driDrawPriv)
- ? driDrawPriv->driverPrivate : NULL;
+ 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,
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)) {
/*****************************************************************/
/*@{*/
-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
__DRIdrawable *pdp,
__DRIdrawable *prp)
{
- /*
+ /*
** Assume error checking is done properly in glXMakeCurrent before
** calling driUnbindContext.
*/
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);
}
/**
*
* \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
*/
static int driUnbindContext(__DRIcontext *pcp)
{
- __DRIdrawable *pdp;
- __DRIdrawable *prp;
-
/*
** Assume error checking is done properly in glXMakeCurrent before
** calling driUnbindContext.
*/
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;
}
/*@}*/
-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);
}
}
const __DRIconfig *config,
void *data)
{
- __DRIdrawable *pdraw;
-
assert(data != NULL);
- pdraw = malloc(sizeof *pdraw);
- if (!pdraw)
- return NULL;
-
- 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);
+ struct dri_drawable *drawable =
+ screen->driver->CreateBuffer(screen, &config->modes, GL_FALSE, data);
- 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 *
static void
driSwapBuffers(__DRIdrawable *pdp)
{
- assert(pdp->driScreenPriv->swrast_loader);
+ struct dri_drawable *drawable = dri_drawable(pdp);
+
+ assert(drawable->sPriv->swrast_loader);
- pdp->driScreenPriv->driver->SwapBuffers(pdp);
+ drawable->sPriv->driver->SwapBuffers(drawable);
}
/** Core interface */
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,
/**
* 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.
} 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);
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;
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
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
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
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)
}
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);
}
/*
*/
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;
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);
}
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;
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);
}
}
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;
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;
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);
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;
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,
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. */
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;
}
/**
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);
+
+ assert(drawable->sPriv->swrast_loader);
- drisw_copy_sub_buffer(pdp, x, y, w, h);
+ drisw_copy_sub_buffer(drawable, x, y, w, h);
}
/* for swrast only */
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
{
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);
}
// 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,
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;
}
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
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);
&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);
}
&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);
}
&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);
}
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;
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);
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
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;
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;
}
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;
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,
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. */
// - 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);
// 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;
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;
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]) {
}
static void
-kopper_swap_buffers(__DRIdrawable *dPriv)
+kopper_swap_buffers(struct dri_drawable *drawable)
{
- kopperSwapBuffers(dPriv);
+ kopperSwapBuffers(opaque_dri_drawable(drawable));
}
static __DRIdrawable *
void *data,
int is_pixmap)
{
- __DRIdrawable *pdraw;
-
assert(data != NULL);
- pdraw = malloc(sizeof *pdraw);
- if (!pdraw)
- return NULL;
-
- 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;
- }
+ struct dri_drawable *drawable =
+ screen->driver->CreateBuffer(screen, &config->modes, is_pixmap, data);
- return pdraw;
+ return opaque_dri_drawable(drawable);
}
static void
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];