Lines Matching refs:vbox

30 void vbox_report_caps(struct vbox_private *vbox)  in vbox_report_caps()  argument
36 hgsmi_send_caps_info(vbox->guest_pool, caps); in vbox_report_caps()
38 hgsmi_send_caps_info(vbox->guest_pool, caps); in vbox_report_caps()
46 struct vbox_private *vbox = fb->dev->dev_private; in vbox_framebuffer_dirty_rectangles() local
52 mutex_lock(&vbox->hw_mutex); in vbox_framebuffer_dirty_rectangles()
76 if (!vbva_buffer_begin_update(&vbox->vbva_info[crtc_id], in vbox_framebuffer_dirty_rectangles()
77 vbox->guest_pool)) in vbox_framebuffer_dirty_rectangles()
80 vbva_write(&vbox->vbva_info[crtc_id], vbox->guest_pool, in vbox_framebuffer_dirty_rectangles()
82 vbva_buffer_end_update(&vbox->vbva_info[crtc_id]); in vbox_framebuffer_dirty_rectangles()
85 mutex_unlock(&vbox->hw_mutex); in vbox_framebuffer_dirty_rectangles()
104 int vbox_framebuffer_init(struct vbox_private *vbox, in vbox_framebuffer_init() argument
111 drm_helper_mode_fill_fb_struct(&vbox->ddev, &vbox_fb->base, mode_cmd); in vbox_framebuffer_init()
113 ret = drm_framebuffer_init(&vbox->ddev, &vbox_fb->base, &vbox_fb_funcs); in vbox_framebuffer_init()
122 static int vbox_accel_init(struct vbox_private *vbox) in vbox_accel_init() argument
127 vbox->vbva_info = devm_kcalloc(vbox->ddev.dev, vbox->num_crtcs, in vbox_accel_init()
128 sizeof(*vbox->vbva_info), GFP_KERNEL); in vbox_accel_init()
129 if (!vbox->vbva_info) in vbox_accel_init()
133 vbox->available_vram_size -= vbox->num_crtcs * VBVA_MIN_BUFFER_SIZE; in vbox_accel_init()
135 vbox->vbva_buffers = pci_iomap_range(vbox->ddev.pdev, 0, in vbox_accel_init()
136 vbox->available_vram_size, in vbox_accel_init()
137 vbox->num_crtcs * in vbox_accel_init()
139 if (!vbox->vbva_buffers) in vbox_accel_init()
142 for (i = 0; i < vbox->num_crtcs; ++i) { in vbox_accel_init()
143 vbva_setup_buffer_context(&vbox->vbva_info[i], in vbox_accel_init()
144 vbox->available_vram_size + in vbox_accel_init()
147 vbva = (void __force *)vbox->vbva_buffers + in vbox_accel_init()
149 if (!vbva_enable(&vbox->vbva_info[i], in vbox_accel_init()
150 vbox->guest_pool, vbva, i)) { in vbox_accel_init()
159 static void vbox_accel_fini(struct vbox_private *vbox) in vbox_accel_fini() argument
163 for (i = 0; i < vbox->num_crtcs; ++i) in vbox_accel_fini()
164 vbva_disable(&vbox->vbva_info[i], vbox->guest_pool, i); in vbox_accel_fini()
166 pci_iounmap(vbox->ddev.pdev, vbox->vbva_buffers); in vbox_accel_fini()
170 static bool have_hgsmi_mode_hints(struct vbox_private *vbox) in have_hgsmi_mode_hints() argument
175 ret = hgsmi_query_conf(vbox->guest_pool, in have_hgsmi_mode_hints()
181 ret = hgsmi_query_conf(vbox->guest_pool, in have_hgsmi_mode_hints()
200 int vbox_hw_init(struct vbox_private *vbox) in vbox_hw_init() argument
204 vbox->full_vram_size = inl(VBE_DISPI_IOPORT_DATA); in vbox_hw_init()
205 vbox->any_pitch = vbox_check_supported(VBE_DISPI_ID_ANYX); in vbox_hw_init()
207 DRM_INFO("VRAM %08x\n", vbox->full_vram_size); in vbox_hw_init()
210 vbox->guest_heap = in vbox_hw_init()
211 pci_iomap_range(vbox->ddev.pdev, 0, GUEST_HEAP_OFFSET(vbox), in vbox_hw_init()
213 if (!vbox->guest_heap) in vbox_hw_init()
217 vbox->guest_pool = gen_pool_create(4, -1); in vbox_hw_init()
218 if (!vbox->guest_pool) in vbox_hw_init()
221 ret = gen_pool_add_virt(vbox->guest_pool, in vbox_hw_init()
222 (unsigned long)vbox->guest_heap, in vbox_hw_init()
223 GUEST_HEAP_OFFSET(vbox), in vbox_hw_init()
228 ret = hgsmi_test_query_conf(vbox->guest_pool); in vbox_hw_init()
235 vbox->available_vram_size = GUEST_HEAP_OFFSET(vbox); in vbox_hw_init()
237 hgsmi_query_conf(vbox->guest_pool, VBOX_VBVA_CONF32_MONITOR_COUNT, in vbox_hw_init()
238 &vbox->num_crtcs); in vbox_hw_init()
239 vbox->num_crtcs = clamp_t(u32, vbox->num_crtcs, 1, VBOX_MAX_SCREENS); in vbox_hw_init()
241 if (!have_hgsmi_mode_hints(vbox)) { in vbox_hw_init()
246 vbox->last_mode_hints = devm_kcalloc(vbox->ddev.dev, vbox->num_crtcs, in vbox_hw_init()
249 if (!vbox->last_mode_hints) { in vbox_hw_init()
254 ret = vbox_accel_init(vbox); in vbox_hw_init()
261 gen_pool_destroy(vbox->guest_pool); in vbox_hw_init()
263 pci_iounmap(vbox->ddev.pdev, vbox->guest_heap); in vbox_hw_init()
267 void vbox_hw_fini(struct vbox_private *vbox) in vbox_hw_fini() argument
269 vbox_accel_fini(vbox); in vbox_hw_fini()
270 gen_pool_destroy(vbox->guest_pool); in vbox_hw_fini()
271 pci_iounmap(vbox->ddev.pdev, vbox->guest_heap); in vbox_hw_fini()
274 int vbox_gem_create(struct vbox_private *vbox, in vbox_gem_create() argument
286 gbo = drm_gem_vram_create(&vbox->ddev, &vbox->ddev.vram_mm->bdev, in vbox_gem_create()