Skip to contentSkip to conversation

Rework intel 2D driver glamor support

PATCH In review Keith Packard 6 participants 35 messages Jul 24, 2014 – Aug 5, 2014 10 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover Rework intel 2D driver glamor support

I spent the day just cleaning up this patch series and testing. I think it's ready for others to use and review. I've been running it on two machines for a couple of days now and it's been solid.

I ran three different desktop environments (current Debian unstable versions):

XFCE 4.10
Gnome 3.12
KDE 4.13.3

I have not merged DRI2 support when running with Glamor; I've got that working locally, but if you accidentally try indirect rendering, you'll crash the X server with an assert failure. So, this is DRI3 only, at least for now.

This patch series also adds a "none" acceleration mode. It's different from other unaccelerated drivers in offering DRI2 and DRI3 support so that you can run direct rendering.

A brief synopsis of the series

1-4 cleanup patches

5 Identify and isolate UXA code; UXA-specific functions are
renamed and moved into uxa-specific files.

6 Remove UXA-based Glamor support. This pulls out all of the
Glamor calls from UXA rendering paths. This patch only builds with glamor disabled; I didn't worry about the existing glamor code or support for glamor within the rest of the driver.

7-9 Prepare for glamor support. Creates a couple of abstract
functions for accel-dependent functionality needed by the initialization and modesetting code. Gets rid of the glamor stubs in intel_glamor.h

10 Add glamor support back in, using the regular glamor
API.

11 Add an unaccelerated option ("none"). This offers fb-only
support and is always compiled in to the driver.

12 Delay initial mode set operation until the root window
is painted and the server is ready to go. This includes potentially copying an existing fbcon frame buffer to the root window in background none mode, providing support for this in all three acceleration modes. The driver used to support this by copying the fbcon buffer to the screen buffer during early server initialization; this change allows the driver to use regular GC-based CopyArea instead of needing custom rendering code.

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#1 lore raw

PATCH 1/12 Stop trying to out-guess mesa for BO allocation

---
 src/uxa/intel_uxa.c | 2 ++
 1 file changed, 2 insertions(+)
src/uxa/intel_uxa.c +2 -0
index b396188..717754f 100644
@@ -758,6 +758,7 @@ free_priv:
 			goto free_priv;
 		}
 
+#if 0
 		if (tiling != I915_TILING_NONE) {
 			int height;
 
@@ -780,6 +781,7 @@ free_priv:
 			bo = NULL;
 			goto free_priv;
 		}
+#endif
 	}
 
   BAIL:
Signature · 1 line
2.0.1

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-2-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

#3 lore raw

Re: [PATCH 01/12] Stop trying to out-guess mesa for BO allocation

Keith Packard <[email protected]> writes:

I don't see anything indicating that this code path is only used by glamor.

Quoted 31 lines
---
 src/uxa/intel_uxa.c | 2 ++
 1 file changed, 2 insertions(+)
src/uxa/intel_uxa.c +2 -0
index b396188..717754f 100644
@@ -758,6 +758,7 @@ free_priv:
 			goto free_priv;
 		}
 
+#if 0
 		if (tiling != I915_TILING_NONE) {
 			int height;
 
@@ -780,6 +781,7 @@ free_priv:
 			bo = NULL;
 			goto free_priv;
 		}
+#endif
 	}
 
   BAIL:
Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#4 lore raw

Re: [PATCH 01/12] Stop trying to out-guess mesa for BO allocation

Quoted 4 lines · Eric Anholt

Keith Packard <[email protected]> writes:

I don't see anything indicating that this code path is only used by glamor.

True. It's a fix for DRI3 for either UXA or "none". Mesa allocates a single page for a 1x1 texture, but this code thinks that should take two pages causing a texture-to-pixmap operation to fail.

In particular, gnome-shell fails without this patch.

It's useful independent of this series, which is why I stuck it first.

Signature · 1 line
[email protected]

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

#5 lore raw

Re: [PATCH 01/12] Stop trying to out-guess mesa for BO allocation

Quoted 10 lines · Keith Packard
Quoted 4 lines · Eric Anholt

Keith Packard <[email protected]> writes:

I don't see anything indicating that this code path is only used by glamor.

True. It's a fix for DRI3 for either UXA or "none". Mesa allocates a single page for a 1x1 texture, but this code thinks that should take two pages causing a texture-to-pixmap operation to fail.

OK, but isn't the problem with the code you're #if 0ing (which, really? #if 0 in a patch being submitted for review?) that it's aligning to 2*height instead of height?

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

#6 lore raw

Re: [PATCH 01/12] Stop trying to out-guess mesa for BO allocation

Quoted 3 lines · Eric Anholt

OK, but isn't the problem with the code you're #if 0ing (which, really? #if 0 in a patch being submitted for review?) that it's aligning to 2*height instead of height?

I went and did a bit of archaeology to figure out why it's using 2*height instead of just height. The initial change to pixmap allocation, which was then copied to the BO validation logic, was here:

	commit 736b89504a32239a0c7dfb5961c1b8292dd744bd
	Author: Chris Wilson <[email protected]>
	Date:   Sun Dec 30 10:32:18 2012 +0000
	
	    uxa: Align surface allocations to even tile rows
	    
	    Align surface sizes to an even number of tile rows to cater for sampler
	    prefetch. If we read beyond the last page we may catch the PTE in a
	    state of flux and trigger a GPU hang. Also detected by enabling invalid
	    PTE access checking.
	    
	    References: https://bugs.freedesktop.org/show_bug.cgi?id=56916
	    References: https://bugs.freedesktop.org/show_bug.cgi?id=55984
	    Signed-off-by: Chris Wilson <[email protected]>
	
	diff --git a/src/intel_uxa.c b/src/intel_uxa.c
	index f5ac0a6..2f14173 100644
	--- a/src/intel_uxa.c
	+++ b/src/intel_uxa.c
	@@ -209,7 +209,7 @@ intel_uxa_pixmap_compute_size(PixmapPtr pixmap,
	                        tile_height = 8;
	                else
	                        tile_height = 32;
	-               aligned_h = ALIGN(h, tile_height);
	+               aligned_h = ALIGN(h, 2*tile_height);
	 
	                *stride = intel_get_fence_pitch(intel,
	                                                ALIGN(pitch, 512),

Look at the referenced bugs, what I found was a long list of random GPU hangs on ILK and SNB hardware that appear to have been caused by a kernel change. Daniel and Chris created a number of scatter shot fixes across the kernel, and this patch to the 2D driver. However, this patch doesn't appear to have actually solved anything; Norbert Preining was still crashing with this patch applied:

        https://bugs.freedesktop.org/show_bug.cgi?id=55984#c129

Furthermore, SNA has some similar code, but it applies it conditionally for hardware which doesn't have 'relaxed fencing', which is only hardware older than i965 when running on a older kernel that doesn't recognize the HAS_RELAXED_FENCING parameter (the current kernel always returns 'true').

So, as near as I can tell, this fix should never be necessary as the reported bug wasn't fixed by it, and SNA does not apply this rule to any hardware on which either bug was reproduced.

If this fix is actually useful, wouldn't we want it in Mesa as well?

Signature · 1 line
[email protected]

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

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-1-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

#8 lore raw

PATCH 2/12 Fix present debug output

Was using 'low_msc', which isn't defined anymore.

---
 src/uxa/intel_present.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/uxa/intel_present.c +2 -1
index 18fcbf8..5f98da8 100644
@@ -193,7 +193,8 @@ intel_present_queue_vblank(RRCrtcPtr                    crtc,
 		if (errno != EBUSY || !intel_present_flush_drm_events(screen))
 			return BadAlloc;
 	}
-	DebugPresent(("\t\tiq %lld seq %u msc %u (hw msc %u)\n", event_id, seq, low_msc, vbl.request.sequence));
+	DebugPresent(("\t\tiq %lld seq %u msc %llu (hw msc %u)\n",
+                      (long long) event_id, seq, (long long) msc, vbl.request.sequence));
 	return Success;
 }
 
Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
#9 lore raw

PATCH 7/12 Add intel_flush to abstract flushing pending acceleration operations

In reply to a message not in the archive

intel_flush flushes any pending acceleration operations to the hardware, just like intel_uxa_batch_submit does today except that it is not uxa-specific.

---
 src/uxa/intel.h         |  3 +++
 src/uxa/intel_display.c | 11 +++--------
 src/uxa/intel_driver.c  | 14 +++++++++-----
 3 files changed, 15 insertions(+), 13 deletions(-)
src/uxa/intel.h +3 -0
index ade8742..64f573b 100644
@@ -535,4 +535,7 @@ intel_get_pixmap_bo(PixmapPtr pixmap);
 void
 intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo);
 
+void
+intel_flush(intel_screen_private *intel);
+
 #endif /* _I830_H_ */
src/uxa/intel_display.c +3 -8
index a4cbf00..add09b0 100644
@@ -57,8 +57,6 @@
 #include "fb.h"
 #include "uxa.h"
 
-#include "intel_glamor.h"
-
 #define KNOWN_MODE_FLAGS ((1<<14)-1)
 
 struct intel_drm_queue {
@@ -437,8 +435,7 @@ intel_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	crtc->y = y;
 	crtc->rotation = rotation;
 
-	intel_glamor_flush(intel);
-	intel_batch_submit(crtc->scrn);
+        intel_flush(intel);
 
 	mode_to_kmode(crtc->scrn, &intel_crtc->kmode, mode);
 	ret = intel_crtc_apply(crtc);
@@ -1437,8 +1434,7 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
 
-	intel_glamor_flush(intel);
-	intel_batch_submit(scrn);
+        intel_flush(intel);
 
 	old_width = scrn->virtualX;
 	old_height = scrn->virtualY;
@@ -1552,8 +1548,7 @@ intel_do_pageflip(intel_screen_private *intel,
 		goto error_out;
 
 	drm_intel_bo_disable_reuse(new_front);
-	intel_glamor_flush(intel);
-	intel_batch_submit(scrn);
+        intel_flush(intel);
 
 	mode->pageflip_data = pageflip_data;
 	mode->pageflip_handler = pageflip_handler;
src/uxa/intel_driver.c +9 -5
index d9f918b..a764b97 100644
@@ -181,6 +181,12 @@ intel_get_pixmap_bo(PixmapPtr pixmap)
         return intel_uxa_get_pixmap_bo(pixmap);
 }
 
+void
+intel_flush(intel_screen_private *intel)
+{
+        intel_batch_submit(intel->scrn);
+}
+
 static void PreInitCleanup(ScrnInfoPtr scrn)
 {
 	if (!scrn || !scrn->driverPrivate)
@@ -647,7 +653,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
 	PixmapSyncDirtyHelper(dirty, &pixregion);
 	RegionUninit(&pixregion);
 
-	intel_batch_submit(scrn);
+        intel_flush(intel);
 	if (!intel->has_prime_vmap_flush) {
 		drm_intel_bo *bo = intel_uxa_get_pixmap_bo(dirty->slave_dst->master_pixmap);
 		was_blocked = xf86BlockSIGIO();
@@ -732,10 +738,8 @@ intel_flush_callback(CallbackListPtr *list,
 		     pointer user_data, pointer call_data)
 {
 	ScrnInfoPtr scrn = user_data;
-	if (scrn->vtSema) {
-		intel_batch_submit(scrn);
-		intel_glamor_flush(intel_get_screen_private(scrn));
-	}
+	if (scrn->vtSema)
+                intel_flush(intel_get_screen_private(scrn));
 }
 
 #if HAVE_UDEV
Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-8-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

Reviewed-by
#11 lore raw

Re: [PATCH 07/12] Add intel_flush to abstract flushing pending acceleration operations

Quoted 3 lines · Keith Packard

intel_flush flushes any pending acceleration operations to the hardware, just like intel_uxa_batch_submit does today except that it is not uxa-specific.

This seems like an obvious cleanup (and in one case a fix), and we ought to even apply it right away as long as it still calls intel_glamor_flush(). If it did, it gets:

even before we sort out the rest of the series.

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#12 lore raw

PATCH 8/12 Get rid of glamor stubs in intel_glamor.h

In reply to a message not in the archive

This eliminates the stubs in intel_glamor.h and replaces them with ifdefs instead.

---
 src/uxa/intel_dri.c     | 20 ++++++++++++++++++--
 src/uxa/intel_driver.c  |  6 ++++++
 src/uxa/intel_glamor.h  | 21 ---------------------
 src/uxa/intel_present.c |  2 ++
 src/uxa/intel_video.c   |  4 ++++
 5 files changed, 30 insertions(+), 23 deletions(-)
src/uxa/intel_dri.c +18 -2
index 79978ab..78734cb 100644
@@ -66,7 +66,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "dri2.h"
 
+#if USE_GLAMOR
 #include "intel_glamor.h"
+#endif
 #include "uxa.h"
 
 typedef struct {
@@ -107,6 +109,7 @@ static PixmapPtr get_front_buffer(DrawablePtr drawable)
 	return pixmap;
 }
 
+#if USE_GLAMOR
 static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
 {
 	ScreenPtr screen = drawable->pScreen;
@@ -158,6 +161,7 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
 	intel_get_screen_private(xf86ScreenToScrn(screen))->needs_flush = TRUE;
 	return old;
 }
+#endif
 
 #if DRI2INFOREC_VERSION < 2
 static DRI2BufferPtr
@@ -170,7 +174,9 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 	DRI2BufferPtr buffers;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap, pDepthPixmap;
+#if USE_GLAMOR
 	Bool is_glamor_pixmap = FALSE;
+#endif
 	int i;
 
 	buffers = calloc(count, sizeof *buffers);
@@ -187,11 +193,12 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 		pixmap = NULL;
 		if (attachments[i] == DRI2BufferFrontLeft) {
 			pixmap = get_front_buffer(drawable);
-
+#if USE_GLAMOR
 			if (pixmap == NULL) {
 				drawable = &(get_drawable_pixmap(drawable)->drawable);
 				is_glamor_pixmap = TRUE;
 			}
+#endif
 		} else if (attachments[i] == DRI2BufferStencil && pDepthPixmap) {
 			pixmap = pDepthPixmap;
 			pixmap->refcnt++;
@@ -230,8 +237,10 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 				goto unwind;
 			}
 
+#if USE_GLAMOR
 			if (is_glamor_pixmap)
 				pixmap = fixup_glamor(drawable, pixmap);
+#endif
 		}
 
 		if (attachments[i] == DRI2BufferDepth)
@@ -292,7 +301,9 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 	DRI2Buffer2Ptr buffer;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap;
+#if USE_GLAMOR
 	Bool is_glamor_pixmap = FALSE;
+#endif
 
 	buffer = calloc(1, sizeof *buffer);
 	if (buffer == NULL)
@@ -306,11 +317,12 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 	pixmap = NULL;
 	if (attachment == DRI2BufferFrontLeft) {
 		pixmap = get_front_buffer(drawable);
-
+#if USE_GLAMOR
 		if (pixmap == NULL) {
 			drawable = &(get_drawable_pixmap(drawable)->drawable);
 			is_glamor_pixmap = TRUE;
 		}
+#endif
 	}
 
 	if (pixmap == NULL) {
@@ -383,8 +395,10 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 			free(buffer);
 			return NULL;
 		}
+#if USE_GLAMOR
 		if (is_glamor_pixmap)
 			pixmap = fixup_glamor(drawable, pixmap);
+#endif
 	}
 
 	buffer->attachment = attachment;
@@ -762,7 +776,9 @@ intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr fron
 	new_front->busy = 1;
 	new_back->busy = -1;
 
+#if USE_GLAMOR
 	intel_glamor_exchange_buffers(intel, front, back);
+#endif
 
 	DamageRegionProcessPending(&front->drawable);
 
src/uxa/intel_driver.c +6 -0
index a764b97..6d38cfe 100644
@@ -72,7 +72,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "i915_drm.h"
 
+#if USE_GLAMOR
 #include "intel_glamor.h"
+#endif
 #include "intel_options.h"
 
 static void i830AdjustFrame(ADJUST_FRAME_ARGS_DECL);
@@ -610,12 +612,14 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 		return FALSE;
 	}
 
+#if USE_GLAMOR
 	if (!intel_glamor_pre_init(scrn)) {
 		PreInitCleanup(scrn);
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			"Failed to pre init glamor display.\n");
 		return FALSE;
 	}
+#endif
 
 	/* Load the dri modules if requested. */
 #if HAVE_DRI2
@@ -1125,7 +1129,9 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
 
 	DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
 
+#if USE_GLAMOR
 	intel_glamor_close_screen(screen);
+#endif
 
 	TimerFree(intel->cache_expire);
 	intel->cache_expire = NULL;
src/uxa/intel_glamor.h +0 -21
index 2e305fc..97c2257 100644
@@ -32,8 +32,6 @@
 
 #include <xf86xv.h>
 
-#ifdef USE_GLAMOR
-
 Bool intel_glamor_pre_init(ScrnInfoPtr scrn);
 Bool intel_glamor_init(ScreenPtr screen);
 Bool intel_glamor_create_screen_resources(ScreenPtr screen);
@@ -48,24 +46,5 @@ PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
 				     int depth, unsigned int usage);
 void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst);
 XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports);
-#else
-
-static inline Bool intel_glamor_pre_init(ScrnInfoPtr scrn) { return TRUE; }
-static inline Bool intel_glamor_init(ScreenPtr screen) { return TRUE; }
-static inline Bool intel_glamor_create_screen_resources(ScreenPtr screen) { return TRUE; }
-static inline Bool intel_glamor_close_screen(ScreenPtr screen) { return TRUE; }
-static inline void intel_glamor_free_screen(int scrnIndex, int flags) { }
-
-static inline void intel_glamor_flush(intel_screen_private * intel) { }
-
-static inline Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap) { return TRUE; }
-static inline void intel_glamor_destroy_pixmap(PixmapPtr pixmap) { }
-
-static inline PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
-						   int depth, unsigned int usage) { return NULL; }
-
-static inline void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst) {}
-static inline XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports) { return NULL; }
-#endif
 
 #endif /* INTEL_GLAMOR_H */
src/uxa/intel_present.c +2 -0
index 5f98da8..c53d71d 100644
@@ -54,7 +54,9 @@
 
 #include "present.h"
 
+#if USE_GLAMOR
 #include "intel_glamor.h"
+#endif
 #include "uxa.h"
 
 struct intel_present_vblank_event {
src/uxa/intel_video.c +4 -0
index 310b6c9..ae3d351 100644
@@ -78,7 +78,9 @@
 #define _INTEL_XVMC_SERVER_
 #include "intel_xvmc.h"
 #endif
+#if USE_GLAMOR
 #include "intel_glamor.h"
+#endif
 #include "intel_uxa.h"
 #include "intel_video_overlay.h"
 
@@ -213,10 +215,12 @@ void intel_video_init(ScreenPtr screen)
 		}
 	}
 
+#if USE_GLAMOR
 	glamorAdaptor = intel_glamor_xv_init(screen, 16);
 	if (glamorAdaptor != NULL)
 		xf86DrvMsg(scrn->scrnIndex, X_INFO,
 			   "Set up textured video using glamor\n");
+#endif
 
 
 	if (overlayAdaptor && intel->XvPreferOverlay)
Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-9-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

Acked-by
#14 lore raw

Re: [PATCH 08/12] Get rid of glamor stubs in intel_glamor.h

Quoted 2 lines · Keith Packard

This eliminates the stubs in intel_glamor.h and replaces them with ifdefs instead.

I don't feel strongly about this either way -- ifdefs are more traditional userland style, while stubs are more kernel style.

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#15 lore raw

Re: [PATCH 08/12] Get rid of glamor stubs in intel_glamor.h

Quoted 7 lines · Eric Anholt
Quoted 2 lines · Keith Packard

This eliminates the stubs in intel_glamor.h and replaces them with ifdefs instead.

I don't feel strongly about this either way -- ifdefs are more traditional userland style, while stubs are more kernel style.

Right, just trying to keep things all the same and #ifdef USE_GLAMOR seemed more common.

Quoted 1 line
Signature · 1 line
[email protected]

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

#16 lore raw

PATCH 10/12 Add glamor back into the driver

In reply to a message not in the archive

This adds glamor support back into the driver, but instad of going through UXA, this uses it directly instead.

---
 src/uxa/intel.h         |  17 +++
 src/uxa/intel_display.c |  30 ++++-
 src/uxa/intel_dri.c     |  20 +++
 src/uxa/intel_driver.c  | 247 ++++++++++++++++++++++++++++---------
 src/uxa/intel_glamor.c  | 316 +++++++++++++++++++++++++-----------------------
 src/uxa/intel_glamor.h  |  18 ++-
 src/uxa/intel_present.c |   5 -
 src/uxa/intel_uxa.c     |   5 +
 src/uxa/intel_video.c   |  75 +++++++-----
 9 files changed, 480 insertions(+), 253 deletions(-)
src/uxa/intel.h +17 -0
index 64f573b..5fbb2c7 100644
@@ -111,10 +111,21 @@ enum dri_type {
 	DRI_ACTIVE
 };
 
+enum accel_type {
+#if USE_GLAMOR
+        ACCEL_GLAMOR,
+#endif
+#if USE_UXA
+        ACCEL_UXA,
+#endif
+};
+
 typedef struct intel_screen_private {
 	ScrnInfoPtr scrn;
 	int cpp;
 
+        enum accel_type accel;
+
 #define RENDER_BATCH			I915_EXEC_RENDER
 #define BLT_BATCH			I915_EXEC_BLT
 	unsigned int current_batch;
@@ -127,6 +138,7 @@ typedef struct intel_screen_private {
 
 	dri_bufmgr *bufmgr;
 
+#if USE_UXA
 	uint32_t batch_ptr[4096];
 	/** Byte offset in batch_ptr for the next dword to be emitted. */
 	unsigned int batch_used;
@@ -142,6 +154,7 @@ typedef struct intel_screen_private {
 	struct list batch_pixmaps;
 	drm_intel_bo *wa_scratch_bo;
 	OsTimerPtr cache_expire;
+#endif
 
 	/* For Xvideo */
 	Bool use_overlay;
@@ -178,8 +191,10 @@ typedef struct intel_screen_private {
 	void (*batch_flush) (struct intel_screen_private *intel);
 	void (*batch_commit_notify) (struct intel_screen_private *intel);
 
+#if USE_UXA
 	struct _UxaDriver *uxa_driver;
 	int uxa_flags;
+#endif
 	Bool need_sync;
 	int accel_pixmap_offset_alignment;
 	int accel_max_x;
@@ -212,6 +227,7 @@ typedef struct intel_screen_private {
 		drm_intel_bo *gen6_depth_stencil_bo;
 	} video;
 
+#if USE_UXA
 	/* Render accel state */
 	float scale_units[2][2];
 	/** Transform pointers for src/mask, or NULL if identity */
@@ -269,6 +285,7 @@ typedef struct intel_screen_private {
 
 	/* 965 render acceleration state */
 	struct gen4_render_state *gen4_render_state;
+#endif
 
 	/* DRI enabled this generation. */
 	enum dri_type dri2, dri3;
src/uxa/intel_display.c +24 -6
index add09b0..a4c4b82 100644
@@ -56,6 +56,9 @@
 #include "xf86DDC.h"
 #include "fb.h"
 #include "uxa.h"
+#if USE_GLAMOR
+#include "intel_glamor.h"
+#endif
 
 #define KNOWN_MODE_FLAGS ((1<<14)-1)
 
@@ -182,7 +185,7 @@ intel_output_backlight_init(xf86OutputPtr output)
 {
 	struct intel_output *intel_output = output->driver_private;
 	intel_screen_private *intel = intel_get_screen_private(output->scrn);
-	char *str;
+	const char *str;
 
 #if !USE_BACKLIGHT
 	return;
@@ -683,7 +686,10 @@ intel_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 		return TRUE;
 	}
 
-	bo = intel_get_pixmap_bo(ppix);
+        bo = intel_get_pixmap_bo(ppix);
+        if (!bo)
+                return FALSE;
+
 	if (intel->front_buffer) {
 		ErrorF("have front buffer\n");
 	}
@@ -1472,8 +1478,20 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	scrn->virtualX = width;
 	scrn->virtualY = height;
 
-	if (!intel_uxa_create_screen_resources(scrn->pScreen))
-		goto fail;
+        switch (intel->accel) {
+#if USE_GLAMOR
+        case ACCEL_GLAMOR:
+                if (!intel_glamor_create_screen_resources(scrn->pScreen))
+                        goto fail;
+                break;
+#endif
+#if USE_UXA
+        case ACCEL_UXA:
+                if (!intel_uxa_create_screen_resources(scrn->pScreen))
+                        goto fail;
+                break;
+#endif
+        }
 
 	for (i = 0; i < xf86_config->num_crtc; i++) {
 		xf86CrtcPtr crtc = xf86_config->crtc[i];
@@ -1532,7 +1550,7 @@ intel_do_pageflip(intel_screen_private *intel,
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 	struct intel_crtc *crtc = config->crtc[0]->driver_private;
 	struct intel_mode *mode = crtc->mode;
-	unsigned int pitch = scrn->displayWidth * intel->cpp;
+        unsigned int pitch = scrn->displayWidth * intel->cpp;
 	struct intel_pageflip *flip;
 	uint32_t new_fb_id;
 	uint32_t flags;
@@ -2235,7 +2253,7 @@ intel_create_pixmap_for_bo(ScreenPtr pScreen, dri_bo *bo,
 		return NullPixmap;
 	}
 
-	intel_set_pixmap_bo(pixmap, bo);
+        intel_set_pixmap_bo(pixmap, bo);
 	return pixmap;
 }
 
src/uxa/intel_dri.c +20 -0
index 78734cb..2055346 100644
@@ -883,6 +883,26 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
 
 		drm_intel_bo_disable_reuse(new_back);
 		dri_bo_flink(new_back, &intel->back_name);
+#if USE_GLAMOR
+		if (intel->accel == ACCEL_GLAMOR) {
+                        I830DRI2BufferPrivatePtr drvpriv;
+                        PixmapPtr front_pixmap, back_pixmap;
+                        ScreenPtr screen;
+
+			screen = draw->pScreen;
+			drvpriv = info->front->driverPrivate;
+			front_pixmap = drvpriv->pixmap;
+
+			back_pixmap = intel_glamor_create_back_pixmap(screen,
+								      front_pixmap,
+								      new_back);
+			if (back_pixmap == NULL) {
+				drm_intel_bo_unreference(new_back);
+				return FALSE;
+			}
+			intel->back_pixmap = back_pixmap;
+		}
+#endif
 	} else {
 		new_back = intel->back_buffer;
 		intel->back_buffer = NULL;
src/uxa/intel_driver.c +189 -58

346 lines not on this page · raw message

src/uxa/intel_glamor.c +166 -150

396 lines not on this page · raw message

src/uxa/intel_glamor.h +14 -4
index 97c2257..2fcabdf 100644
@@ -40,11 +40,21 @@ void intel_glamor_free_screen(int scrnIndex, int flags);
 
 void intel_glamor_flush(intel_screen_private * intel);
 
-Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap);
-void intel_glamor_destroy_pixmap(PixmapPtr pixmap);
-PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
-				     int depth, unsigned int usage);
+#if HAVE_DRI2
+PixmapPtr
+intel_glamor_create_back_pixmap(ScreenPtr screen,
+				PixmapPtr front_pixmap,
+				drm_intel_bo *back_bo);
+
 void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst);
+#endif
+
 XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports);
 
+dri_bo *
+intel_glamor_get_pixmap_bo(PixmapPtr pixmap);
+
+Bool
+intel_glamor_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo);
+
 #endif /* INTEL_GLAMOR_H */
src/uxa/intel_present.c +0 -5
index b901fb1..04aeb78 100644
@@ -54,11 +54,6 @@
 
 #include "present.h"
 
-#if USE_GLAMOR
-#include "intel_glamor.h"
-#endif
-#include "uxa.h"
-
 struct intel_present_vblank_event {
 	uint64_t        event_id;
 };
src/uxa/intel_uxa.c +5 -0
index da4eb97..e9d905b 100644
@@ -1272,6 +1272,11 @@ Bool intel_uxa_init(ScreenPtr screen)
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
+	intel_batch_init(scrn);
+
+	if (INTEL_INFO(intel)->gen >= 040 && INTEL_INFO(intel)->gen < 0100)
+		gen4_render_state_init(scrn);
+
 #if HAS_DIXREGISTERPRIVATEKEY
 	if (!dixRegisterPrivateKey(&uxa_pixmap_index, PRIVATE_PIXMAP, 0))
 #else
src/uxa/intel_video.c +45 -30

119 lines not on this page · raw message

Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-11-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

#18 lore raw

Re: [PATCH 10/12] Add glamor back into the driver

Quoted 2 lines · Keith Packard

This adds glamor support back into the driver, but instad of going through UXA, this uses it directly instead.

This is hard to read with the conditionalizing all of the UXA code in the same commit as adding the glamor code. Then there are a bunch of unrelated whitespace changes, or flattening of a bunch of nested conditionals.

The only substantive problem I see is intel_glamor_set_pixmap_bo().

Quoted 23 lines
src/uxa/intel_driver.c +23 -0
+static void intel_check_accel_option(ScrnInfoPtr scrn)
+{
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+	enum { NONE, SNA, UXA, GLAMOR } accel_method = DEFAULT_ACCEL_METHOD;
+	const char *s;
+
+	s = xf86GetOptValString(intel->Options, OPTION_ACCEL_METHOD);
+	if (s != NULL) {
+#if USE_GLAMOR
+                if (strcasecmp(s, "glamor") == 0)
+                        accel_method = GLAMOR;
+                else
+#endif
+#if USE_UXA
+                if (strcasecmp(s, "uxa") == 0)
+                        accel_method = UXA;
+                else
+#endif
+                        accel_method = DEFAULT_ACCEL_METHOD;
+        }
+        switch (accel_method) {
+        default:
+#if USE_GLAMOR

src/uxa/intel_driver.c static void intel_check_chipset_option(ScrnInfoPtr scrn) · line 293

Quoted 10 lines
src/uxa/intel_driver.c +10 -0
+        case GLAMOR:
+                intel->accel = ACCEL_GLAMOR;
+                break;
+#endif
+#if USE_UXA
+        case UXA:
+                intel->accel = ACCEL_UXA;
+                break;
+#endif
+        }

The extra enum and temporary variable introduced here seems pretty pointless (even if that pattern had happened before).

Quoted 7 lines
src/uxa/intel_glamor.c +2 -0
index 21636d1..e2bc24c 100644
 
+Bool
+intel_glamor_set_pixmap_bo(PixmapPtr pixmap, drm_intel_bo *bo)

src/uxa/intel_glamor.c line 117

Quoted 10 lines
src/uxa/intel_glamor.c +10 -0
+{
+        if (bo == NULL || glamor_egl_create_textured_pixmap(pixmap,
+                                                            bo->handle,
+                                                            intel_pixmap_pitch(pixmap)))
+        {
+                intel_glamor_reference_pixmap_bo(pixmap, bo);
+                return TRUE;
+        }
+        return FALSE;
+}

I don't think this will work -- glamor_egl uses a different fd from intel->bufmgr, so you're attaching some unrelated BO, if you're even that lucky.

src/uxa/intel_glamor.c intel_glamor_pre_init(ScrnInfoPtr scrn) · line 215

Quoted 11 lines

Bool
intel_glamor_init(ScreenPtr screen)
{

src/uxa/intel_glamor.c +3 -3
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-	intel_screen_private *intel = intel_get_screen_private(scrn);
 
-	if ((intel->uxa_flags & UXA_GLAMOR_EGL_INITIALIZED) == 0)
-		goto fail;
+	if (!dixPrivateKeyRegistered(&intel_glamor_pixmap_key))
+                if (!dixRegisterPrivateKey(&intel_glamor_pixmap_key, PRIVATE_PIXMAP, sizeof (struct intel_glamor_pixmap)))
+                        return FALSE;

No need to check for initiailization -- double-calling it is safe (as long as the size is consistent).

src/uxa/intel_glamor.c intel_glamor_flush(intel_screen_private * intel) · line 244

Quoted 9 lines

void

src/uxa/intel_glamor.c +1 -2
@@ -258,18 +240,52 @@ intel_glamor_flush(intel_screen_private * intel)
 	ScreenPtr screen;
 
 	screen = xf86ScrnToScreen(intel->scrn);
-	if (intel->uxa_flags & UXA_USE_GLAMOR)
-		glamor_block_handler(screen);
+        glamor_block_handler(screen);
 }

glamor_block_handler() is pretty awfully named. We should do something about that.

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

A message that is not in the archive (sent off-list or not yet received): 8761iedzxh.fsf-omZaPlIz5HhaEpDpdNBo/[email protected]

#20 lore raw

Re: [PATCH 10/12] Add glamor back into the driver

Quoted 9 lines · Eric Anholt
Quoted 2 lines · Keith Packard

This adds glamor support back into the driver, but instad of going through UXA, this uses it directly instead.

This is hard to read with the conditionalizing all of the UXA code in the same commit as adding the glamor code. Then there are a bunch of unrelated whitespace changes, or flattening of a bunch of nested conditionals.

I'm not sure how to make the patch easier to review; I guess I could make UXA conditional first? That would be 'crazy' in that the driver would fail to ever work if you didn't ask for UXA, but might make the patch easier to read?

Quoted 4 lines

The only substantive problem I see is intel_glamor_set_pixmap_bo().

The extra enum and temporary variable introduced here seems pretty pointless (even if that pattern had happened before).

Agreed. The problem is that 'DEFAULT_ACCEL_METHOD' is defined as 'GLAMOR', 'UXA' or 'NONE' by configure.ac. This seemed like the cleanest solution in some ways. I also liked having the accel_type enum *not* define acceleration types which weren't compiled into the driver; that caught a few missing #ifdefs

Quoted 3 lines

I don't think this will work -- glamor_egl uses a different fd from intel->bufmgr, so you're attaching some unrelated BO, if you're even that lucky.

This API uses the same FD as the intel bufmgr.

From intel_glamor.c:

        if (!glamor_egl_init(scrn, intel->drmSubFD)) {

From glamor_egl.c:

        Bool
        glamor_egl_init(ScrnInfoPtr scrn, int fd)
        ...

	    glamor_egl->fd = fd;
        ...                
	    glamor_egl->has_gem = glamor_egl_check_has_gem(fd);

        ...
        Bool
	glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
	...
            if (glamor_egl->has_gem) {
                if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {

So, you pass in a GEM handle for the intel driver bufmgr and glamor does the flink to get a global name.

We should be using an FD passing mechanism here instead, to avoid creating more global names...

Quoted 2 lines

No need to check for initiailization -- double-calling it is safe (as long as the size is consistent).

Thanks. Will fix.

Quoted 4 lines
Quoted 4 lines

void

src/uxa/intel_glamor.c +0 -0
@@ -258,18 +240,52 @@ intel_glamor_flush(intel_screen_private * intel)
 	ScreenPtr screen;
 
Quoted 8 lines

src/uxa/intel_glamor.c intel_glamor_flush(intel_screen_private * intel) · line 244

Quoted 5 lines
src/uxa/intel_glamor.c +1 -2
 	screen = xf86ScrnToScreen(intel->scrn);
-	if (intel->uxa_flags & UXA_USE_GLAMOR)
-		glamor_block_handler(screen);
+        glamor_block_handler(screen);
 }

glamor_block_handler() is pretty awfully named. We should do something about that.

Suggestions welcome :-)

Thanks for the careful review.

Signature · 1 line
[email protected]

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#21 lore raw

PATCH 11/12 Add "none" acceleration option

In reply to a message not in the archive

This just uses fb directly

---
 configure.ac            |  24 ++++-
 src/Makefile.am         |   9 +-
 src/intel_module.c      |  12 ++-
 src/uxa/Makefile.am     |  46 ++++++---
 src/uxa/intel.h         |   5 +
 src/uxa/intel_display.c |   6 ++
 src/uxa/intel_dri3.c    |  49 ++++++----
 src/uxa/intel_driver.c  | 245 ++++++++++++++++++++++++++++++------------------
 src/uxa/intel_glamor.c  |  10 ++
 src/uxa/intel_none.c    | 189 +++++++++++++++++++++++++++++++++++++
 src/uxa/intel_none.h    |  38 ++++++++
 src/uxa/intel_uxa.c     |   9 ++
 12 files changed, 504 insertions(+), 138 deletions(-)
 create mode 100644 src/uxa/intel_none.c
 create mode 100644 src/uxa/intel_none.h
configure.ac +20 -4
index 5c3dd20..46c3143 100644
@@ -396,7 +396,6 @@ if test "x$UXA" = "xauto"; then
 fi
 if test "x$UXA" != "xno"; then
 	AC_DEFINE(USE_UXA, 1, [Enable UXA support])
-	PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= $uxa_requires_libdrm])
 	required_pixman_version=0.24
 	UXA=yes
 fi
@@ -407,9 +406,6 @@ AC_ARG_ENABLE(glamor,
 	      [GLAMOR="$enableval"],
 	      [GLAMOR="no"])
 if test "x$GLAMOR" != "xno"; then
-	if test "x$UXA" != "xyes"; then
-		AC_MSG_ERROR([Glamor acceleration requested but UXA is not enabled])
-	fi
 	if pkg-config --exists "xorg-server >= 1.15.99.901"; then
 		GLAMOR="yes (using Xorg glamor module)"
 	else
@@ -417,9 +413,12 @@ if test "x$GLAMOR" != "xno"; then
 		PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
 		GLAMOR="yes (using libglamor)"
 	fi
+	GLAMOR=yes
 	AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
 fi
 
+PKG_CHECK_MODULES(DRMINTEL, [libdrm_intel >= $uxa_requires_libdrm])
+
 PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_server_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
 ABI_VERSION=`$PKG_CONFIG --variable=abi_videodrv xorg-server`
 
@@ -661,6 +660,12 @@ if test "x$accel" = "xauto"; then
 	else
 		if test "x$UXA" != "xno"; then
 			accel="uxa"
+		else
+			if test "x$GLAMOR" != "xno"; then
+				accel="glamor"
+			else
+				accel="none"
+			fi
 		fi
 	fi
 	if test "x$accel" = "xauto" -a "x$KMS" = "xyes"; then
@@ -696,6 +701,11 @@ if test "x$accel" = "xglamor"; then
 	fi
 fi
 
+if test "x$accel" = "xnone"; then
+	AC_DEFINE(DEFAULT_ACCEL_METHOD, NONE, [Default acceleration method])
+	have_accel="yes"
+fi
+
 if test "x$have_accel" = "xnone"; then
 	if test "x$KMS" = "xyes"; then
 		AC_MSG_ERROR([Invalid default acceleration option])
@@ -886,6 +896,12 @@ if test "x$GLAMOR" != "xno"; then
 	fi
 fi
 
+if test "$accel" = "none"; then
+	accel_msg="$accel_msg *none"
+else
+	accel_msg="$accel_msg none"
+fi
+
 if test "x$dri_msg" = "x"; then
 	dri_msg=" none"
 fi
src/Makefile.am +2 -7
index aa8b47e..ce6f836 100644
@@ -18,7 +18,7 @@
 #  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.
 
-SUBDIRS = render_program legacy
+SUBDIRS = render_program legacy uxa
 
 # this is obnoxious:
 # -module lets us name the module exactly how we want
@@ -41,18 +41,13 @@ endif
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
 intel_drv_ladir = $(moduledir)/drivers
-intel_drv_la_LIBADD = legacy/liblegacy.la $(PCIACCESS_LIBS) $(XORG_LIBS)
+intel_drv_la_LIBADD = legacy/liblegacy.la uxa/libuxa.la $(PCIACCESS_LIBS) $(XORG_LIBS)
 
 if SNA
 SUBDIRS += sna
 intel_drv_la_LIBADD += sna/libsna.la
 endif
 
-if UXA
-SUBDIRS += uxa
-intel_drv_la_LIBADD += uxa/libuxa.la
-endif
-
 NULL:=#
 
 intel_drv_la_SOURCES = \
src/intel_module.c +8 -4
index d6a0d3c..b8d7f91 100644
@@ -489,7 +489,7 @@ _xf86findDriver(const char *ident, XF86ConfDevicePtr p)
 	return NULL;
 }
 
-static enum accel_method { SNA, UXA, GLAMOR } get_accel_method(void)
+static enum accel_method { NONE, SNA, UXA, GLAMOR } get_accel_method(void)
 {
 	enum accel_method accel_method = DEFAULT_ACCEL_METHOD;
 	XF86ConfDevicePtr dev;
@@ -509,6 +509,8 @@ static enum accel_method { SNA, UXA, GLAMOR } get_accel_method(void)
 				accel_method = UXA;
 			else if (strcasecmp(s, "glamor") == 0)
 				accel_method = GLAMOR;
+                        else if (strcasecmp(s, "none") == 0)
+                                 accel_method = NONE;
 		}
 	}
 
@@ -564,12 +566,14 @@ intel_scrn_create(DriverPtr		driver,
 #if USE_SNA
 	case SNA: return sna_init_scrn(scrn, entity_num);
 #endif
-#if USE_UXA
+#if USE_GLAMOR
 	case GLAMOR:
+#endif
+#if USE_UXA
 	case UXA:
-		  return intel_init_scrn(scrn);
 #endif
-
+        case NONE:
+		  return intel_init_scrn(scrn);
 	default: break;
 	}
 #endif
src/uxa/Makefile.am +33 -13

78 lines not on this page · raw message

src/uxa/intel.h +5 -0
index 5fbb2c7..ae33938 100644
@@ -112,6 +112,7 @@ enum dri_type {
 };
 
 enum accel_type {
+        ACCEL_NONE,
 #if USE_GLAMOR
         ACCEL_GLAMOR,
 #endif
@@ -126,9 +127,11 @@ typedef struct intel_screen_private {
 
         enum accel_type accel;
 
+#if USE_UXA
 #define RENDER_BATCH			I915_EXEC_RENDER
 #define BLT_BATCH			I915_EXEC_BLT
 	unsigned int current_batch;
+#endif
 
 	void *modes;
 	drm_intel_bo *front_buffer, *back_buffer;
@@ -544,7 +547,9 @@ Bool intel_present_screen_init(ScreenPtr screen);
 static inline Bool intel_present_screen_init(ScreenPtr screen) { return 0; }
 #endif
 
+#if USE_UXA
 #include "intel_uxa.h"
+#endif
 
 dri_bo *
 intel_get_pixmap_bo(PixmapPtr pixmap);
src/uxa/intel_display.c +6 -0
index a4c4b82..1d4ba3c 100644
@@ -56,9 +56,11 @@
 #include "xf86DDC.h"
 #include "fb.h"
 #include "uxa.h"
+
 #if USE_GLAMOR
 #include "intel_glamor.h"
 #endif
+#include "intel_none.h"
 
 #define KNOWN_MODE_FLAGS ((1<<14)-1)
 
@@ -1491,6 +1493,10 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
                         goto fail;
                 break;
 #endif
+        case ACCEL_NONE:
+                if (!intel_none_create_screen_resources(scrn->pScreen))
+                        goto fail;
+                break;
         }
 
 	for (i = 0; i < xf86_config->num_crtc; i++) {
src/uxa/intel_dri3.c +30 -19

74 lines not on this page · raw message

src/uxa/intel_driver.c +154 -91

404 lines not on this page · raw message

src/uxa/intel_glamor.c +10 -0
index e2bc24c..cc98eb4 100644
@@ -36,6 +36,7 @@
 #define GLAMOR_FOR_XORG  1
 #include <glamor.h>
 #include <unistd.h>
+#include <mipict.h>
 
 #include "intel.h"
 #include "i915_drm.h"
@@ -210,6 +211,15 @@ intel_glamor_init(ScreenPtr screen)
 {
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 
+	/* Must be first, before anything else installs screen callbacks. */
+	if (!fbScreenInit(screen, NULL,
+			  scrn->virtualX, scrn->virtualY,
+			  scrn->xDpi, scrn->yDpi,
+			  scrn->displayWidth, scrn->bitsPerPixel))
+		return FALSE;
+
+	fbPictureInit(screen, NULL, 0);
+
 	if (!dixPrivateKeyRegistered(&intel_glamor_pixmap_key))
                 if (!dixRegisterPrivateKey(&intel_glamor_pixmap_key, PRIVATE_PIXMAP, sizeof (struct intel_glamor_pixmap)))
                         return FALSE;
src/uxa/intel_none.c new file +189 -0

189 lines not on this page · raw message

src/uxa/intel_none.h new file +38 -0
new file mode 100644
index 0000000..1c20b02
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _INTEL_NONE_H_
+#define _INTEL_NONE_H_
+
+Bool
+intel_none_init(ScreenPtr screen);
+
+Bool
+intel_none_create_screen_resources(ScreenPtr screen);
+
+dri_bo *
+intel_none_get_pixmap_bo(PixmapPtr pixmap);
+
+Bool
+intel_none_set_pixmap_bo(PixmapPtr pixmap, dri_bo *dri_bo);
+
+#endif /* _INTEL_NONE_H_ */
src/uxa/intel_uxa.c +9 -0
index e9d905b..358960e 100644
@@ -1272,6 +1272,15 @@ Bool intel_uxa_init(ScreenPtr screen)
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
+	/* Must be first, before anything else installs screen callbacks. */
+	if (!fbScreenInit(screen, NULL,
+			  scrn->virtualX, scrn->virtualY,
+			  scrn->xDpi, scrn->yDpi,
+			  scrn->displayWidth, scrn->bitsPerPixel))
+		return FALSE;
+
+	fbPictureInit(screen, NULL, 0);
+
 	intel_batch_init(scrn);
 
 	if (INTEL_INFO(intel)->gen >= 040 && INTEL_INFO(intel)->gen < 0100)
Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
#22 lore raw

PATCH 12/12 Delay initial modeset until root window contents are prepared

In reply to a message not in the archive

Wait until the root window has been painted for the first time before doing the modeset. This avoids flashing black while the root window gets set up.

---
 src/uxa/intel.h         |  2 ++
 src/uxa/intel_display.c | 39 ++++++++++++++++++---------------------
 src/uxa/intel_driver.c  | 40 +++++++++++++++++++++++++++++++++++-----
 3 files changed, 55 insertions(+), 26 deletions(-)
src/uxa/intel.h +2 -0
index ae33938..fa2aa64 100644
@@ -194,6 +194,8 @@ typedef struct intel_screen_private {
 	void (*batch_flush) (struct intel_screen_private *intel);
 	void (*batch_commit_notify) (struct intel_screen_private *intel);
 
+        Bool need_entervt;
+
 #if USE_UXA
 	struct _UxaDriver *uxa_driver;
 	int uxa_flags;
src/uxa/intel_display.c +18 -21
index 1d4ba3c..758f01f 100644
@@ -2319,7 +2319,7 @@ void intel_copy_fb(ScrnInfoPtr scrn)
 	ScreenPtr pScreen = xf86ScrnToScreen(scrn);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	PixmapPtr src, dst;
-	unsigned int pitch = scrn->displayWidth * intel->cpp;
+        GCPtr gc;
 	struct intel_crtc *intel_crtc;
 	int i, fbcon_id;
 
@@ -2339,30 +2339,27 @@ void intel_copy_fb(ScrnInfoPtr scrn)
 	if (src == NULL)
 		return;
 
-	/* We dont have a screen Pixmap yet */
-	dst = intel_create_pixmap_for_bo(pScreen, intel->front_buffer,
-					 scrn->virtualX, scrn->virtualY,
-					 scrn->depth, scrn->bitsPerPixel,
-					 pitch);
+        dst = (*pScreen->GetScreenPixmap)(pScreen);
+
 	if (dst == NullPixmap)
 		goto cleanup_src;
 
-	if (!intel->uxa_driver->prepare_copy(src, dst,
-					     -1, -1,
-					     GXcopy, FB_ALLONES))
-		goto cleanup_dst;
-
-	intel->uxa_driver->copy(dst,
-				0, 0,
-				0, 0,
-				scrn->virtualX, scrn->virtualY);
-	intel->uxa_driver->done_copy(dst);
-#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0)
-	pScreen->canDoBGNoneRoot = TRUE;
-#endif
+        gc = GetScratchGC(scrn->depth, pScreen);
+
+        if (!gc)
+                goto cleanup_src;
+
+        ValidateGC(&dst->drawable, gc);
+
+        (*gc->ops->CopyArea)(&src->drawable,
+                             &dst->drawable,
+                             gc,
+                             0, 0,
+                             scrn->virtualX, scrn->virtualY,
+                             0, 0);
+
+        FreeScratchGC(gc);
 
-cleanup_dst:
-	(*pScreen->DestroyPixmap)(dst);
 cleanup_src:
 	(*pScreen->DestroyPixmap)(src);
 }
src/uxa/intel_driver.c +35 -5
index 316de64..0475a17 100644
@@ -170,13 +170,19 @@ static Bool i830CreateScreenResources(ScreenPtr screen)
         case ACCEL_GLAMOR:
                 if (!intel_glamor_create_screen_resources(screen))
                         return FALSE;
+#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0)
+                screen->canDoBGNoneRoot = TRUE;
+#endif
                 break;
 #endif
 #if USE_UXA
         case ACCEL_UXA:
                 if (!intel_uxa_create_screen_resources(screen))
                         return FALSE;
-                intel_copy_fb(scrn);
+#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0)
+                screen->canDoBGNoneRoot = TRUE;
+#endif
+                break;
 #endif
         case ACCEL_NONE:
                 if (!intel_none_create_screen_resources(screen))
@@ -830,6 +836,29 @@ I830BlockHandler(BLOCKHANDLER_ARGS_DECL)
 
 	screen->BlockHandler = intel->BlockHandler;
 
+        /* At server init time, get the root window bits from fbcon if
+         * available and then update the protocol-level information
+         * for both RandR and XINERAMA
+         */
+        if (intel->need_entervt) {
+                intel->need_entervt = FALSE;
+
+                if (screen->root->backgroundState == None)
+                        intel_copy_fb(scrn);
+
+                /* Must force it before EnterVT, so we are in control of VT and
+                 * later memory should be bound when allocating, e.g rotate_mem */
+                scrn->vtSema = TRUE;
+
+                if (!I830EnterVT(VT_FUNC_ARGS(0))) {
+                        xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                                   "Failed to perform initial modeset.\n");
+                        FatalError("Mode set failed\n");
+                }
+
+                xf86RandR12CreateScreenResources(screen);
+        }
+
 	(*screen->BlockHandler) (BLOCKHANDLER_ARGS);
 
 	intel->BlockHandler = screen->BlockHandler;
@@ -1211,11 +1240,12 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
 	I830UeventInit(scrn);
 #endif
 
-	/* Must force it before EnterVT, so we are in control of VT and
-	 * later memory should be bound when allocating, e.g rotate_mem */
-	scrn->vtSema = TRUE;
+        /* Delay the call to I830EnterVT until
+         * the server is all ready to accept protocol requests.
+         */
+        intel->need_entervt = TRUE;
 
-	return I830EnterVT(VT_FUNC_ARGS(0));
+        return TRUE;
 }
 
 static void i830AdjustFrame(ADJUST_FRAME_ARGS_DECL)
Signature · 6 lines
2.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
Reviewed-by Acked-by
#23 lore raw
In reply to a message not in the archive
Quoted 3 lines · Keith Packard

I spent the day just cleaning up this patch series and testing. I think it's ready for others to use and review. I've been running it on two machines for a couple of days now and it's been solid.

Patches 2, 4 are:

Patch 5 is:

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#24 lore raw
Quoted 6 lines · Eric Anholt
Quoted 3 lines · Keith Packard

I spent the day just cleaning up this patch series and testing. I think it's ready for others to use and review. I've been running it on two machines for a couple of days now and it's been solid.

Quoted 7 lines

Patches 2, 4 are:

Patch 5 is:

Thanks.

Signature · 1 line
[email protected]

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

#25 lore raw
In reply to Eric Anholt
Quoted 6 lines · Eric Anholt
Quoted 3 lines · Keith Packard

I spent the day just cleaning up this patch series and testing. I think it's ready for others to use and review. I've been running it on two machines for a couple of days now and it's been solid.

Quoted 7 lines

Patches 2, 4 are:

Patch 5 is:

I've pushed a new version of the tree with your review marked and a few changes:

* Split the GetScratchPixmapHeader change into two pieces; the first just removes the redundant calls to drm_intel_bo_disable_reuse and the second contains the scratch pixmap changes and the other misc stuff. Yes, I could split the misc changes out into another cleanup patch if you want.

* Removed the tiling check from intel_present when flipping. The kernel doesn't appear to ever require matching tiling.

* Removed call to dixPrivateKeyRegistered in the 'Add glamor back' patch.

What I didn't do is clean up the 'remove glamor' patch so that it would compile even with --enable-glamor. Fixing that seems like noise to me; all of the changes needed to make it work would be immediately un-done when adding glamor back.

Signature · 1 line
[email protected]

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

#26 lore raw

PATCH 3/12 Don't use GetScratchPixmapHeader for shadow pixmaps

In reply to Keith Packard

GetScratchPixmapHeader should only be used for local memory pixmaps, as used by PutImage and friends. That's because when you free the scratch pixmap header, it doesn't actually free the pixmap; instead, it gets stuffed in pScreen->pScratchPixmap and any private data stored on it will be left hanging around forever.

In the case of glamor, that private data includes all of the GL state. Using that scratch pixmap later results in glamor getting mightily confused as the pixmap and underlying objects do not match.

Avoid this by allocating pixmap headers explicitly for this purpose.

---
 src/uxa/intel_display.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)
src/uxa/intel_display.c +30 -14
index 0b83140..bcaafaa 100644
@@ -545,13 +545,31 @@ intel_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 		return NULL;
 	}
 
-	drm_intel_bo_disable_reuse(intel_crtc->rotate_bo);
-
 	intel_crtc->rotate_pitch = rotate_pitch;
 	return intel_crtc->rotate_bo;
 }
 
 static PixmapPtr
+intel_create_pixmap_header(ScreenPtr pScreen, int width, int height, int depth,
+                           int bitsPerPixel, int devKind, void *pPixData)
+{
+        PixmapPtr pixmap;
+
+        /* width and height of 0 means don't allocate any pixmap data */
+        pixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0);
+
+        if (pixmap) {
+                if ((*pScreen->ModifyPixmapHeader) (pixmap, width, height, depth,
+                                                    bitsPerPixel, devKind, pPixData))
+                {
+                        return pixmap;
+                }
+                (*pScreen->DestroyPixmap) (pixmap);
+        }
+        return NullPixmap;
+}
+
+static PixmapPtr
 intel_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 {
 	ScrnInfoPtr scrn = crtc->scrn;
@@ -573,12 +591,12 @@ intel_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 		return NULL;
 	}
 
-	rotate_pixmap = GetScratchPixmapHeader(scrn->pScreen,
-					       width, height,
-					       scrn->depth,
-					       scrn->bitsPerPixel,
-					       intel_crtc->rotate_pitch,
-					       NULL);
+	rotate_pixmap = intel_create_pixmap_header(scrn->pScreen,
+                                                   width, height,
+                                                   scrn->depth,
+                                                   scrn->bitsPerPixel,
+                                                   intel_crtc->rotate_pitch,
+                                                   NULL);
 
 	if (rotate_pixmap == NULL) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -602,8 +620,8 @@ intel_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
 	struct intel_mode *mode = intel_crtc->mode;
 
 	if (rotate_pixmap) {
-		intel_set_pixmap_bo(rotate_pixmap, NULL);
-		FreeScratchPixmapHeader(rotate_pixmap);
+                intel_set_pixmap_bo(rotate_pixmap, NULL);
+                rotate_pixmap->drawable.pScreen->DestroyPixmap(rotate_pixmap);
 	}
 
 	if (data) {
@@ -1415,7 +1433,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	int	    i, old_width, old_height, old_pitch;
 	int pitch;
 	uint32_t tiling;
-	ScreenPtr screen;
 
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
@@ -1430,8 +1447,7 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	old_front = intel->front_buffer;
 
 	if (intel->back_pixmap) {
-		screen = intel->back_pixmap->drawable.pScreen;
-		screen->DestroyPixmap(intel->back_pixmap);
+		scrn->pScreen->DestroyPixmap(intel->back_pixmap);
 		intel->back_pixmap = NULL;
 	}
 
@@ -1454,7 +1470,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	if (ret)
 		goto fail;
 
-	drm_intel_bo_disable_reuse(intel->front_buffer);
 	intel->front_pitch = pitch;
 	intel->front_tiling = tiling;
 
@@ -2204,6 +2219,7 @@ Bool intel_crtc_on(xf86CrtcPtr crtc)
 	return ret;
 }
 
+
 static PixmapPtr
 intel_create_pixmap_for_bo(ScreenPtr pScreen, dri_bo *bo,
 			   int width, int height,
Signature · 1 line
2.0.1

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-4-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

#28 lore raw

Re: [PATCH 03/12] Don't use GetScratchPixmapHeader for shadow pixmaps

Quoted 22 lines · Keith Packard

GetScratchPixmapHeader should only be used for local memory pixmaps, as used by PutImage and friends. That's because when you free the scratch pixmap header, it doesn't actually free the pixmap; instead, it gets stuffed in pScreen->pScratchPixmap and any private data stored on it will be left hanging around forever.

In the case of glamor, that private data includes all of the GL state. Using that scratch pixmap later results in glamor getting mightily confused as the pixmap and underlying objects do not match.

Avoid this by allocating pixmap headers explicitly for this purpose.

---
 src/uxa/intel_display.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)
src/uxa/intel_display.c +0 -0
index 0b83140..bcaafaa 100644

src/uxa/intel_display.c intel_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height) · line 550

Quoted 8 lines
src/uxa/intel_display.c +0 -2
@@ -545,13 +545,31 @@ intel_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 		return NULL;
 	}
 
-	drm_intel_bo_disable_reuse(intel_crtc->rotate_bo);
-
 	intel_crtc->rotate_pitch = rotate_pitch;
 	return intel_crtc->rotate_bo;
 }

See comment below...

Quoted 20 lines
src/uxa/intel_display.c +2 -3
@@ -602,8 +620,8 @@ intel_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
 	struct intel_mode *mode = intel_crtc->mode;
 
 	if (rotate_pixmap) {
-		intel_set_pixmap_bo(rotate_pixmap, NULL);
-		FreeScratchPixmapHeader(rotate_pixmap);
+                intel_set_pixmap_bo(rotate_pixmap, NULL);
+                rotate_pixmap->drawable.pScreen->DestroyPixmap(rotate_pixmap);
 	}
 
 	if (data) {
@@ -1415,7 +1433,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	int	    i, old_width, old_height, old_pitch;
 	int pitch;
 	uint32_t tiling;
-	ScreenPtr screen;
 
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;

src/uxa/intel_display.c intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) · line 1453

Quoted 9 lines
src/uxa/intel_display.c +1 -2
@@ -1430,8 +1447,7 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	old_front = intel->front_buffer;
 
 	if (intel->back_pixmap) {
-		screen = intel->back_pixmap->drawable.pScreen;
-		screen->DestroyPixmap(intel->back_pixmap);
+		scrn->pScreen->DestroyPixmap(intel->back_pixmap);
 		intel->back_pixmap = NULL;
 	}
 

Grumble, unrelated noise in the patch.

src/uxa/intel_display.c intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) · line 1475

Quoted 8 lines
src/uxa/intel_display.c +0 -1
@@ -1454,7 +1470,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	if (ret)
 		goto fail;
 
-	drm_intel_bo_disable_reuse(intel->front_buffer);
 	intel->front_pitch = pitch;
 	intel->front_tiling = tiling;
 

This change appears to be unrelated, and possibly harmful (if X has dropped the last ref to the BO, but it's still the scanout buffer, a new allocation would now reuse the BO and scribble on scanout until the next modeset happens).

src/uxa/intel_display.c Bool intel_crtc_on(xf86CrtcPtr crtc) · line 2225

Quoted 8 lines
src/uxa/intel_display.c +1 -0
@@ -2204,6 +2219,7 @@ Bool intel_crtc_on(xf86CrtcPtr crtc)
 	return ret;
 }
 
+
 static PixmapPtr
 intel_create_pixmap_for_bo(ScreenPtr pScreen, dri_bo *bo,
 			   int width, int height,

Unrelated whitespace.

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#29 lore raw

Re: [PATCH 03/12] Don't use GetScratchPixmapHeader for shadow pixmaps

Quoted 4 lines · Eric Anholt

This change appears to be unrelated, and possibly harmful (if X has dropped the last ref to the BO, but it's still the scanout buffer, a new allocation would now reuse the BO and scribble on scanout until the next modeset happens).

Yeah, it's unrelated. intel_allocate_framebuffer calls disable_reuse, so there's no need to call it from these two other places. I'll split that change out into a separate patch with separate comment.

Quoted 1 line

Unrelated whitespace.

There are a bunch of whitespace fixups; should I pull those into a separate patch or just leave them scattered in the first patch to change a file?

Signature · 1 line
[email protected]

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

#30 lore raw

Re: [PATCH 03/12] Don't use GetScratchPixmapHeader for shadow pixmaps

Quoted 11 lines · Keith Packard
Quoted 4 lines · Eric Anholt

This change appears to be unrelated, and possibly harmful (if X has dropped the last ref to the BO, but it's still the scanout buffer, a new allocation would now reuse the BO and scribble on scanout until the next modeset happens).

Yeah, it's unrelated. intel_allocate_framebuffer calls disable_reuse, so there's no need to call it from these two other places. I'll split that change out into a separate patch with separate comment.

Quoted 5 lines
Quoted 1 line

Unrelated whitespace.

There are a bunch of whitespace fixups; should I pull those into a separate patch or just leave them scattered in the first patch to change a file?

One patch at the front is fine with me.

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

#31 lore raw

PATCH 4/12 Move intel_alloc_framebuffer to intel_memory.c

In reply to Keith Packard

UXA and Glamor both share this function, so move it out of the UXA file.

---
 src/uxa/intel.h        |   5 ++
 src/uxa/intel_memory.c | 138 ++++++++++++++++++++++++++++++++++++++++++
 src/uxa/intel_uxa.c    | 158 ++++---------------------------------------------
 3 files changed, 154 insertions(+), 147 deletions(-)
src/uxa/intel.h +5 -0
index 409635d..8110c2e 100644
@@ -539,6 +539,11 @@ unsigned long intel_get_fence_pitch(intel_screen_private *intel, unsigned long p
 Bool intel_check_display_stride(ScrnInfoPtr scrn, int stride, Bool tiling);
 void intel_set_gem_max_sizes(ScrnInfoPtr scrn);
 
+unsigned int
+intel_compute_size(struct intel_screen_private *intel,
+                   int w, int h, int bpp, unsigned usage,
+                   uint32_t *tiling, int *stride);
+
 drm_intel_bo *intel_allocate_framebuffer(ScrnInfoPtr scrn,
 					 int width, int height, int cpp,
 					 int *out_stride,
src/uxa/intel_memory.c +138 -0

141 lines not on this page · raw message

src/uxa/intel_uxa.c +11 -147

182 lines not on this page · raw message

Signature · 1 line
2.0.1
#32 lore raw

PATCH 5/12 Rename uxa-specific functions and structs

In reply to Keith Packard

This starts to separate uxa from the rest of the driver by renaming uxa-specific functions and structs to make it clear which portions of the driver are uxa-specific and which are common.

---
 src/uxa/Makefile.am           |    4 +
 src/uxa/i830_render.c         |   82 +--
 src/uxa/i915_render.c         |  100 ++--
 src/uxa/i915_video.c          |   10 +-
 src/uxa/i965_render.c         |   98 +--
 src/uxa/i965_video.c          |   48 +-
 src/uxa/intel.h               |  267 +--------
 src/uxa/intel_batchbuffer.c   |    8 +-
 src/uxa/intel_batchbuffer.h   |    4 +-
 src/uxa/intel_display.c       |   78 +++
 src/uxa/intel_dri.c           |   26 +-
 src/uxa/intel_dri3.c          |   10 +-
 src/uxa/intel_driver.c        |   39 +-
 src/uxa/intel_glamor.c        |    4 +-
 src/uxa/intel_uxa.c           |  136 +++--
 src/uxa/intel_uxa.h           |  300 ++++++++++
 src/uxa/intel_uxa_video.c     |  389 ++++++++++++
 src/uxa/intel_video.c         | 1312 +++++++----------------------------------
 src/uxa/intel_video.h         |  156 +++--
 src/uxa/intel_video_overlay.c |  554 +++++++++++++++++
 src/uxa/intel_video_overlay.h |   51 ++
 21 files changed, 2004 insertions(+), 1672 deletions(-)
 create mode 100644 src/uxa/intel_uxa.h
 create mode 100644 src/uxa/intel_uxa_video.c
 create mode 100644 src/uxa/intel_video_overlay.c
 create mode 100644 src/uxa/intel_video_overlay.h
src/uxa/Makefile.am +4 -0
index 0e10a2b..23b074d 100644
@@ -25,6 +25,7 @@ AM_CFLAGS += -I$(top_srcdir)/xvmc -I$(top_srcdir)/src -I$(top_srcdir)/src/render
 noinst_LTLIBRARIES = libuxa.la
 libuxa_la_LIBADD = $(UDEV_LIBS) $(DRMINTEL_LIBS) $(DRM_LIBS)
 libuxa_la_SOURCES = \
+	intel_uxa.h \
 	brw_defines.h \
 	brw_structs.h \
 	common.h \
@@ -38,6 +39,9 @@ libuxa_la_SOURCES = \
 	intel_uxa.c \
 	intel_video.c \
 	intel_video.h \
+	intel_video_overlay.c \
+	intel_video_overlay.h \
+	intel_uxa_video.c \
 	i830_3d.c \
 	i830_render.c \
 	i830_reg.h \
src/uxa/i830_render.c +41 -41

286 lines not on this page · raw message

src/uxa/i915_render.c +50 -50

350 lines not on this page · raw message

src/uxa/i915_video.c +5 -5
index 16389cd..1996e8c 100644
@@ -67,7 +67,7 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 	dyo = dstRegion->extents.y1;
 
 	if (pixmap->drawable.width > 2048 || pixmap->drawable.height > 2048 ||
-	    !intel_check_pitch_3d(pixmap)) {
+	    !intel_uxa_check_pitch_3d(pixmap)) {
 		ScreenPtr screen = pixmap->drawable.pScreen;
 
 		target = screen->CreatePixmap(screen,
@@ -78,7 +78,7 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 		if (target == NULL)
 			return;
 
-		if (intel_get_pixmap_bo(target) == NULL) {
+		if (intel_uxa_get_pixmap_bo(target) == NULL) {
 			screen->DestroyPixmap(target);
 			return;
 		}
@@ -159,9 +159,9 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 			  DSTORG_VERT_BIAS(0x8) | format);
 
 		/* front buffer, pitch, offset */
-		if (intel_pixmap_tiled(target)) {
+		if (intel_uxa_pixmap_tiled(target)) {
 			tiling = BUF_3D_TILED_SURFACE;
-			if (intel_get_pixmap_private(target)->tiling == I915_TILING_Y)
+			if (intel_uxa_get_pixmap_private(target)->tiling == I915_TILING_Y)
 				tiling |= BUF_3D_TILE_WALK_Y;
 		} else
 			tiling = 0;
@@ -488,5 +488,5 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 		target->drawable.pScreen->DestroyPixmap(target);
 	}
 
-	intel_debug_flush(scrn);
+	intel_uxa_debug_flush(scrn);
 }
src/uxa/i965_render.c +49 -49

377 lines not on this page · raw message

src/uxa/i965_video.c +24 -24

189 lines not on this page · raw message

src/uxa/intel.h +18 -249

302 lines not on this page · raw message

src/uxa/intel_batchbuffer.c +4 -4
index dedf7f8..25349fc 100644
@@ -142,7 +142,7 @@ void intel_batch_teardown(ScrnInfoPtr scrn)
 static void intel_batch_do_flush(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	struct intel_pixmap *priv;
+	struct intel_uxa_pixmap *priv;
 
 	list_for_each_entry(priv, &intel->batch_pixmaps, batch)
 		priv->dirty = 0;
@@ -289,10 +289,10 @@ void intel_batch_submit(ScrnInfoPtr scrn)
 	}
 
 	while (!list_is_empty(&intel->batch_pixmaps)) {
-		struct intel_pixmap *entry;
+		struct intel_uxa_pixmap *entry;
 
 		entry = list_first_entry(&intel->batch_pixmaps,
-					 struct intel_pixmap,
+					 struct intel_uxa_pixmap,
 					 batch);
 
 		entry->busy = -1;
@@ -311,7 +311,7 @@ void intel_batch_submit(ScrnInfoPtr scrn)
 	intel->current_batch = 0;
 }
 
-void intel_debug_flush(ScrnInfoPtr scrn)
+void intel_uxa_debug_flush(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
src/uxa/intel_batchbuffer.h +2 -2
index 79e2ab0..e5fb8d0 100644
@@ -129,7 +129,7 @@ intel_batch_emit_reloc(intel_screen_private *intel,
 
 static inline void
 intel_batch_mark_pixmap_domains(intel_screen_private *intel,
-				struct intel_pixmap *priv,
+				struct intel_uxa_pixmap *priv,
 				uint32_t read_domains, uint32_t write_domain)
 {
 	assert (read_domains);
@@ -149,7 +149,7 @@ intel_batch_emit_reloc_pixmap(intel_screen_private *intel, PixmapPtr pixmap,
 			      uint32_t read_domains, uint32_t write_domain,
 			      uint32_t delta, int needs_fence)
 {
-	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
+	struct intel_uxa_pixmap *priv = intel_uxa_get_pixmap_private(pixmap);
 
 	intel_batch_mark_pixmap_domains(intel, priv, read_domains, write_domain);
 
src/uxa/intel_display.c +78 -0

81 lines not on this page · raw message

src/uxa/intel_dri.c +13 -13
index ef66aa5..65612f7 100644
@@ -82,7 +82,7 @@ static int i830_client_key;
 
 static uint32_t pixmap_flink(PixmapPtr pixmap)
 {
-	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
+	struct intel_uxa_pixmap *priv = intel_uxa_get_pixmap_private(pixmap);
 	uint32_t name;
 
 	if (priv == NULL || priv->bo == NULL)
@@ -113,7 +113,7 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	PixmapPtr old = get_drawable_pixmap(drawable);
-	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
+	struct intel_uxa_pixmap *priv = intel_uxa_get_pixmap_private(pixmap);
 	GCPtr gc;
 
 	/* With a glamor pixmap, 2D pixmaps are created in texture
@@ -140,12 +140,12 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
 		FreeScratchGC(gc);
 	}
 
-	intel_set_pixmap_private(pixmap, NULL);
+	intel_uxa_set_pixmap_private(pixmap, NULL);
 
 	/* Exchange the underlying texture/image. */
 	intel_glamor_exchange_buffers(intel, old, pixmap);
 	/* And redirect the pixmap to the new bo (for 3D). */
-	intel_set_pixmap_private(old, priv);
+	intel_uxa_set_pixmap_private(old, priv);
 	old->refcnt++;
 
 	screen->ModifyPixmapHeader(old,
@@ -739,10 +739,10 @@ i830_dri2_del_frame_event(DRI2FrameEventPtr info)
 	free(info);
 }
 
-static struct intel_pixmap *
+static struct intel_uxa_pixmap *
 intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr front, PixmapPtr back)
 {
-	struct intel_pixmap *new_front, *new_back;
+	struct intel_uxa_pixmap *new_front = NULL, *new_back;
 	RegionRec region;
 
 	/* Post damage on the front buffer so that listeners, such
@@ -755,10 +755,10 @@ intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr fron
 	region.data = NULL;
 	DamageRegionAppend(&front->drawable, &region);
 
-	new_front = intel_get_pixmap_private(back);
-	new_back = intel_get_pixmap_private(front);
-	intel_set_pixmap_private(front, new_front);
-	intel_set_pixmap_private(back, new_back);
+	new_front = intel_uxa_get_pixmap_private(back);
+	new_back = intel_uxa_get_pixmap_private(front);
+	intel_uxa_set_pixmap_private(front, new_front);
+	intel_uxa_set_pixmap_private(back, new_back);
 	new_front->busy = 1;
 	new_back->busy = -1;
 
@@ -774,7 +774,7 @@ I830DRI2ExchangeBuffers(struct intel_screen_private *intel, DRI2BufferPtr front,
 {
 	I830DRI2BufferPrivatePtr front_priv, back_priv;
 	int tmp;
-	struct intel_pixmap *new_front;
+	struct intel_uxa_pixmap *new_front;
 
 	front_priv = front->driverPrivate;
 	back_priv = back->driverPrivate;
@@ -967,8 +967,8 @@ can_exchange(DrawablePtr drawable, DRI2BufferPtr front, DRI2BufferPtr back)
 	I830DRI2BufferPrivatePtr back_priv = back->driverPrivate;
 	PixmapPtr front_pixmap = front_priv->pixmap;
 	PixmapPtr back_pixmap = back_priv->pixmap;
-	struct intel_pixmap *front_intel = intel_get_pixmap_private(front_pixmap);
-	struct intel_pixmap *back_intel = intel_get_pixmap_private(back_pixmap);
+	struct intel_uxa_pixmap *front_intel = intel_uxa_get_pixmap_private(front_pixmap);
+	struct intel_uxa_pixmap *back_intel = intel_uxa_get_pixmap_private(back_pixmap);
 
 	if (!pScrn->vtSema)
 		return FALSE;
src/uxa/intel_dri3.c +5 -5
index dc8d762..16a2463 100644
@@ -56,7 +56,7 @@ static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
 {
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	struct intel_pixmap *priv;
+	struct intel_uxa_pixmap *priv;
 	PixmapPtr pixmap;
 	dri_bo *bo;
 
@@ -84,10 +84,10 @@ static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
 	if (bo == NULL)
 		goto free_pixmap;
 
-	intel_set_pixmap_bo(pixmap, bo);
+	intel_uxa_set_pixmap_bo(pixmap, bo);
 	dri_bo_unreference(bo);
 
-	priv = intel_get_pixmap_private(pixmap);
+	priv = intel_uxa_get_pixmap_private(pixmap);
 	if (priv == NULL)
 		goto free_pixmap;
 
@@ -105,10 +105,10 @@ static int intel_dri3_fd_from_pixmap(ScreenPtr screen,
 				     CARD16 *stride,
 				     CARD32 *size)
 {
-	struct intel_pixmap *priv;
+	struct intel_uxa_pixmap *priv;
 	int fd;
 
-	priv = intel_get_pixmap_private(pixmap);
+	priv = intel_uxa_get_pixmap_private(pixmap);
 	if (!priv)
 		return -1;
 
src/uxa/intel_driver.c +14 -25
index a7ca906..8ab2252 100644
@@ -169,6 +169,18 @@ static Bool i830CreateScreenResources(ScreenPtr screen)
 	return TRUE;
 }
 
+void
+intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
+{
+        intel_uxa_set_pixmap_bo(pixmap, bo);
+}
+
+dri_bo *
+intel_get_pixmap_bo(PixmapPtr pixmap)
+{
+        return intel_uxa_get_pixmap_bo(pixmap);
+}
+
 static void PreInitCleanup(ScrnInfoPtr scrn)
 {
 	if (!scrn || !scrn->driverPrivate)
@@ -612,29 +624,6 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 	return TRUE;
 }
 
-/**
- * Intialiazes the hardware for the 3D pipeline use in the 2D driver.
- *
- * Some state caching is performed to avoid redundant state emits.  This
- * function is also responsible for marking the state as clobbered for DRI
- * clients.
- */
-void IntelEmitInvarientState(ScrnInfoPtr scrn)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-
-	/* If we've emitted our state since the last clobber by another client,
-	 * skip it.
-	 */
-	if (intel->last_3d != LAST_3D_OTHER)
-		return;
-
-	if (IS_GEN2(intel))
-		I830EmitInvarientState(scrn);
-	else if IS_GEN3(intel)
-		I915EmitInvarientState(scrn);
-}
-
 #ifdef INTEL_PIXMAP_SHARING
 static void
 redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
@@ -660,7 +649,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
 
 	intel_batch_submit(scrn);
 	if (!intel->has_prime_vmap_flush) {
-		drm_intel_bo *bo = intel_get_pixmap_bo(dirty->slave_dst->master_pixmap);
+		drm_intel_bo *bo = intel_uxa_get_pixmap_bo(dirty->slave_dst->master_pixmap);
 		was_blocked = xf86BlockSIGIO();
 		drm_intel_bo_map(bo, FALSE);
 		drm_intel_bo_unmap(bo);
@@ -1000,7 +989,7 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
 #endif
 	/* Init video */
 	if (intel->XvEnabled)
-		I830InitVideo(screen);
+		intel_video_init(screen);
 
 #if HAVE_DRI2
 	switch (intel->dri2) {
src/uxa/intel_glamor.c +2 -2
index 0be87b8..21636d1 100644
@@ -156,12 +156,12 @@ intel_glamor_create_textured_pixmap(PixmapPtr pixmap)
 {
 	ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	struct intel_pixmap *priv;
+	struct intel_uxa_pixmap *priv;
 
 	if ((intel->uxa_flags & UXA_USE_GLAMOR) == 0)
 		return TRUE;
 
-	priv = intel_get_pixmap_private(pixmap);
+	priv = intel_uxa_get_pixmap_private(pixmap);
 	if (glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
 					      priv->stride)) {
 		drm_intel_bo_disable_reuse(priv->bo);
src/uxa/intel_uxa.c +77 -59

385 lines not on this page · raw message

src/uxa/intel_uxa.h new file +300 -0

300 lines not on this page · raw message

src/uxa/intel_uxa_video.c new file +389 -0

389 lines not on this page · raw message

src/uxa/intel_video.c +212 -1100

65 lines not on this page · raw message

src/uxa/intel_video.h +112 -44

156 lines not on this page · raw message

src/uxa/intel_video_overlay.c new file +554 -0

554 lines not on this page · raw message

src/uxa/intel_video_overlay.h new file +51 -0

51 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
2.0.1


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

Part of the diff is not shown here. View the raw message.

#33 lore raw

PATCH 6/12 Remove glamor support from UXA acceleration

In reply to Keith Packard

Makes UXA no longer include calls to glamor acceleration functions.

---
 src/uxa/Makefile.am    |   9 --
 src/uxa/intel_dri.c    |  60 +------------
 src/uxa/intel_driver.c |   1 -
 src/uxa/intel_uxa.c    |  49 -----------
 src/uxa/intel_uxa.h    |   1 -
 src/uxa/uxa-accel.c    | 230 -------------------------------------------------
 src/uxa/uxa-glamor.h   |  65 --------------
 src/uxa/uxa-glyphs.c   |  28 ------
 src/uxa/uxa-render.c   |  79 -----------------
 src/uxa/uxa.c          |   7 --
 src/uxa/uxa.h          |  16 ----
 11 files changed, 2 insertions(+), 543 deletions(-)
 delete mode 100644 src/uxa/uxa-glamor.h
src/uxa/Makefile.am +0 -9
index 23b074d..b9618c9 100644
@@ -34,7 +34,6 @@ libuxa_la_SOURCES = \
 	intel_batchbuffer.h \
 	intel_display.c \
 	intel_driver.c \
-	intel_glamor.h \
 	intel_memory.c \
 	intel_uxa.c \
 	intel_video.c \
@@ -65,14 +64,6 @@ libuxa_la_SOURCES = \
 	uxa-unaccel.c
 	$(NULL)
 
-if GLAMOR
-AM_CFLAGS += $(LIBGLAMOR_CFLAGS)
-libuxa_la_LIBADD += $(LIBGLAMOR_LIBS)
-libuxa_la_SOURCES += \
-	 intel_glamor.c \
-	 $(NULL)
-endif
-
 if DRI2
 AM_CFLAGS += $(DRI2_CFLAGS)
 libuxa_la_SOURCES += \
src/uxa/intel_dri.c +2 -58

84 lines not on this page · raw message

src/uxa/intel_driver.c +0 -1
index 8ab2252..d9f918b 100644
@@ -963,7 +963,6 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
 	intel->CreateScreenResources = screen->CreateScreenResources;
 	screen->CreateScreenResources = i830CreateScreenResources;
 
-	intel_glamor_init(screen);
 	if (!xf86CrtcScreenInit(screen))
 		return FALSE;
 
src/uxa/intel_uxa.c +0 -49

101 lines not on this page · raw message

src/uxa/intel_uxa.h +0 -1
index 34903a3..69500a8 100644
@@ -40,7 +40,6 @@ struct intel_uxa_pixmap {
 #define PIN_DRI2 0x2
 #define PIN_DRI3 0x4
 #define PIN_PRIME 0x8
-#define PIN_GLAMOR 0x10
 };
 
 #if HAS_DEVPRIVATEKEYREC
src/uxa/uxa-accel.c +0 -230

323 lines not on this page · raw message

src/uxa/uxa-glamor.h deleted +0 -65

65 lines not on this page · raw message

src/uxa/uxa-glyphs.c +0 -28
index 7f35863..d24ba51 100644
@@ -65,7 +65,6 @@
 #include <stdlib.h>
 
 #include "uxa-priv.h"
-#include "uxa-glamor.h"
 #include "common.h"
 
 /* Width of the pixmaps we use for the caches; this should be less than
@@ -210,10 +209,6 @@ bail:
 Bool uxa_glyphs_init(ScreenPtr pScreen)
 {
 
-	uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
-
-	if (uxa_screen->info->flags & UXA_USE_GLAMOR)
-		return TRUE;
 #if HAS_DIXREGISTERPRIVATEKEY
 	if (!dixRegisterPrivateKey(&uxa_glyph_key, PRIVATE_GLYPH, 0))
 		return FALSE;
@@ -308,12 +303,6 @@ uxa_glyph_unrealize(ScreenPtr screen,
 		    GlyphPtr glyph)
 {
 	struct uxa_glyph *priv;
-	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
-
-	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
-		glamor_glyph_unrealize(screen, glyph);
-		return;
-	}
 
 	/* Use Lookup in case we have not attached to this glyph. */
 	priv = dixLookupPrivate(&glyph->devPrivates, &uxa_glyph_key);
@@ -975,23 +964,6 @@ uxa_glyphs(CARD8 op,
 	ScreenPtr screen = pDst->pDrawable->pScreen;
 	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
 
-	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
-		int ok;
-
-		uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
-		uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
-		ok = glamor_glyphs_nf(op,
-				     pSrc, pDst, maskFormat,
-				     xSrc, ySrc, nlist, list, glyphs);
-		uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
-		uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
-
-		if (!ok)
-			goto fallback;
-
-		return;
-	}
-
 	if (!uxa_screen->info->prepare_composite ||
 	    uxa_screen->force_fallback ||
 	    !uxa_drawable_is_offscreen(pDst->pDrawable) ||
src/uxa/uxa-render.c +0 -79

110 lines not on this page · raw message

src/uxa/uxa.c +0 -7
index c8d7900..905667d 100644
@@ -38,7 +38,6 @@
 #include <X11/fonts/fontstruct.h>
 #include "dixfontstr.h"
 #include "uxa.h"
-#include "uxa-glamor.h"
 
 #if HAS_DEVPRIVATEKEYREC
 DevPrivateKeyRec uxa_screen_index;
@@ -184,7 +183,6 @@ void uxa_finish_access(DrawablePtr pDrawable, uxa_access_t access)
 static void
 uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 {
-	uxa_screen_t *uxa_screen = uxa_get_screen(pGC->pScreen);
 	/* fbValidateGC will do direct access to pixmaps if the tiling has
 	 * changed.
 	 * Preempt fbValidateGC by doing its work and masking the change out, so
@@ -195,10 +193,6 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 	 * may be pure GLAMOR pixmap, then we should let the glamor
 	 * to do the validation.
 	 */
-	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
-		glamor_validate_gc(pGC, changes, pDrawable);
-		goto set_ops;
-	}
 #ifdef FB_24_32BIT
 	if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) {
 		(*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
@@ -267,7 +261,6 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 		fbValidateGC(pGC, changes, pDrawable);
 	}
 
-set_ops:
 	pGC->ops = (GCOps *) & uxa_ops;
 }
 
src/uxa/uxa.h +0 -16
index b8569f0..d08c601 100644
@@ -46,8 +46,6 @@
 typedef enum {
 	UXA_ACCESS_RO,
 	UXA_ACCESS_RW,
-	UXA_GLAMOR_ACCESS_RO,
-	UXA_GLAMOR_ACCESS_RW
 } uxa_access_t;
 
 /**
@@ -545,20 +543,6 @@ typedef struct _UxaDriver {
  */
 #define UXA_TWO_BITBLT_DIRECTIONS	(1 << 2)
 
-/**
- * UXA_USE_GLAMOR indicates to use glamor acceleration to perform rendering.
- * And if glamor fail to accelerate the rendering, then goto fallback to
- * use CPU to do the rendering. This flag will be set only when glamor get
- * initialized successfully.
- * Note, in ddx close screen, this bit need to be cleared.
- */
-#define UXA_USE_GLAMOR			(1 << 3)
-
-/* UXA_GLAMOR_EGL_INITIALIZED indicates glamor egl layer get initialized
- * successfully. UXA layer does not use this flag, before call to
- * glamor_init, ddx need to check this flag. */
-#define UXA_GLAMOR_EGL_INITIALIZED	(1 << 4)
-
 /** @} */
 /** @name UXA CreatePixmap hint flags
  * @{
Signature · 6 lines
2.0.1

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

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-7-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

#35 lore raw

Re: [PATCH 06/12] Remove glamor support from UXA acceleration

Quoted 32 lines · Keith Packard

Makes UXA no longer include calls to glamor acceleration functions.

---
 src/uxa/Makefile.am    |   9 --
 src/uxa/intel_dri.c    |  60 +------------
 src/uxa/intel_driver.c |   1 -
 src/uxa/intel_uxa.c    |  49 -----------
 src/uxa/intel_uxa.h    |   1 -
 src/uxa/uxa-accel.c    | 230 -------------------------------------------------
 src/uxa/uxa-glamor.h   |  65 --------------
 src/uxa/uxa-glyphs.c   |  28 ------
 src/uxa/uxa-render.c   |  79 -----------------
 src/uxa/uxa.c          |   7 --
 src/uxa/uxa.h          |  16 ----
 11 files changed, 2 insertions(+), 543 deletions(-)
 delete mode 100644 src/uxa/uxa-glamor.h
src/uxa/Makefile.am +0 -1
index 23b074d..b9618c9 100644
@@ -34,7 +34,6 @@ libuxa_la_SOURCES = \
 	intel_batchbuffer.h \
 	intel_display.c \
 	intel_driver.c \
-	intel_glamor.h \
 	intel_memory.c \
 	intel_uxa.c \
 	intel_video.c \
@@ -65,14 +64,6 @@ libuxa_la_SOURCES = \
 	uxa-unaccel.c

src/uxa/Makefile.am libuxa_la_SOURCES = \ · line 75

Quoted 10 lines
src/uxa/Makefile.am +0 -8
 	$(NULL)
 
-if GLAMOR
-AM_CFLAGS += $(LIBGLAMOR_CFLAGS)
-libuxa_la_LIBADD += $(LIBGLAMOR_LIBS)
-libuxa_la_SOURCES += \
-	 intel_glamor.c \
-	 $(NULL)
-endif
-

Something weird happened in this commit.

uxa-glamor.h is removed from the repo, but the makefile only drops intel_glamor.h, which keeps getting used. I suspect make distcheck is broken.

intel_glamor.c is no longer built, but USE_GLAMOR might still be defined I think, and if so intel_glamor_flush() from it is still getting called.

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#36 lore raw

Re: [PATCH 06/12] Remove glamor support from UXA acceleration

Quoted 5 lines · Eric Anholt

Something weird happened in this commit.

uxa-glamor.h is removed from the repo, but the makefile only drops intel_glamor.h, which keeps getting used. I suspect make distcheck is broken.

Yeah, almost certainly. In fact, after this patch, the driver does *not* build if you ask for glamor.

Quoted 3 lines

intel_glamor.c is no longer built, but USE_GLAMOR might still be defined I think, and if so intel_glamor_flush() from it is still getting called.

Right, the driver explicitly doesn't build with --enable-glamor after this patch. Cleaning it up so that it would build makes more of a mess though, so I just didn't worry about it as I was re-adding glamor when all of the USE_GLAMOR bits would be needed again.

I can make it work if you like, but this patch and the re-enable glamor patch would both get larger.

Signature · 1 line
[email protected]

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

#37 lore raw

PATCH 9/12 Do more checks for proposed flip pixmaps

In reply to Keith Packard

Make sure the pitch and tiling are correct.
Make sure there's a BO we can get at.

---
 src/uxa/intel_present.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
src/uxa/intel_present.c +18 -0
index c53d71d..b901fb1 100644
@@ -248,6 +248,8 @@ intel_present_check_flip(RRCrtcPtr              crtc,
 	ScreenPtr               screen = window->drawable.pScreen;
 	ScrnInfoPtr             scrn = xf86ScreenToScrn(screen);
 	intel_screen_private    *intel = intel_get_screen_private(scrn);
+        dri_bo                  *bo;
+        uint32_t                tiling, swizzle;
 
 	if (!scrn->vtSema)
 		return FALSE;
@@ -261,6 +263,22 @@ intel_present_check_flip(RRCrtcPtr              crtc,
 	if (crtc && !intel_crtc_on(crtc->devPrivate))
 		return FALSE;
 
+        /* Check stride, can't change that on flip */
+        if (pixmap->devKind != intel->front_pitch)
+                return FALSE;
+
+        /* Make sure there's a bo we can get to */
+        bo = intel_get_pixmap_bo(pixmap);
+        if (!bo)
+                return FALSE;
+
+        /* Check tiling, can't change that on flip */
+        if (drm_intel_bo_get_tiling((drm_intel_bo *) bo, &tiling, &swizzle) != 0)
+                return FALSE;
+
+        if (tiling != intel->front_tiling)
+                return FALSE;
+
 	return TRUE;
 }
 
Signature · 1 line
2.0.1

A message that is not in the archive (sent off-list or not yet received): 1406243908-1123-10-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org

#39 lore raw

Re: [PATCH 09/12] Do more checks for proposed flip pixmaps

Quoted 2 lines · Keith Packard

Make sure the pitch and tiling are correct.
Make sure there's a BO we can get at.

I thought we couldn't change these parameters, but now I can't find what prevents them from changing. Can you cite sources?

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

#40 lore raw

Re: [PATCH 09/12] Do more checks for proposed flip pixmaps

Quoted 7 lines · Eric Anholt
Quoted 2 lines · Keith Packard

Make sure the pitch and tiling are correct.
Make sure there's a BO we can get at.

I thought we couldn't change these parameters, but now I can't find what prevents them from changing. Can you cite sources?

Looks like we *can* change tiling format. That actually makes me kinda happy as that explains why we were able to allocate a linear frame buffer for the X front buffer (due to a bug) and page flip to DRI3 buffers which are always tiled.

However, we can't change the pitch. From the kernel driver:

	/*
	 * TILEOFF/LINOFF registers can't be changed via MI display flips.
	 * Note that pitch changes could also affect these register.
	 */
	if (INTEL_INFO(dev)->gen > 3 &&
	    (fb->offsets[0] != crtc->primary->fb->offsets[0] ||
	     fb->pitches[0] != crtc->primary->fb->pitches[0]))
		return -EINVAL;

I'll remove the tiling check.

Signature · 1 line
[email protected]

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

#41 lore raw

Re: [PATCH 09/12] Do more checks for proposed flip pixmaps

Quoted 26 lines · Keith Packard
Quoted 7 lines · Eric Anholt
Quoted 2 lines · Keith Packard

Make sure the pitch and tiling are correct.
Make sure there's a BO we can get at.

I thought we couldn't change these parameters, but now I can't find what prevents them from changing. Can you cite sources?

Looks like we *can* change tiling format. That actually makes me kinda happy as that explains why we were able to allocate a linear frame buffer for the X front buffer (due to a bug) and page flip to DRI3 buffers which are always tiled.

However, we can't change the pitch. From the kernel driver:

	/*
	 * TILEOFF/LINOFF registers can't be changed via MI display flips.
	 * Note that pitch changes could also affect these register.
	 */
	if (INTEL_INFO(dev)->gen > 3 &&
	    (fb->offsets[0] != crtc->primary->fb->offsets[0] ||
	     fb->pitches[0] != crtc->primary->fb->pitches[0]))
		return -EINVAL;
Quoted 1 line

I'll remove the tiling check.

Now that we have mmio flips in the kernel we can start to relax that restriction. That still needs a bit more work in the mmio flip code but I believe some people working on just that.

We could even change the pixel format, except a check was added to drm_mode_page_flip_ioctl() to prevent that, so I guess it was deemed that the API isn't meant to allow that.

Signature · 2 lines
Ville Syrjälä
Intel OTC
#42 lore raw

Re: [PATCH 09/12] Do more checks for proposed flip pixmaps

Quoted 3 lines · Ville Syrjälä

Now that we have mmio flips in the kernel we can start to relax that restriction. That still needs a bit more work in the mmio flip code but I believe some people working on just that.

I couldn't find any tiling restrictions in the current (ring-based) flip code; did I just miss them?

Quoted 3 lines

We could even change the pixel format, except a check was added to drm_mode_page_flip_ioctl() to prevent that, so I guess it was deemed that the API isn't meant to allow that.

Yeah, not sure I care about this; 32bpp is pretty much the only format I want.

Signature · 1 line
[email protected]

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

A message that is not in the archive (sent off-list or not yet received): 86a97pd07f.fsf-6d7jPg3SX/[email protected]

#44 lore raw

Re: [Intel-gfx] [PATCH 09/12] Do more checks for proposed flip pixmaps

Quoted 8 lines · Keith Packard
Quoted 3 lines · Ville Syrjälä

Now that we have mmio flips in the kernel we can start to relax that restriction. That still needs a bit more work in the mmio flip code but I believe some people working on just that.

I couldn't find any tiling restrictions in the current (ring-based) flip code; did I just miss them?

No, changing tiling is supposed to work via cs flips. Except it doesn't actually work on VLV for some reason. We now fall back to mmio flip on VLV for that, so given a recent enough kernel it should just work (tm) on all platforms.

I was referring to the relaxing the restrictions on stride changes.

Quoted 7 lines
Quoted 4 lines

We could even change the pixel format, except a check was added to drm_mode_page_flip_ioctl() to prevent that, so I guess it was deemed that the API isn't meant to allow that.

Yeah, not sure I care about this; 32bpp is pretty much the only format I want.

You just need to be careful with the X vs. A because the kernel considers those distinct pixel formats. I now regret adding that distinciton to the pixel formats, but sadly I don't own a time machine so I can't undo it.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel