summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-03-04 10:23:12 -0800
committerEric Anholt <eric@anholt.net>2010-03-04 11:25:12 -0800
commite37b562083aa3293e0c009171724a3f122d8a32d (patch)
treef78a80129edc6460eadd1f0318d786350d8307ea /src
parenta36bdaba6136054ae7c67943ca0215cfd177bc5b (diff)
Init CRTC cursors with CRTC setup instead of i830_memory.
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c24
-rw-r--r--src/i830.h3
-rw-r--r--src/i830_driver.c4
-rw-r--r--src/i830_memory.c44
4 files changed, 21 insertions, 54 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fd31b1dc..9cdb7e8b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -582,6 +582,15 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc,
size, red, green, blue);
}
+static void
+drmmode_crtc_destroy(xf86CrtcPtr crtc)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+ drm_intel_bo_unreference(drmmode_crtc->cursor);
+ drmmode_crtc->cursor = NULL;
+}
+
static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
.dpms = drmmode_crtc_dpms,
.set_mode_major = drmmode_set_mode_major,
@@ -594,13 +603,14 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
.shadow_allocate = drmmode_crtc_shadow_allocate,
.shadow_destroy = drmmode_crtc_shadow_destroy,
.gamma_set = drmmode_crtc_gamma_set,
- .destroy = NULL, /* XXX */
+ .destroy = drmmode_crtc_destroy,
};
static void
drmmode_crtc_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num)
{
+ intel_screen_private *intel = intel_get_screen_private(scrn);
xf86CrtcPtr crtc;
drmmode_crtc_private_ptr drmmode_crtc;
@@ -614,14 +624,12 @@ drmmode_crtc_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num)
drmmode_crtc->drmmode = drmmode;
crtc->driver_private = drmmode_crtc;
- return;
-}
+ drmmode_crtc->cursor = drm_intel_bo_alloc(intel->bufmgr, "ARGB cursor",
+ HWCURSOR_SIZE_ARGB,
+ GTT_PAGE_SIZE);
+ drm_intel_bo_disable_reuse(drmmode_crtc->cursor);
-void
-drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo *cursor)
-{
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_crtc->cursor = cursor;
+ return;
}
static xf86OutputStatus
diff --git a/src/i830.h b/src/i830.h
index 2547b6ff..9b3282a9 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -234,8 +234,6 @@ typedef struct intel_screen_private {
long GTTMapSize;
drm_intel_bo *front_buffer;
- /* One big buffer for all cursors for kernels that support this */
- drm_intel_bo *cursor_mem_argb[2];
dri_bufmgr *bufmgr;
@@ -421,7 +419,6 @@ extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr * bufmgr,
xf86CrtcPtr crtc);
extern int drmmode_output_dpms_status(xf86OutputPtr output);
extern int drmmode_crtc_id(xf86CrtcPtr crtc);
-void drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo * cursor);
extern Bool i830_crtc_on(xf86CrtcPtr crtc);
extern int i830_crtc_to_pipe(xf86CrtcPtr crtc);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index e7bfb9b2..6381549f 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -704,6 +704,8 @@ static Bool I830DrmModeInit(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
+ i830_init_bufmgr(scrn);
+
if (drmmode_pre_init(scrn, intel->drmSubFD, intel->cpp) == FALSE) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Kernel modesetting setup failed\n");
@@ -711,8 +713,6 @@ static Bool I830DrmModeInit(ScrnInfoPtr scrn)
return FALSE;
}
- i830_init_bufmgr(scrn);
-
return TRUE;
}
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 7d0e3369..d1a2b6b2 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -169,16 +169,10 @@ i830_check_display_stride(ScrnInfoPtr scrn, int stride, Bool tiling)
void i830_reset_allocations(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
- int p;
/* Null out the pointers for all the allocations we just freed. This is
* kind of gross, but at least it's just one place now.
*/
- for (p = 0; p < 2; p++) {
- drm_intel_bo_unreference(intel->cursor_mem_argb[p]);
- intel->cursor_mem_argb[p] = NULL;
- }
-
drm_intel_bo_unreference(intel->front_buffer);
intel->front_buffer = NULL;
}
@@ -282,39 +276,14 @@ drm_intel_bo *i830_allocate_framebuffer(ScrnInfoPtr scrn)
return front_buffer;
}
-static Bool i830_allocate_cursor_buffers(ScrnInfoPtr scrn)
-{
- intel_screen_private *intel = intel_get_screen_private(scrn);
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
-
- for (i = 0; i < xf86_config->num_crtc; i++) {
- intel->cursor_mem_argb[i] =
- drm_intel_bo_alloc(intel->bufmgr, "ARGB cursor",
- HWCURSOR_SIZE_ARGB, GTT_PAGE_SIZE);
-
- if (!intel->cursor_mem_argb[i])
- return FALSE;
-
- drm_intel_bo_disable_reuse(intel->cursor_mem_argb[i]);
- }
- return TRUE;
-}
-
/*
- * Allocate memory for 2D operation. This includes the (front) framebuffer,
- * and HW cursor.
+ * Allocate memory for 2D operation. This includes only the (front)
+ * framebuffer now.
*/
Bool i830_allocate_2d_memory(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
- if (!i830_allocate_cursor_buffers(scrn)) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Failed to allocate HW cursor space.\n");
- return FALSE;
- }
-
intel->front_buffer = i830_allocate_framebuffer(scrn);
if (intel->front_buffer == NULL)
return FALSE;
@@ -323,18 +292,11 @@ Bool i830_allocate_2d_memory(ScrnInfoPtr scrn)
}
/**
- * Called at EnterVT to reinit memory related stuff. Also reinits the drmmode
- * cursors.
+ * Called at EnterVT to reinit memory related stuff..
*/
Bool i830_reinit_memory(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- int i;
-
- for (i = 0; i < xf86_config->num_crtc; i++)
- drmmode_crtc_set_cursor_bo(xf86_config->crtc[i],
- intel->cursor_mem_argb[i]);
i830_set_gem_max_sizes(scrn);