* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "util/u_memory.h"
#include "virgl_context.h"
#include "virgl_encode.h"
+#include "virgl_protocol.h"
#include "virgl_resource.h"
static struct pipe_stream_output_target *virgl_create_so_target(
unsigned buffer_offset,
unsigned buffer_size)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
- struct virgl_resource *res = (struct virgl_resource *)buffer;
+ struct virgl_context *vctx = virgl_context(ctx);
+ struct virgl_resource *res = virgl_resource(buffer);
struct virgl_so_target *t = CALLOC_STRUCT(virgl_so_target);
uint32_t handle;
static void virgl_destroy_so_target(struct pipe_context *ctx,
struct pipe_stream_output_target *target)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
- struct virgl_so_target *t = (struct virgl_so_target *)target;
+ struct virgl_context *vctx = virgl_context(ctx);
+ struct virgl_so_target *t = virgl_so_target(target);
pipe_resource_reference(&t->base.buffer, NULL);
virgl_encode_delete_object(vctx, t->handle, VIRGL_OBJECT_STREAMOUT_TARGET);
struct pipe_stream_output_target **targets,
const unsigned *offset)
{
- struct virgl_context *vctx = (struct virgl_context *)ctx;
+ struct virgl_context *vctx = virgl_context(ctx);
int i;
for (i = 0; i < num_targets; i++) {
pipe_resource_reference(&vctx->so_targets[i].base.buffer, targets[i]->buffer);