linux/drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c

// SPDX-License-Identifier: GPL-2.0 OR MIT
/**************************************************************************
 *
 * Copyright © 2018-2023 VMware, Inc., Palo Alto, CA., USA
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 * USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 **************************************************************************/

#include "vmwgfx_binding.h"
#include "vmwgfx_bo.h"
#include "vmwgfx_drv.h"
#include "vmwgfx_resource_priv.h"

#include <drm/ttm/ttm_placement.h>

/**
 * struct vmw_dx_streamoutput - Streamoutput resource metadata.
 * @res: Base resource struct.
 * @ctx: Non-refcounted context to which @res belong.
 * @cotable: Refcounted cotable holding this Streamoutput.
 * @cotable_head: List head for cotable-so_res list.
 * @id: User-space provided identifier.
 * @size: User-space provided mob size.
 * @committed: Whether streamoutput is actually created or pending creation.
 */
struct vmw_dx_streamoutput {};

static int vmw_dx_streamoutput_create(struct vmw_resource *res);
static int vmw_dx_streamoutput_bind(struct vmw_resource *res,
				    struct ttm_validate_buffer *val_buf);
static int vmw_dx_streamoutput_unbind(struct vmw_resource *res, bool readback,
				      struct ttm_validate_buffer *val_buf);
static void vmw_dx_streamoutput_commit_notify(struct vmw_resource *res,
					      enum vmw_cmdbuf_res_state state);

static const struct vmw_res_func vmw_dx_streamoutput_func =;

static inline struct vmw_dx_streamoutput *
vmw_res_to_dx_streamoutput(struct vmw_resource *res)
{}

/**
 * vmw_dx_streamoutput_unscrub - Reattach the MOB to streamoutput.
 * @res: The streamoutput resource.
 *
 * Return: 0 on success, negative error code on failure.
 */
static int vmw_dx_streamoutput_unscrub(struct vmw_resource *res)
{}

static int vmw_dx_streamoutput_create(struct vmw_resource *res)
{}

static int vmw_dx_streamoutput_bind(struct vmw_resource *res,
				    struct ttm_validate_buffer *val_buf)
{}

/**
 * vmw_dx_streamoutput_scrub - Unbind the MOB from streamoutput.
 * @res: The streamoutput resource.
 *
 * Return: 0 on success, negative error code on failure.
 */
static int vmw_dx_streamoutput_scrub(struct vmw_resource *res)
{}

static int vmw_dx_streamoutput_unbind(struct vmw_resource *res, bool readback,
				      struct ttm_validate_buffer *val_buf)
{}

static void vmw_dx_streamoutput_commit_notify(struct vmw_resource *res,
					   enum vmw_cmdbuf_res_state state)
{}

/**
 * vmw_dx_streamoutput_lookup - Do a streamoutput resource lookup by user key.
 * @man: Command buffer managed resource manager for current context.
 * @user_key: User-space identifier for lookup.
 *
 * Return: Valid refcounted vmw_resource on success, error pointer on failure.
 */
struct vmw_resource *
vmw_dx_streamoutput_lookup(struct vmw_cmdbuf_res_manager *man,
			   u32 user_key)
{}

static void vmw_dx_streamoutput_res_free(struct vmw_resource *res)
{}

static void vmw_dx_streamoutput_hw_destroy(struct vmw_resource *res)
{}

/**
 * vmw_dx_streamoutput_add - Add a streamoutput as a cmd buf managed resource.
 * @man: Command buffer managed resource manager for current context.
 * @ctx: Pointer to context resource.
 * @user_key: The identifier for this streamoutput.
 * @list: The list of staged command buffer managed resources.
 *
 * Return: 0 on success, negative error code on failure.
 */
int vmw_dx_streamoutput_add(struct vmw_cmdbuf_res_manager *man,
			    struct vmw_resource *ctx, u32 user_key,
			    struct list_head *list)
{}

/**
 * vmw_dx_streamoutput_set_size - Sets streamoutput mob size in res struct.
 * @res: The streamoutput res for which need to set size.
 * @size: The size provided by user-space to set.
 */
void vmw_dx_streamoutput_set_size(struct vmw_resource *res, u32 size)
{}

/**
 * vmw_dx_streamoutput_remove - Stage streamoutput for removal.
 * @man: Command buffer managed resource manager for current context.
 * @user_key: The identifier for this streamoutput.
 * @list: The list of staged command buffer managed resources.
 *
 * Return: 0 on success, negative error code on failure.
 */
int vmw_dx_streamoutput_remove(struct vmw_cmdbuf_res_manager *man,
			       u32 user_key,
			       struct list_head *list)
{}

/**
 * vmw_dx_streamoutput_cotable_list_scrub - cotable unbind_func callback.
 * @dev_priv: Device private.
 * @list: The list of cotable resources.
 * @readback: Whether the call was part of a readback unbind.
 */
void vmw_dx_streamoutput_cotable_list_scrub(struct vmw_private *dev_priv,
					    struct list_head *list,
					    bool readback)
{}