summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2007-02-16 00:57:44 -0800
committerKeith Packard <keithp@guitar.keithp.com>2007-02-16 00:57:44 -0800
commit20e146a09e3b4907a6800588ebfa787bfc5b0d89 (patch)
tree58f957dbefa6bd74c100a222825e5b8c67464d08 /src
parent17e38e39a49b2a96e31cca4a0b922631c5f7879e (diff)
Change rotation pixmap creation API to permit start-time rotation.
Start time rotation requires that the pixmap be created after the server has initialized the screens. Delay the pixmap creation until the first block handler invocation.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/i830.h4
-rw-r--r--src/i830_crt.c2
-rw-r--r--src/i830_display.c68
-rw-r--r--src/i830_driver.c48
-rw-r--r--src/i830_modes.c2
6 files changed, 74 insertions, 54 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3f680c71..f656270a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,11 +25,9 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ -Iparser -Imodes \
-DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DXF86_MODES_RENAME
-AM_INCLUDES=-Iparser -Imodes
-
intel_drv_la_LTLIBRARIES = intel_drv.la
intel_drv_la_LDFLAGS = -module -avoid-version
intel_drv_ladir = @moduledir@/drivers
diff --git a/src/i830.h b/src/i830.h
index 26d16e92..f52f1496 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -58,8 +58,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86int10.h"
#include "vbe.h"
#include "vgaHW.h"
-#include "i830_xf86Crtc.h"
-#include "i830_xf86RandR12.h"
+#include "xf86Crtc.h"
+#include "xf86RandR12.h"
#ifdef XF86DRI
#include "xf86drm.h"
diff --git a/src/i830_crt.c b/src/i830_crt.c
index 573e6526..77061653 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -31,7 +31,7 @@
#include "xf86.h"
#include "i830.h"
-#include "i830_xf86Modes.h"
+#include "xf86Modes.h"
#include "i830_display.h"
static void
diff --git a/src/i830_display.c b/src/i830_display.c
index f44a8bf3..e7a5605e 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -41,7 +41,7 @@
#include "i830_bios.h"
#include "i830_display.h"
#include "i830_debug.h"
-#include "i830_xf86Modes.h"
+#include "xf86Modes.h"
typedef struct {
/* given values */
@@ -342,9 +342,8 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE);
int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
- if (crtc->rotatedPixmap != NULL) {
- Start = (char *)crtc->rotatedPixmap->devPrivate.ptr -
- (char *)pI830->FbBase;
+ if (crtc->rotatedData != NULL) {
+ Start = (char *)crtc->rotatedData - (char *)pI830->FbBase;
} else if (I830IsPrimary(pScrn)) {
Start = pI830->FrontBuffer.Start;
} else {
@@ -931,21 +930,18 @@ i830_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
}
/**
- * Creates a locked-in-framebuffer pixmap of the given width and height for
- * this CRTC's rotated shadow framebuffer.
- *
- * The current implementation uses fixed buffers allocated at startup at the
- * maximal size.
+ * Allocates memory for a locked-in-framebuffer shadow of the given
+ * width and height for this CRTC's rotated shadow framebuffer.
*/
-static PixmapPtr
-i830_crtc_shadow_create(xf86CrtcPtr crtc, int width, int height)
+
+static void *
+i830_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
{
ScrnInfoPtr pScrn = crtc->scrn;
ScreenPtr pScreen = pScrn->pScreen;
I830Ptr pI830 = I830PTR(pScrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
unsigned long rotate_pitch;
- PixmapPtr rotate_pixmap;
unsigned long rotate_offset;
int align = KB(4), size;
@@ -994,12 +990,32 @@ i830_crtc_shadow_create(xf86CrtcPtr crtc, int width, int height)
}
#endif /* I830_USE_XAA */
+ return pI830->FbBase + rotate_offset;
+}
+
+/**
+ * Creates a pixmap for this CRTC's rotated shadow framebuffer.
+ */
+static PixmapPtr
+i830_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ I830Ptr pI830 = I830PTR(pScrn);
+ unsigned long rotate_pitch;
+ PixmapPtr rotate_pixmap;
+
+ if (!data)
+ data = i830_crtc_shadow_allocate (crtc, width, height);
+
+ rotate_pitch = pI830->displayWidth * pI830->cpp;
+
rotate_pixmap = GetScratchPixmapHeader(pScrn->pScreen,
width, height,
pScrn->depth,
pScrn->bitsPerPixel,
rotate_pitch,
- pI830->FbBase + rotate_offset);
+ data);
+
if (rotate_pixmap == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate shadow pixmap for rotated CRTC\n");
@@ -1008,25 +1024,30 @@ i830_crtc_shadow_create(xf86CrtcPtr crtc, int width, int height)
}
static void
-i830_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap)
+i830_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
{
ScrnInfoPtr pScrn = crtc->scrn;
I830Ptr pI830 = I830PTR(pScrn);
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- FreeScratchPixmapHeader(rotate_pixmap);
+ if (rotate_pixmap)
+ FreeScratchPixmapHeader(rotate_pixmap);
+
+ if (data)
+ {
#ifdef I830_USE_EXA
- if (pI830->useEXA && intel_crtc->rotate_mem_exa != NULL) {
- exaOffscreenFree(pScrn->pScreen, intel_crtc->rotate_mem_exa);
- intel_crtc->rotate_mem_exa = NULL;
- }
+ if (pI830->useEXA && intel_crtc->rotate_mem_exa != NULL) {
+ exaOffscreenFree(pScrn->pScreen, intel_crtc->rotate_mem_exa);
+ intel_crtc->rotate_mem_exa = NULL;
+ }
#endif /* I830_USE_EXA */
#ifdef I830_USE_XAA
- if (!pI830->useEXA) {
- xf86FreeOffscreenLinear(intel_crtc->rotate_mem_xaa);
- intel_crtc->rotate_mem_xaa = NULL;
- }
+ if (!pI830->useEXA) {
+ xf86FreeOffscreenLinear(intel_crtc->rotate_mem_xaa);
+ intel_crtc->rotate_mem_xaa = NULL;
+ }
#endif /* I830_USE_XAA */
+ }
}
@@ -1272,6 +1293,7 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = {
.mode_set = i830_crtc_mode_set,
.gamma_set = i830_crtc_gamma_set,
.shadow_create = i830_crtc_shadow_create,
+ .shadow_allocate = i830_crtc_shadow_allocate,
.shadow_destroy = i830_crtc_shadow_destroy,
.destroy = NULL, /* XXX */
};
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 56903e15..e46c0572 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2695,6 +2695,30 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n");
+ if (!pI830->useEXA) {
+ if (I830IsPrimary(pScrn)) {
+ if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to init memory manager\n");
+ }
+
+ if (pI830->LinearAlloc &&
+ xf86InitFBManagerLinear(pScreen,
+ pI830->LinearMem.Offset / pI830->cpp,
+ pI830->LinearMem.Size / pI830->cpp))
+ {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using %ld bytes of offscreen memory for linear "
+ "(offset=0x%lx)\n", pI830->LinearMem.Size,
+ pI830->LinearMem.Offset);
+ }
+ } else {
+ if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to init memory manager\n");
+ }
+ }
+ }
if (!I830EnterVT(scrnIndex, 0))
return FALSE;
@@ -2731,30 +2755,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DPRINTF(PFX,
"assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n");
- if (!pI830->useEXA) {
- if (I830IsPrimary(pScrn)) {
- if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to init memory manager\n");
- }
-
- if (pI830->LinearAlloc &&
- xf86InitFBManagerLinear(pScreen,
- pI830->LinearMem.Offset / pI830->cpp,
- pI830->LinearMem.Size / pI830->cpp))
- {
- xf86DrvMsg(scrnIndex, X_INFO,
- "Using %ld bytes of offscreen memory for linear "
- "(offset=0x%lx)\n", pI830->LinearMem.Size,
- pI830->LinearMem.Offset);
- }
- } else {
- if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to init memory manager\n");
- }
- }
- }
if (!pI830->noAccel) {
if (!I830AccelInit(pScreen)) {
diff --git a/src/i830_modes.c b/src/i830_modes.c
index 405dcc61..06921a50 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -52,7 +52,7 @@
#include "X11/Xatom.h"
#include "i830.h"
#include "i830_display.h"
-#include "i830_xf86Modes.h"
+#include "xf86Modes.h"
#include <randrstr.h>
DisplayModePtr