示例#1
0
        private NvResult GetDeviceFileFromFd(int fd, out NvDeviceFile deviceFile)
        {
            deviceFile = null;

            if (fd < 0)
            {
                return(NvResult.InvalidParameter);
            }

            deviceFile = _deviceFileIdRegistry.GetData <NvDeviceFile>(fd);

            if (deviceFile == null)
            {
                Logger.Warning?.Print(LogClass.ServiceNv, $"Invalid file descriptor {fd}");

                return(NvResult.NotImplemented);
            }

            if (deviceFile.Owner.Pid != _owner.Pid)
            {
                return(NvResult.AccessDenied);
            }

            return(NvResult.Success);
        }
示例#2
0
        // CreateStrayLayer(u32, u64) -> (u64, u64, buffer<bytes, 6>)
        public ResultCode CreateStrayLayer(ServiceCtx context)
        {
            long layerFlags = context.RequestData.ReadInt64();
            long displayId  = context.RequestData.ReadInt64();

            ulong parcelPtr = context.Request.ReceiveBuff[0].Position;

            // TODO: support multi display.
            Display disp = _displays.GetData <Display>((int)displayId);

            IBinder producer = context.Device.System.SurfaceFlinger.CreateLayer(0, out long layerId);

            context.Device.System.SurfaceFlinger.SetRenderLayer(layerId);

            Parcel parcel = new Parcel(0x28, 0x4);

            parcel.WriteObject(producer, "dispdrv\0");

            ReadOnlySpan <byte> parcelData = parcel.Finish();

            context.Memory.Write(parcelPtr, parcelData);

            context.ResponseData.Write(layerId);
            context.ResponseData.Write((long)parcelData.Length);

            return(ResultCode.Success);
        }
示例#3
0
        // CreateStrayLayer(u32, u64) -> (u64, u64, buffer<bytes, 6>)
        public ResultCode CreateStrayLayer(ServiceCtx context)
        {
            long layerFlags = context.RequestData.ReadInt64();
            long displayId  = context.RequestData.ReadInt64();

            long parcelPtr = context.Request.ReceiveBuff[0].Position;

            Display disp = _displays.GetData <Display>((int)displayId);

            IBinder producer = context.Device.System.SurfaceFlinger.CreateLayer(context.Process, out long layerId);

            HOSBinderDriverServer.RegisterBinderObject(producer);

            Parcel parcel = new Parcel(0x28, 0x4);

            parcel.WriteObject(producer, "dispdrv\0");

            ReadOnlySpan <byte> parcelData = parcel.Finish();

            context.Memory.WriteBytes(parcelPtr, parcelData.ToArray());

            context.ResponseData.Write(layerId);
            context.ResponseData.Write((long)parcelData.Length);

            return(ResultCode.Success);
        }
        // CreateStrayLayer(u32, u64) -> (u64, u64, buffer<bytes, 6>)
        public ResultCode CreateStrayLayer(ServiceCtx context)
        {
            long layerFlags = context.RequestData.ReadInt64();
            long displayId  = context.RequestData.ReadInt64();

            long parcelPtr = context.Request.ReceiveBuff[0].Position;

            Display disp = _displays.GetData <Display>((int)displayId);

            byte[] parcel = MakeIGraphicsBufferProducer(parcelPtr);

            context.Memory.WriteBytes(parcelPtr, parcel);

            context.ResponseData.Write(0L);
            context.ResponseData.Write((long)parcel.Length);

            return(ResultCode.Success);
        }
        public long CreateStrayLayer(ServiceCtx Context)
        {
            long LayerFlags = Context.RequestData.ReadInt64();
            long DisplayId  = Context.RequestData.ReadInt64();

            long ParcelPtr = Context.Request.ReceiveBuff[0].Position;

            Display Disp = Displays.GetData <Display>((int)DisplayId);

            byte[] Parcel = MakeIGraphicsBufferProducer(ParcelPtr);

            AMemoryHelper.WriteBytes(Context.Memory, ParcelPtr, Parcel);

            Context.ResponseData.Write(0L);
            Context.ResponseData.Write((long)Parcel.Length);

            return(0);
        }
示例#6
0
 private IIpcService GetObject(int id)
 {
     return(_domainObjects.GetData <IIpcService>(id));
 }
示例#7
0
 private IIpcService GetObject(int Id)
 {
     return(DomainObjects.GetData <IIpcService>(Id));
 }
示例#8
0
 public T GetData <T>(int Handle)
 {
     return(Handles.GetData <T>(Handle));
 }