rpms/kernel/devel linux-2.6-drm-i915-modeset.patch, NONE, 1.1 kernel.spec, 1.478, 1.479

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Thu Mar 6 05:38:08 UTC 2008


Author: airlied

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20171

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-drm-i915-modeset.patch 
Log Message:
* Thu Mar 06 2008 Dave Airlie <airlied at redhat.com>
- Add initial i915 drm modesetting tree - needs i915.modeset=1 on command
  line + new libdrm + new intel driver to actually be useful


linux-2.6-drm-i915-modeset.patch:

--- NEW FILE linux-2.6-drm-i915-modeset.patch ---
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 721548c..2190a4c 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -7,14 +7,15 @@ drm-objs    :=	drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \
 		drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
 		drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
 		drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o drm_object.o \
-		drm_fence.o drm_ttm.o drm_bo.o drm_bo_move.o drm_bo_lock.o
+		drm_fence.o drm_ttm.o drm_bo.o drm_bo_move.o drm_bo_lock.o \
+		drm_modes.o drm_crtc.o drm_edid.o
 
 tdfx-objs   := tdfx_drv.o
 r128-objs   := r128_drv.o r128_cce.o r128_state.o r128_irq.o
 mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
 i810-objs   := i810_drv.o i810_dma.o
 i830-objs   := i830_drv.o i830_dma.o i830_irq.o
-i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o i915_buffer.o
+i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o i915_buffer.o i915_init.o intel_display.o intel_lvds.o intel_crt.o intel_i2c.o intel_modes.o intel_sdvo.o intel_tv.o intel_fb.o
 nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
 		nouveau_object.o nouveau_irq.o nouveau_notifier.o nouveau_swmthd.o \
 		nouveau_sgdma.o nouveau_dma.o nouveau_buffer.o nouveau_fence.o \
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 8fe8ac1..8f1c8d4 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -884,6 +884,185 @@ struct drm_mm_init_arg {
 	uint64_t p_size;
 };
 
+struct drm_mm_info_arg {
+	unsigned int mem_type;
+	uint64_t p_size;
+};
+
+
+/*
+ * Drm mode setting
+ */
+#define DRM_DISPLAY_INFO_LEN 32
+#define DRM_OUTPUT_NAME_LEN 32
+#define DRM_DISPLAY_MODE_LEN 32
+#define DRM_PROP_NAME_LEN 32
+
+#define DRM_MODE_TYPE_BUILTIN	(1<<0)
+#define DRM_MODE_TYPE_CLOCK_C	((1<<1) | DRM_MODE_TYPE_BUILTIN)
+#define DRM_MODE_TYPE_CRTC_C	((1<<2) | DRM_MODE_TYPE_BUILTIN)
+#define DRM_MODE_TYPE_PREFERRED	(1<<3)
+#define DRM_MODE_TYPE_DEFAULT	(1<<4)
+#define DRM_MODE_TYPE_USERDEF	(1<<5)
+#define DRM_MODE_TYPE_DRIVER	(1<<6)
+
+struct drm_mode_modeinfo {
+	unsigned int clock;
+	unsigned short hdisplay, hsync_start, hsync_end, htotal, hskew;
+	unsigned short vdisplay, vsync_start, vsync_end, vtotal, vscan;
+
+	unsigned int vrefresh; /* vertical refresh * 1000 */
+
+	unsigned int flags;
+	unsigned int type;
+	char name[DRM_DISPLAY_MODE_LEN];
+};
+
+struct drm_mode_card_res {
+	uint64_t fb_id_ptr;
+	uint64_t crtc_id_ptr;
+	uint64_t output_id_ptr;
+	int count_fbs;
+	int count_crtcs;
+	int count_outputs;
+	int min_width, max_width;
+	int min_height, max_height;
+};
+
+struct drm_mode_crtc {
+	uint64_t set_outputs_ptr;
+
+	unsigned int crtc_id; /**< Id */
+	unsigned int fb_id; /**< Id of framebuffer */
+
+	int x, y; /**< Position on the frameuffer */
+
+	int count_outputs;
+	unsigned int outputs; /**< Outputs that are connected */
+
+	int count_possibles;
+	unsigned int possibles; /**< Outputs that can be connected */
+	int gamma_size;
+	int mode_valid;
+	struct drm_mode_modeinfo mode;
+};
+
+#define DRM_MODE_OUTPUT_NONE 0
+#define DRM_MODE_OUTPUT_DAC  1
+#define DRM_MODE_OUTPUT_TMDS 2
+#define DRM_MODE_OUTPUT_LVDS 3
+#define DRM_MODE_OUTPUT_TVDAC 4
+
+struct drm_mode_get_output {
+
+	uint64_t modes_ptr;
+	uint64_t props_ptr;
+	uint64_t prop_values_ptr;
+
+	int count_modes;
+	int count_props;
+	unsigned int output; /**< Id */
+	unsigned int crtc; /**< Id of crtc */
+	unsigned int output_type;
+	unsigned int output_type_id;
+
+	unsigned int connection;
+	unsigned int mm_width, mm_height; /**< HxW in millimeters */
+	unsigned int subpixel;
+	int count_crtcs;
+	int count_clones;
+	unsigned int crtcs; /**< possible crtc to connect to */
+	unsigned int clones; /**< list of clones */
+};
+
+#define DRM_MODE_PROP_PENDING (1<<0)
+#define DRM_MODE_PROP_RANGE (1<<1)
+#define DRM_MODE_PROP_IMMUTABLE (1<<2)
+#define DRM_MODE_PROP_ENUM (1<<3) // enumerated type with text strings
+#define DRM_MODE_PROP_BLOB (1<<4)
+
+struct drm_mode_property_enum {
+	uint64_t value;
+	unsigned char name[DRM_PROP_NAME_LEN];
+};
+
+struct drm_mode_get_property {
+	uint64_t values_ptr; /* values and blob lengths */
+	uint64_t enum_blob_ptr; /* enum and blob id ptrs */
+
+	unsigned int prop_id;
+	unsigned int flags;
+	unsigned char name[DRM_PROP_NAME_LEN];
+
+	int count_values;
+	int count_enum_blobs;
+};
+
+struct drm_mode_output_set_property {
+	uint64_t value;
+	unsigned int prop_id;
+	unsigned int output_id;
+};
+
+struct drm_mode_get_blob {
+	uint32_t blob_id;
+	uint32_t length;
+	uint64_t data;
+};
+
+struct drm_mode_fb_cmd {
+        unsigned int buffer_id;
+        unsigned int width, height;
+        unsigned int pitch;
+        unsigned int bpp;
+        unsigned int handle;
+	unsigned int depth;
+};
+
+struct drm_mode_mode_cmd {
+	unsigned int output_id;
+	struct drm_mode_modeinfo mode;
+};
+
+#define DRM_MODE_CURSOR_BO   0x01
+#define DRM_MODE_CURSOR_MOVE 0x02
+
+/*
+ * depending on the value in flags diffrent members are used.
+ *
+ * CURSOR_BO uses
+ *    crtc
+ *    width
+ *    height
+ *    handle - if 0 turns the cursor of
+ *
+ * CURSOR_MOVE uses
+ *    crtc
+ *    x
+ *    y
+ */
+struct drm_mode_cursor {
+	unsigned int flags;
+	unsigned int crtc;
+	int x;
+	int y;
+	uint32_t width;
+	uint32_t height;
+	unsigned int handle;
+};
+
+/*
+ * oh so ugly hotplug
[...15728 lines suppressed...]
+	 */
+	tv_format_atom = MakeAtom(TV_FORMAT_NAME, sizeof(TV_FORMAT_NAME) - 1,
+				  TRUE);
+
+	for (i = 0; i < NUM_TV_MODES; i++)
+		tv_format_name_atoms[i] = MakeAtom (tv_modes[i].name,
+						    strlen (tv_modes[i].name),
+						    TRUE);
+
+	err = intel_tv_format_configure_property (output);
+
+	if (err != 0) {
+		xf86DrvMsg(dev->scrnIndex, X_ERROR,
+			   "RRConfigureOutputProperty error, %d\n", err);
+	}
+
+	/* Set the current value of the tv_format property */
+	if (!intel_tv_format_set_property (output))
+		xf86DrvMsg(dev->scrnIndex, X_ERROR,
+			   "RRChangeOutputProperty error, %d\n", err);
+
+	for (i = 0; i < 4; i++)
+	{
+		INT32	range[2];
+		margin_atoms[i] = MakeAtom(margin_names[i], strlen (margin_names[i]),
+					   TRUE);
+
+		range[0] = 0;
+		range[1] = 100;
+		err = RRConfigureOutputProperty(output->randr_output, margin_atoms[i],
+						TRUE, TRUE, FALSE, 2, range);
+    
+		if (err != 0)
+			xf86DrvMsg(dev->scrnIndex, X_ERROR,
+				   "RRConfigureOutputProperty error, %d\n", err);
+
+		err = RRChangeOutputProperty(output->randr_output, margin_atoms[i],
+					     XA_INTEGER, 32, PropModeReplace,
+					     1, &tv_priv->margin[i],
+					     FALSE, TRUE);
+		if (err != 0)
+			xf86DrvMsg(dev->scrnIndex, X_ERROR,
+				   "RRChangeOutputProperty error, %d\n", err);
+	}
+#endif
+}
+
+static bool
+intel_tv_set_property(struct drm_output *output, struct drm_property *property,
+		      uint64_t val)
+{
+	struct drm_device *dev = output->dev;
+	int ret = 0;
+    
+	if (property == dev->mode_config.tv_left_margin_property ||
+	    property == dev->mode_config.tv_right_margin_property ||
+	    property == dev->mode_config.tv_top_margin_property ||
+	    property == dev->mode_config.tv_bottom_margin_property) {
+		ret = drm_output_property_set_value(output, property, val);
+	} else {
+		/* TV mode handling here */
+	}
+
+	return ret;
+}
+
+static const struct drm_output_funcs intel_tv_output_funcs = {
+	.dpms = intel_tv_dpms,
+	.save = intel_tv_save,
+	.restore = intel_tv_restore,
+	.mode_valid = intel_tv_mode_valid,
+	.mode_fixup = intel_tv_mode_fixup,
+	.prepare = intel_output_prepare,
+	.mode_set = intel_tv_mode_set,
+	.commit = intel_output_commit,
+	.detect = intel_tv_detect,
+	.get_modes = intel_tv_get_modes,
+	.cleanup = intel_tv_destroy,
+	.set_property = intel_tv_set_property,
+};
+
+void
+intel_tv_init(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_output *output;
+	struct intel_output *intel_output;
+	struct intel_tv_priv *tv_priv;
+	u32 tv_dac_on, tv_dac_off, save_tv_dac;
+
+	/* FIXME: better TV detection and/or quirks */
+#if 0
+	if (tv_priv->quirk_flag & QUIRK_IGNORE_TV)
+		return;
+#endif
+	if ((I915_READ(TV_CTL) & TV_FUSE_STATE_MASK) == TV_FUSE_STATE_DISABLED)
+		return;
+
+	/*
+	 * Sanity check the TV output by checking to see if the
+	 * DAC register holds a value
+	 */
+	save_tv_dac = I915_READ(TV_DAC);
+
+	I915_WRITE(TV_DAC, save_tv_dac | TVDAC_STATE_CHG_EN);
+	tv_dac_on = I915_READ(TV_DAC);
+
+	I915_WRITE(TV_DAC, save_tv_dac & ~TVDAC_STATE_CHG_EN);
+	tv_dac_off = I915_READ(TV_DAC);
+
+	I915_WRITE(TV_DAC, save_tv_dac);
+
+	/*
+	 * If the register does not hold the state change enable
+	 * bit, (either as a 0 or a 1), assume it doesn't really
+	 * exist
+	 */
+	if ((tv_dac_on & TVDAC_STATE_CHG_EN) == 0 || 
+	    (tv_dac_off & TVDAC_STATE_CHG_EN) != 0)
+		return;
+
+	output = drm_output_create(dev, &intel_tv_output_funcs,
+				   DRM_MODE_OUTPUT_TVDAC);
+
+	if (!output)
+		return;
+
+	intel_output = drm_calloc(1, sizeof(struct intel_output) +
+				  sizeof(struct intel_tv_priv), DRM_MEM_DRIVER);
+	if (!intel_output) {
+		drm_output_destroy(output);
+		return;
+	}
+
+	tv_priv = (struct intel_tv_priv *)(intel_output + 1);
+	intel_output->type = INTEL_OUTPUT_TVOUT;
+	output->possible_crtcs = ((1 << 0) | (1 << 1));
+	output->possible_clones = (1 << INTEL_OUTPUT_TVOUT);
+	intel_output->dev_priv = tv_priv;
+	tv_priv->type = TV_TYPE_UNKNOWN;
+
+	tv_priv->tv_format = NULL;
+    
+	/* BIOS margin values */
+	tv_priv->margin[TV_MARGIN_LEFT] = 54;
+	tv_priv->margin[TV_MARGIN_TOP] = 36;
+	tv_priv->margin[TV_MARGIN_RIGHT] = 46;
+	tv_priv->margin[TV_MARGIN_BOTTOM] = 37;
+    
+	if (!tv_priv->tv_format)
+		tv_priv->tv_format = kstrdup(tv_modes[0].name, GFP_KERNEL);
+    
+	output->driver_private = intel_output;
+	output->interlace_allowed = FALSE;
+	output->doublescan_allowed = FALSE;
+}
diff --git a/drivers/char/drm/nouveau_mem.c b/drivers/char/drm/nouveau_mem.c
index a508a37..622fe99 100644
--- a/drivers/char/drm/nouveau_mem.c
+++ b/drivers/char/drm/nouveau_mem.c
@@ -372,7 +372,7 @@ nouveau_mem_init_ttm(struct drm_device *dev)
 	bar1_size = drm_get_resource_len(dev, 1) >> PAGE_SHIFT;
 	if (bar1_size < vram_size) {
 		if ((ret = drm_bo_init_mm(dev, DRM_BO_MEM_PRIV0,
-					  bar1_size, vram_size - bar1_size))) {
+					  bar1_size, vram_size - bar1_size, 1))) {
 			DRM_ERROR("Failed PRIV0 mm init: %d\n", ret);
 			return ret;
 		}
@@ -383,7 +383,7 @@ nouveau_mem_init_ttm(struct drm_device *dev)
 #ifdef HACK_OLD_MM
 	vram_size /= 4;
 #endif
-	if ((ret = drm_bo_init_mm(dev, DRM_BO_MEM_VRAM, 0, vram_size))) {
+	if ((ret = drm_bo_init_mm(dev, DRM_BO_MEM_VRAM, 0, vram_size, 1))) {
 		DRM_ERROR("Failed VRAM mm init: %d\n", ret);
 		return ret;
 	}
@@ -403,7 +403,7 @@ nouveau_mem_init_ttm(struct drm_device *dev)
 
 	if ((ret = drm_bo_init_mm(dev, DRM_BO_MEM_TT, 0,
 				  dev_priv->gart_info.aper_size >>
-				  PAGE_SHIFT))) {
+				  PAGE_SHIFT, 1))) {
 		DRM_ERROR("Failed TT mm init: %d\n", ret);
 		return ret;
 	}
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 6f75512..8e4a494 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -3012,7 +3012,7 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
 		 */
 	case RADEON_PARAM_SAREA_HANDLE:
 		/* The lock is the first dword in the sarea. */
-		value = (long)dev->lock.hw_lock;
+		value = (long)dev->primary->master->lock.hw_lock;
 		break;
 #endif
 	case RADEON_PARAM_GART_TEX_HANDLE:


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.478
retrieving revision 1.479
diff -u -r1.478 -r1.479
--- kernel.spec	6 Mar 2008 05:31:30 -0000	1.478
+++ kernel.spec	6 Mar 2008 05:37:20 -0000	1.479
@@ -425,6 +425,7 @@
 Provides: kernel-%{_target_cpu} = %{rpmversion}-%{pkg_release}%{?1}\
 Provides: kernel-drm = 4.3.0\
 Provides: kernel-drm-nouveau = 10\
+Provides: kernel-modeset = 1\
 Requires(pre): %{kernel_prereq}\
 Conflicts: %{kernel_dot_org_conflicts}\
 Conflicts: %{package_conflicts}\
@@ -625,6 +626,7 @@
 Patch1803: nouveau-drm.patch
 Patch1804: linux-2.6-drm-git-mm-revert-nopfn.patch
 Patch1805: linux-2.6-drm-git-i915-remove-priv-access.patch
+Patch1806: linux-2.6-drm-i915-modeset.patch
 
 # kludge to make ich9 e1000 work
 Patch2000: linux-2.6-e1000-ich9.patch
@@ -1149,6 +1151,7 @@
 ApplyPatch nouveau-drm.patch
 ApplyPatch linux-2.6-drm-git-mm-revert-nopfn.patch
 ApplyPatch linux-2.6-drm-git-i915-remove-priv-access.patch
+ApplyPatch linux-2.6-drm-i915-modeset.patch
 
 # ext4dev stable patch queue, slated for 2.6.25
 #ApplyPatch linux-2.6-ext4-stable-queue.patch
@@ -1754,6 +1757,10 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
+* Thu Mar 06 2008 Dave Airlie <airlied at redhat.com>
+- Add initial i915 drm modesetting tree - needs i915.modeset=1 on command
+  line + new libdrm + new intel driver to actually be useful
+
 * Wed Mar 05 2008 Jarod Wilson <jwilson at redhat.com>
 - firewire-sbp2: improved ability to reconnect to devices
   following a bus reset




More information about the fedora-extras-commits mailing list