Lines Matching full:shader
44 struct vmw_shader shader; member
129 * Shader management:
169 struct vmw_shader *shader = vmw_res_to_shader(res); in vmw_gb_shader_init() local
188 shader->size = size; in vmw_gb_shader_init()
189 shader->type = type; in vmw_gb_shader_init()
190 shader->num_input_sig = num_input_sig; in vmw_gb_shader_init()
191 shader->num_output_sig = num_output_sig; in vmw_gb_shader_init()
198 * GB shader code:
204 struct vmw_shader *shader = vmw_res_to_shader(res); in vmw_gb_shader_create() local
216 DRM_ERROR("Failed to allocate a shader id.\n"); in vmw_gb_shader_create()
234 cmd->body.type = shader->type; in vmw_gb_shader_create()
235 cmd->body.sizeInBytes = shader->size; in vmw_gb_shader_create()
345 * DX shader code:
349 * vmw_dx_shader_commit_notify - Notify that a shader operation has been
352 * @res: Pointer to the shader resource.
359 struct vmw_dx_shader *shader = vmw_res_to_dx_shader(res); in vmw_dx_shader_commit_notify() local
364 vmw_cotable_add_resource(shader->cotable, in vmw_dx_shader_commit_notify()
365 &shader->cotable_head); in vmw_dx_shader_commit_notify()
366 shader->committed = true; in vmw_dx_shader_commit_notify()
367 res->id = shader->id; in vmw_dx_shader_commit_notify()
371 list_del_init(&shader->cotable_head); in vmw_dx_shader_commit_notify()
372 shader->committed = false; in vmw_dx_shader_commit_notify()
379 * vmw_dx_shader_unscrub - Have the device reattach a MOB to a DX shader.
381 * @res: The shader resource
387 struct vmw_dx_shader *shader = vmw_res_to_dx_shader(res); in vmw_dx_shader_unscrub() local
394 if (!list_empty(&shader->cotable_head) || !shader->committed) in vmw_dx_shader_unscrub()
397 cmd = VMW_FIFO_RESERVE_DX(dev_priv, sizeof(*cmd), shader->ctx->id); in vmw_dx_shader_unscrub()
403 cmd->body.cid = shader->ctx->id; in vmw_dx_shader_unscrub()
404 cmd->body.shid = shader->id; in vmw_dx_shader_unscrub()
409 vmw_cotable_add_resource(shader->cotable, &shader->cotable_head); in vmw_dx_shader_unscrub()
415 * vmw_dx_shader_create - The DX shader create callback
417 * @res: The DX shader resource
420 * makes sure that we unscrub the shader if it's previously been scrubbed.
425 struct vmw_dx_shader *shader = vmw_res_to_dx_shader(res); in vmw_dx_shader_create() local
428 WARN_ON_ONCE(!shader->committed); in vmw_dx_shader_create()
436 res->id = shader->id; in vmw_dx_shader_create()
441 * vmw_dx_shader_bind - The DX shader bind callback
443 * @res: The DX shader resource
462 * vmw_dx_shader_scrub - Have the device unbind a MOB from a DX shader.
464 * @res: The shader resource
466 * This function unbinds a MOB from the DX shader without requiring the
473 struct vmw_dx_shader *shader = vmw_res_to_dx_shader(res); in vmw_dx_shader_scrub() local
480 if (list_empty(&shader->cotable_head)) in vmw_dx_shader_scrub()
483 WARN_ON_ONCE(!shader->committed); in vmw_dx_shader_scrub()
490 cmd->body.cid = shader->ctx->id; in vmw_dx_shader_scrub()
496 list_del_init(&shader->cotable_head); in vmw_dx_shader_scrub()
502 * vmw_dx_shader_unbind - The dx shader unbind callback.
504 * @res: The shader resource
543 * Scrubs all shader MOBs so that any subsequent shader unbind or shader
562 * vmw_dx_shader_res_free - The DX shader free callback
564 * @res: The shader resource
566 * Frees the DX shader resource and updates memory accounting.
571 struct vmw_dx_shader *shader = vmw_res_to_dx_shader(res); in vmw_dx_shader_res_free() local
573 vmw_resource_unreference(&shader->cotable); in vmw_dx_shader_res_free()
574 kfree(shader); in vmw_dx_shader_res_free()
579 * vmw_dx_shader_add - Add a shader resource as a command buffer managed
584 * @user_key: The id used for this shader.
585 * @shader_type: The shader type.
594 struct vmw_dx_shader *shader; in vmw_dx_shader_add() local
604 vmw_shader_dx_size = ttm_round_pot(sizeof(*shader)); in vmw_dx_shader_add()
613 DRM_ERROR("Out of graphics memory for shader " in vmw_dx_shader_add()
618 shader = kmalloc(sizeof(*shader), GFP_KERNEL); in vmw_dx_shader_add()
619 if (!shader) { in vmw_dx_shader_add()
624 res = &shader->res; in vmw_dx_shader_add()
625 shader->ctx = ctx; in vmw_dx_shader_add()
626 shader->cotable = vmw_resource_reference in vmw_dx_shader_add()
628 shader->id = user_key; in vmw_dx_shader_add()
629 shader->committed = false; in vmw_dx_shader_add()
630 INIT_LIST_HEAD(&shader->cotable_head); in vmw_dx_shader_add()
637 * The user_key name-space is not per shader type for DX shaders, in vmw_dx_shader_add()
638 * so when hashing, use a single zero shader type. in vmw_dx_shader_add()
646 res->id = shader->id; in vmw_dx_shader_add()
658 * User-space shader management:
665 shader.res); in vmw_user_shader_base_to_res()
671 container_of(res, struct vmw_user_shader, shader.res); in vmw_user_shader_free()
681 struct vmw_shader *shader = vmw_res_to_shader(res); in vmw_shader_free() local
684 kfree(shader); in vmw_shader_free()
741 DRM_ERROR("Out of graphics memory for shader " in vmw_user_shader_alloc()
754 res = &ushader->shader.res; in vmw_user_shader_alloc()
794 struct vmw_shader *shader; in vmw_shader_alloc() local
812 DRM_ERROR("Out of graphics memory for shader " in vmw_shader_alloc()
817 shader = kzalloc(sizeof(*shader), GFP_KERNEL); in vmw_shader_alloc()
818 if (unlikely(!shader)) { in vmw_shader_alloc()
825 res = &shader->res; in vmw_shader_alloc()
855 VMW_DEBUG_USER("Couldn't find buffer for shader creation.\n"); in vmw_shader_define()
861 VMW_DEBUG_USER("Illegal buffer- or shader size.\n"); in vmw_shader_define()
875 VMW_DEBUG_USER("Illegal shader type.\n"); in vmw_shader_define()
895 * vmw_shader_id_ok - Check whether a compat shader user key and
896 * shader type are within valid bounds.
898 * @user_key: User space id of the shader.
899 * @shader_type: Shader type.
909 * vmw_shader_key - Compute a hash key suitable for a compat shader.
911 * @user_key: User space id of the shader.
912 * @shader_type: Shader type.
923 * vmw_shader_remove - Stage a compat shader for removal.
925 * @man: Pointer to the compat shader manager identifying the shader namespace.
926 * @user_key: The key that is used to identify the shader. The key is
927 * unique to the shader type.
928 * @shader_type: Shader type.
946 * vmw_compat_shader_add - Create a compat shader and stage it for addition
949 * @man: Pointer to the compat shader manager identifying the shader namespace.
950 * @user_key: The key that is used to identify the shader. The key is
951 * unique to the shader type.
952 * @bytecode: Pointer to the bytecode of the shader.
953 * @shader_type: Shader type.
954 * @tfile: Pointer to a struct ttm_object_file that the guest-backed shader is
990 /* Map and copy shader bytecode. */ in vmw_compat_shader_add()
1021 * vmw_shader_lookup - Look up a compat shader
1024 * the shader namespace.
1025 * @user_key: The user space id of the shader.
1026 * @shader_type: The shader type.
1028 * Returns a refcounted pointer to a struct vmw_resource if the shader was