void (*put_image2) (struct dri_drawable *dri_drawable,
void *data, int x, int y, unsigned width, unsigned height, unsigned stride);
void (*put_image_shm) (struct dri_drawable *dri_drawable,
- int shmid, char *shmaddr, unsigned offset,
+ int shmid, char *shmaddr, unsigned offset, unsigned offset_x,
int x, int y, unsigned width, unsigned height, unsigned stride);
};
static inline void
put_image_shm(__DRIdrawable *dPriv, int shmid, char *shmaddr,
- unsigned offset, int x, int y,
+ unsigned offset, unsigned offset_x, int x, int y,
unsigned width, unsigned height, unsigned stride)
{
__DRIscreen *sPriv = dPriv->driScreenPriv;
const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
- loader->putImageShm(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
- x, y, width, height, stride,
- shmid, shmaddr, offset, dPriv->loaderPrivate);
+ /* 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,
+ x, y, width, height, stride,
+ shmid, shmaddr, offset, dPriv->loaderPrivate);
+ else
+ loader->putImageShm(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
+ x, y, width, height, stride,
+ shmid, shmaddr, offset + offset_x, dPriv->loaderPrivate);
}
static inline void
static inline void
drisw_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)
{
__DRIdrawable *dPriv = drawable->dPriv;
- put_image_shm(dPriv, shmid, shmaddr, offset, x, y, width, height, stride);
+ put_image_shm(dPriv, shmid, shmaddr, offset, offset_x, x, y, width, height, stride);
}
static inline void
unsigned width, height, x = 0, y = 0;
unsigned blsize = util_format_get_blocksize(dri_sw_dt->format);
unsigned offset = 0;
+ unsigned offset_x = 0;
char *data = dri_sw_dt->data;
-
+ bool is_shm = dri_sw_dt->shmid != -1;
/* Set the width to 'stride / cpp'.
*
* PutImage correctly clips to the width of the dst drawable.
*/
if (box) {
- offset = (dri_sw_dt->stride * box->y) + box->x * blsize;
+ offset = dri_sw_dt->stride * box->y;
+ offset_x = box->x * blsize;
data += offset;
+ /* don't add x offset for shm, the put_image_shm will deal with it */
+ if (!is_shm)
+ data += offset_x;
x = box->x;
y = box->y;
width = box->width;
height = dri_sw_dt->height;
}
- if (dri_sw_dt->shmid != -1) {
- dri_sw_ws->lf->put_image_shm(dri_drawable, dri_sw_dt->shmid, dri_sw_dt->data, offset,
+ if (is_shm) {
+ dri_sw_ws->lf->put_image_shm(dri_drawable, dri_sw_dt->shmid, dri_sw_dt->data, offset, offset_x,
x, y, width, height, dri_sw_dt->stride);
return;
}