[PATCH 06/18] Eliminate pixmap private 'stride' field, which duplicates devKind
Keith Packard
keithp at keithp.com
Sat Aug 16 23:13:09 PDT 2014
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 at keithp.com>
---
src/uxa/intel.h | 5 ++---
src/uxa/intel_dri.c | 2 +-
src/uxa/intel_dri3.c | 4 ++--
src/uxa/intel_glamor.c | 2 +-
src/uxa/intel_uxa.c | 16 ++++++----------
5 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/src/uxa/intel.h b/src/uxa/intel.h
index 409635d..ceb20ea 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;
@@ -500,9 +499,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 ef66aa5..eb210f3 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 dc8d762..005df8c 100644
--- a/src/uxa/intel_dri3.c
+++ b/src/uxa/intel_dri3.c
@@ -112,7 +112,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)
@@ -120,7 +120,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 9d2792f..3a0fbd7 100644
--- a/src/uxa/intel_glamor.c
+++ b/src/uxa/intel_glamor.c
@@ -162,7 +162,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 4ce6eae..5845d2e 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);
--
2.0.1
More information about the xorg-devel
mailing list