CN106649037A - Judgment method and apparatus for GPU task completion state - Google Patents

Judgment method and apparatus for GPU task completion state Download PDF

Info

Publication number
CN106649037A
CN106649037A CN201611119859.XA CN201611119859A CN106649037A CN 106649037 A CN106649037 A CN 106649037A CN 201611119859 A CN201611119859 A CN 201611119859A CN 106649037 A CN106649037 A CN 106649037A
Authority
CN
China
Prior art keywords
gpu task
methods
event
interfaces
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201611119859.XA
Other languages
Chinese (zh)
Other versions
CN106649037B (en
Inventor
杨亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Huafu Top Dyed Yarn Melange Co ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201611119859.XA priority Critical patent/CN106649037B/en
Publication of CN106649037A publication Critical patent/CN106649037A/en
Application granted granted Critical
Publication of CN106649037B publication Critical patent/CN106649037B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a judgment method and apparatus for a GPU task completion state. The judgment method comprises the steps of presetting an event query in a first process; running a GPU task in the first process; after the GPU task, presetting the event query to be in a completion state; judging whether the event query is in a ready state or not; and if yes, determining that the GPU task is completed. According to the method and the apparatus, the technical problem that contents in another uncompleted GPU task are difficultly read in a cross-process manner in a GPU is solved and the technical effect of cross-process sharing of the contents of the uncompleted GPU task is achieved; and especially the technical problem that one process performs texture drawing and another process performs texture reading during cross-process sharing of a same texture in a typical condition of the GPU task is solved.

Description

A kind of determination methods and device of GPU task completion status
Technical field
The present invention relates to field of computer technology, the determination methods and device of more particularly to a kind of GPU task completion status.
Background technology
With the continuous development of hardware technology, GPU (image processor) powerful computing capability is received more and more Pay attention to, accordingly, also more and more higher is required to the read-write efficiency of graphics processing tasks.When the instruction operation of program operation is in CPU When in (central processing unit), as long as a upper instruction operation is complete, it is determined that the tasks carrying is completed on ordinary meaning, then Following task can be carried out.But when instructions to be executed by is operated in GPU, generally need under certain conditions clear and definite Operate in the instruction in GPU or whether task completes, can just carry out following operation.
Striding course is difficult when a process GPU task is not also completed in prior art, and another process is entered to the GPU task Row reads, the typical situation of one of which, and when striding course shares same texture, a process is drawing texture, and in addition One process is reading the texture.There are corresponding critical zone, read-write lock mechanism to solve this problem on CPU;And in GPU The upper process for reading the shared texture is had to until another process for drawing the texture completes to draw operation on GPU, The image of texture could be successfully read, the picture material of the shared texture otherwise cannot be correctly got.
The content of the invention
The present invention provides a kind of determination methods and device of GPU task completion status, solves and striding course is difficult on GPU The technical problem of content in another unfinished GPU task is read, has been reached and has been realized the shared unfinished GPU task content of striding course Technique effect;
Typical case in GPU task is especially solved, when striding course shares same texture, a process is being drawn Texture, and another process is in the technical problem for reading the texture.
In a first aspect, the application provides a kind of determination methods of GPU task completion status, the determination methods include:
The predeterminable event inquiry in the first process;Operation in first process has the GPU task;
After the GPU task, the event query is preset as into completion status;
Judge whether the event query is ready state;
If, it is determined that the GPU task is completed.
Preferably, the GPU task specially draws shared texture;
The inquiry of the predeterminable event in first process, also includes before:
The shared texture is preset in the first process, and the shared texture is set to into post-processing object, to be painted System;
It is described to determine that the GPU task is completed, also include afterwards:
Second process reads the shared texture.
Preferably, the inquiry of the predeterminable event in the first process, specially:
By the CreateQuery methods of IDirect3DDevice9 interfaces, one is preset in first process IDirect3DQuery9 interfaces, to preset an event query.
Preferably, it is described after GPU task instruction, the event query is preset as into completion status, specially:
After GPU task instruction, by the Issue methods of IDirect3DQuery9 interfaces by the event query It is arranged to D3DISSUE_END states.
Preferably, it is described to judge whether the event query is ready state, specially:
By the GetData methods of IDirect3DDevice9 interfaces in first process, GetData methods are judged Return value, if the return value be mistake S_FALSE, first process by GetData methods continue judgement;If institute State return value for correct S_OK when, the event query be ready state.
Preferably, it is described that a shared texture is preset in the first process, specifically include:
D3D11_TEXTURE2D_DESC structures in initialization Direct3D11 equipment, by Direct3D11 device pointers The default ID3D11Texture2D texture interfaces of the CreateTexture2D methods of interface ID3D11Device;
Shared texture pointer interface ID3D11Texture2D is obtained, by interface ID3D11Texture2D's QueryInterface methods obtain IDXGIResource interfaces;
By the GetSharedHandle methods in the IDXGIResource interfaces that get, handle value is obtained sharedHandle。
Preferably, the inquiry of the predeterminable event in first process, specifically includes:
When the second process needs to read the unfinished shared texture, by ID3D11Device interfaces CreateQuery methods, preset an ID3D11Query interface in first process, to preset an event query.
Preferably, it is described after the GPU task, the event query is preset as into completion status, specially:
After the GPU task, the event query is set by the End methods of ID3D11DeviceContext interfaces It is set to D3DISSUE_END states.
Preferably, it is described to judge whether the event query is ready state, specially:
By the GetData methods of ID3D11DeviceContext interfaces, the return value of GetData methods is judged, to sentence Whether disconnected event query completes.
Second aspect, the application also provides a kind of judgment means of GPU task completion status, and the judgment means include:
The default unit of inquiry, inquires about for the predeterminable event in the first process;
State presets unit, for after the GPU task, the event query being preset as into completion status;
Condition adjudgement unit, for judging whether the event query is ready state;
Status determining unit, for when the condition adjudgement unit judges result is to be, it is determined that the GPU task is Complete.
One or more technical schemes provided in the embodiment of the present invention, at least have the following technical effect that or advantage:
1st, the method and device that the embodiment of the present application is provided, is inquired about by the predeterminable event in first process;Institute After stating GPU task, the event query is preset as into completion status, makes video driver take over the state control of inquiry;And lead to Cross and judge that whether event query is ready state judging whether GPU task completes;If it is not, then first process continues to sentence It is disconnected;If, it is determined that the GPU task is completed, realizes the GPU task content in the shared operation of striding course.
2nd, the method and device that the embodiment of the present application is provided, by passing through IDirect3DDevice9 in Direct3D9 The default texture of the CreateTexture interfaces of interface, arranges handle value for 0 to preset a shared texture, obtains return described The read-write handle value e of shared texture, by arranging the shared handle value to open the first process in default shared texture, it is real The read-write of striding course texture is showed.
3rd, the method and device that the embodiment of the present application is provided, the second process needs to read unfinished described shared texture When, the predeterminable event inquiry in first process makes video driver take over the state control of inquiry;It is described by determining Event query whether ready state determining whether shared texture part to be read has completed, the second process can if completing Shared texture part to be read in read the first process, realizes and the process of the shared texture is read on GPU need not wait The process that the texture is drawn to another is completed to draw operation on GPU and just can correctly read the picture material of texture.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention, And can be practiced according to the content of specification, and in order to allow the above and other objects of the present invention, feature and advantage can Become apparent, below especially exemplified by the specific embodiment of the present invention.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing The accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are these Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with root Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the flow chart of the determination methods of GPU task completion status in the embodiment of the present invention;
Fig. 2 is the structural representation of the judgment means of GPU task completion status in the embodiment of the present invention.
Specific embodiment
Determination methods and device that the embodiment of the present application passes through a kind of GPU task completion status of offer, solve on GPU The technical problem that striding course reads content in another unfinished GPU task is difficult to, has been reached and has been realized that striding course is shared unfinished The technique effect of GPU task content;Typical case in GPU task is especially solved, when striding course shares same texture, One process is in drafting texture, and another process is in the technical problem for reading the texture.
Technical scheme in the embodiment of the present application, general thought is as follows:
When GPU task completion status in needing to judge the first process, predeterminable event inquiry, institute in first process Stating operation in the first process has the GPU task;After the GPU task, the event query is preset as into completion status and is sentenced Whether the event query that breaks is ready state, then first process continues to judge;If it is just to determine the event query Not-ready status, if, it is determined that the GPU task is completed.
Said method is inquired about by the predeterminable event in the first process, and is inserted the event after goal task instruction Inquiry is preset as completion status so that user can according to their needs select partial task to be read as goal task, GPU synchronizing processes are ensure that, even if the overall tasks in that is, described first process are not also completed, target also can be synchronously read and be appointed Business.
To make purpose, technical scheme and the advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is The a part of embodiment of the present invention, rather than the embodiment of whole.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Embodiment one
The application provides a kind of determination methods of GPU task completion status, refers to Fig. 1, and the determination methods include:
Step S110, the predeterminable event inquiry in the first process;Operation in first process has the GPU task.
Step S120, after the GPU task, by the event query completion status is preset as.
Step S130, judges whether the event query is ready state.
Step S140, if, it is determined that the GPU task is completed.
It should be noted that this method is suitable for all Windows systems, particularly Windows Vista systems and afterwards Version.Can be in the version of Windows Vista, Windows 7, Windows 8 and Windows 10.
With reference to Fig. 1, the determination methods of the GPU task completion status provided the application describe in detail:
Wherein, the GPU task specially draws shared texture, and the predeterminable event in first process is inquired about, Also include before:
Step S109, presets the shared texture in the first process, and the shared texture is set to into post-processing object, To be drawn;
It is described to determine that the GPU task is completed, also include afterwards:
Step S150, the second process reads the shared texture.
The determination methods that the application is provided can apply to Direct3D9, be also applied to Direct3D11.
Example one
The determination methods that the application is provided are applied in Direct3D9, therefore, the specific embodiment of the determination methods It is based on the interface or method in Direct3D11.The determination methods of the GPU task completion status that the application is provided, in detail such as Under:
First, execution step S110, the predeterminable event inquiry in the first process;Operation in first process has described GPU task.
In present application example, the inquiry of the predeterminable event in the first process;Operation in first process has described GPU task, specifically includes:
By the CreateQuery methods of IDirect3DDevice9 interfaces, one is preset in first process IDirect3DQuery9 interfaces, to preset an event query Query.
It should be noted that including three state by the default event query Query of step S110:
(1) ready state (Signaled State):It seem the state of a free time.Query object has been generated, and is judged Application program is completing this time inquiry.Work as poll-final, when inquiry state is changed into ready state, it is possible to get inquiry knot Fruit.
(2) preset state (Building State):It seem a staging area.In preset state, inquiry is sent out Rise (by calling D3DISSUE_BEGIN), but without being transformed into completion status.When application program statement poll-final (passes through Call D3DISSUE_END), inquiry has just been transformed into completion status.
(3) completion status (Issued State):The resource that expression is queried has taken over inquiry.When resource completes work After work, state machine can be transformed into ready state.In the stage of completing, application program is it must be determined whether be converted to ready shape State, if ready state, then what GetData was returned is exactly the Query Result for needing.
Next execution step S120, after the GPU task, by the event query completion status is preset as.
It is described after the GPU task in present application example, the event query is preset as into completion status, specifically For:
After the GPU task, the event query is arranged by the Issue methods of IDirect3DQuery9 interfaces Into D3DISSUE_END states.
The event query Query is arranged to into D3DISSUE_END states by performing, so that video driver becomes to connect The state control of pipe inquiry.
Subsequently execution step S130, judges whether the event query is ready state.
In the step s 120 after the GPU task, the event query is preset as into completion status, afterwards described first Process needs to judge whether query event completes, if completing, then the operation of GPU task is also completed, then the second process this When can correctly read in first process share GPU task content.
Due in step S120 the event query being arranged to by the Issue methods of IDirect3DQuery9 interfaces Video driver has taken over the state control of inquiry after D3DISSUE_END states, and after the completion of GPU task, the video driver will The State Transferring of the query event is into ready state, so whether the state that only need to pass through to judge event query is ready state To judge whether GPU task completes.
In present application example, if it is ready state not determine the event query, first process continues to sentence It is disconnected, specifically include:
By the GetData methods of IDirect3DDevice9 interfaces in first process, GetData methods are judged Return value be mistake S_FALSE when, first process by GetData methods continue judgement.
Last execution step S140, if, it is determined that the GPU task is completed.
In present application example, if described, it is determined that the GPU task is completed, is specifically included:
By the GetData methods of IDirect3DDevice9 interfaces in first process, GetData methods are judged Return value be correct S_OK when, it is determined that goal task has been completed, and first process exits judgement.
A kind of determination methods of GPU task completion status that above-mentioned the application is also provided, the GPU task completion status Determination methods solve and the technical problem that striding course reads content in another unfinished GPU task are difficult on GPU.
When the GPU task specially draws shared texture, then step S109 is first carried out before execution step S110, The shared texture is preset in first process, and the shared texture is set to into post-processing object, to be drawn;Performing step After rapid S140, execution step S150, the second process reads the shared texture.
Step S109, presets the shared texture in the first process, and the shared texture is set to render Target, to be drawn, specifically includes:
In the first process, by the CreateTexture interfaces of IDirect3DDevice9 interfaces in Direct3D9 Preset a shared texture;By the SetRenderTarget methods of IDirect3DDevice9 interfaces, by the shared texture It is arranged to a post-processing object.
It can be that method for drafting related in IDirect3DDevice9 interfaces is drawn to draw on the shared texture, can Being to draw content on the shared texture by SetRenderTarget methods.
In the first process, by the CreateTexture interfaces of IDirect3DDevice9 interfaces in Direct3D9 A shared texture is preset, specifically can be pre- to realize when the handle for arranging is 0 by arranging handle (HANDLE) pointer If texture be sharable texture;When the handle for arranging is not 0, then it represents that open a shared texture.
In the shared texture of striding course operation, by arranging handle value in the first process for 0 a shared line is preset Reason, obtains returning the read-write handle value sharedHandle of the shared texture, and other processes can be described shared by arranging Handle value sharedHandle to open the first process in default shared texture, realize the read-write of striding course texture, i.e., in fact Having showed the second process can share the content of shared texture of the first process.But when in the first process in drafting texture still not The picture material of the shared texture can be correctly obtained, will further explain how to solve the problem below.
Step S150, the second process reads the shared texture, specifically includes:
Second process by arranging the shared handle value sharedHandle to open the first process in it is default Shared texture, and read the shared texture, by the shared texture display in first process second process window On mouth.
It is determined that the shared texture rendering after the completion of, second process can read being total in first process Texture is enjoyed, even if the drafting to sharing texture has not been completed in certain process of moment first using after the reading/writing method of the application, Second process still can synchronously read the content of the shared texture.
In the present embodiment, it is described to read the shared texture particular by IDirect3DDevice9's SetTexture methods, so as to realize reading the shared texture.
Example two
The determination methods that the application is provided are applied in Direct3D11, the concrete reality of the determination methods that the application is provided The mode of applying is based on the interface or method in Direct3D11.The determination methods of the GPU task completion status that the application is provided, in detail It is thin as follows:
First, execution step S110, the predeterminable event inquiry in the first process;Operation in first process has described GPU task.
In present application example, the inquiry of the predeterminable event in the first process;Operation in first process has described GPU task, specifically includes:
By the CreateQuery methods of ID3D11Device interfaces, one is preset in first process ID3D11Query interfaces, to preset an event query.
Specifically, the type that will be inquired about by the CreateQuery methods of ID3D11Device interfaces in the first process It is set to D3D11_QUERY_EVENT to preset an ID3D11Query interface, to preset an event query.
It should be noted that including three state by the default event query Query of step S110:
(1) ready state (Signaled State):It seem the state of a free time.Query object has been generated, and is judged Application program is completing this time inquiry.Work as poll-final, when inquiry state is changed into ready state, it is possible to get inquiry knot Fruit.
(2) preset state (Building State):It seem a staging area.In preset state, inquiry is sent out Rise (by calling D3DISSUE_BEGIN), but without being transformed into completion status.When application program statement poll-final (passes through Call D3DISSUE_END), inquiry has just been transformed into completion status.
(3) completion status (Issued State):The resource that expression is queried has taken over inquiry.When resource completes work After work, state machine can be transformed into ready state.In the stage of completing, application program is it must be determined whether be converted to ready shape State, if ready state, then what GetData was returned is exactly the Query Result for needing.
Next execution step S120, after the GPU task, by the event query completion status is preset as.
It is described after the GPU task in present application example, the event query is preset as into completion status, specifically For:
After the GPU task, the event query is set by the End methods of ID3D11DeviceContext interfaces It is set to D3DISSUE_END states.By the way that event query is preset as into completion status so that video driver becomes the shape for taking over inquiry State is controlled.
Subsequently execution step S130, judges whether the event query is ready state.
In the step s 120 after the GPU task, the event query is preset as into completion status, afterwards described first Process needs to judge whether query event completes, if completing, then the operation of GPU task is also completed, then the second process this When can correctly read in first process share GPU task content.
Due in step S120 the event query being arranged by the End methods of ID3D11DeviceContext interfaces Into D3DISSUE_END states.By the way that event query is preset as into completion status so that video driver becomes the state for taking over inquiry Control, after the completion of GPU task, the video driver by the State Transferring of the query event into ready state, so only needing By judging that whether the state of event query is ready state judging whether GPU task completes.
In present application example, judge whether the event query is ready state, specifically include:
By the GetData methods of ID3D11DeviceContext interfaces, the return value of GetData methods is judged, to sentence Whether disconnected event query completes.
When GetData methods return value be S_FALSE, represent the query event have not been completed GPU task also in In drawing process, the first process still needs to continue waiting for and call again GetData methods;If the return value of GetData methods For S_OK, represent that the query event is completed and the drafting operation of GPU task has also been completed, the first process then can be exited Treat, the second process can read the content of GPU task.
Last execution step S140, if, it is determined that the GPU task is completed.
In present application example, if described, it is determined that the GPU task is completed, is specifically included:
When the return value of the GetData methods of ID3D11DeviceContext interfaces is S_OK, represent that the query event is complete Into and GPU task drafting operation also completed, it is determined that the GPU task is completed.
A kind of determination methods of GPU task completion status that above-mentioned the application is also provided, the GPU task completion status Determination methods solve and the technical problem that striding course reads content in another unfinished GPU task are difficult on GPU.
When the GPU task specially draws shared texture, then step S109 is first carried out before execution step S110, The shared texture is preset in first process, and the shared texture is set to into post-processing object, to be drawn;Performing step After rapid S140, execution step S150, the second process reads the shared texture.
Step S109, presets the shared texture in the first process, and the shared texture is set to render Target, to be drawn, specifically includes:
When needing texture read-write synchronous, D3D11_TEXTURE2D_DESC structures in initialization Direct3D11 equipment, Preset by the CreateTexture2D methods of Direct3D11 device pointer interface ID3D11Device ID3D11Texture2D texture interfaces;
Shared texture pointer interface ID3D11Texture2D is obtained, by interface ID3D11Texture2D's QueryInterface methods obtain IDXGIResource interfaces;
By the OMSetRenderTargets methods of ID3D11DeviceContext interfaces, the shared texture is set A post-processing object is set to, then using related method for drafting, the drawing image on the shared texture;
By the OMSetRenderTargets methods of ID3D11DeviceContext interfaces, the shared texture is set A post-processing object is set to, then using related method for drafting, the drawing image on the shared texture.First process can be with Content is drawn on the shared texture by OMSetRenderTargets methods.
By the GetSharedHandle methods in the IDXGIResource interfaces that get, handle value is obtained SharedHandle, obtains a shared Direct3D11 texture so in the first process.Can lead in other processes Cross setting handle value sharedHandle to open the shared texture.
Wherein, D3D11_TEXTURE2D_DESC structures in Direct3D11 equipment are initialized, is specially set by preset value The association attributes in D3D11_TEXTURE2D_DESC structures is put, and D3D11_RESOURCE_MISC_SHARED values are assigned to The MiscFlags attributes of the structure.
Step S150, the second process reads the shared texture, specifically includes:
Step S151, the handle value sharedHandle is set to not for 0, to open first process in institute State shared texture.
Step S151, the handle value sharedHandle is set to not for 0, to open first process in Described shared texture, specially:
By the OpenSharedHandle methods of ID3D11Device interfaces, and handle value sharedHandle, obtain One ID3D11Texture2D interface, to share to the described shared texture in the first process in the second process.
Step S152, reads the shared texture.It is described to read the shared texture, specifically include:
By the PSSetShaderResource methods of ID3D11DeviceContext interfaces, so as to realize that reading this is total to Enjoy the function of texture.Due to now described in the first process share texture have determined complete draw, so second process The content of the shared texture can accurately be read.
Embodiment two
Based on same inventive concept, the application also provides a kind of judgment means of GPU task completion status, refers to figure 2, the judgment means include:
The default unit 210 of inquiry, inquires about for the predeterminable event in the first process;
State presets unit 220, for after the GPU task, the event query being preset as into completion status;
Condition adjudgement unit 230, for judging whether the event query is ready state;
Status determining unit 240, for when the condition adjudgement unit judges result is to be, it is determined that the GPU appoints Business is completed.
The judgment means that the application is provided can apply to Direct3D9, be also applied to Direct3D11.
The judgment means that the present embodiment two is introduced are a kind of judgement side of GPU task completion status of the embodiment of the present application one The device that method is adopted, so the method introduced based on the embodiment of the present invention one, the affiliated personnel in this area will appreciate that the dress The concrete structure put and deformation, so will not be described here.The device that the method for every embodiment of the present invention one is adopted all belongs to In the scope to be protected of the invention.
The technical scheme provided in the embodiment of the present application, at least has the following technical effect that or advantage:
1st, the method and device that the embodiment of the present application is provided, is inquired about by the predeterminable event in first process;Institute After stating GPU task, the event query is preset as into completion status, makes video driver take over the state control of inquiry;And lead to Cross and judge that whether event query is ready state judging whether GPU task completes;If it is not, then first process continues to sentence It is disconnected;If, it is determined that the GPU task is completed, realizes that striding course shares unfinished GPU task content.
2nd, the method and device that the embodiment of the present application is provided, by passing through IDirect3DDevice9 in Direct3D9 The default texture of the CreateTexture interfaces of interface, arranges handle value for 0 to preset a shared texture, obtains return described The read-write handle value e of shared texture, by arranging the shared handle value to open the first process in default shared texture, it is real The read-write of striding course texture is showed.
3rd, the method and device that the embodiment of the present application is provided, the second process needs to read the described shared texture in drawing When, the predeterminable event inquiry in first process makes video driver take over the state control of inquiry;It is described by determining Event query whether ready state determining whether shared texture part to be read has completed, the second process can if completing Shared texture part to be read in read the first process, realizes and the process of the shared texture is read on GPU need not wait The process that the texture is drawn to another is completed to draw operation on GPU and just can correctly read the picture material of texture.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can be using complete hardware embodiment, complete software embodiment or with reference to the reality in terms of software and hardware Apply the form of example.And, the present invention can be adopted and wherein include the computer of computer usable program code at one or more The computer program implemented in usable storage medium (including but not limited to magnetic disc store, CD-ROM, optical memory etc.) is produced The form of product.
The present invention is the flow process with reference to method according to embodiments of the present invention, equipment (system) and computer program Figure and/or block diagram are describing.It should be understood that can be by computer program instructions flowchart and/or each stream in block diagram The combination of journey and/or square frame and flow chart and/or the flow process in block diagram and/or square frame.These computer programs can be provided The processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced for reality by the instruction of computer or the computing device of other programmable data processing devices The device of the function of specifying in present one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or other programmable data processing devices with spy In determining the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory is produced to be included referring to Make the manufacture of device, the command device realize in one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or The function of specifying in multiple square frames.
These computer program instructions also can be loaded in computer or other programmable data processing devices so that in meter Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented process, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow process of flow chart or multiple flow processs and/or block diagram one The step of function of specifying in individual square frame or multiple square frames.
, but those skilled in the art once know basic creation although preferred embodiments of the present invention have been described Property concept, then can make other change and modification to these embodiments.So, claims are intended to be construed to include excellent Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification without deviating from this to the embodiment of the present invention The spirit and scope of bright embodiment.So, if these modifications of the embodiment of the present invention and modification belong to the claims in the present invention And its within the scope of equivalent technologies, then the present invention is also intended to comprising these changes and modification.

Claims (10)

1. a kind of determination methods of GPU task completion status, it is characterised in that the determination methods include:
The predeterminable event inquiry in the first process, operation in first process has the GPU task;
After the GPU task, the event query is preset as into completion status;
Judge whether the event query is ready state;
If, it is determined that the GPU task is completed.
2. determination methods as claimed in claim 1, it is characterised in that the GPU task specially draws shared texture;
The inquiry of the predeterminable event in first process, also includes before:
The shared texture is preset in the first process, and the shared texture is set to into post-processing object, to be drawn;
It is described to determine that the GPU task is completed, also include afterwards:
Second process reads the shared texture.
3. determination methods as claimed in claim 1 or 2, it is characterised in that the inquiry of the predeterminable event in the first process, tool Body is:
By the CreateQuery methods of IDirect3DDevice9 interfaces, one is preset in first process IDirect3DQuery9 interfaces, to preset an event query.
4. determination methods as claimed in claim 3, it is characterised in that described after GPU task instruction, by the event Inquiry is preset as completion status, specially:
After GPU task instruction, the event query is arranged by the Issue methods of IDirect3DQuery9 interfaces Into D3DISSUE_END states.
5. determination methods as claimed in claim 3, it is characterised in that described to judge whether the event query is ready shape State, specially:
By the GetData methods of IDirect3DDevice9 interfaces in first process, returning for GetData methods is judged Value is returned, if the return value is mistake S_FALSE, first process continues to judge by GetData methods;If described return Return value for correct S_OK when, the event query be ready state.
6. determination methods as claimed in claim 3, it is characterised in that described that a shared texture, tool are preset in the first process Body includes:
D3D11_TEXTURE2D_DESC structures in initialization Direct3D11 equipment, by Direct3D11 device pointer interfaces The default ID3D11Texture2D texture interfaces of the CreateTexture2D methods of ID3D11Device;
Shared texture pointer interface ID3D11Texture2D is obtained, by interface ID3D11Texture2D's QueryInterface methods obtain IDXGIResource interfaces;
By the GetSharedHandle methods in the IDXGIResource interfaces that get, handle value is obtained sharedHandle。
7. determination methods as claimed in claim 1 or 2, it is characterised in that the predeterminable event in first process is looked into Ask, specifically include:
When the second process needs to read the unfinished shared texture, by ID3D11Device interfaces CreateQuery methods, preset an ID3D11Query interface in first process, to preset an event query.
8. the determination methods that such as claim 7 is stated, it is characterised in that described after the GPU task, the event query is pre- Completion status is set to, specially:
After the GPU task, the event query is arranged to by the End methods of ID3D11DeviceContext interfaces D3DISSUE_END states.
9. the determination methods that such as claim 7 is stated, it is characterised in that described to judge whether the event query is ready state, Specially:
By the GetData methods of ID3D11DeviceContext interfaces, the return value of GetData methods is judged, to judge thing Whether part inquiry completes.
10. a kind of judgment means of GPU task completion status, it is characterised in that the judgment means include:
The default unit of inquiry, inquires about for the predeterminable event in the first process;
State presets unit, for after the GPU task, the event query being preset as into completion status;
Condition adjudgement unit, for judging whether the event query is ready state;
Status determining unit, for when the condition adjudgement unit judges result is to be, it is determined that the GPU task is complete Into.
CN201611119859.XA 2016-12-08 2016-12-08 A kind of judgment method and device of GPU task completion status Active CN106649037B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611119859.XA CN106649037B (en) 2016-12-08 2016-12-08 A kind of judgment method and device of GPU task completion status

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611119859.XA CN106649037B (en) 2016-12-08 2016-12-08 A kind of judgment method and device of GPU task completion status

Publications (2)

Publication Number Publication Date
CN106649037A true CN106649037A (en) 2017-05-10
CN106649037B CN106649037B (en) 2019-04-23

Family

ID=58818746

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611119859.XA Active CN106649037B (en) 2016-12-08 2016-12-08 A kind of judgment method and device of GPU task completion status

Country Status (1)

Country Link
CN (1) CN106649037B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733356A (en) * 2018-05-14 2018-11-02 武汉斗鱼网络科技有限公司 A kind of texture sharing method, computer equipment and storage medium
CN110058926A (en) * 2018-01-18 2019-07-26 伊姆西Ip控股有限责任公司 For handling the method, equipment and computer-readable medium of GPU task

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101702231A (en) * 2008-11-06 2010-05-05 威盛电子股份有限公司 Plotting processing unit synchronizing system and method
CN101719262A (en) * 2008-11-06 2010-06-02 威盛电子股份有限公司 Graphics processing unit, metaprocessor and metaprocessor executing method
CN101877120A (en) * 2008-11-06 2010-11-03 威盛电子股份有限公司 Method and system for supporting interaction of a plurality of graphics processing units

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101702231A (en) * 2008-11-06 2010-05-05 威盛电子股份有限公司 Plotting processing unit synchronizing system and method
CN101719262A (en) * 2008-11-06 2010-06-02 威盛电子股份有限公司 Graphics processing unit, metaprocessor and metaprocessor executing method
CN101877120A (en) * 2008-11-06 2010-11-03 威盛电子股份有限公司 Method and system for supporting interaction of a plurality of graphics processing units

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
EFFULGENT: "深入理解Direct3D9", 《博客园》 *
GUO SHENG、ZHANG YONG、SONG ZHIKAI等: "Optimize power for portable games on Ultrabook", 《2012 INTERNATIONAL CONFERENCE ON ENERGY AWARE COMPUTING PUBLISHED IN IEEE》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110058926A (en) * 2018-01-18 2019-07-26 伊姆西Ip控股有限责任公司 For handling the method, equipment and computer-readable medium of GPU task
CN110058926B (en) * 2018-01-18 2023-03-14 伊姆西Ip控股有限责任公司 Method, apparatus, and computer-readable medium for processing GPU tasks
CN108733356A (en) * 2018-05-14 2018-11-02 武汉斗鱼网络科技有限公司 A kind of texture sharing method, computer equipment and storage medium

Also Published As

Publication number Publication date
CN106649037B (en) 2019-04-23

Similar Documents

Publication Publication Date Title
JP6778485B2 (en) Rendering method and its device
US7755632B2 (en) GPU internal wait/fence synchronization method and apparatus
US7385607B2 (en) Scalable shader architecture
EP2593862B1 (en) Out-of-order command execution in a multimedia processor
EP0486144A2 (en) High performance triangle interpolator
US9182938B2 (en) Method for controlling multiple displays and system thereof
EP2245598B1 (en) Multi-buffer support for off-screen surfaces in a graphics processing system
TWI344621B (en) A system and method for managing multiple contexts in a decentralized graphics processing unit
US20110276966A1 (en) Managing task dependency within a data processing system
AU2008258132B2 (en) Load balancing in multiple processor rendering systems
US10824468B2 (en) Control of instruction execution in a data processor
CN107577185A (en) A kind of task executing method and the controller based on polycaryon processor
CN106776252B (en) A kind of method and device for evaluating GPU performance
CN106796530A (en) A kind of virtual method, device and electronic equipment, computer program product
CN110494837B (en) Ink rendering using high priority queues
CN110100274A (en) With the mixed reality system for reducing power rendering
CN109213607A (en) A kind of method and apparatus of multithreading rendering
CN106649037A (en) Judgment method and apparatus for GPU task completion state
JPS59149541A (en) Setting system of information on processing conditions
TW201137752A (en) Relational modeling for performance analysis of multi-core processors using virtual tasks
CN107291559A (en) A kind of method and device of control CPU line journey and GPU thread synchronizations
EP0486195A2 (en) Computer graphics system
CN110223215A (en) A kind of control method of graphics rendering pipeline, device and computer storage medium
EP0486194A2 (en) Memory system
KR101131636B1 (en) Command synchronisation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240416

Address after: 312000 Renmin West Road, Shangyu Economic Development Zone, Shaoxing City, Zhejiang Province

Patentee after: ZHEJIANG HUAFU TOP DYED YARN MELANGE Co.,Ltd.

Country or region after: China

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

Country or region before: China