On 11/25/25 15:00, Alex Bennée wrote:
>>      if (ret) {
>>          qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to map virgl resource: 
>> %s\n",
>>                        __func__, strerror(-ret));
>> -        return ret;
>> +        return -1;
> If we are using errno's lets use the defines rather than -1, should this
> be -EPERM?
> 
>>      }
>>  
>>      vmr = g_new0(struct virtio_gpu_virgl_hostmem_region, 1);
>> @@ -789,7 +789,16 @@ static void virgl_cmd_resource_map_blob(VirtIOGPU *g,
>>      }
>>  
>>      ret = virtio_gpu_virgl_map_resource_blob(g, res, mblob.offset);
>> -    if (ret) {
>> +
>> +    switch (ret) {
>> +    case 0:
>> +        break;
>> +
>> +    case -EINVAL:
>> +        cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
>> +        return;
> which isn't what can come here. I see EOPNOTSUPP not being handled either.

When error comes from external virglrenderer code, we don't know exact
reason it fails. Using -1 allows clear distinguish of external vs
internal to QEMU errors.

EOPNOTSUPP and everything else that doesn't have a directly matching
guest code falls into the default error handling returning
VIRTIO_GPU_RESP_ERR_UNSPEC to guest.

-- 
Best regards,
Dmitry

Reply via email to