@@ -111,6 +111,7 @@ static void pgraph_gl_process_pending(NV2AState *d)
111111
112112 if (qatomic_read (& r -> downloads_pending ) ||
113113 qatomic_read (& r -> download_dirty_surfaces_pending ) ||
114+ qatomic_read (& r -> download_dirty_surfaces_in_range_pending ) ||
114115 qatomic_read (& d -> pgraph .sync_pending ) ||
115116 qatomic_read (& d -> pgraph .flush_pending ) ||
116117 qatomic_read (& r -> shader_cache_writeback_pending )) {
@@ -122,6 +123,13 @@ static void pgraph_gl_process_pending(NV2AState *d)
122123 if (qatomic_read (& r -> download_dirty_surfaces_pending )) {
123124 pgraph_gl_download_dirty_surfaces (d );
124125 }
126+ if (qatomic_read (& r -> download_dirty_surfaces_in_range_pending )) {
127+ pgraph_gl_download_surfaces_in_range_if_dirty (
128+ d , r -> download_dirty_surfaces_in_range_start ,
129+ r -> download_dirty_surfaces_in_range_size );
130+ qatomic_set (& r -> download_dirty_surfaces_in_range_pending , false);
131+ qemu_event_set (& r -> dirty_surfaces_download_complete );
132+ }
125133 if (qatomic_read (& d -> pgraph .sync_pending )) {
126134 pgraph_gl_sync (d );
127135 }
@@ -153,6 +161,25 @@ static void pgraph_gl_pre_savevm_wait(NV2AState *d)
153161 qemu_event_wait (& r -> dirty_surfaces_download_complete );
154162}
155163
164+ static void pgraph_gl_download_overlapping_surfaces_trigger (NV2AState * d ,
165+ hwaddr start ,
166+ hwaddr size )
167+ {
168+ PGRAPHState * pg = & d -> pgraph ;
169+ PGRAPHGLState * r = pg -> gl_renderer_state ;
170+
171+ r -> download_dirty_surfaces_in_range_start = start ;
172+ r -> download_dirty_surfaces_in_range_size = size ;
173+ qemu_event_reset (& r -> dirty_surfaces_download_complete );
174+ qatomic_set (& r -> download_dirty_surfaces_in_range_pending , true);
175+ }
176+
177+ static void pgraph_gl_download_overlapping_surfaces_wait (NV2AState * d )
178+ {
179+ qemu_event_wait (
180+ & d -> pgraph .gl_renderer_state -> dirty_surfaces_download_complete );
181+ }
182+
156183static void pgraph_gl_pre_shutdown_trigger (NV2AState * d )
157184{
158185 PGRAPHState * pg = & d -> pgraph ;
@@ -170,33 +197,43 @@ static void pgraph_gl_pre_shutdown_wait(NV2AState *d)
170197 qemu_event_wait (& r -> shader_cache_writeback_complete );
171198}
172199
173- static PGRAPHRenderer pgraph_gl_renderer = {
174- .type = CONFIG_DISPLAY_RENDERER_OPENGL ,
175- .name = "OpenGL" ,
176- .ops = {
177- .init = pgraph_gl_init ,
178- .early_context_init = early_context_init ,
179- .finalize = pgraph_gl_finalize ,
180- .clear_report_value = pgraph_gl_clear_report_value ,
181- .clear_surface = pgraph_gl_clear_surface ,
182- .draw_begin = pgraph_gl_draw_begin ,
183- .draw_end = pgraph_gl_draw_end ,
184- .flip_stall = pgraph_gl_flip_stall ,
185- .flush_draw = pgraph_gl_flush_draw ,
186- .get_report = pgraph_gl_get_report ,
187- .image_blit = pgraph_gl_image_blit ,
188- .pre_savevm_trigger = pgraph_gl_pre_savevm_trigger ,
189- .pre_savevm_wait = pgraph_gl_pre_savevm_wait ,
190- .pre_shutdown_trigger = pgraph_gl_pre_shutdown_trigger ,
191- .pre_shutdown_wait = pgraph_gl_pre_shutdown_wait ,
192- .process_pending = pgraph_gl_process_pending ,
193- .process_pending_reports = pgraph_gl_process_pending_reports ,
194- .surface_update = pgraph_gl_surface_update ,
195- .set_surface_scale_factor = pgraph_gl_set_surface_scale_factor ,
196- .get_surface_scale_factor = pgraph_gl_get_surface_scale_factor ,
197- .get_framebuffer_surface = pgraph_gl_get_framebuffer_surface ,
198- }
199- };
200+ static PGRAPHRenderer
201+ pgraph_gl_renderer = { .type = CONFIG_DISPLAY_RENDERER_OPENGL ,
202+ .name = "OpenGL" ,
203+ .ops = {
204+ .init = pgraph_gl_init ,
205+ .early_context_init = early_context_init ,
206+ .finalize = pgraph_gl_finalize ,
207+ .clear_report_value =
208+ pgraph_gl_clear_report_value ,
209+ .clear_surface = pgraph_gl_clear_surface ,
210+ .draw_begin = pgraph_gl_draw_begin ,
211+ .draw_end = pgraph_gl_draw_end ,
212+ .flip_stall = pgraph_gl_flip_stall ,
213+ .flush_draw = pgraph_gl_flush_draw ,
214+ .get_report = pgraph_gl_get_report ,
215+ .image_blit = pgraph_gl_image_blit ,
216+ .pre_savevm_trigger =
217+ pgraph_gl_pre_savevm_trigger ,
218+ .pre_savevm_wait = pgraph_gl_pre_savevm_wait ,
219+ .pre_shutdown_trigger =
220+ pgraph_gl_pre_shutdown_trigger ,
221+ .pre_shutdown_wait = pgraph_gl_pre_shutdown_wait ,
222+ .process_pending = pgraph_gl_process_pending ,
223+ .process_pending_reports =
224+ pgraph_gl_process_pending_reports ,
225+ .surface_update = pgraph_gl_surface_update ,
226+ .download_overlapping_surfaces_trigger =
227+ pgraph_gl_download_overlapping_surfaces_trigger ,
228+ .download_overlapping_surfaces_wait =
229+ pgraph_gl_download_overlapping_surfaces_wait ,
230+ .set_surface_scale_factor =
231+ pgraph_gl_set_surface_scale_factor ,
232+ .get_surface_scale_factor =
233+ pgraph_gl_get_surface_scale_factor ,
234+ .get_framebuffer_surface =
235+ pgraph_gl_get_framebuffer_surface ,
236+ } };
200237
201238static void __attribute__((constructor )) register_renderer (void )
202239{
0 commit comments