1 #include "main/glheader.h"
2 #include "glapi/glthread.h"
3 #include <GL/internal/glcore.h>
5 #include "pipe/p_context.h"
6 #include "state_tracker/st_public.h"
7 #include "state_tracker/st_context.h"
8 #include "state_tracker/st_cb_fbo.h"
10 #include "nouveau_context.h"
11 #include "nouveau_local.h"
12 #include "nouveau_screen.h"
13 #include "nouveau_swapbuffers.h"
16 nouveau_copy_buffer(__DRIdrawablePrivate
*dPriv
, struct pipe_surface
*surf
,
17 const drm_clip_rect_t
*rect
)
19 struct nouveau_context
*nv
= dPriv
->driContextPriv
->driverPrivate
;
20 drm_clip_rect_t
*pbox
;
24 if (!dPriv
->numClipRects
) {
28 pbox
= dPriv
->pClipRects
;
29 nbox
= dPriv
->numClipRects
;
31 nv
->surface_copy_prep(nv
, nv
->frontbuffer
, surf
);
32 for (i
= 0; i
< nbox
; i
++, pbox
++) {
33 int sx
, sy
, dx
, dy
, w
, h
;
35 sx
= pbox
->x1
- dPriv
->x
;
36 sy
= pbox
->y1
- dPriv
->y
;
39 w
= pbox
->x2
- pbox
->x1
;
40 h
= pbox
->y2
- pbox
->y1
;
42 nv
->surface_copy(nv
, dx
, dy
, sx
, sy
, w
, h
);
48 if (nv
->last_stamp
!= dPriv
->lastStamp
) {
49 struct nouveau_framebuffer
*nvfb
= dPriv
->driverPrivate
;
50 st_resize_framebuffer(nvfb
->stfb
, dPriv
->w
, dPriv
->h
);
51 nv
->last_stamp
= dPriv
->lastStamp
;
56 nouveau_copy_sub_buffer(__DRIdrawablePrivate
*dPriv
, int x
, int y
, int w
, int h
)
58 struct nouveau_framebuffer
*nvfb
= dPriv
->driverPrivate
;
59 struct pipe_surface
*surf
;
61 surf
= st_get_framebuffer_surface(nvfb
->stfb
, ST_SURFACE_BACK_LEFT
);
69 st_notify_swapbuffers(nvfb
->stfb
);
70 nouveau_copy_buffer(dPriv
, surf
, &rect
);
75 nouveau_swap_buffers(__DRIdrawablePrivate
*dPriv
)
77 struct nouveau_framebuffer
*nvfb
= dPriv
->driverPrivate
;
78 struct pipe_surface
*surf
;
80 surf
= st_get_framebuffer_surface(nvfb
->stfb
, ST_SURFACE_BACK_LEFT
);
82 st_notify_swapbuffers(nvfb
->stfb
);
83 nouveau_copy_buffer(dPriv
, surf
, NULL
);