static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num, int type, unsigned int resolution) { struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num); if (WARN_ON(resolution >= GVT_EDID_NUM)) return -EINVAL; port->edid = kzalloc(sizeof(*(port->edid)), GFP_KERNEL); if (!port->edid) return -ENOMEM; port->dpcd = kzalloc(sizeof(*(port->dpcd)), GFP_KERNEL); if (!port->dpcd) { kfree(port->edid); return -ENOMEM; } memcpy(port->edid->edid_block, virtual_dp_monitor_edid[resolution], EDID_SIZE); port->edid->data_valid = true; memcpy(port->dpcd->data, dpcd_fix_data, DPCD_HEADER_SIZE); port->dpcd->data_valid = true; port->dpcd->data[DPCD_SINK_COUNT] = 0x1; port->type = type; emulate_monitor_status_change(vgpu); vgpu_vreg(vgpu, PIPECONF(PIPE_A)) |= PIPECONF_ENABLE; return 0; }
static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num, int type) { struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num); port->edid = kzalloc(sizeof(*(port->edid)), GFP_KERNEL); if (!port->edid) return -ENOMEM; port->dpcd = kzalloc(sizeof(*(port->dpcd)), GFP_KERNEL); if (!port->dpcd) { kfree(port->edid); return -ENOMEM; } memcpy(port->edid->edid_block, virtual_dp_monitor_edid, EDID_SIZE); port->edid->data_valid = true; memcpy(port->dpcd->data, dpcd_fix_data, DPCD_HEADER_SIZE); port->dpcd->data_valid = true; port->dpcd->data[DPCD_SINK_COUNT] = 0x1; port->type = type; emulate_monitor_status_change(vgpu); return 0; }
static void clean_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num) { struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num); kfree(port->edid); port->edid = NULL; kfree(port->dpcd); port->dpcd = NULL; }