From d9a1d7b212b7f5f760e2ddd3d80f7a15a3fd1493 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 5 Mar 2018 18:32:47 +0000 Subject: [PATCH] i915 destroy_cursor(): GEN3 specific code git-svn-id: svn://kolibrios.org@7173 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/video/drm/i915/kos_cursor.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/video/drm/i915/kos_cursor.c b/drivers/video/drm/i915/kos_cursor.c index b52271c8a4..704a725276 100644 --- a/drivers/video/drm/i915/kos_cursor.c +++ b/drivers/video/drm/i915/kos_cursor.c @@ -61,14 +61,28 @@ static void disable_mouse(void){}; static void __attribute__((regparm(1))) destroy_cursor(cursor_t *cursor) { + struct drm_i915_private *dev_priv = main_device->dev_private; struct drm_i915_gem_object *obj = cursor->cobj; - list_del(&cursor->list); + u32 ifl; + ifl = safe_cli(); + list_del(&cursor->list); + safe_sti(ifl); + + if (!dev_priv->info.cursor_needs_physical) + { i915_gem_object_ggtt_unpin(cursor->cobj); mutex_lock(&main_device->struct_mutex); drm_gem_object_unreference(&obj->base); mutex_unlock(&main_device->struct_mutex); + } + else + { + addr_t page = (addr_t)obj; + for(addr_t i = 0; i < (KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*8)/4096; i+=4096) + FreePage(page+i); + } __DestroyObject(cursor); }; @@ -90,7 +104,7 @@ static int init_cursor(cursor_t *cursor) if (dev_priv->info.cursor_needs_physical) { - bits = (uint32_t*)KernelAlloc(KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*8); + mapped = bits = (uint32_t*)KernelAlloc(KMS_CURSOR_WIDTH*KMS_CURSOR_HEIGHT*8); if (unlikely(bits == NULL)) { ret = -ENOMEM;