diff options
author | Dave Airlie <airlied@redhat.com> | 2011-08-23 17:28:12 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-08-23 17:28:12 +0100 |
commit | a07c185f79dc03392b8314a956268f1e69a8853f (patch) | |
tree | 6d79bd71532a4957af33e9833d53307f9038fc65 | |
parent | 7d9daf38ca327c5c5ab5aa8f2785d3dd27f8748a (diff) |
drvmodelv2WIPdrvmodelv2-wip
-rw-r--r-- | drv/TODO | 10 | ||||
-rw-r--r-- | drv/impedpict.c | 12 | ||||
-rw-r--r-- | drv/impedscrn.c | 1 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyr.c | 206 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyr.h | 21 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrinit.c | 1 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.c | 4 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.h | 2 | ||||
-rw-r--r-- | hw/kdrive/src/kdrive.c | 6 | ||||
-rw-r--r-- | hw/kdrive/src/kdrive.h | 1 | ||||
-rw-r--r-- | randr/Makefile.am | 3 | ||||
-rw-r--r-- | randr/randrstr.h | 3 | ||||
-rw-r--r-- | randr/rrdispatch.c | 7 |
13 files changed, 204 insertions, 73 deletions
@@ -13,10 +13,20 @@ start hot remove - drop a pixmap shard and all copies of the gpu objects. - 40% test composited environment - broadcasted pixmaps. start looking at shattered Xv + gpu switch/offload: only one drvscreen , no switch with running Xv apps. + + for hotplug USB - same difference - accel on device. + + only screwed when doing accel/display on multiple devices - disable XV? + - no looping over anything for Xv needed. + + Xv - passthrough to the primary screen or have randr redirect it. + clip Xv window contents at boundary of screen/overlay start looking at X.org DDX start looking at GLX/DRI2 - + offload multi-card to client side apps xephyr root pixmap setup not copying properly diff --git a/drv/impedpict.c b/drv/impedpict.c index 0fe162cac..e8f93dc96 100644 --- a/drv/impedpict.c +++ b/drv/impedpict.c @@ -237,6 +237,8 @@ impedRasterizeTrapezoid (PicturePtr pPicture, for (i = 0; i < imped_screen->num_gpu; i++) { pDrvPicture = imped_picture->gpu[i]; pDrvPicture->pPixmap = imped_pixmap->gpu[i]; + + if (imped_pixmap->shattered) ErrorF("%s: shattered picture\n", __func__); drv_ps = DrvGetPictureScreen(imped_screen->gpu[i]); drv_ps->RasterizeTrapezoid(pDrvPicture, trap, x_off, y_off); } @@ -259,6 +261,8 @@ impedAddTraps (PicturePtr pPicture, for (i = 0; i < imped_screen->num_gpu; i++) { pDrvPicture = imped_picture->gpu[i]; pDrvPicture->pPixmap = imped_pixmap->gpu[i]; + + if (imped_pixmap->shattered) ErrorF("%s: shattered picture\n", __func__); drv_ps = DrvGetPictureScreen(imped_screen->gpu[i]); drv_ps->AddTraps(pDrvPicture, x_off, y_off, ntrap, traps); } @@ -287,6 +291,7 @@ impedTrapezoids (CARD8 op, if (pSrc->pDrawable) { pSrcPixmap = GetDrawablePixmap(pSrc->pDrawable); imped_src_pixmap = impedGetPixmap(pSrcPixmap); + if (imped_src_pixmap->shattered) ErrorF("%s: shattered src picture\n", __func__); impedGetDrawableDeltas(pSrc->pDrawable, pSrcPixmap, &x_off, &y_off); xSrc += x_off; ySrc += y_off; @@ -299,6 +304,7 @@ impedTrapezoids (CARD8 op, pDstPixmap = GetDrawablePixmap(pDst->pDrawable); imped_dst_pixmap = impedGetPixmap(pDstPixmap); + if (imped_dst_pixmap->shattered) ErrorF("%s: shattered dst picture\n", __func__); impedGetDrawableDeltas(pDst->pDrawable, pDstPixmap, &x_off, &y_off); if (x_off || y_off) { for (i = 0; i < ntrap; i++) { @@ -360,6 +366,7 @@ impedAddTriangles (PicturePtr pPicture, pDrvPicture = imped_picture->gpu[i]; pDrvPicture->pPixmap = imped_pixmap->gpu[i]; + if (imped_pixmap->shattered) ErrorF("%s: shattered picture\n", __func__); drv_ps = DrvGetPictureScreen(imped_screen->gpu[i]); drv_ps->AddTriangles(pDrvPicture, x_off_orig, y_off_orig, ntri, tris); } @@ -402,6 +409,8 @@ impedTriangles (CARD8 op, tris[i].p3.y += y_off << 16; } } + if (imped_src_pixmap->shattered) ErrorF("%s: shattered src picture\n", __func__); + if (imped_dst_pixmap->shattered) ErrorF("%s: shattered dst picture\n", __func__); for (i = 0; i < imped_screen->num_gpu; i++) { DrvPictureScreenPtr drv_ps = DrvGetPictureScreen(imped_screen->gpu[i]); @@ -448,6 +457,9 @@ impedGlyphs(CARD8 op, imped_dst_pixmap = impedGetPixmap(pDstPixmap); impedGetDrawableDeltas(pDst->pDrawable, pDstPixmap, &x_off, &y_off); + if (imped_src_pixmap->shattered) ErrorF("%s: shattered src picture\n", __func__); + if (imped_dst_pixmap->shattered) ErrorF("%s: shattered dst picture\n", __func__); + for (i = 0; i < imped_screen->num_gpu; i++) { DrvPictureScreenPtr drv_ps = DrvGetPictureScreen(imped_screen->gpu[i]); DrvPicturePtr pDrvSrc = NULL, pDrvDst; diff --git a/drv/impedscrn.c b/drv/impedscrn.c index d60b70936..481f87e21 100644 --- a/drv/impedscrn.c +++ b/drv/impedscrn.c @@ -537,6 +537,7 @@ void impedAttachDrvScreen(ScreenPtr pScreen, DrvScreenPtr pDrvScreen) imped_screen->gpu[i] = pDrvScreen; pDrvScreen->pScreen = pScreen; imped_screen->num_gpu++; + } struct list drvscreen_list; diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 10fd79fab..a6d2370e7 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -195,7 +195,8 @@ Bool ephyrScreenInit (KdDrvScreenInfo *screen) { EphyrScrPriv *scrpriv; - + Bool ret; + scrpriv = calloc(1, sizeof (EphyrScrPriv)); if (!scrpriv) @@ -209,7 +210,35 @@ ephyrScreenInit (KdDrvScreenInfo *screen) free(scrpriv); return FALSE; } - + +#ifdef RANDR + { + drvrrScrPrivPtr pDrvScrPriv; + /* create a crtc and and output */ + + ret = DrvRRScreenInit(screen->pDrvScreen); + if (ret == FALSE) + return FALSE; + + pDrvScrPriv = drvrrGetScrPriv(screen->pDrvScreen); + pDrvScrPriv->drvrrGetInfo = ephyrRandRGetInfo; + pDrvScrPriv->drvrrCrtcSet = ephyrCrtcSet; + scrpriv->crtc = DrvRRCrtcCreate(screen->pDrvScreen, NULL); + if (!scrpriv->crtc) + return FALSE; + scrpriv->output = DrvRROutputCreate(screen->pDrvScreen, "ephyr", 5, NULL); + if (!scrpriv->output) + return FALSE; + + ret = ephyrCreateFakeModes(scrpriv->output); + if (!ret) + return FALSE; + + DrvRROutputSetCrtcs(scrpriv->output, &scrpriv->crtc, 1); + DrvRROutputSetConnection(scrpriv->output, RR_Connected); + + } +#endif return TRUE; } @@ -446,7 +475,10 @@ ephyrHotAddDrvScreen(void) /* duplicate resources */ impedAddDrvScreen(screen->pScreen, drvscreen->pDrvScreen); + drvscreen->pDrvScreen->CreateScreenResources(drvscreen->pDrvScreen); + + hostx_paint_rect(drvscreen, 0,0,0,0, drvscreen->width, drvscreen->height); } } } @@ -521,72 +553,94 @@ ephyrUnsetInternalDamage (DrvScreenPtr pScreen) } #ifdef RANDR -#if 0 + Bool -ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +ephyrCreateFakeModes(DrvRROutputPtr rroutput) { - KdScreenPriv(pScreen); - KdScreenInfo *pscreen = pScreenPriv->screen; - KdDrvScreenInfo *screen = pscreen->drvscreen; - EphyrScrPriv *scrpriv = screen->driver; + xRRModeInfo modeInfo; + RRModePtr rrmode; + Bool ret; + struct { int width, height; } sizes[] = + { + { 1600, 1200 }, + { 1400, 1050 }, + { 1280, 960 }, + { 1280, 1024 }, + { 1152, 864 }, + { 1024, 768 }, + { 832, 624 }, + { 800, 600 }, + { 720, 400 }, + { 480, 640 }, + { 640, 480 }, + { 640, 400 }, + { 320, 240 }, + { 240, 320 }, + { 160, 160 }, + }; + int nmodes, i; + RRModePtr *rrmodes = NULL; + char name[255]; + int nmode = 0; + + nmodes = sizeof(sizes) / sizeof(sizes[0]); + + rrmodes = malloc(nmodes * sizeof(RRModePtr)); + + for (i = 0; i < nmodes; i++) { + memset(&modeInfo, 0, sizeof(xRRModeInfo)); + + snprintf(name, 255, "%dx%d", sizes[i].width, sizes[i].height); + modeInfo.nameLength = strlen(name); + modeInfo.width = sizes[i].width; + modeInfo.height = sizes[i].height; + rrmode = RRModeGet(&modeInfo, name); + if (rrmode) { + rrmodes[nmode++] = rrmode; + } + } + + ret = DrvRROutputSetModes(rroutput, rrmodes, nmode, 0); + + free(rrmodes); + return ret; +} + +#if 1 +Bool +ephyrRandRGetInfo (DrvScreenPtr pDrvScreen, Rotation *rotations) +{ + KdScreenPriv(pDrvScreen); + KdDrvScreenInfo *pscreen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = pscreen->driver; RRScreenSizePtr pSize; Rotation randr; int n = 0; - - struct { int width, height; } sizes[] = - { - { 1600, 1200 }, - { 1400, 1050 }, - { 1280, 960 }, - { 1280, 1024 }, - { 1152, 864 }, - { 1024, 768 }, - { 832, 624 }, - { 800, 600 }, - { 720, 400 }, - { 480, 640 }, - { 640, 480 }, - { 640, 400 }, - { 320, 240 }, - { 240, 320 }, - { 160, 160 }, - { 0, 0 } - }; EPHYR_LOG("mark"); *rotations = RR_Rotate_All|RR_Reflect_All; - if (!hostx_want_preexisting_window (screen) - && !hostx_want_fullscreen ()) /* only if no -parent switch */ - { - while (sizes[n].width != 0 && sizes[n].height != 0) - { - RRRegisterSize (pScreen, - sizes[n].width, - sizes[n].height, - (sizes[n].width * screen->width_mm)/screen->width, - (sizes[n].height *screen->height_mm)/screen->height - ); - n++; - } - } - - pSize = RRRegisterSize (pScreen, - screen->width, - screen->height, - screen->width_mm, - screen->height_mm); - - randr = KdSubRotation (scrpriv->randr, screen->randr); - - RRSetCurrentConfig (pScreen, randr, 0, pSize); - return TRUE; } + Bool -ephyrRandRSetConfig (ScreenPtr pScreen, +ephyrCrtcSet (DrvScreenPtr pScreen, + DrvRRCrtcPtr randr_crtc, + RRModePtr randr_mode, + int x, + int y, + Rotation rotation, + int num_randr_outputs, + DrvRROutputPtr *randr_outputs) +{ + +} +#endif +#if 0 +Bool +ephyrRandRSetConfig (DrvScreenPtr pScreen, Rotation randr, int rate, RRScreenSizePtr pSize) @@ -708,18 +762,13 @@ ephyrRandRSetConfig (ScreenPtr pScreen, return FALSE; } #endif + Bool ephyrRandRInit (ScreenPtr pScreen) { - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit (pScreen)) - return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - // pScrPriv->rrGetInfo = ephyrRandRGetInfo; - // pScrPriv->rrSetConfig = ephyrRandRSetConfig; - return TRUE; + Bool ret; + ret = impedRandR12Init(pScreen); + return ret; } #endif @@ -783,24 +832,51 @@ ephyrFinishInitScreen (DrvScreenPtr pScreen) if (!shadowSetup (pScreen)) return FALSE; + +#endif + return TRUE; +} + +Bool ephyrScreenFinishInit(struct _KdScreenInfo *screen) +{ #ifdef RANDR - if (!ephyrRandRInit (pScreen)) + if (!ephyrRandRInit (screen->pScreen)) return FALSE; #endif -#endif return TRUE; } Bool +ephyrRandrCSR(DrvScreenPtr pScreen) +{ + KdDrvScreenPriv(pScreen); + KdDrvScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + int i; + RRModePtr mode = NULL; + + for (i = 0; i < scrpriv->output->numModes; i++) { + if (screen->width == scrpriv->output->modes[i]->mode.width && + screen->height == scrpriv->output->modes[i]->mode.height) + mode = scrpriv->output->modes[i]; + } + DrvRRCrtcNotify(scrpriv->crtc, mode, 0, 0, RR_Rotate_0, + NULL, 1, &scrpriv->output); + +} + +Bool ephyrCreateResources (DrvScreenPtr pScreen) { KdDrvScreenPriv(pScreen); KdDrvScreenInfo *screen = pScreenPriv->screen; EphyrScrPriv *scrpriv = screen->driver; + int c; EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d", pScreen, pScreen->myNum, scrpriv->shadow); + ephyrRandrCSR(pScreen); pScreen->screenPixmap->devPrivate.ptr = screen->fb.frameBuffer; if (scrpriv->shadow) return KdShadowSet (pScreen, diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h index 2081a9e2d..bd71600ad 100644 --- a/hw/kdrive/ephyr/ephyr.h +++ b/hw/kdrive/ephyr/ephyr.h @@ -36,7 +36,7 @@ #include "drvexa.h" #ifdef RANDR -#include "randrstr.h" +#include "drv_randr.h" #endif #include "drv_damage.h" @@ -65,6 +65,8 @@ typedef struct _ephyrDrvScrPriv { Bool shadow; DrvDamagePtr pDamage; EphyrFakexaPriv *fakexa; + DrvRRCrtcPtr crtc; + DrvRROutputPtr output; } EphyrScrPriv; extern KdCardFuncs ephyrFuncs; @@ -152,10 +154,21 @@ ephyrPoll(void); #ifdef RANDR Bool -ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations); +ephyrRandRGetInfo (DrvScreenPtr pScreen, Rotation *rotations); + + +Bool +ephyrCrtcSet (DrvScreenPtr pScreen, + DrvRRCrtcPtr randr_crtc, + RRModePtr randr_mode, + int x, + int y, + Rotation rotation, + int num_randr_outputs, + DrvRROutputPtr *randr_outputs); Bool -ephyrRandRSetConfig (ScreenPtr pScreen, +ephyrRandRSetConfig (DrvScreenPtr pScreen, Rotation randr, int rate, RRScreenSizePtr pSize); @@ -202,4 +215,6 @@ Bool ephyrInitVideo(ScreenPtr pScreen) ; void processDrvScreenArg (char *screen_size, char *parent_id, int create_win) ; +Bool ephyrScreenFinishInit(struct _KdScreenInfo *screen); + #endif diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 11d441f1c..5f5e5418c 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -145,6 +145,7 @@ processScreenArg (char *screen_size, char *parent_id) unsigned long p_id = 0; screen = KdScreenInfoAdd (); + screen->screenFinishInit = ephyrScreenFinishInit; // KdParseScreen (screen, screen_size); drv_screen = KdDrvScreenInfoAdd(card); drv_screen->proto_screen = screen->mynum; diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 323fc380a..9e54ae262 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -114,7 +114,7 @@ struct EphyrHostXVars /*static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};*/ static EphyrHostXVars HostX; -static int HostXWantDamageDebug = 0; +static int HostXWantDamageDebug = 1; extern EphyrKeySyms ephyrKeySyms; @@ -860,7 +860,7 @@ hostx_paint_rect (EphyrScreenInfo screen, { struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen); - EPHYR_DBG ("painting in screen %d\n", host_screen->mynum) ; + EPHYR_DBG ("painting in screen %d %d %d %d %d %d %d\n", host_screen->mynum, sx, sy, dx, dy, width, height) ; /* * Copy the image data updated by the shadow layer diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h index 23e3df51d..a72b668c8 100644 --- a/hw/kdrive/ephyr/hostx.h +++ b/hw/kdrive/ephyr/hostx.h @@ -29,7 +29,7 @@ #include <X11/X.h> #include <X11/Xmd.h> -#define EPHYR_WANT_DEBUG 0 +#define EPHYR_WANT_DEBUG 1 #if (EPHYR_WANT_DEBUG) #define EPHYR_DBG(x, a...) \ diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index bda65fe72..87aa55e02 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -1272,6 +1272,10 @@ KdScreenInit(int index, ScreenPtr pScreen, pScreen->WakeupHandler = KdWakeupHandler; kdCurrentScreen->pScreen = pScreen; + if (kdCurrentScreen->screenFinishInit) + if (!kdCurrentScreen->screenFinishInit(kdCurrentScreen)) + return FALSE; + return TRUE; } static void @@ -1355,7 +1359,7 @@ KdInitOutput (ScreenInfo *pScreenInfo, KdDrvScreenInfo *drvscreen; impedInit(); - + if (!dixRegisterPrivateKey(&kdDrvScreenPrivateKeyRec, PRIVATE_DRV_SCREEN, 0)) return FALSE; diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 3a5cb3d8f..0d872c0f1 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -97,6 +97,7 @@ typedef struct _KdScreenInfo { // KdCardInfo *card; ScreenPtr pScreen; int mynum; + Bool (*screenFinishInit)(struct _KdScreenInfo *); } KdScreenInfo; typedef struct _KdDrvScreenInfo { diff --git a/randr/Makefile.am b/randr/Makefile.am index de338b972..1dcd8078a 100644 --- a/randr/Makefile.am +++ b/randr/Makefile.am @@ -21,7 +21,8 @@ librandr_la_SOURCES = \ rrscreen.c \ rrsdispatch.c \ rrtransform.h \ - rrtransform.c + rrtransform.c \ + rrprovider.c if XINERAMA librandr_la_SOURCES += ${XINERAMA_SRCS} diff --git a/randr/randrstr.h b/randr/randrstr.h index d8dd37d96..414edd7ad 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -893,6 +893,9 @@ ProcRRConfigureOutputProperty (ClientPtr client); extern _X_EXPORT int ProcRRDeleteOutputProperty (ClientPtr client); +extern _X_EXPORT int +ProcRRGetProviders (ClientPtr client); + /* rrxinerama.c */ #ifdef XINERAMA extern _X_EXPORT void diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index d1c99c288..4ae346457 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -252,5 +252,12 @@ int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = { ProcRRSetPanning, /* 29 */ ProcRRSetOutputPrimary, /* 30 */ ProcRRGetOutputPrimary, /* 31 */ + NULL, + NULL, + NULL, + NULL, + NULL, + ProcRRGetProviders, /* 37 */ + NULL, }; |