summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/i915
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@openbsd.org>2013-03-17 20:46:10 +0100
committerMark Kettenis <kettenis@openbsd.org>2013-03-17 20:46:10 +0100
commitced165cddcd198eed276fd7caf5f3bb706c9c59e (patch)
tree94acaacd3ce49f35d20233b9b21d87e5c355f600 /sys/dev/pci/drm/i915
parent790d17b08829bcb49ea2365a9037a7e001c7af9c (diff)
Enable acceleration for the framebuffer, but fall back on the unaccelerated
code if somebody has /dev/drm0 open.
Diffstat (limited to 'sys/dev/pci/drm/i915')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c
index 8b6db394be8..7fabfb6d49e 100644
--- a/sys/dev/pci/drm/i915/i915_drv.c
+++ b/sys/dev/pci/drm/i915/i915_drv.c
@@ -759,8 +759,9 @@ inteldrm_copycols(void *cookie, int row, int src, int dst, int num)
{
struct rasops_info *ri = cookie;
struct inteldrm_softc *sc = ri->ri_hw;
+ struct drm_device *dev = (struct drm_device *)sc->drmdev;
- if (sc->noaccel)
+ if (dev->open_count > 0 || sc->noaccel)
return sc->noaccel_ops.copycols(cookie, row, src, dst, num);
num *= ri->ri_font->fontwidth;
@@ -780,9 +781,10 @@ inteldrm_erasecols(void *cookie, int row, int col, int num, long attr)
{
struct rasops_info *ri = cookie;
struct inteldrm_softc *sc = ri->ri_hw;
+ struct drm_device *dev = (struct drm_device *)sc->drmdev;
int bg, fg;
- if (sc->noaccel)
+ if (dev->open_count > 0 || sc->noaccel)
return sc->noaccel_ops.erasecols(cookie, row, col, num, attr);
ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
@@ -802,8 +804,9 @@ inteldrm_copyrows(void *cookie, int src, int dst, int num)
{
struct rasops_info *ri = cookie;
struct inteldrm_softc *sc = ri->ri_hw;
+ struct drm_device *dev = (struct drm_device *)sc->drmdev;
- if (sc->noaccel)
+ if (dev->open_count > 0 || sc->noaccel)
return sc->noaccel_ops.copyrows(cookie, src, dst, num);
num *= ri->ri_font->fontheight;
@@ -821,10 +824,11 @@ inteldrm_eraserows(void *cookie, int row, int num, long attr)
{
struct rasops_info *ri = cookie;
struct inteldrm_softc *sc = ri->ri_hw;
+ struct drm_device *dev = (struct drm_device *)sc->drmdev;
int bg, fg;
int x, y, w;
- if (sc->noaccel)
+ if (dev->open_count > 0 || sc->noaccel)
return sc->noaccel_ops.eraserows(cookie, row, num, attr);
ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
@@ -1161,13 +1165,11 @@ inteldrm_attach(struct device *parent, struct device *self, void *aux)
dev_priv->noaccel_ops = ri->ri_ops;
-#ifdef notyet
ri->ri_hw = dev_priv;
ri->ri_ops.copyrows = inteldrm_copyrows;
ri->ri_ops.copycols = inteldrm_copycols;
ri->ri_ops.eraserows = inteldrm_eraserows;
ri->ri_ops.erasecols = inteldrm_erasecols;
-#endif
inteldrm_stdscreen.capabilities = ri->ri_caps;
inteldrm_stdscreen.nrows = ri->ri_rows;