Subversion Repositories Kolibri OS

Rev

Rev 4359 | Rev 4372 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4359 Rev 4368
Line 47... Line 47...
47
#include 
47
#include 
48
#include 
48
#include 
Line 49... Line 49...
49
 
49
 
Line -... Line 50...
-
 
50
#define to_surface(x) (surface_t*)((x)->handle)
-
 
51
 
-
 
52
typedef struct {
-
 
53
    int l;
-
 
54
    int t;
-
 
55
    int r;
-
 
56
    int b;
50
#define to_surface(x) (surface_t*)((x)->handle)
57
} rect_t;
51
 
58
 
Line 52... Line 59...
52
static struct sna_fb sna_fb;
59
static struct sna_fb sna_fb;
Line 266... Line 273...
266
    return caps;
273
    return caps;
267
}
274
}
Line 268... Line 275...
268
 
275
 
269
void sna_fini()
276
void sna_fini()
-
 
277
{
-
 
278
    ENTER();
270
{
279
 
271
    if( sna_device )
280
    if( sna_device )
272
    {
281
    {
Line 273... Line 282...
273
        struct kgem_bo *mask;
282
        struct kgem_bo *mask;
Line 277... Line 286...
277
        mask = tls_get(tls_mask);
286
        mask = tls_get(tls_mask);
Line 278... Line 287...
278
 
287
 
279
        sna_device->render.fini(sna_device);
288
        sna_device->render.fini(sna_device);
280
        if(mask)
289
        if(mask)
281
            kgem_bo_destroy(&sna_device->kgem, mask);
290
            kgem_bo_destroy(&sna_device->kgem, mask);
282
        kgem_close_batches(&sna_device->kgem);
291
//        kgem_close_batches(&sna_device->kgem);
Line 283... Line 292...
283
   	    kgem_cleanup_cache(&sna_device->kgem);
292
   	    kgem_cleanup_cache(&sna_device->kgem);
284
 
293
 
285
   	    sna_device = NULL;
294
   	    sna_device = NULL;
-
 
295
        __lock_release_recursive(__sna_lock);
286
        __lock_release_recursive(__sna_lock);
296
    };
Line 287... Line 297...
287
    };
297
    LEAVE();
Line 288... Line 298...
288
}
298
}
Line 695... Line 705...
695
err_1:
705
err_1:
696
    __lock_release_recursive(__sna_lock);
706
    __lock_release_recursive(__sna_lock);
697
    return -1;
707
    return -1;
698
};
708
};
Line -... Line 709...
-
 
709
 
-
 
710
#define MI_LOAD_REGISTER_IMM		(0x22<<23)
-
 
711
#define MI_WAIT_FOR_EVENT			(0x03<<23)
-
 
712
 
-
 
713
static bool sna_emit_wait_for_scanline_gen6(struct sna *sna,
-
 
714
                        rect_t *crtc,
-
 
715
					    int pipe, int y1, int y2,
-
 
716
					    bool full_height)
-
 
717
{
-
 
718
	uint32_t *b;
-
 
719
	uint32_t event;
-
 
720
 
-
 
721
//	if (!sna->kgem.has_secure_batches)
-
 
722
//		return false;
-
 
723
 
-
 
724
	assert(y1 >= 0);
-
 
725
	assert(y2 > y1);
-
 
726
	assert(sna->kgem.mode == KGEM_RENDER);
-
 
727
 
-
 
728
	/* Always program one less than the desired value */
-
 
729
	if (--y1 < 0)
-
 
730
		y1 = crtc->b;
-
 
731
	y2--;
-
 
732
 
-
 
733
	/* The scanline granularity is 3 bits */
-
 
734
	y1 &= ~7;
-
 
735
	y2 &= ~7;
-
 
736
	if (y2 == y1)
-
 
737
		return false;
-
 
738
 
-
 
739
	event = 1 << (3*full_height + pipe*8);
-
 
740
 
-
 
741
	b = kgem_get_batch(&sna->kgem);
-
 
742
	sna->kgem.nbatch += 10;
-
 
743
 
-
 
744
	b[0] = MI_LOAD_REGISTER_IMM | 1;
-
 
745
	b[1] = 0x44050; /* DERRMR */
-
 
746
	b[2] = ~event;
-
 
747
	b[3] = MI_LOAD_REGISTER_IMM | 1;
-
 
748
	b[4] = 0x4f100; /* magic */
-
 
749
	b[5] = (1 << 31) | (1 << 30) | pipe << 29 | (y1 << 16) | y2;
-
 
750
	b[6] = MI_WAIT_FOR_EVENT | event;
-
 
751
	b[7] = MI_LOAD_REGISTER_IMM | 1;
-
 
752
	b[8] = 0x44050; /* DERRMR */
-
 
753
	b[9] = ~0;
-
 
754
 
-
 
755
	sna->kgem.batch_flags |= I915_EXEC_SECURE;
-
 
756
 
-
 
757
	return true;
-
 
758
}
-
 
759
 
-
 
760
bool
-
 
761
sna_wait_for_scanline(struct sna *sna,
-
 
762
		      rect_t *crtc,
-
 
763
		      rect_t *clip)
-
 
764
{
-
 
765
	bool full_height;
-
 
766
	int y1, y2, pipe;
-
 
767
	bool ret;
-
 
768
 
-
 
769
//	if (sna->flags & SNA_NO_VSYNC)
-
 
770
//		return false;
-
 
771
 
-
 
772
	/*
-
 
773
	 * Make sure we don't wait for a scanline that will
-
 
774
	 * never occur
-
 
775
	 */
-
 
776
	y1 = clip->t - crtc->t;
-
 
777
	if (y1 < 0)
-
 
778
		y1 = 0;
-
 
779
	y2 = clip->b - crtc->t;
-
 
780
	if (y2 > crtc->b - crtc->t)
-
 
781
		y2 = crtc->b - crtc->t;
-
 
782
//	DBG(("%s: clipped range = %d, %d\n", __FUNCTION__, y1, y2));
-
 
783
//	printf("%s: clipped range = %d, %d\n", __FUNCTION__, y1, y2);
-
 
784
 
-
 
785
	if (y2 <= y1 + 4)
-
 
786
		return false;
-
 
787
 
-
 
788
	full_height = y1 == 0 && y2 == crtc->b - crtc->t;
-
 
789
 
-
 
790
	pipe = 0;
-
 
791
	DBG(("%s: pipe=%d, y1=%d, y2=%d, full_height?=%d\n",
-
 
792
	     __FUNCTION__, pipe, y1, y2, full_height));
-
 
793
 
-
 
794
	if (sna->kgem.gen >= 0100)
-
 
795
		ret = false;
-
 
796
//	else if (sna->kgem.gen >= 075)
-
 
797
//		ret = sna_emit_wait_for_scanline_hsw(sna, crtc, pipe, y1, y2, full_height);
-
 
798
//	else if (sna->kgem.gen >= 070)
-
 
799
//		ret = sna_emit_wait_for_scanline_ivb(sna, crtc, pipe, y1, y2, full_height);
-
 
800
	else if (sna->kgem.gen >= 060)
-
 
801
		ret =sna_emit_wait_for_scanline_gen6(sna, crtc, pipe, y1, y2, full_height);
-
 
802
//	else if (sna->kgem.gen >= 040)
-
 
803
//		ret = sna_emit_wait_for_scanline_gen4(sna, crtc, pipe, y1, y2, full_height);
-
 
804
 
-
 
805
	return ret;
-
 
806
}
Line 699... Line 807...
699
 
807
 
700
 
808
 
701
bool
809
bool
702
gen6_composite(struct sna *sna,
810
gen6_composite(struct sna *sna,
Line 784... Line 892...
784
 
892
 
Line 785... Line 893...
785
    src_bo = sf->bo;
893
    src_bo = sf->bo;
Line -... Line 894...
-
 
894
 
-
 
895
    __lock_acquire_recursive(__sna_lock);
-
 
896
 
-
 
897
    {
-
 
898
        rect_t crtc, clip;
-
 
899
 
-
 
900
        crtc.l = 0;
-
 
901
        crtc.t = 0;
-
 
902
        crtc.r = sna_fb.width-1;
-
 
903
        crtc.b = sna_fb.height-1;
-
 
904
 
-
 
905
        clip.l = winx+dst_x;
-
 
906
        clip.t = winy+dst_y;
-
 
907
        clip.r = clip.l+w-1;
-
 
908
        clip.b = clip.t+h-1;
-
 
909
 
Line 786... Line 910...
786
 
910
        kgem_set_mode(&sna_device->kgem, KGEM_RENDER, sna_fb.fb_bo);
787
    __lock_acquire_recursive(__sna_lock);
911
        sna_wait_for_scanline(sna_device, &crtc, &clip);
788
 
912
    }
789
 
913