summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-08-16 17:05:35 -0700
committerKeith Packard <keithp@keithp.com>2014-09-12 13:50:36 -0700
commit61305740ef3dcd4ee10b335574d659d7c886d29a (patch)
tree8f16d2a4dfc948d88d734ff1831fbd473949f283
parent1ac76b47b3dd8d14017271f5abd72664c71021c5 (diff)
Eliminate pixmap private 'stride' field, which duplicates devKind
The pixmap private stride field is an exact duplicate of the devKind field present in the core pixmap; eliminate the duplicate value and replace references by calls to intel_pixmap_pitch. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r--src/uxa/intel.h5
-rw-r--r--src/uxa/intel_dri.c2
-rw-r--r--src/uxa/intel_dri3.c4
-rw-r--r--src/uxa/intel_glamor.c2
-rw-r--r--src/uxa/intel_uxa.c16
5 files changed, 12 insertions, 17 deletions
diff --git a/src/uxa/intel.h b/src/uxa/intel.h
index eebe08fa..d3e3dcff 100644
--- a/src/uxa/intel.h
+++ b/src/uxa/intel.h
@@ -98,7 +98,6 @@ struct intel_pixmap {
struct list batch;
- uint16_t stride;
uint8_t tiling;
int8_t busy :2;
uint8_t dirty :1;
@@ -501,9 +500,9 @@ intel_get_screen_private(ScrnInfoPtr scrn)
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
-static inline unsigned long intel_pixmap_pitch(PixmapPtr pixmap)
+static inline int intel_pixmap_pitch(PixmapPtr pixmap)
{
- return (unsigned long)pixmap->devKind;
+ return pixmap->devKind;
}
/* Batchbuffer support macros and functions */
diff --git a/src/uxa/intel_dri.c b/src/uxa/intel_dri.c
index ef66aa53..eb210f36 100644
--- a/src/uxa/intel_dri.c
+++ b/src/uxa/intel_dri.c
@@ -152,7 +152,7 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
drawable->width,
drawable->height,
0, 0,
- priv->stride,
+ intel_pixmap_pitch(pixmap),
NULL);
screen->DestroyPixmap(pixmap);
intel_get_screen_private(xf86ScreenToScrn(screen))->needs_flush = TRUE;
diff --git a/src/uxa/intel_dri3.c b/src/uxa/intel_dri3.c
index a81ebe58..8c362c93 100644
--- a/src/uxa/intel_dri3.c
+++ b/src/uxa/intel_dri3.c
@@ -121,7 +121,7 @@ static int intel_dri3_fd_from_pixmap(ScreenPtr screen,
if (!priv)
return -1;
- if (priv->stride > UINT16_MAX)
+ if (intel_pixmap_pitch(pixmap) > UINT16_MAX)
return -1;
if (drm_intel_bo_gem_export_to_prime(priv->bo, &fd) < 0)
@@ -129,7 +129,7 @@ static int intel_dri3_fd_from_pixmap(ScreenPtr screen,
priv->pinned |= PIN_DRI3;
- *stride = priv->stride;
+ *stride = intel_pixmap_pitch(pixmap);
*size = priv->bo->size;
return fd;
}
diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c
index c8b41033..fdc65787 100644
--- a/src/uxa/intel_glamor.c
+++ b/src/uxa/intel_glamor.c
@@ -193,7 +193,7 @@ intel_glamor_create_textured_pixmap(PixmapPtr pixmap)
priv = intel_get_pixmap_private(pixmap);
if (glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
- priv->stride)) {
+ intel_pixmap_pitch(pixmap))) {
drm_intel_bo_disable_reuse(priv->bo);
priv->pinned |= PIN_GLAMOR;
return TRUE;
diff --git a/src/uxa/intel_uxa.c b/src/uxa/intel_uxa.c
index 4ce6eae1..5845d2e2 100644
--- a/src/uxa/intel_uxa.c
+++ b/src/uxa/intel_uxa.c
@@ -733,7 +733,6 @@ free_priv:
dri_bo_reference(bo);
priv->bo = bo;
- priv->stride = intel_pixmap_pitch(pixmap);
if (drm_intel_bo_get_tiling(bo, &tiling, &swizzle_mode)) {
bo = NULL;
@@ -748,12 +747,12 @@ free_priv:
tile_width = intel_get_tile_width(intel, tiling, stride);
stride = ALIGN(stride, tile_width);
- if (priv->stride < stride ||
- priv->stride & (tile_width - 1) ||
- priv->stride >= KB(32)) {
+ if (intel_pixmap_pitch(pixmap) < stride ||
+ intel_pixmap_pitch(pixmap) & (tile_width - 1) ||
+ intel_pixmap_pitch(pixmap) >= KB(32)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"%s: stride on buffer object does not match constraints: stride=%d, must be greater than %d, but less than %d, and have alignment at least %d\n",
- __FUNCTION__, priv->stride, stride, KB(32), tile_width);
+ __FUNCTION__, intel_pixmap_pitch(pixmap), stride, KB(32), tile_width);
bo = NULL;
goto free_priv;
}
@@ -769,9 +768,9 @@ free_priv:
height = 32;
height = ALIGN(pixmap->drawable.height, height);
- size = intel_get_fence_size(intel, priv->stride * height);
+ size = intel_get_fence_size(intel, intel_pixmap_pitch(pixmap) * height);
} else
- size = priv->stride * pixmap->drawable.height;
+ size = intel_pixmap_pitch(pixmap) * pixmap->drawable.height;
if (bo->size < size || bo->size > intel->max_bo_size) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -917,7 +916,6 @@ static Bool intel_uxa_put_image(PixmapPtr pixmap,
if (tiling != I915_TILING_NONE)
drm_intel_bo_set_tiling(bo, &tiling, stride);
- priv->stride = stride;
priv->tiling = tiling;
screen->ModifyPixmapHeader(pixmap,
@@ -1197,7 +1195,6 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (tiling != I915_TILING_NONE)
drm_intel_bo_set_tiling(priv->bo, &tiling, stride);
- priv->stride = stride;
priv->tiling = tiling;
priv->offscreen = 1;
@@ -1333,7 +1330,6 @@ intel_uxa_share_pixmap_backing(PixmapPtr ppix, ScreenPtr slave, void **fd_handle
if (tiling != I915_TILING_NONE)
drm_intel_bo_set_tiling(newbo, &tiling, stride);
- priv->stride = stride;
priv->tiling = tiling;
intel_set_pixmap_bo(ppix, newbo);