[Intel-gfx] [PATCH 16/22] Xv: scrap overlay offscreen pixmap support

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jul 2 14:15:49 CEST 2009


The code looks like it's been bitrotting since being copied over
from the i810 driver. Furthermore painting rgb pixmaps with the overlay
engine is in these days of modern compositing X an absolute no-go. And
textured video doesn't support it neither, so its likely never ever
used by applications.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 src/i830.h        |    1 -
 src/i830_driver.c |    2 -
 src/i830_video.c  |  193 -----------------------------------------------------
 3 files changed, 0 insertions(+), 196 deletions(-)

diff --git a/src/i830.h b/src/i830.h
index 25ed424..cf7f517 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -394,7 +394,6 @@ typedef struct _I830Rec {
 
    /* For Xvideo */
    i830_memory *overlay_regs;
-   void *offscreenImages;          /**< remembered memory block for release */
 #ifdef INTEL_XVMC
    /* For XvMC */
    Bool XvMCEnabled;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index c125a73..f39bbdf 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3219,8 +3219,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    i830_allocator_fini(pScrn);
 
    i965_free_video(pScrn);
-   free(pI830->offscreenImages);
-   pI830->offscreenImages = NULL;
 
    pScreen->CloseScreen = pI830->CloseScreen;
    (*pScreen->CloseScreen) (scrnIndex, pScreen);
diff --git a/src/i830_video.c b/src/i830_video.c
index 7b425be..ac5c0ca 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -87,8 +87,6 @@
 
 #define TIMER_MASK      (OFF_TIMER | FREE_TIMER)
 
-static void I830InitOffscreenImages(ScreenPtr);
-
 static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr);
 static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr);
 static void I830StopVideo(ScrnInfoPtr, pointer, Bool);
@@ -617,7 +615,6 @@ I830InitVideo(ScreenPtr pScreen)
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "Failed to set up overlay video\n");
 	}
-	I830InitOffscreenImages(pScreen);
     }
 
     if (overlayAdaptor && pI830->XvPreferOverlay)
@@ -2639,196 +2636,6 @@ I830VideoBlockHandler(int i, pointer blockData, pointer pTimeout,
     }
 }
 
-/***************************************************************************
- * Offscreen Images
- ***************************************************************************/
-
-typedef struct {
-    Bool isOn;
-} OffscreenPrivRec, *OffscreenPrivPtr;
-
-static int
-I830AllocateSurface(ScrnInfoPtr pScrn,
-		    int id,
-		    unsigned short w,
-		    unsigned short h, XF86SurfacePtr surface)
-{
-    int pitch, fbpitch, size;
-    OffscreenPrivPtr pPriv;
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    OVERLAY_DEBUG("I830AllocateSurface\n");
-
-    if (IS_845G(pI830) || IS_I830(pI830)) {
-	if ((w > IMAGE_MAX_WIDTH_LEGACY) || (h > IMAGE_MAX_HEIGHT_LEGACY))
-	    return BadAlloc;
-    } else {
-	if ((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT))
-	    return BadAlloc;
-    }
-
-    /* What to do when rotated ?? */
-    if (pI830->rotation != RR_Rotate_0)
-	return BadAlloc;
-
-    if (!(surface->pitches = xalloc(sizeof(int))))
-	return BadAlloc;
-    if (!(surface->offsets = xalloc(sizeof(int)))) {
-	xfree(surface->pitches);
-	return BadAlloc;
-    }
-    if (!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) {
-	xfree(surface->pitches);
-	xfree(surface->offsets);
-	return BadAlloc;
-    }
-
-    w = (w + 1) & ~1;
-    pitch = ((w << 1) + 15) & ~15;
-    fbpitch = pI830->cpp * pScrn->displayWidth;
-    size = pitch * h;
-
-    surface->width = w;
-    surface->height = h;
-
-    pPriv->isOn = FALSE;
-
-    surface->pScrn = pScrn;
-    surface->id = id;
-    surface->pitches[0] = pitch;
-    surface->offsets[0] = 0;
-    surface->devPrivate.ptr = (pointer) pPriv;
-
-    return Success;
-}
-
-static int
-I830StopSurface(XF86SurfacePtr surface)
-{
-    OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr;
-    ScrnInfoPtr pScrn = surface->pScrn;
-
-    if (pPriv->isOn) {
-	OVERLAY_DEBUG("StopSurface\n");
-
-	i830_overlay_off (pScrn);
-
-	pPriv->isOn = FALSE;
-    }
-
-    return Success;
-}
-
-static int
-I830FreeSurface(XF86SurfacePtr surface)
-{
-    I830StopSurface(surface);
-    xfree(surface->pitches);
-    xfree(surface->offsets);
-    xfree(surface->devPrivate.ptr);
-
-    return Success;
-}
-
-static int
-I830GetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value)
-{
-    return I830GetPortAttribute(pScrn, attribute, value, NULL);
-}
-
-static int
-I830SetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value)
-{
-    return I830SetPortAttributeOverlay(pScrn, attribute, value, NULL);
-}
-
-static int
-I830DisplaySurface(XF86SurfacePtr surface,
-		   short src_x, short src_y,
-		   short drw_x, short drw_y,
-		   short src_w, short src_h,
-		   short drw_w, short drw_h, RegionPtr clipBoxes)
-{
-    OffscreenPrivPtr pPriv = (OffscreenPrivPtr) surface->devPrivate.ptr;
-    ScrnInfoPtr pScrn = surface->pScrn;
-    ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-    I830PortPrivPtr pI830Priv = GET_PORT_PRIVATE(pScrn);
-    INT32 x1, y1, x2, y2;
-    BoxRec dstBox;
-    xf86CrtcPtr crtc;
-
-    OVERLAY_DEBUG("I830DisplaySurface\n");
-
-    x1 = src_x;
-    x2 = src_x + src_w;
-    y1 = src_y;
-    y2 = src_y + src_h;
-
-    dstBox.x1 = drw_x;
-    dstBox.x2 = drw_x + drw_w;
-    dstBox.y1 = drw_y;
-    dstBox.y2 = drw_y + drw_h;
-
-    if (!i830_clip_video_helper (pScrn, pI830Priv, &crtc, &dstBox,
-				 &x1, &x2, &y1, &y2, clipBoxes,
-				 surface->width, surface->height))
-	return Success;
-
-    /* fixup pointers */
-    pI830Priv->YBufOffset = surface->offsets[0];
-
-    i830_display_overlay(pScrn, crtc, surface->id, surface->width, surface->height,
-		     surface->pitches[0], x1, y1, x2, y2, &dstBox,
-		     src_w, src_h, drw_w, drw_h);
-
-    i830_fill_colorkey (pScreen, pI830Priv->colorKey, clipBoxes);
-
-    pPriv->isOn = TRUE;
-    /* we've prempted the XvImage stream so set its free timer */
-    if (pI830Priv->videoStatus & CLIENT_VIDEO_ON) {
-	REGION_EMPTY(pScrn->pScreen, &pI830Priv->clip);
-	UpdateCurrentTime();
-	pI830Priv->videoStatus = FREE_TIMER;
-	pI830Priv->freeTime = currentTime.milliseconds + FREE_DELAY;
-    }
-
-    return Success;
-}
-
-static void
-I830InitOffscreenImages(ScreenPtr pScreen)
-{
-    XF86OffscreenImagePtr offscreenImages;
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    I830Ptr pI830 = I830PTR(pScrn);
-
-    if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) {
-	return;
-    }
-
-    pI830->offscreenImages = offscreenImages;
-
-    offscreenImages[0].image = &Images[0];
-    offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/;
-    offscreenImages[0].alloc_surface = I830AllocateSurface;
-    offscreenImages[0].free_surface = I830FreeSurface;
-    offscreenImages[0].display = I830DisplaySurface;
-    offscreenImages[0].stop = I830StopSurface;
-    offscreenImages[0].setAttribute = I830SetSurfaceAttribute;
-    offscreenImages[0].getAttribute = I830GetSurfaceAttribute;
-    if (IS_845G(pI830) || IS_I830(pI830)) {
-	offscreenImages[0].max_width = IMAGE_MAX_WIDTH_LEGACY;
-	offscreenImages[0].max_height = IMAGE_MAX_HEIGHT_LEGACY;
-    } else {
-	offscreenImages[0].max_width = IMAGE_MAX_WIDTH;
-	offscreenImages[0].max_height = IMAGE_MAX_HEIGHT; 
-    }
-    offscreenImages[0].num_attributes = 1;
-    offscreenImages[0].attributes = Attributes;
-
-    xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1);
-}
-
 void
 i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on)
 {
-- 
1.6.3.3




More information about the Intel-gfx mailing list