} else {
OUT_MODE(NV50_CRTC0_FB_OFFSET + offset, crtc->fb->block->start >> 8);
OUT_MODE(0x864 + offset, 0);
- if (crtc->cursor->block)
- OUT_MODE(NV50_CRTC0_CURSOR_OFFSET + offset, crtc->cursor->block->start >> 8);
- else
- OUT_MODE(NV50_CRTC0_CURSOR_OFFSET + offset, 0);
+
+ crtc->cursor->set_offset(crtc);
+
if (dev_priv->chipset != 0x50)
OUT_MODE(NV84_CRTC0_BLANK_UNK2 + offset, NV84_CRTC0_BLANK_UNK2_UNBLANK);
OUT_MODE(NV50_CRTC0_BLANK_CTRL + offset, NV50_CRTC0_BLANK_CTRL_UNBLANK);
}
+ /* sometimes you need to know if a screen is already blanked. */
+ crtc->blanked = blanked;
+
return 0;
}
struct drm_device *dev;
int index;
bool active;
+ bool blanked;
struct nouveau_hw_mode *mode;
struct nouveau_hw_mode *native_mode;
return 0;
}
+static int nv50_cursor_set_offset(struct nv50_crtc *crtc)
+{
+ struct drm_nouveau_private *dev_priv = crtc->dev->dev_private;
+
+ NV50_DEBUG("\n");
+
+ if (crtc->cursor->block) {
+ OUT_MODE(NV50_CRTC0_CURSOR_OFFSET + crtc->index * 0x400, crtc->cursor->block->start >> 8);
+ } else {
+ OUT_MODE(NV50_CRTC0_CURSOR_OFFSET + crtc->index * 0x400, 0);
+ }
+
+ return 0;
+}
+
static int nv50_cursor_set_bo(struct nv50_crtc *crtc, drm_handle_t handle)
{
struct mem_block *block = NULL;
/* set the cursor offset cursor */
if (first_time) {
- OUT_MODE(NV50_CRTC0_CURSOR_OFFSET + crtc->index * 0x400, crtc->cursor->block->start >> 8);
+ crtc->cursor->set_offset(crtc);
if (crtc->cursor->visible)
crtc->cursor->show(crtc);
}
crtc->cursor->show = nv50_cursor_show;
crtc->cursor->hide = nv50_cursor_hide;
crtc->cursor->set_pos = nv50_cursor_set_pos;
+ crtc->cursor->set_offset = nv50_cursor_set_offset;
crtc->cursor->set_bo = nv50_cursor_set_bo;
crtc->cursor->enable = nv50_cursor_enable;
crtc->cursor->disable = nv50_cursor_disable;
int (*show) (struct nv50_crtc *crtc);
int (*hide) (struct nv50_crtc *crtc);
int (*set_pos) (struct nv50_crtc *crtc, int x, int y);
+ int (*set_offset) (struct nv50_crtc *crtc);
int (*set_bo) (struct nv50_crtc *crtc, drm_handle_t handle);
int (*enable) (struct nv50_crtc *crtc);
int (*disable) (struct nv50_crtc *crtc);
#include "drm.h"
#include "drm_sarea.h"
#include "nouveau_drv.h"
+#include "nv50_kms_wrapper.h"
+
static struct mem_block *
split_block(struct mem_block *p, uint64_t start, uint64_t size,
DRM_DEBUG("freeing 0x%llx type=0x%08x\n", block->start, block->flags);
+ /* Check if the deallocations cause problems for our modesetting system. */
+ if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+ if (dev_priv->card_type >= NV_50) {
+ struct nv50_crtc *crtc = NULL;
+ struct nv50_display *display = nv50_get_display(dev);
+
+ list_for_each_entry(crtc, &display->crtcs, head) {
+ if (crtc->fb->block == block) {
+ crtc->fb->block = NULL;
+
+ /* this will force a lut change next time a fb is loaded */
+ crtc->lut->depth = 0;
+
+ if (!crtc->blanked)
+ crtc->blank(crtc, TRUE);
+ }
+
+ if (crtc->cursor->block == block) {
+ crtc->cursor->block = NULL;
+
+ if (crtc->cursor->visible)
+ crtc->cursor->hide(crtc);
+ }
+ }
+ }
+ }
+
if (block->flags&NOUVEAU_MEM_MAPPED)
drm_rmmap(dev, block->map);