xf86-video-intel: 3 commits - src/drmmode_display.c src/i830_driver.c src/i830.h uxa/uxa-accel.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Apr 12 05:10:22 PDT 2010
src/drmmode_display.c | 18 +++++------
src/i830.h | 11 +++++--
src/i830_driver.c | 17 +++--------
uxa/uxa-accel.c | 77 ++++++++++++++++++++++++++++++++++++++++++--------
4 files changed, 89 insertions(+), 34 deletions(-)
New commits:
commit 27195d7dba0f3ff08b92f3fd916cdf5113cbef58
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Mar 31 20:30:27 2010 +0100
uxa: Try using put_image when copying from a memory buffer.
Often, for example in the fallback for ShmPutImage, we will attempt to
use uxa_copy_area() copying to a normal pixmap from a memory buffer.
This triggers a fallback, and maps the destination pixmap back into the
GTT. The accelerated put_image path will attempt to stream a blit to the
destination pixmap if it is currently active, avoiding the stall.
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 7fb4bf9..c022956 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -470,18 +470,19 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
goto fallback;
}
- if (!uxa_pixmap_is_offscreen(pSrcPixmap) ||
- !uxa_pixmap_is_offscreen(pDstPixmap) ||
- !(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap,
+ if (!uxa_pixmap_is_offscreen(pDstPixmap))
+ goto fallback;
+
+ if (uxa_pixmap_is_offscreen(pSrcPixmap)) {
+ if (!(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap,
reverse ? -1 : 1,
upsidedown ? -1 : 1,
pGC ? pGC->alu : GXcopy,
pGC ? pGC->
- planemask : FB_ALLONES)) {
+ planemask : FB_ALLONES))
goto fallback;
- }
- while (nbox--) {
+ while (nbox--) {
(*uxa_screen->info->copy) (pDstPixmap,
pbox->x1 + dx + src_off_x,
pbox->y1 + dy + src_off_y,
@@ -490,9 +491,43 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
- }
+ }
+
+ (*uxa_screen->info->done_copy) (pDstPixmap);
+ } else {
+ int stride, bpp;
+ char *src;
- (*uxa_screen->info->done_copy) (pDstPixmap);
+ if (!uxa_screen->info->put_image)
+ goto fallback;
+
+ /* Don't bother with under 8bpp, XYPixmaps. */
+ bpp = pSrcPixmap->drawable.bitsPerPixel;
+ if (bpp != pDstDrawable->bitsPerPixel || bpp < 8)
+ goto fallback;
+
+ /* Only accelerate copies: no rop or planemask. */
+ if (pGC && (!UXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask) || pGC->alu != GXcopy))
+ goto fallback;
+
+ src = pSrcPixmap->devPrivate.ptr;
+ stride = pSrcPixmap->devKind;
+ bpp /= 8;
+ while (nbox--) {
+ if (!uxa_screen->info->put_image(pDstPixmap,
+ pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1,
+ (char *) src +
+ (pbox->y1 + dy + src_off_y) * stride +
+ (pbox->x1 + dx + src_off_x) * bpp,
+ stride))
+ goto fallback;
+
+ pbox++;
+ }
+ }
return;
commit 385563417d10b5e8a005bed6ae4de9a8fac1b407
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Mar 30 21:10:50 2010 +0100
Review i830_pad_drawable_width()
We appear to have a confusion of stride in terms of pixels, pitch in
terms of bytes and the actual width of the surface.
i830_pad_drawable_width() appears to be operating aligning *pixels* to a
64 pixel boundary and has never used the chars-per-pixel causing
considerable confusion in its callers. Remove the parameter and ensure
that the callers are expecting a value in pixels returned, multiplying
by cpp where necessary to get the pitch.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1348e08..d8b158e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -476,7 +476,7 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
int size, ret;
unsigned long rotate_pitch;
- width = i830_pad_drawable_width(width, drmmode->cpp);
+ width = i830_pad_drawable_width(width);
rotate_pitch = width * drmmode->cpp;
size = rotate_pitch * height;
@@ -523,8 +523,7 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
}
}
- rotate_pitch =
- i830_pad_drawable_width(width, drmmode->cpp) * drmmode->cpp;
+ rotate_pitch = i830_pad_drawable_width(width) * drmmode->cpp;
rotate_pixmap = GetScratchPixmapHeader(scrn->pScreen,
width, height,
scrn->depth,
@@ -1257,13 +1256,14 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
Bool ret;
ScreenPtr screen = screenInfo.screens[scrn->scrnIndex];
uint32_t old_fb_id;
- int i, pitch, old_width, old_height, old_pitch;
+ int i, w, pitch, old_width, old_height, old_pitch;
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
- pitch = i830_pad_drawable_width(width, intel->cpp);
- i830_tiled_width(intel, &pitch, intel->cpp);
+ w = i830_pad_drawable_width(width);
+ i830_tiled_width(intel, &w, intel->cpp);
+ pitch = w * intel->cpp;
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Allocate new frame buffer %dx%d stride %d\n",
width, height, pitch);
@@ -1276,13 +1276,13 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
scrn->virtualX = width;
scrn->virtualY = height;
- scrn->displayWidth = pitch;
+ scrn->displayWidth = w;
intel->front_buffer = i830_allocate_framebuffer(scrn);
if (!intel->front_buffer)
goto fail;
ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
- scrn->bitsPerPixel, pitch * intel->cpp,
+ scrn->bitsPerPixel, pitch,
intel->front_buffer->handle,
&drmmode->fb_id);
if (ret)
@@ -1291,7 +1291,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
i830_set_pixmap_bo(screen->GetScreenPixmap(screen), intel->front_buffer);
screen->ModifyPixmapHeader(screen->GetScreenPixmap(screen),
- width, height, -1, -1, pitch * intel->cpp, NULL);
+ width, height, -1, -1, pitch, NULL);
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
diff --git a/src/i830.h b/src/i830.h
index 7593cde..43c5887 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -429,8 +429,6 @@ void i830_init_bufmgr(ScrnInfoPtr scrn);
Bool i830_tiled_width(intel_screen_private *intel, int *width, int cpp);
-int i830_pad_drawable_width(int width, int cpp);
-
/* i830_memory.c */
unsigned long i830_get_fence_size(intel_screen_private *intel, unsigned long size);
unsigned long i830_get_fence_pitch(intel_screen_private *intel, unsigned long pitch,
@@ -587,4 +585,13 @@ static inline Bool pixmap_is_scanout(PixmapPtr pixmap)
return pixmap == screen->GetScreenPixmap(screen);
}
+/*
+ * Pad to accelerator requirement
+ */
+static inline int i830_pad_drawable_width(int width)
+{
+ return (width + 63) & ~63;
+}
+
+
#endif /* _I830_H_ */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 95b02f3..40ad9c3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -374,11 +374,13 @@ Bool i830_tiled_width(intel_screen_private *intel, int *width, int cpp)
8192,
0
};
+ int pitch;
int i;
+ pitch = *width * cpp;
for (i = 0; pitches[i] != 0; i++) {
- if (pitches[i] >= *width) {
- *width = pitches[i];
+ if (pitches[i] >= pitch) {
+ *width = pitches[i] / cpp;
tiled = TRUE;
break;
}
@@ -389,14 +391,6 @@ Bool i830_tiled_width(intel_screen_private *intel, int *width, int cpp)
}
/*
- * Pad to accelerator requirement
- */
-int i830_pad_drawable_width(int width, int cpp)
-{
- return (width + 63) & ~63;
-}
-
-/*
* DRM mode setting Linux only at this point... later on we could
* add a wrapper here.
*/
@@ -1100,8 +1094,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
struct pci_device *const device = intel->PciInfo;
int fb_bar = IS_I9XX(intel) ? 2 : 0;
- scrn->displayWidth =
- i830_pad_drawable_width(scrn->virtualX, intel->cpp);
+ scrn->displayWidth = i830_pad_drawable_width(scrn->virtualX);
/*
* The "VideoRam" config file parameter specifies the maximum amount of
commit 299b0338d0811192dc4f8eae5d79453e9882c5d1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 25 13:43:26 2010 +0000
uxa: Add fallback warnings for PutImage.
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index cd3e477..7fb4bf9 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -130,17 +130,37 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int bpp = pDrawable->bitsPerPixel;
/* Don't bother with under 8bpp, XYPixmaps. */
- if (format != ZPixmap || bpp < 8)
+ if (format != ZPixmap || bpp < 8) {
+ ScrnInfoPtr scrn = xf86Screens[pDrawable->pScreen->myNum];
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "%s %p: format=%d, bpp=%d\n", __FUNCTION__, pDrawable,
+ format, bpp);
return FALSE;
+ }
/* Only accelerate copies: no rop or planemask. */
- if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
+ if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy) {
+ ScrnInfoPtr scrn = xf86Screens[pDrawable->pScreen->myNum];
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "%s %p: solid=%d, alu=%d\n", __FUNCTION__, pDrawable,
+ UXA_PM_IS_SOLID(pDrawable, pGC->planemask), pGC->alu);
return FALSE;
+ }
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut) {
+ ScrnInfoPtr scrn = xf86Screens[pDrawable->pScreen->myNum];
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "%s %p: swapped out\n", __FUNCTION__, pDrawable);
return FALSE;
+ }
pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
+ if (!pPix) {
+ ScrnInfoPtr scrn = xf86Screens[pDrawable->pScreen->myNum];
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "%s %p: not offscreen pixmap\n", __FUNCTION__, pDrawable);
+ return FALSE;
+ }
if (!pPix || !uxa_screen->info->put_image)
return FALSE;
More information about the xorg-commit
mailing list