Subversion Repositories Kolibri OS

Rev

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

Rev 4398 Rev 4539
Line 911... Line 911...
911
        };
911
        };
912
        safe_sti(ifl);
912
        safe_sti(ifl);
913
 
913
 
Line 914... Line 914...
914
        ret = i915_gem_object_set_to_gtt_domain(to_intel_bo(obj), false);
914
        ret = i915_gem_object_set_to_gtt_domain(to_intel_bo(obj), false);
-
 
915
    }
-
 
916
 
-
 
917
err2:
-
 
918
    mutex_unlock(&dev->struct_mutex);
-
 
919
err1:
-
 
920
    drm_gem_object_unreference(obj);
-
 
921
 
-
 
922
    return ret;
-
 
923
}
-
 
924
 
-
 
925
int i915_mask_update_ex(struct drm_device *dev, void *data,
-
 
926
            struct drm_file *file)
-
 
927
{
-
 
928
    struct drm_i915_mask_update *mask = data;
-
 
929
    struct drm_gem_object *obj;
-
 
930
    static unsigned int mask_seqno[256];
-
 
931
    static warn_count;
-
 
932
 
-
 
933
    rect_t win;
-
 
934
    u32    winw,winh;
-
 
935
    u32    ml,mt,mr,mb;
-
 
936
    u32    slot;
-
 
937
    int    ret = 0;
-
 
938
    slot = *((u8*)CURRENT_TASK);
-
 
939
 
-
 
940
    if( mask_seqno[slot] == os_display->mask_seqno)
-
 
941
        return 0;
-
 
942
 
-
 
943
    GetWindowRect(&win);
-
 
944
    win.right+= 1;
-
 
945
    win.bottom+=  1;
-
 
946
 
-
 
947
    winw = win.right - win.left;
-
 
948
    winh = win.bottom - win.top;
-
 
949
 
-
 
950
    if(mask->dx >= winw ||
-
 
951
       mask->dy >= winh)
-
 
952
       return 1;
-
 
953
 
-
 
954
    ml = win.left + mask->dx;
-
 
955
    mt = win.top  + mask->dy;
-
 
956
    mr = ml + mask->width;
-
 
957
    mb = mt + mask->height;
-
 
958
 
-
 
959
    if( ml >= win.right || mt >= win.bottom ||
-
 
960
        mr < win.left   || mb < win.top )
-
 
961
        return 1;
-
 
962
 
-
 
963
    if( mr > win.right )
-
 
964
        mr = win.right;
-
 
965
 
-
 
966
    if( mb > win.bottom )
-
 
967
        mb = win.bottom;
-
 
968
 
-
 
969
    mask->width  = mr - ml;
-
 
970
    mask->height = mb - mt;
-
 
971
 
-
 
972
    if( mask->width == 0 ||
-
 
973
        mask->height== 0 )
-
 
974
        return 1;
-
 
975
 
-
 
976
    obj = drm_gem_object_lookup(dev, file, mask->handle);
-
 
977
    if (obj == NULL)
-
 
978
        return -ENOENT;
-
 
979
 
-
 
980
    if (!obj->filp) {
-
 
981
        drm_gem_object_unreference_unlocked(obj);
-
 
982
        return -EINVAL;
-
 
983
    }
-
 
984
 
-
 
985
#if 1
-
 
986
    if(warn_count < 1000)
-
 
987
    {
-
 
988
        printf("left %d top %d right %d bottom %d\n",
-
 
989
                ml, mt, mr, mb);
-
 
990
        warn_count++;
-
 
991
    };
-
 
992
#endif
-
 
993
 
-
 
994
 
-
 
995
#if 1
-
 
996
 
-
 
997
    {
-
 
998
        u8* src_offset;
-
 
999
        u8* dst_offset;
-
 
1000
        u32 ifl;
-
 
1001
 
-
 
1002
        ret = i915_mutex_lock_interruptible(dev);
915
        if(ret != 0 )
1003
        if (ret)
-
 
1004
            goto err1;
-
 
1005
 
-
 
1006
        i915_gem_object_set_to_cpu_domain(to_intel_bo(obj), true);
-
 
1007
 
-
 
1008
        src_offset = (u8*)( mt*os_display->width + ml);
-
 
1009
        src_offset+= get_display_map();
-
 
1010
        dst_offset = (u8*)mask->bo_map;
-
 
1011
 
-
 
1012
        u32_t tmp_h = mask->height;
-
 
1013
 
-
 
1014
        ifl = safe_cli();
916
        {
1015
        {
-
 
1016
            mask_seqno[slot] = os_display->mask_seqno;
-
 
1017
 
-
 
1018
            slot|= (slot<<8)|(slot<<16)|(slot<<24);
-
 
1019
 
-
 
1020
            __asm__ __volatile__ (
-
 
1021
            "movd       %[slot],   %%xmm6         \n"
-
 
1022
            "punpckldq  %%xmm6, %%xmm6            \n"
-
 
1023
            "punpcklqdq %%xmm6, %%xmm6            \n"
-
 
1024
            :: [slot]  "m" (slot)
-
 
1025
            :"xmm6");
-
 
1026
 
-
 
1027
            while( tmp_h--)
-
 
1028
            {
-
 
1029
                int tmp_w = mask->width;
-
 
1030
 
-
 
1031
                u8* tmp_src = src_offset;
-
 
1032
                u8* tmp_dst = dst_offset;
-
 
1033
 
-
 
1034
                src_offset+= os_display->width;
-
 
1035
                dst_offset+= mask->bo_pitch;
-
 
1036
 
-
 
1037
                while(tmp_w >= 64)
-
 
1038
                {
-
 
1039
                    __asm__ __volatile__ (
-
 
1040
                    "movdqu     (%0),   %%xmm0            \n"
-
 
1041
                    "movdqu   16(%0),   %%xmm1            \n"
-
 
1042
                    "movdqu   32(%0),   %%xmm2            \n"
-
 
1043
                    "movdqu   48(%0),   %%xmm3            \n"
-
 
1044
                    "pcmpeqb    %%xmm6, %%xmm0            \n"
-
 
1045
                    "pcmpeqb    %%xmm6, %%xmm1            \n"
-
 
1046
                    "pcmpeqb    %%xmm6, %%xmm2            \n"
-
 
1047
                    "pcmpeqb    %%xmm6, %%xmm3            \n"
-
 
1048
                    "movdqa     %%xmm0,   (%%edi)         \n"
-
 
1049
                    "movdqa     %%xmm1, 16(%%edi)         \n"
-
 
1050
                    "movdqa     %%xmm2, 32(%%edi)         \n"
-
 
1051
                    "movdqa     %%xmm3, 48(%%edi)         \n"
-
 
1052
 
-
 
1053
                    :: "r" (tmp_src), "D" (tmp_dst)
-
 
1054
                    :"xmm0","xmm1","xmm2","xmm3");
-
 
1055
                    tmp_w -= 64;
-
 
1056
                    tmp_src += 64;
-
 
1057
                    tmp_dst += 64;
-
 
1058
                }
-
 
1059
 
-
 
1060
                if( tmp_w >= 32 )
-
 
1061
                {
-
 
1062
                    __asm__ __volatile__ (
-
 
1063
                    "movdqu     (%0),   %%xmm0            \n"
-
 
1064
                    "movdqu   16(%0),   %%xmm1            \n"
-
 
1065
                    "pcmpeqb    %%xmm6, %%xmm0            \n"
-
 
1066
                    "pcmpeqb    %%xmm6, %%xmm1            \n"
-
 
1067
                    "movdqa     %%xmm0,   (%%edi)         \n"
-
 
1068
                    "movdqa     %%xmm1, 16(%%edi)         \n"
-
 
1069
 
-
 
1070
                    :: "r" (tmp_src), "D" (tmp_dst)
-
 
1071
                    :"xmm0","xmm1");
-
 
1072
                    tmp_w -= 32;
-
 
1073
                    tmp_src += 32;
-
 
1074
                    tmp_dst += 32;
-
 
1075
                }
-
 
1076
 
-
 
1077
                if( tmp_w >= 16 )
-
 
1078
                {
-
 
1079
                    __asm__ __volatile__ (
-
 
1080
                    "movdqu     (%0),   %%xmm0            \n"
-
 
1081
                    "pcmpeqb    %%xmm6, %%xmm0            \n"
-
 
1082
                    "movdqa     %%xmm0,   (%%edi)         \n"
-
 
1083
                    :: "r" (tmp_src), "D" (tmp_dst)
-
 
1084
                    :"xmm0");
-
 
1085
                    tmp_w -= 16;
-
 
1086
                    tmp_src += 16;
-
 
1087
                    tmp_dst += 16;
-
 
1088
                }
-
 
1089
 
-
 
1090
                if( tmp_w >= 8 )
-
 
1091
                {
-
 
1092
                    __asm__ __volatile__ (
-
 
1093
                    "movq       (%0),   %%xmm0            \n"
-
 
1094
                    "pcmpeqb    %%xmm6, %%xmm0            \n"
-
 
1095
                    "movq       %%xmm0,   (%%edi)         \n"
-
 
1096
                    :: "r" (tmp_src), "D" (tmp_dst)
-
 
1097
                    :"xmm0");
-
 
1098
                    tmp_w -= 8;
-
 
1099
                    tmp_src += 8;
-
 
1100
                    tmp_dst += 8;
-
 
1101
                }
-
 
1102
                if( tmp_w >= 4 )
-
 
1103
        {
-
 
1104
                    __asm__ __volatile__ (
-
 
1105
                    "movd       (%0),   %%xmm0            \n"
-
 
1106
                    "pcmpeqb    %%xmm6, %%xmm0            \n"
-
 
1107
                    "movd       %%xmm0,   (%%edi)         \n"
-
 
1108
                    :: "r" (tmp_src), "D" (tmp_dst)
-
 
1109
                    :"xmm0");
-
 
1110
                    tmp_w -= 4;
-
 
1111
                    tmp_src += 4;
-
 
1112
                    tmp_dst += 4;
-
 
1113
                }
-
 
1114
                while(tmp_w--)
917
            dbgprintf("%s: i915_gem_object_set_to_gtt_domain failed\n", __FUNCTION__);
1115
                    *tmp_dst++ = (*tmp_src++ == (u8)slot) ? 0xFF:0x00;
-
 
1116
            };
918
        };
1117
        };
-
 
1118
        safe_sti(ifl);
-
 
1119
 
-
 
1120
        i915_gem_object_set_to_gtt_domain(to_intel_bo(obj), false);
919
    }
1121
    }
-
 
1122
#endif
Line 920... Line 1123...
920
 
1123
 
921
err2:
1124
err2:
922
    mutex_unlock(&dev->struct_mutex);
1125
    mutex_unlock(&dev->struct_mutex);
923
err1:
1126
err1:
Line 929... Line -...
929
 
-