Re: [PATCH 04/36] dix: introduce gpu screens. (v3)

2012-07-04 Thread Dave Airlie
On Wed, Jul 4, 2012 at 1:07 AM, Aaron Plattner aplatt...@nvidia.com wrote:
 On 07/02/2012 03:12 AM, Dave Airlie wrote:

 From: Dave Airlie airl...@redhat.com


 diff --git a/render/glyph.c b/render/glyph.c
 index acb573f..c121e64 100644
 --- a/render/glyph.c
 +++ b/render/glyph.c
 @@ -687,6 +687,8 @@ miGlyphs(CARD8 op,

   PicturePtr GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen)
   {
 +if (pScreen-isGPU)
 +return NULL;
   return GlyphPicture(glyph)[pScreen-myNum];
   }


 What's up with this?  How are we supposed to render glyphs without glyph
 pictures?


Well for slave output and dri2 offload its not possible to need to
render glyphs from what I can see,
for GPU switching I'll be fixing that up alright, but for 1.13 this
should be fine.

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 04/36] dix: introduce gpu screens. (v3)

2012-07-03 Thread Dave Airlie
On Mon, Jul 2, 2012 at 9:07 PM, Adam Jackson a...@nwnk.net wrote:
 On 7/2/12 6:12 AM, Dave Airlie wrote:

 +void
 +RemoveGPUScreen(ScreenPtr pScreen)
 +{
 +int idx, j;
 +if (!pScreen-isGPU)
 +return;
 +
 +idx = pScreen-myNum - GPU_SCREEN_OFFSET;
 +for (j = idx; j  screenInfo.numGPUScreens - 1; j++) {
 +screenInfo.gpuscreens[j] = screenInfo.gpuscreens[j + 1];
 +}
 +screenInfo.numGPUScreens--;
 +
 +free(pScreen);
 +
 +}


 I don't see this getting called from the xf86 DDX, at least not in 6/36.

It doesn't get used until hotplug time.


 Even if it were, it's not symmetric with how xf86's remove path works.
 There you change -scrnIndex to match the current slot in the array, here
 you're not doing that with -myNum.  That seems like an error.

Oh good point, will revise to be saner.

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 04/36] dix: introduce gpu screens. (v3)

2012-07-03 Thread Aaron Plattner

On 07/02/2012 03:12 AM, Dave Airlie wrote:

From: Dave Airlie airl...@redhat.com




diff --git a/render/glyph.c b/render/glyph.c
index acb573f..c121e64 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -687,6 +687,8 @@ miGlyphs(CARD8 op,

  PicturePtr GetGlyphPicture(GlyphPtr glyph, ScreenPtr pScreen)
  {
+if (pScreen-isGPU)
+return NULL;
  return GlyphPicture(glyph)[pScreen-myNum];
  }



What's up with this?  How are we supposed to render glyphs without glyph 
pictures?

-- Aaron
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 04/36] dix: introduce gpu screens. (v3)

2012-07-02 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This patch introduces gpu screens into screenInfo. It adds interfaces
for adding and removing gpu screens, along with adding private fixup,
block handler support, and scratch pixmap init.

GPU screens have a myNum that is offset by GPU_SCREEN_OFFSET (256),
this is used for logging etc.

v2: no glyph pictures for GPU screens for now.
v3: introduce MAXGPUSCREENS, fix return value check

Signed-off-by: Dave Airlie airl...@redhat.com
---
 dix/dispatch.c   |   75 --
 dix/dixutils.c   |6 
 dix/main.c   |   15 ++
 dix/privates.c   |5 
 include/misc.h   |4 +++
 include/screenint.h  |9 ++
 include/scrnintstr.h |4 +++
 render/glyph.c   |2 ++
 8 files changed, 118 insertions(+), 2 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 34d82f4..b0fc531 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3724,7 +3724,7 @@ with its screen number, a pointer to its ScreenRec, argc, 
and argv.
 
 */
 
-static int init_screen(ScreenPtr pScreen, int i)
+static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
 {
 int scanlinepad, format, depth, bitsPerPixel, j, k;
 
@@ -3732,6 +3732,10 @@ static int init_screen(ScreenPtr pScreen, int i)
 return -1;
 }
 pScreen-myNum = i;
+if (gpu) {
+pScreen-myNum += GPU_SCREEN_OFFSET;
+pScreen-isGPU = TRUE;
+}
 pScreen-totalPixmapSize = 0;   /* computed in 
CreateScratchPixmapForScreen */
 pScreen-ClipNotify = 0;/* for R4 ddx compatibility */
 pScreen-CreateScreenResources = 0;
@@ -3788,7 +3792,7 @@ AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 if (!pScreen)
 return -1;
 
-ret = init_screen(pScreen, i);
+ret = init_screen(pScreen, i, FALSE);
 if (ret != 0) {
 free(pScreen);
 return ret;
@@ -3817,3 +3821,70 @@ AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 
 return i;
 }
+
+int
+AddGPUScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
+  int /*argc */ ,
+  char **  /*argv */
+  ),
+ int argc, char **argv)
+{
+int i;
+ScreenPtr pScreen;
+Bool ret;
+
+i = screenInfo.numGPUScreens;
+if (i == MAXGPUSCREENS)
+return -1;
+
+pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
+if (!pScreen)
+return -1;
+
+ret = init_screen(pScreen, i, TRUE);
+if (ret != 0) {
+free(pScreen);
+return ret;
+}
+
+/* This is where screen specific stuff gets initialized.  Load the
+   screen structure, call the hardware, whatever.
+   This is also where the default colormap should be allocated and
+   also pixel values for blackPixel, whitePixel, and the cursor
+   Note that InitScreen is NOT allowed to modify argc, argv, or
+   any of the strings pointed to by argv.  They may be passed to
+   multiple screens.
+ */
+screenInfo.gpuscreens[i] = pScreen;
+screenInfo.numGPUScreens++;
+if (!(*pfnInit) (pScreen, argc, argv)) {
+dixFreePrivates(pScreen-devPrivates, PRIVATE_SCREEN);
+free(pScreen);
+screenInfo.numGPUScreens--;
+return -1;
+}
+
+update_desktop_dimensions();
+
+dixRegisterScreenPrivateKey(cursorScreenDevPriv, pScreen, PRIVATE_CURSOR,
+0);
+
+return i;
+}
+
+void
+RemoveGPUScreen(ScreenPtr pScreen)
+{
+int idx, j;
+if (!pScreen-isGPU)
+return;
+
+idx = pScreen-myNum - GPU_SCREEN_OFFSET;
+for (j = idx; j  screenInfo.numGPUScreens - 1; j++) {
+screenInfo.gpuscreens[j] = screenInfo.gpuscreens[j + 1];
+}
+screenInfo.numGPUScreens--;
+
+free(pScreen);
+
+}
diff --git a/dix/dixutils.c b/dix/dixutils.c
index b249a81..3f24629 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -386,6 +386,9 @@ BlockHandler(pointer pTimeout, pointer pReadmask)
 for (i = 0; i  screenInfo.numScreens; i++)
 (*screenInfo.screens[i]-BlockHandler) (screenInfo.screens[i],
 pTimeout, pReadmask);
+for (i = 0; i  screenInfo.numGPUScreens; i++)
+(*screenInfo.gpuscreens[i]-BlockHandler) (screenInfo.gpuscreens[i],
+   pTimeout, pReadmask);
 for (i = 0; i  numHandlers; i++)
 if (!handlers[i].deleted)
 (*handlers[i].BlockHandler) (handlers[i].blockData,
@@ -422,6 +425,9 @@ WakeupHandler(int result, pointer pReadmask)
 for (i = 0; i  screenInfo.numScreens; i++)
 (*screenInfo.screens[i]-WakeupHandler) (screenInfo.screens[i],
  result, pReadmask);
+for (i = 0; i  screenInfo.numGPUScreens; i++)
+(*screenInfo.gpuscreens[i]-WakeupHandler) (screenInfo.gpuscreens[i],
+result, 

Re: [PATCH 04/36] dix: introduce gpu screens. (v3)

2012-07-02 Thread Keith Packard
Dave Airlie airl...@gmail.com writes:

 v3: introduce MAXGPUSCREENS, fix return value check

Reviewed-by: Keith Packard kei...@keithp.com

-- 
keith.pack...@intel.com


pgpdolhPk7zkO.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 04/36] dix: introduce gpu screens. (v3)

2012-07-02 Thread Adam Jackson

On 7/2/12 6:12 AM, Dave Airlie wrote:


+void
+RemoveGPUScreen(ScreenPtr pScreen)
+{
+int idx, j;
+if (!pScreen-isGPU)
+return;
+
+idx = pScreen-myNum - GPU_SCREEN_OFFSET;
+for (j = idx; j  screenInfo.numGPUScreens - 1; j++) {
+screenInfo.gpuscreens[j] = screenInfo.gpuscreens[j + 1];
+}
+screenInfo.numGPUScreens--;
+
+free(pScreen);
+
+}


I don't see this getting called from the xf86 DDX, at least not in 6/36.

Even if it were, it's not symmetric with how xf86's remove path works. 
 There you change -scrnIndex to match the current slot in the array, 
here you're not doing that with -myNum.  That seems like an error.


- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel