Skip to contentSkip to conversation

introduce intel_ring_buffer structure

PATCH In review Zou Nan hai 6 participants 21 messages May 6, 2010 – May 19, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 introduce intel_ring_buffer structure

introduce intel_ring_buffer structure. sequential number, IRQ logic and hardware status page were included in the intel_ring_buffer structure

---
 drivers/gpu/drm/i915/Makefile           |    1 +
 drivers/gpu/drm/i915/i915_drv.h         |    7 +
 drivers/gpu/drm/i915/i915_irq.c         |    4 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |  576 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_ringbuffer.h |  119 +++++++
 include/drm/i915_drm.h                  |    4 +-
 6 files changed, 708 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_ringbuffer.c
 create mode 100644 drivers/gpu/drm/i915/intel_ringbuffer.h
drivers/gpu/drm/i915/Makefile +1 -0
index 9929f84..bf8d097 100644
@@ -22,6 +22,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
 	  intel_fb.o \
 	  intel_tv.o \
 	  intel_dvo.o \
+	  intel_ringbuffer.o \
 	  intel_overlay.o \
 	  dvo_ch7xxx.o \
 	  dvo_ch7017.o \
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 790fef3..32953ad 100644
@@ -32,6 +32,7 @@
 
 #include "i915_reg.h"
 #include "intel_bios.h"
+#include "intel_ringbuffer.h"
 #include <linux/io-mapping.h>
 
 /* General customization:
@@ -838,6 +839,12 @@ extern u32 gm45_get_vblank_counter(struct drm_device *dev, int crtc);
 extern int i915_vblank_swap(struct drm_device *dev, void *data,
 			    struct drm_file *file_priv);
 extern void i915_enable_irq(drm_i915_private_t *dev_priv, u32 mask);
+extern void i915_disable_irq(drm_i915_private_t *dev_priv, u32 mask);
+extern void ironlake_enable_graphics_irq(drm_i915_private_t *dev_priv,
+		u32 mask);
+extern void ironlake_disable_graphics_irq(drm_i915_private_t *dev_priv,
+		u32 mask);
+
 
 void
 i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
drivers/gpu/drm/i915/i915_irq.c +2 -2
index 7701cbd..301702a 100644
@@ -73,7 +73,7 @@ ironlake_enable_graphics_irq(drm_i915_private_t *dev_priv, u32 mask)
 	}
 }
 
-static inline void
+void
 ironlake_disable_graphics_irq(drm_i915_private_t *dev_priv, u32 mask)
 {
 	if ((dev_priv->gt_irq_mask_reg & mask) != mask) {
@@ -114,7 +114,7 @@ i915_enable_irq(drm_i915_private_t *dev_priv, u32 mask)
 	}
 }
 
-static inline void
+void
 i915_disable_irq(drm_i915_private_t *dev_priv, u32 mask)
 {
 	if ((dev_priv->irq_mask_reg & mask) != mask) {
drivers/gpu/drm/i915/intel_ringbuffer.c new file +576 -0

576 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.h new file +119 -0

119 lines not on this page · raw message

include/drm/i915_drm.h +3 -1
index b64a8d7..e916870 100644
@@ -616,7 +616,9 @@ struct drm_i915_gem_execbuffer2 {
 	__u32 num_cliprects;
 	/** This is a struct drm_clip_rect *cliprects */
 	__u64 cliprects_ptr;
-	__u64 flags; /* currently unused */
+#define I915_EXEC_RENDER                 (1<<0)
+#define I915_EXEC_BSD                    (1<<1)
+	__u64 flags;
 	__u64 rsvd1;
 	__u64 rsvd2;
 };
Signature · 1 line
1.7.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw

PATCH 2/4 convert render engine to use intel_ring_buffer

convert ring buffer used by render engine to intel_ring_buffer structure.

---
 drivers/gpu/drm/i915/i915_debugfs.c     |   14 +-
 drivers/gpu/drm/i915/i915_dma.c         |  159 ++++++-----------------
 drivers/gpu/drm/i915/i915_drv.c         |   27 +----
 drivers/gpu/drm/i915/i915_drv.h         |   35 ++---
 drivers/gpu/drm/i915/i915_gem.c         |  214 ++-----------------------------
 drivers/gpu/drm/i915/i915_irq.c         |   16 ++-
 drivers/gpu/drm/i915/intel_display.c    |    1 -
 drivers/gpu/drm/i915/intel_overlay.c    |    9 --
 drivers/gpu/drm/i915/intel_ringbuffer.c |   24 +++-
 9 files changed, 101 insertions(+), 398 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +7 -7
index bb3a4a8..ea81ec1 100644
@@ -143,7 +143,7 @@ static int i915_gem_seqno_info(struct seq_file *m, void *data)
 	struct drm_device *dev = node->minor->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
-	if (dev_priv->hw_status_page != NULL) {
+	if (dev_priv->render_ring.status_page.page_addr != NULL) {
 		seq_printf(m, "Current sequence: %d\n",
 			   i915_get_gem_seqno(dev));
 	} else {
@@ -195,7 +195,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 	}
 	seq_printf(m, "Interrupts received: %d\n",
 		   atomic_read(&dev_priv->irq_received));
-	if (dev_priv->hw_status_page != NULL) {
+	if (dev_priv->render_ring.status_page.page_addr != NULL) {
 		seq_printf(m, "Current sequence:    %d\n",
 			   i915_get_gem_seqno(dev));
 	} else {
@@ -251,7 +251,7 @@ static int i915_hws_info(struct seq_file *m, void *data)
 	int i;
 	volatile u32 *hws;
 
-	hws = (volatile u32 *)dev_priv->hw_status_page;
+	hws = (volatile u32 *)dev_priv->render_ring.status_page.page_addr;
 	if (hws == NULL)
 		return 0;
 
@@ -317,14 +317,14 @@ static int i915_ringbuffer_data(struct seq_file *m, void *data)
 	u8 *virt;
 	uint32_t *ptr, off;
 
-	if (!dev_priv->ring.ring_obj) {
+	if (!dev_priv->render_ring.gem_object) {
 		seq_printf(m, "No ringbuffer setup\n");
 		return 0;
 	}
 
-	virt = dev_priv->ring.virtual_start;
+	virt = dev_priv->render_ring.virtual_start;
 
-	for (off = 0; off < dev_priv->ring.Size; off += 4) {
+	for (off = 0; off < dev_priv->render_ring.size; off += 4) {
 		ptr = (uint32_t *)(virt + off);
 		seq_printf(m, "%08x :  %08x\n", off, *ptr);
 	}
@@ -344,7 +344,7 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data)
 
 	seq_printf(m, "RingHead :  %08x\n", head);
 	seq_printf(m, "RingTail :  %08x\n", tail);
-	seq_printf(m, "RingSize :  %08lx\n", dev_priv->ring.Size);
+	seq_printf(m, "RingSize :  %08lx\n", dev_priv->render_ring.size);
 	seq_printf(m, "Acthd :     %08x\n", I915_READ(IS_I965G(dev) ? ACTHD_I965 : ACTHD));
 
 	return 0;
drivers/gpu/drm/i915/i915_dma.c +38 -121

299 lines not on this page · raw message

drivers/gpu/drm/i915/i915_drv.c +2 -25
index 01e91ea..be0f31b 100644
@@ -388,32 +388,9 @@ int i965_reset(struct drm_device *dev, u8 flags)
 	 */
 	if (drm_core_check_feature(dev, DRIVER_MODESET) ||
 	    !dev_priv->mm.suspended) {
-		drm_i915_ring_buffer_t *ring = &dev_priv->ring;
-		struct drm_gem_object *obj = ring->ring_obj;
-		struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
+		struct intel_ring_buffer *ring = &dev_priv->render_ring;
 		dev_priv->mm.suspended = 0;
-
-		/* Stop the ring if it's running. */
-		I915_WRITE(PRB0_CTL, 0);
-		I915_WRITE(PRB0_TAIL, 0);
-		I915_WRITE(PRB0_HEAD, 0);
-
-		/* Initialize the ring. */
-		I915_WRITE(PRB0_START, obj_priv->gtt_offset);
-		I915_WRITE(PRB0_CTL,
-			   ((obj->size - 4096) & RING_NR_PAGES) |
-			   RING_NO_REPORT |
-			   RING_VALID);
-		if (!drm_core_check_feature(dev, DRIVER_MODESET))
-			i915_kernel_lost_context(dev);
-		else {
-			ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
-			ring->tail = I915_READ(PRB0_TAIL) & TAIL_ADDR;
-			ring->space = ring->head - (ring->tail + 8);
-			if (ring->space < 0)
-				ring->space += ring->Size;
-		}
-
+		ring->init(dev, ring);
 		mutex_unlock(&dev->struct_mutex);
 		drm_irq_uninstall(dev);
 		drm_irq_install(dev);
drivers/gpu/drm/i915/i915_drv.h +13 -22
index 32953ad..83d6e9b 100644
@@ -237,10 +237,10 @@ typedef struct drm_i915_private {
 	void __iomem *regs;
 
 	struct pci_dev *bridge_dev;
-	drm_i915_ring_buffer_t ring;
+	struct intel_ring_buffer render_ring;
+
 
 	drm_dma_handle_t *status_page_dmah;
-	void *hw_status_page;
 	dma_addr_t dma_status_page;
 	uint32_t counter;
 	unsigned int status_gfx_addr;
@@ -1017,7 +1017,8 @@ extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
  * has access to the ring.
  */
 #define RING_LOCK_TEST_WITH_RETURN(dev, file_priv) do {			\
-	if (((drm_i915_private_t *)dev->dev_private)->ring.ring_obj == NULL) \
+	if (((drm_i915_private_t *)dev->dev_private)->render_ring.gem_object \
+			== NULL) \
 		LOCK_TEST_WITH_RETURN(dev, file_priv);			\
 } while (0)
 
@@ -1036,29 +1037,18 @@ extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
 #define RING_LOCALS	volatile unsigned int *ring_virt__;
 
 #define BEGIN_LP_RING(n) do {						\
-	int bytes__ = 4*(n);						\
-	if (I915_VERBOSE) DRM_DEBUG("BEGIN_LP_RING(%d)\n", (n));	\
-	/* a wrap must occur between instructions so pad beforehand */	\
-	if (unlikely (dev_priv->ring.tail + bytes__ > dev_priv->ring.Size)) \
-		i915_wrap_ring(dev);					\
-	if (unlikely (dev_priv->ring.space < bytes__))			\
-		i915_wait_ring(dev, bytes__, __func__);			\
-	ring_virt__ = (unsigned int *)					\
-	        (dev_priv->ring.virtual_start + dev_priv->ring.tail);	\
-	dev_priv->ring.tail += bytes__;					\
-	dev_priv->ring.tail &= dev_priv->ring.Size - 1;			\
-	dev_priv->ring.space -= bytes__;				\
+	drm_i915_private_t *dev_priv = dev->dev_private;                \
+	intel_ring_begin(dev, &dev_priv->render_ring, 4*(n));    \
 } while (0)
 
-#define OUT_RING(n) do {						\
-	if (I915_VERBOSE) DRM_DEBUG("   OUT_RING %x\n", (int)(n));	\
-	*ring_virt__++ = (n);						\
+#define OUT_RING(x) do {						\
+	drm_i915_private_t *dev_priv = dev->dev_private;                \
+	intel_ring_emit(dev, &dev_priv->render_ring, x);		\
 } while (0)
 
 #define ADVANCE_LP_RING() do {						\
-	if (I915_VERBOSE)						\
-		DRM_DEBUG("ADVANCE_LP_RING %x\n", dev_priv->ring.tail);	\
-	I915_WRITE(PRB0_TAIL, dev_priv->ring.tail);			\
+	drm_i915_private_t *dev_priv = dev->dev_private;                \
+	intel_ring_advance(dev, &dev_priv->render_ring);		\
 } while(0)
 
 /**
@@ -1076,7 +1066,8 @@ extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
  *
  * The area from dword 0x20 to 0x3ff is available for driver usage.
  */
-#define READ_HWSP(dev_priv, reg)  (((volatile u32*)(dev_priv->hw_status_page))[reg])
+#define READ_HWSP(dev_priv, reg)  (((volatile u32 *)\
+			(dev_priv->render_ring.status_page.page_addr))[reg])
 #define READ_BREADCRUMB(dev_priv) READ_HWSP(dev_priv, I915_BREADCRUMB_INDEX)
 #define I915_GEM_HWS_INDEX		0x20
 #define I915_BREADCRUMB_INDEX		0x21
drivers/gpu/drm/i915/i915_gem.c +13 -201

271 lines not on this page · raw message

drivers/gpu/drm/i915/i915_irq.c +9 -7
index 301702a..1e3299a 100644
@@ -531,17 +531,18 @@ i915_ringbuffer_last_batch(struct drm_device *dev)
 	 */
 	bbaddr = 0;
 	head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
-	ring = (u32 *)(dev_priv->ring.virtual_start + head);
+	ring = (u32 *)(dev_priv->render_ring.virtual_start + head);
 
-	while (--ring >= (u32 *)dev_priv->ring.virtual_start) {
+	while (--ring >= (u32 *)dev_priv->render_ring.virtual_start) {
 		bbaddr = i915_get_bbaddr(dev, ring);
 		if (bbaddr)
 			break;
 	}
 
 	if (bbaddr == 0) {
-		ring = (u32 *)(dev_priv->ring.virtual_start + dev_priv->ring.Size);
-		while (--ring >= (u32 *)dev_priv->ring.virtual_start) {
+		ring = (u32 *)(dev_priv->render_ring.virtual_start
+				+ dev_priv->render_ring.size);
+		while (--ring >= (u32 *)dev_priv->render_ring.virtual_start) {
 			bbaddr = i915_get_bbaddr(dev, ring);
 			if (bbaddr)
 				break;
@@ -551,6 +552,7 @@ i915_ringbuffer_last_batch(struct drm_device *dev)
 	return bbaddr;
 }
 
+
 /**
  * i915_capture_error_state - capture an error record for later analysis
  * @dev: drm device
@@ -634,7 +636,8 @@ static void i915_capture_error_state(struct drm_device *dev)
 	error->batchbuffer[1] = i915_error_object_create(dev, batchbuffer[1]);
 
 	/* Record the ringbuffer */
-	error->ringbuffer = i915_error_object_create(dev, dev_priv->ring.ring_obj);
+	error->ringbuffer = i915_error_object_create(dev,
+			dev_priv->render_ring.gem_object);
 
 	/* Record buffers on the active list. */
 	error->active_bo = NULL;
@@ -979,7 +982,6 @@ static int i915_emit_irq(struct drm_device * dev)
 {
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
-	RING_LOCALS;
 
 	i915_kernel_lost_context(dev);
 
@@ -1082,7 +1084,7 @@ int i915_irq_emit(struct drm_device *dev, void *data,
 	drm_i915_irq_emit_t *emit = data;
 	int result;
 
-	if (!dev_priv || !dev_priv->ring.virtual_start) {
+	if (!dev_priv || !dev_priv->render_ring.virtual_start) {
 		DRM_ERROR("called with no initialization\n");
 		return -EINVAL;
 	}
drivers/gpu/drm/i915/intel_display.c +0 -1
index 58668c4..edac8cf 100644
@@ -4603,7 +4603,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	unsigned long flags;
 	int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC;
 	int ret, pipesrc;
-	RING_LOCALS;
 
 	work = kzalloc(sizeof *work, GFP_KERNEL);
 	if (work == NULL)
drivers/gpu/drm/i915/intel_overlay.c +0 -9
index 6d524a1..2e490ad 100644
@@ -211,10 +211,7 @@ static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay)
 static int intel_overlay_on(struct intel_overlay *overlay)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
 	int ret;
-	RING_LOCALS;
-
 	BUG_ON(overlay->active);
 
 	overlay->active = 1;
@@ -248,7 +245,6 @@ static void intel_overlay_continue(struct intel_overlay *overlay,
         drm_i915_private_t *dev_priv = dev->dev_private;
 	u32 flip_addr = overlay->flip_addr;
 	u32 tmp;
-	RING_LOCALS;
 
 	BUG_ON(!overlay->active);
 
@@ -274,7 +270,6 @@ static int intel_overlay_wait_flip(struct intel_overlay *overlay)
         drm_i915_private_t *dev_priv = dev->dev_private;
 	int ret;
 	u32 tmp;
-	RING_LOCALS;
 
 	if (overlay->last_flip_req != 0) {
 		ret = i915_do_wait_request(dev, overlay->last_flip_req, 1);
@@ -314,9 +309,7 @@ static int intel_overlay_off(struct intel_overlay *overlay)
 {
 	u32 flip_addr = overlay->flip_addr;
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
 	int ret;
-	RING_LOCALS;
 
 	BUG_ON(!overlay->active);
 
@@ -390,11 +383,9 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
 					 int interruptible)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
 	struct drm_gem_object *obj;
 	u32 flip_addr;
 	int ret;
-	RING_LOCALS;
 
 	if (overlay->hw_wedged == HW_WEDGED)
 		return -EIO;
drivers/gpu/drm/i915/intel_ringbuffer.c +19 -5
index 65c540b..33e4fde 100644
@@ -185,6 +185,15 @@ static int init_render_ring(struct drm_device *dev,
 		return -EIO;
 	}
 
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		i915_kernel_lost_context(dev);
+	else {
+		ring->head = ring->get_head(dev, ring);
+		ring->tail = ring->get_tail(dev, ring);
+		ring->space = ring->head - (ring->tail + 8);
+		if (ring->space < 0)
+			ring->space += ring->size;
+	}
 	return 0;
 }
 
@@ -419,11 +428,16 @@ int intel_init_ring_buffer(struct drm_device *dev,
 		return ret;
 	}
 
-	ring->head = ring->get_head(dev, ring);
-	ring->tail = ring->get_tail(dev, ring);
-	ring->space = ring->head - (ring->tail + 8);
-	if (ring->space < 0)
-		ring->space += ring->size;
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		i915_kernel_lost_context(dev);
+	else {
+		ring->head = ring->get_head(dev, ring);
+		ring->tail = ring->get_tail(dev, ring);
+		ring->space = ring->head - (ring->tail + 8);
+		if (ring->space < 0)
+			ring->space += ring->size;
+	}
+
 	INIT_LIST_HEAD(&ring->active_list);
 	INIT_LIST_HEAD(&ring->request_list);
 	return ret;
Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/4 add BSD ring buffer support

In reply to Zou Nan hai

add BSD ring buffer support on GM45+ systems.
BSD (bit-stream-decoder) engine is a GPU engine for H.264/VC1 VLD decoding.

---
 drivers/gpu/drm/i915/i915_dma.c         |    2 +
 drivers/gpu/drm/i915/i915_drv.h         |    2 +
 drivers/gpu/drm/i915/i915_gem.c         |   76 ++--------
 drivers/gpu/drm/i915/i915_reg.h         |   16 ++
 drivers/gpu/drm/i915/intel_ringbuffer.c |  232 ++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/intel_ringbuffer.h |    6 +
 6 files changed, 252 insertions(+), 82 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +2 -0
index 88ec88c..063f355 100644
@@ -128,6 +128,8 @@ static int i915_dma_cleanup(struct drm_device * dev)
 		drm_irq_uninstall(dev);
 
 	intel_cleanup_ring_buffer(dev, &dev_priv->render_ring);
+	if (HAS_BSD(dev))
+		intel_cleanup_ring_buffer(dev, &dev_priv->bsd_ring);
 
 	/* Clear the HWS virtual address at teardown */
 	if (I915_NEED_GFX_HWS(dev))
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 83d6e9b..ee0a15e 100644
@@ -238,6 +238,7 @@ typedef struct drm_i915_private {
 
 	struct pci_dev *bridge_dev;
 	struct intel_ring_buffer render_ring;
+	struct intel_ring_buffer bsd_ring;
 
 
 	drm_dma_handle_t *status_page_dmah;
@@ -1120,6 +1121,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 			 (dev)->pci_device == 0x2A42 ||		\
 			 (dev)->pci_device == 0x2E42)
 
+#define HAS_BSD(dev)           (IS_IRONLAKE(dev) || IS_G4X(dev))
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
drivers/gpu/drm/i915/i915_gem.c +15 -61

101 lines not on this page · raw message

drivers/gpu/drm/i915/i915_reg.h +16 -0
index 527d30a..64f6bba 100644
@@ -324,6 +324,7 @@
 #define   I915_DEBUG_INTERRUPT				(1<<2)
 #define   I915_USER_INTERRUPT				(1<<1)
 #define   I915_ASLE_INTERRUPT				(1<<0)
+#define   I915_BSD_USER_INTERRUPT                      (1<<25)
 #define EIR		0x020b0
 #define EMR		0x020b4
 #define ESR		0x020b8
@@ -358,6 +359,18 @@
 #define BB_ADDR		0x02140 /* 8 bytes */
 #define GFX_FLSH_CNTL	0x02170 /* 915+ only */
 
+/*
+ * BSD (bit stream decoder instruction and interrupt control register defines
+ * (G4X and Ironlake only)
+ */
+
+#define BSD_RING_TAIL          0x04030
+#define BSD_RING_HEAD          0x04034
+#define BSD_RING_START         0x04038
+#define BSD_RING_CTL           0x0403c
+#define BSD_RING_ACTHD         0x04074
+#define BSD_HWS_PGA            0x04080
+
 
 /*
  * Framebuffer compression (915+ only)
@@ -2342,6 +2355,9 @@
 #define GT_SYNC_STATUS          (1 << 2)
 #define GT_USER_INTERRUPT       (1 << 0)
 
+#define GT_BSD_USER_INTERRUPT          (1 << 5)
+
+
 #define GTISR   0x44010
 #define GTIMR   0x44014
 #define GTIIR   0x44018
drivers/gpu/drm/i915/intel_ringbuffer.c +211 -21

293 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.h +6 -0
index e3b40d1..b1748b6 100644
@@ -10,6 +10,12 @@ struct  intel_hw_status_page {
 struct drm_i915_gem_execbuffer2;
 struct  intel_ring_buffer {
 	const char	*name;
+	struct		ring_regs {
+			u32 ctl;
+			u32 head;
+			u32 tail;
+			u32 start;
+	} regs;
 	unsigned int	ring_flag;	
 	unsigned long	size;
 	unsigned int  	alignment;
Signature · 1 line
1.7.1
#3 lore raw

PATCH 4/4 adapt intel_ring_buffer into gem

In reply to Zou Nan hai

remove single active_list amd request_list, seperate them into every intel_ring_buffer structure.
use a flag in execbuffer2 to decide on which ring to run the command
legacy ioctl are consider to run on render ring by default

---
 drivers/gpu/drm/i915/i915_debugfs.c   |   23 ++-
 drivers/gpu/drm/i915/i915_dma.c       |    4 +-
 drivers/gpu/drm/i915/i915_drv.c       |    5 +-
 drivers/gpu/drm/i915/i915_drv.h       |   64 ++----
 drivers/gpu/drm/i915/i915_gem.c       |  355 ++++++++++++++++++---------------
 drivers/gpu/drm/i915/i915_gem_debug.c |   11 +-
 drivers/gpu/drm/i915/i915_irq.c       |   98 ++++-----
 drivers/gpu/drm/i915/intel_overlay.c  |   45 +++--
 8 files changed, 322 insertions(+), 283 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +13 -10
index ea81ec1..7bf08c5 100644
@@ -76,7 +76,7 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
 	case ACTIVE_LIST:
 		seq_printf(m, "Active:\n");
 		lock = &dev_priv->mm.active_list_lock;
-		head = &dev_priv->mm.active_list;
+		head = &dev_priv->render_ring.active_list;
 		break;
 	case INACTIVE_LIST:
 		seq_printf(m, "Inactive:\n");
@@ -129,7 +129,8 @@ static int i915_gem_request_info(struct seq_file *m, void *data)
 	struct drm_i915_gem_request *gem_request;
 
 	seq_printf(m, "Request:\n");
-	list_for_each_entry(gem_request, &dev_priv->mm.request_list, list) {
+	list_for_each_entry(gem_request,
+			&dev_priv->render_ring.request_list, list) {
 		seq_printf(m, "    %d @ %d\n",
 			   gem_request->seqno,
 			   (int) (jiffies - gem_request->emitted_jiffies));
@@ -145,13 +146,14 @@ static int i915_gem_seqno_info(struct seq_file *m, void *data)
 
 	if (dev_priv->render_ring.status_page.page_addr != NULL) {
 		seq_printf(m, "Current sequence: %d\n",
-			   i915_get_gem_seqno(dev));
+			   i915_get_gem_seqno(dev, &dev_priv->render_ring));
 	} else {
 		seq_printf(m, "Current sequence: hws uninitialized\n");
 	}
 	seq_printf(m, "Waiter sequence:  %d\n",
-			dev_priv->mm.waiting_gem_seqno);
-	seq_printf(m, "IRQ sequence:     %d\n", dev_priv->mm.irq_gem_seqno);
+			dev_priv->render_ring.waiting_gem_seqno);
+	seq_printf(m, "IRQ sequence:     %d\n",
+			dev_priv->render_ring.irq_gem_seqno);
 	return 0;
 }
 
@@ -197,14 +199,14 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 		   atomic_read(&dev_priv->irq_received));
 	if (dev_priv->render_ring.status_page.page_addr != NULL) {
 		seq_printf(m, "Current sequence:    %d\n",
-			   i915_get_gem_seqno(dev));
+			   i915_get_gem_seqno(dev, &dev_priv->render_ring));
 	} else {
 		seq_printf(m, "Current sequence:    hws uninitialized\n");
 	}
 	seq_printf(m, "Waiter sequence:     %d\n",
-		   dev_priv->mm.waiting_gem_seqno);
+		   dev_priv->render_ring.waiting_gem_seqno);
 	seq_printf(m, "IRQ sequence:        %d\n",
-		   dev_priv->mm.irq_gem_seqno);
+		   dev_priv->render_ring.irq_gem_seqno);
 	return 0;
 }
 
@@ -287,7 +289,8 @@ static int i915_batchbuffer_info(struct seq_file *m, void *data)
 
 	spin_lock(&dev_priv->mm.active_list_lock);
 
-	list_for_each_entry(obj_priv, &dev_priv->mm.active_list, list) {
+	list_for_each_entry(obj_priv,
+			&dev_priv->render_ring.active_list, list) {
 		obj = obj_priv->obj;
 		if (obj->read_domains & I915_GEM_DOMAIN_COMMAND) {
 		    ret = i915_gem_object_get_pages(obj, 0);
@@ -682,7 +685,7 @@ i915_wedged_write(struct file *filp,
 
 	atomic_set(&dev_priv->mm.wedged, val);
 	if (val) {
-		DRM_WAKEUP(&dev_priv->irq_queue);
+		DRM_WAKEUP(&dev_priv->render_ring.irq_queue);
 		queue_work(dev_priv->wq, &dev_priv->error_work);
 	}
 
drivers/gpu/drm/i915/i915_dma.c +2 -2
index 063f355..0c0e1d7 100644
@@ -81,7 +81,8 @@ static void i915_free_hws(struct drm_device *dev)
 		dev_priv->status_page_dmah = NULL;
 	}
 
-	if (dev_priv->status_gfx_addr) {
+	if (dev_priv->render_ring.status_page.gfx_addr) {
+		dev_priv->render_ring.status_page.gfx_addr = 0;
 		dev_priv->status_gfx_addr = 0;
 		drm_core_ioremapfree(&dev_priv->hws_map, dev);
 	}
@@ -1616,7 +1617,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
 	spin_lock_init(&dev_priv->user_irq_lock);
 	spin_lock_init(&dev_priv->error_lock);
-	dev_priv->user_irq_refcount = 0;
 	dev_priv->trace_irq_seqno = 0;
 
 	ret = drm_vblank_init(dev, I915_NUM_PIPE);
drivers/gpu/drm/i915/i915_drv.c +4 -1
index be0f31b..a67680e 100644
@@ -339,7 +339,9 @@ int i965_reset(struct drm_device *dev, u8 flags)
 	/*
 	 * Clear request list
 	 */
-	i915_gem_retire_requests(dev);
+
+	i915_gem_retire_requests(dev, &dev_priv->render_ring);
+	i915_gem_retire_requests(dev, &dev_priv->bsd_ring);
 
 	if (need_display)
 		i915_save_display(dev);
@@ -388,6 +390,7 @@ int i965_reset(struct drm_device *dev, u8 flags)
 	 */
 	if (drm_core_check_feature(dev, DRIVER_MODESET) ||
 	    !dev_priv->mm.suspended) {
+
 		struct intel_ring_buffer *ring = &dev_priv->render_ring;
 		dev_priv->mm.suspended = 0;
 		ring->init(dev, ring);
drivers/gpu/drm/i915/i915_drv.h +22 -42

152 lines not on this page · raw message

drivers/gpu/drm/i915/i915_gem.c +198 -157

735 lines not on this page · raw message

drivers/gpu/drm/i915/i915_gem_debug.c +10 -1
index 35507cf..830680b 100644
@@ -106,12 +106,21 @@ i915_dump_lru(struct drm_device *dev, const char *where)
 
 	DRM_INFO("active list %s {\n", where);
 	spin_lock(&dev_priv->mm.active_list_lock);
-	list_for_each_entry(obj_priv, &dev_priv->mm.active_list,
+	list_for_each_entry(obj_priv, &dev_priv->render_ring.active_list,
 			    list)
 	{
 		DRM_INFO("    %p: %08x\n", obj_priv,
 			 obj_priv->last_rendering_seqno);
 	}
+
+	if (HAS_BSD(dev)) {
+		list_for_each_entry(obj_priv, &dev_priv->bsd_ring.active_list,
+				list)
+		{
+			DRM_INFO("    %p: %08x\n", obj_priv,
+				obj_priv->last_rendering_seqno);
+		}
+	}
 	spin_unlock(&dev_priv->mm.active_list_lock);
 	DRM_INFO("}\n");
 	DRM_INFO("flushing list %s {\n", where);
drivers/gpu/drm/i915/i915_irq.c +42 -56

224 lines not on this page · raw message

drivers/gpu/drm/i915/intel_overlay.c +31 -14

131 lines not on this page · raw message

Signature · 1 line
1.7.1
#4 lore raw
In reply to Zou Nan hai
Quoted 3 lines · Zou Nan hai

introduce intel_ring_buffer structure. sequential number, IRQ logic and hardware status page were included in the intel_ring_buffer structure

I tried to go apply this patch series once again. The first one actually applies now. The second produces massive rejects, whether I apply against linus master or drm-intel-next.

Please rebase against drm-intel-next, since that's where it will land.

I've gone ahead and merged master to -next now so that the final rebase of this patch series (I sure hope) can be well-tested on that branch with the PIPE_CONTROL fix.

And while you're fixing up the rebase to make sure it all works, a couple of fixes:

drivers/gpu/drm/i915/intel_ringbuffer.c line 2

Quoted 8 lines
drivers/gpu/drm/i915/intel_ringbuffer.c new file +2 -0
new file mode 100644
index 0000000..65c540b
@@ -0,0 +1,576 @@
+/*
+ * Copyright © 20010 Intel Corporation

It's 2010.

Quoted 21 lines
drivers/gpu/drm/i915/intel_ringbuffer.c new file +21 -0
+ * 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:
+ *    Zou Nan hai <[email protected]>

drivers/gpu/drm/i915/intel_ringbuffer.c line 34

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c new file +10 -0
+ *    Xiang Hai hao<[email protected]>
+ *
+ */
+#include "drmP.h"
+#include "drm.h"
+#include "i915_drv.h"
+#include "i915_drm.h"
+#include "i915_trace.h"
+
+#define I915_GEM_GPU_DOMAINS	(~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))

Common definitions should go in header files (i915_drv.h here).

Quoted 106 lines
drivers/gpu/drm/i915/intel_ringbuffer.h new file +100 -0
new file mode 100644
index 0000000..e3b40d1
@@ -0,0 +1,119 @@
+#ifndef _INTEL_RINGBUFFER_H_
+#define _INTEL_RINGBUFFER_H_
+
+struct  intel_hw_status_page {
+	void 		*page_addr;
+	unsigned int 	gfx_addr;
+	struct 		drm_gem_object *obj;
+};
+
+struct drm_i915_gem_execbuffer2;
+struct  intel_ring_buffer {
+	const char	*name;
+	unsigned int	ring_flag;	
+	unsigned long	size;
+	unsigned int  	alignment;
+	void 		*virtual_start;
+	struct		drm_device *dev;
+	struct 		drm_gem_object *gem_object;
+
+	unsigned int	head;
+	unsigned int 	tail;
+	unsigned int 	space;
+	u32		next_seqno;
+	struct intel_hw_status_page status_page;
+
+	u32		irq_gem_seqno; 		/* last seq seem at irq time */
+	u32		waiting_gem_seqno;
+	int		user_irq_refcount;
+	void		(*user_irq_get)(struct drm_device *dev, 
+			struct intel_ring_buffer *ring);
+	void		(*user_irq_put)(struct drm_device *dev, 
+			struct intel_ring_buffer *ring);
+	void		(*setup_status_page)(struct drm_device *dev,
+			struct	intel_ring_buffer *ring);
+
+	int		(*init)(struct drm_device *dev, 
+			struct intel_ring_buffer *ring);
+
+	unsigned int	(*get_head)(struct drm_device *dev,
+			struct intel_ring_buffer *ring);
+	unsigned int	(*get_tail)(struct drm_device *dev,
+			struct intel_ring_buffer *ring);
+	unsigned int	(*get_active_head)(struct drm_device *dev,
+			struct intel_ring_buffer *ring);
+	void		(*advance_ring)(struct drm_device *dev,
+			struct intel_ring_buffer *ring);
+	void 		(*flush)(struct drm_device *dev, 
+			struct intel_ring_buffer *ring,
+			u32	invalidate_domains,
+			u32	flush_domains);
+	u32		(*add_request)(struct drm_device *dev,
+			struct intel_ring_buffer *ring,
+			struct drm_file *file_priv,
+			u32 flush_domains);	
+	u32		(*get_gem_seqno)(struct drm_device *dev,
+			struct intel_ring_buffer *ring);
+	int 		(*dispatch_gem_execbuffer)(struct drm_device *dev,
+			struct intel_ring_buffer *ring,
+			struct drm_i915_gem_execbuffer2 *exec,
+			struct drm_clip_rect *cliprects,
+			uint64_t exec_offset);
+
+	/**
+	 * List of objects currently involved in rendering from the
+	 * ringbuffer.
+	 *
+	 * Includes buffers having the contents of their GPU caches
+	 * flushed, not necessarily primitives.  last_rendering_seqno
+	 * represents when the rendering involved will be completed.
+	 *
+	 * A reference is held on the buffer while on this list.
+	 */
+	struct list_head active_list;
+
+	/**
+	 * List of breadcrumbs associated with GPU requests currently
+	 * outstanding.
+	 */
+	struct list_head request_list;
+
+	wait_queue_head_t irq_queue;
+	drm_local_map_t map;
+};
+
+static inline u32 
+intel_read_status_page(struct intel_ring_buffer *ring,
+		int reg)
+{
+	u32 *regs = ring->status_page.page_addr;
+	return regs[reg];
+}
+
+int intel_init_ring_buffer(struct drm_device *dev,
+		struct intel_ring_buffer *ring);
+void intel_cleanup_ring_buffer(struct drm_device *dev,
+		struct intel_ring_buffer *ring);
+int intel_wait_ring_buffer(struct drm_device *dev,
+		struct intel_ring_buffer *ring, int n);
+int intel_wrap_ring_buffer(struct drm_device *dev, 
+		struct intel_ring_buffer *ring);

drivers/gpu/drm/i915/intel_ringbuffer.h line 110

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.h new file +10 -0
+void intel_ring_begin(struct drm_device *dev,
+		struct intel_ring_buffer *ring, int n);
+void intel_ring_emit(struct drm_device *dev,
+		struct intel_ring_buffer *ring, u32 data);
+void intel_fill_struct(struct drm_device *dev,
+		struct intel_ring_buffer *ring, 
+		void *data,
+		unsigned int len);
+void intel_ring_advance(struct drm_device *dev, 
+		struct intel_ring_buffer *ring);

Lots of trailing whitespace in this hunk.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Am 07.05.2010 23:34, schrieb Eric Anholt:

Quoted 10 lines · Zou Nan hai
Quoted 3 lines

introduce intel_ring_buffer structure. sequential number, IRQ logic and hardware status page were included in the intel_ring_buffer structure

I tried to go apply this patch series once again. The first one actually applies now. The second produces massive rejects, whether I apply against linus master or drm-intel-next.

Please rebase against drm-intel-next, since that's where it will land.

I'm glad I'm not the only one. I wanted to test the h264 decoding and actually managed to apply an old version of the first patch - but I also got the rejects on the second, thought it was my fault though, for using the wrong tree or so.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Zou Nan hai

Hi all,

Ok, here's my try at a review. Sorry for the rather long delay.

First things first, please put on your asbestos suits, this one's gonna be rough;) Second: Your patch is still a pain to review for the following reasons:

- IMHO you split-up made things worse: The completely rewritten render ring implementation is introduced in patch 1, but only really fully used when all 4 patches are applied. Now instead of hunting around in one monster patch (which was hard) I have to hunt around in four different patches to make sense of changes (rather impossible). Similarly other stuff is splattered all over the series, e.g. I've found definitions for the bsd ring in patch 1 instead of patch 3.

- Your doing tons of (at least at first glance) superfluously search&replaces. Yep, inconsistent naming is ugly, but patches bloated with tons of such changes are even uglier. Some examples:
s/ring/render_ring/ s/drm_i915_ring_buffer_t/intel_ring_buffer/
There are more. If you think these changes really are beneficial, please do one patch per s&r with nothing else in it.

Now for the more specific issues:

- In my previous review I've proposed to replace the gpu execution breadcrumb with something like this

struct intel_gpu_breadcrumb {                                                                                                
        uint32_t seqno : 30;                                                                                                 
	uint32_t domain : 2;                                                                                                 
}; 

Compared to your approach this doesn't waste a pointer per gem object. Further it can be used for execution domains like keeping track of pageflips (tossed around some ideas with Kristian on irc) or to batch up gtt chipset flushes (probably needed to make my i855 cache coherency stuff fast again). So yes, I'd like to see this.

- struct intel_ring_buffer looks massively overdesigned in your patch. I think a more lightweight approach that leaves as much as possible of the render ring implementation untouched (and doesn't move it around) is better for at least two reasons:
- Your abstraction requires quite a few automatic changes all over. This needlessly bloats the patch and makes finding the interesting stuff harder.
- Greatly reduced risk of introducing regressions.

There are also a few places that look rather fishy. Mostly I simply couldn't follow anymore what's going on due to the reasons laid out above. Anyway, here they are:

- You (seem to) move around kernel_lost_context. For a feature that's currently only supported for hw that was never supported with ums, this is either fishy or needs a big comment.

- In i915_gem_flush you simply flush both ringbuffers. Now either these two have independent caches (and only one needs to be flushed, gem is not supposed to do unnecessary flushes) or they are coherent and only one flush is required, period. Current code looks like it tries to paper over some coherency issues (and I've learned to loathe these buggers). Related to this: The active list gets split up between the to ringbuffers. The flushing list is still global. This looks inconsistent.

- I haven't found out how synchronization between the bsd and the render ringbuffer is handled. And if the answer is "userspace takes care" I'm not gonna like it.

With this off the table, I still have to do some venting ;) The idea behind splitting patches up is:
- to make life easier for reviewers. IHMO you've failed in that regard.
- to make bisecting regressions easy. Given that I've found gimmicks like

tatus_page_dmah->vaddr;
- memset(dev_priv->render_ring.status_page.page_addr
+ memset(dev_priv->render_ring.status_page.page_addr,

                        0, PAGE_SIZE);                                                                                       
        }

in your patches (note the re-added semicolon at the end) your patches definitely fail at that - they won't even compile in between. And it looks like other people have problems simply applying the patches, too.

So please take a tad bit more care when prepping patch series. Otherwise the hours (including thinking time) I've just put into this review feel kinda wasted.

For a _really_ nice patch series that was a joy to read, look no further than at Zhenyu Wang's recent connector rework (the patch series that got merged, _not_ the first submission - but that can serve as comparison).

Oh, one last thing: Given that libIntelXvMC seems to support vld (for mpeg2), why exactly do we need this?

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#7 lore raw

Hi,

Thanks for reviewing the patch.

To clarify,
This patch is used for H.264/VC1 decoding.
Abstract ring buffer is also needed for our later generation GPUs, Because there are more types of ring buffer to come.

H.264/VC1 HW decoding is a bigger requirement than mepg2. XvMC VLD can only support mpeg2. It is rendering in server context and lack of post processing features.
We are not going to support it later, our later media work will be based on vaapi.

Synchronize between BSD and render ring will be done by VAAPI client.

We have run Tons of video validation upon this patch.

Our QA will do 1-2 days of regression test on different chips each time I rebase and sent out the patch

Let's get simple code works first then we can optimize it. Thanks
Zou Nan hai

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]]
Sent: 2010年5月12日 6:24
To: Zou, Nanhai
Cc: Anholt, Eric; Intel GFX
Subject: Re: [Intel-gfx] [PATCH 1/4] introduce intel_ring_buffer structure

Hi all,

Ok, here's my try at a review. Sorry for the rather long delay.

First things first, please put on your asbestos suits, this one's gonna be rough;) Second: Your patch is still a pain to review for the following reasons:

- IMHO you split-up made things worse: The completely rewritten render ring implementation is introduced in patch 1, but only really fully used when all 4 patches are applied. Now instead of hunting around in one monster patch (which was hard) I have to hunt around in four different patches to make sense of changes (rather impossible). Similarly other stuff is splattered all over the series, e.g. I've found definitions for the bsd ring in patch 1 instead of patch 3.

- Your doing tons of (at least at first glance) superfluously search&replaces. Yep, inconsistent naming is ugly, but patches bloated with tons of such changes are even uglier. Some examples:
s/ring/render_ring/ s/drm_i915_ring_buffer_t/intel_ring_buffer/
There are more. If you think these changes really are beneficial, please do one patch per s&r with nothing else in it.

Now for the more specific issues:

- In my previous review I've proposed to replace the gpu execution breadcrumb with something like this

struct intel_gpu_breadcrumb {                                                                                                
        uint32_t seqno : 30;                                                                                                 
	uint32_t domain : 2;                                                                                                 
}; 

Compared to your approach this doesn't waste a pointer per gem object. Further it can be used for execution domains like keeping track of pageflips (tossed around some ideas with Kristian on irc) or to batch up gtt chipset flushes (probably needed to make my i855 cache coherency stuff fast again). So yes, I'd like to see this.

- struct intel_ring_buffer looks massively overdesigned in your patch. I think a more lightweight approach that leaves as much as possible of the render ring implementation untouched (and doesn't move it around) is better for at least two reasons:
- Your abstraction requires quite a few automatic changes all over. This needlessly bloats the patch and makes finding the interesting stuff harder.
- Greatly reduced risk of introducing regressions.

There are also a few places that look rather fishy. Mostly I simply couldn't follow anymore what's going on due to the reasons laid out above. Anyway, here they are:

- You (seem to) move around kernel_lost_context. For a feature that's currently only supported for hw that was never supported with ums, this is either fishy or needs a big comment.

- In i915_gem_flush you simply flush both ringbuffers. Now either these two have independent caches (and only one needs to be flushed, gem is not supposed to do unnecessary flushes) or they are coherent and only one flush is required, period. Current code looks like it tries to paper over some coherency issues (and I've learned to loathe these buggers). Related to this: The active list gets split up between the to ringbuffers. The flushing list is still global. This looks inconsistent.

- I haven't found out how synchronization between the bsd and the render ringbuffer is handled. And if the answer is "userspace takes care" I'm not gonna like it.

With this off the table, I still have to do some venting ;) The idea behind splitting patches up is:
- to make life easier for reviewers. IHMO you've failed in that regard.
- to make bisecting regressions easy. Given that I've found gimmicks like

tatus_page_dmah->vaddr;
- memset(dev_priv->render_ring.status_page.page_addr
+ memset(dev_priv->render_ring.status_page.page_addr,

                        0, PAGE_SIZE);                                                                                       
        }

in your patches (note the re-added semicolon at the end) your patches definitely fail at that - they won't even compile in between. And it looks like other people have problems simply applying the patches, too.

So please take a tad bit more care when prepping patch series. Otherwise the hours (including thinking time) I've just put into this review feel kinda wasted.

For a _really_ nice patch series that was a joy to read, look no further than at Zhenyu Wang's recent connector rework (the patch series that got merged, _not_ the first submission - but that can serve as comparison).

Oh, one last thing: Given that libIntelXvMC seems to support vld (for mpeg2), why exactly do we need this?

Yours, Daniel

Signature · 7 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Hi,

Quoted 7 lines · Nanhai

Thanks for reviewing the patch.

To clarify,
This patch is used for H.264/VC1 decoding.
Abstract ring buffer is also needed for our later generation GPUs, Because there are more types of ring buffer to come.

Quoted 5 lines

H.264/VC1 HW decoding is a bigger requirement than mepg2. XvMC VLD can only support mpeg2. It is rendering in server context and lack of post processing features.
We are not going to support it later, our later media work will be based on vaapi.

Ok, let me restate my question: Is there a strict hw requirement to use a second ring buffer? If not, what does this gain us?

I'm asking because:
- the XvMC implementation can use the media engine without a second ring buffer. Yep, I know that XvMC is only mpeg2, but that doesn't change the fact that the current kernel interface seems to be enough. An no, current XvMC doesn't issue batchbuffers in the Xorg context but in the client's process (like direct gl rendering).
- I've strolled through the ironlake docs and I didn't notice anything saying that bsd for mpeg4/vc1 needs a special ring buffer. Please correct me if I'm wrong.
- Even the old i815 laying around here has multiple ringbuffers with arbitration between them. The i915 drm module never used them. The added complexity simply doesn't pay.

So please explain the technical reasons we need this rather complex beast of code in the kernel?

Quoted 1 line

Synchronize between BSD and render ring will be done by VAAPI client.

As I've said, I'm not gonna like this answer. I still don't. gem is supposed to hide the asynchronous execution nature of gpus. It would be dead easy to add the required i915_gem_object_wait_for_rendering when switching ring buffers. You didn't do it and you don't deliver any explanation for not doing so. In other words, your code looks deliberately broken.

Quoted 3 lines

We have run Tons of video validation upon this patch.

Our QA will do 1-2 days of regression test on different chips each time I rebase and sent out the patch

Frankly, I don't care what your qa says about your patches. I measure code quality on the following levels:
1) Is it readable by mere humans? This also includes whether someone could make sense of it a few months down the road with git blame & friends. IMHO your patches fail at that for the outlined reasons.
2) Is it bisectable and nicely split up for regression testing? Your patches fail this, too.
3) Does it actually run on real hw?
Without 1) and 2) fulfilled, 3) (i.e. your qa work) doesn't matter, because these changes are not really supportable going forward.

Quoted 1 line

Let's get simple code works first then we can optimize it.

You probably noticed by now that I'm slightly pissed, so I apologize upfront for the harsh tone. Let me state my opinion in plain English:

Your patch series as-is is crap.

And I think the issues I've raised are not just "optimizations", but rather fundamental problems. So either you ignore me and I'll cease to review your patches. Or you start to fix your stuff and/or deliver decent rebuttals explaining why I'm wrong. And If you resend patches, please explain in the changelogs what you've changed since last submission (and why) and what you didn't change (and why).

Quoted 2 lines

Thanks
Zou Nan hai

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#9 lore raw

Hi all,

Quoted 2 lines · Daniel Vetter

So please explain the technical reasons we need this rather complex beast of code in the kernel?

Ok, I owe you my apologies (and a beer). I've read through the HD docs and it looks like bsd decoding for avc/vc1 can't be done without the bsd command stream. What a pain.

I'm currently crawling through the docs. It looks like we also need a new gpu domain (something like I915_GEM_DOMAIN_BSD) in addition to a new execution domain to properly support flushing and coherency. This way round my concerns about userspace synchronization and the flush-both-rings semantics would be void, too.

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#10 lore raw
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]]
Sent: 2010年5月14日 23:03
To: Zou, Nanhai
Cc: Daniel Vetter; Anholt, Eric; Intel GFX
Subject: Re: [Intel-gfx] [PATCH 1/4] introduce intel_ring_buffer structure

Hi all,

Quoted 8 lines
Quoted 8 lines · Daniel Vetter
Quoted 2 lines

So please explain the technical reasons we need this rather complex beast of code in the kernel?

Ok, I owe you my apologies (and a beer). I've read through the HD docs and it looks like bsd decoding for avc/vc1 can't be done without the bsd command stream. What a pain.

Never mind,
H.264 HW decoding is a huge amount of work,
I can image much more works needed later.
Gem may need some more changes if we continue to improve H.264 decoding work. e.g currently we found H.264 decoding used too much GPU memory cause 2 HD H.264 video decoding slow, we are tring optimize gem GPU memory usage.

Even some works we may do with current ring buffer, We'd better split it to maximum utilize GPU power.

E.g. on Gen6, we have blitter ring buffer. Though blitter can be done in render ring buffer, implement and using blitter may improve throughput.

Quoted 6 lines
Quoted 6 lines

I'm currently crawling through the docs. It looks like we also need a new gpu domain (something like I915_GEM_DOMAIN_BSD) in addition to a new execution domain to properly support flushing and coherency. This way round my concerns about userspace synchronization and the flush-both-rings semantics would be void, too.

Actually we have considered adding BSD_DOMAIN when we first design the patch, Synchronize BSD ring will done at mapping time of media ring buffer. Since BSD ring will always write, media ring will always read.
No multiple client need to refer to one ring buffer.

We decided to keep this simple at the beginning till we need to do some additional optimize on that.

We almost do not flush both rings in hot path. If you check the code, Flush both ring will only happen at slow path, e.g gpu_idle.

Thanks
Zou Nan hai

Quoted 5 lines
Quoted 5 lines

Yours, Daniel
--
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 8 lines · Nanhai

H.264 HW decoding is a huge amount of work,
I can image much more works needed later.
Gem may need some more changes if we continue to improve H.264 decoding work. e.g currently we found H.264 decoding used too much GPU memory cause 2 HD H.264 video decoding slow, we are tring optimize gem GPU memory usage.

Even some works we may do with current ring buffer, We'd better split it to maximum utilize GPU power.

You might want to try out the fair-lru-eviction patch by Chris Wilson. When you're pushing gtt usage to the limit, this should behave much better than the current code.

Quoted 10 lines

E.g. on Gen6, we have blitter ring buffer. Though blitter can be done in render ring buffer, implement and using blitter may improve throughput.

Quoted 6 lines
Quoted 6 lines

I'm currently crawling through the docs. It looks like we also need a new gpu domain (something like I915_GEM_DOMAIN_BSD) in addition to a new execution domain to properly support flushing and coherency. This way round my concerns about userspace synchronization and the flush-both-rings semantics would be void, too.

Quoted 4 lines

Actually we have considered adding BSD_DOMAIN when we first design the patch, Synchronize BSD ring will done at mapping time of media ring buffer. Since BSD ring will always write, media ring will always read.
No multiple client need to refer to one ring buffer.

Well, the bsd(write) -> render(read) is exactly the kind of cache coherency transition gem is supposed to handle. Differentiating between these two by the ring the object is sitting on looks hackish to me. We're not really short on bits for domains after all.

Quoted 4 lines

We decided to keep this simple at the beginning till we need to do some additional optimize on that.

We almost do not flush both rings in hot path. If you check the code, Flush both ring will only happen at slow path, e.g gpu_idle.

Add it to the list of things I've got wrong while trying to read your patches ;)

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#12 lore raw
In reply to Zou, Nanhai
Quoted 9 lines · Nanhai

Hi,

Thanks for reviewing the patch.

To clarify,
This patch is used for H.264/VC1 decoding.
Abstract ring buffer is also needed for our later generation GPUs, Because there are more types of ring buffer to come.

Quoted 5 lines

H.264/VC1 HW decoding is a bigger requirement than mepg2. XvMC VLD can only support mpeg2. It is rendering in server context and lack of post processing features.
We are not going to support it later, our later media work will be based on vaapi.

The need for the multiple rings is ring by me. I've checked the ironlake docs and I see how this works.

Quoted 2 lines

Synchronize between BSD and render ring will be done by VAAPI client.

On the other hand, I have a problem with this particular situation. Without a description of exactly how this works I can not be entirely sure, but this sounds very unsafe to me.

It looks almost like this is going the way of the DRI1 lock, where userland is in control of mutual exclusion. I'm glad those days are gone and I do not wish to go back there.

Look at the rework of xvmc, see how much cleaner it is when it uses GEM to arbitrate and control caches instead of trying to reinvent it badly in userland.

Also, (this again is just speculation since I can't see code for userland), doing this sync in userland means *unprivileged clients*, i.e. anyone in userland who can speak to the xserver, get the option to lock the gpu hard trivially. I know our protection against that isn't so good right now (I am mulling over ideas for how to fix this better), but openly depending on behaviour that allows this strikes me as wrong.

So, Nanhai, could you please explain how the synchronisation works in VAAPI? I'll have more comments when I can see how this fits and I see if it is in fact safe. As usual, seeing an interface without the user means you only get half the picture and makes review half useless at best.

Quoted 1 line

Let's get simple code works first then we can optimize it.

Let's make sure the interface is right before we event think about optimising it.

Cheers,

-0-

Signature · 2 lines
People will do tomorrow what they did today because that is what they
did yesterday.
#13 lore raw
Quoted 53 lines
Quoted 53 lines

-----Original Message-----
From: Owain Ainsworth [mailto:[email protected]]
Sent: 2010年5月15日 1:44
To: Zou, Nanhai
Cc: Daniel Vetter; Intel GFX; Anholt, Eric
Subject: Re: [Intel-gfx] [PATCH 1/4] introduce intel_ring_buffer structure

Quoted 9 lines · Nanhai

Hi,

Thanks for reviewing the patch.

To clarify,
This patch is used for H.264/VC1 decoding.
Abstract ring buffer is also needed for our later generation GPUs, Because there are more types of ring buffer to come.

Quoted 5 lines

H.264/VC1 HW decoding is a bigger requirement than mepg2. XvMC VLD can only support mpeg2. It is rendering in server context and lack of post processing features.
We are not going to support it later, our later media work will be based on vaapi.

The need for the multiple rings is ring by me. I've checked the ironlake docs and I see how this works.

Quoted 2 lines

Synchronize between BSD and render ring will be done by VAAPI client.

On the other hand, I have a problem with this particular situation. Without a description of exactly how this works I can not be entirely sure, but this sounds very unsafe to me.

It looks almost like this is going the way of the DRI1 lock, where userland is in control of mutual exclusion. I'm glad those days are gone and I do not wish to go back there.

Look at the rework of xvmc, see how much cleaner it is when it uses GEM to arbitrate and control caches instead of trying to reinvent it badly in userland.

Also, (this again is just speculation since I can't see code for userland), doing this sync in userland means *unprivileged clients*, i.e. anyone in userland who can speak to the xserver, get the option to lock the gpu hard trivially. I know our protection against that isn't so good right now (I am mulling over ideas for how to fix this better), but openly depending on behaviour that allows this strikes me as wrong.

So, Nanhai, could you please explain how the synchronisation works in VAAPI? I'll have more comments when I can see how this fits and I see if it is in fact safe. As usual, seeing an interface without the user means you only get half the picture and makes review half useless at best.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Let's get simple code works first then we can optimize it.

Let's make sure the interface is right before we event think about optimising it.

Cheers,

Hi,
You may check how user space works in VAAPI code, if you have an Ironlake system.
We have install guide at http://intellinuxgraphics.org/h264.html.
We have some customer requests for H.264 decoding, so we point to an early kernel and a similar patch on that page.

Actually no additional synchronize was add to user space, after BSD decoding is done, we map the BSD output for media pipe input command stream, at this point kernel will wait BSD decoding done before it begin media pipe.

so unprivileged client can not damage GPU with this.

Though this is not the most efficient way to do the work,

One of our optimize plan is to have double ring buffer for H.264 decoding later, e.g. while BSD is decoding to one buffer, media pipe may consume another buffer,

So media and BSD ring can work in parallel. Once we begin to do that, we may need to design a better synchronize method.

Thanks
Zou Nan hai

Quoted 4 lines
Quoted 4 lines

-0-
--
People will do tomorrow what they did today because that is what they did yesterday.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

Hi

Quoted 4 lines · Nanhai

You may check how user space works in VAAPI code, if you have an Ironlake system.
We have install guide at http://intellinuxgraphics.org/h264.html.
We have some customer requests for H.264 decoding, so we point to an
early kernel and a similar patch on that page.

I'll try this out. But likely takes a while till I get around - there's enough other stuff going on to keep me busy.

Quoted 7 lines

Actually no additional synchronize was add to user space, after BSD decoding is done, we map the BSD output for media pipe input command stream, at this point kernel will wait BSD decoding done before it begin media pipe.

so unprivileged client can not damage GPU with this.

Quoted 8 lines

Though this is not the most efficient way to do the work,

One of our optimize plan is to have double ring buffer for H.264 decoding later, e.g. while BSD is decoding to one buffer, media pipe may consume another buffer,

So media and BSD ring can work in parallel. Once we begin to do that, we may need to design a better synchronize method.

Well, that's exactly the problem. You simply can't optimize a kernel interface once it's in use. And if you try to, your users will get the pitchforks and scream bloody murder trying to get you ;) So we need to get these patches right (at least the semantics of the interface) beforehand.

Quoted 2 lines

Thanks
Zou Nan hai

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#15 lore raw
Quoted 35 lines
Quoted 35 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]]
Sent: 2010年5月18日 1:43
To: Zou, Nanhai
Cc: Owain Ainsworth; Daniel Vetter; Intel GFX; Anholt, Eric
Subject: Re: [Intel-gfx] [PATCH 1/4] introduce intel_ring_buffer structure

Hi

Quoted 1 line · Nanhai

You may check how user space works in VAAPI code, if you have an Ironlake

system.

Quoted 3 lines

We have install guide at http://intellinuxgraphics.org/h264.html.
We have some customer requests for H.264 decoding, so we point to an early kernel and a similar patch on that page.

I'll try this out. But likely takes a while till I get around - there's enough other stuff going on to keep me busy.

Quoted 15 lines

Actually no additional synchronize was add to user space, after BSD decoding is done, we map the BSD output for media pipe input command stream, at this point kernel will wait BSD decoding done before it begin media pipe.

so unprivileged client can not damage GPU with this.

Though this is not the most efficient way to do the work,

One of our optimize plan is to have double ring buffer for H.264 decoding later, e.g. while BSD is decoding to one buffer, media pipe may consume another buffer,

So media and BSD ring can work in parallel. Once we begin to do that, we may need to design a better synchronize method.

Quoted 8 lines
Quoted 8 lines

Well, that's exactly the problem. You simply can't optimize a kernel interface once it's in use. And if you try to, your users will get the pitchforks and scream bloody murder trying to get you ;) So we need to get these patches right (at least the semantics of the interface) beforehand.

Quoted 2 lines

Thanks
Zou Nan hai

Hi,
Since VAAPI will be the only client for this multi ring buffer for a period of time.
We may not have so much pain to optimize both kernel and user space.
This approach touches little user space interface, only 1 new flag is added to IOCTL.
We have new kinds of ring buffer to come in SandyBridge and later chips. Since we are still enabling SandyBridge. I can not for cast how those rings would be synchronized to each other. We may use minimum API to work first.

Quoted 5 lines
Quoted 5 lines

Yours, Daniel
--
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw
Quoted 9 lines · Nanhai
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]]
Sent: 2010年5月18日 1:43
Well, that's exactly the problem. You simply can't optimize a kernel interface once it's in use. And if you try to, your users will get the pitchforks and scream bloody murder trying to get you ;) So we need to get these patches right (at least the semantics of the interface) beforehand.

Quoted 9 lines

Hi,
Since VAAPI will be the only client for this multi ring buffer for a period of time. We may not have so much pain to optimize both kernel and user space. This approach touches little user space interface, only 1 new flag
is added to IOCTL. We have new kinds of ring buffer to come in
SandyBridge and later chips. Since we are still enabling SandyBridge. I can not for cast how those rings would be synchronized to each other. We may use minimum API to work first.

Be aware that you cannot expect users to bump both their userspace VAAPI library and their kernel at the same time; there are good reasons for this.

If you do tie the VAAPI library version and the kernel version too tightly together, you get into a position where users get upset - if I bump my kernel from 2.6.32 to 2.6.36 to get support for a new WiFi chipset and a new TV capture card, I'm likely to get quite upset if I then have to also respin my userspace.

There are also issues around bisection as a tool for isolating regressions - if I have to carefully bump userspace and kernel in lock-step, it's very difficult for me to bisect down until I find the changeset that broke things. As most of the bugs you'll get reported from users like me won't reproduce in your lab, making it harder for me to give you helpful information is not in your interests.

In conclusion, as Daniel's been saying, you must get the kernel interface mostly right first time. If it's too slow, a new interface to improve performance isn't hard to add in parallel to the old interface; if the old interface is a DoS vector or worse, you're going to get stuck in a very bad place.

Signature · 8 lines
Simon Farnsworth
Software Engineer
ONELAN Limited
http://www.onelan.com/
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw
Quoted 45 lines
Quoted 45 lines

-----Original Message-----
From: Simon Farnsworth [mailto:[email protected]]
Sent: 2010年5月19日 0:20
To: [email protected]
Cc: Zou, Nanhai; Daniel Vetter; Anholt, Eric
Subject: Re: [Intel-gfx] [PATCH 1/4] introduce intel_ring_buffer structure

Quoted 9 lines · Nanhai
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]]
Sent: 2010年5月18日 1:43
Well, that's exactly the problem. You simply can't optimize a kernel interface once it's in use. And if you try to, your users will get the pitchforks and scream bloody murder trying to get you ;) So we need to get these patches right (at least the semantics of the interface) beforehand.

Quoted 9 lines

Hi,
Since VAAPI will be the only client for this multi ring buffer for a period of time. We may not have so much pain to optimize both kernel and user space. This approach touches little user space interface, only 1 new flag
is added to IOCTL. We have new kinds of ring buffer to come in
SandyBridge and later chips. Since we are still enabling SandyBridge. I can not for cast how those rings would be synchronized to each other. We may use minimum API to work first.

Be aware that you cannot expect users to bump both their userspace VAAPI library and their kernel at the same time; there are good reasons for this.

If you do tie the VAAPI library version and the kernel version too tightly together, you get into a position where users get upset - if I bump my kernel from 2.6.32 to 2.6.36 to get support for a new WiFi chipset and a new TV capture card, I'm likely to get quite upset if I then have to also respin my userspace.

There are also issues around bisection as a tool for isolating regressions - if I have to carefully bump userspace and kernel in lock-step, it's very difficult for me to bisect down until I find the changeset that broke things. As
most of the bugs you'll get reported from users like me won't reproduce in your lab, making it harder for me to give you helpful information is not in your interests.

Quoted 6 lines
Quoted 6 lines

In conclusion, as Daniel's been saying, you must get the kernel interface mostly right first time. If it's too slow, a new interface to improve performance isn't hard to add in parallel to the old interface; if the old interface is a DoS vector or worse, you're going to get stuck in a very bad place.
--

Hi,
Currently we do not find any regression or slowness. We have been testing full HD video test along with regression tests for more than 1 month.
The only slowness we find now is with playing 2 1080p H.264 video. That was caused by too much GPU memory usage which is not related to the interface.

Thanks
Zou Nan hai

Quoted 4 lines
Quoted 4 lines

Simon Farnsworth
Software Engineer
ONELAN Limited
http://www.onelan.com/

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw
Quoted 5 lines · Nanhai

Currently we do not find any regression or slowness. We have been testing
full HD video test along with regression tests for more than 1 month. The only slowness we find now is with playing 2 1080p H.264 video. That was caused by too much GPU memory usage which is not related to the interface.

And are you utterly confident that if anyone finds a way to use your new ioctl to (e.g.) hang the GPU, stall rendering indefinitely waiting for media engine events that will never happen, or perhaps bypass system security, you can fix it without changing the ioctl interface to userspace? If not, you have a problem, and need to redesign the ioctl.

Bear in mind that I don't have to use VAAPI to call your ioctl; I can write evil code that calls it directly. On the other hand, you can't remove the ioctl later - users will want to use older VAAPI versions with new kernels, so that they can upgrade without too much fear of regression.

Signature · 4 lines
Simon Farnsworth
Software Engineer
ONELAN Limited
http://www.onelan.com/
#19 lore raw
Quoted 12 lines · Simon Farnsworth
Quoted 5 lines · Nanhai

Currently we do not find any regression or slowness. We have been testing
full HD video test along with regression tests for more than 1 month. The only slowness we find now is with playing 2 1080p H.264 video. That was caused by too much GPU memory usage which is not related to the interface.

And are you utterly confident that if anyone finds a way to use your new ioctl to (e.g.) hang the GPU, stall rendering indefinitely waiting for media engine events that will never happen, or perhaps bypass system security, you can fix it without changing the ioctl interface to userspace? If not, you have a problem, and need to redesign the ioctl.

Quoted 4 lines

Bear in mind that I don't have to use VAAPI to call your ioctl; I can write evil code that calls it directly. On the other hand, you can't remove the ioctl later - users will want to use older VAAPI versions with new kernels, so that they can upgrade without too much fear of regression.

OK, now you're going over the top. The GPU can't schedule[1], is turing complete, and you hand it programs. You can hang it with or without his interface. If you don't want to be able to do that, then don't let non-root use the DRI.

Our goal in designing kernel interfaces is to make sure that we get the best behavior we can. After clarifying the cache behavior of the BSD rendering (it all goes into the render cache, so if we're tracking which ring is producing the results, having objects only on one ring, and then tracking them in the one flushing list once they fall off a ring's active list), we can safely handle normal operation with a client dying in the middle. Also, userland is not having to manage caching differently from how userland already does in GEM. That was the part that was unclear before, so I think we're good to go.

[1] OK, there's support for scheduling of operations between rings at batch or packet boundaries. Not helping.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw
Quoted 1 line · Eric Anholt

On Wed, 19 May 2010 10:00:10 +0100, Simon Farnsworth

Quoted 11 lines · <[email protected]> wrote:
Quoted 5 lines

Bear in mind that I don't have to use VAAPI to call your ioctl; I can write evil code that calls it directly. On the other hand, you can't remove the ioctl later - users will want to use older VAAPI versions with new kernels, so that they can upgrade without too much fear of regression.

OK, now you're going over the top. The GPU can't schedule[1], is turing complete, and you hand it programs. You can hang it with or without his interface. If you don't want to be able to do that, then don't let non-root use the DRI.

Fair enough, and my apologies for going overboard - my intended point is that just because VAAPI is the only planned user of this ioctl doesn't mean that it's OK to get the userspace/kernel interface wrong.

Signature · 4 lines
Simon Farnsworth
Software Engineer
ONELAN Limited
http://www.onelan.com/