exa: add nouveau_exa_pixmap_is_tiled
PATCH 1/3 exa: add nouveau_exa_pixmap_is_tiled
--- src/nouveau_exa.c | 19 +++++++++++++++---- src/nv50_exa.c | 6 +++--- src/nv50_xv.c | 5 +---- src/nv_proto.h | 1 + 4 files changed, 20 insertions(+), 11 deletions(-)
src/nouveau_exa.c +15 -4
@@ -52,8 +52,7 @@ NVAccelDownloadM2MF(PixmapPtr pspix, int x, int y, int w, int h,unsigned line_len = w * cpp;unsigned src_pitch =0 , src_offset =0 , linear =0 ; -if (pNv->Architecture <NV_ARCH_50 || -exaGetPixmapOffset (pspix) < pNv->EXADriverPtr->offScreenBase) { +if (!nouveau_exa_pixmap_is_tiled (pspix)) { linear =1 ; src_pitch =exaGetPixmapPitch (pspix); src_offset = (y * src_pitch) + (x * cpp);
@@ -162,8 +161,7 @@ NVAccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,unsigned line_len = w * cpp;unsigned dst_pitch =0 , dst_offset =0 , linear =0 ; -if (pNv->Architecture <NV_ARCH_50 || -exaGetPixmapOffset (pdpix) < pNv->EXADriverPtr->offScreenBase) { +if (!nouveau_exa_pixmap_is_tiled (pdpix)) { linear =1 ; dst_pitch =exaGetPixmapPitch (pdpix); dst_offset = (y * dst_pitch) + (x * cpp);
@@ -275,6 +273,19 @@ nouveau_exa_wait_marker(ScreenPtr pScreen, int marker)NVSync (xf86Screens[pScreen->myNum]); } +bool +nouveau_exa_pixmap_is_tiled (PixmapPtr ppix) +{ +ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum]; +NVPtr pNv =NVPTR (pScrn); + +if (pNv->Architecture <NV_ARCH_50 || +exaGetPixmapOffset (ppix) < pNv->EXADriverPtr->offScreenBase) +return false; + +return true; +} +static void *nouveau_exa_pixmap_map (PixmapPtr ppix) {
src/nv50_exa.c +3 -3
@@ -117,7 +117,7 @@ NV50EXAAcquireSurface2D(PixmapPtr ppix, int is_src) bo_flags =NOUVEAU_BO_VRAM ; bo_flags |= is_src ?NOUVEAU_BO_RD :NOUVEAU_BO_WR ; -if (exaGetPixmapOffset (ppix) < pNv->EXADriverPtr->offScreenBase) { +if (!nouveau_exa_pixmap_is_tiled (ppix)) {BEGIN_RING (chan, eng2d, mthd,2 );OUT_RING (chan, fmt);OUT_RING (chan,1 );
@@ -438,7 +438,7 @@ NV50EXARenderTarget(PixmapPtr ppix, PicturePtr ppict)unsigned format;/*XXX: Scanout buffer not tiled, someone needs to figure it out */ -if (exaGetPixmapOffset (ppix) < pNv->EXADriverPtr->offScreenBase) +if (!nouveau_exa_pixmap_is_tiled (ppix))NOUVEAU_FALLBACK ("pixmap is scanout buffer\n" );switch (ppict->format) {
@@ -511,7 +511,7 @@ NV50EXATexture(PixmapPtr ppix, PicturePtr ppict, unsigned unit)const unsigned tcb_flags =NOUVEAU_BO_RDWR |NOUVEAU_BO_VRAM ;/*XXX: Scanout buffer not tiled, someone needs to figure it out */ -if (exaGetPixmapOffset (ppix) < pNv->EXADriverPtr->offScreenBase) +if (!nouveau_exa_pixmap_is_tiled (ppix))NOUVEAU_FALLBACK ("pixmap is scanout buffer\n" );BEGIN_RING (chan, tesla,NV50TCL_TIC_ADDRESS_HIGH ,3 );
src/nv50_xv.c +1 -4
@@ -39,9 +39,6 @@static Bool nv50_xv_check_image_put (PixmapPtr ppix) { -ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum]; -NVPtr pNv =NVPTR (pScrn); -switch (ppix->drawable.depth) {case 32 :case 24 :
@@ -51,7 +48,7 @@ nv50_xv_check_image_put(PixmapPtr ppix)return FALSE; } -if (exaGetPixmapOffset (ppix) < pNv->EXADriverPtr->offScreenBase) +if (!nouveau_exa_pixmap_is_tiled (ppix))return FALSE;return TRUE;
src/nv_proto.h +1 -0
@@ -64,6 +64,7 @@ void NVTakedownDma(ScrnInfoPtr pScrn);/* in nouveau_exa.c */ Bool nouveau_exa_init (ScreenPtr pScreen);Bool nouveau_exa_pixmap_is_onscreen (PixmapPtr pPixmap); +bool nouveau_exa_pixmap_is_tiled (PixmapPtr ppix);/* in nv_hw.c */ void NVCalcStateExt (ScrnInfoPtr ,struct _riva_hw_state *,int ,int ,int ,int ,int ,int );
Signature · 1 line
1.6.1.2
A message that is not in the archive (sent off-list or not yet received): 1234479392-1984-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/3 nv50: initial bits for "shadowfb"
- Fallbacks on the frontbuffer still need to be handled.
--- src/Makefile.am | 1 + src/nouveau_exa.c | 7 +-- src/nv50_randr.c | 2 +- src/nv50_shadow_damage.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++ src/nv_driver.c | 46 ++++++++++++-- src/nv_proto.h | 3 + src/nv_type.h | 3 + 7 files changed, 214 insertions(+), 12 deletions(-) create mode 100644 src/nv50_shadow_damage.c
src/Makefile.am +1 -0
@@ -79,6 +79,7 @@ nouveau_drv_la_SOURCES = \ nv50_xv.c \ nv50_texture.h \ nv50reg.h \ + nv50_shadow_damage.c \ nouveau_crtc.h \ nouveau_output.h \ nouveau_connector.h \
src/nouveau_exa.c +1 -6
@@ -279,8 +279,7 @@ nouveau_exa_pixmap_is_tiled(PixmapPtr ppix)ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];NVPtr pNv =NVPTR (pScrn); -if (pNv->Architecture <NV_ARCH_50 || -exaGetPixmapOffset (ppix) < pNv->EXADriverPtr->offScreenBase) +if (pNv->Architecture <NV_ARCH_50 )return false;return true;
@@ -437,10 +436,6 @@ nouveau_exa_init(ScreenPtr pScreen) exa->memorySize = pNv->FB->size;if (pNv->Architecture >=NV_ARCH_50 ) { -nouveau_bo_tile (pNv->FB,NOUVEAU_BO_VRAM |NOUVEAU_BO_TILED , - exa->offScreenBase, - exa->memorySize - exa->offScreenBase); - exa->maxX =8192 ; exa->maxY =8192 ; }else
src/nv50_randr.c +1 -1
@@ -99,7 +99,7 @@ nv50_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjuste nv_crtc->crtc->SetFB (nv_crtc->crtc, nv_crtc->shadow); nv_crtc->crtc->SetFBOffset (nv_crtc->crtc,0 ,0 ); }else { - nv_crtc->crtc->SetFB (nv_crtc->crtc, pNv->FB); + nv_crtc->crtc->SetFB (nv_crtc->crtc, pNv->scanout); nv_crtc->crtc->SetFBOffset (nv_crtc->crtc, x, y); } nv_crtc->crtc->ModeSet (nv_crtc->crtc, mode);
src/nv50_shadow_damage.c new file +164 -0
164 lines not on this page · raw message
src/nv_driver.c +41 -5
80 lines not on this page · raw message
src/nv_proto.h +3 -0
@@ -276,6 +276,9 @@ void nv50_xv_video_stop(ScrnInfoPtr, pointer, Bool);int nv50_xv_port_attribute_set (ScrnInfoPtr ,Atom ,INT32 ,pointer );int nv50_xv_port_attribute_get (ScrnInfoPtr ,Atom ,INT32 *,pointer ); +/* nv50_shadow_damage.c */ +bool nv50_shadow_damage_create (ScrnInfoPtr pScrn); +/* To support EXA 2.0, 2.1 has this in the header */ #ifndef exaMoveInPixmapextern void exaMoveInPixmap (PixmapPtr pPixmap);
src/nv_type.h +3 -0
@@ -248,12 +248,15 @@ typedef struct _NVRec {/* Various pinned memory regions */ struct nouveau_bo *FB ; +struct nouveau_bo * scanout;//struct nouveau_bo * FB_old; /* for KMS */ struct nouveau_bo * shadow[2 ];/* for easy acces by exa */ struct nouveau_bo * Cursor;struct nouveau_bo * Cursor2;struct nouveau_bo *GART ; +DamagePtr screen_damage;/* for NV50+ */ +struct nouveau_bios VBIOS ;Bool NoAccel;Bool HWCursor;
Signature · 1 line
1.6.1.2
A message that is not in the archive (sent off-list or not yet received): 1234479392-1984-2-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 3/3 nv50: support frontbuffer fallbacks
--- src/nouveau_exa.c | 36 +++++++++++++++ src/nv50_shadow_damage.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++ src/nv_proto.h | 1 + 3 files changed, 145 insertions(+), 0 deletions(-)
src/nouveau_exa.c +36 -0
@@ -308,6 +308,36 @@ nouveau_exa_pixmap_unmap(PixmapPtr ppix) }static Bool +nouveau_exa_prepare_access (PixmapPtr ppix,int index) +{ +ScreenPtr pScreen = ppix->drawable.pScreen; +NVPtr pNv =NVPTR (xf86Screens[pScreen->myNum]); + +if (ppix == pScreen->GetScreenPixmap (pScreen)) { +nouveau_bo_map (pNv->scanout,NOUVEAU_BO_RDWR ); + ppix->devPrivate.ptr = pNv->scanout->map; + }else if (nouveau_exa_pixmap_is_tiled (ppix)) { +return false;/* force migration */ + } + +return true; +} + +static void +nouveau_exa_finish_access (PixmapPtr ppix,int index) +{ +ScreenPtr pScreen = ppix->drawable.pScreen; +ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; +NVPtr pNv =NVPTR (pScrn); + +if (ppix == pScreen->GetScreenPixmap (pScreen)) { + ppix->devPrivate.ptr =NULL ; +nouveau_bo_unmap (pNv->scanout); +nv50_shadow_damage_frontbuffer_fallback (pScrn); + } +} + +static Bool nouveau_exa_download_from_screen (PixmapPtr pspix,int x,int y,int w,int h,char *dst,int dst_pitch) {
@@ -447,6 +477,12 @@ nouveau_exa_init(ScreenPtr pScreen) exa->maxY =2048 ; } +/* Needed for frontbuffer fallbacks (to ensure it accesses the linear fb). */ +if (pNv->Architecture >=NV_ARCH_50 ) { + exa->PrepareAccess = nouveau_exa_prepare_access; + exa->FinishAccess = nouveau_exa_finish_access; + } + exa->MarkSync = nouveau_exa_mark_sync; exa->WaitMarker = nouveau_exa_wait_marker;
src/nv50_shadow_damage.c +108 -0
126 lines not on this page · raw message
src/nv_proto.h +1 -0
@@ -278,6 +278,7 @@ int nv50_xv_port_attribute_get(ScrnInfoPtr, Atom, INT32 *, pointer);/* nv50_shadow_damage.c */ bool nv50_shadow_damage_create (ScrnInfoPtr pScrn); +void nv50_shadow_damage_frontbuffer_fallback (ScrnInfoPtr pScrn);/* To support EXA 2.0, 2.1 has this in the header */ #ifndef exaMoveInPixmap
Signature · 1 line
1.6.1.2
A message that is not in the archive (sent off-list or not yet received): 1234479392-1984-3-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 3/3] nv50: support frontbuffer fallbacks
Quoted 1 line · Maarten Maathuis
[snip]
I can't tell you about the technical quality of this patch but it made my day.
When I saw "frontbuffer" I thought about my bug #20066 and applied your three patches in another branch. Gnome-terminal is now fast as expected, with the nouveau module loaded.
It will be fine enough for me now. I'll report if it crashes.
Notice that the second patch contains white space.
Hervé
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 3/3] nv50: support frontbuffer fallbacks
These patches are workarounds, and therefore will not be applied to git.
I made them out of curiosity.
Maarten.
Quoted 20 lines · Hervé Cauwelier
Quoted 1 line · Maarten Maathuis
[snip]
I can't tell you about the technical quality of this patch but it made my day.
When I saw "frontbuffer" I thought about my bug #20066 and applied your three patches in another branch. Gnome-terminal is now fast as expected, with the nouveau module loaded.
It will be fine enough for me now. I'll report if it crashes.
Notice that the second patch contains white space.
Hervé
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [PATCH 2/3] nv50: initial bits for "shadowfb"
In reply to a message not in the archiveQuoted 2 lines · Maarten Maathuis
- Fallbacks on the frontbuffer still need to be handled.
---
Why are you posting this again ? It's not really better than the last time, still a lousy workaround.
Stephane
A message that is not in the archive (sent off-list or not yet received): 6a89f9d50902121511w2b20af44m48b9c48d2fc97175-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 2/3] nv50: initial bits for "shadowfb"
Quoted 9 lines · Stephane Marchesin
Quoted 2 lines · Maarten Maathuis
- Fallbacks on the frontbuffer still need to be handled.
---Why are you posting this again ? It's not really better than the last time, still a lousy workaround.
Stephane
It's at least correct rendering wise (the last one obviously wasn't). I was curious about how difficult the implementation would be. I wanted to put the issue on the table. The hw "fix" is out my reach, but if anyone wants to give it a shot then be my guest. These patches are also serve the bridge the gap between now and the moment exa wfb support becomes reasonable widespread, regardless of hw issues.
Maarten.