[PATCH] Add Option "TearFree" v3

2015-04-21 Thread Michel Dänzer
From: Michel Dänzer 

Avoids tearing by flipping between two scanout BOs per (non-rotated) CRTC

v2:
* Fix condition for TearFree log message (Richard Wilbur)
* Log warning message about DRI page flipping being enabled because of
  TearFree (or ShadowPrimary) also when building without glamor support

v3:
* Only override fb_id/x/y if all scanout pixmaps have been successfully
  allocated

Signed-off-by: Michel Dänzer 
---
 man/radeon.man|   7 +++
 src/drmmode_display.c |  79 +++-
 src/drmmode_display.h |   5 +-
 src/radeon.h  |   2 +
 src/radeon_kms.c  | 142 +-
 5 files changed, 162 insertions(+), 73 deletions(-)

diff --git a/man/radeon.man b/man/radeon.man
index 2703773..f0a6be1 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -276,6 +276,13 @@ Enable DRI2 page flipping.  The default is
 .B on.
 Pageflipping is supported on all radeon hardware.
 .TP
+.BI "Option \*qTearFree\*q \*q" boolean \*q
+Enable tearing prevention using the hardware page flipping mechanism. This
+option currently doesn't have any effect for rotated CRTCs. It requires
+allocating two separate scanout buffers for each non-rotated CRTC. Enabling
+this option currently disables Option \*qEnablePageFlip\*q. The default is
+.B off.
+.TP
 .BI "Option \*qAccelMethod\*q \*q" "string" \*q
 Chooses between available acceleration architectures.  Valid values are
 .B EXA
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1f22869..21a5937 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -488,6 +488,10 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
scanout->bo = NULL;
}
 
+   if (scanout->damage) {
+   DamageDestroy(scanout->damage);
+   scanout->damage = NULL;
+   }
 }
 
 void
@@ -501,12 +505,9 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
xf86_config->crtc[c]->driver_private;
 
drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
-&drmmode_crtc->scanout);
-
-   if (drmmode_crtc->scanout_damage) {
-   DamageDestroy(drmmode_crtc->scanout_damage);
-   drmmode_crtc->scanout_damage = NULL;
-   }
+&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+&drmmode_crtc->scanout[1]);
}
 }
 
@@ -704,43 +705,51 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr 
mode,
x = drmmode_crtc->prime_pixmap_x;
y = 0;
 
-   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[1]);
} else
 #endif
if (drmmode_crtc->rotate.fb_id) {
fb_id = drmmode_crtc->rotate.fb_id;
x = y = 0;
 
-   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout);
-   } else if (info->shadow_primary) {
-   drmmode_crtc_scanout_create(crtc,
-   &drmmode_crtc->scanout,
-   NULL, mode->HDisplay,
-   mode->VDisplay);
-
-   if (drmmode_crtc->scanout.pixmap) {
-   RegionPtr pRegion;
-   BoxPtr pBox;
-
-   if (!drmmode_crtc->scanout_damage) {
-   drmmode_crtc->scanout_damage =
-   
DamageCreate(radeon_screen_damage_report,
-NULL, 
DamageReportRawRegion,
-TRUE, pScreen, 
NULL);
-   
DamageRegister(&pScreen->GetScreenPixmap(pScreen)->drawable,
-  
drmmode_crtc->scanout_damage);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[1]);
+   } else if (info->tear_free || info->shadow_primary) {
+   for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
+   drmmode_crtc_scanout_create(crtc,
+   
&drmmode_crtc->scanout[i],
+   NULL, 
mode->HDisplay,
+   mode->VDisplay);
+
+  

[PATCH 4/5] Update scanout pixmap contents before setting a mode with it

2015-04-21 Thread Michel Dänzer
From: Michel Dänzer 

This ensures the scanout pixmaps used for Option "TearFree" and Option
"ShadowPrimary" have been initialized when their initial mode is set.

Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.c | 2 ++
 src/radeon.h  | 4 
 src/radeon_kms.c  | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 064a64c..8caad70 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -718,6 +718,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr 
mode,
drmmode_crtc->scanout_id = 0;
fb_id = drmmode_crtc->scanout[0].fb_id;
x = y = 0;
+
+   radeon_scanout_update_handler(pScrn, 0, 0, 
crtc);
}
}
ret = drmModeSetCrtc(drmmode->fd, 
drmmode_crtc->mode_crtc->crtc_id,
diff --git a/src/radeon.h b/src/radeon.h
index 962a68d..8220da7 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -593,6 +593,10 @@ extern Bool RADEONGetPixmapOffsetPitch(PixmapPtr pPix,
 /* radeon_dri3.c */
 Bool radeon_dri3_screen_init(ScreenPtr screen);
 
+/* radeon_kms.c */
+void radeon_scanout_update_handler(ScrnInfoPtr scrn, uint32_t frame,
+  uint64_t usec, void *event_data);
+
 /* radeon_present.c */
 Bool radeon_present_screen_init(ScreenPtr screen);
 
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index eda3f33..082c5b6 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -385,7 +385,7 @@ radeon_scanout_update_abort(ScrnInfoPtr scrn, void 
*event_data)
 drmmode_crtc->scanout_update_pending = FALSE;
 }
 
-static void
+void
 radeon_scanout_update_handler(ScrnInfoPtr scrn, uint32_t frame, uint64_t usec,
  void *event_data)
 {
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH 5/5] Make drmmode_copy_fb() work with glamor as well

2015-04-21 Thread Michel Dänzer
From: Michel Dänzer 

Needed for Xorg -background none.

Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.c | 49 ++---
 src/radeon.h  |  1 +
 src/radeon_kms.c  |  7 +--
 3 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8caad70..326d863 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -348,11 +348,15 @@ static PixmapPtr
 create_pixmap_for_fbcon(drmmode_ptr drmmode,
ScrnInfoPtr pScrn, int fbcon_id)
 {
-   PixmapPtr pixmap = NULL;
+   RADEONInfoPtr info = RADEONPTR(pScrn);
+   PixmapPtr pixmap = info->fbcon_pixmap;
struct radeon_bo *bo;
drmModeFBPtr fbcon;
struct drm_gem_flink flink;
 
+   if (pixmap)
+   return pixmap;
+
fbcon = drmModeGetFB(drmmode->fd, fbcon_id);
if (fbcon == NULL)
return NULL;
@@ -379,12 +383,30 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height,
  fbcon->depth, fbcon->bpp,
  fbcon->pitch, 0, bo, NULL);
+   info->fbcon_pixmap = pixmap;
radeon_bo_unref(bo);
 out_free_fb:
drmModeFreeFB(fbcon);
return pixmap;
 }
 
+static void
+destroy_pixmap_for_fbcon(ScrnInfoPtr pScrn)
+{
+   RADEONInfoPtr info = RADEONPTR(pScrn);
+
+   /* XXX: The current GPUVM support in the kernel doesn't allow removing
+* the virtual address range for this BO, so we need to keep around
+* the pixmap to avoid breaking glamor with GPUVM
+*/
+   if (info->use_glamor && info->ChipFamily >= CHIP_FAMILY_CAYMAN)
+   return;
+
+   if (info->fbcon_pixmap)
+   pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap);
+   info->fbcon_pixmap = NULL;
+}
+
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
 
 void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
@@ -394,8 +416,9 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
PixmapPtr src, dst;
ScreenPtr pScreen = pScrn->pScreen;
int fbcon_id = 0;
+   Bool force;
+   GCPtr gc;
int i;
-   Bool ret;
 
for (i = 0; i < xf86_config->num_crtc; i++) {
drmmode_crtc_private_ptr drmmode_crtc = 
xf86_config->crtc[i]->driver_private;
@@ -421,18 +444,22 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr 
drmmode)
return;
 
dst = pScreen->GetScreenPixmap(pScreen);
-   ret = info->accel_state->exa->PrepareCopy (src, dst,
-  -1, -1, GXcopy, FB_ALLONES);
-   if (!ret)
- goto out_free_src;
-   info->accel_state->exa->Copy (dst, 0, 0, 0, 0,
- pScrn->virtualX, pScrn->virtualY);
-   info->accel_state->exa->DoneCopy (dst);
+
+   gc = GetScratchGC(pScrn->depth, pScreen);
+   ValidateGC(&dst->drawable, gc);
+
+   force = info->accel_state->force;
+   info->accel_state->force = TRUE;
+   (*gc->ops->CopyArea)(&src->drawable, &dst->drawable, gc, 0, 0,
+pScrn->virtualX, pScrn->virtualY, 0, 0);
+   info->accel_state->force = force;
+
+   FreeScratchGC(gc);
+
radeon_cs_flush_indirect(pScrn);
 
pScreen->canDoBGNoneRoot = TRUE;
- out_free_src:
-   drmmode_destroy_bo_pixmap(src);
+   destroy_pixmap_for_fbcon(pScrn);
return;
 }
 
diff --git a/src/radeon.h b/src/radeon.h
index 8220da7..cd03d53 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -475,6 +475,7 @@ typedef struct {
 uint_fast32_t gpu_flushed;
 uint_fast32_t gpu_synced;
 struct radeon_accel_state *accel_state;
+PixmapPtr fbcon_pixmap;
 Bool  accelOn;
 Bool  use_glamor;
 Bool  shadow_primary;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 082c5b6..fa40776 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -186,6 +186,9 @@ static void RADEONFreeRec(ScrnInfoPtr pScrn)
 
 info = RADEONPTR(pScrn);
 
+if (info->fbcon_pixmap)
+   pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap);
+
 if (info->dri2.drm_fd > 0) {
 DevUnion *pPriv;
 RADEONEntPtr pRADEONEnt;
@@ -1706,7 +1709,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 pScrn->pScreen = pScreen;
 
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
-if (bgNoneRoot && info->accelOn && !info->use_glamor) {
+if (bgNoneRoot && info->accelOn) {
info->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = RADEONCreateWindow;
 }
@@ -1772,7 +1775,7 @@ Bool RADEONEnterVT_KMS(VT_FUNC_ARGS_DECL)
 pScrn->vtSema = TRUE;
 
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
-if (bgNoneRoot && info->accelOn && !info->use_glamor)
+if (bgNoneRoot && info->accelOn)
  

[PATCH 1/5] Only copy fbcon BO contents if bgNoneRoot is TRUE

2015-04-21 Thread Michel Dänzer
From: Michel Dänzer 

Otherwise, the X server will initialize the screen pixmap contents
anyway.

Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.c | 27 +++
 src/drmmode_display.h |  2 ++
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 21a5937..edeba47 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -385,6 +385,8 @@ out_free_fb:
return pixmap;
 }
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+
 void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 {
xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -397,9 +399,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
uint32_t tiling_flags = 0;
Bool ret;
 
-   if (info->accelOn == FALSE || info->use_glamor)
-   goto fallback;
-
for (i = 0; i < xf86_config->num_crtc; i++) {
drmmode_crtc_private_ptr drmmode_crtc = 
xf86_config->crtc[i]->driver_private;
 
@@ -408,7 +407,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
}
 
if (!fbcon_id)
-   goto fallback;
+   return;
 
if (fbcon_id == drmmode->fb_id) {
/* in some rare case there might be no fbcon and we might 
already
@@ -421,7 +420,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 
src = create_pixmap_for_fbcon(drmmode, pScrn, fbcon_id);
if (!src)
-   goto fallback;
+   return;
 
if (info->allowColorTiling) {
if (info->ChipFamily >= CHIP_FAMILY_R600) {
@@ -454,23 +453,15 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr 
drmmode)
info->accel_state->exa->DoneCopy (dst);
radeon_cs_flush_indirect(pScrn);
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
pScreen->canDoBGNoneRoot = TRUE;
-#endif
drmmode_destroy_bo_pixmap(dst);
  out_free_src:
drmmode_destroy_bo_pixmap(src);
return;
-
-fallback:
-   /* map and memset the bo */
-   if (radeon_bo_map(info->front_bo, 1))
-   return;
-
-   memset(info->front_bo->ptr, 0x00, info->front_bo->size);
-   radeon_bo_unmap(info->front_bo);
 }
 
+#endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 */
+
 static void
 drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
 struct drmmode_scanout *scanout)
@@ -2122,8 +2113,12 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, 
drmmode_ptr drmmode)
 {
xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+   RADEONInfoPtr info = RADEONPTR(pScrn);
 
-   drmmode_copy_fb(pScrn, drmmode);
+   if (bgNoneRoot && info->accelOn && !info->use_glamor)
+   drmmode_copy_fb(pScrn, drmmode);
+#endif
 
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 1908b46..49b02d6 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -127,7 +127,9 @@ extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, 
drmmode_ptr drmmode, struct ra
 extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, 
struct radeon_bo *bo);
 void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int 
y);
 extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
 extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+#endif
 extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
 
 extern void drmmode_scanout_free(ScrnInfoPtr scrn);
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH 3/5] Defer initial modeset until the first BlockHandler invocation

2015-04-21 Thread Michel Dänzer
From: Michel Dänzer 

This ensures that the screen pixmap contents have been initialized when
the initial modes are set.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27757
Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.c | 44 ++--
 src/drmmode_display.h |  3 ++-
 src/radeon_kms.c  | 17 ++---
 3 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 76b2577..064a64c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -395,8 +395,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
ScreenPtr pScreen = pScrn->pScreen;
int fbcon_id = 0;
int i;
-   int pitch;
-   uint32_t tiling_flags = 0;
Bool ret;
 
for (i = 0; i < xf86_config->num_crtc; i++) {
@@ -422,28 +420,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr 
drmmode)
if (!src)
return;
 
-   if (info->allowColorTiling) {
-   if (info->ChipFamily >= CHIP_FAMILY_R600) {
-   if (info->allowColorTiling2D) {
-   tiling_flags |= RADEON_TILING_MACRO;
-   } else {
-   tiling_flags |= RADEON_TILING_MICRO;
-   }
-   } else
-   tiling_flags |= RADEON_TILING_MACRO;
-   }
-
-   pitch = RADEON_ALIGN(pScrn->displayWidth,
-drmmode_get_pitch_align(pScrn, info->pixel_bytes, 
tiling_flags)) *
-   info->pixel_bytes;
-
-   dst = drmmode_create_bo_pixmap(pScrn, pScrn->virtualX,
-  pScrn->virtualY, pScrn->depth,
-  pScrn->bitsPerPixel, pitch,
-  tiling_flags, info->front_bo, 
&info->front_surface);
-   if (!dst)
-   goto out_free_src;
-
+   dst = pScreen->GetScreenPixmap(pScreen);
ret = info->accel_state->exa->PrepareCopy (src, dst,
   -1, -1, GXcopy, FB_ALLONES);
if (!ret)
@@ -454,7 +431,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
radeon_cs_flush_indirect(pScrn);
 
pScreen->canDoBGNoneRoot = TRUE;
-   drmmode_destroy_bo_pixmap(dst);
  out_free_src:
drmmode_destroy_bo_pixmap(src);
return;
@@ -2109,7 +2085,8 @@ void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr 
drmmode, int x, int y)
}
 }
 
-Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
+  Bool set_hw)
 {
xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
@@ -2121,7 +2098,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, 
drmmode_ptr drmmode)
int o;
 
/* Skip disabled CRTCs */
-   if (!crtc->enabled) {
+   if (set_hw && !crtc->enabled) {
drmmode_do_crtc_dpms(crtc, DPMSModeOff);
drmModeSetCrtc(drmmode->fd, 
drmmode_crtc->mode_crtc->crtc_id,
   0, 0, 0, NULL, 0, NULL);
@@ -2157,9 +2134,16 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, 
drmmode_ptr drmmode)
crtc->desiredY = 0;
}
 
-   if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, 
crtc->desiredRotation,
-crtc->desiredX, 
crtc->desiredY))
-   return FALSE;
+   if (set_hw) {
+   if (!crtc->funcs->set_mode_major(crtc, 
&crtc->desiredMode, crtc->desiredRotation,
+crtc->desiredX, 
crtc->desiredY))
+   return FALSE;
+   } else {
+   crtc->mode = crtc->desiredMode;
+   crtc->rotation = crtc->desiredRotation;
+   crtc->x = crtc->desiredX;
+   crtc->y = crtc->desiredY;
+   }
}
return TRUE;
 }
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 49b02d6..2fdd3e0 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -126,7 +126,8 @@ extern void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr 
drmmode);
 extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct 
radeon_bo_manager *bufmgr);
 extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, 
struct radeon_bo *bo);
 void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int 
y);
-extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
+ Bool set_h

[PATCH 0/5] Smoother startup

2015-04-21 Thread Michel Dänzer
These patches make the Xorg startup smoother in two ways:

* Make sure the contents of the buffers being scanned out have been
  initialized when the initial modes are set

* Make the "-background none" command line option work as intended with
  glamor as well

The patches apply on top of the 'Add Option "TearFree"' patch and are
also available on the master branch of
git://people.freedesktop.org/~daenzer/xf86-video-ati .

[PATCH 1/5] Only copy fbcon BO contents if bgNoneRoot is TRUE
[PATCH 2/5] Defer initial drmmode_copy_fb call until root window
[PATCH 3/5] Defer initial modeset until the first BlockHandler
[PATCH 4/5] Update scanout pixmap contents before setting a mode with
[PATCH 5/5] Make drmmode_copy_fb() work with glamor as well
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH 2/5] Defer initial drmmode_copy_fb call until root window creation

2015-04-21 Thread Michel Dänzer
From: Michel Dänzer 

That's late enough for acceleration to be fully initialized, but still
early enough to set pScreen->canDoBGNoneRoot.

Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.c |  6 --
 src/radeon.h  |  3 +++
 src/radeon_kms.c  | 40 
 3 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index edeba47..76b2577 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2113,12 +2113,6 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, 
drmmode_ptr drmmode)
 {
xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
-   RADEONInfoPtr info = RADEONPTR(pScrn);
-
-   if (bgNoneRoot && info->accelOn && !info->use_glamor)
-   drmmode_copy_fb(pScrn, drmmode);
-#endif
 
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
diff --git a/src/radeon.h b/src/radeon.h
index 1c794ce..962a68d 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -493,6 +493,9 @@ typedef struct {
 DisplayModePtr currentMode;
 
 CreateScreenResourcesProcPtr CreateScreenResources;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+CreateWindowProcPtr CreateWindow;
+#endif
 
 Bool  IsSecondary;
 Bool  IsPrimary;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index a85e890..2a84ff6 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1012,6 +1012,34 @@ static void RADEONSetupCapabilities(ScrnInfoPtr pScrn)
 #endif
 }
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+
+/* When the root window is created, initialize the screen contents from
+ * console if -background none was specified on the command line
+ */
+static Bool RADEONCreateWindow(WindowPtr pWin)
+{
+ScreenPtr pScreen = pWin->drawable.pScreen;
+ScrnInfoPtr pScrn;
+RADEONInfoPtr info;
+Bool ret;
+
+if (pWin != pScreen->root)
+   ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+pScrn = xf86ScreenToScrn(pScreen);
+info = RADEONPTR(pScrn);
+pScreen->CreateWindow = info->CreateWindow;
+ret = pScreen->CreateWindow(pWin);
+
+if (ret)
+   drmmode_copy_fb(pScrn, &info->drmmode);
+
+return ret;
+}
+
+#endif
+
 Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
 RADEONInfoPtr info;
@@ -1666,6 +1694,13 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 }
 pScrn->pScreen = pScreen;
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+if (bgNoneRoot && info->accelOn && !info->use_glamor) {
+   info->CreateWindow = pScreen->CreateWindow;
+   pScreen->CreateWindow = RADEONCreateWindow;
+}
+#endif
+
 /* Provide SaveScreen & wrap BlockHandler and CloseScreen */
 /* Wrap CloseScreen */
 info->CloseScreen= pScreen->CloseScreen;
@@ -1725,6 +1760,11 @@ Bool RADEONEnterVT_KMS(VT_FUNC_ARGS_DECL)
 
 pScrn->vtSema = TRUE;
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+if (bgNoneRoot && info->accelOn && !info->use_glamor)
+   drmmode_copy_fb(pScrn, &info->drmmode);
+#endif
+
 if (!drmmode_set_desired_modes(pScrn, &info->drmmode))
return FALSE;
 
-- 
2.1.4

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 89505] Oculus Rift DK2 on radeon modesetting not lighting up

2015-04-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89505

--- Comment #11 from Asbjørn Sannes  ---
First reverified that it did not work with plain 4.0.0 vanilla kernel.
Tested with 4.0.0 + updated.patch and it works.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 90072] Xorg crashes when Alt-Tabbing on DRI3 and Gallium Nine

2015-04-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90072

--- Comment #2 from sarnex  ---
Hi guys,

Just to note, Xorg does not crash, nor do I get Wine errors if I enable
TearFree in my xorg.conf.

Hope this helps,
sarnex

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati