summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@neko.keithp.com>2006-06-19 13:47:28 -0700
committerKeith Packard <keithp@neko.keithp.com>2006-06-19 13:47:28 -0700
commit8a6edba33213911cc2210b5e903428b81d45862f (patch)
treecf1ff10a7d2ca15319a286ef932dad91dc594acf
parenta73ab7f0e6e3b0462e05c0031ffd602ed3e2bcd4 (diff)
Set vblank interrupt configuration to match pipe configuration
New i915 drm ioctl (in version 1.5) allows the X server to select which pipe drives vblank interrupts. Use this to drive from the 'preferred' pipe. Yes, per-window vblanks would be nice in a shared fb environment. Maybe someday. (cherry picked from 2fb375b665f4802819b89f2277fd6154006c11ee commit)
-rw-r--r--src/i830.h1
-rw-r--r--src/i830_common.h9
-rw-r--r--src/i830_dri.c25
-rw-r--r--src/i830_driver.c6
4 files changed, 41 insertions, 0 deletions
diff --git a/src/i830.h b/src/i830.h
index 4fa33285..4fc39878 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -427,6 +427,7 @@ extern void I830DRIUnmapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea);
extern Bool I830DRIMapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea);
extern void I830DRIUnlock(ScrnInfoPtr pScrn);
extern Bool I830DRILock(ScrnInfoPtr pScrn);
+extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on);
#endif
extern Bool I830AccelInit(ScreenPtr pScreen);
diff --git a/src/i830_common.h b/src/i830_common.h
index 41b5cc3c..a27bc011 100644
--- a/src/i830_common.h
+++ b/src/i830_common.h
@@ -52,6 +52,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DRM_I830_INIT_HEAP 0x0a
#define DRM_I830_CMDBUFFER 0x0b
#define DRM_I830_DESTROY_HEAP 0x0c
+#define DRM_I830_SET_VBLANK_PIPE 0x0d
+#define DRM_I830_GET_VBLANK_PIPE 0x0e
+
typedef struct {
enum {
@@ -193,5 +196,11 @@ typedef struct {
int region;
} drmI830MemDestroyHeap;
+#define DRM_I830_VBLANK_PIPE_A 1
+#define DRM_I830_VBLANK_PIPE_B 2
+
+typedef struct {
+ int pipe;
+} drmI830VBlankPipe;
#endif /* _I830_DRM_H_ */
diff --git a/src/i830_dri.c b/src/i830_dri.c
index ed5e6851..7c65f656 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1454,6 +1454,31 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
}
Bool
+I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+ drmI830VBlankPipe pipe;
+
+ if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) {
+ if (on) {
+ if (pI830->planeEnabled[1])
+ pipe.pipe = DRM_I830_VBLANK_PIPE_B;
+ else
+ pipe.pipe = DRM_I830_VBLANK_PIPE_A;
+ } else {
+ pipe.pipe = 0;
+ }
+ if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE,
+ &pipe, sizeof (pipe))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Vblank Pipe Setup Failed\n");
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
I830DRILock(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index a4b891b6..907b2042 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3826,6 +3826,9 @@ RestoreHWState(ScrnInfoPtr pScrn)
DPRINTF(PFX, "RestoreHWState\n");
+#ifdef XF86DRI
+ I830DRISetVBlankInterrupt (pScrn, FALSE);
+#endif
if (I830IsPrimary(pScrn) && pI830->pipe != pI830->origPipe)
SetBIOSPipe(pScrn, pI830->origPipe);
else
@@ -4411,6 +4414,9 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
#endif
#ifdef XF86DRI
+ I830DRISetVBlankInterrupt (pScrn, TRUE);
+#endif
+#ifdef XF86DRI
if (didLock)
I830DRIUnlock(pScrn);
#endif