Пример #1
0
/*!
 * This function is directly exported.
 *
 * @param driver_handle
 * @param info
 *
 * @return 0
 */
int igd_get_config_info(igd_driver_h driver_handle,
	igd_config_info_t *config_info)
{
	igd_context_t *context = (igd_context_t *)driver_handle;

	EMGD_TRACE_ENTER;

	EMGD_ASSERT(context, "Null context!", -IGD_ERROR_INVAL);
	EMGD_ASSERT(config_info, "Null config_info!", -IGD_ERROR_INVAL);

	OS_MEMSET(config_info, 0, sizeof(igd_config_info_t));

	/* Config information already obtained from driver_config() */
	config_info->mmio_base_phys = context->device_context.mmadr;
	config_info->mmio_base_virt = context->device_context.virt_mmadr;
	config_info->gtt_memory_base_phys = context->device_context.fb_adr;
	/* config_info->gtt_memory_base_virt = context->device_context.virt_fb_adr; */
	config_info->gtt_memory_size = context->device_context.mem_size;
	config_info->revision_id = context->device_context.rid;
	config_info->hw_status_offset = context->device_context.hw_status_offset;
	config_info->stolen_memory_base_virt = 0; /* FIXME: remove this */

	/* get the portions held in the dsp module */
	if(context->mod_dispatch.dsp_get_config_info) {
		context->mod_dispatch.dsp_get_config_info(context, config_info);
	}
	/* get the portions held in the pi module */
	if(context->mod_dispatch.pi_get_config_info) {
		context->mod_dispatch.pi_get_config_info(context, config_info);
	}

	EMGD_TRACE_EXIT;
	return 0;
}
Пример #2
0
/*!
 * This function is directly exported. When compiled without the init
 * module the function calls the DD layer get_param function. When the
 * full init module is included this function calls _init_get_param to
 * first get the DI parameters then calls the DD layer.
 *
 * @param driver_handle
 * @param id
 * @param value
 *
 * @return get_param()
 */
int igd_get_param(igd_driver_h driver_handle,
	unsigned long id,
	unsigned long *value)
{
	igd_context_t *context = (igd_context_t *)driver_handle;

	EMGD_ASSERT(context, "Null Driver Handle", -IGD_ERROR_INVAL);
	EMGD_ASSERT(value, "Null Value", -IGD_ERROR_INVAL);

	OPT_MICRO_CALL(_init_get_param(driver_handle, id, value));

	return init_dispatch->get_param(context, id, value);
}
Пример #3
0
/*!
 * This function is directly exported. When compiled without the init
 * module the function does nothing and returns 0. When the full init
 * module is included this function calls _init_set_param and returns
 * the result.
 *
 * @param driver_handle
 * @param id
 * @param value
 *
 * @return 0
 */
int igd_set_param(igd_driver_h driver_handle,
	unsigned long id,
	unsigned long value)
{
	igd_context_t *context = (igd_context_t *)driver_handle;

	EMGD_ASSERT(context, "Null Driver Handle", -IGD_ERROR_INVAL);

	OPT_MICRO_CALL(_init_set_param(context, id, value));
	return 0;
}
Пример #4
0
/* FIXME: Move this to PI */
static int igd_get_EDID_block(igd_driver_h driver_handle,
		unsigned short port_number,
		unsigned char FAR *edid_ptr,
		unsigned char block_number)
{
	igd_context_t *context = (igd_context_t *)driver_handle;
	igd_display_port_t *port;
	int                   ret;

	EMGD_TRACE_ENTER;

	EMGD_ASSERT(driver_handle, "Null driver_handle", -IGD_ERROR_INVAL);
	EMGD_ASSERT(edid_ptr, "Null edid_ptr", -IGD_ERROR_INVAL);

	port = context->mod_dispatch.dsp_port_list[port_number];
	if(!port) {
		EMGD_TRACE_EXIT;
		return -IGD_ERROR_INVAL;
	}
	/* Read EDID */
	ret = context->mod_dispatch.i2c_read_regs(
		context,
		port->ddc_reg,
		10,              /* DDC speed 10 KHz */
		port->ddc_dab,
		128*block_number,
		edid_ptr,
		128);

	if (ret) {
		EMGD_TRACE_EXIT;
		return -IGD_ERROR_EDID;
	}

	EMGD_TRACE_EXIT;
	return 0;
} /* end igd_get_EDID_block() */
Пример #5
0
/*!
 * This function is directly exported.
 *
 * @param driver_handle
 *
 * @return 0 on success
 * @return 1 on failure
 */
int igd_driver_config(igd_driver_h driver_handle)
{
	igd_context_t *context = (igd_context_t *)driver_handle;
	int ret;

	EMGD_TRACE_ENTER;

	EMGD_ASSERT(context, "Null context!", -IGD_ERROR_INVAL);

	ret = init_dispatch->config(context, init_dispatch);
	if(ret) {
		EMGD_ERROR_EXIT("Device Dependent Config Failed");
		return ret;
	}


	EMGD_TRACE_EXIT;
	return 0;
}
Пример #6
0
/*!
 * Update internal data structures for the plane, pipe, and port as
 * requested. Allocate a new framebuffer if the new parameters do not
 * match the existing framebuffer.
 *
 * @param display
 * @param port_number
 * @param timing
 * @param pt_info User supplied timing info to check.
 * @param fb_info User supplied framebuffer info.
 * @param flags
 *
 * @return 0 on success
 * @return -IGD_ERROR_INVAL on failure
 */
static int mode_update_plane_pipe_ports(
	igd_display_context_t *display,
	unsigned short port_number,
	igd_timing_info_t *timing,
	igd_framebuffer_info_t *fb_info,
	igd_display_info_t *pt_info,
	unsigned long flags)
{
	int ret;
	int alloc_fb;
	unsigned long size = 0;
	igd_framebuffer_info_t *plane_fb_info;
	igd_display_plane_t *mirror;

	EMGD_TRACE_ENTER;

	EMGD_DEBUG("Port Number (%d)", port_number);

	EMGD_ASSERT( (fb_info || pt_info), "ERROR: fb_info & pt_info are NULL",
		-IGD_ERROR_INVAL);

	EMGD_ASSERT( PLANE(display)->fb_info, "ERROR: fb_info in plane is NULL",
		-IGD_ERROR_INVAL);

	plane_fb_info = PLANE(display)->fb_info;
	mirror = PLANE(display)->mirror;

	/*
	 * If there is a mirror plane (for Clone) and the mirror is populated
	 * then update our plane from the mirror. If the mirror is not populated
	 * then update the mirror from ours.
	 */
	if (mirror) {
		if(mirror->fb_info->flags) {
			OS_MEMCPY(plane_fb_info, mirror->fb_info,
				sizeof(igd_framebuffer_info_t));
		} else {
			OS_MEMCPY(mirror->fb_info, plane_fb_info,
				sizeof(igd_framebuffer_info_t));
		}
	}

	if (PORT(display, port_number)->pt_info == NULL) {
		if ((PORT(display, port_number)->pt_info = (igd_display_info_t *)
				OS_ALLOC(sizeof(igd_display_info_t))) == NULL) {
			EMGD_ERROR_EXIT("unable to alloc a pt_info struct in pipe.");
			return -IGD_ERROR_INVAL;
		}
	}

	/*
	 * If the fb_info was provided, and either we were asked to update
	 * the internal structures via the flags, or we are allocating a new
	 * framebuffer.
	 */
	if(fb_info && (flags & MODE_UPDATE_PLANE)) {

		/* Assume we will be allocating a FB */
		alloc_fb = 1;

		/* If the frambuffer parameters are unchanged then do not re-alloc */
		if((fb_info->width == plane_fb_info->width) &&
			(fb_info->height == plane_fb_info->height) &&
			(fb_info->pixel_format == plane_fb_info->pixel_format) &&
			(fb_info->flags == plane_fb_info->flags)) {
			alloc_fb = 0;
		}

		/* Do not re-alloc a framebuffer if the re-use flag is set. */
		if(fb_info->flags & IGD_REUSE_FB) {
			alloc_fb = 0;
			/* May need to get the MIN_PITCH flags */
			plane_fb_info->flags = (fb_info->flags & IGD_FB_FLAGS_MASK) |
				(plane_fb_info->flags & ~IGD_FB_FLAGS_MASK);
		}

		/*
		 * If we don't have a framebuffer at all then we MUST allocate
		 * one.
		 */
		if(!plane_fb_info->allocated && !fb_info->allocated) {
			alloc_fb = 1;
		}

		EMGD_DEBUG("plane_fb_info->fb_base_offset = 0x%08lx",
			plane_fb_info->fb_base_offset);
		if(alloc_fb) {
			if(plane_fb_info->allocated) {
				/* Free frame buffer memory */
				display->context->dispatch.gmm_free(
					plane_fb_info->fb_base_offset);
				plane_fb_info->allocated = 0;
			}

			fb_info->fb_base_offset = plane_fb_info->fb_base_offset;
			/*
			 * Keep the FB flags, add in Displayable flag and blank out
			 * the rest. This insures that any tiled or usage flags from an
			 * earlier call do not get reused.
			 */
			fb_info->flags = (fb_info->flags & IGD_FB_FLAGS_MASK) |
				IGD_SURFACE_DISPLAY;

			/*
			 * Framebuffer allocations must always come from a reservation
			 * if the IAL changes the address the new address must also be
			 * from a reservation.
			 */
			GMM_SET_DEBUG_NAME("Framebuffer");
			ret = display->context->dispatch.gmm_alloc_surface(
				&fb_info->fb_base_offset,
				fb_info->pixel_format,
				&fb_info->width,
				&fb_info->height,
				&fb_info->screen_pitch,
				&size,
				IGD_GMM_ALLOC_TYPE_RESERVATION,
				&fb_info->flags);
			if(ret) {
				EMGD_ERROR_EXIT("Allocation of Front buffer failed: %d", ret);
				return ret;
			}
			fb_info->allocated = 1;
			/* Set the visible offset to the newly-allocated offset: */
			fb_info->visible_offset = fb_info->fb_base_offset;
		} else {
			/* If not reallocating, use back the offset in plane_fb_info */
			fb_info->fb_base_offset = plane_fb_info->fb_base_offset;
		}

		OS_MEMCPY(plane_fb_info, fb_info, sizeof(igd_framebuffer_info_t));
		plane_fb_info->allocated = 1;
		EMGD_DEBUG("plane_fb_info->fb_base_offset = 0x%08lx",
			plane_fb_info->fb_base_offset);

	}

	if(timing && (flags & MODE_UPDATE_PIPE)) {
		EMGD_DEBUG("Updating pipe timing.");
		PIPE(display)->timing = timing;
		PIPE(display)->owner = display;
	}

	if(pt_info && (flags & MODE_UPDATE_PORT)) {
		EMGD_DEBUG("OLD_PT========NEW PT ");
		IGD_PRINTK_PTINFO_2(PORT(display, port_number)->pt_info, pt_info);
		OS_MEMCPY(PORT(display, port_number)->pt_info, pt_info,
				sizeof(igd_display_info_t));
	}

	EMGD_TRACE_EXIT;
	return 0;
} /* end mode_update_plane_pipe_ports() */