[PATCH 11/12] Add "none" acceleration option

Keith Packard
2014-07-24T23:18:27Z

This just uses fb directly

Signed-off-by: Keith Packard <keithp@keithp.com>
---
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

diff --git a/configure.ac b/configure.ac
index 5c3dd20..46c3143 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/src/Makefile.am b/src/Makefile.am
index aa8b47e..ce6f836 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 = \
diff --git a/src/intel_module.c b/src/intel_module.c
index d6a0d3c..b8d7f91 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -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
diff --git a/src/uxa/Makefile.am b/src/uxa/Makefile.am
index b9618c9..b7b5138 100644
--- a/src/uxa/Makefile.am
+++ b/src/uxa/Makefile.am
@@ -25,21 +25,27 @@ 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 \
intel.h \
- intel_batchbuffer.c \
- intel_batchbuffer.h \
intel_display.c \
intel_driver.c \
intel_memory.c \
- intel_uxa.c \
+ intel_none.c \
+ intel_none.h \
intel_video.c \
intel_video.h \
intel_video_overlay.c \
intel_video_overlay.h \
+ $(NULL)
+
+if UXA
+libuxa_la_SOURCES += \
+ intel_uxa.h \
+ intel_batchbuffer.c \
+ intel_batchbuffer.h \
+ brw_defines.h \
+ brw_structs.h \
+ intel_uxa.c \
intel_uxa_video.c \
i830_3d.c \
i830_render.c \
@@ -61,9 +67,20 @@ libuxa_la_SOURCES = \
uxa-glyphs.c \
uxa-render.c \
uxa-priv.h \
- uxa-unaccel.c
+ uxa-unaccel.c \
+ $(NULL)
+endif
+
+if GLAMOR
+AM_CFLAGS += $(LIBGLAMOR_CFLAGS)
+libuxa_la_LIBADD += $(LIBGLAMOR_LIBS)
+libuxa_la_SOURCES += \
+ intel_glamor.h \
+ intel_glamor.c \
$(NULL)
+endif

+if UXA
if DRI2
AM_CFLAGS += $(DRI2_CFLAGS)
libuxa_la_SOURCES += \
@@ -75,6 +92,15 @@ libuxa_la_LIBADD += \
$(NULL)
endif

+if XVMC
+AM_CFLAGS += -I$(top_srcdir)/xvmc
+libuxa_la_SOURCES += \
+ intel_hwmc.c \
+ $(NULL)
+endif
+
+endif
+
if DRI3
libuxa_la_SOURCES += \
intel_dri3.c \
@@ -88,9 +114,3 @@ libuxa_la_SOURCES += \
$(NULL)
endif

-if XVMC
-AM_CFLAGS += -I$(top_srcdir)/xvmc
-libuxa_la_SOURCES += \
- intel_hwmc.c \
- $(NULL)
-endif
diff --git a/src/uxa/intel.h b/src/uxa/intel.h
index 5fbb2c7..ae33938 100644
--- a/src/uxa/intel.h
+++ b/src/uxa/intel.h
@@ -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);
diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c
index a4c4b82..1d4ba3c 100644
--- a/src/uxa/intel_display.c
+++ b/src/uxa/intel_display.c
@@ -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++) {
diff --git a/src/uxa/intel_dri3.c b/src/uxa/intel_dri3.c
index 16a2463..be7af49 100644
--- a/src/uxa/intel_dri3.c
+++ b/src/uxa/intel_dri3.c
@@ -56,7 +56,6 @@ static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
- struct intel_uxa_pixmap *priv;
PixmapPtr pixmap;
dri_bo *bo;

@@ -84,14 +83,19 @@ static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
if (bo == NULL)
goto free_pixmap;

- intel_uxa_set_pixmap_bo(pixmap, bo);
+ intel_set_pixmap_bo(pixmap, bo);
dri_bo_unreference(bo);

- priv = intel_uxa_get_pixmap_private(pixmap);
- if (priv == NULL)
- goto free_pixmap;
+#if USE_UXA
+ if (intel->accel == ACCEL_UXA) {
+ struct intel_uxa_pixmap *priv;
+ priv = intel_uxa_get_pixmap_private(pixmap);
+ if (priv == NULL)
+ goto free_pixmap;

- priv->pinned |= PIN_DRI3;
+ priv->pinned |= PIN_DRI3;
+ }
+#endif

return pixmap;

@@ -105,23 +109,30 @@ static int intel_dri3_fd_from_pixmap(ScreenPtr screen,
CARD16 *stride,
CARD32 *size)
{
- struct intel_uxa_pixmap *priv;
- int fd;
-
- priv = intel_uxa_get_pixmap_private(pixmap);
- if (!priv)
- return -1;
+ dri_bo *bo;
+ int fd;

- if (priv->stride > UINT16_MAX)
- return -1;
+ bo = intel_get_pixmap_bo(pixmap);
+ if (!bo)
+ return -1;

- if (drm_intel_bo_gem_export_to_prime(priv->bo, &fd) < 0)
+ if (drm_intel_bo_gem_export_to_prime(bo, &fd) < 0)
return -1;

- priv->pinned |= PIN_DRI3;
-
- *stride = priv->stride;
- *size = priv->bo->size;
+#if USE_UXA
+ if (intel_get_screen_private(xf86ScreenToScrn(screen))->accel== ACCEL_UXA) {
+ struct intel_uxa_pixmap *priv;
+
+ priv = intel_uxa_get_pixmap_private(pixmap);
+ if (!priv)
+ return -1;
+ if (priv->stride > UINT16_MAX)
+ return -1;
+ priv->pinned |= PIN_DRI3;
+ }
+#endif
+ *stride = bo->size / pixmap->drawable.height;
+ *size = bo->size;
return fd;
}

diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c
index 065c679..316de64 100644
--- a/src/uxa/intel_driver.c
+++ b/src/uxa/intel_driver.c
@@ -62,6 +62,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "intel.h"
#include "intel_video.h"
#include "uxa_module.h"
+#include "intel_none.h"

#ifdef INTEL_XVMC
#define _INTEL_XVMC_SERVER_
@@ -177,6 +178,10 @@ static Bool i830CreateScreenResources(ScreenPtr screen)
return FALSE;
intel_copy_fb(scrn);
#endif
+ case ACCEL_NONE:
+ if (!intel_none_create_screen_resources(screen))
+ return FALSE;
+ break;
}

return TRUE;
@@ -199,6 +204,9 @@ intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
intel_uxa_set_pixmap_bo(pixmap, bo);
break;
#endif
+ case ACCEL_NONE:
+ intel_none_set_pixmap_bo(pixmap, bo);
+ break;
default:
ErrorF("No accel architecture, cannot set pixmap bo\n");
break;
@@ -220,6 +228,8 @@ intel_get_pixmap_bo(PixmapPtr pixmap)
case ACCEL_UXA:
return intel_uxa_get_pixmap_bo(pixmap);
#endif
+ case ACCEL_NONE:
+ return intel_none_get_pixmap_bo(pixmap);
default:
ErrorF("No accel architecture, cannot set pixmap bo\n");
return NULL;
@@ -240,6 +250,8 @@ intel_flush(intel_screen_private *intel)
intel_batch_submit(intel->scrn);
break;
#endif
+ default:
+ break;
}
}

@@ -276,6 +288,9 @@ static void intel_check_accel_option(ScrnInfoPtr scrn)
accel_method = UXA;
else
#endif
+ if (strcasecmp(s, "none") == 0)
+ accel_method = NONE;
+ else
accel_method = DEFAULT_ACCEL_METHOD;
}
switch (accel_method) {
@@ -290,6 +305,9 @@ static void intel_check_accel_option(ScrnInfoPtr scrn)
intel->accel = ACCEL_UXA;
break;
#endif
+ case NONE:
+ intel->accel = ACCEL_NONE;
+ break;
}
}

@@ -376,10 +394,13 @@ static int intel_init_bufmgr(intel_screen_private *intel)
if (!intel->bufmgr)
return FALSE;

- if (xf86ReturnOptValBool(intel->Options, OPTION_BUFFER_CACHE, TRUE))
- drm_intel_bufmgr_gem_enable_reuse(intel->bufmgr);
- drm_intel_bufmgr_gem_set_vma_cache_size(intel->bufmgr, 512);
- drm_intel_bufmgr_gem_enable_fenced_relocs(intel->bufmgr);
+#if USE_UXA
+ if (intel->accel == ACCEL_UXA) {
+ if (xf86ReturnOptValBool(intel->Options, OPTION_BUFFER_CACHE, TRUE))
+ drm_intel_bufmgr_gem_enable_reuse(intel->bufmgr);
+ drm_intel_bufmgr_gem_set_vma_cache_size(intel->bufmgr, 512);
+ drm_intel_bufmgr_gem_enable_fenced_relocs(intel->bufmgr);
+ }

list_init(&intel->batch_pixmaps);

@@ -388,6 +409,7 @@ static int intel_init_bufmgr(intel_screen_private *intel)
drm_intel_bo_alloc(intel->bufmgr, "wa scratch",
4096, 4096);
}
+#endif

return TRUE;
}
@@ -397,7 +419,10 @@ static void intel_bufmgr_fini(intel_screen_private *intel)
if (intel->bufmgr == NULL)
return;

- drm_intel_bo_unreference(intel->wa_scratch_bo);
+#if USE_UXA
+ if (intel->accel == ACCEL_UXA)
+ drm_intel_bo_unreference(intel->wa_scratch_bo);
+#endif
drm_intel_bufmgr_destroy(intel->bufmgr);
}

@@ -711,7 +736,11 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
PreInitCleanup(scrn);
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to pre init glamor display.\n");
+#if USE_UXA
intel->accel = ACCEL_UXA;
+#else
+ intel->accel = ACCEL_NONE;
+#endif
}
break;
#endif
@@ -722,12 +751,14 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
if (intel->dri2 != DRI_DISABLED && !xf86LoadSubModule(scrn, "dri2"))
intel->dri2 = DRI_DISABLED;
#endif
+ /* fall through ... */
+#endif
+ case ACCEL_NONE:
#if HAVE_DRI3
if (intel->dri3 != DRI_DISABLED && !xf86LoadSubModule(scrn, "dri3"))
intel->dri3 = DRI_DISABLED;
#endif
break;
-#endif
default:
break;
}
@@ -760,7 +791,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)

intel_flush(intel);
if (!intel->has_prime_vmap_flush) {
- drm_intel_bo *bo = intel_uxa_get_pixmap_bo(dirty->slave_dst->master_pixmap);
+ drm_intel_bo *bo = (drm_intel_bo *) intel_get_pixmap_bo(dirty->slave_dst->master_pixmap);
was_blocked = xf86BlockSIGIO();
drm_intel_bo_map(bo, FALSE);
drm_intel_bo_unmap(bo);
@@ -804,8 +835,12 @@ I830BlockHandler(BLOCKHANDLER_ARGS_DECL)
intel->BlockHandler = screen->BlockHandler;
screen->BlockHandler = I830BlockHandler;

- intel_uxa_block_handler(intel);
- intel_video_block_handler(intel);
+#if USE_UXA
+ if (intel->accel == ACCEL_UXA) {
+ intel_uxa_block_handler(intel);
+ intel_video_block_handler(intel);
+ }
+#endif
#ifdef INTEL_PIXMAP_SHARING
intel_dirty_update(screen);
#endif
@@ -957,9 +992,11 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
VisualPtr visual;
+#if USE_UXA
#ifdef INTEL_XVMC
MessageType from;
#endif
+#endif
struct pci_device *const device = intel->PciInfo;
int fb_bar = IS_GEN2(intel) ? 0 : 2;

@@ -985,32 +1022,6 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
if (!miSetPixmapDepths())
return FALSE;

- /* 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;
-
- if (scrn->bitsPerPixel > 8) {
- /* Fixup RGB ordering */
- visual = screen->visuals + screen->numVisuals;
- while (--visual >= screen->visuals) {
- if ((visual->class | DynamicClass) == DirectColor) {
- visual->offsetRed = scrn->offset.red;
- visual->offsetGreen = scrn->offset.green;
- visual->offsetBlue = scrn->offset.blue;
- visual->redMask = scrn->mask.red;
- visual->greenMask = scrn->mask.green;
- visual->blueMask = scrn->mask.blue;
- }
- }
- }
-
- fbPictureInit(screen, NULL, 0);
-
- xf86SetBlackWhitePixels(screen);
-
switch (intel->accel) {
#if USE_GLAMOR
case ACCEL_GLAMOR:
@@ -1028,11 +1039,26 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
"Hardware acceleration initialization failed\n");
return FALSE;
}
+ break;
+#endif
+ case ACCEL_NONE:
+ if (!intel_none_init(screen)) {
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "Screen initialization failed\n");
+ return FALSE;
+ }
+ }
+
+ switch (intel->accel) {
+#if USE_UXA
+ case ACCEL_UXA:
#if HAVE_DRI2
if (intel->dri2 == DRI_NONE && I830DRI2ScreenInit(screen))
intel->dri2 = DRI_ACTIVE;
#endif
-
+ /* fall through ... */
+#endif /* USE_UXA */
+ case ACCEL_NONE:
#if HAVE_DRI3
if (!intel_sync_init(screen))
intel->dri3 = DRI_DISABLED;
@@ -1040,9 +1066,27 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
intel->dri3 = DRI_ACTIVE;
#endif
break;
-#endif
+ default:
+ break;
}

+ if (scrn->bitsPerPixel > 8) {
+ /* Fixup RGB ordering */
+ visual = screen->visuals + screen->numVisuals;
+ while (--visual >= screen->visuals) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = scrn->offset.red;
+ visual->offsetGreen = scrn->offset.green;
+ visual->offsetBlue = scrn->offset.blue;
+ visual->redMask = scrn->mask.red;
+ visual->greenMask = scrn->mask.green;
+ visual->blueMask = scrn->mask.blue;
+ }
+ }
+ }
+
+ xf86SetBlackWhitePixels(screen);
+
if (xf86ReturnOptValBool(intel->Options, OPTION_PRESENT, TRUE))
intel_present_screen_init(screen);

@@ -1095,58 +1139,66 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)

xf86DPMSInit(screen, xf86DPMSSet, 0);

+ switch (intel->accel) {
+#if USE_UXA
+ case ACCEL_UXA:
#ifdef INTEL_XVMC
- if (INTEL_INFO(intel)->gen >= 040)
- intel->XvMCEnabled = TRUE;
- from = (intel->dri2 == DRI_ACTIVE &&
- xf86GetOptValBool(intel->Options, OPTION_XVMC,
- &intel->XvMCEnabled) ? X_CONFIG : X_DEFAULT);
- xf86DrvMsg(scrn->scrnIndex, from, "Intel XvMC decoder %sabled\n",
- intel->XvMCEnabled ? "en" : "dis");
+ if (INTEL_INFO(intel)->gen >= 040)
+ intel->XvMCEnabled = TRUE;
+ from = (intel->dri2 == DRI_ACTIVE &&
+ xf86GetOptValBool(intel->Options, OPTION_XVMC,
+ &intel->XvMCEnabled) ? X_CONFIG : X_DEFAULT);
+ xf86DrvMsg(scrn->scrnIndex, from, "Intel XvMC decoder %sabled\n",
+ intel->XvMCEnabled ? "en" : "dis");
#endif
- /* Init video */
- if (intel->XvEnabled)
- intel_video_init(screen);
-
#if HAVE_DRI2
- switch (intel->dri2) {
- case DRI_ACTIVE:
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI2: Enabled\n");
- break;
- case DRI_DISABLED:
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI2: Disabled\n");
- break;
- case DRI_NONE:
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI2: Failed\n");
- break;
- }
+ switch (intel->dri2) {
+ case DRI_ACTIVE:
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI2: Enabled\n");
+ break;
+ case DRI_DISABLED:
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI2: Disabled\n");
+ break;
+ case DRI_NONE:
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI2: Failed\n");
+ break;
+ }
#else
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI2: Not available\n");
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI2: Not available\n");
#endif

#if HAVE_DRI3
- switch (intel->dri3) {
- case DRI_ACTIVE:
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI3: Enabled\n");
- break;
- case DRI_DISABLED:
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI3: Disabled\n");
- break;
- case DRI_NONE:
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI3: Failed\n");
- break;
- }
+ switch (intel->dri3) {
+ case DRI_ACTIVE:
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI3: Enabled\n");
+ break;
+ case DRI_DISABLED:
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI3: Disabled\n");
+ break;
+ case DRI_NONE:
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI3: Failed\n");
+ break;
+ }
#else
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "DRI3: Not available\n");
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "DRI3: Not available\n");
#endif
+ break;
+#endif
+ default:
+ break;
+ }
+
+ /* Init video */
+ if (intel->XvEnabled)
+ intel_video_init(screen);

if (serverGeneration == 1)
xf86ShowUnusedOptions(scrn->scrnIndex, scrn->options);
@@ -1247,16 +1299,9 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
#endif
#if USE_UXA
case ACCEL_UXA:
-
- TimerFree(intel->cache_expire);
- intel->cache_expire = NULL;
-
- intel_batch_teardown(scrn);
-
- if (INTEL_INFO(intel)->gen >= 040 && INTEL_INFO(intel)->gen < 0100)
- gen4_render_state_cleanup(scrn);
-
if (intel->uxa_driver) {
+ TimerFree(intel->cache_expire);
+ intel->cache_expire = NULL;
uxa_driver_fini(screen);
free(intel->uxa_driver);
intel->uxa_driver = NULL;
@@ -1287,9 +1332,28 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
I830LeaveVT(VT_FUNC_ARGS(0));
}

+ switch (intel->accel) {
+#if USE_UXA
+ case ACCEL_UXA:
+ intel_batch_teardown(scrn);
+
+ if (INTEL_INFO(intel)->gen >= 040 && INTEL_INFO(intel)->gen < 0100)
+ gen4_render_state_cleanup(scrn);
+
+ i965_free_video(scrn);
+ /* fall through ... */
+#endif
+ case ACCEL_NONE:
+#if HAVE_DRI3
+ intel_sync_close(screen);
+#endif
+ break;
+ default:
+ break;
+ }
+
xf86_cursors_fini(screen);

- i965_free_video(scrn);

screen->CloseScreen = intel->CloseScreen;
(*screen->CloseScreen) (CLOSE_SCREEN_ARGS);
@@ -1310,7 +1374,6 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
}
intel_sync_close(screen);
#endif
-
break;
#endif
default:
diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c
index e2bc24c..cc98eb4 100644
--- a/src/uxa/intel_glamor.c
+++ b/src/uxa/intel_glamor.c
@@ -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;
diff --git a/src/uxa/intel_none.c b/src/uxa/intel_none.c
new file mode 100644
index 0000000..470ea07
--- /dev/null
+++ b/src/uxa/intel_none.c
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include "xorg-server.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86cmap.h"
+#include "xf86drm.h"
+#include "compiler.h"
+#include "mipointer.h"
+#include "micmap.h"
+#include <X11/extensions/randr.h>
+#include "fb.h"
+#include "miscstruct.h"
+#include "dixstruct.h"
+#include "xf86xv.h"
+#include "shadow.h"
+#include "intel.h"
+#include "intel_video.h"
+#include "intel_none.h"
+#include "intel_bufmgr.h"
+
+struct intel_none_screen {
+ DestroyPixmapProcPtr DestroyPixmap;
+};
+
+static DevPrivateKeyRec intel_none_screen_key;
+
+static inline struct intel_none_screen *intel_none_get_screen(ScreenPtr screen)
+{
+ return dixGetPrivateAddr(&screen->devPrivates, &intel_none_screen_key);
+}
+
+struct intel_none_pixmap {
+ drm_intel_bo *bo;
+};
+
+static DevPrivateKeyRec intel_none_pixmap_key;
+
+static inline struct intel_none_pixmap *intel_none_get_pixmap(PixmapPtr pixmap)
+{
+ return dixGetPrivateAddr(&pixmap->devPrivates, &intel_none_pixmap_key);
+}
+
+dri_bo *
+intel_none_get_pixmap_bo(PixmapPtr pixmap)
+{
+ return (dri_bo *) intel_none_get_pixmap(pixmap)->bo;
+}
+
+Bool
+intel_none_set_pixmap_bo(PixmapPtr pixmap, dri_bo *d_bo)
+{
+ struct intel_none_pixmap *none_pixmap = intel_none_get_pixmap(pixmap);
+ drm_intel_bo *bo = (drm_intel_bo *) d_bo;
+
+ if (bo) {
+ if (drm_intel_gem_bo_map_gtt(bo) != 0)
+ return FALSE;
+ }
+
+ if (none_pixmap->bo) {
+ drm_intel_bo_unreference(none_pixmap->bo);
+ none_pixmap->bo = NULL;
+ pixmap->devPrivate.ptr = NULL;
+ }
+
+ if (bo) {
+ pixmap->devPrivate.ptr = bo->virtual;
+ dri_bo_reference(d_bo);
+ none_pixmap->bo = bo;
+ }
+ return TRUE;
+}
+
+static Bool
+intel_none_destroy_pixmap(PixmapPtr pixmap)
+{
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ struct intel_none_screen *none_screen = intel_none_get_screen(screen);
+ struct intel_none_pixmap *none_pixmap = intel_none_get_pixmap(pixmap);
+ Bool ret;
+
+ screen->DestroyPixmap = none_screen->DestroyPixmap;
+ if (pixmap->refcnt <= 1) {
+ if (none_pixmap->bo) {
+ drm_intel_bo_unreference(none_pixmap->bo);
+ none_pixmap->bo = NULL;
+ }
+ }
+
+ ret = screen->DestroyPixmap(pixmap);
+
+ none_screen->DestroyPixmap = screen->DestroyPixmap;
+ screen->DestroyPixmap = intel_none_destroy_pixmap;
+ return ret;
+}
+
+Bool
+intel_none_init(ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ intel_screen_private *intel = intel_get_screen_private(scrn);
+ struct intel_none_screen *none_screen;
+ dri_bo *bo = intel->front_buffer;
+ int ret;
+
+ ret = drm_intel_gem_bo_map_gtt(bo);
+ if (ret)
+ return FALSE;
+
+ if (!fbScreenInit(screen, bo->virtual,
+ scrn->virtualX, scrn->virtualY,
+ scrn->xDpi, scrn->yDpi,
+ scrn->displayWidth, scrn->bitsPerPixel))
+ return FALSE;
+
+ fbPictureInit(screen, NULL, 0);
+
+ if (!dixRegisterPrivateKey(&intel_none_screen_key, PRIVATE_SCREEN, sizeof (struct intel_none_screen)))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&intel_none_pixmap_key, PRIVATE_PIXMAP, sizeof (struct intel_none_pixmap)))
+ return FALSE;
+
+ none_screen = intel_none_get_screen(screen);
+
+ none_screen->DestroyPixmap = screen->DestroyPixmap;
+ screen->DestroyPixmap = intel_none_destroy_pixmap;
+
+ return TRUE;
+}
+
+Bool
+intel_none_create_screen_resources(ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ PixmapPtr pixmap;
+ intel_screen_private *intel = intel_get_screen_private(scrn);
+ dri_bo *bo = intel->front_buffer;
+
+ pixmap = screen->GetScreenPixmap(screen);
+
+ if (!intel_none_set_pixmap_bo(pixmap, bo))
+ return FALSE;
+
+ if (!screen->ModifyPixmapHeader(pixmap,
+ scrn->virtualX,
+ scrn->virtualY,
+ -1, -1,
+ intel->front_pitch,
+ NULL))
+ return FALSE;
+
+ scrn->displayWidth = intel->front_pitch / intel->cpp;
+
+ return TRUE;
+}
diff --git a/src/uxa/intel_none.h b/src/uxa/intel_none.h
new file mode 100644
index 0000000..1c20b02
--- /dev/null
+++ b/src/uxa/intel_none.h
@@ -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_ */
diff --git a/src/uxa/intel_uxa.c b/src/uxa/intel_uxa.c
index e9d905b..358960e 100644
--- a/src/uxa/intel_uxa.c
+++ b/src/uxa/intel_uxa.c
@@ -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)
--
2.0.1

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel