Removing direct graphics access from DGA
Dave Airlie
airlied at redhat.com
Wed Sep 16 17:24:47 PDT 2009
On Wed, 2009-09-16 at 15:34 -0700, Keith Packard wrote:
> DGA remains an ugly wart inside the X server, and yet we can't quite get
> rid of it because it is the only way to get unfiltered relative mouse
> motion events.
>
> This patch removes the drawing part of DGA, both the DGA pixmap stuff,
> the DGA rendering operations and the DGA mmap ability from the
> device-independent DGA code that was included in RandR 1.2.
>
> I'm posting this to let people know what I'd like to see happen to DGA
> before its ultimate demise.
As long as someone tests quake 1 still works ;-)
/me tries to remember any useful app that used DGA graphics ever (old
vmware?)
Dave.
>
> -keith
>
> From b31340789682149e75fefe372f4e66395f91f13c Mon Sep 17 00:00:00 2001
> From: Keith Packard <keithp at keithp.com>
> Date: Wed, 16 Sep 2009 15:26:24 -0700
> Subject: [PATCH] Remove DGA pixmaps and framebuffer mmap from device-independent DGA
>
> If you want direct frame buffer access, use DRI.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
> hw/xfree86/modes/xf86Crtc.h | 3 -
> hw/xfree86/modes/xf86DiDGA.c | 107 ++++--------------------------------------
> 2 files changed, 9 insertions(+), 101 deletions(-)
>
> diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
> index 69afaa5..5b0dca1 100644
> --- a/hw/xfree86/modes/xf86Crtc.h
> +++ b/hw/xfree86/modes/xf86Crtc.h
> @@ -650,11 +650,8 @@ typedef struct _xf86CrtcConfig {
> Bool rotation_damage_registered;
>
> /* DGA */
> - unsigned int dga_flags;
> - unsigned long dga_address;
> DGAModePtr dga_modes;
> int dga_nmode;
> - int dga_width, dga_height, dga_stride;
> DisplayModePtr dga_save_mode;
>
> const xf86CrtcConfigFuncsRec *funcs;
> diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
> index 0964cef..6f433ed 100644
> --- a/hw/xfree86/modes/xf86DiDGA.c
> +++ b/hw/xfree86/modes/xf86DiDGA.c
> @@ -72,8 +72,7 @@ xf86_dga_get_modes (ScreenPtr pScreen)
> mode = modes + num++;
>
> mode->mode = display_mode;
> - mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
> - mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
> + mode->flags = DGA_CONCURRENT_ACCESS;
> if (display_mode->Flags & V_DBLSCAN)
> mode->flags |= DGA_DOUBLESCAN;
> if (display_mode->Flags & V_INTERLACE)
> @@ -91,10 +90,10 @@ xf86_dga_get_modes (ScreenPtr pScreen)
> mode->yViewportStep = 1;
> mode->viewportFlags = DGA_FLIP_RETRACE;
> mode->offset = 0;
> - mode->address = (unsigned char *) xf86_config->dga_address;
> - mode->bytesPerScanline = xf86_config->dga_stride;
> - mode->imageWidth = xf86_config->dga_width;
> - mode->imageHeight = xf86_config->dga_height;
> + mode->address = 0;
> + mode->bytesPerScanline = display_mode->HDisplay * bpp;
> + mode->imageWidth = display_mode->HDisplay;
> + mode->imageHeight = display_mode->VDisplay;
> mode->pixmapWidth = mode->imageWidth;
> mode->pixmapHeight = mode->imageHeight;
> mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
> @@ -149,93 +148,11 @@ xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
> }
>
> static Bool
> -xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC)
> -{
> - ScreenPtr pScreen = scrn->pScreen;
> - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> - PixmapPtr pPixmap;
> - GCPtr pGC;
> -
> - pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height,
> - scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride,
> - (char *) scrn->memPhysBase + scrn->fbOffset);
> - if (!pPixmap)
> - return FALSE;
> - pGC = GetScratchGC (scrn->depth, pScreen);
> - if (!pGC)
> - {
> - FreeScratchPixmapHeader (pPixmap);
> - return FALSE;
> - }
> - *ppDrawable = &pPixmap->drawable;
> - *ppGC = pGC;
> - return TRUE;
> -}
> -
> -static void
> -xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC)
> -{
> - FreeScratchGC (pGC);
> - FreeScratchPixmapHeader ((PixmapPtr) pDrawable);
> -}
> -
> -static void
> -xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color)
> -{
> - GCPtr pGC;
> - DrawablePtr pDrawable;
> - XID vals[1];
> - xRectangle r;
> -
> - if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
> - return;
> - vals[0] = color;
> - ChangeGC (pGC, GCForeground, vals);
> - ValidateGC (pDrawable, pGC);
> - r.x = x;
> - r.y = y;
> - r.width = w;
> - r.height = h;
> - pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r);
> - xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
> -}
> -
> -static void
> -xf86_dga_sync(ScrnInfoPtr scrn)
> -{
> - ScreenPtr pScreen = scrn->pScreen;
> - WindowPtr pRoot = WindowTable [pScreen->myNum];
> - char buffer[4];
> -
> - pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
> -}
> -
> -static void
> -xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
> -{
> - DrawablePtr pDrawable;
> - GCPtr pGC;
> -
> - if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
> - return;
> - ValidateGC (pDrawable, pGC);
> - pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty);
> - xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
> -}
> -
> -static Bool
> xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
> char **name,
> unsigned char **mem, int *size, int *offset, int *flags)
> {
> - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> -
> - *size = xf86_config->dga_stride * xf86_config->dga_height;
> - *mem = (unsigned char *) (xf86_config->dga_address);
> - *offset = 0;
> - *flags = DGA_NEED_ROOT;
> -
> - return TRUE;
> + return FALSE;
> }
>
> static void
> @@ -249,9 +166,9 @@ static DGAFunctionRec xf86_dga_funcs = {
> xf86_dga_set_mode,
> xf86_dga_set_viewport,
> xf86_dga_get_viewport,
> - xf86_dga_sync,
> - xf86_dga_fill_rect,
> - xf86_dga_blit_rect,
> + NULL,
> + NULL,
> + NULL,
> NULL
> };
>
> @@ -273,12 +190,6 @@ xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
> ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
> xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
>
> - xf86_config->dga_flags = 0;
> - xf86_config->dga_address = dga_address;
> - xf86_config->dga_width = scrn->virtualX;
> - xf86_config->dga_height = scrn->virtualY;
> - xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3;
> -
> if (!xf86_dga_get_modes (pScreen))
> return FALSE;
>
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list