rpms/xorg-x11-drv-i810/devel intel-modeset.patch, NONE, 1.1 intel-stub.c, 1.1, 1.2 xorg-x11-drv-i810.spec, 1.78, 1.79

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Thu Mar 6 06:51:43 UTC 2008


Author: airlied

Update of /cvs/pkgs/rpms/xorg-x11-drv-i810/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28774

Modified Files:
	intel-stub.c xorg-x11-drv-i810.spec 
Added Files:
	intel-modeset.patch 
Log Message:
* Thu Mar 06 2008 Dave Airlie <airlied at redhat.com> 2.2.1-5
- Bump to include modesetting driver - and make stub auto pick
  batchbuffer branch if modesetting enabled


intel-modeset.patch:

--- NEW FILE intel-modeset.patch ---
diff --git a/configure.ac b/configure.ac
index c9773e6..a3d545e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,6 +202,10 @@ if test "$DRI" = yes; then
 
 	save_CFLAGS="$CFLAGS"
 	CFLAGS="$XORG_CFLAGS $DRI_CFLAGS"
+	AC_CHECK_HEADER(xf86drmMode.h,[DRM_MODE=yes],[DRM_MODE=no],[#include "stdint.h"])
+	if test "x$DRM_MODE" = xyes; then
+		AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting])
+	fi
 	AC_CHECK_TYPE(drm_i915_flip_t,
 		      [AC_DEFINE(HAVE_I915_FLIP, 1,
 			         [Have drm_i915_flip_t and related definitions])],
diff --git a/src/Makefile.am b/src/Makefile.am
index 701d928..441f0ca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -122,8 +122,13 @@ intel_drv_la_SOURCES = \
 	 dri_bufmgr_remap.h \
 	 intel_bufmgr_ttm.c \
          intel_bufmgr_ttm.h \
+	 intel_bufmgr_exa.c \
+         intel_bufmgr_exa.h \
          intel_batchbuffer.c \
-         intel_batchbuffer.h
+         intel_batchbuffer.h \
+	 drmmode_display.c \
+	 drmmode_display.h
+	
 
 INTEL_G4A =				\
 	packed_yuv_sf.g4a		\
diff --git a/src/common.h b/src/common.h
index 2d3b84b..7100b4e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -229,6 +229,9 @@ union intfloat {
    if (I810_DEBUG & DEBUG_VERBOSE_RING)					\
       ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME);
 
+#define ENSURE_LP_RING(n)			\
+   if (RecPtr->LpRing->space < (n) * 4)		\
+      WaitRingFunc(pScrn, (n) * 4, 0);
 
 #define BEGIN_LP_RING(n)						\
 	RING_LOCALS							\
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
new file mode 100644
index 0000000..34cf2e0
--- /dev/null
+++ b/src/drmmode_display.c
@@ -0,0 +1,615 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Dave Airlie <airlied at redhat.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef XF86DRM_MODE
+#include "i830.h"
+
+static Bool
+drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+{
+	scrn->virtualX = width;
+	scrn->virtualY = height;
+	return TRUE;
+}
+
+static void
+drmmode_ConvertFromKMode(ScrnInfoPtr	scrn,
+		     struct drm_mode_modeinfo *kmode,
+		     DisplayModePtr	mode)
+{
+	memset(mode, 0, sizeof(DisplayModeRec));
+	mode->status = MODE_OK;
+	
+	mode->Clock = kmode->clock;
+	
+	mode->HDisplay = kmode->hdisplay;
+	mode->HSyncStart = kmode->hsync_start;
+	mode->HSyncEnd = kmode->hsync_end;
+	mode->HTotal = kmode->htotal;
+	mode->HSkew = kmode->hskew;
+    
+	mode->VDisplay = kmode->vdisplay;
+	mode->VSyncStart = kmode->vsync_start;
+	mode->VSyncEnd = kmode->vsync_end;
+	mode->VTotal = kmode->vtotal;
+	mode->VScan = kmode->vscan;
+
+	mode->Flags = kmode->flags; //& FLAG_BITS;
+	mode->name = strdup(kmode->name);
+
+	if (kmode->type & DRM_MODE_TYPE_DRIVER)
+		mode->type = M_T_DRIVER;
+	if (kmode->type & DRM_MODE_TYPE_PREFERRED)
+		mode->type |= M_T_PREFERRED;
+	xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static void
+drmmode_ConvertToKMode(ScrnInfoPtr	scrn,
+		     struct drm_mode_modeinfo *kmode,
+		     DisplayModePtr	mode)
+{
+	memset(kmode, 0, sizeof(*kmode));
+
+	kmode->clock = mode->Clock;
+	kmode->hdisplay = mode->HDisplay;
+	kmode->hsync_start = mode->HSyncStart;
+	kmode->hsync_end = mode->HSyncEnd;
+	kmode->htotal = mode->HTotal;
+	kmode->hskew = mode->HSkew;
+    
+	kmode->vdisplay = mode->VDisplay;
+	kmode->vsync_start = mode->VSyncStart;
+	kmode->vsync_end = mode->VSyncEnd;
+	kmode->vtotal = mode->VTotal;
+	kmode->vscan = mode->VScan;
+
+	kmode->flags = mode->Flags; //& FLAG_BITS;
+	if (mode->name)
+		strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
+	kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
+
+}
+
+static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
+	drmmode_xf86crtc_resize
+};
+
+static void
+drmmode_crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode)
+{
+
+}
+
+static Bool
+drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+		     Rotation rotation, int x, int y)
+{
+	xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+	drmmode_ptr drmmode = drmmode_crtc->drmmode;
+	int saved_x, saved_y;
+	Rotation saved_rotation;
+	DisplayModeRec saved_mode;
+	uint32_t *output_ids;
+	int output_count = 0;
+	int ret = TRUE;
+	int i;
+	int fb_id;
+	struct drm_mode_modeinfo kmode;
+
+	saved_mode = crtc->mode;
+	saved_x = crtc->x;
+	saved_y = crtc->y;
+	saved_rotation = crtc->rotation;
+
+	crtc->mode = *mode;
+	crtc->x = x;
+	crtc->y = y;
+	crtc->rotation = rotation;
+
+	output_ids = xcalloc(sizeof(uint32_t), xf86_config->num_output);
+	if (!output_ids) {
+		ret = FALSE;
+		goto done;
+	}
+
+	for (i = 0; i < xf86_config->num_output; i++) {
[...3471 lines suppressed...]
diff --git a/src/intel_bufmgr_exa.c b/src/intel_bufmgr_exa.c
new file mode 100644
index 0000000..f4a3590
--- /dev/null
+++ b/src/intel_bufmgr_exa.c
@@ -0,0 +1,167 @@
+/**************************************************************************
+ *
+ * Copyright © 2007-2008 Red Hat Inc.
+ * Copyright © 2007 Intel Corporation
+ * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+/*
+ * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+ *          Keith Whitwell <keithw-at-tungstengraphics-dot-com>
+ *	    Eric Anholt <eric at anholt.net>
+ *	    Dave Airlie <airlied at linux.ie>
+ *	    Kristian Høgsberg <krh at redhat.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <xf86drm.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <assert.h>
+
+#include "xf86.h"
+#include "i830.h"
+#include "errno.h"
+#include "dri_bufmgr.h"
+#include "string.h"
+
+#include "i915_drm.h"
+
+#include "intel_bufmgr_exa.h"
+
+typedef struct _dri_bufmgr_exa {
+    dri_bufmgr bufmgr;
+    ScrnInfoPtr pScrn;
+} dri_bufmgr_exa;
+
+typedef struct _dri_bo_exa {
+    dri_bo bo;
+    i830_memory *memory;
+    int refcount;
+} dri_bo_exa;
+
+static dri_bo *
+dri_exa_alloc(dri_bufmgr *bufmgr, const char *name,
+	      unsigned long size, unsigned int alignment,
+	      uint64_t location_mask)
+{
+    dri_bufmgr_exa *bufmgr_exa = (dri_bufmgr_exa *)bufmgr;
+    I830Ptr pI830 = I830PTR(bufmgr_exa->pScrn);
+    dri_bo_exa *exa_buf;
+
+    exa_buf = malloc(sizeof(*exa_buf));
+    if (!exa_buf)
+	return NULL;
+
+    exa_buf->refcount = 1;
+    exa_buf->memory = i830_allocate_memory(bufmgr_exa->pScrn,
+					   name, size, alignment, 0);
+
+    exa_buf->bo.size = exa_buf->memory->size;
+    exa_buf->bo.offset = exa_buf->memory->offset;
+    exa_buf->bo.bufmgr = bufmgr;
+    exa_buf->bo.virtual = pI830->FbBase + exa_buf->memory->offset;
+
+    return &exa_buf->bo;
+}
+
+static void
+dri_exa_bo_reference(dri_bo *buf)
+{
+    dri_bo_exa *exa_buf = (dri_bo_exa *)buf;
+
+    exa_buf->refcount++;
+}
+
+static void
+dri_exa_bo_unreference(dri_bo *buf)
+{
+    dri_bufmgr_exa *bufmgr_exa = (dri_bufmgr_exa *)buf->bufmgr;
+    dri_bo_exa *exa_buf = (dri_bo_exa *)buf;
+
+    if (!buf)
+	return;
+
+    if (--exa_buf->refcount == 0)
+	i830_free_memory(bufmgr_exa->pScrn, exa_buf->memory);
+}
+
+static int
+dri_exa_bo_map(dri_bo *buf, GLboolean write_enable)
+{
+    return 0;
+}
+
+static int
+dri_exa_bo_unmap(dri_bo *buf)
+{
+    return 0;
+}
+
+static void
+dri_bufmgr_exa_destroy(dri_bufmgr *bufmgr)
+{
+    free(bufmgr);
+}
+
+static void
+dri_exa_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
+		   GLuint offset, dri_bo *target_buf)
+{
+}
+
+/**
+ * Initializes the EXA buffer manager, which is just a thin wrapper
+ * around the EXA allocator.
+ *
+ * \param fd File descriptor of the opened DRM device.
+ * \param fence_type Driver-specific fence type used for fences with no flush.
+ * \param fence_type_flush Driver-specific fence type used for fences with a
+ *	  flush.
+ */
+dri_bufmgr *
+intel_bufmgr_exa_init(ScrnInfoPtr pScrn)
+{
+    dri_bufmgr_exa *bufmgr_exa;
+
+    bufmgr_exa = calloc(1, sizeof(*bufmgr_exa));
+    bufmgr_exa->pScrn = pScrn;
+
+    bufmgr_exa->bufmgr.bo_alloc = dri_exa_alloc;
+    bufmgr_exa->bufmgr.bo_reference = dri_exa_bo_reference;
+    bufmgr_exa->bufmgr.bo_unreference = dri_exa_bo_unreference;
+    bufmgr_exa->bufmgr.bo_map = dri_exa_bo_map;
+    bufmgr_exa->bufmgr.bo_unmap = dri_exa_bo_unmap;
+    bufmgr_exa->bufmgr.destroy = dri_bufmgr_exa_destroy;
+    bufmgr_exa->bufmgr.emit_reloc = dri_exa_emit_reloc;
+
+    return &bufmgr_exa->bufmgr;
+}
+
diff --git a/src/intel_bufmgr_exa.h b/src/intel_bufmgr_exa.h
new file mode 100644
index 0000000..ebfb38f
--- /dev/null
+++ b/src/intel_bufmgr_exa.h
@@ -0,0 +1,8 @@
+#ifndef INTEL_BUFMGR_EXA_H
+#define INTEL_BUFMGR_EXA_H
+
+#include "dri_bufmgr.h"
+
+dri_bufmgr *intel_bufmgr_exa_init(ScrnInfoPtr pScrn);
+
+#endif
diff --git a/src/intel_bufmgr_ttm.c b/src/intel_bufmgr_ttm.c
index 6d8719d..5652889 100644
--- a/src/intel_bufmgr_ttm.c
+++ b/src/intel_bufmgr_ttm.c
@@ -374,7 +374,7 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
     ttm_buf->validate_index = -1;
     ttm_buf->map_count = 0;
 
-    DBG("bo_create: %p (%s) %ldb\n", &ttm_buf->bo, ttm_buf->name, size);
+    DBG("bo_create: %p %08x (%s) %ldb\n", &ttm_buf->bo, ttm_buf->drm_bo.handle, ttm_buf->name, size);
 
     return &ttm_buf->bo;
 }


Index: intel-stub.c
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-i810/devel/intel-stub.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- intel-stub.c	27 Feb 2008 22:32:21 -0000	1.1
+++ intel-stub.c	6 Mar 2008 06:51:07 -0000	1.2
@@ -30,6 +30,7 @@
  *   Kristian Høgsberg (krh at redhat.com)
  */
 
+#include <fcntl.h>
 #include "xorg-server.h"
 #include "xf86.h"
 #include "xf86Priv.h"
@@ -53,12 +54,31 @@
 	pointer driver;
 	Bool value;
 	const char *name;
-
-	xf86ProcessOptions(-1, xf86ConfigLayout.options, stubOptions);
-	if (xf86GetOptValBool(stubOptions, FLAG_BATCHBUFFER, &value) && value)
+	int cmdline_fd;
+	int kmode = 0;
+	
+	cmdline_fd = open("/proc/cmdline", O_RDONLY);
+	if (cmdline_fd >= 0) {
+	    char buf[255];
+	    int ret;
+
+	    ret = read(cmdline_fd, buf, 255);
+	    if (ret > 0) {
+		if (strstr(buf, "i915.modeset=1")) {
+		    kmode = 1;
+		}
+	    }
+	    close(cmdline_fd);
+	}
+
+	if (kmode == 0) {
+	    xf86ProcessOptions(-1, xf86ConfigLayout.options, stubOptions);
+	    if (xf86GetOptValBool(stubOptions, FLAG_BATCHBUFFER, &value) && value)
 		name = "intel_batchbuffer";
-	else
+	    else
 		name = "intel_master";
+	} else
+	    name = "intel_batchbuffer";
 
 	driver = LoadSubModule(module, name, NULL, NULL, NULL, NULL, 
 			       errmaj, errmin);


Index: xorg-x11-drv-i810.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-i810/devel/xorg-x11-drv-i810.spec,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- xorg-x11-drv-i810.spec	4 Mar 2008 00:34:50 -0000	1.78
+++ xorg-x11-drv-i810.spec	6 Mar 2008 06:51:07 -0000	1.79
@@ -5,7 +5,7 @@
 Summary:   Xorg X11 Intel video driver(s)
 Name:      xorg-x11-drv-i810
 Version:   2.2.1
-Release:   4%{?dist}
+Release:   5%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X Hardware Support
@@ -26,6 +26,7 @@
 
 Patch100: intel-master.patch
 Patch101: intel-batchbuffer.patch
+Patch102: intel-modeset.patch
 
 ExclusiveArch: %{ix86} x86_64 ia64
 
@@ -65,6 +66,7 @@
 
 cd ../xf86-video-intel-%{batchbuffer_version}
 %patch101 -p1 -b .intel-batchbuffer
+%patch102 -p1 -b .intel-modeset
 
 %build
 
@@ -126,6 +128,10 @@
 %{_libdir}/libI810XvMC.so
 
 %changelog
+* Thu Mar 06 2008 Dave Airlie <airlied at redhat.com> 2.2.1-5
+- Bump to include modesetting driver - and make stub auto pick
+  batchbuffer branch if modesetting enabled
+
 * Mon Mar  3 2008 Kristian Høgsberg <krh at redhat.com> - 2.2.1-4
 - Bump intel-batchbuffer to latest snapshot, rebuild against new server ABI.
 




More information about the fedora-extras-commits mailing list