Change pdf_measure_text to account for the borders around characters

Prevously the true bounds of the glyph were used which didn't account
for the total area blocked out by a character

--- source/pdf/pdf-font.c
+++ source/pdf/pdf-font.c
@@ -177,6 +177,7 @@
 {
 	unsigned char *data;
 	unsigned int len;
+	FT_Face face;

 	fontname = clean_font_name(fontname);

@@ -188,6 +189,10 @@

 	if (!strcmp(fontname, "Symbol") || !strcmp(fontname, "ZapfDingbats"))
 		fontdesc->flags |= PDF_FD_SYMBOLIC;
+
+	face = fontdesc->font->ft_face;
+	fontdesc->ascent = 1000.0f * face->ascender / face->units_per_EM;
+	fontdesc->descent = 1000.0f * face->descender / face->units_per_EM;
 }

 static void
@@ -1149,6 +1154,12 @@
 	{
 		if (FT_IS_TRICKY(face) || is_dynalab(fontdesc->font->name))
 			fontdesc->font->ft_hint = 1;
+
+		if (fontdesc->ascent == 0.0f)
+			fontdesc->ascent = 1000.0f * face->ascender / face->units_per_EM;
+
+		if (fontdesc->descent == 0.0f)
+			fontdesc->descent = 1000.0f * face->descender / face->units_per_EM;
 	}
 }

@@ -1284,23 +1295,16 @@

 fz_rect *pdf_measure_text(fz_context *ctx, pdf_font_desc *fontdesc, unsigned char *buf, int len, fz_rect *acc)
 {
-	pdf_hmtx h;
-	int gid;
 	int i;
-	float x = 0.0;
-	fz_rect bbox;
-
-	*acc = fz_empty_rect;
+	int w = 0;
+
 	for (i = 0; i < len; i++)
-	{
-		gid = pdf_font_cid_to_gid(ctx, fontdesc, buf[i]);
-		h = pdf_lookup_hmtx(ctx, fontdesc, buf[i]);
-		fz_bound_glyph(ctx, fontdesc->font, gid, &fz_identity, &bbox);
-		bbox.x0 += x;
-		bbox.x1 += x;
-		fz_union_rect(acc, &bbox);
-		x += h.w / 1000.0;
-	}
+		w += pdf_lookup_hmtx(ctx, fontdesc, buf[i]).w;
+
+	acc->x0 = 0;
+	acc->x1 = w / 1000.0f;
+	acc->y0 = fontdesc->descent / 1000.0f;
+	acc->y1 = fontdesc->ascent / 1000.0f;

 	return acc;
 }


Choose the lastmost annotation rather than firstmost as mouse event target.

pdf_pass_event iterates through the annotations to find one with a
bounding box that encompasses the event point. We were choosing the first
found, whereas later annotations are considered above earlier ones so we
should be choosing the last found.

--- source/pdf/pdf-form.c
+++ source/pdf/pdf-form.c
@@ -532,7 +532,8 @@

 int pdf_pass_event(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_ui_event *ui_event)
 {
-	pdf_annot *annot;
+	pdf_annot *a;
+	pdf_annot *annot = NULL;
 	pdf_hotspot *hp = &doc->hotspot;
 	fz_point *pt = &(ui_event->event.pointer.pt);
 	int changed = 0;
@@ -541,12 +542,12 @@
 	if (page == NULL)
 		return 0;

-	for (annot = page->annots; annot; annot = annot->next)
-	{
-		bbox = pdf_bound_annot(ctx, annot);
+	for (a = page->annots; a; a = a->next)
+	{
+		bbox = pdf_bound_annot(ctx, a);
 		if (pt->x >= bbox.x0 && pt->x <= bbox.x1)
 			if (pt->y >= bbox.y0 && pt->y <= bbox.y1)
-				break;
+				annot = a;
 	}

 	/* Skip hidden annotations. */


Bug 106386 rid source of misspellings r=db48x sr=blake a=asa

--- dbm/src/hash.c
+++ dbm/src/hash.c
@@ -420,7 +420,7 @@

 #if !defined(_WIN32) && !defined(_WINDOWS) && !defined(macintosh) && !defined(VMS) && !defined(XP_OS2)
 #if defined(__QNX__) && !defined(__QNXNTO__)
-		hashp->BSIZE = 512; /* prefered blk size on qnx4 */
+		hashp->BSIZE = 512; /* preferred blk size on qnx4 */
 #else
 		hashp->BSIZE = statbuf.st_blksize;
 #endif


MFC: Label the apic timer interrupt as 'cpuN: timer' like on i386

--- sys/amd64/amd64/local_apic.c
+++ sys/amd64/amd64/local_apic.c
@@ -312,7 +312,7 @@

 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
-	snprintf(buf, sizeof(buf), "lapic%d: timer", lapic_id());
+	snprintf(buf, sizeof(buf), "cpu%d: timer", lapic_id());
 	intrcnt_add(buf, &la->la_timer_count);
 	if (PCPU_GET(cpuid) != 0) {
 		KASSERT(lapic_timer_period != 0, ("lapic%u: zero divisor",


linux: more cleanup on DMA mapping code

linux: more cleanup on DMA mapping code

--- sys/dev/netmap/netmap_kern.h
+++ sys/dev/netmap/netmap_kern.h
@@ -1653,71 +1653,11 @@
 int nm_iommu_group_id(bus_dma_tag_t dev);
 #include <linux/dma-mapping.h>

-static inline int
-netmap_load_map(struct netmap_adapter *na,
-	bus_dma_tag_t tag, bus_dmamap_t map, void *buf, u_int size)
-{
-	if (map) {
-		*map = dma_map_single(na->pdev, buf, size,
-				      DMA_BIDIRECTIONAL);
-		if (dma_mapping_error(na->pdev, *map)) {
-			*map = 0;
-			return ENOMEM;
-		}
-	}
-	return 0;
-}
-
-static inline void
-netmap_unload_map(struct netmap_adapter *na,
-	bus_dma_tag_t tag, bus_dmamap_t map, u_int sz)
-{
-	if (*map) {
-		dma_unmap_single(na->pdev, *map, sz,
-				 DMA_BIDIRECTIONAL);
-	}
-}
-
-static inline void
-netmap_sync_map(struct netmap_adapter *na,
-	bus_dma_tag_t tag, bus_dmamap_t map, u_int sz, enum txrx t)
-{
-	if (*map) {
-		if (t == NR_RX)
-			dma_sync_single_for_cpu(na->pdev, *map, sz,
-					DMA_FROM_DEVICE);
-		else
-			dma_sync_single_for_device(na->pdev, *map, sz,
-					DMA_TO_DEVICE);
-	}
-}
-
-static inline void
-netmap_reload_map(struct netmap_adapter *na,
-	bus_dma_tag_t tag, bus_dmamap_t map, void *buf)
-{
-	u_int sz = NETMAP_BUF_SIZE(na);
-
-	if (*map) {
-		dma_unmap_single(na->pdev, *map, sz,
-				DMA_BIDIRECTIONAL);
-	}
-
-	*map = dma_map_single(na->pdev, buf, sz,
-				DMA_BIDIRECTIONAL);
-}
-
-/*
- * XXX How do we redefine these functions:
- *
+/*
  * on linux we need
  *	dma_map_single(&pdev->dev, virt_addr, len, direction)
- *	dma_unmap_single(&adapter->pdev->dev, phys_addr, len, direction
- * The len can be implicit (on netmap it is NETMAP_BUF_SIZE)
- * unfortunately the direction is not, so we need to change
- * something to have a cross API
- */
-
+ *	dma_unmap_single(&adapter->pdev->dev, phys_addr, len, direction)
+ */
 #if 0
 	struct e1000_buffer *buffer_info =  &tx_ring->buffer_info[l];
 	/* set time_stamp *before* dma to help avoid a possible race */
@@ -1740,10 +1680,59 @@

 #endif

-/*
- * The bus_dmamap_sync() can be one of wmb() or rmb() depending on direction.
- */
-#define bus_dmamap_sync(_a, _b, _c)
+static inline int
+netmap_load_map(struct netmap_adapter *na,
+	bus_dma_tag_t tag, bus_dmamap_t map, void *buf, u_int size)
+{
+	if (map) {
+		*map = dma_map_single(na->pdev, buf, size,
+				      DMA_BIDIRECTIONAL);
+		if (dma_mapping_error(na->pdev, *map)) {
+			*map = 0;
+			return ENOMEM;
+		}
+	}
+	return 0;
+}
+
+static inline void
+netmap_unload_map(struct netmap_adapter *na,
+	bus_dma_tag_t tag, bus_dmamap_t map, u_int sz)
+{
+	if (*map) {
+		dma_unmap_single(na->pdev, *map, sz,
+				 DMA_BIDIRECTIONAL);
+	}
+}
+
+static inline void
+netmap_sync_map(struct netmap_adapter *na,
+	bus_dma_tag_t tag, bus_dmamap_t map, u_int sz, enum txrx t)
+{
+	if (*map) {
+		if (t == NR_RX)
+			dma_sync_single_for_cpu(na->pdev, *map, sz,
+					DMA_FROM_DEVICE);
+		else
+			dma_sync_single_for_device(na->pdev, *map, sz,
+					DMA_TO_DEVICE);
+	}
+}
+
+static inline void
+netmap_reload_map(struct netmap_adapter *na,
+	bus_dma_tag_t tag, bus_dmamap_t map, void *buf)
+{
+	u_int sz = NETMAP_BUF_SIZE(na);
+
+	if (*map) {
+		dma_unmap_single(na->pdev, *map, sz,
+				DMA_BIDIRECTIONAL);
+	}
+
+	*map = dma_map_single(na->pdev, buf, sz,
+				DMA_BIDIRECTIONAL);
+}

 #endif /* linux */


[ptnetmap] cleanup netmap_mem2.c

[ptnetmap] cleanup netmap_mem2.c

--- sys/dev/netmap/netmap_mem2.c
+++ sys/dev/netmap/netmap_mem2.c
@@ -76,6 +76,7 @@
 	u_int size;
 	u_int num;
 };
+
 struct netmap_obj_pool {
 	char name[NETMAP_POOL_MAX_NAMSZ];	/* name of the allocator */

@@ -121,8 +122,8 @@

 	vm_paddr_t (*nmd_ofstophys)(struct netmap_mem_d *, vm_ooffset_t);
 	int (*nmd_config)(struct netmap_mem_d *);
-	int (*nmd_finalize)(struct netmap_mem_d *, struct netmap_adapter *);
-	void (*nmd_deref)(struct netmap_mem_d *, struct netmap_adapter *);
+	int (*nmd_finalize)(struct netmap_mem_d *);
+	void (*nmd_deref)(struct netmap_mem_d *);
 	ssize_t  (*nmd_if_offset)(struct netmap_mem_d *, const void *vaddr);
 	void (*nmd_delete)(struct netmap_mem_d *);

@@ -285,7 +286,7 @@
 	if (nm_mem_assign_group(nmd, na->pdev) < 0) {
 		return ENOMEM;
 	} else {
-		nmd->lasterr = nmd->ops->nmd_finalize(nmd, na);
+		nmd->lasterr = nmd->ops->nmd_finalize(nmd);
 	}

 	if (!nmd->lasterr && na->pdev)
@@ -300,7 +301,7 @@
 	NMA_LOCK(nmd);
 	netmap_mem_unmap(&nmd->pools[NETMAP_BUF_POOL], na);
 	NMA_UNLOCK(nmd);
-	return nmd->ops->nmd_deref(nmd, na);
+	return nmd->ops->nmd_deref(nmd);
 }

@@ -447,8 +448,9 @@
 DECLARE_SYSCTLS(NETMAP_RING_POOL, ring);
 DECLARE_SYSCTLS(NETMAP_BUF_POOL, buf);

-static int
-_nm_mem_assign_id(struct netmap_mem_d *nmd)
+/* call with NMA_LOCK(&nm_mem) held */
+static int
+nm_mem_assign_id_locked(struct netmap_mem_d *nmd)
 {
 	nm_memid_t id;
 	struct netmap_mem_d *scan = netmap_last_mem_d;
@@ -475,13 +477,14 @@
 	return error;
 }

+/* call with NMA_LOCK(&nm_mem) *not* held */
 static int
 nm_mem_assign_id(struct netmap_mem_d *nmd)
 {
         int ret;

 	NMA_LOCK(&nm_mem);
-        ret = _nm_mem_assign_id(nmd);
+        ret = nm_mem_assign_id_locked(nmd);
 	NMA_UNLOCK(&nm_mem);

 	return ret;
@@ -1020,7 +1023,6 @@

 	return 0;
 }
-

 static struct lut_entry *
 nm_alloc_lut(u_int nobj)
@@ -1289,7 +1291,7 @@
 }

 static int
-netmap_mem_private_finalize(struct netmap_mem_d *nmd, struct netmap_adapter *na)
+netmap_mem_private_finalize(struct netmap_mem_d *nmd)
 {
 	int err;
 	NMA_LOCK(nmd);
@@ -1301,7 +1303,7 @@
 }

 static void
-netmap_mem_private_deref(struct netmap_mem_d *nmd, struct netmap_adapter *na)
+netmap_mem_private_deref(struct netmap_mem_d *nmd)
 {
 	NMA_LOCK(nmd);
 	if (--nmd->active <= 0)
@@ -1439,7 +1441,7 @@
 }

 static int
-netmap_mem_global_finalize(struct netmap_mem_d *nmd, struct netmap_adapter *na)
+netmap_mem_global_finalize(struct netmap_mem_d *nmd)
 {
 	int err;

@@ -1682,7 +1684,7 @@
 }

 static void
-netmap_mem_global_deref(struct netmap_mem_d *nmd, struct netmap_adapter *na)
+netmap_mem_global_deref(struct netmap_mem_d *nmd)
 {

 	nmd->active--;
@@ -1723,7 +1725,7 @@
 };

 #ifdef WITH_PTNETMAP_GUEST
-/* ptnetmap allocator */
+/* allocator for ptnetmap guest */
 struct netmap_mem_ptg {
 	struct netmap_mem_d up;

@@ -1839,13 +1841,13 @@
 netmap_mem_pt_guest_config(struct netmap_mem_d *nmd)
 {
 	/* nothing to do, we are configured on creation
- 	 * and configuration never changes thereafter
- 	 */
+	 * and configuration never changes thereafter
+	 */
 	return 0;
 }

 static int
-netmap_mem_pt_guest_finalize(struct netmap_mem_d *nmd, struct netmap_adapter *na)
+netmap_mem_pt_guest_finalize(struct netmap_mem_d *nmd)
 {
 	struct netmap_mem_ptg *pv = (struct netmap_mem_ptg *)nmd;
 	int error = 0;
@@ -1882,15 +1884,14 @@
 }

 static void
-netmap_mem_pt_guest_deref(struct netmap_mem_d *nmd, struct netmap_adapter *na)
+netmap_mem_pt_guest_deref(struct netmap_mem_d *nmd)
 {
 	struct netmap_mem_ptg *pv = (struct netmap_mem_ptg *)nmd;

 	NMA_LOCK(nmd);
 	nmd->active--;
 	if (nmd->active <= 0 &&
-	   	(nmd->flags & NETMAP_MEM_FINALIZED))
-	{
+		(nmd->flags & NETMAP_MEM_FINALIZED)) {
 	    nmd->flags  &= ~NETMAP_MEM_FINALIZED;
 	    /* unmap ptnetmap-memdev memory */
 	    if (pv->ptn_dev) {
@@ -1942,7 +1943,6 @@
 static void
 netmap_mem_pt_guest_if_delete(struct netmap_adapter *na, struct netmap_if *nifp)
 {
-        /* TODO-ste remove?? */
 	struct netmap_pt_guest_adapter *ptna = (struct netmap_pt_guest_adapter *) na;
 	struct ifnet *ifp = ptna->hwup.up.ifp;

@@ -1990,13 +1990,12 @@
 static void
 netmap_mem_pt_guest_rings_delete(struct netmap_adapter *na)
 {
-        /* TODO-ste remove?? */
+        /* TODO: remove?? */
 	/*
 	struct netmap_mem_ptg *pv = (struct netmap_mem_ptg *)na->nm_mem;
 	struct netmap_pt_guest_adapter *ptna = (struct netmap_pt_guest_adapter *) na;
 	struct ifnet *ifp = ptna->hwup.up.ifp;
 	*/
-	D("");
 }

@@ -2024,7 +2023,7 @@
 	struct netmap_mem_d *scan = netmap_last_mem_d;

 	do {
-		/* check ptnetmap allocator */
+		/* find ptnetmap allocator through host ID */
 		if (scan->ops->nmd_deref == netmap_mem_pt_guest_deref &&
 			((struct netmap_mem_ptg *)(scan))->nm_host_id == host_id) {
 			mem = scan;
@@ -2036,7 +2035,7 @@
 	return mem;
 }

-/* call with lock held */
+/* call with NMA_LOCK(&nm_mem) held */
 static struct netmap_mem_d *
 netmap_mem_pt_guest_create(nm_memid_t host_id)
 {
@@ -2054,7 +2053,7 @@
 	pv->nm_host_id = host_id;

         /* Assign new id in the guest. We have the lock. */
-	err = _nm_mem_assign_id(&pv->up);
+	err = nm_mem_assign_id_locked(&pv->up);
 	if (err)
 		goto error;

@@ -2094,6 +2093,9 @@
 	return nmd;
 }

+/*
+ * Called when ptnetmap device (virtio/e1000) is attaching
+ */
 struct netmap_mem_d *
 netmap_mem_pt_guest_new(struct ifnet *ifp,
 		struct netmap_pt_guest_ops *pv_ops)
@@ -2105,9 +2107,9 @@
 		return NULL;

 	/* get the host id allocator */
-        /* TODO-ste: put in the csb */
 	host_id = pv_ops->nm_ptctl(ifp, NET_PARAVIRT_PTCTL_HOSTMEMID);

+	/* find host id in guest allocators */
 	NMA_LOCK(&nm_mem);
 	nmd = netmap_mem_pt_guest_find_hostid(host_id);
 	if (nmd == NULL) {
@@ -2115,7 +2117,6 @@
 	}
 	NMA_UNLOCK(&nm_mem);

-	/* find host id in guest allocators */
 	return nmd;
 }


Add some more codec IDs.

Add some more codec IDs.

--- sys/dev/sound/pci/hda/hdac.c
+++ sys/dev/sound/pci/hda/hdac.c
@@ -619,10 +619,14 @@
 #define HDA_CODEC_ALC267	HDA_CODEC_CONSTRUCT(REALTEK, 0x0267)
 #define HDA_CODEC_ALC268	HDA_CODEC_CONSTRUCT(REALTEK, 0x0268)
 #define HDA_CODEC_ALC269	HDA_CODEC_CONSTRUCT(REALTEK, 0x0269)
+#define HDA_CODEC_ALC270	HDA_CODEC_CONSTRUCT(REALTEK, 0x0270)
 #define HDA_CODEC_ALC272	HDA_CODEC_CONSTRUCT(REALTEK, 0x0272)
+#define HDA_CODEC_ALC273	HDA_CODEC_CONSTRUCT(REALTEK, 0x0273)
+#define HDA_CODEC_ALC275	HDA_CODEC_CONSTRUCT(REALTEK, 0x0275)
 #define HDA_CODEC_ALC660	HDA_CODEC_CONSTRUCT(REALTEK, 0x0660)
 #define HDA_CODEC_ALC662	HDA_CODEC_CONSTRUCT(REALTEK, 0x0662)
 #define HDA_CODEC_ALC663	HDA_CODEC_CONSTRUCT(REALTEK, 0x0663)
+#define HDA_CODEC_ALC665	HDA_CODEC_CONSTRUCT(REALTEK, 0x0665)
 #define HDA_CODEC_ALC861	HDA_CODEC_CONSTRUCT(REALTEK, 0x0861)
 #define HDA_CODEC_ALC861VD	HDA_CODEC_CONSTRUCT(REALTEK, 0x0862)
 #define HDA_CODEC_ALC880	HDA_CODEC_CONSTRUCT(REALTEK, 0x0880)
@@ -632,6 +636,7 @@
 #define HDA_CODEC_ALC887	HDA_CODEC_CONSTRUCT(REALTEK, 0x0887)
 #define HDA_CODEC_ALC888	HDA_CODEC_CONSTRUCT(REALTEK, 0x0888)
 #define HDA_CODEC_ALC889	HDA_CODEC_CONSTRUCT(REALTEK, 0x0889)
+#define HDA_CODEC_ALC892	HDA_CODEC_CONSTRUCT(REALTEK, 0x0892)
 #define HDA_CODEC_ALCXXXX	HDA_CODEC_CONSTRUCT(REALTEK, 0xffff)

 /* Analog Devices */
@@ -735,6 +740,7 @@
 #define HDA_CODEC_CX20551	HDA_CODEC_CONSTRUCT(CONEXANT, 0x5047)
 #define HDA_CODEC_CX20561	HDA_CODEC_CONSTRUCT(CONEXANT, 0x5051)
 #define HDA_CODEC_CX20582	HDA_CODEC_CONSTRUCT(CONEXANT, 0x5066)
+#define HDA_CODEC_CX20583	HDA_CODEC_CONSTRUCT(CONEXANT, 0x5067)
 #define HDA_CODEC_CXXXXX	HDA_CODEC_CONSTRUCT(CONEXANT, 0xffff)

 /* VIA */
@@ -805,7 +811,8 @@
 #define HDA_CODEC_INTELG45_1	HDA_CODEC_CONSTRUCT(INTEL, 0x2801)
 #define HDA_CODEC_INTELG45_2	HDA_CODEC_CONSTRUCT(INTEL, 0x2802)
 #define HDA_CODEC_INTELG45_3	HDA_CODEC_CONSTRUCT(INTEL, 0x2803)
-#define HDA_CODEC_INTELG45_4	HDA_CODEC_CONSTRUCT(INTEL, 0x29fb)
+#define HDA_CODEC_INTELG45_4	HDA_CODEC_CONSTRUCT(INTEL, 0x2804)
+#define HDA_CODEC_INTELG45_5	HDA_CODEC_CONSTRUCT(INTEL, 0x29fb)
 #define HDA_CODEC_INTELQ57	HDA_CODEC_CONSTRUCT(INTEL, 0x0054)
 #define HDA_CODEC_INTELXXXX	HDA_CODEC_CONSTRUCT(INTEL, 0xffff)

@@ -821,10 +828,14 @@
 	{ HDA_CODEC_ALC267,    "Realtek ALC267" },
 	{ HDA_CODEC_ALC268,    "Realtek ALC268" },
 	{ HDA_CODEC_ALC269,    "Realtek ALC269" },
+	{ HDA_CODEC_ALC270,    "Realtek ALC270" },
 	{ HDA_CODEC_ALC272,    "Realtek ALC272" },
+	{ HDA_CODEC_ALC273,    "Realtek ALC273" },
+	{ HDA_CODEC_ALC275,    "Realtek ALC275" },
 	{ HDA_CODEC_ALC660,    "Realtek ALC660" },
 	{ HDA_CODEC_ALC662,    "Realtek ALC662" },
 	{ HDA_CODEC_ALC663,    "Realtek ALC663" },
+	{ HDA_CODEC_ALC665,    "Realtek ALC665" },
 	{ HDA_CODEC_ALC861,    "Realtek ALC861" },
 	{ HDA_CODEC_ALC861VD,  "Realtek ALC861-VD" },
 	{ HDA_CODEC_ALC880,    "Realtek ALC880" },
@@ -834,6 +845,7 @@
 	{ HDA_CODEC_ALC887,    "Realtek ALC887" },
 	{ HDA_CODEC_ALC888,    "Realtek ALC888" },
 	{ HDA_CODEC_ALC889,    "Realtek ALC889" },
+	{ HDA_CODEC_ALC892,    "Realtek ALC892" },
 	{ HDA_CODEC_AD1882,    "Analog Devices AD1882" },
 	{ HDA_CODEC_AD1882A,   "Analog Devices AD1882A" },
 	{ HDA_CODEC_AD1883,    "Analog Devices AD1883" },
@@ -907,6 +919,7 @@
 	{ HDA_CODEC_CX20551,   "Conexant CX20551 (Waikiki)" },
 	{ HDA_CODEC_CX20561,   "Conexant CX20561 (Hermosa)" },
 	{ HDA_CODEC_CX20582,   "Conexant CX20582 (Pebble)" },
+	{ HDA_CODEC_CX20583,   "Conexant CX20583 (Pebble HSF)" },
 	{ HDA_CODEC_VT1708_8,  "VIA VT1708_8" },
 	{ HDA_CODEC_VT1708_9,  "VIA VT1708_9" },
 	{ HDA_CODEC_VT1708_A,  "VIA VT1708_A" },
@@ -966,6 +979,7 @@
 	{ HDA_CODEC_INTELG45_2, "Intel G45 HDMI" },
 	{ HDA_CODEC_INTELG45_3, "Intel G45 HDMI" },
 	{ HDA_CODEC_INTELG45_4, "Intel G45 HDMI" },
+	{ HDA_CODEC_INTELG45_5, "Intel G45 HDMI" },
 	{ HDA_CODEC_INTELQ57, "Intel Q57 HDMI" },
 	{ HDA_CODEC_SII1390,   "Silicon Image SiI1390 HDMI" },
 	{ HDA_CODEC_SII1392,   "Silicon Image SiI1392 HDMI" },


uart: Do not turn off module if using UART3 for debug

This also fixes the warning "control reaches end of non-void function".

Signed-off-by: Francois Berder <0eabc3e9da54407da074ac08d4217d54f5b94915@imgtec.com>

--- src/core/uart.c
+++ src/core/uart.c
@@ -236,6 +236,9 @@
     else
         UART_SET_INPUT(previous_uart_handler);

+    /* If used for debug, do not turn off module */
+    return 0;
+#endif
     /* Disable interrupts */
     IEC1CLR = _IEC1_U3EIE_MASK | _IEC2_U3TXIE_MASK | _IEC1_U3RXIE_MASK;
     IFS1CLR = _IFS1_U3EIF_MASK | _IFS2_U3TXIF_MASK | _IFS1_U3RXIF_MASK;
@@ -247,6 +250,4 @@
     U3STA = 0;

     return 0;
-#endif
-}
-
+}


cogl-pango-render: Add the base texture to the display list

When rendering a glyph from a texture, instead of adding the glyph's
texture handle to the display list it now retrieves the base texture
using _cogl_texture_foreach_subtexture_in_region and adds that
instead. That way the display can recognise that glyphs in the global
atlas are sharing the same texture and combine them into one VBO.

--- pango/cogl-pango-render.c
+++ pango/cogl-pango-render.c
@@ -35,6 +35,7 @@
 #include <cairo.h>

 #include "cogl/cogl-debug.h"
+#include "cogl/cogl-texture-private.h"
 #include "cogl-pango-private.h"
 #include "cogl-pango-glyph-cache.h"
 #include "cogl-pango-display-list.h"
@@ -85,26 +86,65 @@
 static void
 _cogl_pango_ensure_glyph_cache_for_layout_line (PangoLayoutLine *line);

+typedef struct
+{
+  CoglPangoDisplayList *display_list;
+  float x1, y1, x2, y2;
+} CoglPangoRendererSliceCbData;
+
+void
+cogl_pango_renderer_slice_cb (CoglHandle handle,
+                              const float *slice_coords,
+                              const float *virtual_coords,
+                              void *user_data)
+{
+  CoglPangoRendererSliceCbData *data = user_data;
+
+  /* Note: this assumes that there is only one slice containing the
+     whole texture and it doesn't attempt to split up the vertex
+     coordinates based on the virtual_coords */
+
+  _cogl_pango_display_list_add_texture (data->display_list,
+                                        handle,
+                                        data->x1,
+                                        data->y1,
+                                        data->x2,
+                                        data->y2,
+                                        slice_coords[0],
+                                        slice_coords[1],
+                                        slice_coords[2],
+                                        slice_coords[3]);
+}
+
 static void
 cogl_pango_renderer_draw_glyph (CoglPangoRenderer        *priv,
                                 CoglPangoGlyphCacheValue *cache_value,
                                 float                     x1,
                                 float                     y1)
 {
-  float x2, y2;
+  CoglPangoRendererSliceCbData data;

   g_return_if_fail (priv->display_list != NULL);

-  x2 = x1 + (float) cache_value->draw_width;
-  y2 = y1 + (float) cache_value->draw_height;
-
-  _cogl_pango_display_list_add_texture (priv->display_list,
-                                        cache_value->texture,
-                                        x1, y1, x2, y2,
-                                        cache_value->tx1,
-                                        cache_value->ty1,
-                                        cache_value->tx2,
-                                        cache_value->ty2);
+  data.display_list = priv->display_list;
+  data.x1 = x1;
+  data.y1 = y1;
+  data.x2 = x1 + (float) cache_value->draw_width;
+  data.y2 = y1 + (float) cache_value->draw_height;
+
+  /* We iterate the internal sub textures of the texture so that we
+     can get a pointer to the base texture even if the texture is in
+     the global atlas. That way the display list can recognise that
+     the neighbouring glyphs are coming from the same atlas and bundle
+     them together into a single VBO */
+
+  _cogl_texture_foreach_sub_texture_in_region (cache_value->texture,
+                                               cache_value->tx1,
+                                               cache_value->ty1,
+                                               cache_value->tx2,
+                                               cache_value->ty2,
+                                               cogl_pango_renderer_slice_cb,
+                                               &data);
 }

 static void cogl_pango_renderer_finalize (GObject *object);


Add a comment that says it looks like lucent cards have a primary
firmware revision as well (not sure which firmware versions are needed
for this, but the 6.x and 8.x 'software' versions that I have seem to
support it).

Add dBm comm quality RID.  This is like the normal comm quality rid,
except the signal and noise numbers are normalized to dBm.  Some
revisions of the prism firmware, however, don't support this RID, and
some that do support it return 0 for quality and/or noise.  Your
milage may vary.

--- sys/dev/wi/if_wavelan_ieee.h
+++ sys/dev/wi/if_wavelan_ieee.h
@@ -279,6 +279,7 @@
  */
 #define WI_RID_DNLD_BUF		0xFD01
 #define WI_RID_MEMSZ		0xFD02 /* memory size info (XXX Lucent) */
+					/* Looks like on lucnet pri firm too */
 #define	WI_RID_PRI_IDENTITY	0xFD02 /* primary funcs firmware ident (PRISM2) */
 #define WI_RID_PRI_SUP_RANGE	0xFD03 /* primary supplier compatibility */
 #define WI_RID_CIF_ACT_RANGE	0xFD04 /* controller sup. compatibility */
@@ -318,6 +319,7 @@
 #define WI_RID_AUTH_ALGS	0xFD4D /* auth algorithms available */
 #define WI_RID_AUTH_TYPE	0xFD4E /* availanle auth types */
 #define WI_RID_WEP_AVAIL	0xFD4F /* WEP privacy option available */
+#define WI_RID_DBM_COMMS_QUAL	0xFD51 /* CommQuality normalized to dBm */
 #define WI_RID_CUR_TX_RATE1	0xFD80
 #define WI_RID_CUR_TX_RATE2	0xFD81
 #define WI_RID_CUR_TX_RATE3	0xFD82


Initialize interrupt controller early on.

--- sys/mips/sibyte/sb_machdep.c
+++ sys/mips/sibyte/sb_machdep.c
@@ -102,6 +102,22 @@
 }

 static void
+sb_intr_init(int cpuid)
+{
+	int intrnum, intsrc;
+
+	/*
+	 * Disable all sources to the interrupt mapper and setup the mapping
+	 * between an interrupt source and the mips hard interrupt number.
+	 */
+	for (intsrc = 0; intsrc < NUM_INTSRC; ++intsrc) {
+		intrnum = sb_route_intsrc(intsrc);
+		sb_disable_intsrc(cpuid, intsrc);
+		sb_write_intmap(cpuid, intsrc, intrnum);
+	}
+}
+
+static void
 mips_init(void)
 {
 	int i, cfe_mem_idx, tmp;
@@ -279,6 +295,8 @@
 	memset(&edata, 0, (vm_offset_t)&end - (vm_offset_t)&edata);
 	mips_postboot_fixup();

+	sb_intr_init(0);
+
 	/* Initialize pcpu stuff */
 	mips_pcpu0_init();


MFC r196785:
    correct timeout for doing NOL processing; need a ticks-relative value

Approved by:	re (kensmith)

--- sys/net80211/ieee80211_dfs.c
+++ sys/net80211/ieee80211_dfs.c
@@ -235,7 +235,7 @@
 	}
 	if (oldest != now) {
 		/* arrange to process next channel up for a status change */
-		callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT);
+		callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT - now);
 	}
 }


rpicamsrc: Describe awb-mode=off in lowercase

Change the descriptions for the awb-gain-blue and awb-gain-red
properties to say 'awb-mode=off' instead of 'awb-mode=OFF'

See https://github.com/thaytan/gst-rpicamsrc/issues/26

--- sys/rpicamsrc/gstrpicamsrc.c
+++ sys/rpicamsrc/gstrpicamsrc.c
@@ -340,11 +340,11 @@
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_AWB_GAIN_RED,
       g_param_spec_float ("awb-gain-red", "AWB Red Gain",
-          "Manual AWB Gain for red channel when awb-mode=OFF", 0, 8.0, 0,
+          "Manual AWB Gain for red channel when awb-mode=off", 0, 8.0, 0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_AWB_GAIN_RED,
       g_param_spec_float ("awb-gain-blue", "AWB Blue Gain",
-          "Manual AWB Gain for blue channel when awb-mode=OFF", 0, 8.0, 0,
+          "Manual AWB Gain for blue channel when awb-mode=off", 0, 8.0, 0,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (gobject_class, PROP_IMAGE_EFFECT,
       g_param_spec_enum ("image-effect", "Image effect",


- Add quirk handling for ALi M5229, mainly setting the magic "force   enable IDE I/O" bit which prevents data access traps with revision   0xc8 in Fire-based machines when pci(4) enables PCIM_CMD_PORTEN. - Like for sun4v also don't add the PCI side of host-PCIe bridges to   the bus on sun4u as they don't have configuration space implement   there either.

--- sys/sparc64/pci/ofw_pcibus.c
+++ sys/sparc64/pci/ofw_pcibus.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
  * Copyright (c) 2000, BSDi
  * Copyright (c) 2003, Thomas Moestl <tmm@FreeBSD.org>
+ * Copyright (c) 2005 - 2009 Marius Strobl <marius@FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -194,6 +195,22 @@
 #endif

 	/*
+	 * Ensure that ALi M5229 report the actual content of PCIR_PROGIF
+	 * and that IDE I/O is force enabled.  The former is done in order
+	 * to have unique behavior across revisions as some default to
+	 * hiding bits 4-6 for compliance with PCI 2.3.  The latter is done
+	 * as at least revision 0xc8 requires the PCIM_CMD_PORTEN bypass
+	 * to be always enabled as otherwise even enabling PCIM_CMD_PORTEN
+	 * results in an instant data access trap on Fire-based machines.
+	 * Thus these quirks have to be handled before pci(4) adds the maps.
+	 * Note that for older revisions bit 0 of register 0x50 enables the
+	 * internal IDE function instead of force enabling IDE I/O.
+	 */
+	if ((CS_READ(PCIR_VENDOR, 2) == 0x10b9 &&
+	    CS_READ(PCIR_DEVICE, 2) == 0x5229))
+		CS_WRITE(0x50, CS_READ(0x50, 1) | 0x3, 1);
+
+	/*
 	 * The preset in the intline register is usually wrong.  Reset
 	 * it to 255, so that the PCI code will reroute the interrupt if
 	 * needed.
@@ -222,9 +239,14 @@
 		    domain, busno);
 	node = ofw_bus_get_node(dev);

-#ifndef SUN4V
-	/* Add the PCI side of the HOST-PCI bridge itself to the bus. */
+	/*
+	 * Add the PCI side of the host-PCI bridge itself to the bus.
+	 * Note that we exclude the host-PCIe bridges here as these
+	 * have no configuration space implemented themselves.
+	 */
 	if (strcmp(device_get_name(device_get_parent(pcib)), "nexus") == 0 &&
+	    ofw_bus_get_type(pcib) != NULL &&
+	    strcmp(ofw_bus_get_type(pcib), OFW_TYPE_PCIE) != 0 &&
 	    (dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib,
 	    domain, busno, 0, 0, sizeof(*dinfo))) != NULL) {
 		if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, node) != 0)
@@ -232,7 +254,6 @@
 		else
 			pci_add_child(dev, (struct pci_devinfo *)dinfo);
 	}
-#endif

 	if (OF_getprop(ofw_bus_get_node(pcib), "clock-frequency", &clock,
 	    sizeof(clock)) == -1)


Appledocs. Appledocs everywhere.

Appledocs. Appledocs everywhere.

--- RZUtils/Categories/UIView/UIView+RZAutoLayoutHelpers.h
+++ RZUtils/Categories/UIView/UIView+RZAutoLayoutHelpers.h
@@ -42,42 +42,259 @@

 /** @name Constraint Getters */

+/**
+ *  Return the receiver's pinned width constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedWidthConstraint;
+
+/**
+ *  Return the receiver's pinned height constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedHeightConstraint;

+/**
+ *  Return the receiver's pinned top constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedTopConstraint;
+
+/**
+ *  Return the receiver's pinned left side constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedLeftConstraint;
+
+/**
+ *  Return the receiver's pinned right side constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedRightConstraint;
+
+/**
+ *  Return the receiver's pinned bottom constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedBottomConstraint;

+/**
+ *  Return the receiver's pinned center X constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedCenterXConstraint;
+
+/**
+ *  Return the receiver's pinned center Y constraint, if it exsists.
+ *
+ *  @return The constraint or nil.
+ */
 - (NSLayoutConstraint*)rz_pinnedCenterYConstraint;

 /** @name Constraint Creation */

+/**
+ *  Pin the receiver's width to a constant.
+ *
+ *  @param width Deisred width.
+ *
+ *  @return The pinned width constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinWidthTo:(CGFloat)width;
+
+/**
+ *  Pin the receiver's width to the width of another view.
+ *  By default pins to the other view's exact width, but the
+ *  returned constraint can be edited as desired.
+ *
+ *  @param view The view to pin width to.
+ *
+ *  @return The pinned width constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinWidthToView:(UIView *)view;
+
+/**
+ *  Pin the receiver's width to a constant.
+ *
+ *  @param width Deisred height.
+ *
+ *  @return The pinned height constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinHeightTo:(CGFloat)height;
+
+/**
+ *  Pin the receiver's height to the height of another view.
+ *  By default pins to the other view's exact height, but the
+ *  returned constraint can be edited as desired.
+ *
+ *  @param view The view to pin height to.
+ *
+ *  @return The pinned height constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinHeightToView:(UIView *)view;
+
+/**
+ *  Pin the receiver's size to a particular value.
+ *
+ *  @param size The size to pin to.
+ *
+ *  @return The constraints that were added: [width, height].
+ */
 - (NSArray *)rz_pinSizeTo:(CGSize)size;

+/**
+ *  Pin the receiver's top space to its superview's top with a fixed amount of padding.
+ *
+ *  @param padding The amount of padding between the top of the receiver and the superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinTopSpaceToSuperviewWithPadding:(CGFloat)padding;
+
+/**
+ *  Pin the receiver's left space to its superview's left side with a fixed amount of padding.
+ *
+ *  @param padding The amount of padding between the left side of the receiver and the superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinLeftSpaceToSuperviewWithPadding:(CGFloat)padding;
+
+/**
+ *  Pin the receiver's bottom space to its superview's bottom with a fixed amount of padding.
+ *
+ *  @param padding The amount of padding between the bottom of the receiver and the superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinBottomSpaceToSuperviewWithPadding:(CGFloat)padding;
+
+/**
+ *  Pin the receiver's right space to its superview's right side with a fixed amount of padding.
+ *
+ *  @param padding The amount of padding between the right side of the receiver and the superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_pinRightSpaceToSuperviewWithPadding:(CGFloat)padding;
+
+/**
+ *  Pin all sides of the receiver to its superview's sides with fixed insets.
+ *
+ *  @param insets Insets between receiver's sides and superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraints that were added: [left, right, top, bottom]
+ */
 - (NSArray *)rz_fillContainerWithInsets:(UIEdgeInsets)insets;

+/**
+ *  Make the receiver fill its superview horizontally with a fixed amount of padding.
+ *  Equivalent to pinning left and right sides to superview.
+ *
+ *  @param padding The horizontal padding between the receiver and it superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraints that were added: [left, right]
+ */
 - (NSArray *)rz_fillContainerHorizontallyWithPadding:(CGFloat)padding;
+
+/**
+ *  Make the receiver fill its superview horizontally with a minimum amount of padding.
+ *  Equivalent to pinning left and right sides to superview with relation >=.
+ *
+ *  @param padding The minimum padding between the receiver and it superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraints that were added: [left, right]
+ */
 - (NSArray *)rz_fillContainerHorizontallyWithMinimumPadding:(CGFloat)padding;
+
+/**
+ *  Make the receiver fill its superview vertically with a fixed amount of padding.
+ *  Equivalent to pinning top and bottom to superview.
+ *
+ *  @param padding The vertical padding between the receiver and it superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraints that were added: [top, bottom]
+ */
 - (NSArray *)rz_fillContainerVerticallyWithPadding:(CGFloat)padding;
+
+/**
+ *  Make the receiver fill its superview vertically with a fixed amount of padding.
+ *  Equivalent to pinning top and bottom to superview with relation >=.
+ *
+ *  @param padding The vertical padding between the receiver and it superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraints that were added: [top, bottom]
+ */
 - (NSArray *)rz_fillContainerVerticallyWithMinimumPadding:(CGFloat)padding;

+/**
+ *  Center the receiver horizontally in its superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_centerHorizontallyInContainer;
+
+/**
+ *  Center the receiver horizontally in its superview with an offset.
+ *
+ *  @param offset The horizontal offset for the center pinning. Negative = left.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_centerHorizontallyInContainerWithOffset:(CGFloat)offset;
+
+/**
+ *  Center the receiver vertically in its superview.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_centerVerticallyInContainer;
+
+/**
+ *  Center the receiver vertically in its superview with an offset.
+ *
+ *  @param offset The vertical offset for the center pinning. Negative = up.
+ *
+ *  @warning The receiver must have a superview when this method is called.
+ *
+ *  @return The constraint that was added.
+ */
 - (NSLayoutConstraint *)rz_centerVerticallyInContainerWithOffset:(CGFloat)offset;

-// Batch alignment
+
+/** @name Batch Alignment */
+
 /**
  *  Create a vertical or horizontal minimum space constraint between each adjacent pair of views in an array. This method is
  *  deprecated in favor of rz_spaceSubViews:vertically:itemSpacing:relation:


v4l2: clear flags before reusing buffer from buffer pool

note: this really only affects v4l2sink since gst_v4l2_buffer_pool_get() is
only called once per buffer in the v4l2src case (in
gst_v4l2src_buffer_pool_activate())

--- sys/v4l2/gstv4l2bufferpool.c
+++ sys/v4l2/gstv4l2bufferpool.c
@@ -463,8 +463,10 @@
 {
   GstV4l2Buffer *buf = g_async_queue_try_pop (pool->avail_buffers);

-  if (buf)
+  if (buf) {
     GST_BUFFER_SIZE (buf) = buf->vbuffer.length;
+    GST_BUFFER_FLAG_UNSET (buf, 0xffffffff);
+  }

   pool->running = TRUE;


v4l2: Fix threading issues in orphaning mechanism

The pool orphaning function was colling internal _stop() virtual function
implementation. This is not thread safe, as a private lock inside the buffer
pool is supposed to be held. Fix this by keeping delayed _stop() and orphaning
the GstV4L2Allocator instead (REQBUFS(0)).

Then, protect the orphaned boolean with the object lock for the case a buffer
is being released after we have orphaned the buffer. That would otherwise
cause a QBUF to happen while the queue is no longer owned by the buffer pool.
This boolean is otherwise used and set from the streaming lock, or after
threads have been stopped (final cleanup).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/648>

--- sys/v4l2/gstv4l2bufferpool.c
+++ sys/v4l2/gstv4l2bufferpool.c
@@ -964,9 +964,6 @@
   GstV4l2BufferPool *pool = GST_V4L2_BUFFER_POOL (bpool);
   gboolean ret;

-  if (pool->orphaned)
-    return gst_v4l2_buffer_pool_vallocator_stop (pool);
-
   GST_DEBUG_OBJECT (pool, "stopping pool");

   if (pool->group_released_handler > 0) {
@@ -981,7 +978,8 @@
     pool->other_pool = NULL;
   }

-  gst_v4l2_buffer_pool_streamoff (pool);
+  if (!pool->orphaned)
+    gst_v4l2_buffer_pool_streamoff (pool);

   ret = GST_BUFFER_POOL_CLASS (parent_class)->stop (bpool);

@@ -997,6 +995,8 @@
   GstV4l2BufferPool *pool = GST_V4L2_BUFFER_POOL (*bpool);
   gboolean ret;

+  g_return_val_if_fail (pool->orphaned == FALSE, FALSE);
+
   if (!GST_V4L2_ALLOCATOR_CAN_ORPHAN_BUFS (pool->vallocator))
     return FALSE;

@@ -1004,25 +1004,24 @@
     return FALSE;

   GST_DEBUG_OBJECT (pool, "orphaning pool");
-
   gst_buffer_pool_set_active (*bpool, FALSE);
-  /*
-   * If the buffer pool has outstanding buffers, it will not be stopped
-   * by the base class when set inactive. Stop it manually and mark it
-   * as orphaned
-   */
-  ret = gst_v4l2_buffer_pool_stop (*bpool);
-  if (!ret)
-    ret = gst_v4l2_allocator_orphan (pool->vallocator);
-
-  if (!ret)
-    goto orphan_failed;
-
-  pool->orphaned = TRUE;
-  gst_object_unref (*bpool);
-  *bpool = NULL;
-
-orphan_failed:
+
+  /* We lock to prevent racing with a return buffer in QBuf, and has a
+   * workaround of not being able to use the pool hidden activation lock. */
+  GST_OBJECT_LOCK (pool);
+
+  gst_v4l2_buffer_pool_streamoff (pool);
+  ret = gst_v4l2_allocator_orphan (pool->vallocator);
+  if (ret)
+    pool->orphaned = TRUE;
+
+  GST_OBJECT_UNLOCK (pool);
+
+  if (ret) {
+    gst_object_unref (*bpool);
+    *bpool = NULL;
+  }
+
   return ret;
 }

@@ -1171,6 +1170,13 @@
   }

   GST_OBJECT_LOCK (pool);
+
+  /* If the pool was orphaned, don't try to queue any returned buffers.
+   * This is done with the objet lock in order to synchronize with
+   * orphaning. */
+  if (pool->orphaned)
+    goto was_orphaned;
+
   g_atomic_int_inc (&pool->num_queued);
   pool->buffers[index] = buf;

@@ -1187,6 +1193,13 @@
   {
     GST_ERROR_OBJECT (pool, "the buffer %i was already queued", index);
     return GST_FLOW_ERROR;
+  }
+was_orphaned:
+  {
+    GST_DEBUG_OBJECT (pool, "pool was orphaned, not queuing back buffer.");
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_TAG_MEMORY);
+    GST_OBJECT_UNLOCK (pool);
+    return GST_FLOW_FLUSHING;
   }
 queue_failed:
   {
@@ -1468,14 +1481,6 @@

   GST_DEBUG_OBJECT (pool, "release buffer %p", buffer);

-  /* If the buffer's pool has been orphaned, dispose of it so that
-   * the pool resources can be freed */
-  if (pool->orphaned) {
-    GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_TAG_MEMORY);
-    pclass->release_buffer (bpool, buffer);
-    return;
-  }
-
   switch (obj->type) {
     case V4L2_BUF_TYPE_VIDEO_CAPTURE:
     case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:


add author

add author

[r17978]

--- ir/ana/cdep.c
+++ ir/ana/cdep.c
@@ -20,6 +20,7 @@
 /**
  * @file
  * @brief   Implementation of cdep
+ * @author  Christoph Mallon
  * @version $Id$
  */
 #include <assert.h>


Correct function name in comment.

Correct function name in comment.

Submitted by:	alc

--- sys/x86/x86/busdma_machdep.c
+++ sys/x86/x86/busdma_machdep.c
@@ -567,7 +567,7 @@
 	/*
 	 * dmamem does not need to be bounced, so the map should be
 	 * NULL if malloc() was used and contig_dmamap if
-	 * contigmalloc() was used.
+	 * kmem_alloc_contig() was used.
 	 */
 	if (!(map == NULL || map == &contig_dmamap))
 		panic("bus_dmamem_free: Invalid map freed\n");


be: Assert that the register class index for additional pressure is valid.

--- ir/be/beasm.c
+++ ir/be/beasm.c
@@ -289,6 +289,7 @@
 		bitset_t *const used_ins = bitset_alloca(orig_n_ins);
 		for (size_t o = pn_be_Asm_first_out; o < orig_n_outs; ++o) {
 			arch_register_req_t const *const outreq = out_reqs[o];
+			assert(outreq->cls->index < ARRAY_SIZE(add_pressure));
 			if (!match_requirement(in_reqs, orig_n_ins, used_ins, outreq))
 				add_pressure[outreq->cls->index]++;
 		}
@@ -296,6 +297,7 @@
 		bitset_t *const used_outs = bitset_alloca(orig_n_outs);
 		for (unsigned i = n_be_Asm_first_in; i < orig_n_ins; ++i) {
 			arch_register_req_t const *const inreq = in_reqs[i];
+			assert(inreq->cls->index < ARRAY_SIZE(add_pressure));
 			if (!match_requirement(out_reqs, orig_n_outs, used_outs, inreq))
 				add_pressure[inreq->cls->index]++;
 		}


added computed_value for Carry and Borrow
added equivalent_node_Syn()

[r7472]

--- ir/ir/iropt.c
+++ ir/ir/iropt.c
@@ -103,6 +103,51 @@
   if ((ta != tarval_bad) && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b)))
     return tarval_sub(ta, tb);

+  return tarval_bad;
+}
+
+/**
+ * return the value of a Carry
+ * Special : a op 0, 0 op b
+ */
+static tarval *computed_value_Carry(ir_node *n)
+{
+  ir_node *a = get_binop_left(n);
+  ir_node *b = get_binop_right(n);
+  ir_mode *m = get_irn_mode(n);
+
+  tarval *ta = value_of(a);
+  tarval *tb = value_of(b);
+
+  if ((ta != tarval_bad) && (tb != tarval_bad)) {
+    tarval_add(ta, tb);
+    return tarval_carry() ? get_mode_one(m) : get_mode_null(m);
+  } else {
+    if (   (classify_tarval(ta) == TV_CLASSIFY_NULL)
+        || (classify_tarval(tb) == TV_CLASSIFY_NULL))
+      return get_mode_null(m);
+  }
+  return tarval_bad;
+}
+
+/**
+ * return the value of a Borrow
+ * Special : a op 0
+ */
+static tarval *computed_value_Borrow(ir_node *n)
+{
+  ir_node *a = get_binop_left(n);
+  ir_node *b = get_binop_right(n);
+  ir_mode *m = get_irn_mode(n);
+
+  tarval *ta = value_of(a);
+  tarval *tb = value_of(b);
+
+  if ((ta != tarval_bad) && (tb != tarval_bad)) {
+    return tarval_cmp(ta, tb) == pn_Cmp_Lt ? get_mode_one(m) : get_mode_null(m);
+  } else if (classify_tarval(ta) == TV_CLASSIFY_NULL) {
+      return get_mode_null(m);
+  }
   return tarval_bad;
 }

@@ -631,6 +676,8 @@
   CASE(Shr);
   CASE(Shrs);
   CASE(Rot);
+  CASE(Carry);
+  CASE(Borrow);
   CASE(Conv);
   CASE(Proj);
   CASE(Mux);
@@ -1140,12 +1187,13 @@
   return n;
 }

-/* Several optimizations:
+/**
+  Several optimizations:
    - no Phi in start block.
    - remove Id operators that are inputs to Phi
    - fold Phi-nodes, iff they have only one predecessor except
            themselves.
-*/
+ */
 static ir_node *equivalent_node_Phi(ir_node *n)
 {
   int i, n_preds;
@@ -1153,7 +1201,6 @@
   ir_node *oldn = n;
   ir_node *block = NULL;     /* to shutup gcc */
   ir_node *first_val = NULL; /* to shutup gcc */
-  ir_node *scnd_val = NULL;  /* to shutup gcc */

   if (!get_opt_normalize()) return n;

@@ -1190,12 +1237,10 @@
     return new_Bad();
   }

-  scnd_val = NULL;
-
-  /* follow_Id () for rest of inputs, determine if any of these
+  /* search for rest of inputs, determine if any of these
      are non-self-referencing */
   while (++i < n_preds) {
-    scnd_val = get_Phi_pred(n, i);
+    ir_node *scnd_val = get_Phi_pred(n, i);
     if (   (scnd_val != n)
         && (scnd_val != first_val)
 #if 1
@@ -1210,10 +1255,57 @@
     /* Fold, if no multiple distinct non-self-referencing inputs */
     n = first_val;
     DBG_OPT_PHI(oldn, n);
-  } else {
-    /* skip the remaining Ids (done in get_Phi_pred). */
-    /* superfluous, since we walk all to propagate Block's Bads.
-       while (++i < n_preds) get_Phi_pred(n, i);     */
+  }
+  return n;
+}
+
+/**
+  Several optimizations:
+   - no Sync in start block.
+   - fold Sync-nodes, iff they have only one predecessor except
+           themselves.
+  @fixme: are there loop's in Sync's
+ */
+static ir_node *equivalent_node_Sync(ir_node *n)
+{
+  int i, n_preds;
+
+  ir_node *oldn = n;
+  ir_node *first_val = NULL; /* to shutup gcc */
+
+  if (!get_opt_normalize()) return n;
+
+  n_preds = get_Sync_n_preds(n);
+
+  /* Find first non-self-referencing input */
+  for (i = 0; i < n_preds; ++i) {
+    first_val = get_Sync_pred(n, i);
+    if ((first_val != n)  /* not self pointer */ &&
+        (! is_Bad(first_val))
+       ) {            /* value not dead */
+      break;          /* then found first value. */
+    }
+  }
+
+  if (i >= n_preds)
+    /* A totally Bad or self-referencing Sync (we didn't break the above loop) */
+    return new_Bad();
+
+  /* search the rest of inputs, determine if any of these
+     are non-self-referencing */
+  while (++i < n_preds) {
+    ir_node *scnd_val = get_Sync_pred(n, i);
+    if ((scnd_val != n) &&
+        (scnd_val != first_val) &&
+        (! is_Bad(scnd_val))
+       )
+      break;
+  }
+
+  if (i >= n_preds) {
+    /* Fold, if no multiple distinct non-self-referencing inputs */
+    n = first_val;
+    DBG_OPT_SYNC(oldn, n);
   }
   return n;
 }
@@ -1521,6 +1613,7 @@
   CASE(Conv);
   CASE(Cast);
   CASE(Phi);
+  CASE(Sync);
   CASE(Proj);
   CASE(Id);
   CASE(Mux);


Do not gcse unreachable code

Do not gcse unreachable code

During global CSE we now ignore nodes in unreachable blocks,
otherwise cse could pick the wrong representative node
and use unreachable nodes in reachable code.

--- ir/ir/iropt.c
+++ ir/ir/iropt.c
@@ -6129,6 +6129,16 @@
 	if (value_table == NULL)
 		return n;

+	if (get_opt_global_cse()) {
+		/* do not remember unreachable nodes */
+		if (get_irg_dom_state(irg) == dom_consistent && !is_Block(n)) {
+			ir_node *block = get_nodes_block(n);
+			if (get_Block_dom_depth(block) < 0) {
+				return n;
+			}
+		}
+	}
+
 	ir_normalize_node(n);
 	/* lookup or insert in hash table with given hash key. */
 	nn = (ir_node*)pset_insert(value_table, n, ir_node_hash(n));


Updated test program to reflect new folder structure.

--- tests/test.c
+++ tests/test.c
@@ -51,13 +51,13 @@
   json_error_t error;

   // Open a graph file in GML format.
-  ifile = fopen("../Classic/Chvatal/chvatal.gml", "r");
+  ifile = fopen("../src/Classic/Chvatal/chvatal.gml", "r");
   if (ifile == 0) {
     return 10;
   }

   // Load a JSON file.
-  json = json_load_file("../Classic/Chvatal/chvatal_properties.json", 0, &error);
+  json = json_load_file("../src/Classic/Chvatal/chvatal_properties.json", 0, &error);
   if(!json) {
        /* the error variable contains error information */
   }


update gigo():
- add missing skip_Proj()
- do not kill control flow from a dead block WITHOUT setting this block to dead
- fixed warning

[r17339]

--- ir/ir/iropt.c
+++ ir/ir/iropt.c
@@ -5151,8 +5151,8 @@
  * nodes as parameters.  Returns 0 if the nodes are a Common Sub Expression.
  */
 int identities_cmp(const void *elt, const void *key) {
-	const ir_node *a = elt;
-	const ir_node *b = key;
+	ir_node *a = (ir_node *)elt;
+	ir_node *b = (ir_node *)key;
 	int i, irn_arity_a;

 	if (a == b) return 0;
@@ -5407,22 +5407,35 @@
 		ir_node *block = get_nodes_block(skip_Proj(node));

 		/* Don't optimize nodes in immature blocks. */
-		if (!get_Block_matured(block)) return node;
+		if (!get_Block_matured(block))
+			return node;
 		/* Don't optimize End, may have Bads. */
 		if (op == op_End) return node;

 		if (is_Block(block)) {
-			irn_arity = get_irn_arity(block);
-			for (i = 0; i < irn_arity; i++) {
+			if (is_Block_dead(block)) {
+				/* control flow from dead block is dead */
+				return new_Bad();
+			}
+
+			for (i = get_irn_arity(block) - 1; i >= 0; --i) {
 				if (!is_Bad(get_irn_n(block, i)))
 					break;
 			}
-			if (i == irn_arity) {
+			if (i < 0) {
 				ir_graph *irg = get_irn_irg(block);
 				/* the start block is never dead */
 				if (block != get_irg_start_block(irg)
-					&& block != get_irg_end_block(irg))
+					&& block != get_irg_end_block(irg)) {
+					/*
+					 * Do NOT kill control flow without setting
+					 * the block to dead of bad things can happen:
+					 * We get a Block that is not reachable be irg_block_walk()
+					 * but can be found by irg_walk()!
+					 */
+					set_Block_dead(block);
 					return new_Bad();
+				}
 			}
 		}
 	}
@@ -5436,7 +5449,7 @@
 		 * Beware: we can only read the block of a non-floating node.
 		 */
 		if (is_irn_pinned_in_irg(node) &&
-			is_Block_dead(get_nodes_block(node)))
+			is_Block_dead(get_nodes_block(skip_Proj(node))))
 			return new_Bad();

 		for (i = 0; i < irn_arity; i++) {


branches/zip: rec_get_nth_field_offs_old(): Add UNIV_UNLIKELY hints to assertion-like tests.

--- rem/rem0rec.c
+++ rem/rem0rec.c
@@ -681,13 +681,13 @@
 	ut_ad(rec && len);
 	ut_ad(n < rec_get_n_fields_old(rec));

-	if (n > REC_MAX_N_FIELDS) {
+	if (UNIV_UNLIKELY(n > REC_MAX_N_FIELDS)) {
 		fprintf(stderr, "Error: trying to access field %lu in rec\n",
 			(ulong) n);
 		ut_error;
 	}

-	if (rec == NULL) {
+	if (UNIV_UNLIKELY(rec == NULL)) {
 		fputs("Error: rec is NULL pointer\n", stderr);
 		ut_error;
 	}


Fixed off-by-one in expand_macros()

Fixed off-by-one in expand_macros()

--- src/cpp2/eval.c
+++ src/cpp2/eval.c
@@ -350,7 +350,7 @@

 		}else{
 			/* skip this word */
-			i = end - line; /* i incremented by loop */
+			i = end - line - 1; /* i incremented by loop */
 		}
 	}


removed unused follow_Id()
added Confirm node based optimizations
moved type detection into inner if's

[r6062]

--- ir/ir/iropt.c
+++ ir/ir/iropt.c
@@ -3,7 +3,7 @@
  * File name:   ir/ir/iropt.c
  * Purpose:     iropt --- optimizations intertwined with IR construction.
  * Author:      Christian Schaefer
- * Modified by: Goetz Lindenmaier
+ * Modified by: Goetz Lindenmaier, Michael Beck
  * Created:
  * CVS-ID:      $Id$
  * Copyright:   (c) 1998-2005 Universitt Karlsruhe
@@ -41,20 +41,10 @@
 # include "hashptr.h"
 # include "archop.h"
 # include "opt_polymorphy.h"
+# include "opt_confirms.h"

 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
-
-/**
- * Trivial INLINEable routine for copy propagation.
- * Does follow Ids, needed to optimize INLINEd code.
- */
-static INLINE ir_node *
-follow_Id (ir_node *n)
-{
-  while (get_irn_op (n) == op_Id) n = get_Id_pred (n);
-  return n;
-}

 /**
  * return the value of a Constant
@@ -522,7 +512,8 @@
         return new_tarval_from_long(proj_nr & pn_Cmp_Ne, mode_b);
     }
   }
-  return tarval_bad;
+
+  return computed_value_Cmp_Confirm(aa, ab, proj_nr);
 }

 /**
@@ -580,6 +571,16 @@
     return value_of(v);
   }
   return tarval_bad;
+}
+
+/**
+ * calculate the value of a Confirm: can be evaluated,
+ * if it has the form Confirm(x, '=', Const).
+ */
+static tarval *computed_value_Confirm(ir_node *n)
+{
+  return get_Confirm_cmp(n) == pn_Cmp_Eq ?
+    value_of(get_Confirm_bound(n)) : tarval_bad;
 }

 /**
@@ -627,6 +628,7 @@
   CASE(Conv);
   CASE(Proj);
   CASE(Mux);
+  CASE(Confirm);
   default:
     op->computed_value  = NULL;
   }
@@ -1058,8 +1060,8 @@
     ir_node *b = get_Phi_pred(n, 1);
     if (   (get_irn_op(a) == op_Confirm)
         && (get_irn_op(b) == op_Confirm)
-        && follow_Id (get_irn_n(a, 0) == get_irn_n(b, 0))
-        && (get_irn_n(a, 1) == get_irn_n (b, 1))
+        && (get_irn_n(a, 0) == get_irn_n(b, 0))
+        && (get_irn_n(a, 1) == get_irn_n(b, 1))
         && (a->data.num == (~b->data.num & irpn_True) )) {
       return get_irn_n(a, 0);
     }
@@ -1147,7 +1149,10 @@
 {
   ir_node *oldn = n;

-  n = follow_Id(n);
+  do {
+    n = get_Id_pred(n);
+  } while (get_irn_op(n) == op_Id);
+
   DBG_OPT_ID(oldn, n);
   return n;
 }
@@ -1248,6 +1253,25 @@
 }

 /**
+ * Remove Confirm nodes if setting is on.
+ */
+static ir_node *equivalent_node_Confirm(ir_node *n)
+{
+  if (get_Confirm_cmp(n) == pn_Cmp_Eq) {
+    ir_node *bound = get_Confirm_bound(n);
+    ir_op *op      = get_irn_op(bound);
+
+    /*
+     * Optimize a rare case:
+     * Confirm(x, '=', Const) ==> Const
+     */
+    if (op == op_Const || op == op_SymConst)
+      return bound;
+  }
+  return get_opt_remove_Confirm() ? get_Confirm_value(n) : n;
+}
+
+/**
  * equivalent_node() returns a node equivalent to input n. It skips all nodes that
  * perform no actual computation, as, e.g., the Id nodes.  It does not create
  * new nodes.  It is therefore safe to free n if the node returned is not n.
@@ -1297,6 +1321,7 @@
   CASE(Id);
   CASE(Mux);
   CASE(Cmp);
+  CASE(Confirm);
   default:
     op->equivalent_node  = NULL;
   }
@@ -1484,7 +1509,7 @@

 /**
   Transform Mul(a,-1) into -a.
- * Do architecture dependend optimizations on Mul nodes
+ * Do architecture dependent optimizations on Mul nodes
  */
 static ir_node *transform_node_Mul(ir_node *n) {
   ir_node *oldn = n;
@@ -1523,7 +1548,7 @@

     DBG_OPT_CSTEVAL(n, value);
   }
-  else /* Try architecture dependend optimization */
+  else /* Try architecture dependent optimization */
     value = arch_dep_replace_div_by_const(n);

   if (value != n) {
@@ -1553,7 +1578,7 @@

     DBG_OPT_CSTEVAL(n, value);
   }
-  else /* Try architecture dependend optimization */
+  else /* Try architecture dependent optimization */
     value = arch_dep_replace_mod_by_const(n);

   if (value != n) {
@@ -1607,7 +1632,7 @@
       DBG_OPT_CSTEVAL(n, a);
       DBG_OPT_CSTEVAL(n, b);
     }
-    else { /* Try architecture dependend optimization */
+    else { /* Try architecture dependent optimization */
       arch_dep_replace_divmod_by_const(&a, &b, n);
       evaluated = a != NULL;
     }
@@ -1630,114 +1655,36 @@
   return n;
 }

-
-/**
- * Optimize Abs(x) => x if x is Confirmed >= 0
- * Optimize Abs(x) => -x if x is Confirmed <= 0
+/**
+ * Optimize Abs(x) into  x if x is Confirmed >= 0
+ * Optimize Abs(x) into -x if x is Confirmed <= 0
  */
 static ir_node *transform_node_Abs(ir_node *n)
 {
-  ir_node *oldn = n;
-  ir_node *a = get_Abs_op(n);
-  tarval *tv, *c;
-  ir_mode *mode;
-  pn_Cmp cmp, ncmp;
-  int do_minus = 0;
-
-  if (get_irn_op(a) != op_Confirm)
-    return n;
-
-  tv  = value_of(get_Confirm_bound(n));
-  if (tv == tarval_bad)
-    return n;
-
-  mode = get_irn_mode(n);
-
-  /*
-   * We can handle only >=, >, <, <= cases.
-   * We could handle == too, but this should not happen.
-   *
-   * Note that for integer modes we have a slightly better
-   * optimization possibilities, so we handle this
-   * different.
-   */
-  cmp = get_Confirm_cmp(n);
-
-  switch (cmp) {
-  case pn_Cmp_Lt:
+  ir_node        *oldn = n;
+  ir_node        *a = get_Abs_op(n);
+  value_classify sign = classify_value_sign(a);
+
+  if (sign == VALUE_NEGATIVE) {
+    ir_mode *mode = get_irn_mode(n);
+
     /*
-     * must be x < c <= 1 to be useful if integer mode and -0 = 0
-     *         x < c <= 0 to be useful else
+     * We can replace the Abs by -x here.
+     * We even could add a new Confirm here.
+     *
+     * Note that -x would create a new node, so we could
+     * not run it in the equivalent_node() context.
      */
-  case pn_Cmp_Le:
-    /*
-     * must be x <= c < 1 to be useful if integer mode and -0 = 0
-     *         x <= c < 0 to be useful else
-     */
-    c = mode_is_int(mode) && mode_honor_signed_zeros(mode) ?
-      get_mode_one(mode) : get_mode_null(mode);
-
-    ncmp = tarval_cmp(tv, c) ^ pn_Cmp_Eq;
-    if (cmp != ncmp)
-      return n;
-
-    /* yep, we can replace by -x */
-    do_minus = 1;
-    break;
-
-  case pn_Cmp_Ge:
-    /*
-     * must be x >= c > -1 to be useful if integer mode
-     *         x >= c >= 0 to be useful else
-     */
-  case pn_Cmp_Gt:
-    /*
-     * must be x > c >= -1 to be useful if integer mode
-     *         x > c >= 0 to be useful else
-     */
-    if (mode_is_int(mode)) {
-      c = get_mode_minus_one(mode);
-
-      ncmp = tarval_cmp(tv, c) ^ pn_Cmp_Eq;
-      if (cmp != ncmp)
-        return n;
-    }
-    else {
-      c = get_mode_minus_one(mode);
-
-      ncmp = tarval_cmp(tv, c);
-
-      if (ncmp != pn_Cmp_Eq && ncmp != pn_Cmp_Gt)
-        return n;
-    }
-
-    /* yep, we can replace by x */
-    do_minus = 0;
-    break;
-
-  default:
-    return n;
-  }
-
-  /*
-   * Ok, when we get here, we can replace the Abs
-   * by either x or -x. In the second case we eve could
-   * add a new Confirm.
-   *
-   * Note that -x would create a new node, so we could
-   * not run it in the equivalent_node() context.
-   */
-  if (do_minus) {
-    ir_node *c;
-
     n = new_rd_Minus(get_irn_dbg_info(n), current_ir_graph,
                      get_nodes_block(n), a, mode);

-    c  = new_Const(mode, tarval_neg(tv));
-    n = new_r_Confirm(current_ir_graph, get_nodes_block(n), n, c, get_inversed_pnc(cmp));
-  }
-  else {
+    DBG_OPT_CONFIRM(oldn, n);
+  }
+  else if (sign == VALUE_POSITIVE) {
+    /* n is positive, Abs is not needed */
     n = a;
+
+    DBG_OPT_CONFIRM(oldn, n);
   }

   return n;
@@ -1859,7 +1806,7 @@
 }

 /**
- * Transform a Cast of a Const into a new Const
+ * Transform a Cast_type(Const) into a new Const_type
  */
 static ir_node *transform_node_Cast(ir_node *n) {
   ir_node *oldn = n;
@@ -1880,21 +1827,17 @@
 }

 /**
- * Transform a Proj(Div) with a non-zero constant.
+ * Transform a Proj(Div) with a non-zero value.
  * Removes the exceptions and routes the memory to the NoMem node.
  */
 static ir_node *transform_node_Proj_Div(ir_node *proj)
 {
   ir_node *n = get_Proj_pred(proj);
-  ir_node *b;
-  tarval *tb;
+  ir_node *b = get_Div_right(n);
   long proj_nr;

-  b  = get_Div_right(n);
-  tb = value_of(b);
-
-  if (tb != tarval_bad && classify_tarval(tb) != TV_CLASSIFY_NULL) {
-    /* div(x, c) && c != 0 */
+  if (value_not_zero(b)) {
+    /* div(x, y) && y != 0 */
     proj_nr = get_Proj_proj(proj);

     /* this node may float */
@@ -1915,21 +1858,17 @@
 }

 /**
- * Transform a Proj(Mod) with a non-zero constant.
+ * Transform a Proj(Mod) with a non-zero value.
  * Removes the exceptions and routes the memory to the NoMem node.
  */
 static ir_node *transform_node_Proj_Mod(ir_node *proj)
 {
   ir_node *n = get_Proj_pred(proj);
-  ir_node *b;
-  tarval *tb;
+  ir_node *b = get_Mod_right(n);
   long proj_nr;

-  b  = get_Mod_right(n);
-  tb = value_of(b);
-
-  if (tb != tarval_bad && classify_tarval(tb) != TV_CLASSIFY_NULL) {
-    /* mod(x, c) && c != 0 */
+  if (value_not_zero(b)) {
+    /* mod(x, y) && y != 0 */
     proj_nr = get_Proj_proj(proj);

     /* this node may float */
@@ -1950,21 +1889,17 @@
 }

 /**
- * Transform a Proj(DivMod) with a non-zero constant.
+ * Transform a Proj(DivMod) with a non-zero value.
  * Removes the exceptions and routes the memory to the NoMem node.
  */
 static ir_node *transform_node_Proj_DivMod(ir_node *proj)
 {
   ir_node *n = get_Proj_pred(proj);
-  ir_node *b;
-  tarval *tb;
+  ir_node *b = get_DivMod_right(n);
   long proj_nr;

-  b  = get_DivMod_right(n);
-  tb = value_of(b);
-
-  if (tb != tarval_bad && classify_tarval(tb) != TV_CLASSIFY_NULL) {
-    /* DivMod(x, c) && c != 0 */
+  if (value_not_zero(b)) {
+    /* DivMod(x, y) && y != 0 */
     proj_nr = get_Proj_proj(proj);

     /* this node may float */
@@ -2534,7 +2469,7 @@
 #define transform_node_Shl  transform_node_shift

 /**
- * Remove dead blocks in keepalive list.  We do not generate a new End node.
+ * Remove dead blocks in keep alive list.  We do not generate a new End node.
  */
 static ir_node *transform_node_End(ir_node *n) {
   int i, n_keepalives = get_End_n_keepalives(n);
@@ -2548,7 +2483,7 @@
 }

 /**
- * Optimize a Mux into some simplier cases.
+ * Optimize a Mux into some simpler cases.
  */
 static ir_node *transform_node_Mux(ir_node *n)
 {
@@ -2749,33 +2684,33 @@
 /** Compares the attributes of two Proj nodes. */
 static int node_cmp_attr_Proj(ir_node *a, ir_node *b)
 {
-    return get_irn_proj_attr (a) != get_irn_proj_attr (b);
+  return get_irn_proj_attr (a) != get_irn_proj_attr (b);
 }

 /** Compares the attributes of two Filter nodes. */
 static int node_cmp_attr_Filter(ir_node *a, ir_node *b)
 {
-    return get_Filter_proj(a) != get_Filter_proj(b);
+  return get_Filter_proj(a) != get_Filter_proj(b);
 }

 /** Compares the attributes of two Alloc nodes. */
 static int node_cmp_attr_Alloc(ir_node *a, ir_node *b)
 {
-    return (get_irn_alloc_attr(a).where != get_irn_alloc_attr(b).where)
-        || (get_irn_alloc_attr(a).type != get_irn_alloc_attr(b).type);
+  return (get_irn_alloc_attr(a).where != get_irn_alloc_attr(b).where)
+      || (get_irn_alloc_attr(a).type != get_irn_alloc_attr(b).type);
 }

 /** Compares the attributes of two Free nodes. */
 static int node_cmp_attr_Free(ir_node *a, ir_node *b)
 {
-    return (get_irn_free_attr(a).where != get_irn_free_attr(b).where)
-        || (get_irn_free_attr(a).type != get_irn_free_attr(b).type);
+  return (get_irn_free_attr(a).where != get_irn_free_attr(b).where)
+      || (get_irn_free_attr(a).type != get_irn_free_attr(b).type);
 }

 /** Compares the attributes of two SymConst nodes. */
 static int node_cmp_attr_SymConst(ir_node *a, ir_node *b)
 {
-    return (get_irn_symconst_attr(a).num != get_irn_symconst_attr(b).num)
+  return (get_irn_symconst_attr(a).num != get_irn_symconst_attr(b).num)
       || (get_irn_symconst_attr(a).sym.type_p != get_irn_symconst_attr(b).sym.type_p)
       || (get_irn_symconst_attr(a).tp != get_irn_symconst_attr(b).tp);
 }
@@ -2783,13 +2718,13 @@
 /** Compares the attributes of two Call nodes. */
 static int node_cmp_attr_Call(ir_node *a, ir_node *b)
 {
-    return (get_irn_call_attr(a) != get_irn_call_attr(b));
+  return (get_irn_call_attr(a) != get_irn_call_attr(b));
 }

 /** Compares the attributes of two Sel nodes. */
 static int node_cmp_attr_Sel(ir_node *a, ir_node *b)
 {
-    return (get_irn_sel_attr(a).ent->kind  != get_irn_sel_attr(b).ent->kind)
+  return (get_irn_sel_attr(a).ent->kind  != get_irn_sel_attr(b).ent->kind)
       || (get_irn_sel_attr(a).ent->name    != get_irn_sel_attr(b).ent->name)
       || (get_irn_sel_attr(a).ent->owner   != get_irn_sel_attr(b).ent->owner)
       || (get_irn_sel_attr(a).ent->ld_name != get_irn_sel_attr(b).ent->ld_name)
@@ -2799,13 +2734,13 @@
 /** Compares the attributes of two Phi nodes. */
 static int node_cmp_attr_Phi(ir_node *a, ir_node *b)
 {
-    return get_irn_phi_attr (a) != get_irn_phi_attr (b);
+  return get_irn_phi_attr (a) != get_irn_phi_attr (b);
 }

 /** Compares the attributes of two Cast nodes. */
 static int node_cmp_attr_Cast(ir_node *a, ir_node *b)
 {
-    return get_Cast_type(a) != get_Cast_type(b);
+  return get_Cast_type(a) != get_Cast_type(b);
 }

 /** Compares the attributes of two Load nodes. */
@@ -2824,7 +2759,13 @@
 {
   /* NEVER do CSE on volatile Stores */
   return (get_Store_volatility(a) == volatility_is_volatile ||
-      get_Store_volatility(b) == volatility_is_volatile);
+          get_Store_volatility(b) == volatility_is_volatile);
+}
+
+/** Compares the attributes of two Confirm nodes. */
+static int node_cmp_attr_Confirm(ir_node *a, ir_node *b)
+{
+  return (get_Confirm_cmp(a) != get_Confirm_cmp(b));
 }

 /**
@@ -2850,6 +2791,7 @@
   CASE(Cast);
   CASE(Load);
   CASE(Store);
+  CASE(Confirm);
   default:
     op->node_cmp_attr  = NULL;
   }
@@ -3103,105 +3045,109 @@
  * reference this one, i.e., right after construction of a node.
  */
 ir_node *
-optimize_node (ir_node *n)
-{
-	tarval *tv;
-	ir_node *oldn = n;
-	opcode iro = get_irn_opcode(n);
-
-	type *old_tp = get_irn_type(n);
-	{
-		int i, arity = get_irn_arity(n);
-		for (i = 0; i < arity && !old_tp; ++i)
-			old_tp = get_irn_type(get_irn_n(n, i));
-	}
-
-	/* Always optimize Phi nodes: part of the construction. */
-	if ((!get_opt_optimize()) && (iro != iro_Phi)) return n;
-
-	/* constant expression evaluation / constant folding */
-	if (get_opt_constant_folding()) {
-		/* constants can not be evaluated */
-		if (iro != iro_Const) {
-			/* try to evaluate */
-			tv = computed_value(n);
-			if ((get_irn_mode(n) != mode_T) && (tv != tarval_bad)) {
-				ir_node *nw;
-
-				/*
-				 * we MUST copy the node here temporary, because it's still needed
-				 * for DBG_OPT_CSTEVAL
-				 */
-				int node_size = offsetof(ir_node, attr) +  n->op->attr_size;
-				oldn = alloca(node_size);
-
-				memcpy(oldn, n, node_size);
-				CLONE_ARR_A(ir_node *, oldn->in, n->in);
-
-				/* ARG, copy the in array, we need it for statistics */
-				memcpy(oldn->in, n->in, ARR_LEN(n->in) * sizeof(n->in[0]));
-
-
-				edges_node_deleted(n, current_ir_graph);
-
-				/* evaluation was successful -- replace the node. */
-				obstack_free (current_ir_graph->obst, n);
-				nw = new_Const (get_tarval_mode (tv), tv);
-
-				if (old_tp && get_type_mode(old_tp) == get_tarval_mode (tv))
-					set_Const_type(nw, old_tp);
-				DBG_OPT_CSTEVAL(oldn, nw);
-				return nw;
-			}
-		}
-	}
-
-	/* remove unnecessary nodes */
-	if (get_opt_constant_folding() ||
-			(iro == iro_Phi)  ||   /* always optimize these nodes. */
-			(iro == iro_Id)   ||
-			(iro == iro_Proj) ||
-			(iro == iro_Block)  )  /* Flags tested local. */
-		n = equivalent_node (n);
-
-	optimize_preds(n);                  /* do node specific optimizations of nodes predecessors. */
-
-	/** common subexpression elimination **/
-	/* Checks whether n is already available. */
-	/* The block input is used to distinguish different subexpressions. Right
-		 now all nodes are op_pin_state_pinned to blocks, i.e., the CSE only finds common
-		 subexpressions within a block. */
-	if (get_opt_cse())
-		n = identify_cons (current_ir_graph->value_table, n);
-
-	if (n != oldn) {
-		edges_node_deleted(oldn, current_ir_graph);
-
-		/* We found an existing, better node, so we can deallocate the old node. */
-		obstack_free (current_ir_graph->obst, oldn);
-
-		return n;
-	}
-
-	/* Some more constant expression evaluation that does not allow to
-		 free the node. */
-	iro = get_irn_opcode(n);
-	if (get_opt_constant_folding() ||
-	    (iro == iro_Cond) ||
-	    (iro == iro_Proj) ||
-	    (iro == iro_Sel))     /* Flags tested local. */
-	  n = transform_node (n);
-
-	/* Remove nodes with dead (Bad) input.
-	   Run always for transformation induced Bads. */
-	n = gigo (n);
-
-	/* Now we have a legal, useful node. Enter it in hash table for cse */
-	if (get_opt_cse() && (get_irn_opcode(n) != iro_Block)) {
-	  n = identify_remember (current_ir_graph->value_table, n);
-	}
-
-	return n;
+optimize_node(ir_node *n)
+{
+  tarval *tv;
+  ir_node *oldn = n;
+  opcode iro = get_irn_opcode(n);
+
+  /* Always optimize Phi nodes: part of the construction. */
+  if ((!get_opt_optimize()) && (iro != iro_Phi)) return n;
+
+  /* constant expression evaluation / constant folding */
+  if (get_opt_constant_folding()) {
+    /* neither constants nor Tuple values can be evaluated */
+    if (iro != iro_Const && (get_irn_mode(n) != mode_T)) {
+      /* try to evaluate */
+      tv = computed_value(n);
+      if (tv != tarval_bad) {
+        ir_node *nw;
+        type *old_tp = get_irn_type(n);
+        int i, arity = get_irn_arity(n);
+        int node_size;
+
+        /*
+         * Try to recover the type of the new expression.
+         */
+        for (i = 0; i < arity && !old_tp; ++i)
+          old_tp = get_irn_type(get_irn_n(n, i));
+
+        /*
+         * we MUST copy the node here temporary, because it's still needed
+         * for DBG_OPT_CSTEVAL
+         */
+        node_size = offsetof(ir_node, attr) +  n->op->attr_size;
+        oldn = alloca(node_size);
+
+        memcpy(oldn, n, node_size);
+        CLONE_ARR_A(ir_node *, oldn->in, n->in);
+
+        /* ARG, copy the in array, we need it for statistics */
+        memcpy(oldn->in, n->in, ARR_LEN(n->in) * sizeof(n->in[0]));
+
+        /* note the inplace edges module */
+        edges_node_deleted(n, current_ir_graph);
+
+        /* evaluation was successful -- replace the node. */
+        obstack_free(current_ir_graph->obst, n);
+        nw = new_Const(get_tarval_mode (tv), tv);
+
+        if (old_tp && get_type_mode(old_tp) == get_tarval_mode (tv))
+          set_Const_type(nw, old_tp);
+        DBG_OPT_CSTEVAL(oldn, nw);
+        return nw;
+      }
+    }
+  }
+
+  /* remove unnecessary nodes */
+  if (get_opt_constant_folding() ||
+    (iro == iro_Phi)  ||   /* always optimize these nodes. */
+    (iro == iro_Id)   ||
+    (iro == iro_Proj) ||
+    (iro == iro_Block)  )  /* Flags tested local. */
+    n = equivalent_node (n);
+
+  optimize_preds(n);                  /* do node specific optimizations of nodes predecessors. */
+
+  /* Common Subexpression Elimination.
+   *
+   * Checks whether n is already available.
+   * The block input is used to distinguish different subexpressions. Right
+   * now all nodes are op_pin_state_pinned to blocks, i.e., the CSE only finds common
+   * subexpressions within a block.
+   */
+  if (get_opt_cse())
+    n = identify_cons (current_ir_graph->value_table, n);
+
+  if (n != oldn) {
+    edges_node_deleted(oldn, current_ir_graph);
+
+    /* We found an existing, better node, so we can deallocate the old node. */
+    obstack_free (current_ir_graph->obst, oldn);
+
+    return n;
+  }
+
+  /* Some more constant expression evaluation that does not allow to
+     free the node. */
+  iro = get_irn_opcode(n);
+  if (get_opt_constant_folding() ||
+    (iro == iro_Cond) ||
+    (iro == iro_Proj) ||
+    (iro == iro_Sel))     /* Flags tested local. */
+    n = transform_node (n);
+
+  /* Remove nodes with dead (Bad) input.
+     Run always for transformation induced Bads. */
+  n = gigo (n);
+
+  /* Now we have a legal, useful node. Enter it in hash table for cse */
+  if (get_opt_cse() && (get_irn_opcode(n) != iro_Block)) {
+    n = identify_remember (current_ir_graph->value_table, n);
+  }
+
+  return n;
 }

@@ -3217,34 +3163,29 @@
   ir_node *oldn = n;
   opcode iro = get_irn_opcode(n);

-  type *old_tp = get_irn_type(n);
-  {
-    int i, arity = get_irn_arity(n);
-    for (i = 0; i < arity && !old_tp; ++i)
-      old_tp = get_irn_type(get_irn_n(n, i));
-  }
-
   if (!get_opt_optimize() && (get_irn_op(n) != op_Phi)) return n;
-
-  /* if not optimize return n */
-  if (n == NULL) {
-    assert(0);
-    /* Here this is possible.  Why? */
-    return n;
-  }

   /* constant expression evaluation / constant folding */
   if (get_opt_constant_folding()) {
-    /* constants can not be evaluated */
-    if (iro != iro_Const) {
+    /* neither constants nor Tuple values can be evaluated */
+    if (iro != iro_Const && get_irn_mode(n) != mode_T) {
       /* try to evaluate */
       tv = computed_value(n);
-      if ((get_irn_mode(n) != mode_T) && (tv != tarval_bad)) {
+      if (tv != tarval_bad) {
         /* evaluation was successful -- replace the node. */
-        n = new_Const (get_tarval_mode (tv), tv);
-
-    if (old_tp && get_type_mode(old_tp) == get_tarval_mode (tv))
-      set_Const_type(n, old_tp);
+        type *old_tp = get_irn_type(n);
+        int i, arity = get_irn_arity(n);
+
+        /*
+         * Try to recover the type of the new expression.
+         */
+        for (i = 0; i < arity && !old_tp; ++i)
+          old_tp = get_irn_type(get_irn_n(n, i));
+
+        n = new_Const(get_tarval_mode(tv), tv);
+
+        if (old_tp && get_type_mode(old_tp) == get_tarval_mode(tv))
+          set_Const_type(n, old_tp);

         DBG_OPT_CSTEVAL(oldn, n);
         return n;
@@ -3258,7 +3199,7 @@
       (iro == iro_Id)   ||   /* ... */
       (iro == iro_Proj) ||   /* ... */
       (iro == iro_Block)  )  /* Flags tested local. */
-    n = equivalent_node (n);
+    n = equivalent_node(n);

   optimize_preds(n);                  /* do node specific optimizations of nodes predecessors. */

@@ -3268,7 +3209,7 @@
      now all nodes are op_pin_state_pinned to blocks, i.e., the cse only finds common
      subexpressions within a block. */
   if (get_opt_cse()) {
-    n = identify (current_ir_graph->value_table, n);
+    n = identify(current_ir_graph->value_table, n);
   }

   /* Some more constant expression evaluation. */
@@ -3277,11 +3218,11 @@
       (iro == iro_Cond) ||
       (iro == iro_Proj) ||
       (iro == iro_Sel))     /* Flags tested local. */
-    n = transform_node (n);
+    n = transform_node(n);

   /* Remove nodes with dead (Bad) input.
      Run always for transformation induced Bads.  */
-  n = gigo (n);
+  n = gigo(n);

   /* Now we can verify the node, as it has no dead inputs any more. */
   irn_vrfy(n);
@@ -3290,7 +3231,7 @@
      Blocks should be unique anyways.  (Except the successor of start:
      is cse with the start block!) */
   if (get_opt_cse() && (get_irn_opcode(n) != iro_Block))
-    n = identify_remember (current_ir_graph->value_table, n);
+    n = identify_remember(current_ir_graph->value_table, n);

   return n;
 }


camera_trigger param @unit

camera_trigger param @unit

--- src/drivers/camera_trigger/camera_trigger_params.c
+++ src/drivers/camera_trigger/camera_trigger_params.c
@@ -82,7 +82,11 @@
  *
  * 0 disables the trigger, 1 sets it to enabled on command, 2 always on, 3 distance based, 4 distance based enabled on command
  *
- * @unit None
+ * @unit enum
+ * @value 0 disable
+ * @value 1 cmd
+ * @value 2 always
+ * @value 3 distance
  * @min 0
  * @max 4
  * @group Camera trigger
@@ -94,7 +98,7 @@
  *
  * Selects which pin is used, ranges from 1 to 6 (AUX1-AUX6)
  *
- * @unit None
+ * @unit
  * @min 1
  * @max 123456
  * @group Camera trigger


Remove dead code from CUPS backend

Remove dead code from CUPS backend

https://bugzilla.gnome.org/show_bug.cgi?id=725441

--- modules/printbackends/cups/gtkprintbackendcups.c
+++ modules/printbackends/cups/gtkprintbackendcups.c
@@ -1610,132 +1610,6 @@
     }
 }

-#if 0
-static void
-cups_request_printer_info_cb (GtkPrintBackendCups *backend,
-                              GtkCupsResult       *result,
-                              gpointer             user_data)
-{
-  ipp_attribute_t *attr;
-  ipp_t *response;
-  gchar *printer_name;
-  GtkPrinterCups *cups_printer;
-  GtkPrinter *printer;
-  gchar *loc;
-  gchar *desc;
-  gchar *state_msg;
-  int job_count;
-  gboolean status_changed;
-
-  g_assert (GTK_IS_PRINT_BACKEND_CUPS (backend));
-
-  printer_name = (gchar *)user_data;
-  printer = gtk_print_backend_find_printer (GTK_PRINT_BACKEND (backend),
-					    printer_name);
-
-  GTK_NOTE (PRINTING,
-            g_print ("CUPS Backend: %s - Got printer info for printer '%s'\n", G_STRFUNC, printer_name));
-
-  if (!printer)
-    {
-      GTK_NOTE (PRINTING,
-            g_print ("CUPS Backend: Could not find printer called '%s'\n", printer_name));
-      return;
-    }
-
-  cups_printer = GTK_PRINTER_CUPS (printer);
-
-  if (gtk_cups_result_is_error (result))
-    {
-      if (gtk_printer_is_new (printer))
-	{
-	  gtk_print_backend_remove_printer (GTK_PRINT_BACKEND (backend),
-					    printer);
-	  return;
-	}
-      else
-	return; /* TODO: mark as inactive printer */
-    }
-
-  response = gtk_cups_result_get_response (result);
-
-  /* TODO: determine printer type and use correct icon */
-  gtk_printer_set_icon_name (printer, "printer");
-
-  state_msg = "";
-  loc = "";
-  desc = "";
-  job_count = 0;
-  for (attr = response->attrs; attr != NULL; attr = attr->next)
-    {
-      if (!attr->name)
-        continue;
-
-      _CUPS_MAP_ATTR_STR (attr, loc, "printer-location");
-      _CUPS_MAP_ATTR_STR (attr, desc, "printer-info");
-      _CUPS_MAP_ATTR_STR (attr, state_msg, "printer-state-message");
-      _CUPS_MAP_ATTR_INT (attr, cups_printer->state, "printer-state");
-      _CUPS_MAP_ATTR_INT (attr, job_count, "queued-job-count");
-    }
-
-  status_changed = gtk_printer_set_job_count (printer, job_count);
-
-  status_changed |= gtk_printer_set_location (printer, loc);
-  status_changed |= gtk_printer_set_description (printer, desc);
-  status_changed |= gtk_printer_set_state_message (printer, state_msg);
-
-  if (status_changed)
-    g_signal_emit_by_name (GTK_PRINT_BACKEND (backend),
-			   "printer-status-changed", printer);
-}
-
-static void
-cups_request_printer_info (GtkPrintBackendCups *print_backend,
-                           const gchar         *printer_name)
-{
-  GtkCupsRequest *request;
-  gchar *printer_uri;
-  static const char * const pattrs[] =	/* Attributes we're interested in */
-    {
-      "printer-location",
-      "printer-info",
-      "printer-state-message",
-      "printer-state",
-      "queued-job-count",
-      "job-sheets-supported",
-      "job-sheets-default"
-    };
-
-  request = gtk_cups_request_new_with_username (NULL,
-                                                GTK_CUPS_POST,
-                                                IPP_GET_PRINTER_ATTRIBUTES,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                print_backend->username);
-
-  printer_uri = g_strdup_printf ("ipp://localhost/printers/%s",
-                                  printer_name);
-  gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_URI,
-                                   "printer-uri", NULL, printer_uri);
-
-  GTK_NOTE (PRINTING,
-            g_print ("CUPS Backend: %s - Requesting printer info for URI '%s'\n", G_STRFUNC, printer_uri));
-
-  g_free (printer_uri);
-
-  gtk_cups_request_ipp_add_strings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-				    "requested-attributes", G_N_ELEMENTS (pattrs),
-				    NULL, pattrs);
-
-  cups_request_execute (print_backend,
-                        request,
-                        (GtkPrintCupsResponseCallbackFunc) cups_request_printer_info_cb,
-                        g_strdup (printer_name),
-                        (GDestroyNotify) g_free);
-}
-#endif
-
 typedef struct {
   GtkPrintBackendCups *print_backend;
   GtkPrintJob *job;
@@ -3358,13 +3232,6 @@

 	  gtk_printer_set_is_new (printer, FALSE);
         }
-
-#if 0
-      /* Getting printer info with separate requests overwhelms cups
-       * when the printer list has more than a handful of printers.
-       */
-      cups_request_printer_info (cups_backend, gtk_printer_get_name (printer));
-#endif

       GTK_PRINTER_CUPS (printer)->state = info->state;
       GTK_PRINTER_CUPS (printer)->ipp_version_major = info->ipp_version_major;