<div dir="ltr">I've also pushed a branch with my patches on top of Ken's new present patches here:<br><br><a href="http://cgit.freedesktop.org/~jekstrand/xserver/log/?h=wip/modeset-shadow">http://cgit.freedesktop.org/~jekstrand/xserver/log/?h=wip/modeset-shadow</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 19, 2014 at 2:12 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">This way all of the buffer allocation/destruction is in the same file.<br>
<br>
Signed-off-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
---<br>
hw/xfree86/drivers/modesetting/driver.c | 16 +---------------<br>
hw/xfree86/drivers/modesetting/drmmode_display.c | 19 ++++++++++++++++++-<br>
hw/xfree86/drivers/modesetting/drmmode_display.h | 2 +-<br>
3 files changed, 20 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c<br>
index 5dda96b..77da2cc 100644<br>
--- a/hw/xfree86/drivers/modesetting/driver.c<br>
+++ b/hw/xfree86/drivers/modesetting/driver.c<br>
@@ -993,15 +993,6 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)<br>
if (!drmmode_create_initial_bos(pScrn, &ms->drmmode))<br>
return FALSE;<br>
<br>
- if (ms->drmmode.shadow_enable) {<br>
- ms->drmmode.shadow_fb =<br>
- calloc(1,<br>
- pScrn->displayWidth * pScrn->virtualY *<br>
- ((pScrn->bitsPerPixel + 7) >> 3));<br>
- if (!ms->drmmode.shadow_fb)<br>
- ms->drmmode.shadow_enable = FALSE;<br>
- }<br>
-<br>
miClearVisualTypes();<br>
<br>
if (!miSetVisualTypes(pScrn->depth,<br>
@@ -1200,14 +1191,9 @@ CloseScreen(ScreenPtr pScreen)<br>
ms->damage = NULL;<br>
}<br>
<br>
- if (ms->drmmode.shadow_enable) {<br>
- shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));<br>
- free(ms->drmmode.shadow_fb);<br>
- ms->drmmode.shadow_fb = NULL;<br>
- }<br>
drmmode_uevent_fini(pScrn, &ms->drmmode);<br>
<br>
- drmmode_free_bos(pScrn, &ms->drmmode);<br>
+ drmmode_free_bos(pScreen, &ms->drmmode);<br>
<br>
if (pScrn->vtSema) {<br>
LeaveVT(pScrn);<br>
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c<br>
index 824500b..30ee79d 100644<br>
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c<br>
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c<br>
@@ -39,6 +39,7 @@<br>
#include "micmap.h"<br>
#include "xf86cmap.h"<br>
#include "xf86DDC.h"<br>
+#include "shadow.h"<br>
<br>
#include <xf86drm.h><br>
#include "xf86Crtc.h"<br>
@@ -1539,6 +1540,15 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)<br>
return FALSE;<br>
pScrn->displayWidth = drmmode_bo_get_pitch(&drmmode->front_bo) / cpp;<br>
<br>
+ if (drmmode->shadow_enable) {<br>
+ drmmode->shadow_fb =<br>
+ calloc(1,<br>
+ pScrn->displayWidth * pScrn->virtualY *<br>
+ ((pScrn->bitsPerPixel + 7) >> 3));<br>
+ if (!drmmode->shadow_fb)<br>
+ drmmode->shadow_enable = FALSE;<br>
+ }<br>
+<br>
width = ms->cursor_width;<br>
height = ms->cursor_height;<br>
bpp = 32;<br>
@@ -1601,8 +1611,9 @@ drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)<br>
}<br>
<br>
void<br>
-drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)<br>
+drmmode_free_bos(ScreenPtr pScreen, drmmode_ptr drmmode)<br>
{<br>
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);<br>
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);<br>
int i;<br>
<br>
@@ -1611,6 +1622,12 @@ drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)<br>
drmmode->fb_id = 0;<br>
}<br>
<br>
+ if (drmmode->shadow_enable) {<br>
+ shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));<br>
+ free(drmmode->shadow_fb);<br>
+ drmmode->shadow_fb = NULL;<br>
+ }<br>
+<br>
drmmode_bo_destroy(drmmode, &drmmode->front_bo);<br>
<br>
for (i = 0; i < xf86_config->num_crtc; i++) {<br>
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h<br>
index 66d0ca2..c67809b 100644<br>
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h<br>
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h<br>
@@ -155,7 +155,7 @@ extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);<br>
Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);<br>
void *drmmode_map_front_bo(drmmode_ptr drmmode);<br>
Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);<br>
-void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);<br>
+void drmmode_free_bos(ScreenPtr pScreen, drmmode_ptr drmmode);<br>
void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode,<br>
int *depth, int *bpp);<br>
<br>
--<br>
2.2.0<br>
<br>
</div></div></blockquote></div></div>