On 17.02.2017 14:08, Henri Verbeet wrote:
Is it intentional that you are not updating cs->start and cs->end in any other situation? This might lead to unnecessary memory allocations because start / end is not set back before the block is fully empty. Here an example what happens if wined3d_device_delete_opengl_contexts_cs is called with lots of resources (with this patch http://ix.io/dP5):
fixme:d3d:wined3d_device_delete_opengl_contexts_cs -> unloading resources fixme:d3d:wined3d_cs_st_require_space start = 12 fixme:d3d:wined3d_cs_st_require_space start = 20 fixme:d3d:wined3d_cs_st_require_space start = 28 [...] fixme:d3d:wined3d_cs_st_require_space start = 4068 fixme:d3d:wined3d_cs_st_require_space start = 4076 fixme:d3d:wined3d_cs_st_require_space start = 4084 fixme:d3d:wined3d_cs_st_require_space allocated new block 0x579fdb70 fixme:d3d:wined3d_cs_st_require_space start = 0 fixme:d3d:wined3d_cs_st_require_space start = 0 fixme:d3d:wined3d_cs_st_require_space start = 0 [..]
In this case, with the buffer basically almost empty, there shouldn't be any need to do memory allocations.
On 17 February 2017 at 16:12, Sebastian Lackner sebastian@fds-team.de wrote:
Is it intentional that you are not updating cs->start and cs->end in any other situation?
Somewhat, in the sense that I cared more about simplicity than making it optimal at this point. But there's no reason not to fix the issue.
On 17.02.2017 16:38, Henri Verbeet wrote:
I don't think fixing this requires a more complex solution, see my proposed patch.
On 17 February 2017 at 16:59, Sebastian Lackner sebastian@fds-team.de wrote:
I don't think fixing this requires a more complex solution, see my proposed patch.
I think that should work, yeah.
Hi Henri,
What is your long term plan regarding this? I'm sure you are aware that my last version avoided emitting CS command from inside the CS and the ringbuffer code is designed around having a single producer and single consumer.
Is this patch intended as a temporary measure, or are you planning to retain the ability to emit CS commands from the CS thread?
Stefan
On 17.02.2017 20:07, Stefan Dösinger wrote:
I don't know if its planned as a permanent solution, but emitting commands on the command stream thread (and dispatching them immediately) does not really mean that we can't use a ringbuffer (or any other queue) for commands from other threads. We only have to be careful that wait_idle() doesn't cause a deadlock. ;)