diff options
author | Loren Huang <b02279@freescale.com> | 2014-04-15 04:49:16 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:58:21 -0400 |
commit | 1fc33c819ab3bea79f0faf75e6daf9583ca9beec (patch) | |
tree | c9137b862eb91e6273eac705251a62c3ddd3eda1 | |
parent | 753b8b8761404ae98eb0c76734bf512c17311a70 (diff) |
ENGR00308456-1 gpu:viante 5.0.11 kernel part integration
Integrated 5.0.11 kernel part change.
Signed-off-by: Loren HUANG <b02279@freescale.com>
Acked-by: Shawn Guo
50 files changed, 5196 insertions, 2978 deletions
diff --git a/drivers/mxc/gpu-viv/Kbuild b/drivers/mxc/gpu-viv/Kbuild index 6dee194661f0..15da76a25d29 100644 --- a/drivers/mxc/gpu-viv/Kbuild +++ b/drivers/mxc/gpu-viv/Kbuild | |||
@@ -34,6 +34,8 @@ ARCH_KERNEL_DIR := hal/kernel/arch | |||
34 | ARCH_VG_KERNEL_DIR := hal/kernel/archvg | 34 | ARCH_VG_KERNEL_DIR := hal/kernel/archvg |
35 | HAL_KERNEL_DIR := hal/kernel | 35 | HAL_KERNEL_DIR := hal/kernel |
36 | 36 | ||
37 | CUSTOMER_ALLOCATOR_OBJS := | ||
38 | |||
37 | EXTRA_CFLAGS += -Werror | 39 | EXTRA_CFLAGS += -Werror |
38 | 40 | ||
39 | OBJS := $(OS_KERNEL_DIR)/gc_hal_kernel_device.o \ | 41 | OBJS := $(OS_KERNEL_DIR)/gc_hal_kernel_device.o \ |
@@ -41,7 +43,8 @@ OBJS := $(OS_KERNEL_DIR)/gc_hal_kernel_device.o \ | |||
41 | $(OS_KERNEL_DIR)/gc_hal_kernel_linux.o \ | 43 | $(OS_KERNEL_DIR)/gc_hal_kernel_linux.o \ |
42 | $(OS_KERNEL_DIR)/gc_hal_kernel_math.o \ | 44 | $(OS_KERNEL_DIR)/gc_hal_kernel_math.o \ |
43 | $(OS_KERNEL_DIR)/gc_hal_kernel_os.o \ | 45 | $(OS_KERNEL_DIR)/gc_hal_kernel_os.o \ |
44 | $(OS_KERNEL_DIR)/gc_hal_kernel_debugfs.o | 46 | $(OS_KERNEL_DIR)/gc_hal_kernel_debugfs.o \ |
47 | $(OS_KERNEL_DIR)/gc_hal_kernel_allocator.o \ | ||
45 | 48 | ||
46 | 49 | ||
47 | OBJS += $(HAL_KERNEL_DIR)/gc_hal_kernel.o \ | 50 | OBJS += $(HAL_KERNEL_DIR)/gc_hal_kernel.o \ |
@@ -71,6 +74,11 @@ ifneq ($(CONFIG_SYNC),) | |||
71 | OBJS += $(OS_KERNEL_DIR)/gc_hal_kernel_sync.o | 74 | OBJS += $(OS_KERNEL_DIR)/gc_hal_kernel_sync.o |
72 | endif | 75 | endif |
73 | 76 | ||
77 | |||
78 | ifneq ($(CUSTOMER_ALLOCATOR_OBJS),) | ||
79 | OBJS += $(CUSTOMER_ALLOCATOR_OBJS) | ||
80 | endif | ||
81 | |||
74 | ifeq ($(KERNELRELEASE), ) | 82 | ifeq ($(KERNELRELEASE), ) |
75 | 83 | ||
76 | .PHONY: all clean install | 84 | .PHONY: all clean install |
@@ -92,12 +100,6 @@ else | |||
92 | 100 | ||
93 | EXTRA_CFLAGS += -DLINUX -DDRIVER | 101 | EXTRA_CFLAGS += -DLINUX -DDRIVER |
94 | 102 | ||
95 | ifeq ($(ENUM_WORKAROUND), 1) | ||
96 | EXTRA_CFLAGS += -DENUM_WORKAROUND=1 | ||
97 | else | ||
98 | EXTRA_CFLAGS += -DENUM_WORKAROUND=0 | ||
99 | endif | ||
100 | |||
101 | ifeq ($(FLAREON),1) | 103 | ifeq ($(FLAREON),1) |
102 | EXTRA_CFLAGS += -DFLAREON | 104 | EXTRA_CFLAGS += -DFLAREON |
103 | endif | 105 | endif |
@@ -209,6 +211,7 @@ else | |||
209 | EXTRA_CFLAGS += -DgcdFPGA_BUILD=0 | 211 | EXTRA_CFLAGS += -DgcdFPGA_BUILD=0 |
210 | endif | 212 | endif |
211 | 213 | ||
214 | |||
212 | EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel/inc | 215 | EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel/inc |
213 | EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel | 216 | EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel |
214 | EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel/arch | 217 | EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel/arch |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.c b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.c index 9371ccf32578..d0deb3b47918 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.c +++ b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.c | |||
@@ -142,14 +142,14 @@ | |||
142 | (((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x03 | 0xC0FFEE & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)))) | 142 | (((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x03 | 0xC0FFEE & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27)))) |
143 | 143 | ||
144 | #if !defined(VIVANTE_NO_3D) | 144 | #if !defined(VIVANTE_NO_3D) |
145 | static gctSIZE_T | 145 | static gctUINT32 |
146 | _TerminateStateBlock( | 146 | _TerminateStateBlock( |
147 | IN gckCONTEXT Context, | 147 | IN gckCONTEXT Context, |
148 | IN gctSIZE_T Index | 148 | IN gctUINT32 Index |
149 | ) | 149 | ) |
150 | { | 150 | { |
151 | gctUINT32_PTR buffer; | 151 | gctUINT32_PTR buffer; |
152 | gctSIZE_T align; | 152 | gctUINT32 align; |
153 | 153 | ||
154 | /* Determine if we need alignment. */ | 154 | /* Determine if we need alignment. */ |
155 | align = (Index & 1) ? 1 : 0; | 155 | align = (Index & 1) ? 1 : 0; |
@@ -175,15 +175,15 @@ _TerminateStateBlock( | |||
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | 177 | ||
178 | static gctSIZE_T | 178 | static gctUINT32 |
179 | _FlushPipe( | 179 | _FlushPipe( |
180 | IN gckCONTEXT Context, | 180 | IN gckCONTEXT Context, |
181 | IN gctSIZE_T Index, | 181 | IN gctUINT32 Index, |
182 | IN gcePIPE_SELECT Pipe | 182 | IN gcePIPE_SELECT Pipe |
183 | ) | 183 | ) |
184 | { | 184 | { |
185 | gctBOOL fcFlushStall; | 185 | gctBOOL fcFlushStall; |
186 | gctSIZE_T flushSlots; | 186 | gctUINT32 flushSlots; |
187 | 187 | ||
188 | fcFlushStall | 188 | fcFlushStall |
189 | = gckHARDWARE_IsFeatureAvailable(Context->hardware, gcvFEATURE_FC_FLUSH_STALL); | 189 | = gckHARDWARE_IsFeatureAvailable(Context->hardware, gcvFEATURE_FC_FLUSH_STALL); |
@@ -245,10 +245,10 @@ _FlushPipe( | |||
245 | } | 245 | } |
246 | 246 | ||
247 | #if !defined(VIVANTE_NO_3D) | 247 | #if !defined(VIVANTE_NO_3D) |
248 | static gctSIZE_T | 248 | static gctUINT32 |
249 | _SemaphoreStall( | 249 | _SemaphoreStall( |
250 | IN gckCONTEXT Context, | 250 | IN gckCONTEXT Context, |
251 | IN gctSIZE_T Index | 251 | IN gctUINT32 Index |
252 | ) | 252 | ) |
253 | { | 253 | { |
254 | if (Context->buffer != gcvNULL) | 254 | if (Context->buffer != gcvNULL) |
@@ -282,10 +282,10 @@ _SemaphoreStall( | |||
282 | } | 282 | } |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | static gctSIZE_T | 285 | static gctUINT32 |
286 | _SwitchPipe( | 286 | _SwitchPipe( |
287 | IN gckCONTEXT Context, | 287 | IN gckCONTEXT Context, |
288 | IN gctSIZE_T Index, | 288 | IN gctUINT32 Index, |
289 | IN gcePIPE_SELECT Pipe | 289 | IN gcePIPE_SELECT Pipe |
290 | ) | 290 | ) |
291 | { | 291 | { |
@@ -312,19 +312,20 @@ _SwitchPipe( | |||
312 | } | 312 | } |
313 | 313 | ||
314 | #if !defined(VIVANTE_NO_3D) | 314 | #if !defined(VIVANTE_NO_3D) |
315 | static gctSIZE_T | 315 | static gctUINT32 |
316 | _State( | 316 | _State( |
317 | IN gckCONTEXT Context, | 317 | IN gckCONTEXT Context, |
318 | IN gctSIZE_T Index, | 318 | IN gctUINT32 Index, |
319 | IN gctUINT32 Address, | 319 | IN gctUINT32 Address, |
320 | IN gctUINT32 Value, | 320 | IN gctUINT32 Value, |
321 | IN gctSIZE_T Size, | 321 | IN gctUINT32 Size, |
322 | IN gctBOOL FixedPoint, | 322 | IN gctBOOL FixedPoint, |
323 | IN gctBOOL Hinted | 323 | IN gctBOOL Hinted |
324 | ) | 324 | ) |
325 | { | 325 | { |
326 | gctUINT32_PTR buffer; | 326 | gctUINT32_PTR buffer; |
327 | gctSIZE_T align, i; | 327 | gctUINT32 align; |
328 | gctUINT32 i; | ||
328 | 329 | ||
329 | /* Determine if we need alignment. */ | 330 | /* Determine if we need alignment. */ |
330 | align = (Index & 1) ? 1 : 0; | 331 | align = (Index & 1) ? 1 : 0; |
@@ -372,13 +373,13 @@ _State( | |||
372 | } | 373 | } |
373 | 374 | ||
374 | /* Walk all the states. */ | 375 | /* Walk all the states. */ |
375 | for (i = 0; i < Size; i += 1) | 376 | for (i = 0; i < (gctUINT32)Size; i += 1) |
376 | { | 377 | { |
377 | /* Set state to uninitialized value. */ | 378 | /* Set state to uninitialized value. */ |
378 | buffer[Index + 1 + i] = Value; | 379 | buffer[Index + 1 + i] = Value; |
379 | 380 | ||
380 | /* Set index in state mapping table. */ | 381 | /* Set index in state mapping table. */ |
381 | Context->map[Address + i].index = Index + 1 + i; | 382 | Context->map[Address + i].index = (gctUINT)Index + 1 + i; |
382 | 383 | ||
383 | #if gcdSECURE_USER | 384 | #if gcdSECURE_USER |
384 | /* Save hint. */ | 385 | /* Save hint. */ |
@@ -391,8 +392,8 @@ _State( | |||
391 | } | 392 | } |
392 | 393 | ||
393 | /* Save information for this LoadState. */ | 394 | /* Save information for this LoadState. */ |
394 | Context->lastIndex = Index; | 395 | Context->lastIndex = (gctUINT)Index; |
395 | Context->lastAddress = Address + Size; | 396 | Context->lastAddress = Address + (gctUINT32)Size; |
396 | Context->lastSize = Size; | 397 | Context->lastSize = Size; |
397 | Context->lastFixed = FixedPoint; | 398 | Context->lastFixed = FixedPoint; |
398 | 399 | ||
@@ -408,13 +409,13 @@ _State( | |||
408 | ((((gctUINT32) (buffer[Context->lastIndex])) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (Context->lastSize + Size) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); | 409 | ((((gctUINT32) (buffer[Context->lastIndex])) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (Context->lastSize + Size) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); |
409 | 410 | ||
410 | /* Walk all the states. */ | 411 | /* Walk all the states. */ |
411 | for (i = 0; i < Size; i += 1) | 412 | for (i = 0; i < (gctUINT32)Size; i += 1) |
412 | { | 413 | { |
413 | /* Set state to uninitialized value. */ | 414 | /* Set state to uninitialized value. */ |
414 | buffer[Index + i] = Value; | 415 | buffer[Index + i] = Value; |
415 | 416 | ||
416 | /* Set index in state mapping table. */ | 417 | /* Set index in state mapping table. */ |
417 | Context->map[Address + i].index = Index + i; | 418 | Context->map[Address + i].index = (gctUINT)Index + i; |
418 | 419 | ||
419 | #if gcdSECURE_USER | 420 | #if gcdSECURE_USER |
420 | /* Save hint. */ | 421 | /* Save hint. */ |
@@ -427,22 +428,22 @@ _State( | |||
427 | } | 428 | } |
428 | 429 | ||
429 | /* Update last address and size. */ | 430 | /* Update last address and size. */ |
430 | Context->lastAddress += Size; | 431 | Context->lastAddress += (gctUINT32)Size; |
431 | Context->lastSize += Size; | 432 | Context->lastSize += Size; |
432 | 433 | ||
433 | /* Return number of slots required. */ | 434 | /* Return number of slots required. */ |
434 | return Size; | 435 | return Size; |
435 | } | 436 | } |
436 | 437 | ||
437 | static gctSIZE_T | 438 | static gctUINT32 |
438 | _StateMirror( | 439 | _StateMirror( |
439 | IN gckCONTEXT Context, | 440 | IN gckCONTEXT Context, |
440 | IN gctUINT32 Address, | 441 | IN gctUINT32 Address, |
441 | IN gctSIZE_T Size, | 442 | IN gctUINT32 Size, |
442 | IN gctUINT32 AddressMirror | 443 | IN gctUINT32 AddressMirror |
443 | ) | 444 | ) |
444 | { | 445 | { |
445 | gctSIZE_T i; | 446 | gctUINT32 i; |
446 | 447 | ||
447 | /* Process when buffer is set. */ | 448 | /* Process when buffer is set. */ |
448 | if (Context->buffer != gcvNULL) | 449 | if (Context->buffer != gcvNULL) |
@@ -467,13 +468,13 @@ _InitializeContextBuffer( | |||
467 | ) | 468 | ) |
468 | { | 469 | { |
469 | gctUINT32_PTR buffer; | 470 | gctUINT32_PTR buffer; |
470 | gctSIZE_T index; | 471 | gctUINT32 index; |
471 | 472 | ||
472 | #if !defined(VIVANTE_NO_3D) | 473 | #if !defined(VIVANTE_NO_3D) |
473 | gctBOOL halti0, halti1, halti2, halti3; | 474 | gctBOOL halti0, halti1, halti2, halti3; |
474 | gctUINT i; | 475 | gctUINT i; |
475 | gctUINT vertexUniforms, fragmentUniforms; | 476 | gctUINT vertexUniforms, fragmentUniforms, unifiedConst, vsConstBase, psConstBase, constMax; |
476 | gctBOOL unifiedUnforms; | 477 | gctBOOL unifiedUniform; |
477 | gctUINT fe2vsCount; | 478 | gctUINT fe2vsCount; |
478 | #endif | 479 | #endif |
479 | 480 | ||
@@ -502,12 +503,20 @@ _InitializeContextBuffer( | |||
502 | halti2 = (((((gctUINT32) (Context->hardware->identity.chipMinorFeatures4)) >> (0 ? 16:16)) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))) ); | 503 | halti2 = (((((gctUINT32) (Context->hardware->identity.chipMinorFeatures4)) >> (0 ? 16:16)) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))) ); |
503 | halti3 = (((((gctUINT32) (Context->hardware->identity.chipMinorFeatures5)) >> (0 ? 9:9)) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1)))))) ); | 504 | halti3 = (((((gctUINT32) (Context->hardware->identity.chipMinorFeatures5)) >> (0 ? 9:9)) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1)))))) ); |
504 | 505 | ||
505 | /* Query shader support. */ | 506 | /* Query how many uniforms can support for non-unified uniform mode. */ |
506 | gcmkVERIFY_OK(gckHARDWARE_QueryShaderCaps( | 507 | { if (Context->hardware->identity.chipModel == gcv2000 && Context->hardware->identity.chipRevision == 0x5118) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vertexUniforms = 256; fragmentUniforms = 64; constMax = 320; } else if (Context->hardware->identity.numConstants == 320) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vertexUniforms = 256; fragmentUniforms = 64; constMax = 320; } else if (Context->hardware->identity.numConstants > 256 && Context->hardware->identity.chipModel == gcv1000) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vertexUniforms = 256; fragmentUniforms = 64; constMax = 320; } else if (Context->hardware->identity.numConstants > 256) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vertexUniforms = 256; fragmentUniforms = 256; constMax = 512; } else if (Context->hardware->identity.numConstants == 256) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vertexUniforms = 256; fragmentUniforms = 256; constMax = 512; } else { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vertexUniforms = 168; fragmentUniforms = 64; constMax = 232; }}; |
507 | Context->hardware, &vertexUniforms, &fragmentUniforms, &unifiedUnforms)); | 508 | |
509 | if (Context->hardware->identity.numConstants > 256) | ||
510 | { | ||
511 | unifiedUniform = gcvTRUE; | ||
512 | } | ||
513 | else | ||
514 | { | ||
515 | unifiedUniform = gcvFALSE; | ||
516 | } | ||
508 | 517 | ||
509 | /* Store the 3D entry index. */ | 518 | /* Store the 3D entry index. */ |
510 | Context->entryOffset3D = index * gcmSIZEOF(gctUINT32); | 519 | Context->entryOffset3D = (gctUINT)index * gcmSIZEOF(gctUINT32); |
511 | 520 | ||
512 | /* Flush 2D pipe. */ | 521 | /* Flush 2D pipe. */ |
513 | index += _FlushPipe(Context, index, gcvPIPE_2D); | 522 | index += _FlushPipe(Context, index, gcvPIPE_2D); |
@@ -583,11 +592,6 @@ _InitializeContextBuffer( | |||
583 | 592 | ||
584 | index += _CLOSE_RANGE(); | 593 | index += _CLOSE_RANGE(); |
585 | 594 | ||
586 | if (! unifiedUnforms) | ||
587 | { | ||
588 | index += _State(Context, index, 0x05000 >> 2, 0x00000000, vertexUniforms * 4, gcvFALSE, gcvFALSE); | ||
589 | } | ||
590 | |||
591 | /* Primitive Assembly states. */ | 595 | /* Primitive Assembly states. */ |
592 | index += _State(Context, index, 0x00A00 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); | 596 | index += _State(Context, index, 0x00A00 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); |
593 | index += _State(Context, index, 0x00A04 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); | 597 | index += _State(Context, index, 0x00A04 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); |
@@ -609,6 +613,11 @@ _InitializeContextBuffer( | |||
609 | index += _State(Context, index, 0x00A8C >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | 613 | index += _State(Context, index, 0x00A8C >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); |
610 | index += _State(Context, index, 0x00A88 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | 614 | index += _State(Context, index, 0x00A88 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); |
611 | 615 | ||
616 | #if gcdMULTI_GPU | ||
617 | index += _State(Context, index, 0x03A00 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | ||
618 | index += _State(Context, index, 0x03A04 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | ||
619 | index += _State(Context, index, 0x03A08 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | ||
620 | #endif | ||
612 | /* Setup states. */ | 621 | /* Setup states. */ |
613 | index += _State(Context, index, 0x00C00 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); | 622 | index += _State(Context, index, 0x00C00 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); |
614 | index += _State(Context, index, 0x00C04 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); | 623 | index += _State(Context, index, 0x00C04 >> 2, 0x00000000, 1, gcvTRUE, gcvFALSE); |
@@ -651,11 +660,6 @@ _InitializeContextBuffer( | |||
651 | 660 | ||
652 | index += _CLOSE_RANGE(); | 661 | index += _CLOSE_RANGE(); |
653 | 662 | ||
654 | if (! unifiedUnforms) | ||
655 | { | ||
656 | index += _State(Context, index, 0x07000 >> 2, 0x00000000, fragmentUniforms * 4, gcvFALSE, gcvFALSE); | ||
657 | } | ||
658 | |||
659 | /* Texture states. */ | 663 | /* Texture states. */ |
660 | index += _State(Context, index, 0x02000 >> 2, 0x00000000, 12, gcvFALSE, gcvFALSE); | 664 | index += _State(Context, index, 0x02000 >> 2, 0x00000000, 12, gcvFALSE, gcvFALSE); |
661 | index += _State(Context, index, 0x02040 >> 2, 0x00000000, 12, gcvFALSE, gcvFALSE); | 665 | index += _State(Context, index, 0x02040 >> 2, 0x00000000, 12, gcvFALSE, gcvFALSE); |
@@ -739,6 +743,11 @@ _InitializeContextBuffer( | |||
739 | index += _State(Context, index, 0x10700 >> 2, 0x00000F00, 32, gcvFALSE, gcvFALSE); | 743 | index += _State(Context, index, 0x10700 >> 2, 0x00000F00, 32, gcvFALSE, gcvFALSE); |
740 | } | 744 | } |
741 | 745 | ||
746 | if (halti3) | ||
747 | { | ||
748 | index += _State(Context, index, 0x10780 >> 2, 0x00030000, 32, gcvFALSE, gcvFALSE); | ||
749 | } | ||
750 | |||
742 | /* ASTC */ | 751 | /* ASTC */ |
743 | if ((((((gctUINT32) (Context->hardware->identity.chipMinorFeatures4)) >> (0 ? 13:13)) & ((gctUINT32) ((((1 ? 13:13) - (0 ? 13:13) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 13:13) - (0 ? 13:13) + 1)))))) )) | 752 | if ((((((gctUINT32) (Context->hardware->identity.chipMinorFeatures4)) >> (0 ? 13:13)) & ((gctUINT32) ((((1 ? 13:13) - (0 ? 13:13) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 13:13) - (0 ? 13:13) + 1)))))) )) |
744 | { | 753 | { |
@@ -836,25 +845,37 @@ _InitializeContextBuffer( | |||
836 | _StateMirror(Context, 0x08000 >> 2, Context->hardware->identity.instructionCount << 2 , 0x0C000 >> 2); | 845 | _StateMirror(Context, 0x08000 >> 2, Context->hardware->identity.instructionCount << 2 , 0x0C000 >> 2); |
837 | } | 846 | } |
838 | 847 | ||
839 | if (unifiedUnforms) | 848 | if (unifiedUniform) |
840 | { | 849 | { |
850 | gctINT numConstants = Context->hardware->identity.numConstants; | ||
851 | |||
841 | index += _State(Context, index, 0x01024 >> 2, 0x00000100, 1, gcvFALSE, gcvFALSE); | 852 | index += _State(Context, index, 0x01024 >> 2, 0x00000100, 1, gcvFALSE, gcvFALSE); |
842 | index += _State(Context, index, 0x00864 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | 853 | index += _State(Context, index, 0x00864 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); |
843 | index += _CLOSE_RANGE(); | 854 | index += _CLOSE_RANGE(); |
844 | 855 | ||
845 | for (i = 0; | 856 | for (i = 0; |
846 | i < Context->hardware->identity.numConstants << 2; | 857 | numConstants > 0; |
847 | i += 256 << 2 | 858 | i += 256 << 2, |
859 | numConstants -= 256 | ||
848 | ) | 860 | ) |
849 | { | 861 | { |
850 | index += _State(Context, index, (0x30000 >> 2) + i, 0x00000000, 256 << 2, gcvFALSE, gcvFALSE); | 862 | if (numConstants >= 256) |
863 | { | ||
864 | index += _State(Context, index, (0x30000 >> 2) + i, 0x00000000, 256 << 2, gcvFALSE, gcvFALSE); | ||
865 | } | ||
866 | else | ||
867 | { | ||
868 | index += _State(Context, index, (0x30000 >> 2) + i, 0x00000000, numConstants << 2, gcvFALSE, gcvFALSE); | ||
869 | } | ||
851 | index += _CLOSE_RANGE(); | 870 | index += _CLOSE_RANGE(); |
852 | } | 871 | } |
853 | index += _CLOSE_RANGE(); | ||
854 | } | 872 | } |
855 | 873 | ||
874 | index += _State(Context, index, 0x05000 >> 2, 0x00000000, vertexUniforms * 4, gcvFALSE, gcvFALSE); | ||
875 | index += _State(Context, index, 0x07000 >> 2, 0x00000000, fragmentUniforms * 4, gcvFALSE, gcvFALSE); | ||
876 | |||
856 | /* Store the index of the "XD" entry. */ | 877 | /* Store the index of the "XD" entry. */ |
857 | Context->entryOffsetXDFrom3D = index * gcmSIZEOF(gctUINT32); | 878 | Context->entryOffsetXDFrom3D = (gctUINT)index * gcmSIZEOF(gctUINT32); |
858 | 879 | ||
859 | 880 | ||
860 | /* Pixel Engine states. */ | 881 | /* Pixel Engine states. */ |
@@ -1028,6 +1049,12 @@ _InitializeContextBuffer( | |||
1028 | index += _CLOSE_RANGE(); | 1049 | index += _CLOSE_RANGE(); |
1029 | } | 1050 | } |
1030 | 1051 | ||
1052 | if (halti3) | ||
1053 | { | ||
1054 | index += _State(Context, index, 0x01A80 >> 2, 0x00000000, 8, gcvFALSE, gcvTRUE); | ||
1055 | index += _CLOSE_RANGE(); | ||
1056 | } | ||
1057 | |||
1031 | /* Semaphore/stall. */ | 1058 | /* Semaphore/stall. */ |
1032 | index += _SemaphoreStall(Context, index); | 1059 | index += _SemaphoreStall(Context, index); |
1033 | #endif | 1060 | #endif |
@@ -1035,7 +1062,7 @@ _InitializeContextBuffer( | |||
1035 | /**************************************************************************/ | 1062 | /**************************************************************************/ |
1036 | /* Link to another address. ***********************************************/ | 1063 | /* Link to another address. ***********************************************/ |
1037 | 1064 | ||
1038 | Context->linkIndex3D = index; | 1065 | Context->linkIndex3D = (gctUINT)index; |
1039 | 1066 | ||
1040 | if (buffer != gcvNULL) | 1067 | if (buffer != gcvNULL) |
1041 | { | 1068 | { |
@@ -1057,7 +1084,7 @@ _InitializeContextBuffer( | |||
1057 | /* Pipe switch for the case where neither 2D nor 3D are used. *************/ | 1084 | /* Pipe switch for the case where neither 2D nor 3D are used. *************/ |
1058 | 1085 | ||
1059 | /* Store the 3D entry index. */ | 1086 | /* Store the 3D entry index. */ |
1060 | Context->entryOffsetXDFrom2D = index * gcmSIZEOF(gctUINT32); | 1087 | Context->entryOffsetXDFrom2D = (gctUINT)index * gcmSIZEOF(gctUINT32); |
1061 | 1088 | ||
1062 | /* Flush 2D pipe. */ | 1089 | /* Flush 2D pipe. */ |
1063 | index += _FlushPipe(Context, index, gcvPIPE_2D); | 1090 | index += _FlushPipe(Context, index, gcvPIPE_2D); |
@@ -1066,7 +1093,7 @@ _InitializeContextBuffer( | |||
1066 | index += _SwitchPipe(Context, index, gcvPIPE_3D); | 1093 | index += _SwitchPipe(Context, index, gcvPIPE_3D); |
1067 | 1094 | ||
1068 | /* Store the location of the link. */ | 1095 | /* Store the location of the link. */ |
1069 | Context->linkIndexXD = index; | 1096 | Context->linkIndexXD = (gctUINT)index; |
1070 | 1097 | ||
1071 | if (buffer != gcvNULL) | 1098 | if (buffer != gcvNULL) |
1072 | { | 1099 | { |
@@ -1229,9 +1256,10 @@ gckCONTEXT_Construct( | |||
1229 | { | 1256 | { |
1230 | gceSTATUS status; | 1257 | gceSTATUS status; |
1231 | gckCONTEXT context = gcvNULL; | 1258 | gckCONTEXT context = gcvNULL; |
1232 | gctSIZE_T allocationSize; | 1259 | gctUINT32 allocationSize; |
1233 | gctUINT i; | 1260 | gctUINT i; |
1234 | gctPOINTER pointer = gcvNULL; | 1261 | gctPOINTER pointer = gcvNULL; |
1262 | gctUINT32 address; | ||
1235 | 1263 | ||
1236 | gcmkHEADER_ARG("Os=0x%08X Hardware=0x%08X", Os, Hardware); | 1264 | gcmkHEADER_ARG("Os=0x%08X Hardware=0x%08X", Os, Hardware); |
1237 | 1265 | ||
@@ -1299,7 +1327,7 @@ gckCONTEXT_Construct( | |||
1299 | /* Compute the size of the record array. **********************************/ | 1327 | /* Compute the size of the record array. **********************************/ |
1300 | 1328 | ||
1301 | context->recordArraySize | 1329 | context->recordArraySize |
1302 | = gcmSIZEOF(gcsSTATE_DELTA_RECORD) * context->stateCount; | 1330 | = gcmSIZEOF(gcsSTATE_DELTA_RECORD) * (gctUINT)context->stateCount; |
1303 | 1331 | ||
1304 | 1332 | ||
1305 | if (context->stateCount > 0) | 1333 | if (context->stateCount > 0) |
@@ -1345,6 +1373,8 @@ gckCONTEXT_Construct( | |||
1345 | /* Allocate a context buffer. */ | 1373 | /* Allocate a context buffer. */ |
1346 | gcsCONTEXT_PTR buffer; | 1374 | gcsCONTEXT_PTR buffer; |
1347 | 1375 | ||
1376 | gctSIZE_T totalSize = context->totalSize; | ||
1377 | |||
1348 | /* Allocate the context buffer structure. */ | 1378 | /* Allocate the context buffer structure. */ |
1349 | gcmkONERROR(gckOS_Allocate( | 1379 | gcmkONERROR(gckOS_Allocate( |
1350 | Os, | 1380 | Os, |
@@ -1392,23 +1422,38 @@ gckCONTEXT_Construct( | |||
1392 | gcmkONERROR(gckKERNEL_AllocateVirtualCommandBuffer( | 1422 | gcmkONERROR(gckKERNEL_AllocateVirtualCommandBuffer( |
1393 | context->hardware->kernel, | 1423 | context->hardware->kernel, |
1394 | gcvFALSE, | 1424 | gcvFALSE, |
1395 | &context->totalSize, | 1425 | &totalSize, |
1396 | &buffer->physical, | 1426 | &buffer->physical, |
1397 | &pointer | 1427 | &pointer |
1398 | )); | 1428 | )); |
1429 | |||
1430 | gcmkONERROR(gckKERNEL_GetGPUAddress( | ||
1431 | context->hardware->kernel, | ||
1432 | pointer, | ||
1433 | gcvFALSE, | ||
1434 | &address | ||
1435 | )); | ||
1399 | } | 1436 | } |
1400 | else | 1437 | else |
1401 | { | 1438 | { |
1402 | gcmkONERROR(gckOS_AllocateContiguous( | 1439 | gcmkONERROR(gckOS_AllocateContiguous( |
1403 | Os, | 1440 | Os, |
1404 | gcvFALSE, | 1441 | gcvFALSE, |
1405 | &context->totalSize, | 1442 | &totalSize, |
1406 | &buffer->physical, | 1443 | &buffer->physical, |
1407 | &pointer | 1444 | &pointer |
1408 | )); | 1445 | )); |
1446 | |||
1447 | gcmkONERROR(gckHARDWARE_ConvertLogical( | ||
1448 | context->hardware, | ||
1449 | pointer, | ||
1450 | gcvFALSE, | ||
1451 | &address | ||
1452 | )); | ||
1409 | } | 1453 | } |
1410 | 1454 | ||
1411 | buffer->logical = pointer; | 1455 | buffer->logical = pointer; |
1456 | buffer->address = address; | ||
1412 | 1457 | ||
1413 | /* Set gckEVENT object pointer. */ | 1458 | /* Set gckEVENT object pointer. */ |
1414 | buffer->eventObj = Hardware->kernel->eventObj; | 1459 | buffer->eventObj = Hardware->kernel->eventObj; |
@@ -1427,16 +1472,16 @@ gckCONTEXT_Construct( | |||
1427 | if (context->linkIndexXD != 0) | 1472 | if (context->linkIndexXD != 0) |
1428 | { | 1473 | { |
1429 | gctPOINTER xdLink; | 1474 | gctPOINTER xdLink; |
1430 | gctUINT8_PTR xdEntryLogical; | 1475 | gctUINT32 xdEntryAddress; |
1431 | gctSIZE_T xdEntrySize; | 1476 | gctUINT32 xdEntrySize; |
1432 | gctSIZE_T linkBytes; | 1477 | gctUINT32 linkBytes; |
1433 | 1478 | ||
1434 | /* Determine LINK parameters. */ | 1479 | /* Determine LINK parameters. */ |
1435 | xdLink | 1480 | xdLink |
1436 | = &buffer->logical[context->linkIndexXD]; | 1481 | = &buffer->logical[context->linkIndexXD]; |
1437 | 1482 | ||
1438 | xdEntryLogical | 1483 | xdEntryAddress |
1439 | = (gctUINT8_PTR) buffer->logical | 1484 | = buffer->address |
1440 | + context->entryOffsetXDFrom3D; | 1485 | + context->entryOffsetXDFrom3D; |
1441 | 1486 | ||
1442 | xdEntrySize | 1487 | xdEntrySize |
@@ -1445,14 +1490,14 @@ gckCONTEXT_Construct( | |||
1445 | 1490 | ||
1446 | /* Query LINK size. */ | 1491 | /* Query LINK size. */ |
1447 | gcmkONERROR(gckHARDWARE_Link( | 1492 | gcmkONERROR(gckHARDWARE_Link( |
1448 | Hardware, gcvNULL, gcvNULL, 0, &linkBytes | 1493 | Hardware, gcvNULL, 0, 0, &linkBytes |
1449 | )); | 1494 | )); |
1450 | 1495 | ||
1451 | /* Generate a LINK. */ | 1496 | /* Generate a LINK. */ |
1452 | gcmkONERROR(gckHARDWARE_Link( | 1497 | gcmkONERROR(gckHARDWARE_Link( |
1453 | Hardware, | 1498 | Hardware, |
1454 | xdLink, | 1499 | xdLink, |
1455 | xdEntryLogical, | 1500 | xdEntryAddress, |
1456 | xdEntrySize, | 1501 | xdEntrySize, |
1457 | &linkBytes | 1502 | &linkBytes |
1458 | )); | 1503 | )); |
@@ -1640,7 +1685,7 @@ gckCONTEXT_Update( | |||
1640 | #if gcmIS_DEBUG(gcdDEBUG_CODE) && 1 && !defined(VIVANTE_NO_3D) | 1685 | #if gcmIS_DEBUG(gcdDEBUG_CODE) && 1 && !defined(VIVANTE_NO_3D) |
1641 | /* Update current context token. */ | 1686 | /* Update current context token. */ |
1642 | buffer->logical[Context->map[0x0E14].index] | 1687 | buffer->logical[Context->map[0x0E14].index] |
1643 | = gcmPTR2INT(Context); | 1688 | = (gctUINT32)gcmPTR2INT32(Context); |
1644 | #endif | 1689 | #endif |
1645 | 1690 | ||
1646 | /* Are there any pending deltas? */ | 1691 | /* Are there any pending deltas? */ |
@@ -1968,11 +2013,10 @@ gckCONTEXT_MapBuffer( | |||
1968 | commandBuffer = (gckVIRTUAL_COMMAND_BUFFER_PTR)buffer->physical; | 2013 | commandBuffer = (gckVIRTUAL_COMMAND_BUFFER_PTR)buffer->physical; |
1969 | physical = commandBuffer->physical; | 2014 | physical = commandBuffer->physical; |
1970 | 2015 | ||
1971 | gcmkONERROR(gckOS_LockPages( | 2016 | gcmkONERROR(gckOS_CreateUserVirtualMapping( |
1972 | kernel->os, | 2017 | kernel->os, |
1973 | physical, | 2018 | physical, |
1974 | (gctSIZE_T)Context->totalSize, | 2019 | Context->totalSize, |
1975 | gcvFALSE, | ||
1976 | &logical, | 2020 | &logical, |
1977 | &pageCount)); | 2021 | &pageCount)); |
1978 | } | 2022 | } |
@@ -1983,7 +2027,7 @@ gckCONTEXT_MapBuffer( | |||
1983 | gcmkONERROR(gckOS_MapMemory( | 2027 | gcmkONERROR(gckOS_MapMemory( |
1984 | kernel->os, | 2028 | kernel->os, |
1985 | physical, | 2029 | physical, |
1986 | (gctSIZE_T)Context->totalSize, | 2030 | Context->totalSize, |
1987 | &logical)); | 2031 | &logical)); |
1988 | } | 2032 | } |
1989 | 2033 | ||
@@ -1994,7 +2038,7 @@ gckCONTEXT_MapBuffer( | |||
1994 | buffer = buffer->next; | 2038 | buffer = buffer->next; |
1995 | } | 2039 | } |
1996 | 2040 | ||
1997 | *Bytes = Context->totalSize; | 2041 | *Bytes = (gctUINT)Context->totalSize; |
1998 | 2042 | ||
1999 | gcmkFOOTER_NO(); | 2043 | gcmkFOOTER_NO(); |
2000 | return gcvSTATUS_OK; | 2044 | return gcvSTATUS_OK; |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.h b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.h index d02e16b714e6..9b9cda624eea 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.h +++ b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.h | |||
@@ -62,6 +62,9 @@ typedef struct _gcsCONTEXT | |||
62 | /* Logical address of the context buffer. */ | 62 | /* Logical address of the context buffer. */ |
63 | gctUINT32_PTR logical; | 63 | gctUINT32_PTR logical; |
64 | 64 | ||
65 | /* Hardware address of the context buffer. */ | ||
66 | gctUINT32 address; | ||
67 | |||
65 | /* Pointer to the LINK commands. */ | 68 | /* Pointer to the LINK commands. */ |
66 | gctPOINTER link2D; | 69 | gctPOINTER link2D; |
67 | gctPOINTER link3D; | 70 | gctPOINTER link3D; |
@@ -90,14 +93,14 @@ struct _gckCONTEXT | |||
90 | gckHARDWARE hardware; | 93 | gckHARDWARE hardware; |
91 | 94 | ||
92 | /* Command buffer alignment. */ | 95 | /* Command buffer alignment. */ |
93 | gctSIZE_T alignment; | 96 | gctUINT32 alignment; |
94 | gctSIZE_T reservedHead; | 97 | gctUINT32 reservedHead; |
95 | gctSIZE_T reservedTail; | 98 | gctUINT32 reservedTail; |
96 | 99 | ||
97 | /* Context buffer metrics. */ | 100 | /* Context buffer metrics. */ |
98 | gctSIZE_T stateCount; | 101 | gctSIZE_T stateCount; |
99 | gctSIZE_T totalSize; | 102 | gctUINT32 totalSize; |
100 | gctSIZE_T bufferSize; | 103 | gctUINT32 bufferSize; |
101 | gctUINT32 linkIndex2D; | 104 | gctUINT32 linkIndex2D; |
102 | gctUINT32 linkIndex3D; | 105 | gctUINT32 linkIndex3D; |
103 | gctUINT32 linkIndexXD; | 106 | gctUINT32 linkIndexXD; |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c index b39284df5faa..e7e7f7d1fa84 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c +++ b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c | |||
@@ -63,6 +63,7 @@ typedef struct _gcsiDEBUG_REGISTERS | |||
63 | gctUINT32 signature; | 63 | gctUINT32 signature; |
64 | } | 64 | } |
65 | gcsiDEBUG_REGISTERS; | 65 | gcsiDEBUG_REGISTERS; |
66 | |||
66 | #ifdef LINUX | 67 | #ifdef LINUX |
67 | extern int gpu3DMinClock; | 68 | extern int gpu3DMinClock; |
68 | #endif | 69 | #endif |
@@ -112,7 +113,6 @@ _IdentifyHardware( | |||
112 | #if gcdMULTI_GPU | 113 | #if gcdMULTI_GPU |
113 | gctUINT32 gpuCoreCount = 0; | 114 | gctUINT32 gpuCoreCount = 0; |
114 | #endif | 115 | #endif |
115 | gctBOOL useHZ; | ||
116 | 116 | ||
117 | gcmkHEADER_ARG("Os=0x%x", Os); | 117 | gcmkHEADER_ARG("Os=0x%x", Os); |
118 | 118 | ||
@@ -143,7 +143,8 @@ _IdentifyHardware( | |||
143 | 143 | ||
144 | 144 | ||
145 | if (((Identity->chipModel & 0xFF00) == 0x0400) | 145 | if (((Identity->chipModel & 0xFF00) == 0x0400) |
146 | && (Identity->chipModel != 0x0420)) | 146 | && (Identity->chipModel != 0x0420) |
147 | && (Identity->chipModel != 0x0428)) | ||
147 | { | 148 | { |
148 | Identity->chipModel = (gceCHIPMODEL) (Identity->chipModel & 0x0400); | 149 | Identity->chipModel = (gceCHIPMODEL) (Identity->chipModel & 0x0400); |
149 | } | 150 | } |
@@ -251,12 +252,6 @@ _IdentifyHardware( | |||
251 | 0x00088, | 252 | 0x00088, |
252 | &Identity->chipMinorFeatures3)); | 253 | &Identity->chipMinorFeatures3)); |
253 | 254 | ||
254 | /*The chip has no compression supertiled*/ | ||
255 | if(Identity->chipModel == gcv1000 && Identity->chipRevision == 0x5036) | ||
256 | { | ||
257 | Identity->chipMinorFeatures3 | ||
258 | = ((((gctUINT32) (Identity->chipMinorFeatures3)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))); | ||
259 | } | ||
260 | 255 | ||
261 | /* Read chip minor featuress register #4. */ | 256 | /* Read chip minor featuress register #4. */ |
262 | gcmkONERROR( | 257 | gcmkONERROR( |
@@ -300,6 +295,7 @@ _IdentifyHardware( | |||
300 | if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) | 295 | if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) |
301 | || (Identity->chipRevision == 0x5036) | 296 | || (Identity->chipRevision == 0x5036) |
302 | || (Identity->chipRevision == 0x5037) | 297 | || (Identity->chipRevision == 0x5037) |
298 | || (Identity->chipRevision == 0x5039) | ||
303 | || (Identity->chipRevision >= 0x5040))) | 299 | || (Identity->chipRevision >= 0x5040))) |
304 | || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612)) | 300 | || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612)) |
305 | || ((Identity->chipModel == gcv600) && (Identity->chipRevision >= 0x4650)) | 301 | || ((Identity->chipModel == gcv600) && (Identity->chipRevision >= 0x4650)) |
@@ -309,48 +305,6 @@ _IdentifyHardware( | |||
309 | Identity->superTileMode = 1; | 305 | Identity->superTileMode = 1; |
310 | } | 306 | } |
311 | 307 | ||
312 | if (((Identity->chipModel == gcv4000) && (Identity->chipRevision == 0x5245)) | ||
313 | || ((Identity->chipModel == gcv5000) && (Identity->chipRevision == 0x5309)) | ||
314 | || ((Identity->chipModel == gcv2500) && (Identity->chipRevision == 0x5410)) | ||
315 | || ((Identity->chipModel == gcv5200) && (Identity->chipRevision == 0x5410)) | ||
316 | || ((Identity->chipModel == gcv6400) && (Identity->chipRevision == 0x5420)) | ||
317 | || ((Identity->chipModel == gcv6400) && (Identity->chipRevision == 0x5422)) | ||
318 | || ((Identity->chipModel == gcv5000) && (Identity->chipRevision == 0x5434)) | ||
319 | ) | ||
320 | |||
321 | { | ||
322 | useHZ = ((((gctUINT32) (Identity->chipMinorFeatures3)) >> (0 ? 26:26) & ((gctUINT32) ((((1 ? 26:26) - (0 ? 26:26) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 26:26) - (0 ? 26:26) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 26:26) - (0 ? 26:26) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 26:26) - (0 ? 26:26) + 1))))))) | ||
323 | || ((((gctUINT32) (Identity->chipMinorFeatures3)) >> (0 ? 8:8) & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1))))))); | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | useHZ = gcvFALSE; | ||
328 | } | ||
329 | |||
330 | /* If new HZ is available, disable other early z modes. */ | ||
331 | if (useHZ) | ||
332 | { | ||
333 | /* Disable EZ. */ | ||
334 | Identity->chipFeatures | ||
335 | = ((((gctUINT32) (Identity->chipFeatures)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))); | ||
336 | } | ||
337 | |||
338 | /* Disable HZ when EZ is present for older chips. */ | ||
339 | else if (!((((gctUINT32) (Identity->chipFeatures)) >> (0 ? 16:16) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))))) | ||
340 | { | ||
341 | /* Disable HIERARCHICAL_Z. */ | ||
342 | Identity->chipMinorFeatures | ||
343 | = ((((gctUINT32) (Identity->chipMinorFeatures)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 27:27) - (0 ? 27:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:27) - (0 ? 27:27) + 1))))))) << (0 ? 27:27))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 27:27) - (0 ? 27:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:27) - (0 ? 27:27) + 1))))))) << (0 ? 27:27))); | ||
344 | } | ||
345 | |||
346 | /* Disable rectangle primitive when chip is gc880_5_1_0_rc6*/ | ||
347 | if ((Identity->chipModel == gcv880) && (Identity->chipRevision == 0x5106)) | ||
348 | { | ||
349 | /* Disable rectangle primitive. */ | ||
350 | Identity->chipMinorFeatures2 | ||
351 | = ((((gctUINT32) (Identity->chipMinorFeatures2)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))); | ||
352 | } | ||
353 | |||
354 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | 308 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, |
355 | "Identity: chipFeatures=0x%08X", | 309 | "Identity: chipFeatures=0x%08X", |
356 | Identity->chipFeatures); | 310 | Identity->chipFeatures); |
@@ -592,6 +546,36 @@ _IdentifyHardware( | |||
592 | Identity->varyingsCount -= 1; | 546 | Identity->varyingsCount -= 1; |
593 | } | 547 | } |
594 | 548 | ||
549 | Identity->chip2DControl = 0; | ||
550 | if (Identity->chipModel == gcv320) | ||
551 | { | ||
552 | gctUINT32 data; | ||
553 | |||
554 | gcmkONERROR( | ||
555 | gckOS_ReadRegisterEx(Os, | ||
556 | Core, | ||
557 | 0x0002C, | ||
558 | &data)); | ||
559 | |||
560 | if ((data != 33956864) && | ||
561 | ((Identity->chipRevision == 0x5007) || | ||
562 | (Identity->chipRevision == 0x5220))) | ||
563 | { | ||
564 | Identity->chip2DControl |= 0xFF & | ||
565 | (Identity->chipRevision == 0x5220 ? 8 : | ||
566 | (Identity->chipRevision == 0x5007 ? 12 : 0)); | ||
567 | } | ||
568 | |||
569 | if (Identity->chipRevision == 0x5007) | ||
570 | { | ||
571 | /* Disable splitting rectangle. */ | ||
572 | Identity->chip2DControl |= 0x100; | ||
573 | |||
574 | /* Enable 2D Flush. */ | ||
575 | Identity->chip2DControl |= 0x200; | ||
576 | } | ||
577 | } | ||
578 | |||
595 | #if gcdMULTI_GPU | 579 | #if gcdMULTI_GPU |
596 | #if gcdMULTI_GPU > 1 | 580 | #if gcdMULTI_GPU > 1 |
597 | Identity->gpuCoreCount = gpuCoreCount + 1; | 581 | Identity->gpuCoreCount = gpuCoreCount + 1; |
@@ -618,6 +602,8 @@ OnError: | |||
618 | #define gcdDISABLE_PA_CLOCK_GATING 0 | 602 | #define gcdDISABLE_PA_CLOCK_GATING 0 |
619 | #define gcdDISABLE_SE_CLOCK_GATING 0 | 603 | #define gcdDISABLE_SE_CLOCK_GATING 0 |
620 | #define gcdDISABLE_RA_CLOCK_GATING 0 | 604 | #define gcdDISABLE_RA_CLOCK_GATING 0 |
605 | #define gcdDISABLE_RA_EZ_CLOCK_GATING 0 | ||
606 | #define gcdDISABLE_RA_HZ_CLOCK_GATING 0 | ||
621 | #define gcdDISABLE_TX_CLOCK_GATING 0 | 607 | #define gcdDISABLE_TX_CLOCK_GATING 0 |
622 | 608 | ||
623 | #if gcdDEBUG_MODULE_CLOCK_GATING | 609 | #if gcdDEBUG_MODULE_CLOCK_GATING |
@@ -663,6 +649,14 @@ _ConfigureModuleLevelClockGating( | |||
663 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))); | 649 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))); |
664 | #endif | 650 | #endif |
665 | 651 | ||
652 | #if gcdDISABLE_RA_EZ_CLOCK_GATING | ||
653 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))); | ||
654 | #endif | ||
655 | |||
656 | #if gcdDISABLE_RA_HZ_CLOCK_GATING | ||
657 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 17:17) - (0 ? 17:17) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:17) - (0 ? 17:17) + 1))))))) << (0 ? 17:17))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 17:17) - (0 ? 17:17) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:17) - (0 ? 17:17) + 1))))))) << (0 ? 17:17))); | ||
658 | #endif | ||
659 | |||
666 | gcmkVERIFY_OK( | 660 | gcmkVERIFY_OK( |
667 | gckOS_WriteRegisterEx(Hardware->os, | 661 | gckOS_WriteRegisterEx(Hardware->os, |
668 | Hardware->core, | 662 | Hardware->core, |
@@ -863,7 +857,7 @@ _FlushCache( | |||
863 | ) | 857 | ) |
864 | { | 858 | { |
865 | gceSTATUS status; | 859 | gceSTATUS status; |
866 | gctSIZE_T bytes, requested; | 860 | gctUINT32 bytes, requested; |
867 | gctPOINTER buffer; | 861 | gctPOINTER buffer; |
868 | 862 | ||
869 | /* Get the size of the flush command. */ | 863 | /* Get the size of the flush command. */ |
@@ -968,9 +962,12 @@ gckHARDWARE_Construct( | |||
968 | hardware->type = gcvHARDWARE_VG; | 962 | hardware->type = gcvHARDWARE_VG; |
969 | break; | 963 | break; |
970 | 964 | ||
965 | case gcv200: | ||
971 | case gcv300: | 966 | case gcv300: |
972 | case gcv320: | 967 | case gcv320: |
968 | case gcv328: | ||
973 | case gcv420: | 969 | case gcv420: |
970 | case gcv428: | ||
974 | hardware->type = gcvHARDWARE_2D; | 971 | hardware->type = gcvHARDWARE_2D; |
975 | /*set outstanding limit*/ | 972 | /*set outstanding limit*/ |
976 | gcmkONERROR(gckOS_ReadRegisterEx(Os, Core, 0x00414, &axi_ot)); | 973 | gcmkONERROR(gckOS_ReadRegisterEx(Os, Core, 0x00414, &axi_ot)); |
@@ -1097,6 +1094,17 @@ gckHARDWARE_Construct( | |||
1097 | /* Disable profiler by default */ | 1094 | /* Disable profiler by default */ |
1098 | hardware->gpuProfiler = gcvFALSE; | 1095 | hardware->gpuProfiler = gcvFALSE; |
1099 | 1096 | ||
1097 | #if defined(LINUX) || defined(__QNXNTO__) || defined(UNDERCE) | ||
1098 | if (hardware->mmuVersion) | ||
1099 | { | ||
1100 | hardware->endAfterFlushMmuCache = gcvTRUE; | ||
1101 | } | ||
1102 | else | ||
1103 | #endif | ||
1104 | { | ||
1105 | hardware->endAfterFlushMmuCache = gcvFALSE; | ||
1106 | } | ||
1107 | |||
1100 | /* Return pointer to the gckHARDWARE object. */ | 1108 | /* Return pointer to the gckHARDWARE object. */ |
1101 | *Hardware = hardware; | 1109 | *Hardware = hardware; |
1102 | 1110 | ||
@@ -1257,6 +1265,7 @@ gckHARDWARE_InitializeHardware( | |||
1257 | gctUINT32 chipRev; | 1265 | gctUINT32 chipRev; |
1258 | gctUINT32 control; | 1266 | gctUINT32 control; |
1259 | gctUINT32 data; | 1267 | gctUINT32 data; |
1268 | gctUINT32 regPMC = 0; | ||
1260 | 1269 | ||
1261 | gcmkHEADER_ARG("Hardware=0x%x", Hardware); | 1270 | gcmkHEADER_ARG("Hardware=0x%x", Hardware); |
1262 | 1271 | ||
@@ -1361,26 +1370,22 @@ gckHARDWARE_InitializeHardware( | |||
1361 | /* Disable PE clock gating on revs < 5.0 when HZ is present without a | 1370 | /* Disable PE clock gating on revs < 5.0 when HZ is present without a |
1362 | ** bug fix. */ | 1371 | ** bug fix. */ |
1363 | if ((Hardware->identity.chipRevision < 0x5000) | 1372 | if ((Hardware->identity.chipRevision < 0x5000) |
1373 | && gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_HZ) | ||
1364 | && ((((gctUINT32) (Hardware->identity.chipMinorFeatures1)) >> (0 ? 9:9) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1)))))) == (0x0 & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) | 1374 | && ((((gctUINT32) (Hardware->identity.chipMinorFeatures1)) >> (0 ? 9:9) & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1)))))) == (0x0 & ((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) |
1365 | && ((((gctUINT32) (Hardware->identity.chipMinorFeatures)) >> (0 ? 27:27) & ((gctUINT32) ((((1 ? 27:27) - (0 ? 27:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:27) - (0 ? 27:27) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 27:27) - (0 ? 27:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:27) - (0 ? 27:27) + 1))))))) | ||
1366 | ) | 1375 | ) |
1367 | { | 1376 | { |
1368 | gcmkONERROR( | 1377 | if (regPMC == 0) |
1369 | gckOS_ReadRegisterEx(Hardware->os, | 1378 | { |
1370 | Hardware->core, | 1379 | gcmkONERROR( |
1371 | Hardware->powerBaseAddress | 1380 | gckOS_ReadRegisterEx(Hardware->os, |
1372 | + 0x00104, | 1381 | Hardware->core, |
1373 | &data)); | 1382 | Hardware->powerBaseAddress |
1383 | + 0x00104, | ||
1384 | ®PMC)); | ||
1385 | } | ||
1374 | 1386 | ||
1375 | /* Disable PE clock gating. */ | 1387 | /* Disable PE clock gating. */ |
1376 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))); | 1388 | regPMC = ((((gctUINT32) (regPMC)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 2:2) - (0 ? 2:2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 2:2) - (0 ? 2:2) + 1))))))) << (0 ? 2:2))); |
1377 | |||
1378 | gcmkONERROR( | ||
1379 | gckOS_WriteRegisterEx(Hardware->os, | ||
1380 | Hardware->core, | ||
1381 | Hardware->powerBaseAddress | ||
1382 | + 0x00104, | ||
1383 | data)); | ||
1384 | } | 1389 | } |
1385 | 1390 | ||
1386 | #endif | 1391 | #endif |
@@ -1397,32 +1402,25 @@ gckHARDWARE_InitializeHardware( | |||
1397 | ((((gctUINT32) (0x01590880)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:23) - (0 ? 23:23) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:23) - (0 ? 23:23) + 1))))))) << (0 ? 23:23))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 23:23) - (0 ? 23:23) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:23) - (0 ? 23:23) + 1))))))) << (0 ? 23:23))))); | 1402 | ((((gctUINT32) (0x01590880)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:23) - (0 ? 23:23) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:23) - (0 ? 23:23) + 1))))))) << (0 ? 23:23))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 23:23) - (0 ? 23:23) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:23) - (0 ? 23:23) + 1))))))) << (0 ? 23:23))))); |
1398 | } | 1403 | } |
1399 | 1404 | ||
1400 | if ((gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_HALTI2) == gcvFALSE) | 1405 | if ((gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_HALTI2) == gcvSTATUS_FALSE) |
1401 | || (gckHARDWARE_IsFeatureAvailable(Hardware, gcvFEATURE_HALTI2) && (Hardware->identity.chipRevision < 0x5422)) | 1406 | || (Hardware->identity.chipRevision < 0x5422) |
1402 | ) | 1407 | ) |
1403 | { | 1408 | { |
1404 | gcmkONERROR( | 1409 | if (regPMC == 0) |
1405 | gckOS_ReadRegisterEx(Hardware->os, | 1410 | { |
1406 | Hardware->core, | 1411 | gcmkONERROR( |
1407 | Hardware->powerBaseAddress | 1412 | gckOS_ReadRegisterEx(Hardware->os, |
1408 | + 0x00104, | 1413 | Hardware->core, |
1409 | &data)); | 1414 | Hardware->powerBaseAddress |
1410 | 1415 | + 0x00104, | |
1411 | 1416 | ®PMC)); | |
1412 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:15) - (0 ? 15:15) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:15) - (0 ? 15:15) + 1))))))) << (0 ? 15:15))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 15:15) - (0 ? 15:15) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:15) - (0 ? 15:15) + 1))))))) << (0 ? 15:15))); | 1417 | } |
1413 | |||
1414 | 1418 | ||
1415 | gcmkONERROR( | 1419 | regPMC = ((((gctUINT32) (regPMC)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:15) - (0 ? 15:15) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:15) - (0 ? 15:15) + 1))))))) << (0 ? 15:15))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 15:15) - (0 ? 15:15) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:15) - (0 ? 15:15) + 1))))))) << (0 ? 15:15))); |
1416 | gckOS_WriteRegisterEx(Hardware->os, | ||
1417 | Hardware->core, | ||
1418 | Hardware->powerBaseAddress | ||
1419 | + 0x00104, | ||
1420 | data)); | ||
1421 | } | 1420 | } |
1422 | 1421 | ||
1423 | 1422 | ||
1424 | if ((Hardware->identity.chipModel == gcv2000) | 1423 | if (_IsHardwareMatch(Hardware, gcv2000, 0x5108)) |
1425 | && (Hardware->identity.chipRevision == 0x5108)) | ||
1426 | { | 1424 | { |
1427 | gcmkONERROR( | 1425 | gcmkONERROR( |
1428 | gckOS_ReadRegisterEx(Hardware->os, | 1426 | gckOS_ReadRegisterEx(Hardware->os, |
@@ -1458,26 +1456,22 @@ gckHARDWARE_InitializeHardware( | |||
1458 | if (Hardware->identity.chipModel >= gcv400 | 1456 | if (Hardware->identity.chipModel >= gcv400 |
1459 | && Hardware->identity.chipModel != gcv420) | 1457 | && Hardware->identity.chipModel != gcv420) |
1460 | { | 1458 | { |
1459 | if (regPMC == 0) | ||
1460 | { | ||
1461 | gcmkONERROR( | 1461 | gcmkONERROR( |
1462 | gckOS_ReadRegisterEx(Hardware->os, | 1462 | gckOS_ReadRegisterEx(Hardware->os, |
1463 | Hardware->core, | 1463 | Hardware->core, |
1464 | Hardware->powerBaseAddress | 1464 | Hardware->powerBaseAddress |
1465 | + 0x00104, | 1465 | + 0x00104, |
1466 | &data)); | 1466 | ®PMC)); |
1467 | } | ||
1467 | 1468 | ||
1468 | /* Disable PA clock gating. */ | 1469 | /* Disable PA clock gating. */ |
1469 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))); | 1470 | regPMC = ((((gctUINT32) (regPMC)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))); |
1470 | |||
1471 | gcmkONERROR( | ||
1472 | gckOS_WriteRegisterEx(Hardware->os, | ||
1473 | Hardware->core, | ||
1474 | Hardware->powerBaseAddress | ||
1475 | + 0x00104, | ||
1476 | data)); | ||
1477 | } | 1471 | } |
1478 | 1472 | ||
1479 | /* Limit 2D outstanding request. */ | 1473 | /* Limit 2D outstanding request. */ |
1480 | if(Hardware->identity.chipModel == gcv880 && Hardware->identity.chipRevision == 0x5107) | 1474 | if (_IsHardwareMatch(Hardware, gcv880, 0x5107)) |
1481 | { | 1475 | { |
1482 | gctUINT32 axi_ot; | 1476 | gctUINT32 axi_ot; |
1483 | gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00414, &axi_ot)); | 1477 | gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00414, &axi_ot)); |
@@ -1485,31 +1479,23 @@ gckHARDWARE_InitializeHardware( | |||
1485 | gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00414, axi_ot)); | 1479 | gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00414, axi_ot)); |
1486 | } | 1480 | } |
1487 | 1481 | ||
1488 | if ((Hardware->identity.chipModel == gcv320) | 1482 | if (Hardware->identity.chip2DControl & 0xFF) |
1489 | && ((Hardware->identity.chipRevision == 0x5007) | ||
1490 | || (Hardware->identity.chipRevision == 0x5220))) | ||
1491 | { | 1483 | { |
1484 | gctUINT32 data; | ||
1485 | |||
1492 | gcmkONERROR( | 1486 | gcmkONERROR( |
1493 | gckOS_ReadRegisterEx(Hardware->os, | 1487 | gckOS_ReadRegisterEx(Hardware->os, |
1494 | Hardware->core, | 1488 | Hardware->core, |
1495 | 0x0002C, | 1489 | 0x00414, |
1496 | &data)); | 1490 | &data)); |
1497 | if (data != 33956864) | ||
1498 | { | ||
1499 | gcmkONERROR( | ||
1500 | gckOS_ReadRegisterEx(Hardware->os, | ||
1501 | Hardware->core, | ||
1502 | 0x00414, | ||
1503 | &data)); | ||
1504 | 1491 | ||
1505 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:0) - (0 ? 7:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:0) - (0 ? 7:0) + 1))))))) << (0 ? 7:0))) | (((gctUINT32) ((gctUINT32) (Hardware->identity.chipRevision == 0x5220 ? 8 : (Hardware->identity.chipRevision == 0x5007 ? 16 : 0)) & ((gctUINT32) ((((1 ? 7:0) - (0 ? 7:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:0) - (0 ? 7:0) + 1))))))) << (0 ? 7:0))); | 1492 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:0) - (0 ? 7:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:0) - (0 ? 7:0) + 1))))))) << (0 ? 7:0))) | (((gctUINT32) ((gctUINT32) (Hardware->identity.chip2DControl & 0xFF) & ((gctUINT32) ((((1 ? 7:0) - (0 ? 7:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:0) - (0 ? 7:0) + 1))))))) << (0 ? 7:0))); |
1506 | 1493 | ||
1507 | gcmkONERROR( | 1494 | gcmkONERROR( |
1508 | gckOS_WriteRegisterEx(Hardware->os, | 1495 | gckOS_WriteRegisterEx(Hardware->os, |
1509 | Hardware->core, | 1496 | Hardware->core, |
1510 | 0x00414, | 1497 | 0x00414, |
1511 | data)); | 1498 | data)); |
1512 | } | ||
1513 | } | 1499 | } |
1514 | 1500 | ||
1515 | if (_IsHardwareMatch(Hardware, gcv1000, 0x5035)) | 1501 | if (_IsHardwareMatch(Hardware, gcv1000, 0x5035)) |
@@ -1532,22 +1518,18 @@ gckHARDWARE_InitializeHardware( | |||
1532 | 1518 | ||
1533 | if (_IsHardwareMatch(Hardware, gcv4000, 0x5222)) | 1519 | if (_IsHardwareMatch(Hardware, gcv4000, 0x5222)) |
1534 | { | 1520 | { |
1521 | if (regPMC == 0) | ||
1522 | { | ||
1535 | gcmkONERROR( | 1523 | gcmkONERROR( |
1536 | gckOS_ReadRegisterEx(Hardware->os, | 1524 | gckOS_ReadRegisterEx(Hardware->os, |
1537 | Hardware->core, | 1525 | Hardware->core, |
1538 | Hardware->powerBaseAddress | 1526 | Hardware->powerBaseAddress |
1539 | + 0x00104, | 1527 | + 0x00104, |
1540 | &data)); | 1528 | ®PMC)); |
1529 | } | ||
1541 | 1530 | ||
1542 | /* Disable TX clock gating. */ | 1531 | /* Disable TX clock gating. */ |
1543 | data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))); | 1532 | regPMC = ((((gctUINT32) (regPMC)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))); |
1544 | |||
1545 | gcmkONERROR( | ||
1546 | gckOS_WriteRegisterEx(Hardware->os, | ||
1547 | Hardware->core, | ||
1548 | Hardware->powerBaseAddress | ||
1549 | + 0x00104, | ||
1550 | data)); | ||
1551 | } | 1533 | } |
1552 | 1534 | ||
1553 | if (_IsHardwareMatch(Hardware, gcv880, 0x5106)) | 1535 | if (_IsHardwareMatch(Hardware, gcv880, 0x5106)) |
@@ -1561,6 +1543,34 @@ gckHARDWARE_InitializeHardware( | |||
1561 | 0x00008, | 1543 | 0x00008, |
1562 | 0x00002200)); | 1544 | 0x00002200)); |
1563 | 1545 | ||
1546 | |||
1547 | /*VIV: Disable RA HZ/EZ clock gating until the bug is resolved */ | ||
1548 | if (regPMC == 0) | ||
1549 | { | ||
1550 | gcmkONERROR( | ||
1551 | gckOS_ReadRegisterEx(Hardware->os, | ||
1552 | Hardware->core, | ||
1553 | Hardware->powerBaseAddress | ||
1554 | + 0x00104, | ||
1555 | ®PMC)); | ||
1556 | } | ||
1557 | |||
1558 | /* Disable RA HZ clock gating. */ | ||
1559 | regPMC = ((((gctUINT32) (regPMC)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 17:17) - (0 ? 17:17) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:17) - (0 ? 17:17) + 1))))))) << (0 ? 17:17))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 17:17) - (0 ? 17:17) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:17) - (0 ? 17:17) + 1))))))) << (0 ? 17:17))); | ||
1560 | |||
1561 | /* Disable RA EZ clock gating. */ | ||
1562 | regPMC = ((((gctUINT32) (regPMC)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))); | ||
1563 | |||
1564 | if (regPMC != 0) | ||
1565 | { | ||
1566 | gcmkONERROR( | ||
1567 | gckOS_WriteRegisterEx(Hardware->os, | ||
1568 | Hardware->core, | ||
1569 | Hardware->powerBaseAddress | ||
1570 | + 0x00104, | ||
1571 | regPMC)); | ||
1572 | } | ||
1573 | |||
1564 | #if gcdDEBUG_MODULE_CLOCK_GATING | 1574 | #if gcdDEBUG_MODULE_CLOCK_GATING |
1565 | _ConfigureModuleLevelClockGating(Hardware); | 1575 | _ConfigureModuleLevelClockGating(Hardware); |
1566 | #endif | 1576 | #endif |
@@ -1769,6 +1779,7 @@ gckHARDWARE_QueryChipIdentity( | |||
1769 | #if gcdMULTI_GPU | 1779 | #if gcdMULTI_GPU |
1770 | Identity->gpuCoreCount = Hardware->identity.gpuCoreCount; | 1780 | Identity->gpuCoreCount = Hardware->identity.gpuCoreCount; |
1771 | #endif | 1781 | #endif |
1782 | Identity->chip2DControl = Hardware->identity.chip2DControl; | ||
1772 | 1783 | ||
1773 | /* Success. */ | 1784 | /* Success. */ |
1774 | gcmkFOOTER_NO(); | 1785 | gcmkFOOTER_NO(); |
@@ -1859,8 +1870,8 @@ gckHARDWARE_SplitMemory( | |||
1859 | ** gckHARDWARE Hardware | 1870 | ** gckHARDWARE Hardware |
1860 | ** Pointer to the gckHARDWARE object. | 1871 | ** Pointer to the gckHARDWARE object. |
1861 | ** | 1872 | ** |
1862 | ** gctPOINTER Logical | 1873 | ** gctUINT32 Address |
1863 | ** Logical address of command buffer. | 1874 | ** Hardware address of command buffer. |
1864 | ** | 1875 | ** |
1865 | ** gctSIZE_T Bytes | 1876 | ** gctSIZE_T Bytes |
1866 | ** Number of bytes for the prefetch unit (until after the first LINK). | 1877 | ** Number of bytes for the prefetch unit (until after the first LINK). |
@@ -1872,94 +1883,18 @@ gckHARDWARE_SplitMemory( | |||
1872 | gceSTATUS | 1883 | gceSTATUS |
1873 | gckHARDWARE_Execute( | 1884 | gckHARDWARE_Execute( |
1874 | IN gckHARDWARE Hardware, | 1885 | IN gckHARDWARE Hardware, |
1875 | IN gctPOINTER Logical, | 1886 | IN gctUINT32 Address, |
1876 | #ifdef __QNXNTO__ | ||
1877 | IN gctPOINTER Physical, | ||
1878 | IN gctBOOL PhysicalAddresses, | ||
1879 | #endif | ||
1880 | IN gctSIZE_T Bytes | ||
1881 | ) | ||
1882 | { | ||
1883 | gceSTATUS status; | ||
1884 | gctUINT32 address = 0, control; | ||
1885 | |||
1886 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x Bytes=%lu", | ||
1887 | Hardware, Logical, Bytes); | ||
1888 | |||
1889 | /* Verify the arguments. */ | ||
1890 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | ||
1891 | gcmkVERIFY_ARGUMENT(Logical != gcvNULL); | ||
1892 | |||
1893 | #ifdef __QNXNTO__ | ||
1894 | if (PhysicalAddresses && (Hardware->mmuVersion == 0)) | ||
1895 | { | ||
1896 | /* Convert physical into hardware specific address. */ | ||
1897 | gcmkONERROR( | ||
1898 | gckHARDWARE_ConvertPhysical(Hardware, Physical, &address)); | ||
1899 | } | ||
1900 | else | ||
1901 | { | ||
1902 | #endif | ||
1903 | /* Convert logical into hardware specific address. */ | ||
1904 | gcmkONERROR( | ||
1905 | gckHARDWARE_ConvertLogical(Hardware, Logical, &address)); | ||
1906 | #ifdef __QNXNTO__ | ||
1907 | } | ||
1908 | #endif | ||
1909 | |||
1910 | /* Enable all events. */ | ||
1911 | gcmkONERROR( | ||
1912 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00014, ~0U)); | ||
1913 | |||
1914 | /* Write address register. */ | ||
1915 | gcmkONERROR( | ||
1916 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00654, address)); | ||
1917 | |||
1918 | /* Build control register. */ | ||
1919 | control = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | ||
1920 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) ((Bytes + 7) >> 3) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))); | ||
1921 | |||
1922 | /* Set big endian */ | ||
1923 | if (Hardware->bigEndian) | ||
1924 | { | ||
1925 | control |= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20))) | (((gctUINT32) (0x2 & ((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20))); | ||
1926 | } | ||
1927 | |||
1928 | /* Write control register. */ | ||
1929 | gcmkONERROR( | ||
1930 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00658, control)); | ||
1931 | |||
1932 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | ||
1933 | "Started command buffer @ 0x%08x", | ||
1934 | address); | ||
1935 | |||
1936 | /* Success. */ | ||
1937 | gcmkFOOTER_NO(); | ||
1938 | return gcvSTATUS_OK; | ||
1939 | |||
1940 | OnError: | ||
1941 | /* Return the status. */ | ||
1942 | gcmkFOOTER(); | ||
1943 | return status; | ||
1944 | } | ||
1945 | |||
1946 | #if gcdPROCESS_ADDRESS_SPACE | ||
1947 | gceSTATUS | ||
1948 | gckHARDWARE_ExecutePhysical( | ||
1949 | IN gckHARDWARE Hardware, | ||
1950 | IN gctUINT32 Physical, | ||
1951 | IN gctSIZE_T Bytes | 1887 | IN gctSIZE_T Bytes |
1952 | ) | 1888 | ) |
1953 | { | 1889 | { |
1954 | gceSTATUS status; | 1890 | gceSTATUS status; |
1955 | gctUINT32 address = Physical, control; | 1891 | gctUINT32 control; |
1956 | 1892 | ||
1957 | gcmkHEADER_ARG("Hardware=0x%x Physical=0x%x Bytes=%lu", | 1893 | gcmkHEADER_ARG("Hardware=0x%x Address=0x%x Bytes=%lu", |
1958 | Hardware, Physical, Bytes); | 1894 | Hardware, Address, Bytes); |
1959 | 1895 | ||
1960 | /* Verify the arguments. */ | 1896 | /* Verify the arguments. */ |
1961 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | 1897 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); |
1962 | gcmkVERIFY_ARGUMENT(Physical != 0); | ||
1963 | 1898 | ||
1964 | /* Enable all events. */ | 1899 | /* Enable all events. */ |
1965 | gcmkONERROR( | 1900 | gcmkONERROR( |
@@ -1967,7 +1902,7 @@ gckHARDWARE_ExecutePhysical( | |||
1967 | 1902 | ||
1968 | /* Write address register. */ | 1903 | /* Write address register. */ |
1969 | gcmkONERROR( | 1904 | gcmkONERROR( |
1970 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00654, address)); | 1905 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00654, Address)); |
1971 | 1906 | ||
1972 | /* Build control register. */ | 1907 | /* Build control register. */ |
1973 | control = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | 1908 | control = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) |
@@ -1985,7 +1920,7 @@ gckHARDWARE_ExecutePhysical( | |||
1985 | 1920 | ||
1986 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | 1921 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, |
1987 | "Started command buffer @ 0x%08x", | 1922 | "Started command buffer @ 0x%08x", |
1988 | address); | 1923 | Address); |
1989 | 1924 | ||
1990 | /* Success. */ | 1925 | /* Success. */ |
1991 | gcmkFOOTER_NO(); | 1926 | gcmkFOOTER_NO(); |
@@ -1996,7 +1931,6 @@ OnError: | |||
1996 | gcmkFOOTER(); | 1931 | gcmkFOOTER(); |
1997 | return status; | 1932 | return status; |
1998 | } | 1933 | } |
1999 | #endif | ||
2000 | 1934 | ||
2001 | /******************************************************************************* | 1935 | /******************************************************************************* |
2002 | ** | 1936 | ** |
@@ -2043,9 +1977,9 @@ gckHARDWARE_WaitLink( | |||
2043 | IN gckHARDWARE Hardware, | 1977 | IN gckHARDWARE Hardware, |
2044 | IN gctPOINTER Logical, | 1978 | IN gctPOINTER Logical, |
2045 | IN gctUINT32 Offset, | 1979 | IN gctUINT32 Offset, |
2046 | IN OUT gctSIZE_T * Bytes, | 1980 | IN OUT gctUINT32 * Bytes, |
2047 | OUT gctUINT32 * WaitOffset, | 1981 | OUT gctUINT32 * WaitOffset, |
2048 | OUT gctSIZE_T * WaitSize | 1982 | OUT gctUINT32 * WaitSize |
2049 | ) | 1983 | ) |
2050 | { | 1984 | { |
2051 | static const gctUINT waitCount = 200; | 1985 | static const gctUINT waitCount = 200; |
@@ -2053,7 +1987,7 @@ gckHARDWARE_WaitLink( | |||
2053 | gceSTATUS status; | 1987 | gceSTATUS status; |
2054 | gctUINT32 address; | 1988 | gctUINT32 address; |
2055 | gctUINT32_PTR logical; | 1989 | gctUINT32_PTR logical; |
2056 | gctSIZE_T bytes; | 1990 | gctUINT32 bytes; |
2057 | 1991 | ||
2058 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x Offset=0x%08x *Bytes=%lu", | 1992 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x Offset=0x%08x *Bytes=%lu", |
2059 | Hardware, Logical, Offset, gcmOPT_VALUE(Bytes)); | 1993 | Hardware, Logical, Offset, gcmOPT_VALUE(Bytes)); |
@@ -2081,7 +2015,7 @@ gckHARDWARE_WaitLink( | |||
2081 | } | 2015 | } |
2082 | 2016 | ||
2083 | /* Convert logical into hardware specific address. */ | 2017 | /* Convert logical into hardware specific address. */ |
2084 | gcmkONERROR(gckHARDWARE_ConvertLogical(Hardware, logical, &address)); | 2018 | gcmkONERROR(gckHARDWARE_ConvertLogical(Hardware, logical, gcvFALSE, &address)); |
2085 | 2019 | ||
2086 | /* Store the WAIT/LINK address. */ | 2020 | /* Store the WAIT/LINK address. */ |
2087 | Hardware->lastWaitLink = address; | 2021 | Hardware->lastWaitLink = address; |
@@ -2213,7 +2147,7 @@ gceSTATUS | |||
2213 | gckHARDWARE_End( | 2147 | gckHARDWARE_End( |
2214 | IN gckHARDWARE Hardware, | 2148 | IN gckHARDWARE Hardware, |
2215 | IN gctPOINTER Logical, | 2149 | IN gctPOINTER Logical, |
2216 | IN OUT gctSIZE_T * Bytes | 2150 | IN OUT gctUINT32 * Bytes |
2217 | ) | 2151 | ) |
2218 | { | 2152 | { |
2219 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; | 2153 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; |
@@ -2386,101 +2320,6 @@ OnError: | |||
2386 | 2320 | ||
2387 | /******************************************************************************* | 2321 | /******************************************************************************* |
2388 | ** | 2322 | ** |
2389 | ** gckHARDWARE_Wait | ||
2390 | ** | ||
2391 | ** Append a WAIT command at the specified location in the command queue. | ||
2392 | ** | ||
2393 | ** INPUT: | ||
2394 | ** | ||
2395 | ** gckHARDWARE Hardware | ||
2396 | ** Pointer to an gckHARDWARE object. | ||
2397 | ** | ||
2398 | ** gctPOINTER Logical | ||
2399 | ** Pointer to the current location inside the command queue to append | ||
2400 | ** WAIT command at or gcvNULL just to query the size of the WAIT command. | ||
2401 | ** | ||
2402 | ** gctUINT32 Count | ||
2403 | ** Number of cycles to wait. | ||
2404 | ** | ||
2405 | ** gctSIZE_T * Bytes | ||
2406 | ** Pointer to the number of bytes available for the WAIT command. If | ||
2407 | ** 'Logical' is gcvNULL, this argument will be ignored. | ||
2408 | ** | ||
2409 | ** OUTPUT: | ||
2410 | ** | ||
2411 | ** gctSIZE_T * Bytes | ||
2412 | ** Pointer to a variable that will receive the number of bytes required | ||
2413 | ** for the NOP command. If 'Bytes' is gcvNULL, nothing will be returned. | ||
2414 | */ | ||
2415 | gceSTATUS | ||
2416 | gckHARDWARE_Wait( | ||
2417 | IN gckHARDWARE Hardware, | ||
2418 | IN gctPOINTER Logical, | ||
2419 | IN gctUINT32 Count, | ||
2420 | IN OUT gctSIZE_T * Bytes | ||
2421 | ) | ||
2422 | { | ||
2423 | gceSTATUS status; | ||
2424 | gctUINT32_PTR logical; | ||
2425 | |||
2426 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x Count=%u *Bytes=%lu", | ||
2427 | Hardware, Logical, Count, gcmOPT_VALUE(Bytes)); | ||
2428 | |||
2429 | /* Verify the arguments. */ | ||
2430 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | ||
2431 | gcmkVERIFY_ARGUMENT((Logical == gcvNULL) || (Bytes != gcvNULL)); | ||
2432 | |||
2433 | /* Cast the input pointer. */ | ||
2434 | logical = (gctUINT32_PTR) Logical; | ||
2435 | |||
2436 | if (Logical != gcvNULL) | ||
2437 | { | ||
2438 | if (*Bytes < 8) | ||
2439 | { | ||
2440 | /* Command queue too small. */ | ||
2441 | gcmkONERROR(gcvSTATUS_BUFFER_TOO_SMALL); | ||
2442 | } | ||
2443 | |||
2444 | /* Append WAIT. */ | ||
2445 | logical[0] = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x07 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | ||
2446 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (Count) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))); | ||
2447 | |||
2448 | #if gcmIS_DEBUG(gcdDEBUG_TRACE) | ||
2449 | { | ||
2450 | gctUINT32 address; | ||
2451 | |||
2452 | /* Convert logical into hardware specific address. */ | ||
2453 | gcmkONERROR(gckHARDWARE_ConvertLogical( | ||
2454 | Hardware, logical, &address | ||
2455 | )); | ||
2456 | |||
2457 | gcmkTRACE_ZONE( | ||
2458 | gcvLEVEL_INFO, gcvZONE_HARDWARE, | ||
2459 | "0x%08x: WAIT %u", address, Count | ||
2460 | ); | ||
2461 | } | ||
2462 | #endif | ||
2463 | } | ||
2464 | |||
2465 | if (Bytes != gcvNULL) | ||
2466 | { | ||
2467 | /* Return number of bytes required by the WAIT command. */ | ||
2468 | *Bytes = 8; | ||
2469 | } | ||
2470 | |||
2471 | /* Success. */ | ||
2472 | gcmkFOOTER_ARG("*Bytes=%lu", gcmOPT_VALUE(Bytes)); | ||
2473 | return gcvSTATUS_OK; | ||
2474 | |||
2475 | OnError: | ||
2476 | /* Return the status. */ | ||
2477 | gcmkFOOTER(); | ||
2478 | return status; | ||
2479 | } | ||
2480 | |||
2481 | |||
2482 | /******************************************************************************* | ||
2483 | ** | ||
2484 | ** gckHARDWARE_Event | 2323 | ** gckHARDWARE_Event |
2485 | ** | 2324 | ** |
2486 | ** Append an EVENT command at the specified location in the command queue. | 2325 | ** Append an EVENT command at the specified location in the command queue. |
@@ -2518,7 +2357,7 @@ gckHARDWARE_Event( | |||
2518 | IN gctPOINTER Logical, | 2357 | IN gctPOINTER Logical, |
2519 | IN gctUINT8 Event, | 2358 | IN gctUINT8 Event, |
2520 | IN gceKERNEL_WHERE FromWhere, | 2359 | IN gceKERNEL_WHERE FromWhere, |
2521 | IN OUT gctSIZE_T * Bytes | 2360 | IN OUT gctUINT32 * Bytes |
2522 | ) | 2361 | ) |
2523 | { | 2362 | { |
2524 | gctUINT size; | 2363 | gctUINT size; |
@@ -2534,6 +2373,11 @@ gckHARDWARE_Event( | |||
2534 | gcmkVERIFY_ARGUMENT((Logical == gcvNULL) || (Bytes != gcvNULL)); | 2373 | gcmkVERIFY_ARGUMENT((Logical == gcvNULL) || (Bytes != gcvNULL)); |
2535 | gcmkVERIFY_ARGUMENT(Event < 32); | 2374 | gcmkVERIFY_ARGUMENT(Event < 32); |
2536 | 2375 | ||
2376 | |||
2377 | #if gcdMULTI_GPU | ||
2378 | if (FromWhere == gcvKERNEL_COMMAND) FromWhere = gcvKERNEL_PIXEL; | ||
2379 | #endif | ||
2380 | |||
2537 | /* Determine the size of the command. */ | 2381 | /* Determine the size of the command. */ |
2538 | 2382 | ||
2539 | size = (Hardware->extraEventStates && (FromWhere == gcvKERNEL_PIXEL)) | 2383 | size = (Hardware->extraEventStates && (FromWhere == gcvKERNEL_PIXEL)) |
@@ -2652,7 +2496,7 @@ gckHARDWARE_PipeSelect( | |||
2652 | IN gckHARDWARE Hardware, | 2496 | IN gckHARDWARE Hardware, |
2653 | IN gctPOINTER Logical, | 2497 | IN gctPOINTER Logical, |
2654 | IN gcePIPE_SELECT Pipe, | 2498 | IN gcePIPE_SELECT Pipe, |
2655 | IN OUT gctSIZE_T * Bytes | 2499 | IN OUT gctUINT32 * Bytes |
2656 | ) | 2500 | ) |
2657 | { | 2501 | { |
2658 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; | 2502 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; |
@@ -2761,8 +2605,8 @@ OnError: | |||
2761 | ** the LINK command at or gcvNULL just to query the size of the LINK | 2605 | ** the LINK command at or gcvNULL just to query the size of the LINK |
2762 | ** command. | 2606 | ** command. |
2763 | ** | 2607 | ** |
2764 | ** gctPOINTER FetchAddress | 2608 | ** gctUINT32 FetchAddress |
2765 | ** Logical address of destination of LINK. | 2609 | ** Hardware address of destination of LINK. |
2766 | ** | 2610 | ** |
2767 | ** gctSIZE_T FetchSize | 2611 | ** gctSIZE_T FetchSize |
2768 | ** Number of bytes in destination of LINK. | 2612 | ** Number of bytes in destination of LINK. |
@@ -2781,14 +2625,13 @@ gceSTATUS | |||
2781 | gckHARDWARE_Link( | 2625 | gckHARDWARE_Link( |
2782 | IN gckHARDWARE Hardware, | 2626 | IN gckHARDWARE Hardware, |
2783 | IN gctPOINTER Logical, | 2627 | IN gctPOINTER Logical, |
2784 | IN gctPOINTER FetchAddress, | 2628 | IN gctUINT32 FetchAddress, |
2785 | IN gctSIZE_T FetchSize, | 2629 | IN gctUINT32 FetchSize, |
2786 | IN OUT gctSIZE_T * Bytes | 2630 | IN OUT gctUINT32 * Bytes |
2787 | ) | 2631 | ) |
2788 | { | 2632 | { |
2789 | gceSTATUS status; | 2633 | gceSTATUS status; |
2790 | gctSIZE_T bytes; | 2634 | gctSIZE_T bytes; |
2791 | gctUINT32 address; | ||
2792 | gctUINT32 link; | 2635 | gctUINT32 link; |
2793 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; | 2636 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; |
2794 | 2637 | ||
@@ -2809,19 +2652,15 @@ gckHARDWARE_Link( | |||
2809 | gcmkONERROR(gcvSTATUS_BUFFER_TOO_SMALL); | 2652 | gcmkONERROR(gcvSTATUS_BUFFER_TOO_SMALL); |
2810 | } | 2653 | } |
2811 | 2654 | ||
2812 | /* Convert logical address to hardware address. */ | ||
2813 | gcmkONERROR( | 2655 | gcmkONERROR( |
2814 | gckHARDWARE_ConvertLogical(Hardware, FetchAddress, &address)); | 2656 | gckOS_WriteMemory(Hardware->os, logical + 1, FetchAddress)); |
2815 | |||
2816 | gcmkONERROR( | ||
2817 | gckOS_WriteMemory(Hardware->os, logical + 1, address)); | ||
2818 | 2657 | ||
2819 | /* Make sure the address got written before the LINK command. */ | 2658 | /* Make sure the address got written before the LINK command. */ |
2820 | gcmkONERROR( | 2659 | gcmkONERROR( |
2821 | gckOS_MemoryBarrier(Hardware->os, logical + 1)); | 2660 | gckOS_MemoryBarrier(Hardware->os, logical + 1)); |
2822 | 2661 | ||
2823 | /* Compute number of 64-byte aligned bytes to fetch. */ | 2662 | /* Compute number of 64-byte aligned bytes to fetch. */ |
2824 | bytes = gcmALIGN(address + FetchSize, 64) - address; | 2663 | bytes = gcmALIGN(FetchAddress + FetchSize, 64) - FetchAddress; |
2825 | 2664 | ||
2826 | /* Append LINK(bytes / 8), FetchAddress. */ | 2665 | /* Append LINK(bytes / 8), FetchAddress. */ |
2827 | link = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x08 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | 2666 | link = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x08 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) |
@@ -2849,7 +2688,8 @@ gckHARDWARE_Link( | |||
2849 | /* Record user command buffer and context buffer link | 2688 | /* Record user command buffer and context buffer link |
2850 | ** information for stuck dump. | 2689 | ** information for stuck dump. |
2851 | **/ | 2690 | **/ |
2852 | gckLINKQUEUE_Enqueue(&Hardware->linkQueue, address, address + bytes); | 2691 | gckLINKQUEUE_Enqueue( |
2692 | &Hardware->linkQueue, FetchAddress, FetchAddress + (gctUINT)bytes); | ||
2853 | } | 2693 | } |
2854 | } | 2694 | } |
2855 | #endif | 2695 | #endif |
@@ -2954,6 +2794,9 @@ OnError: | |||
2954 | ** gctPOINTER Logical | 2794 | ** gctPOINTER Logical |
2955 | ** Logical address to convert. | 2795 | ** Logical address to convert. |
2956 | ** | 2796 | ** |
2797 | ** gctBOOL InUserSpace | ||
2798 | ** gcvTRUE if the memory in user space. | ||
2799 | ** | ||
2957 | ** gctUINT32* Address | 2800 | ** gctUINT32* Address |
2958 | ** Return hardware specific address. | 2801 | ** Return hardware specific address. |
2959 | ** | 2802 | ** |
@@ -2965,102 +2808,36 @@ gceSTATUS | |||
2965 | gckHARDWARE_ConvertLogical( | 2808 | gckHARDWARE_ConvertLogical( |
2966 | IN gckHARDWARE Hardware, | 2809 | IN gckHARDWARE Hardware, |
2967 | IN gctPOINTER Logical, | 2810 | IN gctPOINTER Logical, |
2811 | IN gctBOOL InUserSpace, | ||
2968 | OUT gctUINT32 * Address | 2812 | OUT gctUINT32 * Address |
2969 | ) | 2813 | ) |
2970 | { | 2814 | { |
2971 | gctUINT32 address; | 2815 | gctUINT32 address; |
2972 | gceSTATUS status = gcvSTATUS_INVALID_ADDRESS; | 2816 | gceSTATUS status; |
2973 | gctUINT32 baseAddress; | 2817 | gctUINT32 baseAddress; |
2974 | 2818 | ||
2975 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x", Hardware, Logical); | 2819 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x InUserSpace=%d", |
2820 | Hardware, Logical, InUserSpace); | ||
2976 | 2821 | ||
2977 | /* Verify the arguments. */ | 2822 | /* Verify the arguments. */ |
2978 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | 2823 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); |
2979 | gcmkVERIFY_ARGUMENT(Logical != gcvNULL); | 2824 | gcmkVERIFY_ARGUMENT(Logical != gcvNULL); |
2980 | gcmkVERIFY_ARGUMENT(Address != gcvNULL); | 2825 | gcmkVERIFY_ARGUMENT(Address != gcvNULL); |
2981 | 2826 | ||
2982 | if (Hardware->kernel->virtualCommandBuffer) | 2827 | /* Convert logical address into a physical address. */ |
2828 | if (InUserSpace) | ||
2983 | { | 2829 | { |
2984 | status = gckKERNEL_GetGPUAddress(Hardware->kernel, Logical, Address); | 2830 | gcmkONERROR(gckOS_UserLogicalToPhysical(Hardware->os, Logical, &address)); |
2985 | } | 2831 | } |
2986 | 2832 | else | |
2987 | if (status == gcvSTATUS_INVALID_ADDRESS) | ||
2988 | { | 2833 | { |
2989 | /* Convert logical address into a physical address. */ | 2834 | gcmkONERROR(gckOS_GetPhysicalAddress(Hardware->os, Logical, &address)); |
2990 | gcmkONERROR( | ||
2991 | gckOS_GetPhysicalAddress(Hardware->os, Logical, &address)); | ||
2992 | |||
2993 | /* For old MMU, get GPU address according to baseAddress. */ | ||
2994 | if (Hardware->mmuVersion == 0) | ||
2995 | { | ||
2996 | gcmkONERROR(gckOS_GetBaseAddress(Hardware->os, &baseAddress)); | ||
2997 | |||
2998 | /* Subtract base address to get a GPU address. */ | ||
2999 | gcmkASSERT(address >= baseAddress); | ||
3000 | address -= baseAddress; | ||
3001 | } | ||
3002 | |||
3003 | /* Return hardware specific address. */ | ||
3004 | *Address = (Hardware->mmuVersion == 0) | ||
3005 | ? ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) << (0 ? 31:31))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) << (0 ? 31:31))) | ||
3006 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 30:0) - (0 ? 30:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:0) - (0 ? 30:0) + 1))))))) << (0 ? 30:0))) | (((gctUINT32) ((gctUINT32) (address) & ((gctUINT32) ((((1 ? 30:0) - (0 ? 30:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:0) - (0 ? 30:0) + 1))))))) << (0 ? 30:0))) | ||
3007 | : address; | ||
3008 | } | 2835 | } |
3009 | 2836 | ||
3010 | /* Success. */ | ||
3011 | gcmkFOOTER_ARG("*Address=0x%08x", *Address); | ||
3012 | return gcvSTATUS_OK; | ||
3013 | |||
3014 | OnError: | ||
3015 | /* Return the status. */ | ||
3016 | gcmkFOOTER(); | ||
3017 | return status; | ||
3018 | } | ||
3019 | |||
3020 | /******************************************************************************* | ||
3021 | ** | ||
3022 | ** gckHARDWARE_ConvertPhysical | ||
3023 | ** | ||
3024 | ** Convert a physical address into a hardware specific address. | ||
3025 | ** | ||
3026 | ** INPUT: | ||
3027 | ** | ||
3028 | ** gckHARDWARE Hardware | ||
3029 | ** Pointer to an gckHARDWARE object. | ||
3030 | ** | ||
3031 | ** gctPHYS_ADDR Physical | ||
3032 | ** Physical address to convert. | ||
3033 | ** | ||
3034 | ** gctUINT32* Address | ||
3035 | ** Return hardware specific address. | ||
3036 | ** | ||
3037 | ** OUTPUT: | ||
3038 | ** | ||
3039 | ** Nothing. | ||
3040 | */ | ||
3041 | gceSTATUS | ||
3042 | gckHARDWARE_ConvertPhysical( | ||
3043 | IN gckHARDWARE Hardware, | ||
3044 | IN gctPHYS_ADDR Physical, | ||
3045 | OUT gctUINT32 * Address | ||
3046 | ) | ||
3047 | { | ||
3048 | gctUINT32 address; | ||
3049 | gctUINT32 baseAddress; | ||
3050 | |||
3051 | gcmkHEADER_ARG("Hardware=0x%x Physical=0x%x", Hardware, Physical); | ||
3052 | |||
3053 | /* Verify the arguments. */ | ||
3054 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | ||
3055 | gcmkVERIFY_ARGUMENT(Physical != gcvNULL); | ||
3056 | gcmkVERIFY_ARGUMENT(Address != gcvNULL); | ||
3057 | |||
3058 | address = gcmPTR2INT(Physical); | ||
3059 | |||
3060 | /* For old MMU, get GPU address according to baseAddress. */ | 2837 | /* For old MMU, get GPU address according to baseAddress. */ |
3061 | if (Hardware->mmuVersion == 0) | 2838 | if (Hardware->mmuVersion == 0) |
3062 | { | 2839 | { |
3063 | gcmkVERIFY_OK(gckOS_GetBaseAddress(Hardware->os, &baseAddress)); | 2840 | gcmkONERROR(gckOS_GetBaseAddress(Hardware->os, &baseAddress)); |
3064 | 2841 | ||
3065 | /* Subtract base address to get a GPU address. */ | 2842 | /* Subtract base address to get a GPU address. */ |
3066 | gcmkASSERT(address >= baseAddress); | 2843 | gcmkASSERT(address >= baseAddress); |
@@ -3073,9 +2850,14 @@ gckHARDWARE_ConvertPhysical( | |||
3073 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 30:0) - (0 ? 30:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:0) - (0 ? 30:0) + 1))))))) << (0 ? 30:0))) | (((gctUINT32) ((gctUINT32) (address) & ((gctUINT32) ((((1 ? 30:0) - (0 ? 30:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:0) - (0 ? 30:0) + 1))))))) << (0 ? 30:0))) | 2850 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 30:0) - (0 ? 30:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:0) - (0 ? 30:0) + 1))))))) << (0 ? 30:0))) | (((gctUINT32) ((gctUINT32) (address) & ((gctUINT32) ((((1 ? 30:0) - (0 ? 30:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:0) - (0 ? 30:0) + 1))))))) << (0 ? 30:0))) |
3074 | : address; | 2851 | : address; |
3075 | 2852 | ||
3076 | /* Return the status. */ | 2853 | /* Success. */ |
3077 | gcmkFOOTER_ARG("*Address=0x%08x", *Address); | 2854 | gcmkFOOTER_ARG("*Address=0x%08x", *Address); |
3078 | return gcvSTATUS_OK; | 2855 | return gcvSTATUS_OK; |
2856 | |||
2857 | OnError: | ||
2858 | /* Return the status. */ | ||
2859 | gcmkFOOTER(); | ||
2860 | return status; | ||
3079 | } | 2861 | } |
3080 | 2862 | ||
3081 | /******************************************************************************* | 2863 | /******************************************************************************* |
@@ -3205,9 +2987,9 @@ OnError: | |||
3205 | gceSTATUS | 2987 | gceSTATUS |
3206 | gckHARDWARE_QueryCommandBuffer( | 2988 | gckHARDWARE_QueryCommandBuffer( |
3207 | IN gckHARDWARE Hardware, | 2989 | IN gckHARDWARE Hardware, |
3208 | OUT gctSIZE_T * Alignment, | 2990 | OUT gctUINT32 * Alignment, |
3209 | OUT gctSIZE_T * ReservedHead, | 2991 | OUT gctUINT32 * ReservedHead, |
3210 | OUT gctSIZE_T * ReservedTail | 2992 | OUT gctUINT32 * ReservedTail |
3211 | ) | 2993 | ) |
3212 | { | 2994 | { |
3213 | gcmkHEADER_ARG("Hardware=0x%x", Hardware); | 2995 | gcmkHEADER_ARG("Hardware=0x%x", Hardware); |
@@ -3328,13 +3110,14 @@ gckHARDWARE_QueryShaderCaps( | |||
3328 | gctUINT32 psConstMax; | 3110 | gctUINT32 psConstMax; |
3329 | gctUINT32 vsConstBase; | 3111 | gctUINT32 vsConstBase; |
3330 | gctUINT32 psConstBase; | 3112 | gctUINT32 psConstBase; |
3113 | gctUINT32 ConstMax; | ||
3331 | 3114 | ||
3332 | gcmkHEADER_ARG("Hardware=0x%x VertexUniforms=0x%x " | 3115 | gcmkHEADER_ARG("Hardware=0x%x VertexUniforms=0x%x " |
3333 | "FragmentUniforms=0x%x UnifiedUnforms=0x%x", | 3116 | "FragmentUniforms=0x%x UnifiedUnforms=0x%x", |
3334 | Hardware, VertexUniforms, | 3117 | Hardware, VertexUniforms, |
3335 | FragmentUniforms, UnifiedUnforms); | 3118 | FragmentUniforms, UnifiedUnforms); |
3336 | 3119 | ||
3337 | { if (Hardware->identity.chipModel == gcv2000 && Hardware->identity.chipRevision == 0x5118) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 64; } else if (Hardware->identity.numConstants == 320) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 64; } else if (Hardware->identity.numConstants > 256 && Hardware->identity.chipModel == gcv1000) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 64; } else if (Hardware->identity.numConstants > 256) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 256; } else if (Hardware->identity.numConstants == 256) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 256; } else { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 168; psConstMax = 64; }}; | 3120 | { if (Hardware->identity.chipModel == gcv2000 && Hardware->identity.chipRevision == 0x5118) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 64; ConstMax = 320; } else if (Hardware->identity.numConstants == 320) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 64; ConstMax = 320; } else if (Hardware->identity.numConstants > 256 && Hardware->identity.chipModel == gcv1000) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 64; ConstMax = 320; } else if (Hardware->identity.numConstants > 256) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 256; ConstMax = 512; } else if (Hardware->identity.numConstants == 256) { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 256; psConstMax = 256; ConstMax = 512; } else { unifiedConst = gcvFALSE; vsConstBase = 0x1400; psConstBase = 0x1C00; vsConstMax = 168; psConstMax = 64; ConstMax = 232; }}; |
3338 | 3121 | ||
3339 | if (VertexUniforms != gcvNULL) | 3122 | if (VertexUniforms != gcvNULL) |
3340 | { | 3123 | { |
@@ -3386,7 +3169,6 @@ gckHARDWARE_SetMMU( | |||
3386 | { | 3169 | { |
3387 | gceSTATUS status; | 3170 | gceSTATUS status; |
3388 | gctUINT32 address = 0; | 3171 | gctUINT32 address = 0; |
3389 | gctUINT32 baseAddress; | ||
3390 | 3172 | ||
3391 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x", Hardware, Logical); | 3173 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x", Hardware, Logical); |
3392 | 3174 | ||
@@ -3394,38 +3176,33 @@ gckHARDWARE_SetMMU( | |||
3394 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | 3176 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); |
3395 | gcmkVERIFY_ARGUMENT(Logical != gcvNULL); | 3177 | gcmkVERIFY_ARGUMENT(Logical != gcvNULL); |
3396 | 3178 | ||
3397 | /* Convert the logical address into an hardware address. */ | 3179 | /* Convert the logical address into physical address. */ |
3398 | gcmkONERROR( | 3180 | gcmkONERROR(gckOS_GetPhysicalAddress(Hardware->os, Logical, &address)); |
3399 | gckHARDWARE_ConvertLogical(Hardware, Logical, &address)); | ||
3400 | |||
3401 | /* Also get the base address - we need a real physical address. */ | ||
3402 | gcmkONERROR( | ||
3403 | gckOS_GetBaseAddress(Hardware->os, &baseAddress)); | ||
3404 | 3181 | ||
3405 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | 3182 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, |
3406 | "Setting page table to 0x%08X", | 3183 | "Setting page table to 0x%08X", |
3407 | address + baseAddress); | 3184 | address); |
3408 | 3185 | ||
3409 | /* Write the AQMemoryFePageTable register. */ | 3186 | /* Write the AQMemoryFePageTable register. */ |
3410 | gcmkONERROR( | 3187 | gcmkONERROR( |
3411 | gckOS_WriteRegisterEx(Hardware->os, | 3188 | gckOS_WriteRegisterEx(Hardware->os, |
3412 | Hardware->core, | 3189 | Hardware->core, |
3413 | 0x00400, | 3190 | 0x00400, |
3414 | address + baseAddress)); | 3191 | address)); |
3415 | 3192 | ||
3416 | /* Write the AQMemoryRaPageTable register. */ | 3193 | /* Write the AQMemoryRaPageTable register. */ |
3417 | gcmkONERROR( | 3194 | gcmkONERROR( |
3418 | gckOS_WriteRegisterEx(Hardware->os, | 3195 | gckOS_WriteRegisterEx(Hardware->os, |
3419 | Hardware->core, | 3196 | Hardware->core, |
3420 | 0x00410, | 3197 | 0x00410, |
3421 | address + baseAddress)); | 3198 | address)); |
3422 | 3199 | ||
3423 | /* Write the AQMemoryTxPageTable register. */ | 3200 | /* Write the AQMemoryTxPageTable register. */ |
3424 | gcmkONERROR( | 3201 | gcmkONERROR( |
3425 | gckOS_WriteRegisterEx(Hardware->os, | 3202 | gckOS_WriteRegisterEx(Hardware->os, |
3426 | Hardware->core, | 3203 | Hardware->core, |
3427 | 0x00404, | 3204 | 0x00404, |
3428 | address + baseAddress)); | 3205 | address)); |
3429 | 3206 | ||
3430 | 3207 | ||
3431 | /* Write the AQMemoryPePageTable register. */ | 3208 | /* Write the AQMemoryPePageTable register. */ |
@@ -3433,14 +3210,14 @@ gckHARDWARE_SetMMU( | |||
3433 | gckOS_WriteRegisterEx(Hardware->os, | 3210 | gckOS_WriteRegisterEx(Hardware->os, |
3434 | Hardware->core, | 3211 | Hardware->core, |
3435 | 0x00408, | 3212 | 0x00408, |
3436 | address + baseAddress)); | 3213 | address)); |
3437 | 3214 | ||
3438 | /* Write the AQMemoryPezPageTable register. */ | 3215 | /* Write the AQMemoryPezPageTable register. */ |
3439 | gcmkONERROR( | 3216 | gcmkONERROR( |
3440 | gckOS_WriteRegisterEx(Hardware->os, | 3217 | gckOS_WriteRegisterEx(Hardware->os, |
3441 | Hardware->core, | 3218 | Hardware->core, |
3442 | 0x0040C, | 3219 | 0x0040C, |
3443 | address + baseAddress)); | 3220 | address)); |
3444 | 3221 | ||
3445 | /* Return the status. */ | 3222 | /* Return the status. */ |
3446 | gcmkFOOTER_NO(); | 3223 | gcmkFOOTER_NO(); |
@@ -3475,8 +3252,7 @@ gckHARDWARE_FlushMMU( | |||
3475 | gceSTATUS status; | 3252 | gceSTATUS status; |
3476 | gckCOMMAND command; | 3253 | gckCOMMAND command; |
3477 | gctUINT32_PTR buffer; | 3254 | gctUINT32_PTR buffer; |
3478 | gctSIZE_T bufferSize; | 3255 | gctUINT32 bufferSize; |
3479 | gctBOOL commitEntered = gcvFALSE; | ||
3480 | gctPOINTER pointer = gcvNULL; | 3256 | gctPOINTER pointer = gcvNULL; |
3481 | gctUINT32 flushSize; | 3257 | gctUINT32 flushSize; |
3482 | gctUINT32 count; | 3258 | gctUINT32 count; |
@@ -3490,10 +3266,6 @@ gckHARDWARE_FlushMMU( | |||
3490 | /* Verify the gckCOMMAND object pointer. */ | 3266 | /* Verify the gckCOMMAND object pointer. */ |
3491 | command = Hardware->kernel->command; | 3267 | command = Hardware->kernel->command; |
3492 | 3268 | ||
3493 | /* Acquire the command queue. */ | ||
3494 | gcmkONERROR(gckCOMMAND_EnterCommit(command, gcvFALSE)); | ||
3495 | commitEntered = gcvTRUE; | ||
3496 | |||
3497 | /* Flush the memory controller. */ | 3269 | /* Flush the memory controller. */ |
3498 | if (Hardware->mmuVersion == 0) | 3270 | if (Hardware->mmuVersion == 0) |
3499 | { | 3271 | { |
@@ -3527,7 +3299,7 @@ gckHARDWARE_FlushMMU( | |||
3527 | 3299 | ||
3528 | buffer = (gctUINT32_PTR) pointer; | 3300 | buffer = (gctUINT32_PTR) pointer; |
3529 | 3301 | ||
3530 | count = (bufferSize - flushSize + 7) >> 3; | 3302 | count = ((gctUINT)bufferSize - flushSize + 7) >> 3; |
3531 | 3303 | ||
3532 | gcmkONERROR(gckOS_GetPhysicalAddress(command->os, buffer, &physical)); | 3304 | gcmkONERROR(gckOS_GetPhysicalAddress(command->os, buffer, &physical)); |
3533 | 3305 | ||
@@ -3608,21 +3380,11 @@ gckHARDWARE_FlushMMU( | |||
3608 | gcmkONERROR(gckCOMMAND_Execute(command, flushSize)); | 3380 | gcmkONERROR(gckCOMMAND_Execute(command, flushSize)); |
3609 | } | 3381 | } |
3610 | 3382 | ||
3611 | /* Release the command queue. */ | ||
3612 | gcmkONERROR(gckCOMMAND_ExitCommit(command, gcvFALSE)); | ||
3613 | commitEntered = gcvFALSE; | ||
3614 | |||
3615 | /* Success. */ | 3383 | /* Success. */ |
3616 | gcmkFOOTER_NO(); | 3384 | gcmkFOOTER_NO(); |
3617 | return gcvSTATUS_OK; | 3385 | return gcvSTATUS_OK; |
3618 | 3386 | ||
3619 | OnError: | 3387 | OnError: |
3620 | if (commitEntered) | ||
3621 | { | ||
3622 | /* Release the command queue mutex. */ | ||
3623 | gcmkVERIFY_OK(gckCOMMAND_ExitCommit(Hardware->kernel->command, | ||
3624 | gcvFALSE)); | ||
3625 | } | ||
3626 | 3388 | ||
3627 | /* Return the status. */ | 3389 | /* Return the status. */ |
3628 | gcmkFOOTER(); | 3390 | gcmkFOOTER(); |
@@ -3658,7 +3420,7 @@ gckHARDWARE_SetMMUv2( | |||
3658 | gctUINT32 config, address; | 3420 | gctUINT32 config, address; |
3659 | gckCOMMAND command; | 3421 | gckCOMMAND command; |
3660 | gctUINT32_PTR buffer; | 3422 | gctUINT32_PTR buffer; |
3661 | gctSIZE_T bufferSize; | 3423 | gctUINT32 bufferSize; |
3662 | gctBOOL commitEntered = gcvFALSE; | 3424 | gctBOOL commitEntered = gcvFALSE; |
3663 | gctPOINTER pointer = gcvNULL; | 3425 | gctPOINTER pointer = gcvNULL; |
3664 | gctBOOL acquired = gcvFALSE; | 3426 | gctBOOL acquired = gcvFALSE; |
@@ -4300,15 +4062,18 @@ gckHARDWARE_Flush( | |||
4300 | IN gckHARDWARE Hardware, | 4062 | IN gckHARDWARE Hardware, |
4301 | IN gceKERNEL_FLUSH Flush, | 4063 | IN gceKERNEL_FLUSH Flush, |
4302 | IN gctPOINTER Logical, | 4064 | IN gctPOINTER Logical, |
4303 | IN OUT gctSIZE_T * Bytes | 4065 | IN OUT gctUINT32 * Bytes |
4304 | ) | 4066 | ) |
4305 | { | 4067 | { |
4306 | gctUINT32 pipe; | 4068 | gctUINT32 pipe; |
4307 | gctUINT32 flush = 0; | 4069 | gctUINT32 flush = 0; |
4070 | gctBOOL flushTileStatus; | ||
4308 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; | 4071 | gctUINT32_PTR logical = (gctUINT32_PTR) Logical; |
4309 | gceSTATUS status; | 4072 | gceSTATUS status; |
4310 | gctBOOL fcFlushStall; | 4073 | gctBOOL fcFlushStall; |
4311 | gctUINT32 reserveBytes = 8; | 4074 | gctUINT32 reserveBytes |
4075 | /* Semaphore/Stall */ | ||
4076 | = 4 * gcmSIZEOF(gctUINT32); | ||
4312 | 4077 | ||
4313 | gcmkHEADER_ARG("Hardware=0x%x Flush=0x%x Logical=0x%x *Bytes=%lu", | 4078 | gcmkHEADER_ARG("Hardware=0x%x Flush=0x%x Logical=0x%x *Bytes=%lu", |
4314 | Hardware, Flush, Logical, gcmOPT_VALUE(Bytes)); | 4079 | Hardware, Flush, Logical, gcmOPT_VALUE(Bytes)); |
@@ -4320,14 +4085,10 @@ gckHARDWARE_Flush( | |||
4320 | pipe = Hardware->kernel->command->pipeSelect; | 4085 | pipe = Hardware->kernel->command->pipeSelect; |
4321 | 4086 | ||
4322 | fcFlushStall | 4087 | fcFlushStall |
4323 | = ((((gctUINT32) (Hardware->identity.chipMinorFeatures1)) >> (0 ? 31:31) & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) | 4088 | = ((((gctUINT32) (Hardware->identity.chipMinorFeatures1)) >> (0 ? 31:31) & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))); |
4324 | && (Flush == gcvFLUSH_ALL) | ||
4325 | ; | ||
4326 | 4089 | ||
4327 | if (fcFlushStall) | 4090 | /* Flush tile status cache. */ |
4328 | { | 4091 | flushTileStatus = (Flush & gcvFLUSH_TILE_STATUS) && fcFlushStall; |
4329 | reserveBytes += 8; | ||
4330 | } | ||
4331 | 4092 | ||
4332 | /* Flush 3D color cache. */ | 4093 | /* Flush 3D color cache. */ |
4333 | if ((Flush & gcvFLUSH_COLOR) && (pipe == 0x0)) | 4094 | if ((Flush & gcvFLUSH_COLOR) && (pipe == 0x0)) |
@@ -4361,8 +4122,19 @@ gckHARDWARE_Flush( | |||
4361 | } | 4122 | } |
4362 | #endif | 4123 | #endif |
4363 | 4124 | ||
4125 | /* Determine reserve bytes. */ | ||
4126 | if (flush) | ||
4127 | { | ||
4128 | reserveBytes += 2 * gcmSIZEOF(gctUINT32); | ||
4129 | } | ||
4130 | |||
4131 | if (flushTileStatus) | ||
4132 | { | ||
4133 | reserveBytes += 2 * gcmSIZEOF(gctUINT32); | ||
4134 | } | ||
4135 | |||
4364 | /* See if there is a valid flush. */ | 4136 | /* See if there is a valid flush. */ |
4365 | if (flush == 0) | 4137 | if ((flush == 0) && (flushTileStatus == gcvFALSE)) |
4366 | { | 4138 | { |
4367 | if (Bytes != gcvNULL) | 4139 | if (Bytes != gcvNULL) |
4368 | { | 4140 | { |
@@ -4382,29 +4154,52 @@ gckHARDWARE_Flush( | |||
4382 | gcmkONERROR(gcvSTATUS_BUFFER_TOO_SMALL); | 4154 | gcmkONERROR(gcvSTATUS_BUFFER_TOO_SMALL); |
4383 | } | 4155 | } |
4384 | 4156 | ||
4385 | /* Append LOAD_STATE to AQFlush. */ | 4157 | if (flush) |
4386 | logical[0] = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | 4158 | { |
4387 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0E03) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | 4159 | /* Append LOAD_STATE to AQFlush. */ |
4388 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); | 4160 | *logical++ |
4161 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | ||
4162 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0E03) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | ||
4163 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); | ||
4389 | 4164 | ||
4390 | logical[1] = flush; | 4165 | *logical++ |
4166 | = flush; | ||
4391 | 4167 | ||
4392 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | 4168 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, |
4393 | "0x%x: FLUSH 0x%x", logical, flush); | 4169 | "0x%x: FLUSH 0x%x", logical - 1, flush); |
4170 | } | ||
4394 | 4171 | ||
4395 | if (fcFlushStall) | 4172 | if (flushTileStatus) |
4396 | { | 4173 | { |
4397 | logical[2] = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | 4174 | *logical++ |
4398 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0594) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | 4175 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) |
4399 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); | 4176 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0594) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) |
4400 | 4177 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); | |
4401 | logical[3] = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))); | ||
4402 | 4178 | ||
4179 | *logical++ | ||
4180 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))); | ||
4403 | 4181 | ||
4404 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | 4182 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, |
4405 | "0x%x: FLUSH 0x%x", logical + 3, logical[3]); | 4183 | "0x%x: FLUSH TILE STATUS 0x%x", logical - 1, logical[-1]); |
4406 | } | 4184 | } |
4407 | 4185 | ||
4186 | /* Semaphore. */ | ||
4187 | *logical++ | ||
4188 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | ||
4189 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | ||
4190 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (0x0E02) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))); | ||
4191 | |||
4192 | *logical++ | ||
4193 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32) (0x01 & ((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | ||
4194 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8))) | (((gctUINT32) (0x07 & ((gctUINT32) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8))); | ||
4195 | |||
4196 | /* Stall. */ | ||
4197 | *logical++ | ||
4198 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))) | (((gctUINT32) (0x09 & ((gctUINT32) ((((1 ? 31:27) - (0 ? 31:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:27) - (0 ? 31:27) + 1))))))) << (0 ? 31:27))); | ||
4199 | |||
4200 | *logical++ | ||
4201 | = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32) (0x05 & ((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | ||
4202 | | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8))) | (((gctUINT32) (0x07 & ((gctUINT32) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8))); | ||
4408 | } | 4203 | } |
4409 | 4204 | ||
4410 | if (Bytes != gcvNULL) | 4205 | if (Bytes != gcvNULL) |
@@ -4570,7 +4365,7 @@ gckHARDWARE_SetPowerManagementState( | |||
4570 | gckOS os; | 4365 | gckOS os; |
4571 | gctUINT flag, clock; | 4366 | gctUINT flag, clock; |
4572 | gctPOINTER buffer; | 4367 | gctPOINTER buffer; |
4573 | gctSIZE_T bytes, requested; | 4368 | gctUINT32 bytes, requested; |
4574 | gctBOOL acquired = gcvFALSE; | 4369 | gctBOOL acquired = gcvFALSE; |
4575 | gctBOOL mutexAcquired = gcvFALSE; | 4370 | gctBOOL mutexAcquired = gcvFALSE; |
4576 | gctBOOL stall = gcvTRUE; | 4371 | gctBOOL stall = gcvTRUE; |
@@ -5499,7 +5294,7 @@ gckHARDWARE_SetGpuProfiler( | |||
5499 | 5294 | ||
5500 | if (GpuProfiler == gcvTRUE) | 5295 | if (GpuProfiler == gcvTRUE) |
5501 | { | 5296 | { |
5502 | gctUINT32 data; | 5297 | gctUINT32 data = 0; |
5503 | 5298 | ||
5504 | /* Need to disable clock gating when doing profiling. */ | 5299 | /* Need to disable clock gating when doing profiling. */ |
5505 | gcmkVERIFY_OK( | 5300 | gcmkVERIFY_OK( |
@@ -6245,7 +6040,7 @@ gckHARDWARE_UpdateContextProfile( | |||
6245 | gcsPROFILER_COUNTERS * profiler = &Context->latestProfiler; | 6040 | gcsPROFILER_COUNTERS * profiler = &Context->latestProfiler; |
6246 | gcsPROFILER_COUNTERS * profilerHistroy = &Context->histroyProfiler; | 6041 | gcsPROFILER_COUNTERS * profilerHistroy = &Context->histroyProfiler; |
6247 | gctUINT i, clock; | 6042 | gctUINT i, clock; |
6248 | gctUINT32 colorKilled, colorDrawn, depthKilled, depthDrawn; | 6043 | gctUINT32 colorKilled = 0, colorDrawn = 0, depthKilled = 0, depthDrawn = 0; |
6249 | gctUINT32 totalRead, totalWrite; | 6044 | gctUINT32 totalRead, totalWrite; |
6250 | gceCHIPMODEL chipModel; | 6045 | gceCHIPMODEL chipModel; |
6251 | gctUINT32 chipRevision; | 6046 | gctUINT32 chipRevision; |
@@ -6349,8 +6144,6 @@ gckHARDWARE_UpdateContextProfile( | |||
6349 | clock)); | 6144 | clock)); |
6350 | 6145 | ||
6351 | 6146 | ||
6352 | |||
6353 | |||
6354 | /* Reset counters. */ | 6147 | /* Reset counters. */ |
6355 | gcmkONERROR( | 6148 | gcmkONERROR( |
6356 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x0003C, 1)); | 6149 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x0003C, 1)); |
@@ -6577,6 +6370,34 @@ OnError: | |||
6577 | } | 6370 | } |
6578 | #endif | 6371 | #endif |
6579 | 6372 | ||
6373 | |||
6374 | #if VIVANTE_PROFILER_NEW | ||
6375 | gceSTATUS | ||
6376 | gckHARDWARE_InitProfiler( | ||
6377 | IN gckHARDWARE Hardware | ||
6378 | ) | ||
6379 | { | ||
6380 | gceSTATUS status; | ||
6381 | gctUINT32 control; | ||
6382 | |||
6383 | gcmkHEADER_ARG("Hardware=0x%x", Hardware); | ||
6384 | gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, | ||
6385 | Hardware->core, | ||
6386 | 0x00000, | ||
6387 | &control)); | ||
6388 | /* Enable debug register. */ | ||
6389 | gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, | ||
6390 | Hardware->core, | ||
6391 | 0x00000, | ||
6392 | ((((gctUINT32) (control)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 11:11) - (0 ? 11:11) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:11) - (0 ? 11:11) + 1))))))) << (0 ? 11:11))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 11:11) - (0 ? 11:11) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 11:11) - (0 ? 11:11) + 1))))))) << (0 ? 11:11))))); | ||
6393 | |||
6394 | OnError: | ||
6395 | /* Return the status. */ | ||
6396 | gcmkFOOTER(); | ||
6397 | return status; | ||
6398 | } | ||
6399 | #endif | ||
6400 | |||
6580 | static gceSTATUS | 6401 | static gceSTATUS |
6581 | _ResetGPU( | 6402 | _ResetGPU( |
6582 | IN gckHARDWARE Hardware, | 6403 | IN gckHARDWARE Hardware, |
@@ -7068,6 +6889,18 @@ gckHARDWARE_IsFeatureAvailable( | |||
7068 | available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures)) >> (0 ? 22:22) & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1))))))); | 6889 | available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures)) >> (0 ? 22:22) & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 22:22) - (0 ? 22:22) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:22) - (0 ? 22:22) + 1))))))); |
7069 | break; | 6890 | break; |
7070 | 6891 | ||
6892 | case gcvFEATURE_EARLY_Z: | ||
6893 | available = ((((gctUINT32) (Hardware->identity.chipFeatures)) >> (0 ? 16:16) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))) == (0x0 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))); | ||
6894 | break; | ||
6895 | |||
6896 | case gcvFEATURE_HZ: | ||
6897 | available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures)) >> (0 ? 27:27) & ((gctUINT32) ((((1 ? 27:27) - (0 ? 27:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:27) - (0 ? 27:27) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 27:27) - (0 ? 27:27) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 27:27) - (0 ? 27:27) + 1))))))); | ||
6898 | break; | ||
6899 | |||
6900 | case gcvFEATURE_NEW_HZ: | ||
6901 | available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures3)) >> (0 ? 26:26) & ((gctUINT32) ((((1 ? 26:26) - (0 ? 26:26) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 26:26) - (0 ? 26:26) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 26:26) - (0 ? 26:26) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 26:26) - (0 ? 26:26) + 1))))))); | ||
6902 | break; | ||
6903 | |||
7071 | case gcvFEATURE_FAST_MSAA: | 6904 | case gcvFEATURE_FAST_MSAA: |
7072 | available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures3)) >> (0 ? 8:8) & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1))))))); | 6905 | available = ((((gctUINT32) (Hardware->identity.chipMinorFeatures3)) >> (0 ? 8:8) & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1))))))); |
7073 | break; | 6906 | break; |
@@ -7112,8 +6945,8 @@ gckHARDWARE_IsFeatureAvailable( | |||
7112 | } | 6945 | } |
7113 | 6946 | ||
7114 | /* Return result. */ | 6947 | /* Return result. */ |
7115 | gcmkFOOTER_ARG("%d", available ? gcvSTATUS_TRUE : gcvSTATUS_OK); | 6948 | gcmkFOOTER_ARG("%d", available ? gcvSTATUS_TRUE : gcvSTATUS_FALSE); |
7116 | return available ? gcvSTATUS_TRUE : gcvSTATUS_OK; | 6949 | return available ? gcvSTATUS_TRUE : gcvSTATUS_FALSE; |
7117 | } | 6950 | } |
7118 | 6951 | ||
7119 | /******************************************************************************* | 6952 | /******************************************************************************* |
@@ -7136,8 +6969,13 @@ gckHARDWARE_DumpMMUException( | |||
7136 | IN gckHARDWARE Hardware | 6969 | IN gckHARDWARE Hardware |
7137 | ) | 6970 | ) |
7138 | { | 6971 | { |
7139 | gctUINT32 mmu, mmuStatus, address, i; | 6972 | gctUINT32 mmu = 0; |
7140 | gctUINT32 mtlb, stlb, offset; | 6973 | gctUINT32 mmuStatus = 0; |
6974 | gctUINT32 address = 0; | ||
6975 | gctUINT32 i = 0; | ||
6976 | gctUINT32 mtlb = 0; | ||
6977 | gctUINT32 stlb = 0; | ||
6978 | gctUINT32 offset = 0; | ||
7141 | #if gcdPROCESS_ADDRESS_SPACE | 6979 | #if gcdPROCESS_ADDRESS_SPACE |
7142 | gcsDATABASE_PTR database; | 6980 | gcsDATABASE_PTR database; |
7143 | #endif | 6981 | #endif |
@@ -7308,16 +7146,16 @@ gckHARDWARE_DumpGPUState( | |||
7308 | }; | 7146 | }; |
7309 | 7147 | ||
7310 | gceSTATUS status; | 7148 | gceSTATUS status; |
7311 | gckKERNEL kernel; | 7149 | gckKERNEL kernel = gcvNULL; |
7312 | gctUINT32 idle, axi; | 7150 | gctUINT32 idle = 0, axi = 0; |
7313 | gctUINT32 dmaAddress1, dmaAddress2; | 7151 | gctUINT32 dmaAddress1 = 0, dmaAddress2 = 0; |
7314 | gctUINT32 dmaState1, dmaState2; | 7152 | gctUINT32 dmaState1 = 0, dmaState2 = 0; |
7315 | gctUINT32 dmaLow, dmaHigh; | 7153 | gctUINT32 dmaLow = 0, dmaHigh = 0; |
7316 | gctUINT32 cmdState, cmdDmaState, cmdFetState; | 7154 | gctUINT32 cmdState = 0, cmdDmaState = 0, cmdFetState = 0; |
7317 | gctUINT32 dmaReqState, calState, veReqState; | 7155 | gctUINT32 dmaReqState = 0, calState = 0, veReqState = 0; |
7318 | gctUINT i; | 7156 | gctUINT i; |
7319 | gctUINT pipe, pixelPipes; | 7157 | gctUINT pipe = 0, pixelPipes = 0; |
7320 | gctUINT32 control, oldControl; | 7158 | gctUINT32 control = 0, oldControl = 0; |
7321 | gckOS os = Hardware->os; | 7159 | gckOS os = Hardware->os; |
7322 | gceCORE core = Hardware->core; | 7160 | gceCORE core = Hardware->core; |
7323 | 7161 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.h b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.h index e3f9c6f9b12a..2fd731cb6886 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.h +++ b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.h | |||
@@ -92,6 +92,8 @@ struct _gckHARDWARE | |||
92 | 92 | ||
93 | gctBOOL powerManagement; | 93 | gctBOOL powerManagement; |
94 | gctBOOL gpuProfiler; | 94 | gctBOOL gpuProfiler; |
95 | |||
96 | gctBOOL endAfterFlushMmuCache; | ||
95 | }; | 97 | }; |
96 | 98 | ||
97 | gceSTATUS | 99 | gceSTATUS |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.c b/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.c index 225a10ac83a3..049071d6c505 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.c +++ b/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.c | |||
@@ -177,8 +177,8 @@ gckVGCOMMAND_StateCommand( | |||
177 | IN gctUINT32 Pipe, | 177 | IN gctUINT32 Pipe, |
178 | IN gctPOINTER Logical, | 178 | IN gctPOINTER Logical, |
179 | IN gctUINT32 Address, | 179 | IN gctUINT32 Address, |
180 | IN gctSIZE_T Count, | 180 | IN gctUINT32 Count, |
181 | IN OUT gctSIZE_T * Bytes | 181 | IN OUT gctUINT32 * Bytes |
182 | ) | 182 | ) |
183 | { | 183 | { |
184 | gcmkHEADER_ARG("Command=0x%x Pipe=0x%x Logical=0x%x Address=0x%x Count=0x%x Bytes = 0x%x", | 184 | gcmkHEADER_ARG("Command=0x%x Pipe=0x%x Logical=0x%x Address=0x%x Count=0x%x Bytes = 0x%x", |
@@ -278,7 +278,7 @@ gckVGCOMMAND_RestartCommand( | |||
278 | IN gctPOINTER Logical, | 278 | IN gctPOINTER Logical, |
279 | IN gctUINT32 FetchAddress, | 279 | IN gctUINT32 FetchAddress, |
280 | IN gctUINT FetchCount, | 280 | IN gctUINT FetchCount, |
281 | IN OUT gctSIZE_T * Bytes | 281 | IN OUT gctUINT32 * Bytes |
282 | ) | 282 | ) |
283 | { | 283 | { |
284 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x", | 284 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x", |
@@ -369,7 +369,7 @@ gckVGCOMMAND_FetchCommand( | |||
369 | IN gctPOINTER Logical, | 369 | IN gctPOINTER Logical, |
370 | IN gctUINT32 FetchAddress, | 370 | IN gctUINT32 FetchAddress, |
371 | IN gctUINT FetchCount, | 371 | IN gctUINT FetchCount, |
372 | IN OUT gctSIZE_T * Bytes | 372 | IN OUT gctUINT32 * Bytes |
373 | ) | 373 | ) |
374 | { | 374 | { |
375 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x", | 375 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x", |
@@ -471,7 +471,7 @@ gckVGCOMMAND_CallCommand( | |||
471 | IN gctPOINTER Logical, | 471 | IN gctPOINTER Logical, |
472 | IN gctUINT32 FetchAddress, | 472 | IN gctUINT32 FetchAddress, |
473 | IN gctUINT FetchCount, | 473 | IN gctUINT FetchCount, |
474 | IN OUT gctSIZE_T * Bytes | 474 | IN OUT gctUINT32 * Bytes |
475 | ) | 475 | ) |
476 | { | 476 | { |
477 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x", | 477 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x FetchAddress=0x%x FetchCount=0x%x Bytes = 0x%x", |
@@ -543,7 +543,7 @@ gceSTATUS | |||
543 | gckVGCOMMAND_ReturnCommand( | 543 | gckVGCOMMAND_ReturnCommand( |
544 | IN gckVGCOMMAND Command, | 544 | IN gckVGCOMMAND Command, |
545 | IN gctPOINTER Logical, | 545 | IN gctPOINTER Logical, |
546 | IN OUT gctSIZE_T * Bytes | 546 | IN OUT gctUINT32 * Bytes |
547 | ) | 547 | ) |
548 | { | 548 | { |
549 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x Bytes = 0x%x", | 549 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x Bytes = 0x%x", |
@@ -620,7 +620,7 @@ gckVGCOMMAND_EventCommand( | |||
620 | IN gctPOINTER Logical, | 620 | IN gctPOINTER Logical, |
621 | IN gceBLOCK Block, | 621 | IN gceBLOCK Block, |
622 | IN gctINT32 InterruptId, | 622 | IN gctINT32 InterruptId, |
623 | IN OUT gctSIZE_T * Bytes | 623 | IN OUT gctUINT32 * Bytes |
624 | ) | 624 | ) |
625 | { | 625 | { |
626 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x Block=0x%x InterruptId=0x%x Bytes = 0x%x", | 626 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x Block=0x%x InterruptId=0x%x Bytes = 0x%x", |
@@ -858,7 +858,7 @@ gckVGCOMMAND_EndCommand( | |||
858 | IN gckVGCOMMAND Command, | 858 | IN gckVGCOMMAND Command, |
859 | IN gctPOINTER Logical, | 859 | IN gctPOINTER Logical, |
860 | IN gctINT32 InterruptId, | 860 | IN gctINT32 InterruptId, |
861 | IN OUT gctSIZE_T * Bytes | 861 | IN OUT gctUINT32 * Bytes |
862 | ) | 862 | ) |
863 | { | 863 | { |
864 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x InterruptId=0x%x Bytes = 0x%x", | 864 | gcmkHEADER_ARG("Command=0x%x Logical=0x%x InterruptId=0x%x Bytes = 0x%x", |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.h b/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.h index d033fda14340..ad4fecd5585f 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.h +++ b/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_command_vg.h | |||
@@ -255,8 +255,8 @@ gckVGCOMMAND_StateCommand( | |||
255 | IN gctUINT32 Pipe, | 255 | IN gctUINT32 Pipe, |
256 | IN gctPOINTER Logical, | 256 | IN gctPOINTER Logical, |
257 | IN gctUINT32 Address, | 257 | IN gctUINT32 Address, |
258 | IN gctSIZE_T Count, | 258 | IN gctUINT32 Count, |
259 | IN OUT gctSIZE_T * Bytes | 259 | IN OUT gctUINT32 * Bytes |
260 | ); | 260 | ); |
261 | 261 | ||
262 | /* Form a RESTART command at the specified location in the command buffer. */ | 262 | /* Form a RESTART command at the specified location in the command buffer. */ |
@@ -266,7 +266,7 @@ gckVGCOMMAND_RestartCommand( | |||
266 | IN gctPOINTER Logical, | 266 | IN gctPOINTER Logical, |
267 | IN gctUINT32 FetchAddress, | 267 | IN gctUINT32 FetchAddress, |
268 | IN gctUINT FetchCount, | 268 | IN gctUINT FetchCount, |
269 | IN OUT gctSIZE_T * Bytes | 269 | IN OUT gctUINT32 * Bytes |
270 | ); | 270 | ); |
271 | 271 | ||
272 | /* Form a FETCH command at the specified location in the command buffer. */ | 272 | /* Form a FETCH command at the specified location in the command buffer. */ |
@@ -276,7 +276,7 @@ gckVGCOMMAND_FetchCommand( | |||
276 | IN gctPOINTER Logical, | 276 | IN gctPOINTER Logical, |
277 | IN gctUINT32 FetchAddress, | 277 | IN gctUINT32 FetchAddress, |
278 | IN gctUINT FetchCount, | 278 | IN gctUINT FetchCount, |
279 | IN OUT gctSIZE_T * Bytes | 279 | IN OUT gctUINT32 * Bytes |
280 | ); | 280 | ); |
281 | 281 | ||
282 | /* Form a CALL command at the specified location in the command buffer. */ | 282 | /* Form a CALL command at the specified location in the command buffer. */ |
@@ -286,7 +286,7 @@ gckVGCOMMAND_CallCommand( | |||
286 | IN gctPOINTER Logical, | 286 | IN gctPOINTER Logical, |
287 | IN gctUINT32 FetchAddress, | 287 | IN gctUINT32 FetchAddress, |
288 | IN gctUINT FetchCount, | 288 | IN gctUINT FetchCount, |
289 | IN OUT gctSIZE_T * Bytes | 289 | IN OUT gctUINT32 * Bytes |
290 | ); | 290 | ); |
291 | 291 | ||
292 | /* Form a RETURN command at the specified location in the command buffer. */ | 292 | /* Form a RETURN command at the specified location in the command buffer. */ |
@@ -294,7 +294,7 @@ gceSTATUS | |||
294 | gckVGCOMMAND_ReturnCommand( | 294 | gckVGCOMMAND_ReturnCommand( |
295 | IN gckVGCOMMAND Command, | 295 | IN gckVGCOMMAND Command, |
296 | IN gctPOINTER Logical, | 296 | IN gctPOINTER Logical, |
297 | IN OUT gctSIZE_T * Bytes | 297 | IN OUT gctUINT32 * Bytes |
298 | ); | 298 | ); |
299 | 299 | ||
300 | /* Form an EVENT command at the specified location in the command buffer. */ | 300 | /* Form an EVENT command at the specified location in the command buffer. */ |
@@ -304,7 +304,7 @@ gckVGCOMMAND_EventCommand( | |||
304 | IN gctPOINTER Logical, | 304 | IN gctPOINTER Logical, |
305 | IN gceBLOCK Block, | 305 | IN gceBLOCK Block, |
306 | IN gctINT32 InterruptId, | 306 | IN gctINT32 InterruptId, |
307 | IN OUT gctSIZE_T * Bytes | 307 | IN OUT gctUINT32 * Bytes |
308 | ); | 308 | ); |
309 | 309 | ||
310 | /* Form an END command at the specified location in the command buffer. */ | 310 | /* Form an END command at the specified location in the command buffer. */ |
@@ -313,7 +313,7 @@ gckVGCOMMAND_EndCommand( | |||
313 | IN gckVGCOMMAND Command, | 313 | IN gckVGCOMMAND Command, |
314 | IN gctPOINTER Logical, | 314 | IN gctPOINTER Logical, |
315 | IN gctINT32 InterruptId, | 315 | IN gctINT32 InterruptId, |
316 | IN OUT gctSIZE_T * Bytes | 316 | IN OUT gctUINT32 * Bytes |
317 | ); | 317 | ); |
318 | 318 | ||
319 | #endif /* __gc_hal_kernel_hardware_command_h_ */ | 319 | #endif /* __gc_hal_kernel_hardware_command_h_ */ |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_vg.c b/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_vg.c index 3677d4682b23..07f582de3ad6 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_vg.c +++ b/drivers/mxc/gpu-viv/hal/kernel/archvg/gc_hal_kernel_hardware_vg.c | |||
@@ -311,8 +311,8 @@ gckVGHARDWARE_Construct( | |||
311 | hardware->clockState = gcvTRUE; | 311 | hardware->clockState = gcvTRUE; |
312 | hardware->powerState = gcvTRUE; | 312 | hardware->powerState = gcvTRUE; |
313 | 313 | ||
314 | hardware->powerOffTime = 0; | ||
315 | #if gcdPOWEROFF_TIMEOUT | 314 | #if gcdPOWEROFF_TIMEOUT |
315 | hardware->powerOffTime = 0; | ||
316 | hardware->powerOffTimeout = gcdPOWEROFF_TIMEOUT; | 316 | hardware->powerOffTimeout = gcdPOWEROFF_TIMEOUT; |
317 | 317 | ||
318 | gcmkVERIFY_OK(gckOS_CreateTimer(Os, | 318 | gcmkVERIFY_OK(gckOS_CreateTimer(Os, |
@@ -890,7 +890,7 @@ gceSTATUS | |||
890 | gckVGHARDWARE_Execute( | 890 | gckVGHARDWARE_Execute( |
891 | IN gckVGHARDWARE Hardware, | 891 | IN gckVGHARDWARE Hardware, |
892 | IN gctUINT32 Address, | 892 | IN gctUINT32 Address, |
893 | IN gctSIZE_T Count | 893 | IN gctUINT32 Count |
894 | ) | 894 | ) |
895 | { | 895 | { |
896 | gceSTATUS status; | 896 | gceSTATUS status; |
@@ -1043,6 +1043,9 @@ gckVGHARDWARE_AlignToTile( | |||
1043 | ** gctPOINTER Logical | 1043 | ** gctPOINTER Logical |
1044 | ** Logical address to convert. | 1044 | ** Logical address to convert. |
1045 | ** | 1045 | ** |
1046 | ** gctBOOL InUserSpace | ||
1047 | ** gcvTRUE if the memory in user space. | ||
1048 | ** | ||
1046 | ** gctUINT32* Address | 1049 | ** gctUINT32* Address |
1047 | ** Return hardware specific address. | 1050 | ** Return hardware specific address. |
1048 | ** | 1051 | ** |
@@ -1054,14 +1057,15 @@ gceSTATUS | |||
1054 | gckVGHARDWARE_ConvertLogical( | 1057 | gckVGHARDWARE_ConvertLogical( |
1055 | IN gckVGHARDWARE Hardware, | 1058 | IN gckVGHARDWARE Hardware, |
1056 | IN gctPOINTER Logical, | 1059 | IN gctPOINTER Logical, |
1060 | IN gctBOOL InUserSpace, | ||
1057 | OUT gctUINT32 * Address | 1061 | OUT gctUINT32 * Address |
1058 | ) | 1062 | ) |
1059 | { | 1063 | { |
1060 | gctUINT32 address; | 1064 | gctUINT32 address; |
1061 | gceSTATUS status; | 1065 | gceSTATUS status; |
1062 | 1066 | ||
1063 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x Address=0x%x", | 1067 | gcmkHEADER_ARG("Hardware=0x%x Logical=0x%x InUserSpace=%d Address=0x%x", |
1064 | Hardware, Logical, Address); | 1068 | Hardware, Logical, InUserSpace, Address); |
1065 | 1069 | ||
1066 | /* Verify the arguments. */ | 1070 | /* Verify the arguments. */ |
1067 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | 1071 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); |
@@ -1071,9 +1075,18 @@ gckVGHARDWARE_ConvertLogical( | |||
1071 | do | 1075 | do |
1072 | { | 1076 | { |
1073 | /* Convert logical address into a physical address. */ | 1077 | /* Convert logical address into a physical address. */ |
1074 | gcmkERR_BREAK(gckOS_GetPhysicalAddress( | 1078 | if (InUserSpace) |
1075 | Hardware->os, Logical, &address | 1079 | { |
1076 | )); | 1080 | gcmkERR_BREAK(gckOS_UserLogicalToPhysical( |
1081 | Hardware->os, Logical, &address | ||
1082 | )); | ||
1083 | } | ||
1084 | else | ||
1085 | { | ||
1086 | gcmkERR_BREAK(gckOS_GetPhysicalAddress( | ||
1087 | Hardware->os, Logical, &address | ||
1088 | )); | ||
1089 | } | ||
1077 | 1090 | ||
1078 | /* Return hardware specific address. */ | 1091 | /* Return hardware specific address. */ |
1079 | *Address = ((((gctUINT32) (address)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0))); | 1092 | *Address = ((((gctUINT32) (address)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0))); |
@@ -1175,32 +1188,33 @@ gceSTATUS gckVGHARDWARE_SetMMU( | |||
1175 | do | 1188 | do |
1176 | { | 1189 | { |
1177 | /* Convert the logical address into an hardware address. */ | 1190 | /* Convert the logical address into an hardware address. */ |
1178 | gcmkERR_BREAK(gckVGHARDWARE_ConvertLogical(Hardware, Logical, &address) ); | 1191 | gcmkERR_BREAK(gckVGHARDWARE_ConvertLogical(Hardware, Logical, |
1192 | gcvFALSE, &address)); | ||
1179 | 1193 | ||
1180 | /* Write the AQMemoryFePageTable register. */ | 1194 | /* Write the AQMemoryFePageTable register. */ |
1181 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, | 1195 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, |
1182 | 0x00400, | 1196 | 0x00400, |
1183 | gcmkFIXADDRESS(address)) ); | 1197 | gcmkFIXADDRESS(address))); |
1184 | 1198 | ||
1185 | /* Write the AQMemoryTxPageTable register. */ | 1199 | /* Write the AQMemoryTxPageTable register. */ |
1186 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, | 1200 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, |
1187 | 0x00404, | 1201 | 0x00404, |
1188 | gcmkFIXADDRESS(address)) ); | 1202 | gcmkFIXADDRESS(address))); |
1189 | 1203 | ||
1190 | /* Write the AQMemoryPePageTable register. */ | 1204 | /* Write the AQMemoryPePageTable register. */ |
1191 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, | 1205 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, |
1192 | 0x00408, | 1206 | 0x00408, |
1193 | gcmkFIXADDRESS(address)) ); | 1207 | gcmkFIXADDRESS(address))); |
1194 | 1208 | ||
1195 | /* Write the AQMemoryPezPageTable register. */ | 1209 | /* Write the AQMemoryPezPageTable register. */ |
1196 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, | 1210 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, |
1197 | 0x0040C, | 1211 | 0x0040C, |
1198 | gcmkFIXADDRESS(address)) ); | 1212 | gcmkFIXADDRESS(address))); |
1199 | 1213 | ||
1200 | /* Write the AQMemoryRaPageTable register. */ | 1214 | /* Write the AQMemoryRaPageTable register. */ |
1201 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, | 1215 | gcmkERR_BREAK(gckOS_WriteRegisterEx(Hardware->os, gcvCORE_VG, |
1202 | 0x00410, | 1216 | 0x00410, |
1203 | gcmkFIXADDRESS(address)) ); | 1217 | gcmkFIXADDRESS(address))); |
1204 | } | 1218 | } |
1205 | while (gcvFALSE); | 1219 | while (gcvFALSE); |
1206 | 1220 | ||
@@ -2017,6 +2031,7 @@ gckVGHARDWARE_SetPowerManagement( | |||
2017 | return gcvSTATUS_OK; | 2031 | return gcvSTATUS_OK; |
2018 | } | 2032 | } |
2019 | 2033 | ||
2034 | #if gcdPOWEROFF_TIMEOUT | ||
2020 | gceSTATUS | 2035 | gceSTATUS |
2021 | gckVGHARDWARE_SetPowerOffTimeout( | 2036 | gckVGHARDWARE_SetPowerOffTimeout( |
2022 | IN gckVGHARDWARE Hardware, | 2037 | IN gckVGHARDWARE Hardware, |
@@ -2045,6 +2060,7 @@ gckVGHARDWARE_QueryPowerOffTimeout( | |||
2045 | gcmkFOOTER_ARG("*Timeout=%d", *Timeout); | 2060 | gcmkFOOTER_ARG("*Timeout=%d", *Timeout); |
2046 | return gcvSTATUS_OK; | 2061 | return gcvSTATUS_OK; |
2047 | } | 2062 | } |
2063 | #endif | ||
2048 | 2064 | ||
2049 | gceSTATUS | 2065 | gceSTATUS |
2050 | gckVGHARDWARE_QueryIdle( | 2066 | gckVGHARDWARE_QueryIdle( |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c index 274fee19ea6a..092ba444b3db 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | |||
@@ -101,7 +101,6 @@ gctCONST_STRING _DispatchText[] = | |||
101 | }; | 101 | }; |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | #if gcdENABLE_RECOVERY | ||
105 | void | 104 | void |
106 | _ResetFinishFunction( | 105 | _ResetFinishFunction( |
107 | gctPOINTER Data | 106 | gctPOINTER Data |
@@ -111,7 +110,6 @@ _ResetFinishFunction( | |||
111 | 110 | ||
112 | gckOS_AtomSet(kernel->os, kernel->resetAtom, 0); | 111 | gckOS_AtomSet(kernel->os, kernel->resetAtom, 0); |
113 | } | 112 | } |
114 | #endif | ||
115 | 113 | ||
116 | #if gcdPROCESS_ADDRESS_SPACE | 114 | #if gcdPROCESS_ADDRESS_SPACE |
117 | gceSTATUS | 115 | gceSTATUS |
@@ -330,11 +328,12 @@ gckKERNEL_Construct( | |||
330 | /* Initialize virtual command buffer. */ | 328 | /* Initialize virtual command buffer. */ |
331 | /* TODO: Remove platform limitation after porting. */ | 329 | /* TODO: Remove platform limitation after porting. */ |
332 | #if (defined(LINUX) || defined(__QNXNTO__)) | 330 | #if (defined(LINUX) || defined(__QNXNTO__)) |
333 | kernel->virtualCommandBuffer = kernel->hardware->mmuVersion; | 331 | kernel->virtualCommandBuffer = gcvTRUE; |
334 | #else | 332 | #else |
335 | kernel->virtualCommandBuffer = gcvFALSE; | 333 | kernel->virtualCommandBuffer = gcvFALSE; |
336 | #endif | 334 | #endif |
337 | 335 | ||
336 | |||
338 | /* Construct the gckCOMMAND object. */ | 337 | /* Construct the gckCOMMAND object. */ |
339 | gcmkONERROR( | 338 | gcmkONERROR( |
340 | gckCOMMAND_Construct(kernel, &kernel->command)); | 339 | gckCOMMAND_Construct(kernel, &kernel->command)); |
@@ -347,7 +346,6 @@ gckKERNEL_Construct( | |||
347 | gcmkONERROR( | 346 | gcmkONERROR( |
348 | gckMMU_Construct(kernel, gcdMMU_SIZE, &kernel->mmu)); | 347 | gckMMU_Construct(kernel, gcdMMU_SIZE, &kernel->mmu)); |
349 | 348 | ||
350 | #if gcdENABLE_RECOVERY | ||
351 | gcmkONERROR( | 349 | gcmkONERROR( |
352 | gckOS_AtomConstruct(Os, &kernel->resetAtom)); | 350 | gckOS_AtomConstruct(Os, &kernel->resetAtom)); |
353 | 351 | ||
@@ -357,8 +355,7 @@ gckKERNEL_Construct( | |||
357 | (gctPOINTER)kernel, | 355 | (gctPOINTER)kernel, |
358 | &kernel->resetFlagClearTimer)); | 356 | &kernel->resetFlagClearTimer)); |
359 | 357 | ||
360 | kernel->resetTimeStamp = 0; | 358 | gcmkVERIFY_OK(gckOS_GetTime(&kernel->resetTimeStamp)); |
361 | #endif | ||
362 | 359 | ||
363 | #if gcdDVFS | 360 | #if gcdDVFS |
364 | if (gckHARDWARE_IsFeatureAvailable(kernel->hardware, | 361 | if (gckHARDWARE_IsFeatureAvailable(kernel->hardware, |
@@ -389,6 +386,7 @@ gckKERNEL_Construct( | |||
389 | gcmkONERROR( | 386 | gcmkONERROR( |
390 | gckOS_CreateMutex(Os, (gctPOINTER)&kernel->virtualBufferLock)); | 387 | gckOS_CreateMutex(Os, (gctPOINTER)&kernel->virtualBufferLock)); |
391 | 388 | ||
389 | |||
392 | /* Return pointer to the gckKERNEL object. */ | 390 | /* Return pointer to the gckKERNEL object. */ |
393 | *Kernel = kernel; | 391 | *Kernel = kernel; |
394 | 392 | ||
@@ -429,7 +427,6 @@ OnError: | |||
429 | gcmkVERIFY_OK(gckOS_AtomDestroy(Os, kernel->atomClients)); | 427 | gcmkVERIFY_OK(gckOS_AtomDestroy(Os, kernel->atomClients)); |
430 | } | 428 | } |
431 | 429 | ||
432 | #if gcdENABLE_RECOVERY | ||
433 | if (kernel->resetAtom != gcvNULL) | 430 | if (kernel->resetAtom != gcvNULL) |
434 | { | 431 | { |
435 | gcmkVERIFY_OK(gckOS_AtomDestroy(Os, kernel->resetAtom)); | 432 | gcmkVERIFY_OK(gckOS_AtomDestroy(Os, kernel->resetAtom)); |
@@ -440,7 +437,6 @@ OnError: | |||
440 | gcmkVERIFY_OK(gckOS_StopTimer(Os, kernel->resetFlagClearTimer)); | 437 | gcmkVERIFY_OK(gckOS_StopTimer(Os, kernel->resetFlagClearTimer)); |
441 | gcmkVERIFY_OK(gckOS_DestroyTimer(Os, kernel->resetFlagClearTimer)); | 438 | gcmkVERIFY_OK(gckOS_DestroyTimer(Os, kernel->resetFlagClearTimer)); |
442 | } | 439 | } |
443 | #endif | ||
444 | 440 | ||
445 | if (kernel->dbCreated && kernel->db != gcvNULL) | 441 | if (kernel->dbCreated && kernel->db != gcvNULL) |
446 | { | 442 | { |
@@ -590,7 +586,6 @@ gckKERNEL_Destroy( | |||
590 | /* Destroy the gckHARDWARE object. */ | 586 | /* Destroy the gckHARDWARE object. */ |
591 | gcmkVERIFY_OK(gckHARDWARE_Destroy(Kernel->hardware)); | 587 | gcmkVERIFY_OK(gckHARDWARE_Destroy(Kernel->hardware)); |
592 | 588 | ||
593 | #if gcdENABLE_RECOVERY | ||
594 | gcmkVERIFY_OK(gckOS_AtomDestroy(Kernel->os, Kernel->resetAtom)); | 589 | gcmkVERIFY_OK(gckOS_AtomDestroy(Kernel->os, Kernel->resetAtom)); |
595 | 590 | ||
596 | if (Kernel->resetFlagClearTimer) | 591 | if (Kernel->resetFlagClearTimer) |
@@ -598,7 +593,6 @@ gckKERNEL_Destroy( | |||
598 | gcmkVERIFY_OK(gckOS_StopTimer(Kernel->os, Kernel->resetFlagClearTimer)); | 593 | gcmkVERIFY_OK(gckOS_StopTimer(Kernel->os, Kernel->resetFlagClearTimer)); |
599 | gcmkVERIFY_OK(gckOS_DestroyTimer(Kernel->os, Kernel->resetFlagClearTimer)); | 594 | gcmkVERIFY_OK(gckOS_DestroyTimer(Kernel->os, Kernel->resetFlagClearTimer)); |
600 | } | 595 | } |
601 | #endif | ||
602 | } | 596 | } |
603 | 597 | ||
604 | /* Detsroy the client atom. */ | 598 | /* Detsroy the client atom. */ |
@@ -618,6 +612,7 @@ gckKERNEL_Destroy( | |||
618 | gcmkVERIFY_OK(gckOS_DestroySyncTimeline(Kernel->os, Kernel->timeline)); | 612 | gcmkVERIFY_OK(gckOS_DestroySyncTimeline(Kernel->os, Kernel->timeline)); |
619 | #endif | 613 | #endif |
620 | 614 | ||
615 | |||
621 | /* Mark the gckKERNEL object as unknown. */ | 616 | /* Mark the gckKERNEL object as unknown. */ |
622 | Kernel->object.type = gcvOBJ_UNKNOWN; | 617 | Kernel->object.type = gcvOBJ_UNKNOWN; |
623 | 618 | ||
@@ -749,7 +744,7 @@ gckKERNEL_AllocateLinearMemory( | |||
749 | IN gctUINT32 ProcessID, | 744 | IN gctUINT32 ProcessID, |
750 | IN OUT gcePOOL * Pool, | 745 | IN OUT gcePOOL * Pool, |
751 | IN gctSIZE_T Bytes, | 746 | IN gctSIZE_T Bytes, |
752 | IN gctSIZE_T Alignment, | 747 | IN gctUINT32 Alignment, |
753 | IN gceSURF_TYPE Type, | 748 | IN gceSURF_TYPE Type, |
754 | OUT gctUINT32 * Node | 749 | OUT gctUINT32 * Node |
755 | ) | 750 | ) |
@@ -905,6 +900,7 @@ _AllocateMemory_Retry: | |||
905 | Bytes, | 900 | Bytes, |
906 | Alignment, | 901 | Alignment, |
907 | Type, | 902 | Type, |
903 | (*Pool == gcvPOOL_SYSTEM), | ||
908 | &node); | 904 | &node); |
909 | 905 | ||
910 | if (gcmIS_SUCCESS(status)) | 906 | if (gcmIS_SUCCESS(status)) |
@@ -1127,11 +1123,11 @@ gckKERNEL_LockVideoMemory( | |||
1127 | { | 1123 | { |
1128 | gceSTATUS status; | 1124 | gceSTATUS status; |
1129 | gckVIDMEM_NODE nodeObject = gcvNULL; | 1125 | gckVIDMEM_NODE nodeObject = gcvNULL; |
1130 | gcuVIDMEM_NODE_PTR node = gcvNULL; | 1126 | gcuVIDMEM_NODE_PTR node = gcvNULL; |
1131 | gctBOOL locked = gcvFALSE; | 1127 | gctBOOL locked = gcvFALSE; |
1132 | gctBOOL asynchronous; | 1128 | gctBOOL asynchronous = gcvFALSE; |
1133 | #ifndef __QNXNTO__ | 1129 | #ifndef __QNXNTO__ |
1134 | gctPOINTER pointer; | 1130 | gctPOINTER pointer = gcvNULL; |
1135 | #endif | 1131 | #endif |
1136 | 1132 | ||
1137 | gcmkHEADER_ARG("Kernel=0x%08X ProcessID=%d", | 1133 | gcmkHEADER_ARG("Kernel=0x%08X ProcessID=%d", |
@@ -1633,6 +1629,7 @@ gckKERNEL_Dispatch( | |||
1633 | gcmkONERROR(gckHARDWARE_ConvertLogical( | 1629 | gcmkONERROR(gckHARDWARE_ConvertLogical( |
1634 | Kernel->hardware, | 1630 | Kernel->hardware, |
1635 | logical, | 1631 | logical, |
1632 | gcvTRUE, | ||
1636 | &Interface->u.AllocateContiguousMemory.address)); | 1633 | &Interface->u.AllocateContiguousMemory.address)); |
1637 | 1634 | ||
1638 | gcmkVERIFY_OK(gckKERNEL_AddProcessDB( | 1635 | gcmkVERIFY_OK(gckKERNEL_AddProcessDB( |
@@ -2207,7 +2204,12 @@ gckKERNEL_Dispatch( | |||
2207 | #if VIVANTE_PROFILER | 2204 | #if VIVANTE_PROFILER |
2208 | /* Set profile setting */ | 2205 | /* Set profile setting */ |
2209 | if(Kernel->hardware->gpuProfiler) | 2206 | if(Kernel->hardware->gpuProfiler) |
2207 | { | ||
2210 | Kernel->profileEnable = Interface->u.SetProfileSetting.enable; | 2208 | Kernel->profileEnable = Interface->u.SetProfileSetting.enable; |
2209 | #if VIVANTE_PROFILER_NEW | ||
2210 | gckHARDWARE_InitProfiler(Kernel->hardware); | ||
2211 | #endif | ||
2212 | } | ||
2211 | else | 2213 | else |
2212 | { | 2214 | { |
2213 | status = gcvSTATUS_NOT_SUPPORTED; | 2215 | status = gcvSTATUS_NOT_SUPPORTED; |
@@ -2519,11 +2521,7 @@ gckKERNEL_Dispatch( | |||
2519 | break; | 2521 | break; |
2520 | 2522 | ||
2521 | case gcvHAL_QUERY_RESET_TIME_STAMP: | 2523 | case gcvHAL_QUERY_RESET_TIME_STAMP: |
2522 | #if gcdENABLE_RECOVERY | ||
2523 | Interface->u.QueryResetTimeStamp.timeStamp = Kernel->resetTimeStamp; | 2524 | Interface->u.QueryResetTimeStamp.timeStamp = Kernel->resetTimeStamp; |
2524 | #else | ||
2525 | Interface->u.QueryResetTimeStamp.timeStamp = 0; | ||
2526 | #endif | ||
2527 | break; | 2525 | break; |
2528 | 2526 | ||
2529 | case gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER: | 2527 | case gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER: |
@@ -2535,7 +2533,7 @@ gckKERNEL_Dispatch( | |||
2535 | gcvDB_COMMAND_BUFFER, | 2533 | gcvDB_COMMAND_BUFFER, |
2536 | gcmUINT64_TO_PTR(Interface->u.FreeVirtualCommandBuffer.logical))); | 2534 | gcmUINT64_TO_PTR(Interface->u.FreeVirtualCommandBuffer.logical))); |
2537 | 2535 | ||
2538 | gcmkONERROR(gckOS_UnlockPages( | 2536 | gcmkONERROR(gckOS_DestroyUserVirtualMapping( |
2539 | Kernel->os, | 2537 | Kernel->os, |
2540 | buffer->physical, | 2538 | buffer->physical, |
2541 | (gctSIZE_T)Interface->u.FreeVirtualCommandBuffer.bytes, | 2539 | (gctSIZE_T)Interface->u.FreeVirtualCommandBuffer.bytes, |
@@ -2988,7 +2986,7 @@ gckKERNEL_MapLogicalToPhysical( | |||
2988 | #elif gcdSECURE_CACHE_METHOD == gcdSECURE_CACHE_HASH | 2986 | #elif gcdSECURE_CACHE_METHOD == gcdSECURE_CACHE_HASH |
2989 | { | 2987 | { |
2990 | gctINT i; | 2988 | gctINT i; |
2991 | gctUINT32 data = gcmPTR2INT(*Data); | 2989 | gctUINT32 data = gcmPTR2INT32(*Data); |
2992 | gctUINT32 key, index; | 2990 | gctUINT32 key, index; |
2993 | gcskLOGICAL_CACHE_PTR hash; | 2991 | gcskLOGICAL_CACHE_PTR hash; |
2994 | 2992 | ||
@@ -3065,7 +3063,7 @@ gckKERNEL_MapLogicalToPhysical( | |||
3065 | } | 3063 | } |
3066 | #elif gcdSECURE_CACHE_METHOD == gcdSECURE_CACHE_TABLE | 3064 | #elif gcdSECURE_CACHE_METHOD == gcdSECURE_CACHE_TABLE |
3067 | { | 3065 | { |
3068 | gctUINT32 index = (gcmPTR2INT(*Data) % gcdSECURE_CACHE_SLOTS) + 1; | 3066 | gctUINT32 index = (gcmPTR2INT32(*Data) % gcdSECURE_CACHE_SLOTS) + 1; |
3069 | 3067 | ||
3070 | /* Get cache slot. */ | 3068 | /* Get cache slot. */ |
3071 | slot = &Cache->cache[index]; | 3069 | slot = &Cache->cache[index]; |
@@ -3277,7 +3275,7 @@ gckKERNEL_FlushTranslationCache( | |||
3277 | for (i = 1; (low < high) && (i <= gcdSECURE_CACHE_SLOTS); ++i) | 3275 | for (i = 1; (low < high) && (i <= gcdSECURE_CACHE_SLOTS); ++i) |
3278 | { | 3276 | { |
3279 | /* Get index into cache for this range. */ | 3277 | /* Get index into cache for this range. */ |
3280 | index = (gcmPTR2INT(low) % gcdSECURE_CACHE_SLOTS) + 1; | 3278 | index = (gcmPTR2INT32(low) % gcdSECURE_CACHE_SLOTS) + 1; |
3281 | slot = &Cache->cache[index]; | 3279 | slot = &Cache->cache[index]; |
3282 | 3280 | ||
3283 | /* Test if this slot falls within the range to flush. */ | 3281 | /* Test if this slot falls within the range to flush. */ |
@@ -3320,7 +3318,6 @@ gckKERNEL_Recovery( | |||
3320 | IN gckKERNEL Kernel | 3318 | IN gckKERNEL Kernel |
3321 | ) | 3319 | ) |
3322 | { | 3320 | { |
3323 | #if gcdENABLE_RECOVERY | ||
3324 | #define gcdEVENT_MASK 0x3FFFFFFF | 3321 | #define gcdEVENT_MASK 0x3FFFFFFF |
3325 | gceSTATUS status; | 3322 | gceSTATUS status; |
3326 | gckEVENT eventObj; | 3323 | gckEVENT eventObj; |
@@ -3478,7 +3475,7 @@ gckKERNEL_Recovery( | |||
3478 | #endif | 3475 | #endif |
3479 | gcmkONERROR(gckEVENT_Notify(eventObj, 2)); | 3476 | gcmkONERROR(gckEVENT_Notify(eventObj, 2)); |
3480 | 3477 | ||
3481 | Kernel->resetTimeStamp = 0; | 3478 | gcmkVERIFY_OK(gckOS_GetTime(&Kernel->resetTimeStamp)); |
3482 | 3479 | ||
3483 | /* Success. */ | 3480 | /* Success. */ |
3484 | gcmkFOOTER_NO(); | 3481 | gcmkFOOTER_NO(); |
@@ -3488,9 +3485,6 @@ OnError: | |||
3488 | /* Return the status. */ | 3485 | /* Return the status. */ |
3489 | gcmkFOOTER(); | 3486 | gcmkFOOTER(); |
3490 | return status; | 3487 | return status; |
3491 | #else | ||
3492 | return gcvSTATUS_OK; | ||
3493 | #endif | ||
3494 | } | 3488 | } |
3495 | 3489 | ||
3496 | /******************************************************************************* | 3490 | /******************************************************************************* |
@@ -3687,12 +3681,12 @@ gckKERNEL_AllocateVirtualCommandBuffer( | |||
3687 | OUT gctPOINTER * Logical | 3681 | OUT gctPOINTER * Logical |
3688 | ) | 3682 | ) |
3689 | { | 3683 | { |
3690 | gckOS os = Kernel->os; | 3684 | gckOS os = Kernel->os; |
3691 | gceSTATUS status; | 3685 | gceSTATUS status; |
3692 | gctPOINTER logical; | 3686 | gctPOINTER logical = gcvNULL; |
3693 | gctSIZE_T pageCount; | 3687 | gctSIZE_T pageCount; |
3694 | gctSIZE_T bytes = *Bytes; | 3688 | gctSIZE_T bytes = *Bytes; |
3695 | gckVIRTUAL_COMMAND_BUFFER_PTR buffer; | 3689 | gckVIRTUAL_COMMAND_BUFFER_PTR buffer = gcvNULL; |
3696 | #if gcdPROCESS_ADDRESS_SPACE | 3690 | #if gcdPROCESS_ADDRESS_SPACE |
3697 | gckMMU mmu; | 3691 | gckMMU mmu; |
3698 | #endif | 3692 | #endif |
@@ -3722,23 +3716,23 @@ gckKERNEL_AllocateVirtualCommandBuffer( | |||
3722 | 3716 | ||
3723 | if (InUserSpace) | 3717 | if (InUserSpace) |
3724 | { | 3718 | { |
3725 | gcmkONERROR(gckOS_LockPages(os, | 3719 | gcmkONERROR(gckOS_CreateUserVirtualMapping(os, |
3726 | buffer->physical, | 3720 | buffer->physical, |
3727 | bytes, | 3721 | bytes, |
3728 | gcvFALSE, | 3722 | &logical, |
3729 | &logical, | 3723 | &pageCount)); |
3730 | &pageCount)); | ||
3731 | 3724 | ||
3732 | *Logical = | 3725 | *Logical = |
3733 | buffer->userLogical = logical; | 3726 | buffer->userLogical = logical; |
3734 | } | 3727 | } |
3735 | else | 3728 | else |
3736 | { | 3729 | { |
3737 | gcmkONERROR( | 3730 | gcmkONERROR(gckOS_CreateKernelVirtualMapping(os, |
3738 | gckOS_CreateKernelVirtualMapping(buffer->physical, | 3731 | buffer->physical, |
3739 | bytes, | 3732 | bytes, |
3740 | &pageCount, | 3733 | &logical, |
3741 | &logical)); | 3734 | &pageCount)); |
3735 | |||
3742 | *Logical = | 3736 | *Logical = |
3743 | buffer->kernelLogical = logical; | 3737 | buffer->kernelLogical = logical; |
3744 | } | 3738 | } |
@@ -3770,26 +3764,17 @@ gckKERNEL_AllocateVirtualCommandBuffer( | |||
3770 | &buffer->pageTable, | 3764 | &buffer->pageTable, |
3771 | &buffer->gpuAddress)); | 3765 | &buffer->gpuAddress)); |
3772 | 3766 | ||
3773 | #ifdef __QNXNTO__ | ||
3774 | gcmkONERROR(gckOS_MapPagesEx(os, | ||
3775 | Kernel->core, | ||
3776 | buffer->physical, | ||
3777 | logical, | ||
3778 | pageCount, | ||
3779 | buffer->pageTable)); | ||
3780 | #else | ||
3781 | gcmkONERROR(gckOS_MapPagesEx(os, | 3767 | gcmkONERROR(gckOS_MapPagesEx(os, |
3782 | Kernel->core, | 3768 | Kernel->core, |
3783 | buffer->physical, | 3769 | buffer->physical, |
3784 | pageCount, | 3770 | pageCount, |
3785 | buffer->pageTable)); | 3771 | buffer->pageTable)); |
3786 | #endif | 3772 | #endif |
3787 | #endif | ||
3788 | 3773 | ||
3789 | #if gcdPROCESS_ADDRESS_SPACE | 3774 | #if gcdPROCESS_ADDRESS_SPACE |
3790 | gcmkONERROR(gckMMU_Flush(mmu)); | 3775 | gcmkONERROR(gckMMU_Flush(mmu)); |
3791 | #else | 3776 | #else |
3792 | gcmkONERROR(gckMMU_Flush(Kernel->mmu)); | 3777 | gcmkONERROR(gckMMU_Flush(Kernel->mmu, gcvSURF_INDEX)); |
3793 | #endif | 3778 | #endif |
3794 | 3779 | ||
3795 | *Physical = buffer; | 3780 | *Physical = buffer; |
@@ -3833,13 +3818,19 @@ OnError: | |||
3833 | if (buffer->userLogical) | 3818 | if (buffer->userLogical) |
3834 | { | 3819 | { |
3835 | gcmkVERIFY_OK( | 3820 | gcmkVERIFY_OK( |
3836 | gckOS_UnlockPages(os, buffer->physical, bytes, buffer->userLogical)); | 3821 | gckOS_DestroyUserVirtualMapping(os, |
3822 | buffer->physical, | ||
3823 | bytes, | ||
3824 | buffer->userLogical)); | ||
3837 | } | 3825 | } |
3838 | 3826 | ||
3839 | if (buffer->kernelLogical) | 3827 | if (buffer->kernelLogical) |
3840 | { | 3828 | { |
3841 | gcmkVERIFY_OK( | 3829 | gcmkVERIFY_OK( |
3842 | gckOS_DestroyKernelVirtualMapping(buffer->physical, buffer->kernelLogical, bytes)); | 3830 | gckOS_DestroyKernelVirtualMapping(os, |
3831 | buffer->physical, | ||
3832 | bytes, | ||
3833 | buffer->kernelLogical)); | ||
3843 | } | 3834 | } |
3844 | 3835 | ||
3845 | if (buffer->physical) | 3836 | if (buffer->physical) |
@@ -3874,7 +3865,10 @@ gckKERNEL_DestroyVirtualCommandBuffer( | |||
3874 | 3865 | ||
3875 | if (!buffer->userLogical) | 3866 | if (!buffer->userLogical) |
3876 | { | 3867 | { |
3877 | gcmkVERIFY_OK(gckOS_DestroyKernelVirtualMapping(buffer->physical, Logical, Bytes)); | 3868 | gcmkVERIFY_OK(gckOS_DestroyKernelVirtualMapping(os, |
3869 | buffer->physical, | ||
3870 | Bytes, | ||
3871 | Logical)); | ||
3878 | } | 3872 | } |
3879 | 3873 | ||
3880 | #if !gcdPROCESS_ADDRESS_SPACE | 3874 | #if !gcdPROCESS_ADDRESS_SPACE |
@@ -3919,6 +3913,7 @@ gceSTATUS | |||
3919 | gckKERNEL_GetGPUAddress( | 3913 | gckKERNEL_GetGPUAddress( |
3920 | IN gckKERNEL Kernel, | 3914 | IN gckKERNEL Kernel, |
3921 | IN gctPOINTER Logical, | 3915 | IN gctPOINTER Logical, |
3916 | IN gctBOOL InUserSpace, | ||
3922 | OUT gctUINT32 * Address | 3917 | OUT gctUINT32 * Address |
3923 | ) | 3918 | ) |
3924 | { | 3919 | { |
@@ -3927,9 +3922,9 @@ gckKERNEL_GetGPUAddress( | |||
3927 | gctPOINTER start; | 3922 | gctPOINTER start; |
3928 | gctUINT32 pid; | 3923 | gctUINT32 pid; |
3929 | 3924 | ||
3930 | gcmkHEADER_ARG("Logical = %x", Logical); | 3925 | gcmkHEADER_ARG("Logical = %x InUserSpace=%d.", Logical, InUserSpace); |
3931 | 3926 | ||
3932 | gckOS_GetProcessID(&pid); | 3927 | gcmkVERIFY_OK(gckOS_GetProcessID(&pid)); |
3933 | 3928 | ||
3934 | status = gcvSTATUS_INVALID_ADDRESS; | 3929 | status = gcvSTATUS_INVALID_ADDRESS; |
3935 | 3930 | ||
@@ -3938,7 +3933,7 @@ gckKERNEL_GetGPUAddress( | |||
3938 | /* Walk all command buffer. */ | 3933 | /* Walk all command buffer. */ |
3939 | for (buffer = Kernel->virtualBufferHead; buffer != gcvNULL; buffer = buffer->next) | 3934 | for (buffer = Kernel->virtualBufferHead; buffer != gcvNULL; buffer = buffer->next) |
3940 | { | 3935 | { |
3941 | if (buffer->userLogical) | 3936 | if (InUserSpace) |
3942 | { | 3937 | { |
3943 | start = buffer->userLogical; | 3938 | start = buffer->userLogical; |
3944 | } | 3939 | } |
@@ -3947,12 +3942,17 @@ gckKERNEL_GetGPUAddress( | |||
3947 | start = buffer->kernelLogical; | 3942 | start = buffer->kernelLogical; |
3948 | } | 3943 | } |
3949 | 3944 | ||
3945 | if (start == gcvNULL) | ||
3946 | { | ||
3947 | continue; | ||
3948 | } | ||
3949 | |||
3950 | if (Logical >= start | 3950 | if (Logical >= start |
3951 | && (Logical < (gctPOINTER)((gctUINT8_PTR)start + buffer->pageCount * 4096)) | 3951 | && (Logical < (gctPOINTER)((gctUINT8_PTR)start + buffer->pageCount * 4096)) |
3952 | && pid == buffer->pid | 3952 | && pid == buffer->pid |
3953 | ) | 3953 | ) |
3954 | { | 3954 | { |
3955 | * Address = buffer->gpuAddress + ((gctUINT8_PTR)Logical - (gctUINT8_PTR)start); | 3955 | * Address = buffer->gpuAddress + (gctUINT32)((gctUINT8_PTR)Logical - (gctUINT8_PTR)start); |
3956 | status = gcvSTATUS_OK; | 3956 | status = gcvSTATUS_OK; |
3957 | break; | 3957 | break; |
3958 | } | 3958 | } |
@@ -4046,41 +4046,57 @@ gckLINKQUEUE_GetData( | |||
4046 | } | 4046 | } |
4047 | #endif | 4047 | #endif |
4048 | 4048 | ||
4049 | #if gcdPROCESS_ADDRESS_SPACE | 4049 | /* |
4050 | void | 4050 | * gckENTRYQUEUE_Enqueue is called with Command->mutexQueue acquired. |
4051 | gckENTRYQUEUE_Dequeue( | 4051 | */ |
4052 | IN gckENTRYQUEUE Queue | 4052 | gceSTATUS |
4053 | ) | ||
4054 | { | ||
4055 | Queue->count--; | ||
4056 | Queue->front = (Queue->front + 1) % gcdENTRY_QUEUE_SIZE; | ||
4057 | } | ||
4058 | |||
4059 | void | ||
4060 | gckENTRYQUEUE_Enqueue( | 4053 | gckENTRYQUEUE_Enqueue( |
4054 | IN gckKERNEL Kernel, | ||
4061 | IN gckENTRYQUEUE Queue, | 4055 | IN gckENTRYQUEUE Queue, |
4062 | IN gctUINT32 physical, | 4056 | IN gctUINT32 physical, |
4063 | IN gctUINT32 bytes | 4057 | IN gctUINT32 bytes |
4064 | ) | 4058 | ) |
4065 | { | 4059 | { |
4066 | Queue->count++; | 4060 | gctUINT32 next = (Queue->rear + 1) % gcdENTRY_QUEUE_SIZE; |
4061 | |||
4062 | if (next == Queue->front) | ||
4063 | { | ||
4064 | /* Queue is full. */ | ||
4065 | return gcvSTATUS_INVALID_REQUEST; | ||
4066 | } | ||
4067 | 4067 | ||
4068 | /* Copy data. */ | ||
4068 | Queue->data[Queue->rear].physical = physical; | 4069 | Queue->data[Queue->rear].physical = physical; |
4069 | Queue->data[Queue->rear].bytes = bytes; | 4070 | Queue->data[Queue->rear].bytes = bytes; |
4070 | 4071 | ||
4071 | Queue->rear = (Queue->rear + 1) % gcdENTRY_QUEUE_SIZE; | 4072 | gcmkVERIFY_OK(gckOS_MemoryBarrier(Kernel->os, &Queue->rear)); |
4073 | |||
4074 | /* Update rear. */ | ||
4075 | Queue->rear = next; | ||
4076 | |||
4077 | return gcvSTATUS_OK; | ||
4072 | } | 4078 | } |
4073 | 4079 | ||
4074 | void | 4080 | gceSTATUS |
4075 | gckENTRYQUEUE_GetData( | 4081 | gckENTRYQUEUE_Dequeue( |
4076 | IN gckENTRYQUEUE Queue, | 4082 | IN gckENTRYQUEUE Queue, |
4077 | IN gctUINT32 Index, | ||
4078 | OUT gckENTRYDATA * Data | 4083 | OUT gckENTRYDATA * Data |
4079 | ) | 4084 | ) |
4080 | { | 4085 | { |
4081 | *Data = &Queue->data[(Index + Queue->front) % gcdENTRY_QUEUE_SIZE]; | 4086 | if (Queue->front == Queue->rear) |
4087 | { | ||
4088 | /* Queue is empty. */ | ||
4089 | return gcvSTATUS_INVALID_REQUEST; | ||
4090 | } | ||
4091 | |||
4092 | /* Copy data. */ | ||
4093 | *Data = &Queue->data[Queue->front]; | ||
4094 | |||
4095 | /* Update front. */ | ||
4096 | Queue->front = (Queue->front + 1) % gcdENTRY_QUEUE_SIZE; | ||
4097 | |||
4098 | return gcvSTATUS_OK; | ||
4082 | } | 4099 | } |
4083 | #endif | ||
4084 | 4100 | ||
4085 | /******************************************************************************\ | 4101 | /******************************************************************************\ |
4086 | *************************** Pointer - ID translation *************************** | 4102 | *************************** Pointer - ID translation *************************** |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h index bd9a3fd9a047..e2e93dfcc991 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "gc_hal_kernel_vg.h" | 31 | #include "gc_hal_kernel_vg.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | |||
34 | #ifdef __cplusplus | 35 | #ifdef __cplusplus |
35 | extern "C" { | 36 | extern "C" { |
36 | #endif | 37 | #endif |
@@ -92,6 +93,9 @@ extern "C" { | |||
92 | #define gcdSECURE_CACHE_HASH 3 | 93 | #define gcdSECURE_CACHE_HASH 3 |
93 | #define gcdSECURE_CACHE_TABLE 4 | 94 | #define gcdSECURE_CACHE_TABLE 4 |
94 | 95 | ||
96 | #define gcvPAGE_TABLE_DIRTY_BIT_OTHER (1 << 0) | ||
97 | #define gcvPAGE_TABLE_DIRTY_BIT_FE (1 << 1) | ||
98 | |||
95 | typedef struct _gcskLOGICAL_CACHE * gcskLOGICAL_CACHE_PTR; | 99 | typedef struct _gcskLOGICAL_CACHE * gcskLOGICAL_CACHE_PTR; |
96 | typedef struct _gcskLOGICAL_CACHE gcskLOGICAL_CACHE; | 100 | typedef struct _gcskLOGICAL_CACHE gcskLOGICAL_CACHE; |
97 | struct _gcskLOGICAL_CACHE | 101 | struct _gcskLOGICAL_CACHE |
@@ -509,11 +513,9 @@ struct _gckKERNEL | |||
509 | gckDB db; | 513 | gckDB db; |
510 | gctBOOL dbCreated; | 514 | gctBOOL dbCreated; |
511 | 515 | ||
512 | #if gcdENABLE_RECOVERY | ||
513 | gctPOINTER resetFlagClearTimer; | 516 | gctPOINTER resetFlagClearTimer; |
514 | gctPOINTER resetAtom; | 517 | gctPOINTER resetAtom; |
515 | gctUINT64 resetTimeStamp; | 518 | gctUINT64 resetTimeStamp; |
516 | #endif | ||
517 | 519 | ||
518 | /* Pointer to gckEVENT object. */ | 520 | /* Pointer to gckEVENT object. */ |
519 | gcsTIMER timers[8]; | 521 | gcsTIMER timers[8]; |
@@ -544,6 +546,7 @@ struct _gckKERNEL | |||
544 | 546 | ||
545 | /* Level of dump information after stuck. */ | 547 | /* Level of dump information after stuck. */ |
546 | gctUINT stuckDump; | 548 | gctUINT stuckDump; |
549 | |||
547 | }; | 550 | }; |
548 | 551 | ||
549 | struct _FrequencyHistory | 552 | struct _FrequencyHistory |
@@ -577,7 +580,7 @@ struct _gckCOMMAND | |||
577 | gckOS os; | 580 | gckOS os; |
578 | 581 | ||
579 | /* Number of bytes per page. */ | 582 | /* Number of bytes per page. */ |
580 | gctSIZE_T pageSize; | 583 | gctUINT32 pageSize; |
581 | 584 | ||
582 | /* Current pipe select. */ | 585 | /* Current pipe select. */ |
583 | gcePIPE_SELECT pipeSelect; | 586 | gcePIPE_SELECT pipeSelect; |
@@ -609,11 +612,13 @@ struct _gckCOMMAND | |||
609 | gctSIGNAL signal; | 612 | gctSIGNAL signal; |
610 | gctPHYS_ADDR physical; | 613 | gctPHYS_ADDR physical; |
611 | gctPOINTER logical; | 614 | gctPOINTER logical; |
615 | gctUINT32 address; | ||
612 | } | 616 | } |
613 | queues[gcdCOMMAND_QUEUES]; | 617 | queues[gcdCOMMAND_QUEUES]; |
614 | 618 | ||
615 | gctPHYS_ADDR physical; | 619 | gctPHYS_ADDR physical; |
616 | gctPOINTER logical; | 620 | gctPOINTER logical; |
621 | gctUINT32 address; | ||
617 | gctUINT32 offset; | 622 | gctUINT32 offset; |
618 | gctINT index; | 623 | gctINT index; |
619 | #if gcmIS_DEBUG(gcdDEBUG_TRACE) | 624 | #if gcmIS_DEBUG(gcdDEBUG_TRACE) |
@@ -629,12 +634,12 @@ struct _gckCOMMAND | |||
629 | /* Pointer to last WAIT command. */ | 634 | /* Pointer to last WAIT command. */ |
630 | gctPHYS_ADDR waitPhysical; | 635 | gctPHYS_ADDR waitPhysical; |
631 | gctPOINTER waitLogical; | 636 | gctPOINTER waitLogical; |
632 | gctSIZE_T waitSize; | 637 | gctUINT32 waitSize; |
633 | 638 | ||
634 | /* Command buffer alignment. */ | 639 | /* Command buffer alignment. */ |
635 | gctSIZE_T alignment; | 640 | gctUINT32 alignment; |
636 | gctSIZE_T reservedHead; | 641 | gctUINT32 reservedHead; |
637 | gctSIZE_T reservedTail; | 642 | gctUINT32 reservedTail; |
638 | 643 | ||
639 | /* Commit counter. */ | 644 | /* Commit counter. */ |
640 | gctPOINTER atomCommit; | 645 | gctPOINTER atomCommit; |
@@ -654,8 +659,8 @@ struct _gckCOMMAND | |||
654 | 659 | ||
655 | #if gcdPROCESS_ADDRESS_SPACE | 660 | #if gcdPROCESS_ADDRESS_SPACE |
656 | gckMMU currentMmu; | 661 | gckMMU currentMmu; |
657 | struct _gckENTRYQUEUE queue; | ||
658 | #endif | 662 | #endif |
663 | struct _gckENTRYQUEUE queue; | ||
659 | }; | 664 | }; |
660 | 665 | ||
661 | typedef struct _gcsEVENT * gcsEVENT_PTR; | 666 | typedef struct _gcsEVENT * gcsEVENT_PTR; |
@@ -691,6 +696,11 @@ typedef struct _gcsEVENT_QUEUE | |||
691 | /* Source of the event. */ | 696 | /* Source of the event. */ |
692 | gceKERNEL_WHERE source; | 697 | gceKERNEL_WHERE source; |
693 | 698 | ||
699 | #if gcdMULTI_GPU | ||
700 | /* Which chip(s) of the event */ | ||
701 | gceCORE_3D_MASK chipEnable; | ||
702 | #endif | ||
703 | |||
694 | /* Pointer to head of event queue. */ | 704 | /* Pointer to head of event queue. */ |
695 | gcsEVENT_PTR head; | 705 | gcsEVENT_PTR head; |
696 | 706 | ||
@@ -734,11 +744,7 @@ struct _gckEVENT | |||
734 | gctPOINTER eventQueueMutex; | 744 | gctPOINTER eventQueueMutex; |
735 | 745 | ||
736 | /* Array of event queues. */ | 746 | /* Array of event queues. */ |
737 | #if gcdPROCESS_ADDRESS_SPACE | ||
738 | gcsEVENT_QUEUE queues[29]; | 747 | gcsEVENT_QUEUE queues[29]; |
739 | #else | ||
740 | gcsEVENT_QUEUE queues[30]; | ||
741 | #endif | ||
742 | gctUINT8 lastID; | 748 | gctUINT8 lastID; |
743 | gctPOINTER freeAtom; | 749 | gctPOINTER freeAtom; |
744 | 750 | ||
@@ -746,12 +752,14 @@ struct _gckEVENT | |||
746 | #if gcdSMP | 752 | #if gcdSMP |
747 | #if gcdMULTI_GPU | 753 | #if gcdMULTI_GPU |
748 | gctPOINTER pending3D[gcdMULTI_GPU]; | 754 | gctPOINTER pending3D[gcdMULTI_GPU]; |
755 | gctPOINTER pending3DMask[gcdMULTI_GPU]; | ||
749 | gctPOINTER pendingMask; | 756 | gctPOINTER pendingMask; |
750 | #endif | 757 | #endif |
751 | gctPOINTER pending; | 758 | gctPOINTER pending; |
752 | #else | 759 | #else |
753 | #if gcdMULTI_GPU | 760 | #if gcdMULTI_GPU |
754 | volatile gctUINT pending3D[gcdMULTI_GPU]; | 761 | volatile gctUINT pending3D[gcdMULTI_GPU]; |
762 | volatile gctUINT pending3DMask[gcdMULTI_GPU]; | ||
755 | volatile gctUINT pendingMask; | 763 | volatile gctUINT pendingMask; |
756 | #endif | 764 | #endif |
757 | volatile gctUINT pending; | 765 | volatile gctUINT pending; |
@@ -793,7 +801,7 @@ gckEVENT_Stop( | |||
793 | IN gctPHYS_ADDR Handle, | 801 | IN gctPHYS_ADDR Handle, |
794 | IN gctPOINTER Logical, | 802 | IN gctPOINTER Logical, |
795 | IN gctSIGNAL Signal, | 803 | IN gctSIGNAL Signal, |
796 | IN OUT gctSIZE_T * waitSize | 804 | IN OUT gctUINT32 * waitSize |
797 | ); | 805 | ); |
798 | 806 | ||
799 | typedef struct _gcsLOCK_INFO * gcsLOCK_INFO_PTR; | 807 | typedef struct _gcsLOCK_INFO * gcsLOCK_INFO_PTR; |
@@ -835,12 +843,12 @@ typedef union _gcuVIDMEM_NODE | |||
835 | gcuVIDMEM_NODE_PTR prevFree; | 843 | gcuVIDMEM_NODE_PTR prevFree; |
836 | 844 | ||
837 | /* Information for this node. */ | 845 | /* Information for this node. */ |
838 | gctUINT32 offset; | 846 | gctSIZE_T offset; |
839 | gctSIZE_T bytes; | 847 | gctSIZE_T bytes; |
840 | gctUINT32 alignment; | 848 | gctUINT32 alignment; |
841 | 849 | ||
842 | #ifdef __QNXNTO__ | 850 | #ifdef __QNXNTO__ |
843 | /* Client/server vaddr (mapped using mmap_join). */ | 851 | /* Client virtual address. */ |
844 | gctPOINTER logical; | 852 | gctPOINTER logical; |
845 | #endif | 853 | #endif |
846 | 854 | ||
@@ -1105,17 +1113,36 @@ struct _gckMMU | |||
1105 | 1113 | ||
1106 | gceSTATUS | 1114 | gceSTATUS |
1107 | gckOS_CreateKernelVirtualMapping( | 1115 | gckOS_CreateKernelVirtualMapping( |
1116 | IN gckOS Os, | ||
1108 | IN gctPHYS_ADDR Physical, | 1117 | IN gctPHYS_ADDR Physical, |
1109 | IN gctSIZE_T Bytes, | 1118 | IN gctSIZE_T Bytes, |
1110 | OUT gctSIZE_T * PageCount, | 1119 | OUT gctPOINTER * Logical, |
1111 | OUT gctPOINTER * Logical | 1120 | OUT gctSIZE_T * PageCount |
1112 | ); | 1121 | ); |
1113 | 1122 | ||
1114 | gceSTATUS | 1123 | gceSTATUS |
1115 | gckOS_DestroyKernelVirtualMapping( | 1124 | gckOS_DestroyKernelVirtualMapping( |
1116 | IN gctPHYS_ADDR physical, | 1125 | IN gckOS Os, |
1117 | IN gctPOINTER Logical, | 1126 | IN gctPHYS_ADDR Physical, |
1118 | IN gctSIZE_T Bytes | 1127 | IN gctSIZE_T Bytes, |
1128 | IN gctPOINTER Logical | ||
1129 | ); | ||
1130 | |||
1131 | gceSTATUS | ||
1132 | gckOS_CreateUserVirtualMapping( | ||
1133 | IN gckOS Os, | ||
1134 | IN gctPHYS_ADDR Physical, | ||
1135 | IN gctSIZE_T Bytes, | ||
1136 | OUT gctPOINTER * Logical, | ||
1137 | OUT gctSIZE_T * PageCount | ||
1138 | ); | ||
1139 | |||
1140 | gceSTATUS | ||
1141 | gckOS_DestroyUserVirtualMapping( | ||
1142 | IN gckOS Os, | ||
1143 | IN gctPHYS_ADDR Physical, | ||
1144 | IN gctSIZE_T Bytes, | ||
1145 | IN gctPOINTER Logical | ||
1119 | ); | 1146 | ); |
1120 | 1147 | ||
1121 | gceSTATUS | 1148 | gceSTATUS |
@@ -1139,6 +1166,7 @@ gceSTATUS | |||
1139 | gckKERNEL_GetGPUAddress( | 1166 | gckKERNEL_GetGPUAddress( |
1140 | IN gckKERNEL Kernel, | 1167 | IN gckKERNEL Kernel, |
1141 | IN gctPOINTER Logical, | 1168 | IN gctPOINTER Logical, |
1169 | IN gctBOOL InUserSpace, | ||
1142 | OUT gctUINT32 * Address | 1170 | OUT gctUINT32 * Address |
1143 | ); | 1171 | ); |
1144 | 1172 | ||
@@ -1185,6 +1213,7 @@ gckHARDWARE_QueryIdle( | |||
1185 | OUT gctBOOL_PTR IsIdle | 1213 | OUT gctBOOL_PTR IsIdle |
1186 | ); | 1214 | ); |
1187 | 1215 | ||
1216 | |||
1188 | /******************************************************************************\ | 1217 | /******************************************************************************\ |
1189 | ******************************* gckCONTEXT Object ******************************* | 1218 | ******************************* gckCONTEXT Object ******************************* |
1190 | \******************************************************************************/ | 1219 | \******************************************************************************/ |
@@ -1233,27 +1262,20 @@ gckLINKQUEUE_GetData( | |||
1233 | ); | 1262 | ); |
1234 | #endif | 1263 | #endif |
1235 | 1264 | ||
1236 | #if gcdPROCESS_ADDRESS_SPACE | 1265 | gceSTATUS |
1237 | void | ||
1238 | gckENTRYQUEUE_Enqueue( | 1266 | gckENTRYQUEUE_Enqueue( |
1267 | IN gckKERNEL Kernel, | ||
1239 | IN gckENTRYQUEUE Queue, | 1268 | IN gckENTRYQUEUE Queue, |
1240 | IN gctUINT32 physical, | 1269 | IN gctUINT32 physical, |
1241 | IN gctUINT32 bytes | 1270 | IN gctUINT32 bytes |
1242 | ); | 1271 | ); |
1243 | 1272 | ||
1244 | void | 1273 | gceSTATUS |
1245 | gckENTRYQUEUE_GetData( | 1274 | gckENTRYQUEUE_Dequeue( |
1246 | IN gckENTRYQUEUE Queue, | 1275 | IN gckENTRYQUEUE Queue, |
1247 | IN gctUINT32 Index, | ||
1248 | OUT gckENTRYDATA * Data | 1276 | OUT gckENTRYDATA * Data |
1249 | ); | 1277 | ); |
1250 | 1278 | ||
1251 | void | ||
1252 | gckENTRYQUEUE_Dequeue( | ||
1253 | IN gckENTRYQUEUE Queue | ||
1254 | ); | ||
1255 | #endif | ||
1256 | |||
1257 | #ifdef __cplusplus | 1279 | #ifdef __cplusplus |
1258 | } | 1280 | } |
1259 | #endif | 1281 | #endif |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c index 20a5257c6e34..cf43706cb2ec 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c | |||
@@ -23,10 +23,6 @@ | |||
23 | #include "gc_hal_kernel_precomp.h" | 23 | #include "gc_hal_kernel_precomp.h" |
24 | #include "gc_hal_kernel_context.h" | 24 | #include "gc_hal_kernel_context.h" |
25 | 25 | ||
26 | #ifdef __QNXNTO__ | ||
27 | #include <sys/slog.h> | ||
28 | #endif | ||
29 | |||
30 | #define _GC_OBJ_ZONE gcvZONE_COMMAND | 26 | #define _GC_OBJ_ZONE gcvZONE_COMMAND |
31 | 27 | ||
32 | /******************************************************************************\ | 28 | /******************************************************************************\ |
@@ -106,14 +102,14 @@ _NewQueue( | |||
106 | Command->index = newIndex; | 102 | Command->index = newIndex; |
107 | Command->newQueue = gcvTRUE; | 103 | Command->newQueue = gcvTRUE; |
108 | Command->logical = Command->queues[newIndex].logical; | 104 | Command->logical = Command->queues[newIndex].logical; |
105 | Command->address = Command->queues[newIndex].address; | ||
109 | Command->offset = 0; | 106 | Command->offset = 0; |
110 | 107 | ||
111 | gcmkONERROR( | 108 | gcmkONERROR(gckOS_GetPhysicalAddress( |
112 | gckOS_GetPhysicalAddress( | 109 | Command->os, |
113 | Command->os, | 110 | Command->logical, |
114 | Command->logical, | 111 | (gctUINT32 *) &Command->physical |
115 | (gctUINT32 *) &Command->physical | 112 | )); |
116 | )); | ||
117 | 113 | ||
118 | if (currentIndex != -1) | 114 | if (currentIndex != -1) |
119 | { | 115 | { |
@@ -322,7 +318,6 @@ OnError: | |||
322 | } | 318 | } |
323 | #endif | 319 | #endif |
324 | 320 | ||
325 | #if !gcdPROCESS_ADDRESS_SPACE | ||
326 | static gceSTATUS | 321 | static gceSTATUS |
327 | _FlushMMU( | 322 | _FlushMMU( |
328 | IN gckCOMMAND Command | 323 | IN gckCOMMAND Command |
@@ -331,6 +326,14 @@ _FlushMMU( | |||
331 | gceSTATUS status; | 326 | gceSTATUS status; |
332 | gctUINT32 oldValue; | 327 | gctUINT32 oldValue; |
333 | gckHARDWARE hardware = Command->kernel->hardware; | 328 | gckHARDWARE hardware = Command->kernel->hardware; |
329 | gctBOOL pause = gcvFALSE; | ||
330 | |||
331 | gctUINT8_PTR pointer; | ||
332 | gctUINT32 eventBytes; | ||
333 | gctUINT32 endBytes; | ||
334 | gctUINT32 bufferSize; | ||
335 | gctUINT32 executeBytes; | ||
336 | gctUINT32 waitLinkBytes; | ||
334 | 337 | ||
335 | gcmkONERROR(gckOS_AtomicExchange(Command->os, | 338 | gcmkONERROR(gckOS_AtomicExchange(Command->os, |
336 | hardware->pageTableDirty, | 339 | hardware->pageTableDirty, |
@@ -341,13 +344,68 @@ _FlushMMU( | |||
341 | { | 344 | { |
342 | /* Page Table is upated, flush mmu before commit. */ | 345 | /* Page Table is upated, flush mmu before commit. */ |
343 | gcmkONERROR(gckHARDWARE_FlushMMU(hardware)); | 346 | gcmkONERROR(gckHARDWARE_FlushMMU(hardware)); |
347 | |||
348 | if ((oldValue & gcvPAGE_TABLE_DIRTY_BIT_FE) | ||
349 | && (hardware->endAfterFlushMmuCache) | ||
350 | ) | ||
351 | { | ||
352 | pause = gcvTRUE; | ||
353 | } | ||
354 | } | ||
355 | |||
356 | if (pause) | ||
357 | { | ||
358 | /* Query size. */ | ||
359 | gcmkONERROR(gckHARDWARE_Event(hardware, gcvNULL, 0, 0, &eventBytes)); | ||
360 | gcmkONERROR(gckHARDWARE_End(hardware, gcvNULL, &endBytes)); | ||
361 | |||
362 | executeBytes = eventBytes + endBytes; | ||
363 | |||
364 | gcmkONERROR(gckHARDWARE_WaitLink( | ||
365 | hardware, | ||
366 | gcvNULL, | ||
367 | Command->offset + executeBytes, | ||
368 | &waitLinkBytes, | ||
369 | gcvNULL, | ||
370 | gcvNULL | ||
371 | )); | ||
372 | |||
373 | /* Reserve space. */ | ||
374 | gcmkONERROR(gckCOMMAND_Reserve( | ||
375 | Command, | ||
376 | executeBytes, | ||
377 | (gctPOINTER *)&pointer, | ||
378 | &bufferSize | ||
379 | )); | ||
380 | |||
381 | /* Append EVENT(29). */ | ||
382 | gcmkONERROR(gckHARDWARE_Event( | ||
383 | hardware, | ||
384 | pointer, | ||
385 | 29, | ||
386 | gcvKERNEL_PIXEL, | ||
387 | &eventBytes | ||
388 | )); | ||
389 | |||
390 | /* Append END. */ | ||
391 | pointer += eventBytes; | ||
392 | gcmkONERROR(gckHARDWARE_End(hardware, pointer, &endBytes)); | ||
393 | |||
394 | /* Store address to queue. */ | ||
395 | gcmkONERROR(gckENTRYQUEUE_Enqueue( | ||
396 | Command->kernel, | ||
397 | &Command->queue, | ||
398 | Command->address + Command->offset + executeBytes, | ||
399 | waitLinkBytes | ||
400 | )); | ||
401 | |||
402 | gcmkONERROR(gckCOMMAND_Execute(Command, executeBytes)); | ||
344 | } | 403 | } |
345 | 404 | ||
346 | return gcvSTATUS_OK; | 405 | return gcvSTATUS_OK; |
347 | OnError: | 406 | OnError: |
348 | return status; | 407 | return status; |
349 | } | 408 | } |
350 | #endif | ||
351 | 409 | ||
352 | static void | 410 | static void |
353 | _DumpBuffer( | 411 | _DumpBuffer( |
@@ -356,13 +414,12 @@ _DumpBuffer( | |||
356 | IN gctSIZE_T Size | 414 | IN gctSIZE_T Size |
357 | ) | 415 | ) |
358 | { | 416 | { |
359 | gctINT i, line, left; | 417 | gctSIZE_T i, line, left; |
360 | gctUINT32_PTR data = Buffer; | 418 | gctUINT32_PTR data = Buffer; |
361 | 419 | ||
362 | line = Size / 32; | 420 | line = Size / 32; |
363 | left = Size % 32; | 421 | left = Size % 32; |
364 | 422 | ||
365 | |||
366 | for (i = 0; i < line; i++) | 423 | for (i = 0; i < line; i++) |
367 | { | 424 | { |
368 | gcmkPRINT("%X : %08X %08X %08X %08X %08X %08X %08X %08X ", | 425 | gcmkPRINT("%X : %08X %08X %08X %08X %08X %08X %08X %08X ", |
@@ -409,11 +466,11 @@ _DumpBuffer( | |||
409 | static void | 466 | static void |
410 | _DumpKernelCommandBuffer( | 467 | _DumpKernelCommandBuffer( |
411 | IN gckCOMMAND Command | 468 | IN gckCOMMAND Command |
412 | ) | 469 | ) |
413 | { | 470 | { |
414 | gctINT i; | 471 | gctINT i; |
415 | gctUINT32 physical; | 472 | gctUINT32 physical = 0; |
416 | gctPOINTER entry; | 473 | gctPOINTER entry = gcvNULL; |
417 | 474 | ||
418 | for (i = 0; i < gcdCOMMAND_QUEUES; i++) | 475 | for (i = 0; i < gcdCOMMAND_QUEUES; i++) |
419 | { | 476 | { |
@@ -459,6 +516,7 @@ gckCOMMAND_Construct( | |||
459 | gceSTATUS status; | 516 | gceSTATUS status; |
460 | gctINT i; | 517 | gctINT i; |
461 | gctPOINTER pointer = gcvNULL; | 518 | gctPOINTER pointer = gcvNULL; |
519 | gctSIZE_T pageSize; | ||
462 | 520 | ||
463 | gcmkHEADER_ARG("Kernel=0x%x", Kernel); | 521 | gcmkHEADER_ARG("Kernel=0x%x", Kernel); |
464 | 522 | ||
@@ -507,7 +565,9 @@ gckCOMMAND_Construct( | |||
507 | gcmkONERROR(gckOS_AtomConstruct(os, &command->atomCommit)); | 565 | gcmkONERROR(gckOS_AtomConstruct(os, &command->atomCommit)); |
508 | 566 | ||
509 | /* Get the page size from teh OS. */ | 567 | /* Get the page size from teh OS. */ |
510 | gcmkONERROR(gckOS_GetPageSize(os, &command->pageSize)); | 568 | gcmkONERROR(gckOS_GetPageSize(os, &pageSize)); |
569 | |||
570 | gcmkSAFECASTSIZET(command->pageSize, pageSize); | ||
511 | 571 | ||
512 | /* Get process ID. */ | 572 | /* Get process ID. */ |
513 | gcmkONERROR(gckOS_GetProcessID(&command->kernelProcessID)); | 573 | gcmkONERROR(gckOS_GetProcessID(&command->kernelProcessID)); |
@@ -521,11 +581,18 @@ gckCOMMAND_Construct( | |||
521 | gcmkONERROR(gckOS_AllocateNonPagedMemory( | 581 | gcmkONERROR(gckOS_AllocateNonPagedMemory( |
522 | os, | 582 | os, |
523 | gcvFALSE, | 583 | gcvFALSE, |
524 | &command->pageSize, | 584 | &pageSize, |
525 | &command->queues[i].physical, | 585 | &command->queues[i].physical, |
526 | &command->queues[i].logical | 586 | &command->queues[i].logical |
527 | )); | 587 | )); |
528 | 588 | ||
589 | gcmkONERROR(gckHARDWARE_ConvertLogical( | ||
590 | Kernel->hardware, | ||
591 | command->queues[i].logical, | ||
592 | gcvFALSE, | ||
593 | &command->queues[i].address | ||
594 | )); | ||
595 | |||
529 | gcmkONERROR(gckOS_CreateSignal( | 596 | gcmkONERROR(gckOS_CreateSignal( |
530 | os, gcvFALSE, &command->queues[i].signal | 597 | os, gcvFALSE, &command->queues[i].signal |
531 | )); | 598 | )); |
@@ -552,11 +619,9 @@ gckCOMMAND_Construct( | |||
552 | /* END event signal not created. */ | 619 | /* END event signal not created. */ |
553 | command->endEventSignal = gcvNULL; | 620 | command->endEventSignal = gcvNULL; |
554 | 621 | ||
555 | #if gcdPROCESS_ADDRESS_SPACE | ||
556 | command->queue.front = 0; | 622 | command->queue.front = 0; |
557 | command->queue.rear = 0; | 623 | command->queue.rear = 0; |
558 | command->queue.count = 0; | 624 | command->queue.count = 0; |
559 | #endif | ||
560 | 625 | ||
561 | /* Return pointer to the gckCOMMAND object. */ | 626 | /* Return pointer to the gckCOMMAND object. */ |
562 | *Command = command; | 627 | *Command = command; |
@@ -875,7 +940,7 @@ gckCOMMAND_Start( | |||
875 | gceSTATUS status; | 940 | gceSTATUS status; |
876 | gckHARDWARE hardware; | 941 | gckHARDWARE hardware; |
877 | gctUINT32 waitOffset = 0; | 942 | gctUINT32 waitOffset = 0; |
878 | gctSIZE_T waitLinkBytes; | 943 | gctUINT32 waitLinkBytes; |
879 | 944 | ||
880 | gcmkHEADER_ARG("Command=0x%x", Command); | 945 | gcmkHEADER_ARG("Command=0x%x", Command); |
881 | 946 | ||
@@ -935,21 +1000,11 @@ gckCOMMAND_Start( | |||
935 | Command->newQueue = gcvFALSE; | 1000 | Command->newQueue = gcvFALSE; |
936 | 1001 | ||
937 | /* Enable command processor. */ | 1002 | /* Enable command processor. */ |
938 | #ifdef __QNXNTO__ | ||
939 | gcmkONERROR(gckHARDWARE_Execute( | 1003 | gcmkONERROR(gckHARDWARE_Execute( |
940 | hardware, | 1004 | hardware, |
941 | Command->logical, | 1005 | Command->address, |
942 | Command->physical, | ||
943 | gcvTRUE, | ||
944 | waitLinkBytes | 1006 | waitLinkBytes |
945 | )); | 1007 | )); |
946 | #else | ||
947 | gcmkONERROR(gckHARDWARE_Execute( | ||
948 | hardware, | ||
949 | Command->logical, | ||
950 | waitLinkBytes | ||
951 | )); | ||
952 | #endif | ||
953 | 1008 | ||
954 | /* Command queue is running. */ | 1009 | /* Command queue is running. */ |
955 | Command->running = gcvTRUE; | 1010 | Command->running = gcvTRUE; |
@@ -1031,6 +1086,7 @@ gckCOMMAND_Stop( | |||
1031 | hardware, Command->waitLogical, &Command->waitSize | 1086 | hardware, Command->waitLogical, &Command->waitSize |
1032 | )); | 1087 | )); |
1033 | 1088 | ||
1089 | |||
1034 | /* Update queue tail pointer. */ | 1090 | /* Update queue tail pointer. */ |
1035 | gcmkONERROR(gckHARDWARE_UpdateQueueTail(Command->kernel->hardware, | 1091 | gcmkONERROR(gckHARDWARE_UpdateQueueTail(Command->kernel->hardware, |
1036 | Command->logical, | 1092 | Command->logical, |
@@ -1130,35 +1186,47 @@ gckCOMMAND_Commit( | |||
1130 | gcsCONTEXT_PTR contextBuffer; | 1186 | gcsCONTEXT_PTR contextBuffer; |
1131 | struct _gcoCMDBUF _commandBufferObject; | 1187 | struct _gcoCMDBUF _commandBufferObject; |
1132 | gctPHYS_ADDR commandBufferPhysical; | 1188 | gctPHYS_ADDR commandBufferPhysical; |
1133 | gctUINT8_PTR commandBufferLogical; | 1189 | gctUINT8_PTR commandBufferLogical = gcvNULL; |
1134 | gctUINT8_PTR commandBufferLink; | 1190 | gctUINT32 commandBufferAddress = 0; |
1191 | gctUINT8_PTR commandBufferLink = gcvNULL; | ||
1135 | gctUINT commandBufferSize; | 1192 | gctUINT commandBufferSize; |
1136 | gctSIZE_T nopBytes; | 1193 | gctSIZE_T nopBytes; |
1137 | gctSIZE_T pipeBytes; | 1194 | gctUINT32 pipeBytes; |
1138 | gctSIZE_T linkBytes; | 1195 | gctUINT32 linkBytes; |
1139 | gctSIZE_T bytes; | 1196 | gctSIZE_T bytes; |
1140 | gctUINT32 offset; | 1197 | gctUINT32 offset; |
1141 | #if gcdNONPAGED_MEMORY_CACHEABLE | 1198 | #if gcdNONPAGED_MEMORY_CACHEABLE |
1142 | gctPHYS_ADDR entryPhysical; | 1199 | gctPHYS_ADDR entryPhysical; |
1143 | #endif | 1200 | #endif |
1144 | gctPOINTER entryLogical; | 1201 | gctPOINTER entryLogical; |
1145 | gctSIZE_T entryBytes; | 1202 | gctUINT32 entryAddress; |
1203 | gctUINT32 entryBytes; | ||
1146 | #if gcdNONPAGED_MEMORY_CACHEABLE | 1204 | #if gcdNONPAGED_MEMORY_CACHEABLE |
1147 | gctPHYS_ADDR exitPhysical; | 1205 | gctPHYS_ADDR exitPhysical; |
1148 | #endif | 1206 | #endif |
1149 | gctPOINTER exitLogical; | 1207 | gctPOINTER exitLogical; |
1150 | gctSIZE_T exitBytes; | 1208 | gctUINT32 exitAddress; |
1209 | gctUINT32 exitBytes; | ||
1151 | gctPHYS_ADDR waitLinkPhysical; | 1210 | gctPHYS_ADDR waitLinkPhysical; |
1152 | gctPOINTER waitLinkLogical; | 1211 | gctPOINTER waitLinkLogical; |
1153 | gctSIZE_T waitLinkBytes; | 1212 | gctUINT32 waitLinkAddress; |
1213 | gctUINT32 waitLinkBytes; | ||
1154 | gctPHYS_ADDR waitPhysical; | 1214 | gctPHYS_ADDR waitPhysical; |
1155 | gctPOINTER waitLogical; | 1215 | gctPOINTER waitLogical; |
1156 | gctUINT32 waitOffset; | 1216 | gctUINT32 waitOffset; |
1157 | gctSIZE_T waitSize; | 1217 | gctUINT32 waitSize; |
1218 | |||
1219 | #ifdef __QNXNTO__ | ||
1220 | gctPOINTER userCommandBufferLogical = gcvNULL; | ||
1221 | gctBOOL userCommandBufferLogicalMapped = gcvFALSE; | ||
1222 | gctPOINTER userCommandBufferLink = gcvNULL; | ||
1223 | gctBOOL userCommandBufferLinkMapped = gcvFALSE; | ||
1224 | #endif | ||
1158 | 1225 | ||
1159 | #if gcdPROCESS_ADDRESS_SPACE | 1226 | #if gcdPROCESS_ADDRESS_SPACE |
1160 | gctSIZE_T mmuConfigureBytes; | 1227 | gctSIZE_T mmuConfigureBytes; |
1161 | gctPOINTER mmuConfigureLogical = gcvNULL; | 1228 | gctPOINTER mmuConfigureLogical = gcvNULL; |
1229 | gctUINT32 mmuConfigureAddress; | ||
1162 | gctPOINTER mmuConfigurePhysical = 0; | 1230 | gctPOINTER mmuConfigurePhysical = 0; |
1163 | gctSIZE_T mmuConfigureWaitLinkOffset; | 1231 | gctSIZE_T mmuConfigureWaitLinkOffset; |
1164 | gckMMU mmu; | 1232 | gckMMU mmu; |
@@ -1192,7 +1260,7 @@ gckCOMMAND_Commit( | |||
1192 | /* Verify the arguments. */ | 1260 | /* Verify the arguments. */ |
1193 | gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND); | 1261 | gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND); |
1194 | 1262 | ||
1195 | if (Command->kernel->core == gcvCORE_2D) | 1263 | if (Command->kernel->hardware->type== gcvHARDWARE_2D) |
1196 | { | 1264 | { |
1197 | /* There is no context for 2D. */ | 1265 | /* There is no context for 2D. */ |
1198 | Context = gcvNULL; | 1266 | Context = gcvNULL; |
@@ -1206,7 +1274,6 @@ gckCOMMAND_Commit( | |||
1206 | 0, | 1274 | 0, |
1207 | &oldValue)); | 1275 | &oldValue)); |
1208 | #else | 1276 | #else |
1209 | gcmkONERROR(_FlushMMU(Command)); | ||
1210 | #endif | 1277 | #endif |
1211 | 1278 | ||
1212 | #if VIVANTE_PROFILER_CONTEXT | 1279 | #if VIVANTE_PROFILER_CONTEXT |
@@ -1287,7 +1354,7 @@ gckCOMMAND_Commit( | |||
1287 | 1354 | ||
1288 | /* Query the size of LINK command. */ | 1355 | /* Query the size of LINK command. */ |
1289 | gcmkONERROR(gckHARDWARE_Link( | 1356 | gcmkONERROR(gckHARDWARE_Link( |
1290 | hardware, gcvNULL, gcvNULL, 0, &linkBytes | 1357 | hardware, gcvNULL, 0, 0, &linkBytes |
1291 | )); | 1358 | )); |
1292 | 1359 | ||
1293 | #if gcdMULTI_GPU | 1360 | #if gcdMULTI_GPU |
@@ -1302,17 +1369,54 @@ gckCOMMAND_Commit( | |||
1302 | = (gctUINT8_PTR) gcmUINT64_TO_PTR(commandBufferObject->logical) | 1369 | = (gctUINT8_PTR) gcmUINT64_TO_PTR(commandBufferObject->logical) |
1303 | + commandBufferObject->startOffset; | 1370 | + commandBufferObject->startOffset; |
1304 | 1371 | ||
1305 | gcmkONERROR(gckOS_GetPhysicalAddress( | 1372 | /* Get the hardware address. */ |
1373 | if (Command->kernel->virtualCommandBuffer) | ||
1374 | { | ||
1375 | gcmkONERROR(gckKERNEL_GetGPUAddress( | ||
1376 | Command->kernel, | ||
1377 | commandBufferLogical, | ||
1378 | gcvTRUE, | ||
1379 | &commandBufferAddress | ||
1380 | )); | ||
1381 | } | ||
1382 | else | ||
1383 | { | ||
1384 | gcmkONERROR(gckHARDWARE_ConvertLogical( | ||
1385 | hardware, | ||
1386 | commandBufferLogical, | ||
1387 | gcvTRUE, | ||
1388 | &commandBufferAddress | ||
1389 | )); | ||
1390 | } | ||
1391 | |||
1392 | /* Get the physical address. */ | ||
1393 | gcmkONERROR(gckOS_UserLogicalToPhysical( | ||
1306 | Command->os, | 1394 | Command->os, |
1307 | commandBufferLogical, | 1395 | commandBufferLogical, |
1308 | (gctUINT32_PTR)&commandBufferPhysical | 1396 | (gctUINT32_PTR)&commandBufferPhysical |
1309 | )); | 1397 | )); |
1310 | 1398 | ||
1399 | #ifdef __QNXNTO__ | ||
1400 | userCommandBufferLogical = (gctPOINTER) commandBufferLogical; | ||
1401 | |||
1402 | gcmkONERROR(gckOS_MapUserPointer( | ||
1403 | Command->os, | ||
1404 | userCommandBufferLogical, | ||
1405 | 0, | ||
1406 | &pointer)); | ||
1407 | |||
1408 | commandBufferLogical = pointer; | ||
1409 | |||
1410 | userCommandBufferLogicalMapped = gcvTRUE; | ||
1411 | #endif | ||
1412 | |||
1311 | commandBufferSize | 1413 | commandBufferSize |
1312 | = commandBufferObject->offset | 1414 | = commandBufferObject->offset |
1313 | + Command->reservedTail | 1415 | + Command->reservedTail |
1314 | - commandBufferObject->startOffset; | 1416 | - commandBufferObject->startOffset; |
1315 | 1417 | ||
1418 | gcmkONERROR(_FlushMMU(Command)); | ||
1419 | |||
1316 | /* Get the current offset. */ | 1420 | /* Get the current offset. */ |
1317 | offset = Command->offset; | 1421 | offset = Command->offset; |
1318 | 1422 | ||
@@ -1356,79 +1460,35 @@ gckCOMMAND_Commit( | |||
1356 | } | 1460 | } |
1357 | #endif | 1461 | #endif |
1358 | 1462 | ||
1359 | #if gcdPROCESS_ADDRESS_SPACE | 1463 | /* Query the size of WAIT/LINK command sequence. */ |
1360 | if (Command->currentMmu != mmu || oldValue) | 1464 | gcmkONERROR(gckHARDWARE_WaitLink( |
1361 | { | 1465 | hardware, |
1362 | /* Query the size of PAGE TABLE SWITCH command sequence. */ | 1466 | gcvNULL, |
1363 | gcmkONERROR(gckHARDWARE_ConfigMMU( | 1467 | offset, |
1364 | hardware, | 1468 | &waitLinkBytes, |
1365 | gcvNULL, | 1469 | gcvNULL, |
1366 | gcvNULL, | 1470 | gcvNULL |
1367 | offset, | 1471 | )); |
1368 | &mmuConfigureBytes, | ||
1369 | &mmuConfigureWaitLinkOffset, | ||
1370 | &waitLinkBytes | ||
1371 | )); | ||
1372 | |||
1373 | /* Is there enough space in the current command queue? */ | ||
1374 | if (bytes < mmuConfigureBytes) | ||
1375 | { | ||
1376 | /* No, create a new one. */ | ||
1377 | gcmkONERROR(_NewQueue(Command)); | ||
1378 | |||
1379 | /* Get the new current offset. */ | ||
1380 | offset = Command->offset; | ||
1381 | |||
1382 | /* Recompute the number of bytes in the new kernel command queue. */ | ||
1383 | bytes = Command->pageSize - offset; | ||
1384 | gcmkASSERT(bytes >= mmuConfigureBytes); | ||
1385 | } | ||
1386 | |||
1387 | mmuConfigurePhysical = (gctUINT8_PTR) Command->physical + offset; | ||
1388 | mmuConfigureLogical = (gctUINT8_PTR) Command->logical + offset; | ||
1389 | |||
1390 | /* Compute the location if WAIT/LINK command sequence. */ | ||
1391 | waitLinkPhysical = (gctUINT8_PTR) mmuConfigurePhysical + mmuConfigureWaitLinkOffset; | ||
1392 | waitLinkLogical = (gctUINT8_PTR) mmuConfigureLogical + mmuConfigureWaitLinkOffset; | ||
1393 | 1472 | ||
1394 | reservedBytes = mmuConfigureBytes; | 1473 | /* Is there enough space in the current command queue? */ |
1395 | } | 1474 | if (bytes < waitLinkBytes) |
1396 | else | ||
1397 | #endif | ||
1398 | { | 1475 | { |
1399 | /* Query the size of WAIT/LINK command sequence. */ | 1476 | /* No, create a new one. */ |
1400 | gcmkONERROR(gckHARDWARE_WaitLink( | 1477 | gcmkONERROR(_NewQueue(Command)); |
1401 | hardware, | ||
1402 | gcvNULL, | ||
1403 | offset, | ||
1404 | &waitLinkBytes, | ||
1405 | gcvNULL, | ||
1406 | gcvNULL | ||
1407 | )); | ||
1408 | |||
1409 | /* Is there enough space in the current command queue? */ | ||
1410 | if (bytes < waitLinkBytes) | ||
1411 | { | ||
1412 | /* No, create a new one. */ | ||
1413 | gcmkONERROR(_NewQueue(Command)); | ||
1414 | |||
1415 | /* Get the new current offset. */ | ||
1416 | offset = Command->offset; | ||
1417 | |||
1418 | /* Recompute the number of bytes in the new kernel command queue. */ | ||
1419 | bytes = Command->pageSize - offset; | ||
1420 | gcmkASSERT(bytes >= waitLinkBytes); | ||
1421 | } | ||
1422 | 1478 | ||
1423 | /* Compute the location if WAIT/LINK command sequence. */ | 1479 | /* Get the new current offset. */ |
1424 | waitLinkPhysical = (gctUINT8_PTR) Command->physical + offset; | 1480 | offset = Command->offset; |
1425 | waitLinkLogical = (gctUINT8_PTR) Command->logical + offset; | ||
1426 | 1481 | ||
1427 | #if gcdPROCESS_ADDRESS_SPACE | 1482 | /* Recompute the number of bytes in the new kernel command queue. */ |
1428 | reservedBytes = waitLinkBytes; | 1483 | bytes = Command->pageSize - offset; |
1429 | #endif | 1484 | gcmkASSERT(bytes >= waitLinkBytes); |
1430 | } | 1485 | } |
1431 | 1486 | ||
1487 | /* Compute the location if WAIT/LINK command sequence. */ | ||
1488 | waitLinkPhysical = (gctUINT8_PTR) Command->physical + offset; | ||
1489 | waitLinkLogical = (gctUINT8_PTR) Command->logical + offset; | ||
1490 | waitLinkAddress = Command->address + offset; | ||
1491 | |||
1432 | /* Context switch required? */ | 1492 | /* Context switch required? */ |
1433 | if (Context == gcvNULL) | 1493 | if (Context == gcvNULL) |
1434 | { | 1494 | { |
@@ -1458,6 +1518,7 @@ gckCOMMAND_Commit( | |||
1458 | entryPhysical = (gctUINT8_PTR) commandBufferPhysical + offset; | 1518 | entryPhysical = (gctUINT8_PTR) commandBufferPhysical + offset; |
1459 | #endif | 1519 | #endif |
1460 | entryLogical = commandBufferLogical + offset; | 1520 | entryLogical = commandBufferLogical + offset; |
1521 | entryAddress = commandBufferAddress + offset; | ||
1461 | entryBytes = commandBufferSize - offset; | 1522 | entryBytes = commandBufferSize - offset; |
1462 | } | 1523 | } |
1463 | else if (Command->currContext != Context) | 1524 | else if (Command->currContext != Context) |
@@ -1493,6 +1554,7 @@ gckCOMMAND_Commit( | |||
1493 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; | 1554 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; |
1494 | #endif | 1555 | #endif |
1495 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; | 1556 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; |
1557 | entryAddress = contextBuffer->address + pipeBytes; | ||
1496 | entryBytes = Context->bufferSize - pipeBytes; | 1558 | entryBytes = Context->bufferSize - pipeBytes; |
1497 | } | 1559 | } |
1498 | else | 1560 | else |
@@ -1501,6 +1563,7 @@ gckCOMMAND_Commit( | |||
1501 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; | 1563 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; |
1502 | #endif | 1564 | #endif |
1503 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; | 1565 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; |
1566 | entryAddress = contextBuffer->address; | ||
1504 | entryBytes = Context->bufferSize; | 1567 | entryBytes = Context->bufferSize; |
1505 | } | 1568 | } |
1506 | 1569 | ||
@@ -1539,7 +1602,7 @@ gckCOMMAND_Commit( | |||
1539 | gcmkONERROR(gckHARDWARE_Link( | 1602 | gcmkONERROR(gckHARDWARE_Link( |
1540 | hardware, | 1603 | hardware, |
1541 | contextBuffer->link3D, | 1604 | contextBuffer->link3D, |
1542 | commandBufferLogical + offset, | 1605 | commandBufferAddress + offset, |
1543 | commandBufferSize - offset, | 1606 | commandBufferSize - offset, |
1544 | &linkBytes | 1607 | &linkBytes |
1545 | )); | 1608 | )); |
@@ -1563,6 +1626,7 @@ gckCOMMAND_Commit( | |||
1563 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; | 1626 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; |
1564 | #endif | 1627 | #endif |
1565 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; | 1628 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; |
1629 | entryAddress = contextBuffer->address + pipeBytes; | ||
1566 | entryBytes = Context->entryOffset3D - pipeBytes; | 1630 | entryBytes = Context->entryOffset3D - pipeBytes; |
1567 | } | 1631 | } |
1568 | else | 1632 | else |
@@ -1571,6 +1635,7 @@ gckCOMMAND_Commit( | |||
1571 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; | 1635 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; |
1572 | #endif | 1636 | #endif |
1573 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; | 1637 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; |
1638 | entryAddress = contextBuffer->address; | ||
1574 | entryBytes = Context->entryOffset3D; | 1639 | entryBytes = Context->entryOffset3D; |
1575 | } | 1640 | } |
1576 | 1641 | ||
@@ -1604,7 +1669,7 @@ gckCOMMAND_Commit( | |||
1604 | gcmkONERROR(gckHARDWARE_Link( | 1669 | gcmkONERROR(gckHARDWARE_Link( |
1605 | hardware, | 1670 | hardware, |
1606 | contextBuffer->link2D, | 1671 | contextBuffer->link2D, |
1607 | commandBufferLogical + offset, | 1672 | commandBufferAddress + offset, |
1608 | commandBufferSize - offset, | 1673 | commandBufferSize - offset, |
1609 | &linkBytes | 1674 | &linkBytes |
1610 | )); | 1675 | )); |
@@ -1643,6 +1708,7 @@ gckCOMMAND_Commit( | |||
1643 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + offset; | 1708 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + offset; |
1644 | #endif | 1709 | #endif |
1645 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + offset; | 1710 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + offset; |
1711 | entryAddress = contextBuffer->address + offset; | ||
1646 | entryBytes = Context->bufferSize - offset; | 1712 | entryBytes = Context->bufferSize - offset; |
1647 | 1713 | ||
1648 | /* See if we have to switch pipes between the context | 1714 | /* See if we have to switch pipes between the context |
@@ -1672,7 +1738,7 @@ gckCOMMAND_Commit( | |||
1672 | gcmkONERROR(gckHARDWARE_Link( | 1738 | gcmkONERROR(gckHARDWARE_Link( |
1673 | hardware, | 1739 | hardware, |
1674 | contextBuffer->link3D, | 1740 | contextBuffer->link3D, |
1675 | commandBufferLogical + offset, | 1741 | commandBufferAddress + offset, |
1676 | commandBufferSize - offset, | 1742 | commandBufferSize - offset, |
1677 | &linkBytes | 1743 | &linkBytes |
1678 | )); | 1744 | )); |
@@ -1698,6 +1764,10 @@ gckCOMMAND_Commit( | |||
1698 | = (gctUINT8_PTR) contextBuffer->logical | 1764 | = (gctUINT8_PTR) contextBuffer->logical |
1699 | + Context->entryOffsetXDFrom3D; | 1765 | + Context->entryOffsetXDFrom3D; |
1700 | 1766 | ||
1767 | entryAddress | ||
1768 | = contextBuffer->address | ||
1769 | + Context->entryOffsetXDFrom3D; | ||
1770 | |||
1701 | entryBytes | 1771 | entryBytes |
1702 | = Context->bufferSize | 1772 | = Context->bufferSize |
1703 | - Context->entryOffsetXDFrom3D; | 1773 | - Context->entryOffsetXDFrom3D; |
@@ -1713,6 +1783,10 @@ gckCOMMAND_Commit( | |||
1713 | = (gctUINT8_PTR) contextBuffer->logical | 1783 | = (gctUINT8_PTR) contextBuffer->logical |
1714 | + Context->entryOffsetXDFrom2D; | 1784 | + Context->entryOffsetXDFrom2D; |
1715 | 1785 | ||
1786 | entryAddress | ||
1787 | = contextBuffer->address | ||
1788 | + Context->entryOffsetXDFrom2D; | ||
1789 | |||
1716 | entryBytes | 1790 | entryBytes |
1717 | = Context->totalSize | 1791 | = Context->totalSize |
1718 | - Context->entryOffsetXDFrom2D; | 1792 | - Context->entryOffsetXDFrom2D; |
@@ -1745,7 +1819,7 @@ gckCOMMAND_Commit( | |||
1745 | gcmkONERROR(gckHARDWARE_Link( | 1819 | gcmkONERROR(gckHARDWARE_Link( |
1746 | hardware, | 1820 | hardware, |
1747 | contextBuffer->link3D, | 1821 | contextBuffer->link3D, |
1748 | commandBufferLogical + offset, | 1822 | commandBufferAddress + offset, |
1749 | commandBufferSize - offset, | 1823 | commandBufferSize - offset, |
1750 | &linkBytes | 1824 | &linkBytes |
1751 | )); | 1825 | )); |
@@ -1771,6 +1845,7 @@ gckCOMMAND_Commit( | |||
1771 | contextDumpLogical = entryLogical; | 1845 | contextDumpLogical = entryLogical; |
1772 | contextDumpBytes = entryBytes; | 1846 | contextDumpBytes = entryBytes; |
1773 | #endif | 1847 | #endif |
1848 | |||
1774 | } | 1849 | } |
1775 | 1850 | ||
1776 | /* Same context. */ | 1851 | /* Same context. */ |
@@ -1797,6 +1872,7 @@ gckCOMMAND_Commit( | |||
1797 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; | 1872 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; |
1798 | #endif | 1873 | #endif |
1799 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; | 1874 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; |
1875 | entryAddress = contextBuffer->address + pipeBytes; | ||
1800 | entryBytes = Context->bufferSize - pipeBytes; | 1876 | entryBytes = Context->bufferSize - pipeBytes; |
1801 | } | 1877 | } |
1802 | else | 1878 | else |
@@ -1805,6 +1881,7 @@ gckCOMMAND_Commit( | |||
1805 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; | 1881 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; |
1806 | #endif | 1882 | #endif |
1807 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; | 1883 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; |
1884 | entryAddress = contextBuffer->address; | ||
1808 | entryBytes = Context->bufferSize; | 1885 | entryBytes = Context->bufferSize; |
1809 | } | 1886 | } |
1810 | 1887 | ||
@@ -1843,7 +1920,7 @@ gckCOMMAND_Commit( | |||
1843 | gcmkONERROR(gckHARDWARE_Link( | 1920 | gcmkONERROR(gckHARDWARE_Link( |
1844 | hardware, | 1921 | hardware, |
1845 | contextBuffer->link3D, | 1922 | contextBuffer->link3D, |
1846 | commandBufferLogical + offset, | 1923 | commandBufferAddress + offset, |
1847 | commandBufferSize - offset, | 1924 | commandBufferSize - offset, |
1848 | &linkBytes | 1925 | &linkBytes |
1849 | )); | 1926 | )); |
@@ -1857,6 +1934,7 @@ gckCOMMAND_Commit( | |||
1857 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; | 1934 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + pipeBytes; |
1858 | #endif | 1935 | #endif |
1859 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; | 1936 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + pipeBytes; |
1937 | entryAddress = contextBuffer->address + pipeBytes; | ||
1860 | entryBytes = Context->entryOffset3D - pipeBytes; | 1938 | entryBytes = Context->entryOffset3D - pipeBytes; |
1861 | } | 1939 | } |
1862 | else | 1940 | else |
@@ -1865,6 +1943,7 @@ gckCOMMAND_Commit( | |||
1865 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; | 1943 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical; |
1866 | #endif | 1944 | #endif |
1867 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; | 1945 | entryLogical = (gctUINT8_PTR) contextBuffer->logical; |
1946 | entryAddress = contextBuffer->address; | ||
1868 | entryBytes = Context->entryOffset3D; | 1947 | entryBytes = Context->entryOffset3D; |
1869 | } | 1948 | } |
1870 | 1949 | ||
@@ -1895,7 +1974,7 @@ gckCOMMAND_Commit( | |||
1895 | gcmkONERROR(gckHARDWARE_Link( | 1974 | gcmkONERROR(gckHARDWARE_Link( |
1896 | hardware, | 1975 | hardware, |
1897 | contextBuffer->link2D, | 1976 | contextBuffer->link2D, |
1898 | commandBufferLogical + offset, | 1977 | commandBufferAddress + offset, |
1899 | commandBufferSize - offset, | 1978 | commandBufferSize - offset, |
1900 | &linkBytes | 1979 | &linkBytes |
1901 | )); | 1980 | )); |
@@ -1925,6 +2004,7 @@ gckCOMMAND_Commit( | |||
1925 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + offset; | 2004 | entryPhysical = (gctUINT8_PTR) contextBuffer->physical + offset; |
1926 | #endif | 2005 | #endif |
1927 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + offset; | 2006 | entryLogical = (gctUINT8_PTR) contextBuffer->logical + offset; |
2007 | entryAddress = contextBuffer->address + offset; | ||
1928 | entryBytes = Context->bufferSize - offset; | 2008 | entryBytes = Context->bufferSize - offset; |
1929 | 2009 | ||
1930 | /* See if we have to switch pipes between the context | 2010 | /* See if we have to switch pipes between the context |
@@ -1954,7 +2034,7 @@ gckCOMMAND_Commit( | |||
1954 | gcmkONERROR(gckHARDWARE_Link( | 2034 | gcmkONERROR(gckHARDWARE_Link( |
1955 | hardware, | 2035 | hardware, |
1956 | contextBuffer->link3D, | 2036 | contextBuffer->link3D, |
1957 | commandBufferLogical + offset, | 2037 | commandBufferAddress + offset, |
1958 | commandBufferSize - offset, | 2038 | commandBufferSize - offset, |
1959 | &linkBytes | 2039 | &linkBytes |
1960 | )); | 2040 | )); |
@@ -1987,6 +2067,7 @@ gckCOMMAND_Commit( | |||
1987 | entryPhysical = (gctUINT8_PTR) commandBufferPhysical + offset; | 2067 | entryPhysical = (gctUINT8_PTR) commandBufferPhysical + offset; |
1988 | #endif | 2068 | #endif |
1989 | entryLogical = commandBufferLogical + offset; | 2069 | entryLogical = commandBufferLogical + offset; |
2070 | entryAddress = commandBufferAddress + offset; | ||
1990 | entryBytes = commandBufferSize - offset; | 2071 | entryBytes = commandBufferSize - offset; |
1991 | } | 2072 | } |
1992 | } | 2073 | } |
@@ -2011,13 +2092,9 @@ gckCOMMAND_Commit( | |||
2011 | exitPhysical = Command->physical; | 2092 | exitPhysical = Command->physical; |
2012 | #endif | 2093 | #endif |
2013 | 2094 | ||
2014 | #if gcdPROCESS_ADDRESS_SPACE | ||
2015 | exitLogical = waitLinkLogical; | ||
2016 | exitBytes = waitLinkBytes; | ||
2017 | #else | ||
2018 | exitLogical = Command->logical; | 2095 | exitLogical = Command->logical; |
2096 | exitAddress = Command->address; | ||
2019 | exitBytes = Command->offset + waitLinkBytes; | 2097 | exitBytes = Command->offset + waitLinkBytes; |
2020 | #endif | ||
2021 | } | 2098 | } |
2022 | else | 2099 | else |
2023 | { | 2100 | { |
@@ -2027,6 +2104,7 @@ gckCOMMAND_Commit( | |||
2027 | exitPhysical = waitLinkPhysical; | 2104 | exitPhysical = waitLinkPhysical; |
2028 | #endif | 2105 | #endif |
2029 | exitLogical = waitLinkLogical; | 2106 | exitLogical = waitLinkLogical; |
2107 | exitAddress = waitLinkAddress; | ||
2030 | exitBytes = waitLinkBytes; | 2108 | exitBytes = waitLinkBytes; |
2031 | } | 2109 | } |
2032 | 2110 | ||
@@ -2063,6 +2141,20 @@ gckCOMMAND_Commit( | |||
2063 | = (gctUINT8_PTR) gcmUINT64_TO_PTR(commandBufferObject->logical) | 2141 | = (gctUINT8_PTR) gcmUINT64_TO_PTR(commandBufferObject->logical) |
2064 | + commandBufferObject->offset; | 2142 | + commandBufferObject->offset; |
2065 | 2143 | ||
2144 | #ifdef __QNXNTO__ | ||
2145 | userCommandBufferLink = (gctPOINTER) commandBufferLink; | ||
2146 | |||
2147 | gcmkONERROR(gckOS_MapUserPointer( | ||
2148 | Command->os, | ||
2149 | userCommandBufferLink, | ||
2150 | 0, | ||
2151 | &pointer)); | ||
2152 | |||
2153 | commandBufferLink = pointer; | ||
2154 | |||
2155 | userCommandBufferLinkMapped = gcvTRUE; | ||
2156 | #endif | ||
2157 | |||
2066 | #if gcdMULTI_GPU | 2158 | #if gcdMULTI_GPU |
2067 | if (Command->kernel->core == gcvCORE_MAJOR) | 2159 | if (Command->kernel->core == gcvCORE_MAJOR) |
2068 | { | 2160 | { |
@@ -2079,11 +2171,21 @@ gckCOMMAND_Commit( | |||
2079 | gcmkONERROR(gckHARDWARE_Link( | 2171 | gcmkONERROR(gckHARDWARE_Link( |
2080 | hardware, | 2172 | hardware, |
2081 | commandBufferLink, | 2173 | commandBufferLink, |
2082 | exitLogical, | 2174 | exitAddress, |
2083 | exitBytes, | 2175 | exitBytes, |
2084 | &linkBytes | 2176 | &linkBytes |
2085 | )); | 2177 | )); |
2086 | 2178 | ||
2179 | #ifdef __QNXNTO__ | ||
2180 | gcmkONERROR(gckOS_UnmapUserPointer( | ||
2181 | Command->os, | ||
2182 | userCommandBufferLink, | ||
2183 | 0, | ||
2184 | commandBufferLink)); | ||
2185 | |||
2186 | userCommandBufferLinkMapped = gcvFALSE; | ||
2187 | #endif | ||
2188 | |||
2087 | #if gcdNONPAGED_MEMORY_CACHEABLE | 2189 | #if gcdNONPAGED_MEMORY_CACHEABLE |
2088 | /* Flush the command buffer cache. */ | 2190 | /* Flush the command buffer cache. */ |
2089 | gcmkONERROR(gckOS_CacheClean( | 2191 | gcmkONERROR(gckOS_CacheClean( |
@@ -2096,40 +2198,6 @@ gckCOMMAND_Commit( | |||
2096 | )); | 2198 | )); |
2097 | #endif | 2199 | #endif |
2098 | 2200 | ||
2099 | #if gcdPROCESS_ADDRESS_SPACE | ||
2100 | if (Command->currentMmu != mmu || oldValue) | ||
2101 | { | ||
2102 | gctUINT32 targetPhysical; | ||
2103 | |||
2104 | /* Fill MMU configuration command seqeunce. */ | ||
2105 | gcmkONERROR(gckHARDWARE_ConfigMMU( | ||
2106 | hardware, | ||
2107 | mmuConfigureLogical, | ||
2108 | mmu->mtlbLogical, | ||
2109 | offset, | ||
2110 | gcvNULL, | ||
2111 | gcvNULL, | ||
2112 | gcvNULL | ||
2113 | )); | ||
2114 | |||
2115 | gcmkONERROR( | ||
2116 | gckHARDWARE_ConvertLogical(hardware, entryLogical, &targetPhysical)); | ||
2117 | |||
2118 | gckENTRYQUEUE_Enqueue(&Command->queue, | ||
2119 | targetPhysical, | ||
2120 | entryBytes); | ||
2121 | |||
2122 | /* Update entryLogical. */ | ||
2123 | entryLogical = mmuConfigureLogical; | ||
2124 | |||
2125 | /* Update entryBytes. */ | ||
2126 | entryBytes = mmuConfigureBytes; | ||
2127 | |||
2128 | /* Update current MMU. */ | ||
2129 | Command->currentMmu = mmu; | ||
2130 | } | ||
2131 | #endif | ||
2132 | |||
2133 | /* Generate a LINK from the previous WAIT/LINK command sequence to the | 2201 | /* Generate a LINK from the previous WAIT/LINK command sequence to the |
2134 | entry determined above (either the context or the command buffer). | 2202 | entry determined above (either the context or the command buffer). |
2135 | This LINK replaces the WAIT instruction from the previous WAIT/LINK | 2203 | This LINK replaces the WAIT instruction from the previous WAIT/LINK |
@@ -2138,7 +2206,7 @@ gckCOMMAND_Commit( | |||
2138 | gcmkONERROR(gckHARDWARE_Link( | 2206 | gcmkONERROR(gckHARDWARE_Link( |
2139 | hardware, | 2207 | hardware, |
2140 | Command->waitLogical, | 2208 | Command->waitLogical, |
2141 | entryLogical, | 2209 | entryAddress, |
2142 | entryBytes, | 2210 | entryBytes, |
2143 | &Command->waitSize | 2211 | &Command->waitSize |
2144 | )); | 2212 | )); |
@@ -2191,11 +2259,7 @@ gckCOMMAND_Commit( | |||
2191 | Command->pipeSelect = commandBufferObject->exitPipe; | 2259 | Command->pipeSelect = commandBufferObject->exitPipe; |
2192 | 2260 | ||
2193 | /* Update command queue offset. */ | 2261 | /* Update command queue offset. */ |
2194 | #if gcdPROCESS_ADDRESS_SPACE | ||
2195 | Command->offset += reservedBytes; | ||
2196 | #else | ||
2197 | Command->offset += waitLinkBytes; | 2262 | Command->offset += waitLinkBytes; |
2198 | #endif | ||
2199 | Command->newQueue = gcvFALSE; | 2263 | Command->newQueue = gcvFALSE; |
2200 | 2264 | ||
2201 | /* Update address of last WAIT. */ | 2265 | /* Update address of last WAIT. */ |
@@ -2316,6 +2380,19 @@ gckCOMMAND_Commit( | |||
2316 | gcmkONERROR(status); | 2380 | gcmkONERROR(status); |
2317 | } | 2381 | } |
2318 | 2382 | ||
2383 | #ifdef __QNXNTO__ | ||
2384 | if (userCommandBufferLogicalMapped) | ||
2385 | { | ||
2386 | gcmkONERROR(gckOS_UnmapUserPointer( | ||
2387 | Command->os, | ||
2388 | userCommandBufferLogical, | ||
2389 | 0, | ||
2390 | commandBufferLogical)); | ||
2391 | |||
2392 | userCommandBufferLogicalMapped = gcvFALSE; | ||
2393 | } | ||
2394 | #endif | ||
2395 | |||
2319 | /* Unmap the command buffer pointer. */ | 2396 | /* Unmap the command buffer pointer. */ |
2320 | if (commandBufferMapped) | 2397 | if (commandBufferMapped) |
2321 | { | 2398 | { |
@@ -2365,6 +2442,26 @@ OnError: | |||
2365 | } | 2442 | } |
2366 | #endif | 2443 | #endif |
2367 | 2444 | ||
2445 | #ifdef __QNXNTO__ | ||
2446 | if (userCommandBufferLinkMapped) | ||
2447 | { | ||
2448 | gcmkONERROR(gckOS_UnmapUserPointer( | ||
2449 | Command->os, | ||
2450 | userCommandBufferLink, | ||
2451 | 0, | ||
2452 | commandBufferLink)); | ||
2453 | } | ||
2454 | |||
2455 | if (userCommandBufferLogicalMapped) | ||
2456 | { | ||
2457 | gcmkVERIFY_OK(gckOS_UnmapUserPointer( | ||
2458 | Command->os, | ||
2459 | userCommandBufferLogical, | ||
2460 | 0, | ||
2461 | commandBufferLogical)); | ||
2462 | } | ||
2463 | #endif | ||
2464 | |||
2368 | /* Unmap the command buffer pointer. */ | 2465 | /* Unmap the command buffer pointer. */ |
2369 | if (commandBufferMapped) | 2466 | if (commandBufferMapped) |
2370 | { | 2467 | { |
@@ -2408,14 +2505,14 @@ OnError: | |||
2408 | gceSTATUS | 2505 | gceSTATUS |
2409 | gckCOMMAND_Reserve( | 2506 | gckCOMMAND_Reserve( |
2410 | IN gckCOMMAND Command, | 2507 | IN gckCOMMAND Command, |
2411 | IN gctSIZE_T RequestedBytes, | 2508 | IN gctUINT32 RequestedBytes, |
2412 | OUT gctPOINTER * Buffer, | 2509 | OUT gctPOINTER * Buffer, |
2413 | OUT gctSIZE_T * BufferSize | 2510 | OUT gctUINT32 * BufferSize |
2414 | ) | 2511 | ) |
2415 | { | 2512 | { |
2416 | gceSTATUS status; | 2513 | gceSTATUS status; |
2417 | gctSIZE_T bytes; | 2514 | gctUINT32 bytes; |
2418 | gctSIZE_T requiredBytes; | 2515 | gctUINT32 requiredBytes; |
2419 | gctUINT32 requestedAligned; | 2516 | gctUINT32 requestedAligned; |
2420 | 2517 | ||
2421 | gcmkHEADER_ARG("Command=0x%x RequestedBytes=%lu", Command, RequestedBytes); | 2518 | gcmkHEADER_ARG("Command=0x%x RequestedBytes=%lu", Command, RequestedBytes); |
@@ -2500,7 +2597,7 @@ OnError: | |||
2500 | gceSTATUS | 2597 | gceSTATUS |
2501 | gckCOMMAND_Execute( | 2598 | gckCOMMAND_Execute( |
2502 | IN gckCOMMAND Command, | 2599 | IN gckCOMMAND Command, |
2503 | IN gctSIZE_T RequestedBytes | 2600 | IN gctUINT32 RequestedBytes |
2504 | ) | 2601 | ) |
2505 | { | 2602 | { |
2506 | gceSTATUS status; | 2603 | gceSTATUS status; |
@@ -2508,18 +2605,19 @@ gckCOMMAND_Execute( | |||
2508 | gctPHYS_ADDR waitLinkPhysical; | 2605 | gctPHYS_ADDR waitLinkPhysical; |
2509 | gctUINT8_PTR waitLinkLogical; | 2606 | gctUINT8_PTR waitLinkLogical; |
2510 | gctUINT32 waitLinkOffset; | 2607 | gctUINT32 waitLinkOffset; |
2511 | gctSIZE_T waitLinkBytes; | 2608 | gctUINT32 waitLinkBytes; |
2512 | 2609 | ||
2513 | gctPHYS_ADDR waitPhysical; | 2610 | gctPHYS_ADDR waitPhysical; |
2514 | gctPOINTER waitLogical; | 2611 | gctPOINTER waitLogical; |
2515 | gctUINT32 waitOffset; | 2612 | gctUINT32 waitOffset; |
2516 | gctSIZE_T waitBytes; | 2613 | gctUINT32 waitBytes; |
2517 | 2614 | ||
2518 | #if gcdNONPAGED_MEMORY_CACHEABLE | 2615 | #if gcdNONPAGED_MEMORY_CACHEABLE |
2519 | gctPHYS_ADDR execPhysical; | 2616 | gctPHYS_ADDR execPhysical; |
2520 | #endif | 2617 | #endif |
2521 | gctPOINTER execLogical; | 2618 | gctPOINTER execLogical; |
2522 | gctSIZE_T execBytes; | 2619 | gctUINT32 execAddress; |
2620 | gctUINT32 execBytes; | ||
2523 | 2621 | ||
2524 | gcmkHEADER_ARG("Command=0x%x RequestedBytes=%lu", Command, RequestedBytes); | 2622 | gcmkHEADER_ARG("Command=0x%x RequestedBytes=%lu", Command, RequestedBytes); |
2525 | 2623 | ||
@@ -2559,6 +2657,7 @@ gckCOMMAND_Execute( | |||
2559 | execPhysical = Command->physical; | 2657 | execPhysical = Command->physical; |
2560 | #endif | 2658 | #endif |
2561 | execLogical = Command->logical; | 2659 | execLogical = Command->logical; |
2660 | execAddress = Command->address; | ||
2562 | execBytes = waitLinkOffset + waitLinkBytes; | 2661 | execBytes = waitLinkOffset + waitLinkBytes; |
2563 | } | 2662 | } |
2564 | else | 2663 | else |
@@ -2569,6 +2668,7 @@ gckCOMMAND_Execute( | |||
2569 | execPhysical = (gctUINT8 *) Command->physical + Command->offset; | 2668 | execPhysical = (gctUINT8 *) Command->physical + Command->offset; |
2570 | #endif | 2669 | #endif |
2571 | execLogical = (gctUINT8 *) Command->logical + Command->offset; | 2670 | execLogical = (gctUINT8 *) Command->logical + Command->offset; |
2671 | execAddress = Command->address + Command->offset; | ||
2572 | execBytes = RequestedBytes + waitLinkBytes; | 2672 | execBytes = RequestedBytes + waitLinkBytes; |
2573 | } | 2673 | } |
2574 | 2674 | ||
@@ -2588,7 +2688,7 @@ gckCOMMAND_Execute( | |||
2588 | gcmkONERROR(gckHARDWARE_Link( | 2688 | gcmkONERROR(gckHARDWARE_Link( |
2589 | Command->kernel->hardware, | 2689 | Command->kernel->hardware, |
2590 | Command->waitLogical, | 2690 | Command->waitLogical, |
2591 | execLogical, | 2691 | execAddress, |
2592 | execBytes, | 2692 | execBytes, |
2593 | &Command->waitSize | 2693 | &Command->waitSize |
2594 | )); | 2694 | )); |
@@ -2756,47 +2856,9 @@ gckCOMMAND_Stall( | |||
2756 | __FUNCTION__, __LINE__, idle | 2856 | __FUNCTION__, __LINE__, idle |
2757 | ); | 2857 | ); |
2758 | 2858 | ||
2759 | gcmkONERROR(gckOS_MemoryBarrier(os, gcvNULL)); | 2859 | gcmkVERIFY_OK(gckOS_MemoryBarrier(os, gcvNULL)); |
2760 | |||
2761 | #ifdef __QNXNTO__ | ||
2762 | gctUINT32 reg_cmdbuf_fetch; | ||
2763 | gctUINT32 reg_intr; | ||
2764 | |||
2765 | gcmkVERIFY_OK(gckOS_ReadRegisterEx( | ||
2766 | Command->kernel->hardware->os, Command->kernel->core, 0x0664, ®_cmdbuf_fetch | ||
2767 | )); | ||
2768 | |||
2769 | if (idle == 0x7FFFFFFE) | ||
2770 | { | ||
2771 | /* | ||
2772 | * GPU is idle so there should not be pending interrupts. | ||
2773 | * Just double check. | ||
2774 | * | ||
2775 | * Note that reading interrupt register clears it. | ||
2776 | * That's why we don't read it in all cases. | ||
2777 | */ | ||
2778 | gcmkVERIFY_OK(gckOS_ReadRegisterEx( | ||
2779 | Command->kernel->hardware->os, Command->kernel->core, 0x10, ®_intr | ||
2780 | )); | ||
2781 | |||
2782 | slogf( | ||
2783 | _SLOG_SETCODE(1, 0), | ||
2784 | _SLOG_CRITICAL, | ||
2785 | "GALcore: Stall timeout (idle = 0x%X, command buffer fetch = 0x%X, interrupt = 0x%X)", | ||
2786 | idle, reg_cmdbuf_fetch, reg_intr | ||
2787 | ); | ||
2788 | } | ||
2789 | else | ||
2790 | { | ||
2791 | slogf( | ||
2792 | _SLOG_SETCODE(1, 0), | ||
2793 | _SLOG_CRITICAL, | ||
2794 | "GALcore: Stall timeout (idle = 0x%X, command buffer fetch = 0x%X)", | ||
2795 | idle, reg_cmdbuf_fetch | ||
2796 | ); | ||
2797 | } | ||
2798 | #endif | ||
2799 | #endif | 2860 | #endif |
2861 | |||
2800 | /* Advance timer. */ | 2862 | /* Advance timer. */ |
2801 | timer += gcdGPU_ADVANCETIMER; | 2863 | timer += gcdGPU_ADVANCETIMER; |
2802 | } | 2864 | } |
@@ -3189,10 +3251,11 @@ gckCOMMAND_DumpExecutingBuffer( | |||
3189 | { | 3251 | { |
3190 | /* Make it accessiable by kernel if it is a user command buffer. */ | 3252 | /* Make it accessiable by kernel if it is a user command buffer. */ |
3191 | gcmkVERIFY_OK( | 3253 | gcmkVERIFY_OK( |
3192 | gckOS_CreateKernelVirtualMapping(buffer->physical, | 3254 | gckOS_CreateKernelVirtualMapping(os, |
3255 | buffer->physical, | ||
3193 | buffer->bytes, | 3256 | buffer->bytes, |
3194 | &pageCount, | 3257 | &entry, |
3195 | &entry)); | 3258 | &pageCount)); |
3196 | gcmkPRINT("User Command Buffer:"); | 3259 | gcmkPRINT("User Command Buffer:"); |
3197 | } | 3260 | } |
3198 | 3261 | ||
@@ -3202,7 +3265,11 @@ gckCOMMAND_DumpExecutingBuffer( | |||
3202 | /* Release kernel logical address if neccessary. */ | 3265 | /* Release kernel logical address if neccessary. */ |
3203 | if (!buffer->kernelLogical) | 3266 | if (!buffer->kernelLogical) |
3204 | { | 3267 | { |
3205 | gcmkVERIFY_OK(gckOS_DestroyKernelVirtualMapping(buffer->physical, entry, buffer->bytes)); | 3268 | gcmkVERIFY_OK( |
3269 | gckOS_DestroyKernelVirtualMapping(os, | ||
3270 | buffer->physical, | ||
3271 | buffer->bytes, | ||
3272 | entry)); | ||
3206 | } | 3273 | } |
3207 | } | 3274 | } |
3208 | 3275 | ||
@@ -3224,7 +3291,11 @@ gckCOMMAND_DumpExecutingBuffer( | |||
3224 | if (gcmIS_SUCCESS(status)) | 3291 | if (gcmIS_SUCCESS(status)) |
3225 | { | 3292 | { |
3226 | gcmkVERIFY_OK( | 3293 | gcmkVERIFY_OK( |
3227 | gckOS_CreateKernelVirtualMapping(buffer->physical, buffer->bytes, &pageCount, &entry)); | 3294 | gckOS_CreateKernelVirtualMapping(os, |
3295 | buffer->physical, | ||
3296 | buffer->bytes, | ||
3297 | &entry, | ||
3298 | &pageCount)); | ||
3228 | 3299 | ||
3229 | if (entry) | 3300 | if (entry) |
3230 | { | 3301 | { |
@@ -3248,7 +3319,10 @@ gckCOMMAND_DumpExecutingBuffer( | |||
3248 | } | 3319 | } |
3249 | 3320 | ||
3250 | gcmkVERIFY_OK( | 3321 | gcmkVERIFY_OK( |
3251 | gckOS_DestroyKernelVirtualMapping(buffer->physical, entry, buffer->bytes)); | 3322 | gckOS_DestroyKernelVirtualMapping(os, |
3323 | buffer->physical, | ||
3324 | buffer->bytes, | ||
3325 | entry)); | ||
3252 | } | 3326 | } |
3253 | else | 3327 | else |
3254 | { | 3328 | { |
@@ -3262,7 +3336,7 @@ gckCOMMAND_DumpExecutingBuffer( | |||
3262 | gceSTATUS | 3336 | gceSTATUS |
3263 | gckCOMMAND_AddressInKernelCommandBuffer( | 3337 | gckCOMMAND_AddressInKernelCommandBuffer( |
3264 | IN gckCOMMAND Command, | 3338 | IN gckCOMMAND Command, |
3265 | IN gctPOINTER Logical, | 3339 | IN gctUINT32 Address, |
3266 | OUT gctBOOL *In | 3340 | OUT gctBOOL *In |
3267 | ) | 3341 | ) |
3268 | { | 3342 | { |
@@ -3271,8 +3345,8 @@ gckCOMMAND_AddressInKernelCommandBuffer( | |||
3271 | 3345 | ||
3272 | for (i = 0; i < gcdCOMMAND_QUEUES; i++) | 3346 | for (i = 0; i < gcdCOMMAND_QUEUES; i++) |
3273 | { | 3347 | { |
3274 | if ((Logical >= Command->queues[i].logical) | 3348 | if ((Address >= Command->queues[i].address) |
3275 | && (Logical < (gctPOINTER)((gctUINT8_PTR)Command->queues[i].logical + Command->pageSize)) | 3349 | && (Address < (Command->queues[i].address + Command->pageSize)) |
3276 | ) | 3350 | ) |
3277 | { | 3351 | { |
3278 | in = gcvTRUE; | 3352 | in = gcvTRUE; |
@@ -3283,4 +3357,3 @@ gckCOMMAND_AddressInKernelCommandBuffer( | |||
3283 | *In = in; | 3357 | *In = in; |
3284 | return gcvSTATUS_OK; | 3358 | return gcvSTATUS_OK; |
3285 | } | 3359 | } |
3286 | |||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c index d62607aee146..c3e0201c2b81 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c | |||
@@ -537,7 +537,7 @@ _FreeTaskContainer( | |||
537 | gcsTASK_CONTAINER_PTR next; | 537 | gcsTASK_CONTAINER_PTR next; |
538 | gcsTASK_CONTAINER_PTR merged; | 538 | gcsTASK_CONTAINER_PTR merged; |
539 | 539 | ||
540 | gctSIZE_T mergedSize; | 540 | gctUINT32 mergedSize; |
541 | 541 | ||
542 | /* Verify arguments. */ | 542 | /* Verify arguments. */ |
543 | gcmkASSERT(Buffer != gcvNULL); | 543 | gcmkASSERT(Buffer != gcvNULL); |
@@ -614,8 +614,8 @@ _RemoveRecordFromProcesDB( | |||
614 | gctUINT32 size; | 614 | gctUINT32 size; |
615 | gctUINT32 handle; | 615 | gctUINT32 handle; |
616 | gckKERNEL kernel = Command->kernel->kernel; | 616 | gckKERNEL kernel = Command->kernel->kernel; |
617 | gckVIDMEM_NODE unlockNode; | 617 | gckVIDMEM_NODE unlockNode = gcvNULL; |
618 | gckVIDMEM_NODE nodeObject; | 618 | gckVIDMEM_NODE nodeObject = gcvNULL; |
619 | gceDATABASE_TYPE type; | 619 | gceDATABASE_TYPE type; |
620 | 620 | ||
621 | /* Get the total size of all tasks. */ | 621 | /* Get the total size of all tasks. */ |
@@ -638,13 +638,14 @@ _RemoveRecordFromProcesDB( | |||
638 | handle, | 638 | handle, |
639 | &nodeObject); | 639 | &nodeObject); |
640 | 640 | ||
641 | freeVideoMemory->node = gcmALL_TO_UINT32(nodeObject); | 641 | if (gcmIS_ERROR(status)) |
642 | |||
643 | if(gcmIS_SUCCESS(status)) | ||
644 | { | 642 | { |
645 | gckVIDMEM_HANDLE_Dereference(kernel, pid, handle); | 643 | return status; |
646 | } | 644 | } |
647 | 645 | ||
646 | gckVIDMEM_HANDLE_Dereference(kernel, pid, handle); | ||
647 | freeVideoMemory->node = gcmALL_TO_UINT32(nodeObject); | ||
648 | |||
648 | type = gcvDB_VIDEO_MEMORY | 649 | type = gcvDB_VIDEO_MEMORY |
649 | | (nodeObject->type << gcdDB_VIDEO_MEMORY_TYPE_SHIFT) | 650 | | (nodeObject->type << gcdDB_VIDEO_MEMORY_TYPE_SHIFT) |
650 | | (nodeObject->pool << gcdDB_VIDEO_MEMORY_POOL_SHIFT); | 651 | | (nodeObject->pool << gcdDB_VIDEO_MEMORY_POOL_SHIFT); |
@@ -678,13 +679,15 @@ _RemoveRecordFromProcesDB( | |||
678 | pid, | 679 | pid, |
679 | handle, | 680 | handle, |
680 | &unlockNode); | 681 | &unlockNode); |
681 | unlockVideoMemory->node = gcmPTR_TO_UINT64(unlockNode); | ||
682 | 682 | ||
683 | if(gcmIS_SUCCESS(status)) | 683 | if (gcmIS_ERROR(status)) |
684 | { | 684 | { |
685 | gckVIDMEM_HANDLE_Dereference(kernel, pid, handle); | 685 | return status; |
686 | } | 686 | } |
687 | 687 | ||
688 | gckVIDMEM_HANDLE_Dereference(kernel, pid, handle); | ||
689 | unlockVideoMemory->node = gcmPTR_TO_UINT64(unlockNode); | ||
690 | |||
688 | /* Advance to next task. */ | 691 | /* Advance to next task. */ |
689 | size -= sizeof(gcsTASK_UNLOCK_VIDEO_MEMORY); | 692 | size -= sizeof(gcsTASK_UNLOCK_VIDEO_MEMORY); |
690 | Task = (gcsTASK_HEADER_PTR)(unlockVideoMemory + 1); | 693 | Task = (gcsTASK_HEADER_PTR)(unlockVideoMemory + 1); |
@@ -725,6 +728,11 @@ _ScheduleTasks( | |||
725 | gctINT32 interrupt; | 728 | gctINT32 interrupt; |
726 | gctUINT8_PTR eventCommand; | 729 | gctUINT8_PTR eventCommand; |
727 | 730 | ||
731 | #ifdef __QNXNTO__ | ||
732 | gcsTASK_PTR oldUserTask = gcvNULL; | ||
733 | gctPOINTER pointer; | ||
734 | #endif | ||
735 | |||
728 | /* Nothing to schedule? */ | 736 | /* Nothing to schedule? */ |
729 | if (TaskTable->size == 0) | 737 | if (TaskTable->size == 0) |
730 | { | 738 | { |
@@ -822,7 +830,21 @@ _ScheduleTasks( | |||
822 | /* Copy tasks. */ | 830 | /* Copy tasks. */ |
823 | do | 831 | do |
824 | { | 832 | { |
825 | gcsTASK_HEADER_PTR taskHeader = (gcsTASK_HEADER_PTR) (userTask + 1); | 833 | gcsTASK_HEADER_PTR taskHeader; |
834 | |||
835 | #ifdef __QNXNTO__ | ||
836 | oldUserTask = userTask; | ||
837 | |||
838 | gcmkERR_BREAK(gckOS_MapUserPointer( | ||
839 | Command->os, | ||
840 | oldUserTask, | ||
841 | 0, | ||
842 | &pointer)); | ||
843 | |||
844 | userTask = pointer; | ||
845 | #endif | ||
846 | |||
847 | taskHeader = (gcsTASK_HEADER_PTR) (userTask + 1); | ||
826 | 848 | ||
827 | gcmkVERIFY_OK(_RemoveRecordFromProcesDB(Command, taskHeader)); | 849 | gcmkVERIFY_OK(_RemoveRecordFromProcesDB(Command, taskHeader)); |
828 | 850 | ||
@@ -839,7 +861,8 @@ _ScheduleTasks( | |||
839 | ((gcsTASK_SIGNAL_PTR)taskHeader)->coid = TaskTable->coid; | 861 | ((gcsTASK_SIGNAL_PTR)taskHeader)->coid = TaskTable->coid; |
840 | ((gcsTASK_SIGNAL_PTR)taskHeader)->rcvid = TaskTable->rcvid; | 862 | ((gcsTASK_SIGNAL_PTR)taskHeader)->rcvid = TaskTable->rcvid; |
841 | } | 863 | } |
842 | #endif /* __QNXNTO__ */ | 864 | #endif |
865 | |||
843 | /* Copy the task data. */ | 866 | /* Copy the task data. */ |
844 | gcmkVERIFY_OK(gckOS_MemCopy( | 867 | gcmkVERIFY_OK(gckOS_MemCopy( |
845 | kernelTask, taskHeader, userTask->size | 868 | kernelTask, taskHeader, userTask->size |
@@ -848,6 +871,14 @@ _ScheduleTasks( | |||
848 | /* Advance to the next task. */ | 871 | /* Advance to the next task. */ |
849 | kernelTask += userTask->size; | 872 | kernelTask += userTask->size; |
850 | userTask = userTask->next; | 873 | userTask = userTask->next; |
874 | |||
875 | #ifdef __QNXNTO__ | ||
876 | gcmkERR_BREAK(gckOS_UnmapUserPointer( | ||
877 | Command->os, | ||
878 | oldUserTask, | ||
879 | 0, | ||
880 | pointer)); | ||
881 | #endif | ||
851 | } | 882 | } |
852 | while (userTask != gcvNULL); | 883 | while (userTask != gcvNULL); |
853 | 884 | ||
@@ -1038,7 +1069,7 @@ _ConvertUserCommandBufferPointer( | |||
1038 | gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup( | 1069 | gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup( |
1039 | kernel, | 1070 | kernel, |
1040 | pid, | 1071 | pid, |
1041 | gcmPTR2INT(mappedUserCommandBuffer->node), | 1072 | gcmPTR2INT32(mappedUserCommandBuffer->node), |
1042 | &node)); | 1073 | &node)); |
1043 | 1074 | ||
1044 | /* Translate the logical address to the kernel space. */ | 1075 | /* Translate the logical address to the kernel space. */ |
@@ -1198,17 +1229,17 @@ _AllocateCommandBuffer( | |||
1198 | 1229 | ||
1199 | /* Determine the aligned header size. */ | 1230 | /* Determine the aligned header size. */ |
1200 | alignedHeaderSize | 1231 | alignedHeaderSize |
1201 | = gcmALIGN(gcmSIZEOF(gcsCMDBUFFER), Command->info.addressAlignment); | 1232 | = (gctUINT32)gcmALIGN(gcmSIZEOF(gcsCMDBUFFER), Command->info.addressAlignment); |
1202 | 1233 | ||
1203 | /* Align the requested size. */ | 1234 | /* Align the requested size. */ |
1204 | requestedSize | 1235 | requestedSize |
1205 | = gcmALIGN(Size, Command->info.commandAlignment); | 1236 | = (gctUINT32)gcmALIGN(Size, Command->info.commandAlignment); |
1206 | 1237 | ||
1207 | /* Determine the size of the buffer to allocate. */ | 1238 | /* Determine the size of the buffer to allocate. */ |
1208 | allocationSize | 1239 | allocationSize |
1209 | = alignedHeaderSize | 1240 | = alignedHeaderSize |
1210 | + requestedSize | 1241 | + requestedSize |
1211 | + Command->info.staticTailSize; | 1242 | + (gctUINT32)Command->info.staticTailSize; |
1212 | 1243 | ||
1213 | /* Allocate the command buffer. */ | 1244 | /* Allocate the command buffer. */ |
1214 | gcmkERR_BREAK(_AllocateLinear( | 1245 | gcmkERR_BREAK(_AllocateLinear( |
@@ -3480,6 +3511,14 @@ gckVGCOMMAND_Commit( | |||
3480 | 3511 | ||
3481 | gceSTATUS status, last; | 3512 | gceSTATUS status, last; |
3482 | 3513 | ||
3514 | #ifdef __QNXNTO__ | ||
3515 | gcsVGCONTEXT_PTR userContext = gcvNULL; | ||
3516 | gctBOOL userContextMapped = gcvFALSE; | ||
3517 | gcsTASK_MASTER_TABLE_PTR userTaskTable = gcvNULL; | ||
3518 | gctBOOL userTaskTableMapped = gcvFALSE; | ||
3519 | gctPOINTER pointer = gcvNULL; | ||
3520 | #endif | ||
3521 | |||
3483 | gcmkHEADER_ARG("Command=0x%x Context=0x%x Queue=0x%x EntryCount=0x%x TaskTable=0x%x", | 3522 | gcmkHEADER_ARG("Command=0x%x Context=0x%x Queue=0x%x EntryCount=0x%x TaskTable=0x%x", |
3484 | Command, Context, Queue, EntryCount, TaskTable); | 3523 | Command, Context, Queue, EntryCount, TaskTable); |
3485 | 3524 | ||
@@ -3489,11 +3528,6 @@ gckVGCOMMAND_Commit( | |||
3489 | gcmkVERIFY_ARGUMENT(Queue != gcvNULL); | 3528 | gcmkVERIFY_ARGUMENT(Queue != gcvNULL); |
3490 | gcmkVERIFY_ARGUMENT(EntryCount > 1); | 3529 | gcmkVERIFY_ARGUMENT(EntryCount > 1); |
3491 | 3530 | ||
3492 | #ifdef __QNXNTO__ | ||
3493 | TaskTable->coid = Context->coid; | ||
3494 | TaskTable->rcvid = Context->rcvid; | ||
3495 | #endif /* __QNXNTO__ */ | ||
3496 | |||
3497 | do | 3531 | do |
3498 | { | 3532 | { |
3499 | gctBOOL haveFETasks; | 3533 | gctBOOL haveFETasks; |
@@ -3510,6 +3544,38 @@ gckVGCOMMAND_Commit( | |||
3510 | gctBOOL previousExecuted; | 3544 | gctBOOL previousExecuted; |
3511 | gctUINT controlIndex; | 3545 | gctUINT controlIndex; |
3512 | 3546 | ||
3547 | #ifdef __QNXNTO__ | ||
3548 | /* Map the context into the kernel space. */ | ||
3549 | userContext = Context; | ||
3550 | |||
3551 | gcmkERR_BREAK(gckOS_MapUserPointer( | ||
3552 | Command->os, | ||
3553 | userContext, | ||
3554 | gcmSIZEOF(*userContext), | ||
3555 | &pointer)); | ||
3556 | |||
3557 | Context = pointer; | ||
3558 | |||
3559 | userContextMapped = gcvTRUE; | ||
3560 | |||
3561 | /* Map the taskTable into the kernel space. */ | ||
3562 | userTaskTable = TaskTable; | ||
3563 | |||
3564 | gcmkERR_BREAK(gckOS_MapUserPointer( | ||
3565 | Command->os, | ||
3566 | userTaskTable, | ||
3567 | gcmSIZEOF(*userTaskTable), | ||
3568 | &pointer)); | ||
3569 | |||
3570 | TaskTable = pointer; | ||
3571 | |||
3572 | userTaskTableMapped = gcvTRUE; | ||
3573 | |||
3574 | /* Update the signal info. */ | ||
3575 | TaskTable->coid = Context->coid; | ||
3576 | TaskTable->rcvid = Context->rcvid; | ||
3577 | #endif | ||
3578 | |||
3513 | gcmkERR_BREAK(gckVGHARDWARE_SetPowerManagementState( | 3579 | gcmkERR_BREAK(gckVGHARDWARE_SetPowerManagementState( |
3514 | Command->hardware, gcvPOWER_ON_AUTO | 3580 | Command->hardware, gcvPOWER_ON_AUTO |
3515 | )); | 3581 | )); |
@@ -3772,6 +3838,28 @@ gckVGCOMMAND_Commit( | |||
3772 | } | 3838 | } |
3773 | while (gcvFALSE); | 3839 | while (gcvFALSE); |
3774 | 3840 | ||
3841 | #ifdef __QNXNTO__ | ||
3842 | if (userContextMapped) | ||
3843 | { | ||
3844 | /* Unmap the user context. */ | ||
3845 | gcmkVERIFY_OK(gckOS_UnmapUserPointer( | ||
3846 | Command->os, | ||
3847 | userContext, | ||
3848 | gcmSIZEOF(*userContext), | ||
3849 | Context)); | ||
3850 | } | ||
3851 | |||
3852 | if (userTaskTableMapped) | ||
3853 | { | ||
3854 | /* Unmap the user taskTable. */ | ||
3855 | gcmkVERIFY_OK(gckOS_UnmapUserPointer( | ||
3856 | Command->os, | ||
3857 | userTaskTable, | ||
3858 | gcmSIZEOF(*userTaskTable), | ||
3859 | TaskTable)); | ||
3860 | } | ||
3861 | #endif | ||
3862 | |||
3775 | gcmkFOOTER(); | 3863 | gcmkFOOTER(); |
3776 | /* Return status. */ | 3864 | /* Return status. */ |
3777 | return status; | 3865 | return status; |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c index 5433e02a27d8..db2f077ad394 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | |||
@@ -493,7 +493,6 @@ gckKERNEL_DeleteRecord( | |||
493 | gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); | 493 | gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); |
494 | acquired = gcvTRUE; | 494 | acquired = gcvTRUE; |
495 | 495 | ||
496 | |||
497 | /* Scan the database for this record. */ | 496 | /* Scan the database for this record. */ |
498 | for (record = Database->list[slot], previous = gcvNULL; | 497 | for (record = Database->list[slot], previous = gcvNULL; |
499 | record != gcvNULL; | 498 | record != gcvNULL; |
@@ -650,7 +649,6 @@ OnError: | |||
650 | return status; | 649 | return status; |
651 | } | 650 | } |
652 | 651 | ||
653 | |||
654 | /******************************************************************************* | 652 | /******************************************************************************* |
655 | ***** Public API **************************************************************/ | 653 | ***** Public API **************************************************************/ |
656 | 654 | ||
@@ -1264,18 +1262,17 @@ gckKERNEL_DestroyProcessDB( | |||
1264 | case gcvDB_VIDEO_MEMORY: | 1262 | case gcvDB_VIDEO_MEMORY: |
1265 | gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup(record->kernel, | 1263 | gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup(record->kernel, |
1266 | ProcessID, | 1264 | ProcessID, |
1267 | gcmPTR2INT(record->data), | 1265 | gcmPTR2INT32(record->data), |
1268 | &nodeObject)); | 1266 | &nodeObject)); |
1269 | 1267 | ||
1270 | /* Free the video memory. */ | 1268 | /* Free the video memory. */ |
1271 | gcmkVERIFY_OK(gckVIDMEM_HANDLE_Dereference(record->kernel, | 1269 | gcmkVERIFY_OK(gckVIDMEM_HANDLE_Dereference(record->kernel, |
1272 | ProcessID, | 1270 | ProcessID, |
1273 | gcmPTR2INT(record->data))); | 1271 | gcmPTR2INT32(record->data))); |
1274 | 1272 | ||
1275 | gcmkVERIFY_OK(gckVIDMEM_NODE_Dereference(record->kernel, | 1273 | gcmkVERIFY_OK(gckVIDMEM_NODE_Dereference(record->kernel, |
1276 | nodeObject)); | 1274 | nodeObject)); |
1277 | 1275 | ||
1278 | |||
1279 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, | 1276 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, |
1280 | "DB: VIDEO_MEMORY 0x%x (status=%d)", | 1277 | "DB: VIDEO_MEMORY 0x%x (status=%d)", |
1281 | record->data, status); | 1278 | record->data, status); |
@@ -1290,10 +1287,11 @@ gckKERNEL_DestroyProcessDB( | |||
1290 | record->data); | 1287 | record->data); |
1291 | 1288 | ||
1292 | /* Free the non paged memory. */ | 1289 | /* Free the non paged memory. */ |
1293 | status = gckOS_FreeNonPagedMemory(Kernel->os, | 1290 | status = gckEVENT_FreeNonPagedMemory(Kernel->eventObj, |
1294 | record->bytes, | 1291 | record->bytes, |
1295 | physical, | 1292 | physical, |
1296 | record->data); | 1293 | record->data, |
1294 | gcvKERNEL_PIXEL); | ||
1297 | gcmRELEASE_NAME(record->physical); | 1295 | gcmRELEASE_NAME(record->physical); |
1298 | 1296 | ||
1299 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, | 1297 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, |
@@ -1342,7 +1340,7 @@ gckKERNEL_DestroyProcessDB( | |||
1342 | #else | 1340 | #else |
1343 | /* Free the user signal. */ | 1341 | /* Free the user signal. */ |
1344 | status = gckOS_DestroyUserSignal(Kernel->os, | 1342 | status = gckOS_DestroyUserSignal(Kernel->os, |
1345 | gcmPTR2INT(record->data)); | 1343 | gcmPTR2INT32(record->data)); |
1346 | #endif /* USE_NEW_LINUX_SIGNAL */ | 1344 | #endif /* USE_NEW_LINUX_SIGNAL */ |
1347 | 1345 | ||
1348 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, | 1346 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, |
@@ -1351,7 +1349,7 @@ gckKERNEL_DestroyProcessDB( | |||
1351 | break; | 1349 | break; |
1352 | 1350 | ||
1353 | case gcvDB_VIDEO_MEMORY_LOCKED: | 1351 | case gcvDB_VIDEO_MEMORY_LOCKED: |
1354 | handle = gcmPTR2INT(record->data); | 1352 | handle = gcmPTR2INT32(record->data); |
1355 | 1353 | ||
1356 | gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup(record->kernel, | 1354 | gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup(record->kernel, |
1357 | ProcessID, | 1355 | ProcessID, |
@@ -1361,7 +1359,7 @@ gckKERNEL_DestroyProcessDB( | |||
1361 | /* Unlock what we still locked */ | 1359 | /* Unlock what we still locked */ |
1362 | status = gckVIDMEM_Unlock(record->kernel, | 1360 | status = gckVIDMEM_Unlock(record->kernel, |
1363 | nodeObject->node, | 1361 | nodeObject->node, |
1364 | gcvSURF_TYPE_UNKNOWN, | 1362 | nodeObject->type, |
1365 | &asynchronous); | 1363 | &asynchronous); |
1366 | 1364 | ||
1367 | #if gcdENABLE_VG | 1365 | #if gcdENABLE_VG |
@@ -1372,7 +1370,7 @@ gckKERNEL_DestroyProcessDB( | |||
1372 | /* TODO: we maybe need to schedule a event here */ | 1370 | /* TODO: we maybe need to schedule a event here */ |
1373 | status = gckVIDMEM_Unlock(record->kernel, | 1371 | status = gckVIDMEM_Unlock(record->kernel, |
1374 | nodeObject->node, | 1372 | nodeObject->node, |
1375 | gcvSURF_TYPE_UNKNOWN, | 1373 | nodeObject->type, |
1376 | gcvNULL); | 1374 | gcvNULL); |
1377 | } | 1375 | } |
1378 | 1376 | ||
@@ -1392,11 +1390,10 @@ gckKERNEL_DestroyProcessDB( | |||
1392 | 1390 | ||
1393 | if (gcmIS_SUCCESS(status) && (gcvTRUE == asynchronous)) | 1391 | if (gcmIS_SUCCESS(status) && (gcvTRUE == asynchronous)) |
1394 | { | 1392 | { |
1395 | |||
1396 | status = gckEVENT_Unlock(record->kernel->eventObj, | 1393 | status = gckEVENT_Unlock(record->kernel->eventObj, |
1397 | gcvKERNEL_PIXEL, | 1394 | gcvKERNEL_PIXEL, |
1398 | nodeObject, | 1395 | nodeObject, |
1399 | gcvSURF_TYPE_UNKNOWN); | 1396 | nodeObject->type); |
1400 | } | 1397 | } |
1401 | else | 1398 | else |
1402 | { | 1399 | { |
@@ -1429,7 +1426,7 @@ gckKERNEL_DestroyProcessDB( | |||
1429 | 1426 | ||
1430 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, | 1427 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, |
1431 | "DB: MAP MEMORY %d (status=%d)", | 1428 | "DB: MAP MEMORY %d (status=%d)", |
1432 | gcmPTR2INT(record->data), status); | 1429 | gcmPTR2INT32(record->data), status); |
1433 | break; | 1430 | break; |
1434 | 1431 | ||
1435 | case gcvDB_MAP_USER_MEMORY: | 1432 | case gcvDB_MAP_USER_MEMORY: |
@@ -1444,7 +1441,7 @@ gckKERNEL_DestroyProcessDB( | |||
1444 | 1441 | ||
1445 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, | 1442 | gcmkTRACE_ZONE(gcvLEVEL_WARNING, gcvZONE_DATABASE, |
1446 | "DB: MAP USER MEMORY %d (status=%d)", | 1443 | "DB: MAP USER MEMORY %d (status=%d)", |
1447 | gcmPTR2INT(record->data), status); | 1444 | gcmPTR2INT32(record->data), status); |
1448 | break; | 1445 | break; |
1449 | 1446 | ||
1450 | #if gcdANDROID_NATIVE_FENCE_SYNC | 1447 | #if gcdANDROID_NATIVE_FENCE_SYNC |
@@ -1831,4 +1828,3 @@ OnError: | |||
1831 | gcmkFOOTER(); | 1828 | gcmkFOOTER(); |
1832 | return status; | 1829 | return status; |
1833 | } | 1830 | } |
1834 | |||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c index 7a71dbe7abc7..c6d690efa4c1 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_debug.c | |||
@@ -139,7 +139,7 @@ static gctUINT32 _debugZones = gcvZONE_NONE; | |||
139 | 139 | ||
140 | #define gcmPTRALIGNMENT(Pointer, Alignemnt) \ | 140 | #define gcmPTRALIGNMENT(Pointer, Alignemnt) \ |
141 | ( \ | 141 | ( \ |
142 | gcmALIGN(gcmPTR2INT(Pointer), Alignemnt) - gcmPTR2INT(Pointer) \ | 142 | gcmALIGN(gcmPTR2INT32(Pointer), Alignemnt) - gcmPTR2INT32(Pointer) \ |
143 | ) | 143 | ) |
144 | 144 | ||
145 | #if gcdALIGNBYSIZE | 145 | #if gcdALIGNBYSIZE |
@@ -147,7 +147,7 @@ static gctUINT32 _debugZones = gcvZONE_NONE; | |||
147 | (((Offset) & ((Alignment) - 1)) == 0) | 147 | (((Offset) & ((Alignment) - 1)) == 0) |
148 | 148 | ||
149 | # define gcmkALIGNPTR(Type, Pointer, Alignment) \ | 149 | # define gcmkALIGNPTR(Type, Pointer, Alignment) \ |
150 | Pointer = (Type) gcmINT2PTR(gcmALIGN(gcmPTR2INT(Pointer), Alignment)) | 150 | Pointer = (Type) gcmINT2PTR(gcmALIGN(gcmPTR2INT32(Pointer), Alignment)) |
151 | #else | 151 | #else |
152 | # define gcmISALIGNED(Offset, Alignment) \ | 152 | # define gcmISALIGNED(Offset, Alignment) \ |
153 | gcvTRUE | 153 | gcvTRUE |
@@ -503,7 +503,7 @@ _DirectPrint( | |||
503 | gctARGUMENTS arguments; | 503 | gctARGUMENTS arguments; |
504 | 504 | ||
505 | gcmkARGUMENTS_START(arguments, Message); | 505 | gcmkARGUMENTS_START(arguments, Message); |
506 | len = gcmkVSPRINTF(buffer, gcmSIZEOF(buffer), Message, arguments); | 506 | len = gcmkVSPRINTF(buffer, gcmSIZEOF(buffer), Message, &arguments); |
507 | gcmkARGUMENTS_END(arguments); | 507 | gcmkARGUMENTS_END(arguments); |
508 | 508 | ||
509 | buffer[len] = '\0'; | 509 | buffer[len] = '\0'; |
@@ -1712,7 +1712,7 @@ _Print( | |||
1712 | IN gctUINT ArgumentSize, | 1712 | IN gctUINT ArgumentSize, |
1713 | IN gctBOOL CopyMessage, | 1713 | IN gctBOOL CopyMessage, |
1714 | IN gctCONST_STRING Message, | 1714 | IN gctCONST_STRING Message, |
1715 | IN gctARGUMENTS Arguments | 1715 | IN gctARGUMENTS * Arguments |
1716 | ) | 1716 | ) |
1717 | { | 1717 | { |
1718 | gcsBUFFERED_OUTPUT_PTR outputBuffer; | 1718 | gcsBUFFERED_OUTPUT_PTR outputBuffer; |
@@ -1760,14 +1760,14 @@ _Print( | |||
1760 | { | 1760 | { |
1761 | gcdOUTPUTCOPY( | 1761 | gcdOUTPUTCOPY( |
1762 | outputBuffer, outputBuffer->indent, | 1762 | outputBuffer, outputBuffer->indent, |
1763 | Message, ArgumentSize, * (gctPOINTER *) &Arguments | 1763 | Message, ArgumentSize, (gctPOINTER) Arguments |
1764 | ); | 1764 | ); |
1765 | } | 1765 | } |
1766 | else | 1766 | else |
1767 | { | 1767 | { |
1768 | gcdOUTPUTSTRING( | 1768 | gcdOUTPUTSTRING( |
1769 | outputBuffer, outputBuffer->indent, | 1769 | outputBuffer, outputBuffer->indent, |
1770 | Message, ArgumentSize, * (gctPOINTER *) &Arguments | 1770 | Message, ArgumentSize, ((gctPOINTER) Arguments) |
1771 | ); | 1771 | ); |
1772 | } | 1772 | } |
1773 | 1773 | ||
@@ -1795,7 +1795,7 @@ extern volatile unsigned g_nQnxInIsrs; | |||
1795 | { \ | 1795 | { \ |
1796 | gctARGUMENTS __arguments__; \ | 1796 | gctARGUMENTS __arguments__; \ |
1797 | gcmkARGUMENTS_START(__arguments__, Message); \ | 1797 | gcmkARGUMENTS_START(__arguments__, Message); \ |
1798 | _Print(ArgumentSize, CopyMessage, Message, __arguments__); \ | 1798 | _Print(ArgumentSize, CopyMessage, Message, &__arguments__); \ |
1799 | gcmkARGUMENTS_END(__arguments__); \ | 1799 | gcmkARGUMENTS_END(__arguments__); \ |
1800 | } \ | 1800 | } \ |
1801 | atomic_sub(&g_nQnxInIsrs, 1); \ | 1801 | atomic_sub(&g_nQnxInIsrs, 1); \ |
@@ -1807,7 +1807,7 @@ extern volatile unsigned g_nQnxInIsrs; | |||
1807 | { \ | 1807 | { \ |
1808 | gctARGUMENTS __arguments__; \ | 1808 | gctARGUMENTS __arguments__; \ |
1809 | gcmkARGUMENTS_START(__arguments__, Message); \ | 1809 | gcmkARGUMENTS_START(__arguments__, Message); \ |
1810 | _Print(ArgumentSize, CopyMessage, Message, __arguments__); \ | 1810 | _Print(ArgumentSize, CopyMessage, Message, &__arguments__); \ |
1811 | gcmkARGUMENTS_END(__arguments__); \ | 1811 | gcmkARGUMENTS_END(__arguments__); \ |
1812 | } | 1812 | } |
1813 | 1813 | ||
@@ -1941,10 +1941,10 @@ gckOS_DumpBuffer( | |||
1941 | IN gctBOOL CopyMessage | 1941 | IN gctBOOL CopyMessage |
1942 | ) | 1942 | ) |
1943 | { | 1943 | { |
1944 | gctUINT32 address; | 1944 | gctUINT32 address = 0; |
1945 | gcsBUFFERED_OUTPUT_PTR outputBuffer; | 1945 | gcsBUFFERED_OUTPUT_PTR outputBuffer = gcvNULL; |
1946 | static gctBOOL userLocked; | 1946 | static gctBOOL userLocked; |
1947 | gctCHAR *buffer = (gctCHAR*)Buffer; | 1947 | gctCHAR *buffer = (gctCHAR*)Buffer; |
1948 | 1948 | ||
1949 | gcmkDECLARE_LOCK(lockHandle); | 1949 | gcmkDECLARE_LOCK(lockHandle); |
1950 | 1950 | ||
@@ -2609,7 +2609,7 @@ _VerifyMessage( | |||
2609 | 2609 | ||
2610 | /* Get function name. */ | 2610 | /* Get function name. */ |
2611 | function = (gctSTRING)&message->payload; | 2611 | function = (gctSTRING)&message->payload; |
2612 | functionBytes = strlen(function) + 1; | 2612 | functionBytes = (gctUINT32)strlen(function) + 1; |
2613 | 2613 | ||
2614 | /* Get arguments number. */ | 2614 | /* Get arguments number. */ |
2615 | numArguments = message->numArguments; | 2615 | numArguments = message->numArguments; |
@@ -2629,7 +2629,7 @@ _VerifyMessage( | |||
2629 | 2629 | ||
2630 | if (numArguments) | 2630 | if (numArguments) |
2631 | { | 2631 | { |
2632 | gcmkVSPRINTF(arguments, 150, format, *(gctARGUMENTS *) &args); | 2632 | gcmkVSPRINTF(arguments, 150, format, (gctARGUMENTS *) &args); |
2633 | } | 2633 | } |
2634 | 2634 | ||
2635 | gcmkPRINT("[%d](%d): %s(%d) %s", | 2635 | gcmkPRINT("[%d](%d): %s(%d) %s", |
@@ -2720,7 +2720,7 @@ gckOS_BinaryTrace( | |||
2720 | payload = (gctSTRING)&message->payload; | 2720 | payload = (gctSTRING)&message->payload; |
2721 | 2721 | ||
2722 | /* Function name. */ | 2722 | /* Function name. */ |
2723 | functionBytes = gcmkSTRLEN(Function) + 1; | 2723 | functionBytes = (gctUINT32)gcmkSTRLEN(Function) + 1; |
2724 | gcmkMEMCPY(payload, Function, functionBytes); | 2724 | gcmkMEMCPY(payload, Function, functionBytes); |
2725 | 2725 | ||
2726 | /* Advance to next payload. */ | 2726 | /* Advance to next payload. */ |
@@ -2746,6 +2746,6 @@ gckOS_BinaryTrace( | |||
2746 | 2746 | ||
2747 | 2747 | ||
2748 | /* Send buffer to ring buffer. */ | 2748 | /* Send buffer to ring buffer. */ |
2749 | gckOS_WriteToRingBuffer(buffer, payload - buffer); | 2749 | gckOS_WriteToRingBuffer(buffer, (gctUINT32)(payload - buffer)); |
2750 | } | 2750 | } |
2751 | 2751 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c index fa1cb6338ea6..7adadb36efa0 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | |||
@@ -367,6 +367,68 @@ OnError: | |||
367 | return status; | 367 | return status; |
368 | } | 368 | } |
369 | 369 | ||
370 | /******************************************************************************* | ||
371 | ** | ||
372 | ** _QueryFlush | ||
373 | ** | ||
374 | ** Check the type of surfaces which will be released by current event and | ||
375 | ** determine the cache needed to flush. | ||
376 | ** | ||
377 | */ | ||
378 | static gceSTATUS | ||
379 | _QueryFlush( | ||
380 | IN gckEVENT Event, | ||
381 | IN gcsEVENT_PTR Record, | ||
382 | OUT gceKERNEL_FLUSH *Flush | ||
383 | ) | ||
384 | { | ||
385 | gceKERNEL_FLUSH flush = 0; | ||
386 | gcmkHEADER_ARG("Event=0x%x Record=0x%x", Event, Record); | ||
387 | gcmkVERIFY_ARGUMENT(Record != gcvNULL); | ||
388 | |||
389 | while (Record != gcvNULL) | ||
390 | { | ||
391 | switch (Record->info.command) | ||
392 | { | ||
393 | case gcvHAL_UNLOCK_VIDEO_MEMORY: | ||
394 | switch(Record->info.u.UnlockVideoMemory.type) | ||
395 | { | ||
396 | case gcvSURF_TILE_STATUS: | ||
397 | flush |= gcvFLUSH_TILE_STATUS; | ||
398 | break; | ||
399 | case gcvSURF_RENDER_TARGET: | ||
400 | flush |= gcvFLUSH_COLOR; | ||
401 | break; | ||
402 | case gcvSURF_DEPTH: | ||
403 | flush |= gcvFLUSH_DEPTH; | ||
404 | break; | ||
405 | case gcvSURF_TEXTURE: | ||
406 | flush |= gcvFLUSH_TEXTURE; | ||
407 | break; | ||
408 | case gcvSURF_TYPE_UNKNOWN: | ||
409 | gcmkASSERT(0); | ||
410 | break; | ||
411 | default: | ||
412 | break; | ||
413 | } | ||
414 | break; | ||
415 | case gcvHAL_UNMAP_USER_MEMORY: | ||
416 | *Flush = gcvFLUSH_ALL; | ||
417 | return gcvSTATUS_OK; | ||
418 | |||
419 | default: | ||
420 | break; | ||
421 | } | ||
422 | |||
423 | Record = Record->next; | ||
424 | } | ||
425 | |||
426 | *Flush = flush; | ||
427 | |||
428 | gcmkFOOTER_NO(); | ||
429 | return gcvSTATUS_OK; | ||
430 | } | ||
431 | |||
370 | void | 432 | void |
371 | _SubmitTimerFunction( | 433 | _SubmitTimerFunction( |
372 | gctPOINTER Data | 434 | gctPOINTER Data |
@@ -475,6 +537,7 @@ gckEVENT_Construct( | |||
475 | for (i = 0; i < gcdMULTI_GPU; i++) | 537 | for (i = 0; i < gcdMULTI_GPU; i++) |
476 | { | 538 | { |
477 | gcmkONERROR(gckOS_AtomConstruct(os, &eventObj->pending3D[i])); | 539 | gcmkONERROR(gckOS_AtomConstruct(os, &eventObj->pending3D[i])); |
540 | gcmkONERROR(gckOS_AtomConstruct(os, &eventObj->pending3DMask[i])); | ||
478 | } | 541 | } |
479 | 542 | ||
480 | gcmkONERROR(gckOS_AtomConstruct(os, &eventObj->pendingMask)); | 543 | gcmkONERROR(gckOS_AtomConstruct(os, &eventObj->pendingMask)); |
@@ -544,6 +607,11 @@ OnError: | |||
544 | { | 607 | { |
545 | gcmkVERIFY_OK(gckOS_AtomDestroy(os, eventObj->pending3D[i])); | 608 | gcmkVERIFY_OK(gckOS_AtomDestroy(os, eventObj->pending3D[i])); |
546 | } | 609 | } |
610 | |||
611 | if (eventObj->pending3DMask[i] != gcvNULL) | ||
612 | { | ||
613 | gcmkVERIFY_OK(gckOS_AtomDestroy(os, eventObj->pending3DMask[i])); | ||
614 | } | ||
547 | } | 615 | } |
548 | #endif | 616 | #endif |
549 | #endif | 617 | #endif |
@@ -663,6 +731,7 @@ gckEVENT_Destroy( | |||
663 | for (i = 0; i < gcdMULTI_GPU; i++) | 731 | for (i = 0; i < gcdMULTI_GPU; i++) |
664 | { | 732 | { |
665 | gcmkVERIFY_OK(gckOS_AtomDestroy(Event->os, Event->pending3D[i])); | 733 | gcmkVERIFY_OK(gckOS_AtomDestroy(Event->os, Event->pending3D[i])); |
734 | gcmkVERIFY_OK(gckOS_AtomDestroy(Event->os, Event->pending3DMask[i])); | ||
666 | } | 735 | } |
667 | } | 736 | } |
668 | #endif | 737 | #endif |
@@ -706,6 +775,18 @@ gckEVENT_Destroy( | |||
706 | ** gctUINT8 * EventID | 775 | ** gctUINT8 * EventID |
707 | ** Reserved event ID. | 776 | ** Reserved event ID. |
708 | */ | 777 | */ |
778 | #define gcdINVALID_EVENT_PTR ((gcsEVENT_PTR)gcvMAXUINTPTR_T) | ||
779 | |||
780 | #if gcdMULTI_GPU | ||
781 | gceSTATUS | ||
782 | gckEVENT_GetEvent( | ||
783 | IN gckEVENT Event, | ||
784 | IN gctBOOL Wait, | ||
785 | OUT gctUINT8 * EventID, | ||
786 | IN gceKERNEL_WHERE Source, | ||
787 | IN gceCORE_3D_MASK ChipEnable | ||
788 | ) | ||
789 | #else | ||
709 | gceSTATUS | 790 | gceSTATUS |
710 | gckEVENT_GetEvent( | 791 | gckEVENT_GetEvent( |
711 | IN gckEVENT Event, | 792 | IN gckEVENT Event, |
@@ -713,11 +794,15 @@ gckEVENT_GetEvent( | |||
713 | OUT gctUINT8 * EventID, | 794 | OUT gctUINT8 * EventID, |
714 | IN gceKERNEL_WHERE Source | 795 | IN gceKERNEL_WHERE Source |
715 | ) | 796 | ) |
797 | #endif | ||
716 | { | 798 | { |
717 | gctINT i, id; | 799 | gctINT i, id; |
718 | gceSTATUS status; | 800 | gceSTATUS status; |
719 | gctBOOL acquired = gcvFALSE; | 801 | gctBOOL acquired = gcvFALSE; |
720 | gctINT32 free; | 802 | gctINT32 free; |
803 | #if gcdMULTI_GPU | ||
804 | gctINT j; | ||
805 | #endif | ||
721 | 806 | ||
722 | #if gcdGPU_TIMEOUT | 807 | #if gcdGPU_TIMEOUT |
723 | gctUINT32 timer = 0; | 808 | gctUINT32 timer = 0; |
@@ -747,9 +832,34 @@ gckEVENT_GetEvent( | |||
747 | Event->lastID = (gctUINT8) nextID; | 832 | Event->lastID = (gctUINT8) nextID; |
748 | 833 | ||
749 | /* Save time stamp of event. */ | 834 | /* Save time stamp of event. */ |
835 | Event->queues[id].head = gcdINVALID_EVENT_PTR; | ||
750 | Event->queues[id].stamp = ++(Event->stamp); | 836 | Event->queues[id].stamp = ++(Event->stamp); |
751 | Event->queues[id].source = Source; | 837 | Event->queues[id].source = Source; |
752 | 838 | ||
839 | #if gcdMULTI_GPU | ||
840 | Event->queues[id].chipEnable = ChipEnable; | ||
841 | |||
842 | if (ChipEnable == gcvCORE_3D_ALL_MASK) | ||
843 | { | ||
844 | gckOS_AtomSetMask(Event->pendingMask, (1 << id)); | ||
845 | |||
846 | for (j = 0; j < gcdMULTI_GPU; j++) | ||
847 | { | ||
848 | gckOS_AtomSetMask(Event->pending3DMask[j], (1 << id)); | ||
849 | } | ||
850 | } | ||
851 | else | ||
852 | { | ||
853 | for (j = 0; j < gcdMULTI_GPU; j++) | ||
854 | { | ||
855 | if (ChipEnable & (1 << j)) | ||
856 | { | ||
857 | gckOS_AtomSetMask(Event->pending3DMask[j], (1 << id)); | ||
858 | } | ||
859 | } | ||
860 | } | ||
861 | #endif | ||
862 | |||
753 | gcmkONERROR(gckOS_AtomDecrement(Event->os, | 863 | gcmkONERROR(gckOS_AtomDecrement(Event->os, |
754 | Event->freeAtom, | 864 | Event->freeAtom, |
755 | &free)); | 865 | &free)); |
@@ -1114,7 +1224,7 @@ gckEVENT_AddList( | |||
1114 | buffer = (gckVIRTUAL_COMMAND_BUFFER_PTR)gcmNAME_TO_PTR(Interface->u.FreeVirtualCommandBuffer.physical); | 1224 | buffer = (gckVIRTUAL_COMMAND_BUFFER_PTR)gcmNAME_TO_PTR(Interface->u.FreeVirtualCommandBuffer.physical); |
1115 | if (buffer->userLogical) | 1225 | if (buffer->userLogical) |
1116 | { | 1226 | { |
1117 | gcmkONERROR(gckOS_UnlockPages( | 1227 | gcmkONERROR(gckOS_DestroyUserVirtualMapping( |
1118 | Event->os, | 1228 | Event->os, |
1119 | buffer->physical, | 1229 | buffer->physical, |
1120 | (gctSIZE_T) Interface->u.FreeVirtualCommandBuffer.bytes, | 1230 | (gctSIZE_T) Interface->u.FreeVirtualCommandBuffer.bytes, |
@@ -1575,7 +1685,7 @@ gckEVENT_Submit( | |||
1575 | gckCOMMAND command = gcvNULL; | 1685 | gckCOMMAND command = gcvNULL; |
1576 | gctBOOL commitEntered = gcvFALSE; | 1686 | gctBOOL commitEntered = gcvFALSE; |
1577 | #if !gcdNULL_DRIVER | 1687 | #if !gcdNULL_DRIVER |
1578 | gctSIZE_T bytes; | 1688 | gctUINT32 bytes; |
1579 | gctPOINTER buffer; | 1689 | gctPOINTER buffer; |
1580 | #endif | 1690 | #endif |
1581 | 1691 | ||
@@ -1587,10 +1697,20 @@ gckEVENT_Submit( | |||
1587 | gctUINT32 oldValue; | 1697 | gctUINT32 oldValue; |
1588 | #endif | 1698 | #endif |
1589 | 1699 | ||
1700 | |||
1701 | gctUINT32 flushBytes; | ||
1702 | gctUINT32 executeBytes; | ||
1703 | gckHARDWARE hardware; | ||
1704 | |||
1705 | gceKERNEL_FLUSH flush = gcvFALSE; | ||
1706 | |||
1590 | gcmkHEADER_ARG("Event=0x%x Wait=%d", Event, Wait); | 1707 | gcmkHEADER_ARG("Event=0x%x Wait=%d", Event, Wait); |
1591 | 1708 | ||
1592 | /* Get gckCOMMAND object. */ | 1709 | /* Get gckCOMMAND object. */ |
1593 | command = Event->kernel->command; | 1710 | command = Event->kernel->command; |
1711 | hardware = Event->kernel->hardware; | ||
1712 | |||
1713 | gcmkVERIFY_OBJECT(hardware, gcvOBJ_HARDWARE); | ||
1594 | 1714 | ||
1595 | /* Are there event queues? */ | 1715 | /* Are there event queues? */ |
1596 | if (Event->queueHead != gcvNULL) | 1716 | if (Event->queueHead != gcvNULL) |
@@ -1612,13 +1732,12 @@ gckEVENT_Submit( | |||
1612 | queue = Event->queueHead; | 1732 | queue = Event->queueHead; |
1613 | 1733 | ||
1614 | /* Allocate an event ID. */ | 1734 | /* Allocate an event ID. */ |
1615 | gcmkONERROR(gckEVENT_GetEvent(Event, Wait, &id, queue->source)); | ||
1616 | #if gcdMULTI_GPU | 1735 | #if gcdMULTI_GPU |
1617 | if (ChipEnable == gcvCORE_3D_ALL_MASK) | 1736 | gcmkONERROR(gckEVENT_GetEvent(Event, Wait, &id, queue->source, ChipEnable)); |
1618 | { | 1737 | #else |
1619 | gckOS_AtomSetMask(Event->pendingMask, (1 << id)); | 1738 | gcmkONERROR(gckEVENT_GetEvent(Event, Wait, &id, queue->source)); |
1620 | } | ||
1621 | #endif | 1739 | #endif |
1740 | |||
1622 | /* Copy event list to event ID queue. */ | 1741 | /* Copy event list to event ID queue. */ |
1623 | Event->queues[id].head = queue->head; | 1742 | Event->queues[id].head = queue->head; |
1624 | 1743 | ||
@@ -1640,10 +1759,15 @@ gckEVENT_Submit( | |||
1640 | gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventListMutex)); | 1759 | gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventListMutex)); |
1641 | acquired = gcvFALSE; | 1760 | acquired = gcvFALSE; |
1642 | 1761 | ||
1762 | /* Determine cache needed to flush. */ | ||
1763 | gcmkVERIFY_OK(_QueryFlush(Event, Event->queues[id].head, &flush)); | ||
1764 | |||
1643 | #if gcdINTERRUPT_STATISTIC | 1765 | #if gcdINTERRUPT_STATISTIC |
1644 | gcmkVERIFY_OK(gckOS_AtomIncrement(Event->os, | 1766 | gcmkVERIFY_OK(gckOS_AtomIncrement( |
1645 | Event->interruptCount, | 1767 | Event->os, |
1646 | &oldValue)); | 1768 | Event->interruptCount, |
1769 | &oldValue | ||
1770 | )); | ||
1647 | #endif | 1771 | #endif |
1648 | 1772 | ||
1649 | #if gcdNULL_DRIVER | 1773 | #if gcdNULL_DRIVER |
@@ -1653,58 +1777,86 @@ gckEVENT_Submit( | |||
1653 | gcmkONERROR(gckEVENT_Notify(Event, 0)); | 1777 | gcmkONERROR(gckEVENT_Notify(Event, 0)); |
1654 | #else | 1778 | #else |
1655 | /* Get the size of the hardware event. */ | 1779 | /* Get the size of the hardware event. */ |
1656 | gcmkONERROR(gckHARDWARE_Event(Event->kernel->hardware, | 1780 | gcmkONERROR(gckHARDWARE_Event( |
1657 | gcvNULL, | 1781 | hardware, |
1658 | id, | 1782 | gcvNULL, |
1659 | Event->queues[id].source, | 1783 | id, |
1660 | &bytes)); | 1784 | Event->queues[id].source, |
1785 | &bytes | ||
1786 | )); | ||
1787 | |||
1788 | /* Get the size of flush command. */ | ||
1789 | gcmkONERROR(gckHARDWARE_Flush( | ||
1790 | hardware, | ||
1791 | flush, | ||
1792 | gcvNULL, | ||
1793 | &flushBytes | ||
1794 | )); | ||
1795 | |||
1796 | bytes += flushBytes; | ||
1661 | 1797 | ||
1662 | #if gcdMULTI_GPU | 1798 | #if gcdMULTI_GPU |
1663 | gcmkONERROR(gckHARDWARE_ChipEnable(Event->kernel->hardware, | 1799 | gcmkONERROR(gckHARDWARE_ChipEnable( |
1664 | gcvNULL, | 1800 | hardware, |
1665 | 0, | 1801 | gcvNULL, |
1666 | &chipEnableBytes)); | 1802 | 0, |
1803 | &chipEnableBytes | ||
1804 | )); | ||
1667 | 1805 | ||
1668 | bytes += chipEnableBytes * 2; | 1806 | bytes += chipEnableBytes * 2; |
1669 | #endif | 1807 | #endif |
1670 | 1808 | ||
1809 | /* Total bytes need to execute. */ | ||
1810 | executeBytes = bytes; | ||
1811 | |||
1671 | /* Reserve space in the command queue. */ | 1812 | /* Reserve space in the command queue. */ |
1672 | gcmkONERROR(gckCOMMAND_Reserve(command, | 1813 | gcmkONERROR(gckCOMMAND_Reserve(command, bytes, &buffer, &bytes)); |
1673 | bytes, | ||
1674 | &buffer, | ||
1675 | &bytes)); | ||
1676 | 1814 | ||
1677 | #if gcdMULTI_GPU | 1815 | #if gcdMULTI_GPU |
1678 | gcmkONERROR(gckHARDWARE_ChipEnable(Event->kernel->hardware, | 1816 | gcmkONERROR(gckHARDWARE_ChipEnable( |
1679 | buffer, | 1817 | hardware, |
1680 | ChipEnable, | 1818 | buffer, |
1681 | &chipEnableBytes)); | 1819 | ChipEnable, |
1820 | &chipEnableBytes | ||
1821 | )); | ||
1682 | 1822 | ||
1683 | /* Set the hardware event in the command queue. */ | 1823 | buffer = (gctUINT8_PTR)buffer + chipEnableBytes; |
1684 | gcmkONERROR(gckHARDWARE_Event(Event->kernel->hardware, | 1824 | #endif |
1685 | buffer + chipEnableBytes, | ||
1686 | id, | ||
1687 | Event->queues[id].source, | ||
1688 | &bytes)); | ||
1689 | 1825 | ||
1690 | gcmkONERROR(gckHARDWARE_ChipEnable(Event->kernel->hardware, | 1826 | /* Set the flush in the command queue. */ |
1691 | buffer + bytes + chipEnableBytes, | 1827 | gcmkONERROR(gckHARDWARE_Flush( |
1692 | gcvCORE_3D_ALL_MASK, | 1828 | hardware, |
1693 | &chipEnableBytes)); | 1829 | flush, |
1830 | buffer, | ||
1831 | &flushBytes | ||
1832 | )); | ||
1833 | |||
1834 | /* Advance to next command. */ | ||
1835 | buffer = (gctUINT8_PTR)buffer + flushBytes; | ||
1694 | 1836 | ||
1695 | /* Execute the hardware event. */ | ||
1696 | gcmkONERROR(gckCOMMAND_Execute(command, bytes + chipEnableBytes * 2)); | ||
1697 | #else | ||
1698 | /* Set the hardware event in the command queue. */ | 1837 | /* Set the hardware event in the command queue. */ |
1699 | gcmkONERROR(gckHARDWARE_Event(Event->kernel->hardware, | 1838 | gcmkONERROR(gckHARDWARE_Event( |
1700 | buffer, | 1839 | hardware, |
1701 | id, | 1840 | buffer, |
1702 | Event->queues[id].source, | 1841 | id, |
1703 | &bytes)); | 1842 | Event->queues[id].source, |
1843 | &bytes | ||
1844 | )); | ||
1704 | 1845 | ||
1705 | /* Execute the hardware event. */ | 1846 | /* Advance to next command. */ |
1706 | gcmkONERROR(gckCOMMAND_Execute(command, bytes)); | 1847 | buffer = (gctUINT8_PTR)buffer + bytes; |
1848 | |||
1849 | #if gcdMULTI_GPU | ||
1850 | gcmkONERROR(gckHARDWARE_ChipEnable( | ||
1851 | hardware, | ||
1852 | buffer, | ||
1853 | gcvCORE_3D_ALL_MASK, | ||
1854 | &chipEnableBytes | ||
1855 | )); | ||
1707 | #endif | 1856 | #endif |
1857 | |||
1858 | /* Execute the hardware event. */ | ||
1859 | gcmkONERROR(gckCOMMAND_Execute(command, executeBytes)); | ||
1708 | #endif | 1860 | #endif |
1709 | } | 1861 | } |
1710 | 1862 | ||
@@ -1915,7 +2067,11 @@ gckEVENT_Compose( | |||
1915 | gcmkVERIFY_ARGUMENT(Info != gcvNULL); | 2067 | gcmkVERIFY_ARGUMENT(Info != gcvNULL); |
1916 | 2068 | ||
1917 | /* Allocate an event ID. */ | 2069 | /* Allocate an event ID. */ |
2070 | #if gcdMULTI_GPU | ||
2071 | gcmkONERROR(gckEVENT_GetEvent(Event, gcvTRUE, &id, gcvKERNEL_PIXEL, gcvCORE_3D_ALL_MASK)); | ||
2072 | #else | ||
1918 | gcmkONERROR(gckEVENT_GetEvent(Event, gcvTRUE, &id, gcvKERNEL_PIXEL)); | 2073 | gcmkONERROR(gckEVENT_GetEvent(Event, gcvTRUE, &id, gcvKERNEL_PIXEL)); |
2074 | #endif | ||
1919 | 2075 | ||
1920 | /* Get process ID. */ | 2076 | /* Get process ID. */ |
1921 | gcmkONERROR(gckOS_GetProcessID(&processID)); | 2077 | gcmkONERROR(gckOS_GetProcessID(&processID)); |
@@ -2034,42 +2190,39 @@ gckEVENT_Interrupt( | |||
2034 | /* Verify the arguments. */ | 2190 | /* Verify the arguments. */ |
2035 | gcmkVERIFY_OBJECT(Event, gcvOBJ_EVENT); | 2191 | gcmkVERIFY_OBJECT(Event, gcvOBJ_EVENT); |
2036 | 2192 | ||
2037 | #if gcdPROCESS_ADDRESS_SPACE | ||
2038 | if (Data & 0x20000000) | 2193 | if (Data & 0x20000000) |
2039 | { | 2194 | { |
2040 | gctUINT32 physical; | ||
2041 | gctUINT32 bytes; | ||
2042 | gckENTRYDATA data; | 2195 | gckENTRYDATA data; |
2043 | gctUINT32 idle; | 2196 | gctUINT32 idle; |
2044 | Data &= ~0x20000000; | 2197 | Data &= ~0x20000000; |
2045 | 2198 | ||
2046 | /* Get first entry information. */ | 2199 | #if gcdMULTI_GPU |
2047 | gckENTRYQUEUE_GetData(&Event->kernel->command->queue, 0, &data); | 2200 | if (Event->kernel->core == gcvCORE_MAJOR) |
2048 | 2201 | #endif | |
2049 | physical = data->physical; | ||
2050 | bytes = data->bytes; | ||
2051 | |||
2052 | gckENTRYQUEUE_Dequeue(&Event->kernel->command->queue); | ||
2053 | |||
2054 | /* Make sure FE is idle. */ | ||
2055 | do | ||
2056 | { | 2202 | { |
2057 | gcmkVERIFY_OK(gckOS_ReadRegisterEx( | 2203 | /* Get first entry information. */ |
2058 | Event->os, | 2204 | gcmkVERIFY_OK( |
2059 | Event->kernel->core, | 2205 | gckENTRYQUEUE_Dequeue(&Event->kernel->command->queue, &data)); |
2060 | 0x4, | 2206 | |
2061 | &idle)); | 2207 | /* Make sure FE is idle. */ |
2208 | do | ||
2209 | { | ||
2210 | gcmkVERIFY_OK(gckOS_ReadRegisterEx( | ||
2211 | Event->os, | ||
2212 | Event->kernel->core, | ||
2213 | 0x4, | ||
2214 | &idle)); | ||
2215 | } | ||
2216 | while (idle != 0x7FFFFFFF); | ||
2217 | |||
2218 | /* Start Command Parser. */ | ||
2219 | gcmkVERIFY_OK(gckHARDWARE_Execute( | ||
2220 | Event->kernel->hardware, | ||
2221 | data->physical, | ||
2222 | data->bytes | ||
2223 | )); | ||
2062 | } | 2224 | } |
2063 | while (idle != 0x7FFFFFFF); | ||
2064 | |||
2065 | /* Start Command Parser. */ | ||
2066 | gcmkVERIFY_OK(gckHARDWARE_ExecutePhysical( | ||
2067 | Event->kernel->hardware, | ||
2068 | physical, | ||
2069 | bytes | ||
2070 | )); | ||
2071 | } | 2225 | } |
2072 | #endif | ||
2073 | 2226 | ||
2074 | /* Combine current interrupt status with pending flags. */ | 2227 | /* Combine current interrupt status with pending flags. */ |
2075 | #if gcdSMP | 2228 | #if gcdSMP |
@@ -2226,8 +2379,15 @@ gckEVENT_Notify( | |||
2226 | gcsEVENT_PTR record; | 2379 | gcsEVENT_PTR record; |
2227 | #if gcdMULTI_GPU | 2380 | #if gcdMULTI_GPU |
2228 | gctUINT32 pend[gcdMULTI_GPU]; | 2381 | gctUINT32 pend[gcdMULTI_GPU]; |
2382 | gctUINT32 pendMask[gcdMULTI_GPU]; | ||
2229 | #endif | 2383 | #endif |
2230 | 2384 | ||
2385 | /* Grab the mutex queue. */ | ||
2386 | gcmkONERROR(gckOS_AcquireMutex(Event->os, | ||
2387 | Event->eventQueueMutex, | ||
2388 | gcvINFINITE)); | ||
2389 | acquired = gcvTRUE; | ||
2390 | |||
2231 | #if gcdSMP | 2391 | #if gcdSMP |
2232 | #if gcdMULTI_GPU | 2392 | #if gcdMULTI_GPU |
2233 | if (core == gcvCORE_MAJOR) | 2393 | if (core == gcvCORE_MAJOR) |
@@ -2236,6 +2396,7 @@ gckEVENT_Notify( | |||
2236 | for (i = 0; i < gcdMULTI_GPU; i++) | 2396 | for (i = 0; i < gcdMULTI_GPU; i++) |
2237 | { | 2397 | { |
2238 | gckOS_AtomGet(Event->os, Event->pending3D[i], (gctINT32_PTR)&pend[i]); | 2398 | gckOS_AtomGet(Event->os, Event->pending3D[i], (gctINT32_PTR)&pend[i]); |
2399 | gckOS_AtomGet(Event->os, Event->pending3DMask[i], (gctINT32_PTR)&pendMask[i]); | ||
2239 | } | 2400 | } |
2240 | 2401 | ||
2241 | gckOS_AtomGet(Event->os, Event->pendingMask, (gctINT32_PTR)&pendingMask); | 2402 | gckOS_AtomGet(Event->os, Event->pendingMask, (gctINT32_PTR)&pendingMask); |
@@ -2257,6 +2418,7 @@ gckEVENT_Notify( | |||
2257 | { | 2418 | { |
2258 | /* Get current interrupts. */ | 2419 | /* Get current interrupts. */ |
2259 | pend[i] = Event->pending3D[i]; | 2420 | pend[i] = Event->pending3D[i]; |
2421 | pendMask[i] = Event->pending3DMask[i]; | ||
2260 | } | 2422 | } |
2261 | 2423 | ||
2262 | pendingMask = Event->pendingMask; | 2424 | pendingMask = Event->pendingMask; |
@@ -2275,14 +2437,37 @@ gckEVENT_Notify( | |||
2275 | #if gcdMULTI_GPU | 2437 | #if gcdMULTI_GPU |
2276 | if (core == gcvCORE_MAJOR) | 2438 | if (core == gcvCORE_MAJOR) |
2277 | { | 2439 | { |
2440 | for (i = 0; i < gcdMULTI_GPU; i++) | ||
2441 | { | ||
2442 | gctUINT32 bad_pend = (pend[i] & ~pendMask[i]); | ||
2443 | |||
2444 | if (bad_pend != 0) | ||
2445 | { | ||
2446 | gcmkTRACE_ZONE_N( | ||
2447 | gcvLEVEL_ERROR, gcvZONE_EVENT, | ||
2448 | gcmSIZEOF(bad_pend) + gcmSIZEOF(i), | ||
2449 | "Interrupts 0x%x are not unexpected for Core%d.", | ||
2450 | bad_pend, i | ||
2451 | ); | ||
2452 | |||
2453 | gckOS_AtomClearMask(Event->pending3D[i], bad_pend); | ||
2454 | |||
2455 | pend[i] &= pendMask[i]; | ||
2456 | } | ||
2457 | } | ||
2458 | |||
2278 | pending = (pend[0] & pend[1] & pendingMask) /* Check combined events on both GPUs */ | 2459 | pending = (pend[0] & pend[1] & pendingMask) /* Check combined events on both GPUs */ |
2279 | | (pend[0] & ~pendingMask) /* Check individual events on GPU 0 */ | 2460 | | (pend[0] & ~pendingMask) /* Check individual events on GPU 0 */ |
2280 | | (pend[1] & ~pendingMask); /* Check individual events on GPU 1 */ | 2461 | | (pend[1] & ~pendingMask); /* Check individual events on GPU 1 */ |
2281 | } | 2462 | } |
2282 | #endif | 2463 | #endif |
2283 | 2464 | ||
2284 | if (pending == 0) | 2465 | if (pending == 0) |
2285 | { | 2466 | { |
2467 | /* Release the mutex queue. */ | ||
2468 | gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventQueueMutex)); | ||
2469 | acquired = gcvFALSE; | ||
2470 | |||
2286 | /* No more pending interrupts - done. */ | 2471 | /* No more pending interrupts - done. */ |
2287 | break; | 2472 | break; |
2288 | } | 2473 | } |
@@ -2364,6 +2549,7 @@ gckEVENT_Notify( | |||
2364 | for (i = 0; i < gcdMULTI_GPU; i++) | 2549 | for (i = 0; i < gcdMULTI_GPU; i++) |
2365 | { | 2550 | { |
2366 | gckOS_AtomClearMask(Event->pending3D[i], pending); | 2551 | gckOS_AtomClearMask(Event->pending3D[i], pending); |
2552 | gckOS_AtomClearMask(Event->pending3DMask[i], pending); | ||
2367 | } | 2553 | } |
2368 | 2554 | ||
2369 | gckOS_AtomClearMask(Event->pendingMask, pending); | 2555 | gckOS_AtomClearMask(Event->pendingMask, pending); |
@@ -2381,7 +2567,10 @@ gckEVENT_Notify( | |||
2381 | for (i = 0; i < gcdMULTI_GPU; i++) | 2567 | for (i = 0; i < gcdMULTI_GPU; i++) |
2382 | { | 2568 | { |
2383 | atomic_clr((gctUINT32_PTR)&Event->pending3D[i], pending); | 2569 | atomic_clr((gctUINT32_PTR)&Event->pending3D[i], pending); |
2570 | atomic_clr((gctUINT32_PTR)&Event->pending3DMask[i], pending); | ||
2384 | } | 2571 | } |
2572 | |||
2573 | atomic_clr((gctUINT32_PTR)&Event->pendingMask, pending); | ||
2385 | } | 2574 | } |
2386 | else | 2575 | else |
2387 | #endif | 2576 | #endif |
@@ -2400,6 +2589,7 @@ gckEVENT_Notify( | |||
2400 | { | 2589 | { |
2401 | /* Mark pending interrupts as handled. */ | 2590 | /* Mark pending interrupts as handled. */ |
2402 | Event->pending3D[i] &= ~pending; | 2591 | Event->pending3D[i] &= ~pending; |
2592 | Event->pending3DMask[i] &= ~pending; | ||
2403 | } | 2593 | } |
2404 | } | 2594 | } |
2405 | else | 2595 | else |
@@ -2412,6 +2602,10 @@ gckEVENT_Notify( | |||
2412 | gcmkONERROR(gckOS_ResumeInterruptEx(Event->os, Event->kernel->core)); | 2602 | gcmkONERROR(gckOS_ResumeInterruptEx(Event->os, Event->kernel->core)); |
2413 | suspended = gcvFALSE; | 2603 | suspended = gcvFALSE; |
2414 | #endif | 2604 | #endif |
2605 | |||
2606 | /* Release the mutex queue. */ | ||
2607 | gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventQueueMutex)); | ||
2608 | acquired = gcvFALSE; | ||
2415 | break; | 2609 | break; |
2416 | } | 2610 | } |
2417 | 2611 | ||
@@ -2421,6 +2615,9 @@ gckEVENT_Notify( | |||
2421 | if ((Event->queues[i].head != gcvNULL) | 2615 | if ((Event->queues[i].head != gcvNULL) |
2422 | && (Event->queues[i].stamp < queue->stamp) | 2616 | && (Event->queues[i].stamp < queue->stamp) |
2423 | && (Event->queues[i].source <= queue->source) | 2617 | && (Event->queues[i].source <= queue->source) |
2618 | #if gcdMULTI_GPU | ||
2619 | && (Event->queues[i].chipEnable == queue->chipEnable) | ||
2620 | #endif | ||
2424 | ) | 2621 | ) |
2425 | { | 2622 | { |
2426 | gcmkTRACE_N( | 2623 | gcmkTRACE_N( |
@@ -2456,6 +2653,7 @@ gckEVENT_Notify( | |||
2456 | { | 2653 | { |
2457 | /* Mark pending interrupt as handled. */ | 2654 | /* Mark pending interrupt as handled. */ |
2458 | gckOS_AtomClearMask(Event->pending3D[i], mask); | 2655 | gckOS_AtomClearMask(Event->pending3D[i], mask); |
2656 | gckOS_AtomClearMask(Event->pending3DMask[i], mask); | ||
2459 | } | 2657 | } |
2460 | 2658 | ||
2461 | gckOS_AtomClearMask(Event->pendingMask, mask); | 2659 | gckOS_AtomClearMask(Event->pendingMask, mask); |
@@ -2473,7 +2671,10 @@ gckEVENT_Notify( | |||
2473 | for (i = 0; i < gcdMULTI_GPU; i++) | 2671 | for (i = 0; i < gcdMULTI_GPU; i++) |
2474 | { | 2672 | { |
2475 | atomic_clr(&Event->pending3D[i], mask); | 2673 | atomic_clr(&Event->pending3D[i], mask); |
2674 | atomic_clr(&Event->pending3DMask[i], mask); | ||
2476 | } | 2675 | } |
2676 | |||
2677 | atomic_clr(&Event->pendingMask, mask); | ||
2477 | } | 2678 | } |
2478 | else | 2679 | else |
2479 | #endif | 2680 | #endif |
@@ -2492,7 +2693,10 @@ gckEVENT_Notify( | |||
2492 | { | 2693 | { |
2493 | /* Mark pending interrupt as handled. */ | 2694 | /* Mark pending interrupt as handled. */ |
2494 | Event->pending3D[i] &= ~mask; | 2695 | Event->pending3D[i] &= ~mask; |
2696 | Event->pending3DMask[i] &= ~mask; | ||
2495 | } | 2697 | } |
2698 | |||
2699 | Event->pendingMask &= ~mask; | ||
2496 | } | 2700 | } |
2497 | else | 2701 | else |
2498 | #endif | 2702 | #endif |
@@ -2505,12 +2709,6 @@ gckEVENT_Notify( | |||
2505 | suspended = gcvFALSE; | 2709 | suspended = gcvFALSE; |
2506 | #endif | 2710 | #endif |
2507 | 2711 | ||
2508 | /* Grab the mutex queue. */ | ||
2509 | gcmkONERROR(gckOS_AcquireMutex(Event->os, | ||
2510 | Event->eventQueueMutex, | ||
2511 | gcvINFINITE)); | ||
2512 | acquired = gcvTRUE; | ||
2513 | |||
2514 | /* Grab the event head. */ | 2712 | /* Grab the event head. */ |
2515 | record = queue->head; | 2713 | record = queue->head; |
2516 | 2714 | ||
@@ -3060,7 +3258,7 @@ gckEVENT_Stop( | |||
3060 | IN gctPHYS_ADDR Handle, | 3258 | IN gctPHYS_ADDR Handle, |
3061 | IN gctPOINTER Logical, | 3259 | IN gctPOINTER Logical, |
3062 | IN gctSIGNAL Signal, | 3260 | IN gctSIGNAL Signal, |
3063 | IN OUT gctSIZE_T * waitSize | 3261 | IN OUT gctUINT32 * waitSize |
3064 | ) | 3262 | ) |
3065 | { | 3263 | { |
3066 | gceSTATUS status; | 3264 | gceSTATUS status; |
@@ -3081,8 +3279,11 @@ gckEVENT_Stop( | |||
3081 | #else | 3279 | #else |
3082 | gcmkONERROR(gckEVENT_Submit(Event, gcvTRUE, gcvFALSE)); | 3280 | gcmkONERROR(gckEVENT_Submit(Event, gcvTRUE, gcvFALSE)); |
3083 | #endif | 3281 | #endif |
3084 | 3282 | #if gcdMULTI_GPU | |
3283 | gcmkONERROR(gckEVENT_GetEvent(Event, gcvTRUE, &id, gcvKERNEL_PIXEL, gcvCORE_3D_ALL_MASK)); | ||
3284 | #else | ||
3085 | gcmkONERROR(gckEVENT_GetEvent(Event, gcvTRUE, &id, gcvKERNEL_PIXEL)); | 3285 | gcmkONERROR(gckEVENT_GetEvent(Event, gcvTRUE, &id, gcvKERNEL_PIXEL)); |
3286 | #endif | ||
3086 | 3287 | ||
3087 | /* Allocate a record. */ | 3288 | /* Allocate a record. */ |
3088 | gcmkONERROR(gckEVENT_AllocateRecord(Event, gcvTRUE, &record)); | 3289 | gcmkONERROR(gckEVENT_AllocateRecord(Event, gcvTRUE, &record)); |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c index bc02f428fc28..4c25f395bddd 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_heap.c | |||
@@ -34,8 +34,7 @@ | |||
34 | /******************************************************************************* | 34 | /******************************************************************************* |
35 | ***** Structures *************************************************************** | 35 | ***** Structures *************************************************************** |
36 | *******************************************************************************/ | 36 | *******************************************************************************/ |
37 | 37 | #define gcdIN_USE ((gcskNODE_PTR)gcvMAXUINTPTR_T) | |
38 | #define gcdIN_USE ((gcskNODE_PTR) ~0) | ||
39 | 38 | ||
40 | typedef struct _gcskNODE * gcskNODE_PTR; | 39 | typedef struct _gcskNODE * gcskNODE_PTR; |
41 | typedef struct _gcskNODE | 40 | typedef struct _gcskNODE |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c index e2feb69505de..8721c0b70976 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | |||
@@ -47,7 +47,7 @@ gceMMU_TYPE; | |||
47 | # define gcdMMU_CLEAR_VALUE 0x00000ABC | 47 | # define gcdMMU_CLEAR_VALUE 0x00000ABC |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | /*! Start GPU address for gcvSURF_VERTEX. */ | 50 | /*VIV: Start GPU address for gcvSURF_VERTEX. */ |
51 | #define gcdVERTEX_START (128 << 10) | 51 | #define gcdVERTEX_START (128 << 10) |
52 | 52 | ||
53 | typedef struct _gcsMMU_STLB *gcsMMU_STLB_PTR; | 53 | typedef struct _gcsMMU_STLB *gcsMMU_STLB_PTR; |
@@ -726,7 +726,7 @@ _SetupDynamicSpace( | |||
726 | 726 | ||
727 | Mmu->pageTableSize = numEntries * 4096; | 727 | Mmu->pageTableSize = numEntries * 4096; |
728 | 728 | ||
729 | Mmu->pageTableEntries = Mmu->pageTableSize / gcmSIZEOF(gctUINT32); | 729 | gcmkSAFECASTSIZET(Mmu->pageTableEntries, Mmu->pageTableSize / gcmSIZEOF(gctUINT32)); |
730 | 730 | ||
731 | gcmkONERROR(gckOS_Allocate(Mmu->os, | 731 | gcmkONERROR(gckOS_Allocate(Mmu->os, |
732 | Mmu->pageTableSize, | 732 | Mmu->pageTableSize, |
@@ -915,7 +915,7 @@ _Construct( | |||
915 | 915 | ||
916 | 916 | ||
917 | /* Compute number of entries in page table. */ | 917 | /* Compute number of entries in page table. */ |
918 | mmu->pageTableEntries = mmu->pageTableSize / sizeof(gctUINT32); | 918 | gcmkSAFECASTSIZET(mmu->pageTableEntries, mmu->pageTableSize / sizeof(gctUINT32)); |
919 | 919 | ||
920 | /* Mark all pages as free. */ | 920 | /* Mark all pages as free. */ |
921 | map = mmu->mapLogical; | 921 | map = mmu->mapLogical; |
@@ -1394,6 +1394,7 @@ _AllocatePages( | |||
1394 | gctUINT32_PTR map; | 1394 | gctUINT32_PTR map; |
1395 | gctBOOL gotIt; | 1395 | gctBOOL gotIt; |
1396 | gctUINT32 address; | 1396 | gctUINT32 address; |
1397 | gctUINT32 pageCount; | ||
1397 | 1398 | ||
1398 | gcmkHEADER_ARG("Mmu=0x%x PageCount=%lu", Mmu, PageCount); | 1399 | gcmkHEADER_ARG("Mmu=0x%x PageCount=%lu", Mmu, PageCount); |
1399 | 1400 | ||
@@ -1408,6 +1409,8 @@ _AllocatePages( | |||
1408 | gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES); | 1409 | gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES); |
1409 | } | 1410 | } |
1410 | 1411 | ||
1412 | gcmkSAFECASTSIZET(pageCount, PageCount); | ||
1413 | |||
1411 | /* Grab the mutex. */ | 1414 | /* Grab the mutex. */ |
1412 | gcmkONERROR(gckOS_AcquireMutex(Mmu->os, Mmu->pageTableMutex, gcvINFINITE)); | 1415 | gcmkONERROR(gckOS_AcquireMutex(Mmu->os, Mmu->pageTableMutex, gcvINFINITE)); |
1413 | mutex = gcvTRUE; | 1416 | mutex = gcvTRUE; |
@@ -1422,7 +1425,7 @@ _AllocatePages( | |||
1422 | gcmkONERROR(_AdjustIndex( | 1425 | gcmkONERROR(_AdjustIndex( |
1423 | Mmu, | 1426 | Mmu, |
1424 | index, | 1427 | index, |
1425 | PageCount, | 1428 | pageCount, |
1426 | gcdVERTEX_START / gcmSIZEOF(gctUINT32), | 1429 | gcdVERTEX_START / gcmSIZEOF(gctUINT32), |
1427 | &index | 1430 | &index |
1428 | )); | 1431 | )); |
@@ -1436,7 +1439,7 @@ _AllocatePages( | |||
1436 | { | 1439 | { |
1437 | case gcvMMU_SINGLE: | 1440 | case gcvMMU_SINGLE: |
1438 | /* Single odes are valid if we only need 1 page. */ | 1441 | /* Single odes are valid if we only need 1 page. */ |
1439 | if (PageCount == 1) | 1442 | if (pageCount == 1) |
1440 | { | 1443 | { |
1441 | gotIt = gcvTRUE; | 1444 | gotIt = gcvTRUE; |
1442 | } | 1445 | } |
@@ -1450,7 +1453,7 @@ _AllocatePages( | |||
1450 | 1453 | ||
1451 | case gcvMMU_FREE: | 1454 | case gcvMMU_FREE: |
1452 | /* Test if the node has enough space. */ | 1455 | /* Test if the node has enough space. */ |
1453 | if (PageCount <= (_ReadPageEntry(&map[index]) >> 8)) | 1456 | if (pageCount <= (_ReadPageEntry(&map[index]) >> 8)) |
1454 | { | 1457 | { |
1455 | gotIt = gcvTRUE; | 1458 | gotIt = gcvTRUE; |
1456 | } | 1459 | } |
@@ -1494,7 +1497,7 @@ _AllocatePages( | |||
1494 | 1497 | ||
1495 | case gcvMMU_FREE: | 1498 | case gcvMMU_FREE: |
1496 | /* Check how many pages will be left. */ | 1499 | /* Check how many pages will be left. */ |
1497 | left = (_ReadPageEntry(&map[index]) >> 8) - PageCount; | 1500 | left = (_ReadPageEntry(&map[index]) >> 8) - pageCount; |
1498 | switch (left) | 1501 | switch (left) |
1499 | { | 1502 | { |
1500 | case 0: | 1503 | case 0: |
@@ -1521,7 +1524,7 @@ _AllocatePages( | |||
1521 | } | 1524 | } |
1522 | 1525 | ||
1523 | /* Mark node as used. */ | 1526 | /* Mark node as used. */ |
1524 | gcmkONERROR(_FillPageTable(&map[index], PageCount, gcvMMU_USED)); | 1527 | gcmkONERROR(_FillPageTable(&map[index], pageCount, gcvMMU_USED)); |
1525 | 1528 | ||
1526 | /* Return pointer to page table. */ | 1529 | /* Return pointer to page table. */ |
1527 | *PageTable = &Mmu->pageTableLogical[index]; | 1530 | *PageTable = &Mmu->pageTableLogical[index]; |
@@ -1599,6 +1602,7 @@ _FreePages( | |||
1599 | gctUINT32_PTR node; | 1602 | gctUINT32_PTR node; |
1600 | gceSTATUS status; | 1603 | gceSTATUS status; |
1601 | gctBOOL acquired = gcvFALSE; | 1604 | gctBOOL acquired = gcvFALSE; |
1605 | gctUINT32 pageCount; | ||
1602 | 1606 | ||
1603 | gcmkHEADER_ARG("Mmu=0x%x PageTable=0x%x PageCount=%lu", | 1607 | gcmkHEADER_ARG("Mmu=0x%x PageTable=0x%x PageCount=%lu", |
1604 | Mmu, PageTable, PageCount); | 1608 | Mmu, PageTable, PageCount); |
@@ -1608,6 +1612,8 @@ _FreePages( | |||
1608 | gcmkVERIFY_ARGUMENT(PageTable != gcvNULL); | 1612 | gcmkVERIFY_ARGUMENT(PageTable != gcvNULL); |
1609 | gcmkVERIFY_ARGUMENT(PageCount > 0); | 1613 | gcmkVERIFY_ARGUMENT(PageCount > 0); |
1610 | 1614 | ||
1615 | gcmkSAFECASTSIZET(pageCount, PageCount); | ||
1616 | |||
1611 | /* Get the node by index. */ | 1617 | /* Get the node by index. */ |
1612 | node = Mmu->mapLogical + ((gctUINT32_PTR)PageTable - Mmu->pageTableLogical); | 1618 | node = Mmu->mapLogical + ((gctUINT32_PTR)PageTable - Mmu->pageTableLogical); |
1613 | 1619 | ||
@@ -1617,7 +1623,7 @@ _FreePages( | |||
1617 | #if gcdMMU_CLEAR_VALUE | 1623 | #if gcdMMU_CLEAR_VALUE |
1618 | if (Mmu->hardware->mmuVersion == 0) | 1624 | if (Mmu->hardware->mmuVersion == 0) |
1619 | { | 1625 | { |
1620 | _FillPageTable(PageTable, PageCount, gcdMMU_CLEAR_VALUE); | 1626 | _FillPageTable(PageTable, pageCount, gcdMMU_CLEAR_VALUE); |
1621 | } | 1627 | } |
1622 | #endif | 1628 | #endif |
1623 | 1629 | ||
@@ -1633,12 +1639,12 @@ _FreePages( | |||
1633 | else | 1639 | else |
1634 | { | 1640 | { |
1635 | /* Mark the node as free. */ | 1641 | /* Mark the node as free. */ |
1636 | _WritePageEntry(node, (PageCount << 8) | gcvMMU_FREE); | 1642 | _WritePageEntry(node, (pageCount << 8) | gcvMMU_FREE); |
1637 | _WritePageEntry(node + 1, ~0U); | 1643 | _WritePageEntry(node + 1, ~0U); |
1638 | 1644 | ||
1639 | #if gcdUSE_MMU_EXCEPTION | 1645 | #if gcdUSE_MMU_EXCEPTION |
1640 | /* Enable exception */ | 1646 | /* Enable exception */ |
1641 | gcmkVERIFY_OK(_FillPageTable(PageTable, PageCount, 1 << 1)); | 1647 | gcmkVERIFY_OK(_FillPageTable(PageTable, pageCount, 1 << 1)); |
1642 | #endif | 1648 | #endif |
1643 | } | 1649 | } |
1644 | 1650 | ||
@@ -1671,7 +1677,7 @@ gckMMU_AllocatePages( | |||
1671 | ) | 1677 | ) |
1672 | { | 1678 | { |
1673 | return gckMMU_AllocatePagesEx( | 1679 | return gckMMU_AllocatePagesEx( |
1674 | Mmu, PageCount, gcvSURF_UNKNOWN, PageTable, Address); | 1680 | Mmu, PageCount, gcvSURF_TYPE_UNKNOWN, PageTable, Address); |
1675 | } | 1681 | } |
1676 | 1682 | ||
1677 | gceSTATUS | 1683 | gceSTATUS |
@@ -2207,50 +2213,52 @@ OnError: | |||
2207 | 2213 | ||
2208 | gceSTATUS | 2214 | gceSTATUS |
2209 | gckMMU_Flush( | 2215 | gckMMU_Flush( |
2210 | IN gckMMU Mmu | 2216 | IN gckMMU Mmu, |
2217 | IN gceSURF_TYPE Type | ||
2211 | ) | 2218 | ) |
2212 | { | 2219 | { |
2213 | #if gcdPROCESS_ADDRESS_SPACE | 2220 | gckHARDWARE hardware; |
2221 | gctUINT32 mask; | ||
2214 | gctINT i; | 2222 | gctINT i; |
2223 | |||
2224 | if (Type == gcvSURF_VERTEX || Type == gcvSURF_INDEX) | ||
2225 | { | ||
2226 | mask = gcvPAGE_TABLE_DIRTY_BIT_FE; | ||
2227 | } | ||
2228 | else | ||
2229 | { | ||
2230 | mask = gcvPAGE_TABLE_DIRTY_BIT_OTHER; | ||
2231 | } | ||
2232 | |||
2233 | #if gcdPROCESS_ADDRESS_SPACE | ||
2215 | for (i = 0; i < gcdMAX_GPU_COUNT; i++) | 2234 | for (i = 0; i < gcdMAX_GPU_COUNT; i++) |
2216 | { | 2235 | { |
2217 | gcmkVERIFY_OK( | 2236 | gcmkVERIFY_OK( |
2218 | gckOS_AtomSet(Mmu->os, Mmu->pageTableDirty[i], 1)); | 2237 | gckOS_AtomSetMask(Mmu->pageTableDirty[i], mask)); |
2219 | } | 2238 | } |
2220 | #else | 2239 | #else |
2221 | gckHARDWARE hardware; | ||
2222 | #if gcdSHARED_PAGETABLE | 2240 | #if gcdSHARED_PAGETABLE |
2223 | gctINT i; | ||
2224 | for (i = 0; i < gcdMAX_GPU_COUNT; i++) | 2241 | for (i = 0; i < gcdMAX_GPU_COUNT; i++) |
2225 | { | 2242 | { |
2226 | #if gcdENABLE_VG | ||
2227 | if (i == gcvCORE_VG) | ||
2228 | { | ||
2229 | continue; | ||
2230 | } | ||
2231 | #endif | ||
2232 | hardware = sharedPageTable->hardwares[i]; | 2243 | hardware = sharedPageTable->hardwares[i]; |
2233 | if (hardware) | 2244 | if (hardware) |
2234 | { | 2245 | { |
2235 | /* Notify cores who use this page table. */ | 2246 | gcmkVERIFY_OK(gckOS_AtomSetMask(hardware->pageTableDirty, mask)); |
2236 | gcmkVERIFY_OK( | ||
2237 | gckOS_AtomSet(hardware->os, hardware->pageTableDirty, 1)); | ||
2238 | } | 2247 | } |
2239 | } | 2248 | } |
2240 | #elif gcdMIRROR_PAGETABLE | 2249 | #elif gcdMIRROR_PAGETABLE |
2241 | gctINT i; | ||
2242 | for (i = 0; i < (gctINT)mirrorPageTable->reference; i++) | 2250 | for (i = 0; i < (gctINT)mirrorPageTable->reference; i++) |
2243 | { | 2251 | { |
2244 | hardware = mirrorPageTable->hardwares[i]; | 2252 | hardware = mirrorPageTable->hardwares[i]; |
2245 | 2253 | ||
2246 | /* Notify cores who use this page table. */ | 2254 | /* Notify cores who use this page table. */ |
2247 | gcmkVERIFY_OK( | 2255 | gcmkVERIFY_OK( |
2248 | gckOS_AtomSet(hardware->os, hardware->pageTableDirty, 1)); | 2256 | gckOS_AtomSetMask(hardware->pageTableDirty, mask)); |
2249 | } | 2257 | } |
2250 | #else | 2258 | #else |
2251 | hardware = Mmu->hardware; | 2259 | hardware = Mmu->hardware; |
2252 | gcmkVERIFY_OK( | 2260 | gcmkVERIFY_OK( |
2253 | gckOS_AtomSet(hardware->os, hardware->pageTableDirty, 1)); | 2261 | gckOS_AtomSetMask(hardware->pageTableDirty, mask)); |
2254 | #endif | 2262 | #endif |
2255 | #endif | 2263 | #endif |
2256 | 2264 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c index 540e353c7dda..3909edda4b56 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu_vg.c | |||
@@ -47,7 +47,7 @@ | |||
47 | */ | 47 | */ |
48 | gceSTATUS gckVGMMU_Construct( | 48 | gceSTATUS gckVGMMU_Construct( |
49 | IN gckVGKERNEL Kernel, | 49 | IN gckVGKERNEL Kernel, |
50 | IN gctSIZE_T MmuSize, | 50 | IN gctUINT32 MmuSize, |
51 | OUT gckVGMMU * Mmu | 51 | OUT gckVGMMU * Mmu |
52 | ) | 52 | ) |
53 | { | 53 | { |
@@ -108,7 +108,7 @@ gceSTATUS gckVGMMU_Construct( | |||
108 | } | 108 | } |
109 | 109 | ||
110 | /* Allocate the page table. */ | 110 | /* Allocate the page table. */ |
111 | mmu->pageTableSize = MmuSize; | 111 | mmu->pageTableSize = (gctUINT32)MmuSize; |
112 | status = gckOS_AllocateContiguous(os, | 112 | status = gckOS_AllocateContiguous(os, |
113 | gcvFALSE, | 113 | gcvFALSE, |
114 | &mmu->pageTableSize, | 114 | &mmu->pageTableSize, |
@@ -134,7 +134,7 @@ gceSTATUS gckVGMMU_Construct( | |||
134 | } | 134 | } |
135 | 135 | ||
136 | /* Compute number of entries in page table. */ | 136 | /* Compute number of entries in page table. */ |
137 | mmu->entryCount = mmu->pageTableSize / sizeof(gctUINT32); | 137 | mmu->entryCount = (gctUINT32)mmu->pageTableSize / sizeof(gctUINT32); |
138 | mmu->entry = 0; | 138 | mmu->entry = 0; |
139 | 139 | ||
140 | /* Mark the entire page table as available. */ | 140 | /* Mark the entire page table as available. */ |
@@ -314,7 +314,7 @@ gceSTATUS gckVGMMU_AllocatePages( | |||
314 | } | 314 | } |
315 | 315 | ||
316 | /* Compute the tail for this allocation. */ | 316 | /* Compute the tail for this allocation. */ |
317 | tail = Mmu->entryCount - PageCount; | 317 | tail = Mmu->entryCount - (gctUINT32)PageCount; |
318 | 318 | ||
319 | /* Walk all entries until we find enough slots. */ | 319 | /* Walk all entries until we find enough slots. */ |
320 | for (index = Mmu->entry; index <= tail;) | 320 | for (index = Mmu->entry; index <= tail;) |
@@ -396,7 +396,7 @@ gceSTATUS gckVGMMU_AllocatePages( | |||
396 | if (status >= 0) | 396 | if (status >= 0) |
397 | { | 397 | { |
398 | /* Update current entry into page table. */ | 398 | /* Update current entry into page table. */ |
399 | Mmu->entry = index + PageCount; | 399 | Mmu->entry = index + (gctUINT32)PageCount; |
400 | 400 | ||
401 | /* Return pointer to page table. */ | 401 | /* Return pointer to page table. */ |
402 | *PageTable = (gctUINT32 *) Mmu->pageTableLogical + index; | 402 | *PageTable = (gctUINT32 *) Mmu->pageTableLogical + index; |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_security.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_security.c new file mode 100644 index 000000000000..f9caa17e32d8 --- /dev/null +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_security.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /**************************************************************************** | ||
2 | * | ||
3 | * Copyright (C) 2005 - 2014 by Vivante Corp. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the license, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | |||
21 | |||
22 | |||
23 | #include "gc_hal_kernel_precomp.h" | ||
24 | |||
25 | |||
26 | |||
27 | |||
28 | #define _GC_OBJ_ZONE gcvZONE_KERNEL | ||
29 | |||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c index 942a0a7c2776..2f5107b327a7 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_vg.c | |||
@@ -293,7 +293,7 @@ gceSTATUS gckVGKERNEL_Dispatch( | |||
293 | case gcvHAL_ALLOCATE_NON_PAGED_MEMORY: | 293 | case gcvHAL_ALLOCATE_NON_PAGED_MEMORY: |
294 | bytes = (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes; | 294 | bytes = (gctSIZE_T) kernelInterface->u.AllocateNonPagedMemory.bytes; |
295 | /* Allocate non-paged memory. */ | 295 | /* Allocate non-paged memory. */ |
296 | gcmkERR_BREAK(gckOS_AllocateContiguous( | 296 | gcmkERR_BREAK(gckOS_AllocateNonPagedMemory( |
297 | Kernel->os, | 297 | Kernel->os, |
298 | gcvTRUE, | 298 | gcvTRUE, |
299 | &bytes, | 299 | &bytes, |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c index 43c69eb78503..5b1619a97953 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | |||
@@ -409,6 +409,8 @@ gckVIDMEM_Construct( | |||
409 | gcuVIDMEM_NODE_PTR node; | 409 | gcuVIDMEM_NODE_PTR node; |
410 | gctINT i, banks = 0; | 410 | gctINT i, banks = 0; |
411 | gctPOINTER pointer = gcvNULL; | 411 | gctPOINTER pointer = gcvNULL; |
412 | gctUINT32 heapBytes; | ||
413 | gctUINT32 bankSize; | ||
412 | 414 | ||
413 | gcmkHEADER_ARG("Os=0x%x BaseAddress=%08x Bytes=%lu Threshold=%lu " | 415 | gcmkHEADER_ARG("Os=0x%x BaseAddress=%08x Bytes=%lu Threshold=%lu " |
414 | "BankSize=%lu", | 416 | "BankSize=%lu", |
@@ -419,6 +421,9 @@ gckVIDMEM_Construct( | |||
419 | gcmkVERIFY_ARGUMENT(Bytes > 0); | 421 | gcmkVERIFY_ARGUMENT(Bytes > 0); |
420 | gcmkVERIFY_ARGUMENT(Memory != gcvNULL); | 422 | gcmkVERIFY_ARGUMENT(Memory != gcvNULL); |
421 | 423 | ||
424 | gcmkSAFECASTSIZET(heapBytes, Bytes); | ||
425 | gcmkSAFECASTSIZET(bankSize, BankSize); | ||
426 | |||
422 | /* Allocate the gckVIDMEM object. */ | 427 | /* Allocate the gckVIDMEM object. */ |
423 | gcmkONERROR(gckOS_Allocate(Os, gcmSIZEOF(struct _gckVIDMEM), &pointer)); | 428 | gcmkONERROR(gckOS_Allocate(Os, gcmSIZEOF(struct _gckVIDMEM), &pointer)); |
424 | 429 | ||
@@ -430,8 +435,8 @@ gckVIDMEM_Construct( | |||
430 | 435 | ||
431 | /* Set video memory heap information. */ | 436 | /* Set video memory heap information. */ |
432 | memory->baseAddress = BaseAddress; | 437 | memory->baseAddress = BaseAddress; |
433 | memory->bytes = Bytes; | 438 | memory->bytes = heapBytes; |
434 | memory->freeBytes = Bytes; | 439 | memory->freeBytes = heapBytes; |
435 | memory->threshold = Threshold; | 440 | memory->threshold = Threshold; |
436 | memory->mutex = gcvNULL; | 441 | memory->mutex = gcvNULL; |
437 | 442 | ||
@@ -440,22 +445,22 @@ gckVIDMEM_Construct( | |||
440 | /* Walk all possible banks. */ | 445 | /* Walk all possible banks. */ |
441 | for (i = 0; i < gcmCOUNTOF(memory->sentinel); ++i) | 446 | for (i = 0; i < gcmCOUNTOF(memory->sentinel); ++i) |
442 | { | 447 | { |
443 | gctSIZE_T bytes; | 448 | gctUINT32 bytes; |
444 | 449 | ||
445 | if (BankSize == 0) | 450 | if (BankSize == 0) |
446 | { | 451 | { |
447 | /* Use all bytes for the first bank. */ | 452 | /* Use all bytes for the first bank. */ |
448 | bytes = Bytes; | 453 | bytes = heapBytes; |
449 | } | 454 | } |
450 | else | 455 | else |
451 | { | 456 | { |
452 | /* Compute number of bytes for this bank. */ | 457 | /* Compute number of bytes for this bank. */ |
453 | bytes = gcmALIGN(BaseAddress + 1, BankSize) - BaseAddress; | 458 | bytes = gcmALIGN(BaseAddress + 1, bankSize) - BaseAddress; |
454 | 459 | ||
455 | if (bytes > Bytes) | 460 | if (bytes > heapBytes) |
456 | { | 461 | { |
457 | /* Make sure we don't exceed the total number of bytes. */ | 462 | /* Make sure we don't exceed the total number of bytes. */ |
458 | bytes = Bytes; | 463 | bytes = heapBytes; |
459 | } | 464 | } |
460 | } | 465 | } |
461 | 466 | ||
@@ -490,15 +495,15 @@ gckVIDMEM_Construct( | |||
490 | 495 | ||
491 | node->VidMem.locked = 0; | 496 | node->VidMem.locked = 0; |
492 | 497 | ||
493 | #if gcdDYNAMIC_MAP_RESERVED_MEMORY && gcdENABLE_VG | ||
494 | node->VidMem.kernelVirtual = gcvNULL; | ||
495 | #endif | ||
496 | |||
497 | #ifdef __QNXNTO__ | 498 | #ifdef __QNXNTO__ |
498 | node->VidMem.processID = 0; | 499 | node->VidMem.processID = 0; |
499 | node->VidMem.logical = gcvNULL; | 500 | node->VidMem.logical = gcvNULL; |
500 | #endif | 501 | #endif |
501 | 502 | ||
503 | #if gcdDYNAMIC_MAP_RESERVED_MEMORY && gcdENABLE_VG | ||
504 | node->VidMem.kernelVirtual = gcvNULL; | ||
505 | #endif | ||
506 | |||
502 | /* Initialize the linked list of nodes. */ | 507 | /* Initialize the linked list of nodes. */ |
503 | memory->sentinel[i].VidMem.next = | 508 | memory->sentinel[i].VidMem.next = |
504 | memory->sentinel[i].VidMem.prev = | 509 | memory->sentinel[i].VidMem.prev = |
@@ -510,7 +515,7 @@ gckVIDMEM_Construct( | |||
510 | 515 | ||
511 | /* Adjust address for next bank. */ | 516 | /* Adjust address for next bank. */ |
512 | BaseAddress += bytes; | 517 | BaseAddress += bytes; |
513 | Bytes -= bytes; | 518 | heapBytes -= bytes; |
514 | banks ++; | 519 | banks ++; |
515 | } | 520 | } |
516 | 521 | ||
@@ -820,8 +825,13 @@ _FindNode( | |||
820 | node->VidMem.bytes != 0; | 825 | node->VidMem.bytes != 0; |
821 | node = node->VidMem.nextFree) | 826 | node = node->VidMem.nextFree) |
822 | { | 827 | { |
828 | gctUINT offset; | ||
829 | |||
830 | gctINT modulo; | ||
831 | |||
832 | gcmkSAFECASTSIZET(offset, node->VidMem.offset); | ||
823 | 833 | ||
824 | gctINT modulo = gckMATH_ModuloInt(node->VidMem.offset, *Alignment); | 834 | modulo = gckMATH_ModuloInt(offset, *Alignment); |
825 | 835 | ||
826 | /* Compute number of bytes to skip for alignment. */ | 836 | /* Compute number of bytes to skip for alignment. */ |
827 | alignment = (*Alignment == 0) ? 0 : (*Alignment - modulo); | 837 | alignment = (*Alignment == 0) ? 0 : (*Alignment - modulo); |
@@ -867,6 +877,11 @@ OnError: | |||
867 | ** gceSURF_TYPE Type | 877 | ** gceSURF_TYPE Type |
868 | ** Type of surface to allocate (use by bank optimization). | 878 | ** Type of surface to allocate (use by bank optimization). |
869 | ** | 879 | ** |
880 | ** gctBOOL Specified | ||
881 | ** If user must use this pool, it should set Specified to gcvTRUE, | ||
882 | ** otherwise allocator may reserve some memory for other usage, such | ||
883 | ** as small block size allocation request. | ||
884 | ** | ||
870 | ** OUTPUT: | 885 | ** OUTPUT: |
871 | ** | 886 | ** |
872 | ** gcuVIDMEM_NODE_PTR * Node | 887 | ** gcuVIDMEM_NODE_PTR * Node |
@@ -879,6 +894,7 @@ gckVIDMEM_AllocateLinear( | |||
879 | IN gctSIZE_T Bytes, | 894 | IN gctSIZE_T Bytes, |
880 | IN gctUINT32 Alignment, | 895 | IN gctUINT32 Alignment, |
881 | IN gceSURF_TYPE Type, | 896 | IN gceSURF_TYPE Type, |
897 | IN gctBOOL Specified, | ||
882 | OUT gcuVIDMEM_NODE_PTR * Node | 898 | OUT gcuVIDMEM_NODE_PTR * Node |
883 | ) | 899 | ) |
884 | { | 900 | { |
@@ -912,6 +928,7 @@ gckVIDMEM_AllocateLinear( | |||
912 | #if gcdSMALL_BLOCK_SIZE | 928 | #if gcdSMALL_BLOCK_SIZE |
913 | if ((Memory->freeBytes < (Memory->bytes/gcdRATIO_FOR_SMALL_MEMORY)) | 929 | if ((Memory->freeBytes < (Memory->bytes/gcdRATIO_FOR_SMALL_MEMORY)) |
914 | && (Bytes >= gcdSMALL_BLOCK_SIZE) | 930 | && (Bytes >= gcdSMALL_BLOCK_SIZE) |
931 | && (Specified == gcvFALSE) | ||
915 | ) | 932 | ) |
916 | { | 933 | { |
917 | /* The left memory is for small memory.*/ | 934 | /* The left memory is for small memory.*/ |
@@ -1283,6 +1300,7 @@ _NeedVirtualMapping( | |||
1283 | gcePOOL pool; | 1300 | gcePOOL pool; |
1284 | gctUINT32 offset; | 1301 | gctUINT32 offset; |
1285 | gctUINT32 baseAddress; | 1302 | gctUINT32 baseAddress; |
1303 | gctUINT32 bytes; | ||
1286 | 1304 | ||
1287 | gcmkHEADER_ARG("Node=0x%X", Node); | 1305 | gcmkHEADER_ARG("Node=0x%X", Node); |
1288 | 1306 | ||
@@ -1303,8 +1321,9 @@ _NeedVirtualMapping( | |||
1303 | #endif | 1321 | #endif |
1304 | { | 1322 | { |
1305 | /* Convert logical address into a physical address. */ | 1323 | /* Convert logical address into a physical address. */ |
1306 | gcmkONERROR( | 1324 | gcmkONERROR(gckOS_UserLogicalToPhysical( |
1307 | gckOS_GetPhysicalAddress(Kernel->os, Node->Virtual.logical, &phys)); | 1325 | Kernel->os, Node->Virtual.logical, &phys |
1326 | )); | ||
1308 | 1327 | ||
1309 | gcmkONERROR(gckOS_GetBaseAddress(Kernel->os, &baseAddress)); | 1328 | gcmkONERROR(gckOS_GetBaseAddress(Kernel->os, &baseAddress)); |
1310 | 1329 | ||
@@ -1315,7 +1334,8 @@ _NeedVirtualMapping( | |||
1315 | 1334 | ||
1316 | /* If part of region is belong to gcvPOOL_VIRTUAL, | 1335 | /* If part of region is belong to gcvPOOL_VIRTUAL, |
1317 | ** whole region has to be mapped. */ | 1336 | ** whole region has to be mapped. */ |
1318 | end = phys + Node->Virtual.bytes - 1; | 1337 | gcmkSAFECASTSIZET(bytes, Node->Virtual.bytes); |
1338 | end = phys + bytes - 1; | ||
1319 | 1339 | ||
1320 | gcmkONERROR(gckHARDWARE_SplitMemory( | 1340 | gcmkONERROR(gckHARDWARE_SplitMemory( |
1321 | Kernel->hardware, end, &pool, &offset | 1341 | Kernel->hardware, end, &pool, &offset |
@@ -1484,6 +1504,8 @@ gckVIDMEM_Lock( | |||
1484 | 1504 | ||
1485 | if (Node->VidMem.memory->object.type == gcvOBJ_VIDMEM) | 1505 | if (Node->VidMem.memory->object.type == gcvOBJ_VIDMEM) |
1486 | { | 1506 | { |
1507 | gctUINT32 offset; | ||
1508 | |||
1487 | if (Cacheable == gcvTRUE) | 1509 | if (Cacheable == gcvTRUE) |
1488 | { | 1510 | { |
1489 | gcmkONERROR(gcvSTATUS_INVALID_REQUEST); | 1511 | gcmkONERROR(gcvSTATUS_INVALID_REQUEST); |
@@ -1493,8 +1515,10 @@ gckVIDMEM_Lock( | |||
1493 | Node->VidMem.locked ++; | 1515 | Node->VidMem.locked ++; |
1494 | 1516 | ||
1495 | /* Return the physical address of the node. */ | 1517 | /* Return the physical address of the node. */ |
1518 | gcmkSAFECASTSIZET(offset, Node->VidMem.offset); | ||
1519 | |||
1496 | *Address = Node->VidMem.memory->baseAddress | 1520 | *Address = Node->VidMem.memory->baseAddress |
1497 | + Node->VidMem.offset | 1521 | + offset |
1498 | + Node->VidMem.alignment; | 1522 | + Node->VidMem.alignment; |
1499 | 1523 | ||
1500 | /* Get hardware specific address. */ | 1524 | /* Get hardware specific address. */ |
@@ -1560,15 +1584,19 @@ gckVIDMEM_Lock( | |||
1560 | #if gcdENABLE_VG | 1584 | #if gcdENABLE_VG |
1561 | if (Kernel->vg != gcvNULL) | 1585 | if (Kernel->vg != gcvNULL) |
1562 | { | 1586 | { |
1563 | gcmkONERROR(gckVGHARDWARE_ConvertLogical(Kernel->vg->hardware, | 1587 | gcmkONERROR(gckVGHARDWARE_ConvertLogical( |
1588 | Kernel->vg->hardware, | ||
1564 | Node->Virtual.logical, | 1589 | Node->Virtual.logical, |
1590 | gcvTRUE, | ||
1565 | &Node->Virtual.addresses[Kernel->core])); | 1591 | &Node->Virtual.addresses[Kernel->core])); |
1566 | } | 1592 | } |
1567 | else | 1593 | else |
1568 | #endif | 1594 | #endif |
1569 | { | 1595 | { |
1570 | gcmkONERROR(gckHARDWARE_ConvertLogical(Kernel->hardware, | 1596 | gcmkONERROR(gckHARDWARE_ConvertLogical( |
1597 | Kernel->hardware, | ||
1571 | Node->Virtual.logical, | 1598 | Node->Virtual.logical, |
1599 | gcvTRUE, | ||
1572 | &Node->Virtual.addresses[Kernel->core])); | 1600 | &Node->Virtual.addresses[Kernel->core])); |
1573 | } | 1601 | } |
1574 | } | 1602 | } |
@@ -1599,22 +1627,12 @@ gckVIDMEM_Lock( | |||
1599 | Node->Virtual.lockKernels[Kernel->core] = Kernel; | 1627 | Node->Virtual.lockKernels[Kernel->core] = Kernel; |
1600 | 1628 | ||
1601 | /* Map the pages. */ | 1629 | /* Map the pages. */ |
1602 | #ifdef __QNXNTO__ | ||
1603 | gcmkONERROR( | 1630 | gcmkONERROR( |
1604 | gckOS_MapPagesEx(os, | 1631 | gckOS_MapPagesEx(os, |
1605 | Kernel->core, | 1632 | Kernel->core, |
1606 | Node->Virtual.physical, | 1633 | Node->Virtual.physical, |
1607 | Node->Virtual.logical, | ||
1608 | Node->Virtual.pageCount, | 1634 | Node->Virtual.pageCount, |
1609 | Node->Virtual.pageTables[Kernel->core])); | 1635 | Node->Virtual.pageTables[Kernel->core])); |
1610 | #else | ||
1611 | gcmkONERROR( | ||
1612 | gckOS_MapPagesEx(os, | ||
1613 | Kernel->core, | ||
1614 | Node->Virtual.physical, | ||
1615 | Node->Virtual.pageCount, | ||
1616 | Node->Virtual.pageTables[Kernel->core])); | ||
1617 | #endif | ||
1618 | 1636 | ||
1619 | #if gcdENABLE_VG | 1637 | #if gcdENABLE_VG |
1620 | if (Kernel->core == gcvCORE_VG) | 1638 | if (Kernel->core == gcvCORE_VG) |
@@ -1624,7 +1642,7 @@ gckVIDMEM_Lock( | |||
1624 | else | 1642 | else |
1625 | #endif | 1643 | #endif |
1626 | { | 1644 | { |
1627 | gcmkONERROR(gckMMU_Flush(Kernel->mmu)); | 1645 | gcmkONERROR(gckMMU_Flush(Kernel->mmu, Node->Virtual.type)); |
1628 | } | 1646 | } |
1629 | } | 1647 | } |
1630 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_VIDMEM, | 1648 | gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_VIDMEM, |
@@ -2120,13 +2138,13 @@ gckVIDMEM_HANDLE_Allocate( | |||
2120 | ) | 2138 | ) |
2121 | { | 2139 | { |
2122 | gceSTATUS status; | 2140 | gceSTATUS status; |
2123 | gctUINT32 processID; | 2141 | gctUINT32 processID = 0; |
2124 | gctPOINTER pointer = gcvNULL; | 2142 | gctPOINTER pointer = gcvNULL; |
2125 | gctPOINTER handleDatabase; | 2143 | gctPOINTER handleDatabase = gcvNULL; |
2126 | gctPOINTER mutex; | 2144 | gctPOINTER mutex = gcvNULL; |
2127 | gctUINT32 handle; | 2145 | gctUINT32 handle = 0; |
2128 | gckVIDMEM_HANDLE handleObject = gcvNULL; | 2146 | gckVIDMEM_HANDLE handleObject = gcvNULL; |
2129 | gckOS os = Kernel->os; | 2147 | gckOS os = Kernel->os; |
2130 | 2148 | ||
2131 | gcmkHEADER_ARG("Kernel=0x%X, Node=0x%X", Kernel, Node); | 2149 | gcmkHEADER_ARG("Kernel=0x%X, Node=0x%X", Kernel, Node); |
2132 | 2150 | ||
@@ -2202,11 +2220,11 @@ gckVIDMEM_HANDLE_Reference( | |||
2202 | ) | 2220 | ) |
2203 | { | 2221 | { |
2204 | gceSTATUS status; | 2222 | gceSTATUS status; |
2205 | gckVIDMEM_HANDLE handleObject; | 2223 | gckVIDMEM_HANDLE handleObject = gcvNULL; |
2206 | gctPOINTER database; | 2224 | gctPOINTER database = gcvNULL; |
2207 | gctPOINTER mutex; | 2225 | gctPOINTER mutex = gcvNULL; |
2208 | gctINT32 oldValue; | 2226 | gctINT32 oldValue = 0; |
2209 | gctBOOL acquired = gcvFALSE; | 2227 | gctBOOL acquired = gcvFALSE; |
2210 | 2228 | ||
2211 | gcmkHEADER_ARG("Handle=%d PrcoessID=%d", Handle, ProcessID); | 2229 | gcmkHEADER_ARG("Handle=%d PrcoessID=%d", Handle, ProcessID); |
2212 | 2230 | ||
@@ -2247,11 +2265,11 @@ gckVIDMEM_HANDLE_Dereference( | |||
2247 | ) | 2265 | ) |
2248 | { | 2266 | { |
2249 | gceSTATUS status; | 2267 | gceSTATUS status; |
2250 | gctPOINTER handleDatabase; | 2268 | gctPOINTER handleDatabase = gcvNULL; |
2251 | gctPOINTER mutex; | 2269 | gctPOINTER mutex = gcvNULL; |
2252 | gctINT32 oldValue; | 2270 | gctINT32 oldValue = 0; |
2253 | gckVIDMEM_HANDLE handleObject; | 2271 | gckVIDMEM_HANDLE handleObject = gcvNULL; |
2254 | gctBOOL acquired = gcvFALSE; | 2272 | gctBOOL acquired = gcvFALSE; |
2255 | 2273 | ||
2256 | gcmkHEADER_ARG("Handle=%d PrcoessID=%d", Handle, ProcessID); | 2274 | gcmkHEADER_ARG("Handle=%d PrcoessID=%d", Handle, ProcessID); |
2257 | 2275 | ||
@@ -2306,12 +2324,12 @@ gckVIDMEM_HANDLE_LookupAndReference( | |||
2306 | ) | 2324 | ) |
2307 | { | 2325 | { |
2308 | gceSTATUS status; | 2326 | gceSTATUS status; |
2309 | gckVIDMEM_HANDLE handleObject; | 2327 | gckVIDMEM_HANDLE handleObject = gcvNULL; |
2310 | gckVIDMEM_NODE node; | 2328 | gckVIDMEM_NODE node = gcvNULL; |
2311 | gctPOINTER database; | 2329 | gctPOINTER database = gcvNULL; |
2312 | gctPOINTER mutex; | 2330 | gctPOINTER mutex = gcvNULL; |
2313 | gctUINT32 processID; | 2331 | gctUINT32 processID = 0; |
2314 | gctBOOL acquired = gcvFALSE; | 2332 | gctBOOL acquired = gcvFALSE; |
2315 | 2333 | ||
2316 | gcmkHEADER_ARG("Kernel=0x%X Handle=%d", Kernel, Handle); | 2334 | gcmkHEADER_ARG("Kernel=0x%X Handle=%d", Kernel, Handle); |
2317 | 2335 | ||
@@ -2361,11 +2379,11 @@ gckVIDMEM_HANDLE_Lookup( | |||
2361 | ) | 2379 | ) |
2362 | { | 2380 | { |
2363 | gceSTATUS status; | 2381 | gceSTATUS status; |
2364 | gckVIDMEM_HANDLE handleObject; | 2382 | gckVIDMEM_HANDLE handleObject = gcvNULL; |
2365 | gckVIDMEM_NODE node; | 2383 | gckVIDMEM_NODE node = gcvNULL; |
2366 | gctPOINTER database; | 2384 | gctPOINTER database = gcvNULL; |
2367 | gctPOINTER mutex; | 2385 | gctPOINTER mutex = gcvNULL; |
2368 | gctBOOL acquired = gcvFALSE; | 2386 | gctBOOL acquired = gcvFALSE; |
2369 | 2387 | ||
2370 | gcmkHEADER_ARG("Kernel=0x%X ProcessID=%d Handle=%d", | 2388 | gcmkHEADER_ARG("Kernel=0x%X ProcessID=%d Handle=%d", |
2371 | Kernel, ProcessID, Handle); | 2389 | Kernel, ProcessID, Handle); |
@@ -2430,9 +2448,9 @@ gckVIDMEM_NODE_Allocate( | |||
2430 | { | 2448 | { |
2431 | gceSTATUS status; | 2449 | gceSTATUS status; |
2432 | gckVIDMEM_NODE node = gcvNULL; | 2450 | gckVIDMEM_NODE node = gcvNULL; |
2433 | gctPOINTER pointer = gcvNULL; | 2451 | gctPOINTER pointer = gcvNULL; |
2434 | gctUINT32 handle = 0; | 2452 | gctUINT32 handle = 0; |
2435 | gckOS os = Kernel->os; | 2453 | gckOS os = Kernel->os; |
2436 | 2454 | ||
2437 | gcmkHEADER_ARG("Kernel=0x%X VideoNode=0x%X", Kernel, VideoNode); | 2455 | gcmkHEADER_ARG("Kernel=0x%X VideoNode=0x%X", Kernel, VideoNode); |
2438 | 2456 | ||
@@ -2492,9 +2510,9 @@ gckVIDMEM_NODE_Dereference( | |||
2492 | IN gckVIDMEM_NODE Node | 2510 | IN gckVIDMEM_NODE Node |
2493 | ) | 2511 | ) |
2494 | { | 2512 | { |
2495 | gctINT32 oldValue; | 2513 | gctINT32 oldValue = 0; |
2496 | gctPOINTER database = Kernel->db->nameDatabase; | 2514 | gctPOINTER database = Kernel->db->nameDatabase; |
2497 | gctPOINTER mutex = Kernel->db->nameDatabaseMutex; | 2515 | gctPOINTER mutex = Kernel->db->nameDatabaseMutex; |
2498 | 2516 | ||
2499 | gcmkHEADER_ARG("Kernel=0x%X Node=0x%X", Kernel, Node); | 2517 | gcmkHEADER_ARG("Kernel=0x%X Node=0x%X", Kernel, Node); |
2500 | 2518 | ||
@@ -2554,12 +2572,12 @@ gckVIDMEM_NODE_Name( | |||
2554 | { | 2572 | { |
2555 | gceSTATUS status; | 2573 | gceSTATUS status; |
2556 | gckVIDMEM_NODE node = gcvNULL; | 2574 | gckVIDMEM_NODE node = gcvNULL; |
2557 | gctUINT32 name; | 2575 | gctUINT32 name = 0; |
2558 | gctUINT32 processID; | 2576 | gctUINT32 processID = 0; |
2559 | gctPOINTER database = Kernel->db->nameDatabase; | 2577 | gctPOINTER database = Kernel->db->nameDatabase; |
2560 | gctPOINTER mutex = Kernel->db->nameDatabaseMutex; | 2578 | gctPOINTER mutex = Kernel->db->nameDatabaseMutex; |
2561 | gctBOOL acquired = gcvFALSE; | 2579 | gctBOOL acquired = gcvFALSE; |
2562 | gctBOOL referenced = gcvFALSE; | 2580 | gctBOOL referenced = gcvFALSE; |
2563 | gcmkHEADER_ARG("Kernel=0x%X Handle=%d", Kernel, Handle); | 2581 | gcmkHEADER_ARG("Kernel=0x%X Handle=%d", Kernel, Handle); |
2564 | 2582 | ||
2565 | gcmkONERROR(gckOS_GetProcessID(&processID)); | 2583 | gcmkONERROR(gckOS_GetProcessID(&processID)); |
@@ -2582,7 +2600,10 @@ gckVIDMEM_NODE_Name( | |||
2582 | 2600 | ||
2583 | gcmkVERIFY_OK(gckVIDMEM_NODE_Dereference(Kernel, node)); | 2601 | gcmkVERIFY_OK(gckVIDMEM_NODE_Dereference(Kernel, node)); |
2584 | 2602 | ||
2585 | *Name = node->name; | 2603 | if(node) |
2604 | { | ||
2605 | *Name = node->name; | ||
2606 | } | ||
2586 | 2607 | ||
2587 | gcmkFOOTER_ARG("*Name=%d", *Name); | 2608 | gcmkFOOTER_ARG("*Name=%d", *Name); |
2588 | return gcvSTATUS_OK; | 2609 | return gcvSTATUS_OK; |
@@ -2632,9 +2653,9 @@ gckVIDMEM_NODE_Import( | |||
2632 | gceSTATUS status; | 2653 | gceSTATUS status; |
2633 | gckVIDMEM_NODE node = gcvNULL; | 2654 | gckVIDMEM_NODE node = gcvNULL; |
2634 | gctPOINTER database = Kernel->db->nameDatabase; | 2655 | gctPOINTER database = Kernel->db->nameDatabase; |
2635 | gctPOINTER mutex = Kernel->db->nameDatabaseMutex; | 2656 | gctPOINTER mutex = Kernel->db->nameDatabaseMutex; |
2636 | gctBOOL acquired = gcvFALSE; | 2657 | gctBOOL acquired = gcvFALSE; |
2637 | gctBOOL referenced = gcvFALSE; | 2658 | gctBOOL referenced = gcvFALSE; |
2638 | 2659 | ||
2639 | gcmkHEADER_ARG("Kernel=0x%X Name=%d", Kernel, Name); | 2660 | gcmkHEADER_ARG("Kernel=0x%X Name=%d", Kernel, Name); |
2640 | 2661 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h index ece4fc6f3d57..83e350ee3bb7 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "gc_hal_statistics.h" | 33 | #include "gc_hal_statistics.h" |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | |||
36 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
37 | extern "C" { | 38 | extern "C" { |
38 | #endif | 39 | #endif |
@@ -84,8 +85,6 @@ extern "C" { | |||
84 | #define gcmRELEASE_NAME(na) \ | 85 | #define gcmRELEASE_NAME(na) \ |
85 | gckKERNEL_DeleteName(kernel, gcmALL_TO_UINT32(na)) | 86 | gckKERNEL_DeleteName(kernel, gcmALL_TO_UINT32(na)) |
86 | 87 | ||
87 | #ifdef __LP64__ | ||
88 | |||
89 | #define gcmALL_TO_UINT32(t) \ | 88 | #define gcmALL_TO_UINT32(t) \ |
90 | ( \ | 89 | ( \ |
91 | (gctUINT32) (gctUINTPTR_T) (t)\ | 90 | (gctUINT32) (gctUINTPTR_T) (t)\ |
@@ -93,23 +92,6 @@ extern "C" { | |||
93 | 92 | ||
94 | #define gcmPTR_TO_UINT64(p) \ | 93 | #define gcmPTR_TO_UINT64(p) \ |
95 | ( \ | 94 | ( \ |
96 | (gctUINT64) (p)\ | ||
97 | ) | ||
98 | |||
99 | #define gcmUINT64_TO_PTR(u) \ | ||
100 | ( \ | ||
101 | (gctPOINTER) (u)\ | ||
102 | ) | ||
103 | |||
104 | #else /* 32 bit */ | ||
105 | |||
106 | #define gcmALL_TO_UINT32(t) \ | ||
107 | ( \ | ||
108 | (gctUINT32) (t)\ | ||
109 | ) | ||
110 | |||
111 | #define gcmPTR_TO_UINT64(p) \ | ||
112 | ( \ | ||
113 | (gctUINT64) (gctUINTPTR_T) (p)\ | 95 | (gctUINT64) (gctUINTPTR_T) (p)\ |
114 | ) | 96 | ) |
115 | 97 | ||
@@ -118,8 +100,6 @@ extern "C" { | |||
118 | (gctPOINTER) (gctUINTPTR_T) (u)\ | 100 | (gctPOINTER) (gctUINTPTR_T) (u)\ |
119 | ) | 101 | ) |
120 | 102 | ||
121 | #endif | ||
122 | |||
123 | #define gcmUINT64_TO_TYPE(u, t) \ | 103 | #define gcmUINT64_TO_TYPE(u, t) \ |
124 | ( \ | 104 | ( \ |
125 | (t) (gctUINTPTR_T) (u)\ | 105 | (t) (gctUINTPTR_T) (u)\ |
@@ -396,9 +376,6 @@ gceSTATUS | |||
396 | gckOS_MapPages( | 376 | gckOS_MapPages( |
397 | IN gckOS Os, | 377 | IN gckOS Os, |
398 | IN gctPHYS_ADDR Physical, | 378 | IN gctPHYS_ADDR Physical, |
399 | #ifdef __QNXNTO__ | ||
400 | IN gctPOINTER Logical, | ||
401 | #endif | ||
402 | IN gctSIZE_T PageCount, | 379 | IN gctSIZE_T PageCount, |
403 | IN gctPOINTER PageTable | 380 | IN gctPOINTER PageTable |
404 | ); | 381 | ); |
@@ -409,9 +386,6 @@ gckOS_MapPagesEx( | |||
409 | IN gckOS Os, | 386 | IN gckOS Os, |
410 | IN gceCORE Core, | 387 | IN gceCORE Core, |
411 | IN gctPHYS_ADDR Physical, | 388 | IN gctPHYS_ADDR Physical, |
412 | #ifdef __QNXNTO__ | ||
413 | IN gctPOINTER Logical, | ||
414 | #endif | ||
415 | IN gctSIZE_T PageCount, | 389 | IN gctSIZE_T PageCount, |
416 | #if gcdPROCESS_ADDRESS_SPACE | 390 | #if gcdPROCESS_ADDRESS_SPACE |
417 | IN gctUINT32 Address, | 391 | IN gctUINT32 Address, |
@@ -489,6 +463,14 @@ gckOS_GetPhysicalAddress( | |||
489 | OUT gctUINT32 * Address | 463 | OUT gctUINT32 * Address |
490 | ); | 464 | ); |
491 | 465 | ||
466 | /* Get the physical address of a corresponding user logical address. */ | ||
467 | gceSTATUS | ||
468 | gckOS_UserLogicalToPhysical( | ||
469 | IN gckOS Os, | ||
470 | IN gctPOINTER Logical, | ||
471 | OUT gctUINT32 * Address | ||
472 | ); | ||
473 | |||
492 | /* Get the physical address of a corresponding logical address. */ | 474 | /* Get the physical address of a corresponding logical address. */ |
493 | gceSTATUS | 475 | gceSTATUS |
494 | gckOS_GetPhysicalAddressProcess( | 476 | gckOS_GetPhysicalAddressProcess( |
@@ -663,7 +645,6 @@ gckOS_AtomicExchangePtr( | |||
663 | OUT gctPOINTER * OldValue | 645 | OUT gctPOINTER * OldValue |
664 | ); | 646 | ); |
665 | 647 | ||
666 | #if gcdSMP | ||
667 | gceSTATUS | 648 | gceSTATUS |
668 | gckOS_AtomSetMask( | 649 | gckOS_AtomSetMask( |
669 | IN gctPOINTER Atom, | 650 | IN gctPOINTER Atom, |
@@ -675,7 +656,6 @@ gckOS_AtomClearMask( | |||
675 | IN gctPOINTER Atom, | 656 | IN gctPOINTER Atom, |
676 | IN gctUINT32 Mask | 657 | IN gctUINT32 Mask |
677 | ); | 658 | ); |
678 | #endif | ||
679 | 659 | ||
680 | gceSTATUS | 660 | gceSTATUS |
681 | gckOS_DumpCallStack( | 661 | gckOS_DumpCallStack( |
@@ -1086,6 +1066,7 @@ gckOS_GetThreadID( | |||
1086 | OUT gctUINT32_PTR ThreadID | 1066 | OUT gctUINT32_PTR ThreadID |
1087 | ); | 1067 | ); |
1088 | 1068 | ||
1069 | |||
1089 | /******************************************************************************\ | 1070 | /******************************************************************************\ |
1090 | ********************************** Signal Object ********************************* | 1071 | ********************************** Signal Object ********************************* |
1091 | \******************************************************************************/ | 1072 | \******************************************************************************/ |
@@ -1609,6 +1590,7 @@ gckVIDMEM_AllocateLinear( | |||
1609 | IN gctSIZE_T Bytes, | 1590 | IN gctSIZE_T Bytes, |
1610 | IN gctUINT32 Alignment, | 1591 | IN gctUINT32 Alignment, |
1611 | IN gceSURF_TYPE Type, | 1592 | IN gceSURF_TYPE Type, |
1593 | IN gctBOOL Specified, | ||
1612 | OUT gcuVIDMEM_NODE_PTR * Node | 1594 | OUT gcuVIDMEM_NODE_PTR * Node |
1613 | ); | 1595 | ); |
1614 | 1596 | ||
@@ -1677,6 +1659,7 @@ typedef enum _gceKERNEL_FLUSH | |||
1677 | #if gcdMULTI_GPU | 1659 | #if gcdMULTI_GPU |
1678 | gcvFLUSH_L2 = 0x10, | 1660 | gcvFLUSH_L2 = 0x10, |
1679 | #endif | 1661 | #endif |
1662 | gcvFLUSH_TILE_STATUS = 0x20, | ||
1680 | gcvFLUSH_ALL = gcvFLUSH_COLOR | 1663 | gcvFLUSH_ALL = gcvFLUSH_COLOR |
1681 | | gcvFLUSH_DEPTH | 1664 | | gcvFLUSH_DEPTH |
1682 | | gcvFLUSH_TEXTURE | 1665 | | gcvFLUSH_TEXTURE |
@@ -1684,6 +1667,7 @@ typedef enum _gceKERNEL_FLUSH | |||
1684 | #if gcdMULTI_GPU | 1667 | #if gcdMULTI_GPU |
1685 | | gcvFLUSH_L2 | 1668 | | gcvFLUSH_L2 |
1686 | #endif | 1669 | #endif |
1670 | | gcvFLUSH_TILE_STATUS | ||
1687 | } | 1671 | } |
1688 | gceKERNEL_FLUSH; | 1672 | gceKERNEL_FLUSH; |
1689 | 1673 | ||
@@ -1732,7 +1716,7 @@ gckKERNEL_AllocateLinearMemory( | |||
1732 | IN gctUINT32 ProcessID, | 1716 | IN gctUINT32 ProcessID, |
1733 | IN OUT gcePOOL * Pool, | 1717 | IN OUT gcePOOL * Pool, |
1734 | IN gctSIZE_T Bytes, | 1718 | IN gctSIZE_T Bytes, |
1735 | IN gctSIZE_T Alignment, | 1719 | IN gctUINT32 Alignment, |
1736 | IN gceSURF_TYPE Type, | 1720 | IN gceSURF_TYPE Type, |
1737 | OUT gctUINT32 * Node | 1721 | OUT gctUINT32 * Node |
1738 | ); | 1722 | ); |
@@ -1949,9 +1933,9 @@ gckHARDWARE_BuildVirtualAddress( | |||
1949 | gceSTATUS | 1933 | gceSTATUS |
1950 | gckHARDWARE_QueryCommandBuffer( | 1934 | gckHARDWARE_QueryCommandBuffer( |
1951 | IN gckHARDWARE Hardware, | 1935 | IN gckHARDWARE Hardware, |
1952 | OUT gctSIZE_T * Alignment, | 1936 | OUT gctUINT32 * Alignment, |
1953 | OUT gctSIZE_T * ReservedHead, | 1937 | OUT gctUINT32 * ReservedHead, |
1954 | OUT gctSIZE_T * ReservedTail | 1938 | OUT gctUINT32 * ReservedTail |
1955 | ); | 1939 | ); |
1956 | 1940 | ||
1957 | /* Add a WAIT/LINK pair in the command queue. */ | 1941 | /* Add a WAIT/LINK pair in the command queue. */ |
@@ -1960,39 +1944,25 @@ gckHARDWARE_WaitLink( | |||
1960 | IN gckHARDWARE Hardware, | 1944 | IN gckHARDWARE Hardware, |
1961 | IN gctPOINTER Logical, | 1945 | IN gctPOINTER Logical, |
1962 | IN gctUINT32 Offset, | 1946 | IN gctUINT32 Offset, |
1963 | IN OUT gctSIZE_T * Bytes, | 1947 | IN OUT gctUINT32 * Bytes, |
1964 | OUT gctUINT32 * WaitOffset, | 1948 | OUT gctUINT32 * WaitOffset, |
1965 | OUT gctSIZE_T * WaitBytes | 1949 | OUT gctUINT32 * WaitBytes |
1966 | ); | 1950 | ); |
1967 | 1951 | ||
1968 | /* Kickstart the command processor. */ | 1952 | /* Kickstart the command processor. */ |
1969 | gceSTATUS | 1953 | gceSTATUS |
1970 | gckHARDWARE_Execute( | 1954 | gckHARDWARE_Execute( |
1971 | IN gckHARDWARE Hardware, | 1955 | IN gckHARDWARE Hardware, |
1972 | IN gctPOINTER Logical, | 1956 | IN gctUINT32 Address, |
1973 | #ifdef __QNXNTO__ | ||
1974 | IN gctPOINTER Physical, | ||
1975 | IN gctBOOL PhysicalAddresses, | ||
1976 | #endif | ||
1977 | IN gctSIZE_T Bytes | ||
1978 | ); | ||
1979 | |||
1980 | #if gcdPROCESS_ADDRESS_SPACE | ||
1981 | /* Kickstart the command processor with GPU adddress. */ | ||
1982 | gceSTATUS | ||
1983 | gckHARDWARE_ExecutePhysical( | ||
1984 | IN gckHARDWARE Hardware, | ||
1985 | IN gctUINT32 Physical, | ||
1986 | IN gctSIZE_T Bytes | 1957 | IN gctSIZE_T Bytes |
1987 | ); | 1958 | ); |
1988 | #endif | ||
1989 | 1959 | ||
1990 | /* Add an END command in the command queue. */ | 1960 | /* Add an END command in the command queue. */ |
1991 | gceSTATUS | 1961 | gceSTATUS |
1992 | gckHARDWARE_End( | 1962 | gckHARDWARE_End( |
1993 | IN gckHARDWARE Hardware, | 1963 | IN gckHARDWARE Hardware, |
1994 | IN gctPOINTER Logical, | 1964 | IN gctPOINTER Logical, |
1995 | IN OUT gctSIZE_T * Bytes | 1965 | IN OUT gctUINT32 * Bytes |
1996 | ); | 1966 | ); |
1997 | 1967 | ||
1998 | #if gcdMULTI_GPU | 1968 | #if gcdMULTI_GPU |
@@ -2013,22 +1983,13 @@ gckHARDWARE_Nop( | |||
2013 | IN OUT gctSIZE_T * Bytes | 1983 | IN OUT gctSIZE_T * Bytes |
2014 | ); | 1984 | ); |
2015 | 1985 | ||
2016 | /* Add a WAIT command in the command queue. */ | ||
2017 | gceSTATUS | ||
2018 | gckHARDWARE_Wait( | ||
2019 | IN gckHARDWARE Hardware, | ||
2020 | IN gctPOINTER Logical, | ||
2021 | IN gctUINT32 Count, | ||
2022 | IN OUT gctSIZE_T * Bytes | ||
2023 | ); | ||
2024 | |||
2025 | /* Add a PIPESELECT command in the command queue. */ | 1986 | /* Add a PIPESELECT command in the command queue. */ |
2026 | gceSTATUS | 1987 | gceSTATUS |
2027 | gckHARDWARE_PipeSelect( | 1988 | gckHARDWARE_PipeSelect( |
2028 | IN gckHARDWARE Hardware, | 1989 | IN gckHARDWARE Hardware, |
2029 | IN gctPOINTER Logical, | 1990 | IN gctPOINTER Logical, |
2030 | IN gcePIPE_SELECT Pipe, | 1991 | IN gcePIPE_SELECT Pipe, |
2031 | IN OUT gctSIZE_T * Bytes | 1992 | IN OUT gctUINT32 * Bytes |
2032 | ); | 1993 | ); |
2033 | 1994 | ||
2034 | /* Add a LINK command in the command queue. */ | 1995 | /* Add a LINK command in the command queue. */ |
@@ -2036,9 +1997,9 @@ gceSTATUS | |||
2036 | gckHARDWARE_Link( | 1997 | gckHARDWARE_Link( |
2037 | IN gckHARDWARE Hardware, | 1998 | IN gckHARDWARE Hardware, |
2038 | IN gctPOINTER Logical, | 1999 | IN gctPOINTER Logical, |
2039 | IN gctPOINTER FetchAddress, | 2000 | IN gctUINT32 FetchAddress, |
2040 | IN gctSIZE_T FetchSize, | 2001 | IN gctUINT32 FetchSize, |
2041 | IN OUT gctSIZE_T * Bytes | 2002 | IN OUT gctUINT32 * Bytes |
2042 | ); | 2003 | ); |
2043 | 2004 | ||
2044 | /* Add an EVENT command in the command queue. */ | 2005 | /* Add an EVENT command in the command queue. */ |
@@ -2048,7 +2009,7 @@ gckHARDWARE_Event( | |||
2048 | IN gctPOINTER Logical, | 2009 | IN gctPOINTER Logical, |
2049 | IN gctUINT8 Event, | 2010 | IN gctUINT8 Event, |
2050 | IN gceKERNEL_WHERE FromWhere, | 2011 | IN gceKERNEL_WHERE FromWhere, |
2051 | IN OUT gctSIZE_T * Bytes | 2012 | IN OUT gctUINT32 * Bytes |
2052 | ); | 2013 | ); |
2053 | 2014 | ||
2054 | /* Query the available memory. */ | 2015 | /* Query the available memory. */ |
@@ -2103,19 +2064,10 @@ gceSTATUS | |||
2103 | gckHARDWARE_ConvertLogical( | 2064 | gckHARDWARE_ConvertLogical( |
2104 | IN gckHARDWARE Hardware, | 2065 | IN gckHARDWARE Hardware, |
2105 | IN gctPOINTER Logical, | 2066 | IN gctPOINTER Logical, |
2067 | IN gctBOOL InUserSpace, | ||
2106 | OUT gctUINT32 * Address | 2068 | OUT gctUINT32 * Address |
2107 | ); | 2069 | ); |
2108 | 2070 | ||
2109 | #ifdef __QNXNTO__ | ||
2110 | /* Convert physical address to hardware specific address. */ | ||
2111 | gceSTATUS | ||
2112 | gckHARDWARE_ConvertPhysical( | ||
2113 | IN gckHARDWARE Hardware, | ||
2114 | IN gctPHYS_ADDR Physical, | ||
2115 | OUT gctUINT32 * Address | ||
2116 | ); | ||
2117 | #endif | ||
2118 | |||
2119 | /* Interrupt manager. */ | 2071 | /* Interrupt manager. */ |
2120 | gceSTATUS | 2072 | gceSTATUS |
2121 | gckHARDWARE_Interrupt( | 2073 | gckHARDWARE_Interrupt( |
@@ -2178,7 +2130,7 @@ gckHARDWARE_Flush( | |||
2178 | IN gckHARDWARE Hardware, | 2130 | IN gckHARDWARE Hardware, |
2179 | IN gceKERNEL_FLUSH Flush, | 2131 | IN gceKERNEL_FLUSH Flush, |
2180 | IN gctPOINTER Logical, | 2132 | IN gctPOINTER Logical, |
2181 | IN OUT gctSIZE_T * Bytes | 2133 | IN OUT gctUINT32 * Bytes |
2182 | ); | 2134 | ); |
2183 | 2135 | ||
2184 | /* Enable/disable fast clear. */ | 2136 | /* Enable/disable fast clear. */ |
@@ -2378,6 +2330,16 @@ gckEVENT_Destroy( | |||
2378 | ); | 2330 | ); |
2379 | 2331 | ||
2380 | /* Reserve the next available hardware event. */ | 2332 | /* Reserve the next available hardware event. */ |
2333 | #if gcdMULTI_GPU | ||
2334 | gceSTATUS | ||
2335 | gckEVENT_GetEvent( | ||
2336 | IN gckEVENT Event, | ||
2337 | IN gctBOOL Wait, | ||
2338 | OUT gctUINT8 * EventID, | ||
2339 | IN gceKERNEL_WHERE Source, | ||
2340 | IN gceCORE_3D_MASK ChipEnable | ||
2341 | ); | ||
2342 | #else | ||
2381 | gceSTATUS | 2343 | gceSTATUS |
2382 | gckEVENT_GetEvent( | 2344 | gckEVENT_GetEvent( |
2383 | IN gckEVENT Event, | 2345 | IN gckEVENT Event, |
@@ -2385,6 +2347,7 @@ gckEVENT_GetEvent( | |||
2385 | OUT gctUINT8 * EventID, | 2347 | OUT gctUINT8 * EventID, |
2386 | IN gceKERNEL_WHERE Source | 2348 | IN gceKERNEL_WHERE Source |
2387 | ); | 2349 | ); |
2350 | #endif | ||
2388 | 2351 | ||
2389 | /* Add a new event to the list of events. */ | 2352 | /* Add a new event to the list of events. */ |
2390 | gceSTATUS | 2353 | gceSTATUS |
@@ -2591,16 +2554,16 @@ gckCOMMAND_Commit( | |||
2591 | gceSTATUS | 2554 | gceSTATUS |
2592 | gckCOMMAND_Reserve( | 2555 | gckCOMMAND_Reserve( |
2593 | IN gckCOMMAND Command, | 2556 | IN gckCOMMAND Command, |
2594 | IN gctSIZE_T RequestedBytes, | 2557 | IN gctUINT32 RequestedBytes, |
2595 | OUT gctPOINTER * Buffer, | 2558 | OUT gctPOINTER * Buffer, |
2596 | OUT gctSIZE_T * BufferSize | 2559 | OUT gctUINT32 * BufferSize |
2597 | ); | 2560 | ); |
2598 | 2561 | ||
2599 | /* Execute reserved space in the command buffer. */ | 2562 | /* Execute reserved space in the command buffer. */ |
2600 | gceSTATUS | 2563 | gceSTATUS |
2601 | gckCOMMAND_Execute( | 2564 | gckCOMMAND_Execute( |
2602 | IN gckCOMMAND Command, | 2565 | IN gckCOMMAND Command, |
2603 | IN gctSIZE_T RequstedBytes | 2566 | IN gctUINT32 RequstedBytes |
2604 | ); | 2567 | ); |
2605 | 2568 | ||
2606 | /* Stall the command queue. */ | 2569 | /* Stall the command queue. */ |
@@ -2645,7 +2608,7 @@ gckCOMMAND_DumpExecutingBuffer( | |||
2645 | gceSTATUS | 2608 | gceSTATUS |
2646 | gckCOMMAND_AddressInKernelCommandBuffer( | 2609 | gckCOMMAND_AddressInKernelCommandBuffer( |
2647 | IN gckCOMMAND Command, | 2610 | IN gckCOMMAND Command, |
2648 | IN gctPOINTER Logical, | 2611 | IN gctUINT32 Address, |
2649 | OUT gctBOOL *In | 2612 | OUT gctBOOL *In |
2650 | ); | 2613 | ); |
2651 | 2614 | ||
@@ -2713,7 +2676,8 @@ gckMMU_SetPage( | |||
2713 | 2676 | ||
2714 | gceSTATUS | 2677 | gceSTATUS |
2715 | gckMMU_Flush( | 2678 | gckMMU_Flush( |
2716 | IN gckMMU Mmu | 2679 | IN gckMMU Mmu, |
2680 | IN gceSURF_TYPE Type | ||
2717 | ); | 2681 | ); |
2718 | 2682 | ||
2719 | gceSTATUS | 2683 | gceSTATUS |
@@ -2748,6 +2712,13 @@ gckHARDWARE_UpdateContextProfile( | |||
2748 | ); | 2712 | ); |
2749 | #endif | 2713 | #endif |
2750 | 2714 | ||
2715 | #if VIVANTE_PROFILER_NEW | ||
2716 | gceSTATUS | ||
2717 | gckHARDWARE_InitProfiler( | ||
2718 | IN gckHARDWARE Hardware | ||
2719 | ); | ||
2720 | #endif | ||
2721 | |||
2751 | gceSTATUS | 2722 | gceSTATUS |
2752 | gckOS_SignalQueryHardware( | 2723 | gckOS_SignalQueryHardware( |
2753 | IN gckOS Os, | 2724 | IN gckOS Os, |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h index 8adfd3d5a2f7..ffeac7e40b44 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h | |||
@@ -19,7 +19,6 @@ | |||
19 | *****************************************************************************/ | 19 | *****************************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | |||
23 | #ifndef __gc_hal_base_h_ | 22 | #ifndef __gc_hal_base_h_ |
24 | #define __gc_hal_base_h_ | 23 | #define __gc_hal_base_h_ |
25 | 24 | ||
@@ -81,6 +80,91 @@ typedef struct _gcoOS_SymbolsList gcoOS_SymbolsList; | |||
81 | 80 | ||
82 | typedef struct _gcsPLS * gcsPLS_PTR; | 81 | typedef struct _gcsPLS * gcsPLS_PTR; |
83 | 82 | ||
83 | #ifndef VIVANTE_NO_3D | ||
84 | /****************************************************************************** | ||
85 | ** | ||
86 | ** Patch defines which should be moved to dedicate file later | ||
87 | ** | ||
88 | ** !!! ALWAYS ADD new ID in the TAIL, otherwise will break exising TRACE FILE | ||
89 | *******************************************************************************/ | ||
90 | typedef enum _gcePATCH_ID | ||
91 | { | ||
92 | gcvPATCH_INVALID = 0, | ||
93 | |||
94 | #if gcdDEBUG_OPTION | ||
95 | gcvPATCH_DEBUG, | ||
96 | #endif | ||
97 | |||
98 | gcvPATCH_GTFES30, | ||
99 | gcvPATCH_CTGL11, | ||
100 | gcvPATCH_CTGL20, | ||
101 | gcvPATCH_GLBM11, | ||
102 | gcvPATCH_GLBM21, | ||
103 | gcvPATCH_GLBM25, | ||
104 | gcvPATCH_GLBM27, | ||
105 | gcvPATCH_GLBMGUI, | ||
106 | gcvPATCH_GFXBENCH, | ||
107 | gcvPATCH_ANTUTU, /* Antutu 3.x */ | ||
108 | gcvPATCH_ANTUTU4X, /* Antutu 4.x */ | ||
109 | gcvPATCH_QUADRANT, | ||
110 | gcvPATCH_GPUBENCH, | ||
111 | gcvPATCH_DUOKAN, | ||
112 | gcvPATCH_GLOFTSXHM, | ||
113 | gcvPATCH_XRUNNER, | ||
114 | gcvPATCH_BUSPARKING3D, | ||
115 | gcvPATCH_SIEGECRAFT, | ||
116 | gcvPATCH_PREMIUM, | ||
117 | gcvPATCH_RACEILLEGAL, | ||
118 | gcvPATCH_MEGARUN, | ||
119 | gcvPATCH_BMGUI, | ||
120 | gcvPATCH_NENAMARK, | ||
121 | gcvPATCH_NENAMARK2, | ||
122 | gcvPATCH_FISHNOODLE, | ||
123 | gcvPATCH_MM06, | ||
124 | gcvPATCH_MM07, | ||
125 | gcvPATCH_BM21, | ||
126 | gcvPATCH_SMARTBENCH, | ||
127 | gcvPATCH_JPCT, | ||
128 | gcvPATCH_NEOCORE, | ||
129 | gcvPATCH_RTESTVA, | ||
130 | gcvPATCH_NBA2013, | ||
131 | gcvPATCH_BARDTALE, | ||
132 | gcvPATCH_F18, | ||
133 | gcvPATCH_CARPARK, | ||
134 | gcvPATCH_CARCHALLENGE, | ||
135 | gcvPATCH_HEROESCALL, | ||
136 | gcvPATCH_GLOFTF3HM, | ||
137 | gcvPATCH_CRAZYRACING, | ||
138 | gcvPATCH_FIREFOX, | ||
139 | gcvPATCH_CHROME, | ||
140 | gcvPATCH_MONOPOLY, | ||
141 | gcvPATCH_SNOWCOLD, | ||
142 | gcvPATCH_BM3, | ||
143 | gcvPATCH_BASEMARKX, | ||
144 | gcvPATCH_DEQP, | ||
145 | gcvPATCH_SF4, | ||
146 | gcePATCH_MGOHEAVEN2, | ||
147 | gcePATCH_SILIBILI, | ||
148 | gcePATCH_ELEMENTSDEF, | ||
149 | gcePATCH_GLOFTKRHM, | ||
150 | gcvPATCH_OCLCTS, | ||
151 | gcvPATCH_A8HP, | ||
152 | gcvPATCH_WISTONESG, | ||
153 | gcvPATCH_SPEEDRACE, | ||
154 | gcvPATCH_FSBHAWAIIF, | ||
155 | gcvPATCH_AIRNAVY, | ||
156 | gcvPATCH_F18NEW, | ||
157 | gcvPATCH_CKZOMBIES2, | ||
158 | gcvPATCH_EADGKEEPER, | ||
159 | gcvPATCH_BASEMARK2V2, | ||
160 | gcvPATCH_RIPTIDEGP2, | ||
161 | gcvPATCH_OESCTS, | ||
162 | gcvPATCH_GANGSTAR, | ||
163 | |||
164 | gcvPATCH_COUNT | ||
165 | } gcePATCH_ID; | ||
166 | #endif /* VIVANTE_NO_3D */ | ||
167 | |||
84 | typedef void (* gctPLS_DESTRUCTOR) ( | 168 | typedef void (* gctPLS_DESTRUCTOR) ( |
85 | gcsPLS_PTR | 169 | gcsPLS_PTR |
86 | ); | 170 | ); |
@@ -129,11 +213,42 @@ typedef struct _gcsPLS | |||
129 | ** We can use this mutex for every PLS access. | 213 | ** We can use this mutex for every PLS access. |
130 | */ | 214 | */ |
131 | gctPOINTER accessLock; | 215 | gctPOINTER accessLock; |
216 | #ifndef VIVANTE_NO_3D | ||
217 | /* Global patchID to overwrite the detection */ | ||
218 | gcePATCH_ID patchID; | ||
219 | #endif | ||
132 | } | 220 | } |
133 | gcsPLS; | 221 | gcsPLS; |
134 | 222 | ||
135 | extern gcsPLS gcPLS; | 223 | extern gcsPLS gcPLS; |
136 | 224 | ||
225 | #ifndef VIVANTE_NO_3D | ||
226 | #define gcPLS_INITIALIZER \ | ||
227 | { \ | ||
228 | gcvNULL, /* gcoOS object. */ \ | ||
229 | gcvNULL, /* gcoHAL object. */ \ | ||
230 | 0, /* internalSize */ \ | ||
231 | gcvNULL, /* internalPhysical */ \ | ||
232 | gcvNULL, /* internalLogical */ \ | ||
233 | 0, /* externalSize */ \ | ||
234 | gcvNULL, /* externalPhysical */ \ | ||
235 | gcvNULL, /* externalLogical */ \ | ||
236 | 0, /* contiguousSize */ \ | ||
237 | gcvNULL, /* contiguousPhysical */ \ | ||
238 | gcvNULL, /* contiguousLogical */ \ | ||
239 | gcvNULL, /* eglDisplayInfo */ \ | ||
240 | gcvNULL, /* eglSurfaceInfo */ \ | ||
241 | gcvSURF_A8R8G8B8,/* eglConfigFormat */ \ | ||
242 | gcvNULL, /* reference */ \ | ||
243 | 0, /* processID */ \ | ||
244 | 0, /* threadID */ \ | ||
245 | gcvFALSE, /* exiting */ \ | ||
246 | gcvFALSE, /* Special flag for NP2 texture. */ \ | ||
247 | gcvNULL, /* destructor */ \ | ||
248 | gcvNULL, /* accessLock */ \ | ||
249 | gcvPATCH_INVALID,/* global patchID */ \ | ||
250 | } | ||
251 | #else | ||
137 | #define gcPLS_INITIALIZER \ | 252 | #define gcPLS_INITIALIZER \ |
138 | { \ | 253 | { \ |
139 | gcvNULL, /* gcoOS object. */ \ | 254 | gcvNULL, /* gcoOS object. */ \ |
@@ -157,7 +272,8 @@ extern gcsPLS gcPLS; | |||
157 | gcvFALSE, /* Special flag for NP2 texture. */ \ | 272 | gcvFALSE, /* Special flag for NP2 texture. */ \ |
158 | gcvNULL, /* destructor */ \ | 273 | gcvNULL, /* destructor */ \ |
159 | gcvNULL, /* accessLock */ \ | 274 | gcvNULL, /* accessLock */ \ |
160 | } \ | 275 | } |
276 | #endif | ||
161 | 277 | ||
162 | /******************************************************************************\ | 278 | /******************************************************************************\ |
163 | ******************************* Thread local storage ************************* | 279 | ******************************* Thread local storage ************************* |
@@ -315,86 +431,6 @@ typedef enum _gceSignalHandlerType | |||
315 | gceSignalHandlerType; | 431 | gceSignalHandlerType; |
316 | 432 | ||
317 | 433 | ||
318 | |||
319 | /********************************************************************** | ||
320 | ** | ||
321 | ** Patch defines which should be moved to dedicate file later | ||
322 | ** | ||
323 | **********************************************************************/ | ||
324 | |||
325 | typedef enum _gcePATCH_ID | ||
326 | { | ||
327 | gcvPATCH_INVALID = 0, | ||
328 | |||
329 | #if gcdDEBUG_OPTION | ||
330 | gcvPATCH_DEBUG, | ||
331 | #endif | ||
332 | |||
333 | gcvPATCH_GTFES30, | ||
334 | gcvPATCH_CTGL11, | ||
335 | gcvPATCH_CTGL20, | ||
336 | gcvPATCH_GLBM11, | ||
337 | gcvPATCH_GLBM21, | ||
338 | gcvPATCH_GLBM25, | ||
339 | gcvPATCH_GLBM27, | ||
340 | gcvPATCH_GLBMGUI, | ||
341 | gcvPATCH_GFXBENCH, | ||
342 | gcvPATCH_ANTUTU, /* Antutu 3.x */ | ||
343 | gcvPATCH_ANTUTU4X, /* Antutu 4.x */ | ||
344 | gcvPATCH_QUADRANT, | ||
345 | gcvPATCH_GPUBENCH, | ||
346 | gcvPATCH_DUOKAN, | ||
347 | gcvPATCH_GLOFTSXHM, | ||
348 | gcvPATCH_XRUNNER, | ||
349 | gcvPATCH_BUSPARKING3D, | ||
350 | gcvPATCH_SIEGECRAFT, | ||
351 | gcvPATCH_PREMIUM, | ||
352 | gcvPATCH_RACEILLEGAL, | ||
353 | gcvPATCH_MEGARUN, | ||
354 | gcvPATCH_BMGUI, | ||
355 | gcvPATCH_NENAMARK, | ||
356 | gcvPATCH_NENAMARK2, | ||
357 | gcvPATCH_FISHNOODLE, | ||
358 | gcvPATCH_MM06, | ||
359 | gcvPATCH_MM07, | ||
360 | gcvPATCH_BM21, | ||
361 | gcvPATCH_SMARTBENCH, | ||
362 | gcvPATCH_JPCT, | ||
363 | gcvPATCH_NEOCORE, | ||
364 | gcvPATCH_RTESTVA, | ||
365 | gcvPATCH_NBA2013, | ||
366 | gcvPATCH_BARDTALE, | ||
367 | gcvPATCH_F18, | ||
368 | gcvPATCH_CARPARK, | ||
369 | gcvPATCH_CARCHALLENGE, | ||
370 | gcvPATCH_HEROESCALL, | ||
371 | gcvPATCH_GLOFTF3HM, | ||
372 | gcvPATCH_CRAZYRACING, | ||
373 | gcvPATCH_FIREFOX, | ||
374 | gcvPATCH_CHROME, | ||
375 | gcvPATCH_MONOPOLY, | ||
376 | gcvPATCH_SNOWCOLD, | ||
377 | gcvPATCH_BM3, | ||
378 | gcvPATCH_BASEMARKX, | ||
379 | gcvPATCH_DEQP, | ||
380 | gcvPATCH_SF4, | ||
381 | gcePATCH_MGOHEAVEN2, | ||
382 | gcePATCH_SILIBILI, | ||
383 | gcePATCH_ELEMENTSDEF, | ||
384 | gcePATCH_GLOFTKRHM, | ||
385 | gcvPATCH_OCLCTS, | ||
386 | gcvPATCH_A8HP, | ||
387 | gcvPATCH_WISTONESG, | ||
388 | gcvPATCH_SPEEDRACE, | ||
389 | gcvPATCH_FSBHAWAIIF, | ||
390 | gcvPATCH_GOOGLEMAP, | ||
391 | gcvPATCH_GOOGLEPLUS, | ||
392 | |||
393 | gcvPATCH_COUNT | ||
394 | } gcePATCH_ID; | ||
395 | |||
396 | |||
397 | |||
398 | #if gcdENABLE_VG | 434 | #if gcdENABLE_VG |
399 | /* gcsHAL_Limits*/ | 435 | /* gcsHAL_Limits*/ |
400 | typedef struct _gcsHAL_LIMITS | 436 | typedef struct _gcsHAL_LIMITS |
@@ -522,11 +558,13 @@ gcoHAL_Get2DEngine( | |||
522 | OUT gco2D * Engine | 558 | OUT gco2D * Engine |
523 | ); | 559 | ); |
524 | 560 | ||
561 | #ifndef VIVANTE_NO_3D | ||
525 | gceSTATUS | 562 | gceSTATUS |
526 | gcoHAL_GetSpecialHintData( | 563 | gcoHAL_GetSpecialHintData( |
527 | IN gcoHAL Hal, | 564 | IN gcoHAL Hal, |
528 | OUT gctINT * Hint | 565 | OUT gctINT * Hint |
529 | ); | 566 | ); |
567 | #endif | ||
530 | 568 | ||
531 | gceSTATUS | 569 | gceSTATUS |
532 | gcoHAL_GetHardware( | 570 | gcoHAL_GetHardware( |
@@ -748,6 +786,13 @@ gcoHAL_GetDump( | |||
748 | OUT gcoDUMP * Dump | 786 | OUT gcoDUMP * Dump |
749 | ); | 787 | ); |
750 | 788 | ||
789 | #ifndef VIVANTE_NO_3D | ||
790 | gceSTATUS | ||
791 | gcoHAL_SetPatchID( | ||
792 | IN gcoHAL Hal, | ||
793 | IN gcePATCH_ID PatchID | ||
794 | ); | ||
795 | |||
751 | /* Get Patch ID based on process name */ | 796 | /* Get Patch ID based on process name */ |
752 | gceSTATUS | 797 | gceSTATUS |
753 | gcoHAL_GetPatchID( | 798 | gcoHAL_GetPatchID( |
@@ -755,6 +800,12 @@ gcoHAL_GetPatchID( | |||
755 | OUT gcePATCH_ID * PatchID | 800 | OUT gcePATCH_ID * PatchID |
756 | ); | 801 | ); |
757 | 802 | ||
803 | gceSTATUS | ||
804 | gcoHAL_SetGlobalPatchID( | ||
805 | IN gcoHAL Hal, | ||
806 | IN gcePATCH_ID PatchID | ||
807 | ); | ||
808 | #endif /* VIVANTE_NO_3D */ | ||
758 | /* Call the kernel HAL layer. */ | 809 | /* Call the kernel HAL layer. */ |
759 | gceSTATUS | 810 | gceSTATUS |
760 | gcoHAL_Call( | 811 | gcoHAL_Call( |
@@ -824,7 +875,12 @@ gcoHAL_Query3DCoreCount( | |||
824 | ); | 875 | ); |
825 | 876 | ||
826 | gceSTATUS | 877 | gceSTATUS |
827 | gcoHAL_QuerySeparated3D2D( | 878 | gcoHAL_QuerySeparated2D( |
879 | IN gcoHAL Hal | ||
880 | ); | ||
881 | |||
882 | gceSTATUS | ||
883 | gcoHAL_Is3DAvailable( | ||
828 | IN gcoHAL Hal | 884 | IN gcoHAL Hal |
829 | ); | 885 | ); |
830 | 886 | ||
@@ -950,13 +1006,6 @@ gcoOS_FreeSharedMemory( | |||
950 | IN gctPOINTER Memory | 1006 | IN gctPOINTER Memory |
951 | ); | 1007 | ); |
952 | 1008 | ||
953 | /* Schedule to free memory. */ | ||
954 | gceSTATUS | ||
955 | gcoOS_ScheduleSharedMemory( | ||
956 | IN gcoOS Os, | ||
957 | IN gctPOINTER Memory | ||
958 | ); | ||
959 | |||
960 | /* Allocate memory. */ | 1009 | /* Allocate memory. */ |
961 | gceSTATUS | 1010 | gceSTATUS |
962 | gcoOS_AllocateMemory( | 1011 | gcoOS_AllocateMemory( |
@@ -2174,7 +2223,7 @@ gcoSURF_QueryVidMemNode( | |||
2174 | IN gcoSURF Surface, | 2223 | IN gcoSURF Surface, |
2175 | OUT gctUINT32 * Node, | 2224 | OUT gctUINT32 * Node, |
2176 | OUT gcePOOL * Pool, | 2225 | OUT gcePOOL * Pool, |
2177 | OUT gctUINT_PTR Bytes | 2226 | OUT gctSIZE_T_PTR Bytes |
2178 | ); | 2227 | ); |
2179 | 2228 | ||
2180 | /* Set the color type of the surface. */ | 2229 | /* Set the color type of the surface. */ |
@@ -2359,7 +2408,7 @@ gcoSURF_Unlock( | |||
2359 | gceSTATUS | 2408 | gceSTATUS |
2360 | gcoSURF_QueryFlags( | 2409 | gcoSURF_QueryFlags( |
2361 | IN gcoSURF Surface, | 2410 | IN gcoSURF Surface, |
2362 | IN gctUINT Flag | 2411 | IN gceSURF_FLAG Flag |
2363 | ); | 2412 | ); |
2364 | 2413 | ||
2365 | /* Return pixel format parameters; Info is required to be a pointer to an | 2414 | /* Return pixel format parameters; Info is required to be a pointer to an |
@@ -2418,11 +2467,11 @@ gcoSURF_ConstructWrapper( | |||
2418 | OUT gcoSURF * Surface | 2467 | OUT gcoSURF * Surface |
2419 | ); | 2468 | ); |
2420 | 2469 | ||
2421 | /*. Query surface flags.*/ | 2470 | /* Set surface flags.*/ |
2422 | gceSTATUS | 2471 | gceSTATUS |
2423 | gcoSURF_SetFlags( | 2472 | gcoSURF_SetFlags( |
2424 | IN gcoSURF Surface, | 2473 | IN gcoSURF Surface, |
2425 | IN gctUINT Flag, | 2474 | IN gceSURF_FLAG Flag, |
2426 | IN gctBOOL Value | 2475 | IN gctBOOL Value |
2427 | ); | 2476 | ); |
2428 | 2477 | ||
@@ -2498,7 +2547,7 @@ gcoSURF_QueryOrientation( | |||
2498 | gceSTATUS | 2547 | gceSTATUS |
2499 | gcoSURF_SetOffset( | 2548 | gcoSURF_SetOffset( |
2500 | IN gcoSURF Surface, | 2549 | IN gcoSURF Surface, |
2501 | IN gctUINT Offset | 2550 | IN gctSIZE_T Offset |
2502 | ); | 2551 | ); |
2503 | 2552 | ||
2504 | gceSTATUS | 2553 | gceSTATUS |
@@ -2528,7 +2577,7 @@ gceSTATUS | |||
2528 | gcoSURF_NODE_CPUCacheOperation( | 2577 | gcoSURF_NODE_CPUCacheOperation( |
2529 | IN gcsSURF_NODE_PTR Node, | 2578 | IN gcsSURF_NODE_PTR Node, |
2530 | IN gceSURF_TYPE Type, | 2579 | IN gceSURF_TYPE Type, |
2531 | IN gctUINT32 Offset, | 2580 | IN gctSIZE_T Offset, |
2532 | IN gctSIZE_T Length, | 2581 | IN gctSIZE_T Length, |
2533 | IN gceCACHEOPERATION Operation | 2582 | IN gceCACHEOPERATION Operation |
2534 | ); | 2583 | ); |
@@ -2823,6 +2872,15 @@ gcoOS_ReplaceDebugFile( | |||
2823 | IN gctFILE fp | 2872 | IN gctFILE fp |
2824 | ); | 2873 | ); |
2825 | 2874 | ||
2875 | void | ||
2876 | gcoOS_SysTraceBegin( | ||
2877 | IN gctCONST_STRING FuncName | ||
2878 | ); | ||
2879 | |||
2880 | void | ||
2881 | gcoOS_SysTraceEnd( | ||
2882 | IN void); | ||
2883 | |||
2826 | /******************************************************************************* | 2884 | /******************************************************************************* |
2827 | ** | 2885 | ** |
2828 | ** gcmFATAL | 2886 | ** gcmFATAL |
@@ -3205,6 +3263,9 @@ gcsBINARY_TRACE_MESSAGE; | |||
3205 | 3263 | ||
3206 | #define gcdHEADER_LEVEL gcvLEVEL_VERBOSE | 3264 | #define gcdHEADER_LEVEL gcvLEVEL_VERBOSE |
3207 | 3265 | ||
3266 | #ifndef gcdEMPTY_HEADER_FOOTER | ||
3267 | #define gcdEMPTY_HEADER_FOOTER 0 | ||
3268 | #endif | ||
3208 | 3269 | ||
3209 | #if gcdENABLE_PROFILING | 3270 | #if gcdENABLE_PROFILING |
3210 | void | 3271 | void |
@@ -3240,6 +3301,8 @@ gcoOS_ProfileDB( | |||
3240 | 3301 | ||
3241 | #ifdef gcdFSL_REL_BUILD | 3302 | #ifdef gcdFSL_REL_BUILD |
3242 | #define gcmHEADER() | 3303 | #define gcmHEADER() |
3304 | #elif gcdEMPTY_HEADER_FOOTER | ||
3305 | # define gcmHEADER() | ||
3243 | #elif gcdHAS_ELLIPSIS | 3306 | #elif gcdHAS_ELLIPSIS |
3244 | #define gcmHEADER() \ | 3307 | #define gcmHEADER() \ |
3245 | gctINT8 __user__ = 1; \ | 3308 | gctINT8 __user__ = 1; \ |
@@ -3259,6 +3322,9 @@ gcoOS_ProfileDB( | |||
3259 | #ifdef gcdFSL_REL_BUILD | 3322 | #ifdef gcdFSL_REL_BUILD |
3260 | #define gcmHEADER_ARG(Text, ...) | 3323 | #define gcmHEADER_ARG(Text, ...) |
3261 | #elif gcdHAS_ELLIPSIS | 3324 | #elif gcdHAS_ELLIPSIS |
3325 | #if gcdEMPTY_HEADER_FOOTER | ||
3326 | # define gcmHEADER_ARG(Text, ...) | ||
3327 | #else | ||
3262 | # define gcmHEADER_ARG(Text, ...) \ | 3328 | # define gcmHEADER_ARG(Text, ...) \ |
3263 | gctINT8 __user__ = 1; \ | 3329 | gctINT8 __user__ = 1; \ |
3264 | gctINT8_PTR __user_ptr__ = &__user__; \ | 3330 | gctINT8_PTR __user_ptr__ = &__user__; \ |
@@ -3266,6 +3332,7 @@ gcoOS_ProfileDB( | |||
3266 | gcmBINARY_TRACE(__FUNCTION__, __LINE__, Text, __VA_ARGS__); \ | 3332 | gcmBINARY_TRACE(__FUNCTION__, __LINE__, Text, __VA_ARGS__); \ |
3267 | gcmTRACE_ZONE(gcdHEADER_LEVEL, _GC_OBJ_ZONE, \ | 3333 | gcmTRACE_ZONE(gcdHEADER_LEVEL, _GC_OBJ_ZONE, \ |
3268 | "++%s(%d): " Text, __FUNCTION__, __LINE__, __VA_ARGS__) | 3334 | "++%s(%d): " Text, __FUNCTION__, __LINE__, __VA_ARGS__) |
3335 | #endif | ||
3269 | #else | 3336 | #else |
3270 | gcmINLINE static void | 3337 | gcmINLINE static void |
3271 | __dummy_header_arg( | 3338 | __dummy_header_arg( |
@@ -3279,6 +3346,8 @@ gcoOS_ProfileDB( | |||
3279 | 3346 | ||
3280 | #ifdef gcdFSL_REL_BUILD | 3347 | #ifdef gcdFSL_REL_BUILD |
3281 | # define gcmFOOTER() | 3348 | # define gcmFOOTER() |
3349 | #elif gcdEMPTY_HEADER_FOOTER | ||
3350 | # define gcmFOOTER() | ||
3282 | #elif gcdHAS_ELLIPSIS | 3351 | #elif gcdHAS_ELLIPSIS |
3283 | # define gcmFOOTER() \ | 3352 | # define gcmFOOTER() \ |
3284 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ | 3353 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ |
@@ -3298,6 +3367,8 @@ gcoOS_ProfileDB( | |||
3298 | 3367 | ||
3299 | #ifdef gcdFSL_REL_BUILD | 3368 | #ifdef gcdFSL_REL_BUILD |
3300 | #define gcmFOOTER_NO() | 3369 | #define gcmFOOTER_NO() |
3370 | #elif gcdEMPTY_HEADER_FOOTER | ||
3371 | # define gcmFOOTER_NO() | ||
3301 | #elif gcdHAS_ELLIPSIS | 3372 | #elif gcdHAS_ELLIPSIS |
3302 | #define gcmFOOTER_NO() \ | 3373 | #define gcmFOOTER_NO() \ |
3303 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ | 3374 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ |
@@ -3315,6 +3386,8 @@ gcoOS_ProfileDB( | |||
3315 | 3386 | ||
3316 | #ifdef gcdFSL_REL_BUILD | 3387 | #ifdef gcdFSL_REL_BUILD |
3317 | #define gcmFOOTER_KILL() | 3388 | #define gcmFOOTER_KILL() |
3389 | #elif gcdEMPTY_HEADER_FOOTER | ||
3390 | # define gcmFOOTER_KILL() | ||
3318 | #elif gcdHAS_ELLIPSIS | 3391 | #elif gcdHAS_ELLIPSIS |
3319 | #define gcmFOOTER_KILL() \ | 3392 | #define gcmFOOTER_KILL() \ |
3320 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ | 3393 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ |
@@ -3333,12 +3406,16 @@ gcoOS_ProfileDB( | |||
3333 | #ifdef gcdFSL_REL_BUILD | 3406 | #ifdef gcdFSL_REL_BUILD |
3334 | # define gcmFOOTER_ARG(Text, ...) | 3407 | # define gcmFOOTER_ARG(Text, ...) |
3335 | #elif gcdHAS_ELLIPSIS | 3408 | #elif gcdHAS_ELLIPSIS |
3409 | #if gcdEMPTY_HEADER_FOOTER | ||
3410 | # define gcmFOOTER_ARG(Text, ...) | ||
3411 | #else | ||
3336 | # define gcmFOOTER_ARG(Text, ...) \ | 3412 | # define gcmFOOTER_ARG(Text, ...) \ |
3337 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ | 3413 | gcmSTACK_POP(__user_ptr__, __FUNCTION__); \ |
3338 | gcmBINARY_TRACE(__FUNCTION__, __LINE__, Text, __VA_ARGS__); \ | 3414 | gcmBINARY_TRACE(__FUNCTION__, __LINE__, Text, __VA_ARGS__); \ |
3339 | gcmTRACE_ZONE(gcdHEADER_LEVEL, _GC_OBJ_ZONE, \ | 3415 | gcmTRACE_ZONE(gcdHEADER_LEVEL, _GC_OBJ_ZONE, \ |
3340 | "--%s(%d): " Text, __FUNCTION__, __LINE__, __VA_ARGS__); \ | 3416 | "--%s(%d): " Text, __FUNCTION__, __LINE__, __VA_ARGS__); \ |
3341 | *__user_ptr__ -= 1 | 3417 | *__user_ptr__ -= 1 |
3418 | #endif | ||
3342 | #else | 3419 | #else |
3343 | gcmINLINE static void | 3420 | gcmINLINE static void |
3344 | __dummy_footer_arg( | 3421 | __dummy_footer_arg( |
@@ -4223,6 +4300,50 @@ gckOS_DebugStatus2Name( | |||
4223 | 4300 | ||
4224 | /******************************************************************************* | 4301 | /******************************************************************************* |
4225 | ** | 4302 | ** |
4303 | ** gcmkSAFECASTSIZET | ||
4304 | ** | ||
4305 | ** Check wether value of a gctSIZE_T varible beyond the capability | ||
4306 | ** of 32bits GPU hardware. | ||
4307 | ** | ||
4308 | ** ASSUMPTIONS: | ||
4309 | ** | ||
4310 | ** | ||
4311 | ** | ||
4312 | ** ARGUMENTS: | ||
4313 | ** | ||
4314 | ** x A gctUINT32 variable | ||
4315 | ** y A gctSIZE_T variable | ||
4316 | */ | ||
4317 | #define gcmkSAFECASTSIZET(x, y) \ | ||
4318 | do \ | ||
4319 | { \ | ||
4320 | if (gcmSIZEOF(gctSIZE_T) > gcmSIZEOF(gctUINT32)) \ | ||
4321 | { \ | ||
4322 | if (y) \ | ||
4323 | { \ | ||
4324 | gcmkASSERT((y) <= gcvMAXUINT32); \ | ||
4325 | } \ | ||
4326 | } \ | ||
4327 | (x) = (gctUINT32)(y); \ | ||
4328 | } \ | ||
4329 | while (gcvFALSE) | ||
4330 | |||
4331 | #define gcmSAFECASTSIZET(x, y) \ | ||
4332 | do \ | ||
4333 | { \ | ||
4334 | if (gcmSIZEOF(gctSIZE_T) > gcmSIZEOF(gctUINT32)) \ | ||
4335 | { \ | ||
4336 | if (y) \ | ||
4337 | { \ | ||
4338 | gcmASSERT((y) <= gcvMAXUINT32); \ | ||
4339 | } \ | ||
4340 | } \ | ||
4341 | (x) = (gctUINT32)(y); \ | ||
4342 | } \ | ||
4343 | while (gcvFALSE) | ||
4344 | |||
4345 | /******************************************************************************* | ||
4346 | ** | ||
4226 | ** gcmVERIFY_LOCK | 4347 | ** gcmVERIFY_LOCK |
4227 | ** | 4348 | ** |
4228 | ** Verifies whether the surface is locked. | 4349 | ** Verifies whether the surface is locked. |
@@ -4422,7 +4543,9 @@ gcGetUserDebugOption( | |||
4422 | #if defined(ANDROID) | 4543 | #if defined(ANDROID) |
4423 | struct _gcoOS_SymbolsList | 4544 | struct _gcoOS_SymbolsList |
4424 | { | 4545 | { |
4546 | #ifndef VIVANTE_NO_3D | ||
4425 | gcePATCH_ID patchId; | 4547 | gcePATCH_ID patchId; |
4548 | #endif | ||
4426 | const char * symList[10]; | 4549 | const char * symList[10]; |
4427 | }; | 4550 | }; |
4428 | #endif | 4551 | #endif |
@@ -4445,6 +4568,641 @@ struct _gcoOS_SymbolsList | |||
4445 | #define gcmUSER_DEBUG_WARNING_MSG | 4568 | #define gcmUSER_DEBUG_WARNING_MSG |
4446 | #endif | 4569 | #endif |
4447 | 4570 | ||
4571 | /******************************************************************************* | ||
4572 | ** | ||
4573 | ** A set of macros to aid state loading. | ||
4574 | ** | ||
4575 | ** ARGUMENTS: | ||
4576 | ** | ||
4577 | ** CommandBuffer Pointer to a gcoCMDBUF object. | ||
4578 | ** StateDelta Pointer to a gcsSTATE_DELTA state delta structure. | ||
4579 | ** Memory Destination memory pointer of gctUINT32_PTR type. | ||
4580 | ** PartOfContext Whether or not the state is a part of the context. | ||
4581 | ** FixedPoint Whether or not the state is of the fixed point format. | ||
4582 | ** Count Number of consecutive states to be loaded. | ||
4583 | ** Address State address. | ||
4584 | ** Data Data to be set to the state. | ||
4585 | */ | ||
4586 | |||
4587 | /*----------------------------------------------------------------------------*/ | ||
4588 | |||
4589 | #if gcmIS_DEBUG(gcdDEBUG_CODE) | ||
4590 | |||
4591 | # define gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count) \ | ||
4592 | CommandBuffer->lastLoadStatePtr = gcmPTR_TO_UINT64(Memory); \ | ||
4593 | CommandBuffer->lastLoadStateAddress = Address; \ | ||
4594 | CommandBuffer->lastLoadStateCount = Count | ||
4595 | |||
4596 | # define gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address) \ | ||
4597 | gcmASSERT( \ | ||
4598 | (gctUINT) (Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastLoadStatePtr, gctUINT32_PTR) - 1) \ | ||
4599 | == \ | ||
4600 | (gctUINT) (Address - CommandBuffer->lastLoadStateAddress) \ | ||
4601 | ); \ | ||
4602 | \ | ||
4603 | gcmASSERT(CommandBuffer->lastLoadStateCount > 0); \ | ||
4604 | \ | ||
4605 | CommandBuffer->lastLoadStateCount -= 1 | ||
4606 | |||
4607 | # define gcmVERIFYLOADSTATEDONE(CommandBuffer) \ | ||
4608 | gcmASSERT(CommandBuffer->lastLoadStateCount == 0); | ||
4609 | |||
4610 | # define gcmDEFINELOADSTATEBASE() \ | ||
4611 | gctUINT32_PTR LoadStateBase; | ||
4612 | |||
4613 | # define gcmSETLOADSTATEBASE(CommandBuffer, OutSide) \ | ||
4614 | if (OutSide) \ | ||
4615 | {\ | ||
4616 | LoadStateBase = (gctUINT32_PTR)*OutSide; \ | ||
4617 | }\ | ||
4618 | else\ | ||
4619 | {\ | ||
4620 | LoadStateBase = (gctUINT_PTR)CommandBuffer->buffer;\ | ||
4621 | } | ||
4622 | |||
4623 | |||
4624 | # define gcmVERIFYLOADSTATEALIGNED(CommandBuffer, Memory) \ | ||
4625 | gcmASSERT(((Memory - LoadStateBase) & 1) == 0); | ||
4626 | |||
4627 | # define gcmUNSETLOADSTATEBASE() \ | ||
4628 | LoadStateBase = LoadStateBase; | ||
4629 | |||
4630 | #else | ||
4631 | |||
4632 | # define gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count) | ||
4633 | # define gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address) | ||
4634 | # define gcmVERIFYLOADSTATEDONE(CommandBuffer) | ||
4635 | |||
4636 | # define gcmDEFINELOADSTATEBASE() | ||
4637 | # define gcmSETLOADSTATEBASE(CommandBuffer, OutSide) | ||
4638 | # define gcmVERIFYLOADSTATEALIGNED(CommandBuffer, Memory) | ||
4639 | # define gcmUNSETLOADSTATEBASE() | ||
4640 | |||
4641 | #endif | ||
4642 | |||
4643 | #if gcdSECURE_USER | ||
4644 | |||
4645 | # define gcmDEFINESECUREUSER() \ | ||
4646 | gctUINT __secure_user_offset__; \ | ||
4647 | gctUINT32_PTR __secure_user_hintArray__; | ||
4648 | |||
4649 | # define gcmBEGINSECUREUSER() \ | ||
4650 | __secure_user_offset__ = reserve->lastOffset; \ | ||
4651 | \ | ||
4652 | __secure_user_hintArray__ = gcmUINT64_TO_PTR(reserve->hintArrayTail) | ||
4653 | |||
4654 | # define gcmENDSECUREUSER() \ | ||
4655 | reserve->hintArrayTail = gcmPTR_TO_UINT64(__secure_user_hintArray__) | ||
4656 | |||
4657 | # define gcmSKIPSECUREUSER() \ | ||
4658 | __secure_user_offset__ += gcmSIZEOF(gctUINT32) | ||
4659 | |||
4660 | # define gcmUPDATESECUREUSER() \ | ||
4661 | *__secure_user_hintArray__ = __secure_user_offset__; \ | ||
4662 | \ | ||
4663 | __secure_user_offset__ += gcmSIZEOF(gctUINT32); \ | ||
4664 | __secure_user_hintArray__ += 1 | ||
4665 | |||
4666 | #else | ||
4667 | |||
4668 | # define gcmDEFINESECUREUSER() | ||
4669 | # define gcmBEGINSECUREUSER() | ||
4670 | # define gcmENDSECUREUSER() | ||
4671 | # define gcmSKIPSECUREUSER() | ||
4672 | # define gcmUPDATESECUREUSER() | ||
4673 | |||
4674 | #endif | ||
4675 | |||
4676 | /*----------------------------------------------------------------------------*/ | ||
4677 | |||
4678 | #if gcdDUMP | ||
4679 | # define gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, Data) \ | ||
4680 | if (FixedPoint) \ | ||
4681 | { \ | ||
4682 | gcmDUMP(gcvNULL, "#[state.x 0x%04X 0x%08X]", \ | ||
4683 | Address, Data \ | ||
4684 | ); \ | ||
4685 | } \ | ||
4686 | else \ | ||
4687 | { \ | ||
4688 | gcmDUMP(gcvNULL, "#[state 0x%04X 0x%08X]", \ | ||
4689 | Address, Data \ | ||
4690 | ); \ | ||
4691 | } | ||
4692 | #else | ||
4693 | # define gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, Data) | ||
4694 | #endif | ||
4695 | |||
4696 | #define gcmDEFINESTATEBUFFER(CommandBuffer, StateDelta, Memory, ReserveSize) \ | ||
4697 | gcmDEFINESECUREUSER() \ | ||
4698 | gctSIZE_T ReserveSize; \ | ||
4699 | gcoCMDBUF CommandBuffer; \ | ||
4700 | gctUINT32_PTR Memory; \ | ||
4701 | gcsSTATE_DELTA_PTR StateDelta | ||
4702 | |||
4703 | #define gcmBEGINSTATEBUFFER(Hardware, CommandBuffer, StateDelta, Memory, ReserveSize) \ | ||
4704 | { \ | ||
4705 | gcmONERROR(gcoBUFFER_Reserve( \ | ||
4706 | Hardware->buffer, ReserveSize, gcvTRUE, &CommandBuffer \ | ||
4707 | )); \ | ||
4708 | \ | ||
4709 | Memory = (gctUINT32_PTR) gcmUINT64_TO_PTR(CommandBuffer->lastReserve); \ | ||
4710 | \ | ||
4711 | StateDelta = Hardware->delta; \ | ||
4712 | \ | ||
4713 | gcmBEGINSECUREUSER(); \ | ||
4714 | } | ||
4715 | |||
4716 | #define gcmENDSTATEBUFFER(Hardware, CommandBuffer, Memory, ReserveSize) \ | ||
4717 | { \ | ||
4718 | gcmENDSECUREUSER(); \ | ||
4719 | \ | ||
4720 | gcmASSERT( \ | ||
4721 | gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT8_PTR) + ReserveSize \ | ||
4722 | == \ | ||
4723 | (gctUINT8_PTR) Memory \ | ||
4724 | ); \ | ||
4725 | } | ||
4726 | |||
4727 | /*----------------------------------------------------------------------------*/ | ||
4728 | |||
4729 | #define gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, Count) \ | ||
4730 | { \ | ||
4731 | gcmASSERT(((Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT32_PTR)) & 1) == 0); \ | ||
4732 | gcmASSERT((gctUINT32)Count <= 1024); \ | ||
4733 | \ | ||
4734 | gcmVERIFYLOADSTATEDONE(CommandBuffer); \ | ||
4735 | \ | ||
4736 | gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count); \ | ||
4737 | \ | ||
4738 | *Memory++ \ | ||
4739 | = gcmSETFIELDVALUE(0, AQ_COMMAND_LOAD_STATE_COMMAND, OPCODE, LOAD_STATE) \ | ||
4740 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, FLOAT, FixedPoint) \ | ||
4741 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, COUNT, Count) \ | ||
4742 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, ADDRESS, Address); \ | ||
4743 | \ | ||
4744 | gcmSKIPSECUREUSER(); \ | ||
4745 | } | ||
4746 | |||
4747 | #define gcmENDSTATEBATCH(CommandBuffer, Memory) \ | ||
4748 | { \ | ||
4749 | gcmVERIFYLOADSTATEDONE(CommandBuffer); \ | ||
4750 | \ | ||
4751 | gcmASSERT(((Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT32_PTR)) & 1) == 0); \ | ||
4752 | } | ||
4753 | |||
4754 | /*----------------------------------------------------------------------------*/ | ||
4755 | |||
4756 | #define gcmSETSTATEDATA(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4757 | Address, Data) \ | ||
4758 | { \ | ||
4759 | gctUINT32 __temp_data32__; \ | ||
4760 | \ | ||
4761 | gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address); \ | ||
4762 | \ | ||
4763 | gcmSAFECASTSIZET(__temp_data32__, Data); \ | ||
4764 | \ | ||
4765 | *Memory++ = __temp_data32__; \ | ||
4766 | \ | ||
4767 | gcoHARDWARE_UpdateDelta( \ | ||
4768 | StateDelta, FixedPoint, Address, 0, __temp_data32__ \ | ||
4769 | ); \ | ||
4770 | \ | ||
4771 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
4772 | \ | ||
4773 | gcmUPDATESECUREUSER(); \ | ||
4774 | } | ||
4775 | |||
4776 | #define gcmSETSTATEDATAWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4777 | Address, Mask, Data) \ | ||
4778 | { \ | ||
4779 | gctUINT32 __temp_data32__; \ | ||
4780 | \ | ||
4781 | gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address); \ | ||
4782 | \ | ||
4783 | __temp_data32__ = Data; \ | ||
4784 | \ | ||
4785 | *Memory++ = __temp_data32__; \ | ||
4786 | \ | ||
4787 | gcoHARDWARE_UpdateDelta( \ | ||
4788 | StateDelta, FixedPoint, Address, Mask, __temp_data32__ \ | ||
4789 | ); \ | ||
4790 | \ | ||
4791 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
4792 | \ | ||
4793 | gcmUPDATESECUREUSER(); \ | ||
4794 | } | ||
4795 | |||
4796 | |||
4797 | #define gcmSETCTRLSTATE(StateDelta, CommandBuffer, Memory, Address, Data) \ | ||
4798 | { \ | ||
4799 | gctUINT32 __temp_data32__; \ | ||
4800 | \ | ||
4801 | gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address); \ | ||
4802 | \ | ||
4803 | __temp_data32__ = Data; \ | ||
4804 | \ | ||
4805 | *Memory++ = __temp_data32__; \ | ||
4806 | \ | ||
4807 | gcmDUMPSTATEDATA(StateDelta, gcvFALSE, Address, __temp_data32__); \ | ||
4808 | \ | ||
4809 | gcmSKIPSECUREUSER(); \ | ||
4810 | } | ||
4811 | |||
4812 | #define gcmSETFILLER(CommandBuffer, Memory) \ | ||
4813 | { \ | ||
4814 | gcmVERIFYLOADSTATEDONE(CommandBuffer); \ | ||
4815 | \ | ||
4816 | Memory += 1; \ | ||
4817 | \ | ||
4818 | gcmSKIPSECUREUSER(); \ | ||
4819 | } | ||
4820 | |||
4821 | /*----------------------------------------------------------------------------*/ | ||
4822 | |||
4823 | #define gcmSETSINGLESTATE(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4824 | Address, Data) \ | ||
4825 | { \ | ||
4826 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
4827 | gcmSETSTATEDATA(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4828 | Address, Data); \ | ||
4829 | gcmENDSTATEBATCH(CommandBuffer, Memory); \ | ||
4830 | } | ||
4831 | |||
4832 | #define gcmSETSINGLESTATEWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4833 | Address, Mask, Data) \ | ||
4834 | { \ | ||
4835 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
4836 | gcmSETSTATEDATAWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4837 | Address, Mask, Data); \ | ||
4838 | gcmENDSTATEBATCH(CommandBuffer, Memory); \ | ||
4839 | } | ||
4840 | |||
4841 | |||
4842 | #define gcmSETSINGLECTRLSTATE(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4843 | Address, Data) \ | ||
4844 | { \ | ||
4845 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
4846 | gcmSETCTRLSTATE(StateDelta, CommandBuffer, Memory, Address, Data); \ | ||
4847 | gcmENDSTATEBATCH(CommandBuffer, Memory); \ | ||
4848 | } | ||
4849 | |||
4850 | |||
4851 | |||
4852 | #define gcmSETSEMASTALLPIPE(StateDelta, CommandBuffer, Memory, Data) \ | ||
4853 | { \ | ||
4854 | gcmSETSINGLESTATE(StateDelta, CommandBuffer, Memory, gcvFALSE, AQSemaphoreRegAddrs, Data); \ | ||
4855 | \ | ||
4856 | *Memory++ = gcmSETFIELDVALUE(0, STALL_COMMAND, OPCODE, STALL); \ | ||
4857 | \ | ||
4858 | *Memory++ = Data; \ | ||
4859 | \ | ||
4860 | gcmDUMP(gcvNULL, "#[stall 0x%08X 0x%08X]", \ | ||
4861 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, SOURCE, FRONT_END), \ | ||
4862 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, DESTINATION, PIXEL_ENGINE)); \ | ||
4863 | \ | ||
4864 | gcmSKIPSECUREUSER(); \ | ||
4865 | } | ||
4866 | |||
4867 | /******************************************************************************* | ||
4868 | ** | ||
4869 | ** gcmSETSTARTDECOMMAND | ||
4870 | ** | ||
4871 | ** Form a START_DE command. | ||
4872 | ** | ||
4873 | ** ARGUMENTS: | ||
4874 | ** | ||
4875 | ** Memory Destination memory pointer of gctUINT32_PTR type. | ||
4876 | ** Count Number of the rectangles. | ||
4877 | */ | ||
4878 | |||
4879 | #define gcmSETSTARTDECOMMAND(Memory, Count) \ | ||
4880 | { \ | ||
4881 | *Memory++ \ | ||
4882 | = gcmSETFIELDVALUE(0, AQ_COMMAND_START_DE_COMMAND, OPCODE, START_DE) \ | ||
4883 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, COUNT, Count) \ | ||
4884 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, DATA_COUNT, 0); \ | ||
4885 | \ | ||
4886 | *Memory++ = 0xDEADDEED; \ | ||
4887 | } | ||
4888 | |||
4889 | /***************************************** | ||
4890 | ** Temp command buffer macro | ||
4891 | */ | ||
4892 | #define gcmDEFINESTATEBUFFER_NEW(CommandBuffer, StateDelta, Memory) \ | ||
4893 | gcmDEFINESECUREUSER() \ | ||
4894 | gcmDEFINELOADSTATEBASE() \ | ||
4895 | gcsTEMPCMDBUF CommandBuffer = gcvNULL; \ | ||
4896 | gctUINT32_PTR Memory; \ | ||
4897 | gcsSTATE_DELTA_PTR StateDelta | ||
4898 | |||
4899 | |||
4900 | #define gcmBEGINSTATEBUFFER_NEW(Hardware, CommandBuffer, StateDelta, Memory, OutSide) \ | ||
4901 | { \ | ||
4902 | if (OutSide) \ | ||
4903 | {\ | ||
4904 | Memory = (gctUINT32_PTR)*OutSide; \ | ||
4905 | }\ | ||
4906 | else \ | ||
4907 | {\ | ||
4908 | gcmONERROR(gcoBUFFER_StartTEMPCMDBUF( \ | ||
4909 | Hardware->buffer, &CommandBuffer \ | ||
4910 | ));\ | ||
4911 | \ | ||
4912 | Memory = (gctUINT32_PTR)(CommandBuffer->buffer); \ | ||
4913 | \ | ||
4914 | }\ | ||
4915 | StateDelta = Hardware->delta; \ | ||
4916 | \ | ||
4917 | gcmBEGINSECUREUSER(); \ | ||
4918 | gcmSETLOADSTATEBASE(CommandBuffer,OutSide);\ | ||
4919 | } | ||
4920 | |||
4921 | #define gcmENDSTATEBUFFER_NEW(Hardware, CommandBuffer, Memory, OutSide) \ | ||
4922 | { \ | ||
4923 | gcmENDSECUREUSER(); \ | ||
4924 | \ | ||
4925 | if (OutSide) \ | ||
4926 | {\ | ||
4927 | *OutSide = Memory; \ | ||
4928 | }\ | ||
4929 | else \ | ||
4930 | {\ | ||
4931 | CommandBuffer->currentByteSize = (gctUINT32)((gctUINT8_PTR)Memory - \ | ||
4932 | (gctUINT8_PTR)CommandBuffer->buffer); \ | ||
4933 | \ | ||
4934 | gcmONERROR(gcoBUFFER_EndTEMPCMDBUF(Hardware->buffer));\ | ||
4935 | }\ | ||
4936 | gcmUNSETLOADSTATEBASE()\ | ||
4937 | } | ||
4938 | |||
4939 | /*----------------------------------------------------------------------------*/ | ||
4940 | |||
4941 | #define gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, Count) \ | ||
4942 | { \ | ||
4943 | gcmVERIFYLOADSTATEALIGNED(CommandBuffer,Memory);\ | ||
4944 | gcmASSERT((gctUINT32)Count <= 1024); \ | ||
4945 | \ | ||
4946 | *Memory++ \ | ||
4947 | = gcmSETFIELDVALUE(0, AQ_COMMAND_LOAD_STATE_COMMAND, OPCODE, LOAD_STATE) \ | ||
4948 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, FLOAT, FixedPoint) \ | ||
4949 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, COUNT, Count) \ | ||
4950 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, ADDRESS, Address); \ | ||
4951 | \ | ||
4952 | gcmSKIPSECUREUSER(); \ | ||
4953 | } | ||
4954 | |||
4955 | #define gcmENDSTATEBATCH_NEW(CommandBuffer, Memory) \ | ||
4956 | gcmVERIFYLOADSTATEALIGNED(CommandBuffer,Memory); | ||
4957 | |||
4958 | /*----------------------------------------------------------------------------*/ | ||
4959 | |||
4960 | #define gcmSETSTATEDATA_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4961 | Address, Data) \ | ||
4962 | { \ | ||
4963 | gctUINT32 __temp_data32__; \ | ||
4964 | \ | ||
4965 | __temp_data32__ = Data; \ | ||
4966 | \ | ||
4967 | *Memory++ = __temp_data32__; \ | ||
4968 | \ | ||
4969 | gcoHARDWARE_UpdateDelta( \ | ||
4970 | StateDelta, FixedPoint, Address, 0, __temp_data32__ \ | ||
4971 | ); \ | ||
4972 | \ | ||
4973 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
4974 | \ | ||
4975 | gcmUPDATESECUREUSER(); \ | ||
4976 | } | ||
4977 | |||
4978 | #define gcmSETSTATEDATAWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
4979 | Address, Mask, Data) \ | ||
4980 | { \ | ||
4981 | gctUINT32 __temp_data32__; \ | ||
4982 | \ | ||
4983 | __temp_data32__ = Data; \ | ||
4984 | \ | ||
4985 | *Memory++ = __temp_data32__; \ | ||
4986 | \ | ||
4987 | gcoHARDWARE_UpdateDelta( \ | ||
4988 | StateDelta, FixedPoint, Address, Mask, __temp_data32__ \ | ||
4989 | ); \ | ||
4990 | \ | ||
4991 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
4992 | \ | ||
4993 | gcmUPDATESECUREUSER(); \ | ||
4994 | } | ||
4995 | |||
4996 | |||
4997 | #define gcmSETCTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, Address, Data) \ | ||
4998 | { \ | ||
4999 | gctUINT32 __temp_data32__; \ | ||
5000 | \ | ||
5001 | __temp_data32__ = Data; \ | ||
5002 | \ | ||
5003 | *Memory++ = __temp_data32__; \ | ||
5004 | \ | ||
5005 | gcmDUMPSTATEDATA(StateDelta, gcvFALSE, Address, __temp_data32__); \ | ||
5006 | \ | ||
5007 | gcmSKIPSECUREUSER(); \ | ||
5008 | } | ||
5009 | |||
5010 | #define gcmSETFILLER_NEW(CommandBuffer, Memory) \ | ||
5011 | { \ | ||
5012 | Memory += 1; \ | ||
5013 | \ | ||
5014 | gcmSKIPSECUREUSER(); \ | ||
5015 | } | ||
5016 | |||
5017 | /*----------------------------------------------------------------------------*/ | ||
5018 | |||
5019 | #define gcmSETSINGLESTATE_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
5020 | Address, Data) \ | ||
5021 | { \ | ||
5022 | gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
5023 | gcmSETSTATEDATA_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
5024 | Address, Data); \ | ||
5025 | gcmENDSTATEBATCH_NEW(CommandBuffer, Memory); \ | ||
5026 | } | ||
5027 | |||
5028 | #define gcmSETSINGLESTATEWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
5029 | Address, Mask, Data) \ | ||
5030 | { \ | ||
5031 | gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
5032 | gcmSETSTATEDATAWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
5033 | Address, Mask, Data); \ | ||
5034 | gcmENDSTATEBATCH_NEW(CommandBuffer, Memory); \ | ||
5035 | } | ||
5036 | |||
5037 | |||
5038 | #define gcmSETSINGLECTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
5039 | Address, Data) \ | ||
5040 | { \ | ||
5041 | gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
5042 | gcmSETCTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, Address, Data); \ | ||
5043 | gcmENDSTATEBATCH_NEW(CommandBuffer, Memory); \ | ||
5044 | } | ||
5045 | |||
5046 | |||
5047 | |||
5048 | #define gcmSETSEMASTALLPIPE_NEW(StateDelta, CommandBuffer, Memory, Data) \ | ||
5049 | { \ | ||
5050 | gcmSETSINGLESTATE_NEW(StateDelta, CommandBuffer, Memory, gcvFALSE, AQSemaphoreRegAddrs, Data); \ | ||
5051 | \ | ||
5052 | *Memory++ = gcmSETFIELDVALUE(0, STALL_COMMAND, OPCODE, STALL); \ | ||
5053 | \ | ||
5054 | *Memory++ = Data; \ | ||
5055 | \ | ||
5056 | gcmDUMP(gcvNULL, "#[stall 0x%08X 0x%08X]", \ | ||
5057 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, SOURCE, FRONT_END), \ | ||
5058 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, DESTINATION, PIXEL_ENGINE)); \ | ||
5059 | \ | ||
5060 | gcmSKIPSECUREUSER(); \ | ||
5061 | } | ||
5062 | |||
5063 | #define gcmSETSTARTDECOMMAND_NEW(CommandBuffer, Memory, Count) \ | ||
5064 | { \ | ||
5065 | *Memory++ \ | ||
5066 | = gcmSETFIELDVALUE(0, AQ_COMMAND_START_DE_COMMAND, OPCODE, START_DE) \ | ||
5067 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, COUNT, Count) \ | ||
5068 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, DATA_COUNT, 0); \ | ||
5069 | \ | ||
5070 | *Memory++ = 0xDEADDEED; \ | ||
5071 | \ | ||
5072 | } | ||
5073 | |||
5074 | /******************************************************************************* | ||
5075 | ** | ||
5076 | ** gcmCONFIGUREUNIFORMS | ||
5077 | ** | ||
5078 | ** Configure uniforms according to chip and numConstants. | ||
5079 | */ | ||
5080 | #define gcmCONFIGUREUNIFORMS(ChipModel, ChipRevision, NumConstants, \ | ||
5081 | UnifiedConst, VsConstBase, PsConstBase, VsConstMax, PsConstMax, ConstMax) \ | ||
5082 | { \ | ||
5083 | if (ChipModel == gcv2000 && ChipRevision == 0x5118) \ | ||
5084 | { \ | ||
5085 | UnifiedConst = gcvFALSE; \ | ||
5086 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5087 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5088 | VsConstMax = 256; \ | ||
5089 | PsConstMax = 64; \ | ||
5090 | ConstMax = 320; \ | ||
5091 | } \ | ||
5092 | else if (NumConstants == 320) \ | ||
5093 | { \ | ||
5094 | UnifiedConst = gcvFALSE; \ | ||
5095 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5096 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5097 | VsConstMax = 256; \ | ||
5098 | PsConstMax = 64; \ | ||
5099 | ConstMax = 320; \ | ||
5100 | } \ | ||
5101 | /* All GC1000 series chips can only support 64 uniforms for ps on non-unified const mode. */ \ | ||
5102 | else if (NumConstants > 256 && ChipModel == gcv1000) \ | ||
5103 | { \ | ||
5104 | UnifiedConst = gcvFALSE; \ | ||
5105 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5106 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5107 | VsConstMax = 256; \ | ||
5108 | PsConstMax = 64; \ | ||
5109 | ConstMax = 320; \ | ||
5110 | } \ | ||
5111 | else if (NumConstants > 256) \ | ||
5112 | { \ | ||
5113 | UnifiedConst = gcvFALSE; \ | ||
5114 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5115 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5116 | VsConstMax = 256; \ | ||
5117 | PsConstMax = 256; \ | ||
5118 | ConstMax = 512; \ | ||
5119 | } \ | ||
5120 | else if (NumConstants == 256) \ | ||
5121 | { \ | ||
5122 | UnifiedConst = gcvFALSE; \ | ||
5123 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5124 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5125 | VsConstMax = 256; \ | ||
5126 | PsConstMax = 256; \ | ||
5127 | ConstMax = 512; \ | ||
5128 | } \ | ||
5129 | else \ | ||
5130 | { \ | ||
5131 | UnifiedConst = gcvFALSE; \ | ||
5132 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5133 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5134 | VsConstMax = 168; \ | ||
5135 | PsConstMax = 64; \ | ||
5136 | ConstMax = 232; \ | ||
5137 | } \ | ||
5138 | } | ||
5139 | |||
5140 | /******************************************************************************* | ||
5141 | ** | ||
5142 | ** gcmGET_UNIFORM_INFO_FOR_NONUNIFIEDMODE | ||
5143 | ** | ||
5144 | ** Configure uniforms according to chip and numConstants. | ||
5145 | */ | ||
5146 | #define gcmGET_UNIFORM_INFO_FOR_NONUNIFIEDMODE(ChipModel, ChipRevision, NumConstants, \ | ||
5147 | UnifiedConst, VsConstBase, PsConstBase, VsConstMax, PsConstMax, ConstMax) \ | ||
5148 | { \ | ||
5149 | if (ChipModel == gcv2000 && ChipRevision == 0x5118) \ | ||
5150 | { \ | ||
5151 | UnifiedConst = gcvFALSE; \ | ||
5152 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5153 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5154 | VsConstMax = 256; \ | ||
5155 | PsConstMax = 64; \ | ||
5156 | ConstMax = 320; \ | ||
5157 | } \ | ||
5158 | else if (NumConstants == 320) \ | ||
5159 | { \ | ||
5160 | UnifiedConst = gcvFALSE; \ | ||
5161 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5162 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5163 | VsConstMax = 256; \ | ||
5164 | PsConstMax = 64; \ | ||
5165 | ConstMax = 320; \ | ||
5166 | } \ | ||
5167 | /* All GC1000 series chips can only support 64 uniforms for ps on non-unified const mode. */ \ | ||
5168 | else if (NumConstants > 256 && ChipModel == gcv1000) \ | ||
5169 | { \ | ||
5170 | UnifiedConst = gcvFALSE; \ | ||
5171 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5172 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5173 | VsConstMax = 256; \ | ||
5174 | PsConstMax = 64; \ | ||
5175 | ConstMax = 320; \ | ||
5176 | } \ | ||
5177 | else if (NumConstants > 256) \ | ||
5178 | { \ | ||
5179 | UnifiedConst = gcvFALSE; \ | ||
5180 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5181 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5182 | VsConstMax = 256; \ | ||
5183 | PsConstMax = 256; \ | ||
5184 | ConstMax = 512; \ | ||
5185 | } \ | ||
5186 | else if (NumConstants == 256) \ | ||
5187 | { \ | ||
5188 | UnifiedConst = gcvFALSE; \ | ||
5189 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5190 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5191 | VsConstMax = 256; \ | ||
5192 | PsConstMax = 256; \ | ||
5193 | ConstMax = 512; \ | ||
5194 | } \ | ||
5195 | else \ | ||
5196 | { \ | ||
5197 | UnifiedConst = gcvFALSE; \ | ||
5198 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
5199 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
5200 | VsConstMax = 168; \ | ||
5201 | PsConstMax = 64; \ | ||
5202 | ConstMax = 232; \ | ||
5203 | } \ | ||
5204 | } | ||
5205 | |||
4448 | #ifdef __cplusplus | 5206 | #ifdef __cplusplus |
4449 | } | 5207 | } |
4450 | #endif | 5208 | #endif |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h index 4494805b3ece..9cc9626e3b06 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | |||
@@ -19,7 +19,6 @@ | |||
19 | *****************************************************************************/ | 19 | *****************************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | |||
23 | #ifndef __gc_hal_driver_h_ | 22 | #ifndef __gc_hal_driver_h_ |
24 | #define __gc_hal_driver_h_ | 23 | #define __gc_hal_driver_h_ |
25 | 24 | ||
@@ -271,6 +270,9 @@ typedef struct _gcsHAL_QUERY_CHIP_IDENTITY | |||
271 | /* Number of 3D GPUs */ | 270 | /* Number of 3D GPUs */ |
272 | gctUINT32 gpuCoreCount; | 271 | gctUINT32 gpuCoreCount; |
273 | #endif | 272 | #endif |
273 | |||
274 | /* Special control bits for 2D chip. */ | ||
275 | gctUINT32 chip2DControl; | ||
274 | } | 276 | } |
275 | gcsHAL_QUERY_CHIP_IDENTITY; | 277 | gcsHAL_QUERY_CHIP_IDENTITY; |
276 | 278 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h index fc8954ab37a4..7a7e8b5f4caf 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver_vg.h | |||
@@ -57,37 +57,37 @@ typedef struct _gcsCOMMAND_BUFFER_INFO | |||
57 | 57 | ||
58 | /* Alignment and mask for the buffer address. */ | 58 | /* Alignment and mask for the buffer address. */ |
59 | gctUINT addressMask; | 59 | gctUINT addressMask; |
60 | gctSIZE_T addressAlignment; | 60 | gctUINT32 addressAlignment; |
61 | 61 | ||
62 | /* Alignment for each command. */ | 62 | /* Alignment for each command. */ |
63 | gctSIZE_T commandAlignment; | 63 | gctUINT32 commandAlignment; |
64 | 64 | ||
65 | /* Number of bytes required by the STATE command. */ | 65 | /* Number of bytes required by the STATE command. */ |
66 | gctSIZE_T stateCommandSize; | 66 | gctUINT32 stateCommandSize; |
67 | 67 | ||
68 | /* Number of bytes required by the RESTART command. */ | 68 | /* Number of bytes required by the RESTART command. */ |
69 | gctSIZE_T restartCommandSize; | 69 | gctUINT32 restartCommandSize; |
70 | 70 | ||
71 | /* Number of bytes required by the FETCH command. */ | 71 | /* Number of bytes required by the FETCH command. */ |
72 | gctSIZE_T fetchCommandSize; | 72 | gctUINT32 fetchCommandSize; |
73 | 73 | ||
74 | /* Number of bytes required by the CALL command. */ | 74 | /* Number of bytes required by the CALL command. */ |
75 | gctSIZE_T callCommandSize; | 75 | gctUINT32 callCommandSize; |
76 | 76 | ||
77 | /* Number of bytes required by the RETURN command. */ | 77 | /* Number of bytes required by the RETURN command. */ |
78 | gctSIZE_T returnCommandSize; | 78 | gctUINT32 returnCommandSize; |
79 | 79 | ||
80 | /* Number of bytes required by the EVENT command. */ | 80 | /* Number of bytes required by the EVENT command. */ |
81 | gctSIZE_T eventCommandSize; | 81 | gctUINT32 eventCommandSize; |
82 | 82 | ||
83 | /* Number of bytes required by the END command. */ | 83 | /* Number of bytes required by the END command. */ |
84 | gctSIZE_T endCommandSize; | 84 | gctUINT32 endCommandSize; |
85 | 85 | ||
86 | /* Number of bytes reserved at the tail of a static command buffer. */ | 86 | /* Number of bytes reserved at the tail of a static command buffer. */ |
87 | gctSIZE_T staticTailSize; | 87 | gctUINT32 staticTailSize; |
88 | 88 | ||
89 | /* Number of bytes reserved at the tail of a dynamic command buffer. */ | 89 | /* Number of bytes reserved at the tail of a dynamic command buffer. */ |
90 | gctSIZE_T dynamicTailSize; | 90 | gctUINT32 dynamicTailSize; |
91 | } | 91 | } |
92 | gcsCOMMAND_BUFFER_INFO; | 92 | gcsCOMMAND_BUFFER_INFO; |
93 | 93 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h index 100bda07ecbb..eb19c70066a1 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h | |||
@@ -19,7 +19,6 @@ | |||
19 | *****************************************************************************/ | 19 | *****************************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | |||
23 | #ifndef __gc_hal_eglplatform_h_ | 22 | #ifndef __gc_hal_eglplatform_h_ |
24 | #define __gc_hal_eglplatform_h_ | 23 | #define __gc_hal_eglplatform_h_ |
25 | 24 | ||
@@ -624,6 +623,38 @@ gcoOS_SwapBuffers( | |||
624 | OUT gctUINT *Width, | 623 | OUT gctUINT *Width, |
625 | OUT gctUINT *Height | 624 | OUT gctUINT *Height |
626 | ); | 625 | ); |
626 | |||
627 | #ifdef EGL_API_DRI | ||
628 | gceSTATUS | ||
629 | gcoOS_ResizeWindow( | ||
630 | IN gctPOINTER localDisplay, | ||
631 | IN HALNativeWindowType Drawable, | ||
632 | IN gctUINT Width, | ||
633 | IN gctUINT Height) | ||
634 | ; | ||
635 | |||
636 | #ifdef USE_FREESCALE_EGL_ACCEL | ||
637 | gceSTATUS | ||
638 | gcoOS_SwapBuffersGeneric_Async( | ||
639 | IN gctPOINTER localDisplay, | ||
640 | IN HALNativeWindowType Drawable, | ||
641 | IN gcoSURF RenderTarget, | ||
642 | IN gcoSURF ResolveTarget, | ||
643 | IN gctPOINTER ResolveBits, | ||
644 | OUT gctUINT *Width, | ||
645 | OUT gctUINT *Height, | ||
646 | IN void * resolveRect | ||
647 | ); | ||
648 | |||
649 | gceSTATUS | ||
650 | gcoOS_DrawSurface( | ||
651 | IN gctPOINTER localDisplay, | ||
652 | IN HALNativeWindowType Drawable | ||
653 | ); | ||
654 | #endif | ||
655 | |||
656 | #endif | ||
657 | |||
627 | #ifdef __cplusplus | 658 | #ifdef __cplusplus |
628 | } | 659 | } |
629 | #endif | 660 | #endif |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h index 3136772330c1..aac4bdffdf63 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform_type.h | |||
@@ -33,20 +33,20 @@ extern "C" { | |||
33 | 33 | ||
34 | typedef enum _halEventType | 34 | typedef enum _halEventType |
35 | { | 35 | { |
36 | /* Keyboard event. */ | 36 | /* Keyboard event. */ |
37 | HAL_KEYBOARD, | 37 | HAL_KEYBOARD, |
38 | 38 | ||
39 | /* Mouse move event. */ | 39 | /* Mouse move event. */ |
40 | HAL_POINTER, | 40 | HAL_POINTER, |
41 | 41 | ||
42 | /* Mouse button event. */ | 42 | /* Mouse button event. */ |
43 | HAL_BUTTON, | 43 | HAL_BUTTON, |
44 | 44 | ||
45 | /* Application close event. */ | 45 | /* Application close event. */ |
46 | HAL_CLOSE, | 46 | HAL_CLOSE, |
47 | 47 | ||
48 | /* Application window has been updated. */ | 48 | /* Application window has been updated. */ |
49 | HAL_WINDOW_UPDATE | 49 | HAL_WINDOW_UPDATE |
50 | } | 50 | } |
51 | halEventType; | 51 | halEventType; |
52 | 52 | ||
@@ -172,10 +172,10 @@ halKeys; | |||
172 | /* Structure that defined keyboard mapping. */ | 172 | /* Structure that defined keyboard mapping. */ |
173 | typedef struct _halKeyMap | 173 | typedef struct _halKeyMap |
174 | { | 174 | { |
175 | /* Normal key. */ | 175 | /* Normal key. */ |
176 | halKeys normal; | 176 | halKeys normal; |
177 | 177 | ||
178 | /* Extended key. */ | 178 | /* Extended key. */ |
179 | halKeys extended; | 179 | halKeys extended; |
180 | } | 180 | } |
181 | halKeyMap; | 181 | halKeyMap; |
@@ -183,50 +183,50 @@ halKeyMap; | |||
183 | /* Event structure. */ | 183 | /* Event structure. */ |
184 | typedef struct _halEvent | 184 | typedef struct _halEvent |
185 | { | 185 | { |
186 | /* Event type. */ | 186 | /* Event type. */ |
187 | halEventType type; | 187 | halEventType type; |
188 | 188 | ||
189 | /* Event data union. */ | 189 | /* Event data union. */ |
190 | union _halEventData | 190 | union _halEventData |
191 | { | 191 | { |
192 | /* Event data for keyboard. */ | 192 | /* Event data for keyboard. */ |
193 | struct _halKeyboard | 193 | struct _halKeyboard |
194 | { | 194 | { |
195 | /* Scancode. */ | 195 | /* Scancode. */ |
196 | halKeys scancode; | 196 | halKeys scancode; |
197 | 197 | ||
198 | /* ASCII characte of the key pressed. */ | 198 | /* ASCII characte of the key pressed. */ |
199 | char key; | 199 | char key; |
200 | 200 | ||
201 | /* Flag whether the key was pressed (1) or released (0). */ | 201 | /* Flag whether the key was pressed (1) or released (0). */ |
202 | char pressed; | 202 | char pressed; |
203 | } | 203 | } |
204 | keyboard; | 204 | keyboard; |
205 | 205 | ||
206 | /* Event data for pointer. */ | 206 | /* Event data for pointer. */ |
207 | struct _halPointer | 207 | struct _halPointer |
208 | { | 208 | { |
209 | /* Current pointer coordinate. */ | 209 | /* Current pointer coordinate. */ |
210 | int x; | 210 | int x; |
211 | int y; | 211 | int y; |
212 | } | 212 | } |
213 | pointer; | 213 | pointer; |
214 | 214 | ||
215 | /* Event data for mouse buttons. */ | 215 | /* Event data for mouse buttons. */ |
216 | struct _halButton | 216 | struct _halButton |
217 | { | 217 | { |
218 | /* Left button state. */ | 218 | /* Left button state. */ |
219 | int left; | 219 | int left; |
220 | 220 | ||
221 | /* Middle button state. */ | 221 | /* Middle button state. */ |
222 | int middle; | 222 | int middle; |
223 | 223 | ||
224 | /* Right button state. */ | 224 | /* Right button state. */ |
225 | int right; | 225 | int right; |
226 | 226 | ||
227 | /* Current pointer coordinate. */ | 227 | /* Current pointer coordinate. */ |
228 | int x; | 228 | int x; |
229 | int y; | 229 | int y; |
230 | } | 230 | } |
231 | button; | 231 | button; |
232 | } | 232 | } |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h index 6671d11702f9..cc9fef78ad83 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | |||
@@ -83,13 +83,20 @@ gcoHAL_QueryShaderCapsEx( | |||
83 | gceSTATUS | 83 | gceSTATUS |
84 | gcoHAL_QuerySamplerBase( | 84 | gcoHAL_QuerySamplerBase( |
85 | IN gcoHAL Hal, | 85 | IN gcoHAL Hal, |
86 | OUT gctSIZE_T * VertexCount, | 86 | OUT gctUINT32 * VertexCount, |
87 | OUT gctINT_PTR VertexBase, | 87 | OUT gctINT_PTR VertexBase, |
88 | OUT gctSIZE_T * FragmentCount, | 88 | OUT gctUINT32 * FragmentCount, |
89 | OUT gctINT_PTR FragmentBase | 89 | OUT gctINT_PTR FragmentBase |
90 | ); | 90 | ); |
91 | 91 | ||
92 | gceSTATUS | 92 | gceSTATUS |
93 | gcoHAL_QueryUniformBase( | ||
94 | IN gcoHAL Hal, | ||
95 | OUT gctUINT32 * VertexBase, | ||
96 | OUT gctUINT32 * FragmentBase | ||
97 | ); | ||
98 | |||
99 | gceSTATUS | ||
93 | gcoHAL_QueryTextureCaps( | 100 | gcoHAL_QueryTextureCaps( |
94 | IN gcoHAL Hal, | 101 | IN gcoHAL Hal, |
95 | OUT gctUINT * MaxWidth, | 102 | OUT gctUINT * MaxWidth, |
@@ -141,7 +148,10 @@ typedef struct _gcsSURF_BLIT_ARGS | |||
141 | gctBOOL scissorTest; | 148 | gctBOOL scissorTest; |
142 | gcsRECT scissor; | 149 | gcsRECT scissor; |
143 | gctUINT flags; | 150 | gctUINT flags; |
144 | } gcsSURF_BLIT_ARGS; | 151 | } |
152 | gcsSURF_BLIT_ARGS; | ||
153 | |||
154 | |||
145 | 155 | ||
146 | 156 | ||
147 | /* Clear flags. */ | 157 | /* Clear flags. */ |
@@ -211,9 +221,86 @@ typedef struct _gcsSURF_CLEAR_ARGS | |||
211 | 221 | ||
212 | typedef gcsSURF_CLEAR_ARGS* gcsSURF_CLEAR_ARGS_PTR; | 222 | typedef gcsSURF_CLEAR_ARGS* gcsSURF_CLEAR_ARGS_PTR; |
213 | 223 | ||
224 | typedef struct _gscSURF_BLITDRAW_BLIT | ||
225 | { | ||
226 | gcoSURF srcSurface; | ||
227 | gcoSURF dstSurface; | ||
228 | gcsRECT srcRect; | ||
229 | gcsRECT dstRect; | ||
230 | gceTEXTURE_FILTER filterMode; | ||
231 | gctBOOL xReverse; | ||
232 | gctBOOL yReverse; | ||
233 | gctBOOL scissorEnabled; | ||
234 | gcsRECT scissor; | ||
235 | }gscSURF_BLITDRAW_BLIT; | ||
236 | |||
237 | |||
238 | typedef enum _gceBLITDRAW_TYPE | ||
239 | { | ||
240 | gcvBLITDRAW_CLEAR = 0, | ||
241 | gcvBLITDRAW_BLIT = 1, | ||
242 | |||
243 | /* last number, not a real type */ | ||
244 | gcvBLITDRAW_NUM_TYPE | ||
245 | } | ||
246 | gceBLITDRAW_TYPE; | ||
247 | |||
248 | |||
249 | typedef struct _gscSURF_BLITDRAW_ARGS | ||
250 | { | ||
251 | /* always the fist member */ | ||
252 | gceHAL_ARG_VERSION version; | ||
253 | |||
254 | union _gcsSURF_BLITDRAW_ARGS_UNION | ||
255 | { | ||
256 | struct _gscSURF_BLITDRAW_ARG_v1 | ||
257 | { | ||
258 | /* Whether it's clear or blit operation, can be extended. */ | ||
259 | gceBLITDRAW_TYPE type; | ||
260 | |||
261 | union _gscSURF_BLITDRAW_UNION | ||
262 | { | ||
263 | gscSURF_BLITDRAW_BLIT blit; | ||
264 | |||
265 | struct _gscSURF_BLITDRAW_CLEAR | ||
266 | { | ||
267 | gcsSURF_CLEAR_ARGS clearArgs; | ||
268 | gcoSURF rtSurface; | ||
269 | gcoSURF dsSurface; | ||
270 | } clear; | ||
271 | } u; | ||
272 | } v1; | ||
273 | } uArgs; | ||
274 | } | ||
275 | gcsSURF_BLITDRAW_ARGS; | ||
276 | |||
277 | |||
278 | typedef struct _gcsSURF_RESOLVE_ARGS | ||
279 | { | ||
280 | gceHAL_ARG_VERSION version; | ||
281 | union _gcsSURF_RESOLVE_ARGS_UNION | ||
282 | { | ||
283 | struct _gcsSURF_RESOLVE_ARG_v1 | ||
284 | { | ||
285 | gctBOOL yInverted; | ||
286 | }v1; | ||
287 | } uArgs; | ||
288 | } | ||
289 | gcsSURF_RESOLVE_ARGS; | ||
290 | |||
214 | 291 | ||
215 | /* CPU Blit with format (including linear <-> tile) conversion*/ | 292 | /* CPU Blit with format (including linear <-> tile) conversion*/ |
216 | gceSTATUS gcoSURF_BlitCPU(gcsSURF_BLIT_ARGS* args); | 293 | gceSTATUS |
294 | gcoSURF_BlitCPU( | ||
295 | gcsSURF_BLIT_ARGS* args | ||
296 | ); | ||
297 | |||
298 | |||
299 | gceSTATUS | ||
300 | gcoSURF_BlitDraw( | ||
301 | IN gcsSURF_BLITDRAW_ARGS *args | ||
302 | ); | ||
303 | |||
217 | 304 | ||
218 | /* Copy surface. */ | 305 | /* Copy surface. */ |
219 | gceSTATUS | 306 | gceSTATUS |
@@ -229,6 +316,14 @@ gcoSURF_Clear( | |||
229 | IN gcsSURF_CLEAR_ARGS_PTR clearArg | 316 | IN gcsSURF_CLEAR_ARGS_PTR clearArg |
230 | ); | 317 | ); |
231 | 318 | ||
319 | /* Preserve pixels from source. */ | ||
320 | gceSTATUS | ||
321 | gcoSURF_Preserve( | ||
322 | IN gcoSURF Source, | ||
323 | IN gcoSURF Dest, | ||
324 | IN gcsRECT_PTR MaskRect | ||
325 | ); | ||
326 | |||
232 | /* Set number of samples for a gcoSURF object. */ | 327 | /* Set number of samples for a gcoSURF object. */ |
233 | gceSTATUS | 328 | gceSTATUS |
234 | gcoSURF_SetSamples( | 329 | gcoSURF_SetSamples( |
@@ -287,6 +382,14 @@ gcoSURF_Resolve( | |||
287 | IN gcoSURF DestSurface | 382 | IN gcoSURF DestSurface |
288 | ); | 383 | ); |
289 | 384 | ||
385 | gceSTATUS | ||
386 | gcoSURF_ResolveEx( | ||
387 | IN gcoSURF SrcSurface, | ||
388 | IN gcoSURF DestSurface, | ||
389 | IN gcsSURF_RESOLVE_ARGS *args | ||
390 | ); | ||
391 | |||
392 | |||
290 | /* Resolve rectangular area of a surface. */ | 393 | /* Resolve rectangular area of a surface. */ |
291 | gceSTATUS | 394 | gceSTATUS |
292 | gcoSURF_ResolveRect( | 395 | gcoSURF_ResolveRect( |
@@ -297,6 +400,18 @@ gcoSURF_ResolveRect( | |||
297 | IN gcsPOINT_PTR RectSize | 400 | IN gcsPOINT_PTR RectSize |
298 | ); | 401 | ); |
299 | 402 | ||
403 | /* Resolve rectangular area of a surface. */ | ||
404 | gceSTATUS | ||
405 | gcoSURF_ResolveRectEx( | ||
406 | IN gcoSURF SrcSurface, | ||
407 | IN gcoSURF DestSurface, | ||
408 | IN gcsPOINT_PTR SrcOrigin, | ||
409 | IN gcsPOINT_PTR DestOrigin, | ||
410 | IN gcsPOINT_PTR RectSize, | ||
411 | IN gcsSURF_RESOLVE_ARGS *args | ||
412 | ); | ||
413 | |||
414 | |||
300 | gceSTATUS | 415 | gceSTATUS |
301 | gcoSURF_GetResolveAlignment( | 416 | gcoSURF_GetResolveAlignment( |
302 | IN gcoSURF Surface, | 417 | IN gcoSURF Surface, |
@@ -474,7 +589,7 @@ gcoINDEX_Upload( | |||
474 | gceSTATUS | 589 | gceSTATUS |
475 | gcoINDEX_UploadOffset( | 590 | gcoINDEX_UploadOffset( |
476 | IN gcoINDEX Index, | 591 | IN gcoINDEX Index, |
477 | IN gctUINT32 Offset, | 592 | IN gctSIZE_T Offset, |
478 | IN gctCONST_POINTER Buffer, | 593 | IN gctCONST_POINTER Buffer, |
479 | IN gctSIZE_T Bytes | 594 | IN gctSIZE_T Bytes |
480 | ); | 595 | ); |
@@ -595,7 +710,7 @@ gceSTATUS | |||
595 | gco3D_SetTargetOffsetEx( | 710 | gco3D_SetTargetOffsetEx( |
596 | IN gco3D Engine, | 711 | IN gco3D Engine, |
597 | IN gctUINT32 TargetIndex, | 712 | IN gctUINT32 TargetIndex, |
598 | IN gctUINT32 Offset | 713 | IN gctSIZE_T Offset |
599 | ); | 714 | ); |
600 | 715 | ||
601 | 716 | ||
@@ -616,7 +731,7 @@ gco3D_SetDepth( | |||
616 | gceSTATUS | 731 | gceSTATUS |
617 | gco3D_SetDepthBufferOffset( | 732 | gco3D_SetDepthBufferOffset( |
618 | IN gco3D Engine, | 733 | IN gco3D Engine, |
619 | IN gctUINT32 Offset | 734 | IN gctSIZE_T Offset |
620 | ); | 735 | ); |
621 | 736 | ||
622 | /* Unset depth buffer. */ | 737 | /* Unset depth buffer. */ |
@@ -1105,7 +1220,7 @@ gceSTATUS | |||
1105 | gco3D_DrawPrimitives( | 1220 | gco3D_DrawPrimitives( |
1106 | IN gco3D Engine, | 1221 | IN gco3D Engine, |
1107 | IN gcePRIMITIVE Type, | 1222 | IN gcePRIMITIVE Type, |
1108 | IN gctINT StartVertex, | 1223 | IN gctSIZE_T StartVertex, |
1109 | IN gctSIZE_T PrimitiveCount | 1224 | IN gctSIZE_T PrimitiveCount |
1110 | ); | 1225 | ); |
1111 | 1226 | ||
@@ -1114,8 +1229,8 @@ gco3D_DrawInstancedPrimitives( | |||
1114 | IN gco3D Engine, | 1229 | IN gco3D Engine, |
1115 | IN gcePRIMITIVE Type, | 1230 | IN gcePRIMITIVE Type, |
1116 | IN gctBOOL DrawIndex, | 1231 | IN gctBOOL DrawIndex, |
1117 | IN gctINT StartVertex, | 1232 | IN gctSIZE_T StartVertex, |
1118 | IN gctINT StartIndex, | 1233 | IN gctSIZE_T StartIndex, |
1119 | IN gctSIZE_T PrimitiveCount, | 1234 | IN gctSIZE_T PrimitiveCount, |
1120 | IN gctSIZE_T VertexCount, | 1235 | IN gctSIZE_T VertexCount, |
1121 | IN gctSIZE_T InstanceCount | 1236 | IN gctSIZE_T InstanceCount |
@@ -1145,8 +1260,8 @@ gceSTATUS | |||
1145 | gco3D_DrawIndexedPrimitives( | 1260 | gco3D_DrawIndexedPrimitives( |
1146 | IN gco3D Engine, | 1261 | IN gco3D Engine, |
1147 | IN gcePRIMITIVE Type, | 1262 | IN gcePRIMITIVE Type, |
1148 | IN gctINT BaseVertex, | 1263 | IN gctSIZE_T BaseVertex, |
1149 | IN gctINT StartIndex, | 1264 | IN gctSIZE_T StartIndex, |
1150 | IN gctSIZE_T PrimitiveCount | 1265 | IN gctSIZE_T PrimitiveCount |
1151 | ); | 1266 | ); |
1152 | 1267 | ||
@@ -1570,11 +1685,11 @@ gcoTEXTURE_Upload( | |||
1570 | IN gcoTEXTURE Texture, | 1685 | IN gcoTEXTURE Texture, |
1571 | IN gctINT MipMap, | 1686 | IN gctINT MipMap, |
1572 | IN gceTEXTURE_FACE Face, | 1687 | IN gceTEXTURE_FACE Face, |
1573 | IN gctUINT Width, | 1688 | IN gctSIZE_T Width, |
1574 | IN gctUINT Height, | 1689 | IN gctSIZE_T Height, |
1575 | IN gctUINT Slice, | 1690 | IN gctUINT Slice, |
1576 | IN gctCONST_POINTER Memory, | 1691 | IN gctCONST_POINTER Memory, |
1577 | IN gctINT Stride, | 1692 | IN gctSIZE_T Stride, |
1578 | IN gceSURF_FORMAT Format, | 1693 | IN gceSURF_FORMAT Format, |
1579 | IN gceSURF_COLOR_SPACE SrcColorSpace | 1694 | IN gceSURF_COLOR_SPACE SrcColorSpace |
1580 | ); | 1695 | ); |
@@ -1585,13 +1700,13 @@ gcoTEXTURE_UploadSub( | |||
1585 | IN gcoTEXTURE Texture, | 1700 | IN gcoTEXTURE Texture, |
1586 | IN gctINT MipMap, | 1701 | IN gctINT MipMap, |
1587 | IN gceTEXTURE_FACE Face, | 1702 | IN gceTEXTURE_FACE Face, |
1588 | IN gctUINT X, | 1703 | IN gctSIZE_T X, |
1589 | IN gctUINT Y, | 1704 | IN gctSIZE_T Y, |
1590 | IN gctUINT Width, | 1705 | IN gctSIZE_T Width, |
1591 | IN gctUINT Height, | 1706 | IN gctSIZE_T Height, |
1592 | IN gctUINT Slice, | 1707 | IN gctUINT Slice, |
1593 | IN gctCONST_POINTER Memory, | 1708 | IN gctCONST_POINTER Memory, |
1594 | IN gctINT Stride, | 1709 | IN gctSIZE_T Stride, |
1595 | IN gceSURF_FORMAT Format, | 1710 | IN gceSURF_FORMAT Format, |
1596 | IN gceSURF_COLOR_SPACE SrcColorSpace, | 1711 | IN gceSURF_COLOR_SPACE SrcColorSpace, |
1597 | IN gctUINT32 PhysicalAddress | 1712 | IN gctUINT32 PhysicalAddress |
@@ -1617,8 +1732,8 @@ gcoTEXTURE_UploadCompressed( | |||
1617 | IN gcoTEXTURE Texture, | 1732 | IN gcoTEXTURE Texture, |
1618 | IN gctINT MipMap, | 1733 | IN gctINT MipMap, |
1619 | IN gceTEXTURE_FACE Face, | 1734 | IN gceTEXTURE_FACE Face, |
1620 | IN gctUINT Width, | 1735 | IN gctSIZE_T Width, |
1621 | IN gctUINT Height, | 1736 | IN gctSIZE_T Height, |
1622 | IN gctUINT Slice, | 1737 | IN gctUINT Slice, |
1623 | IN gctCONST_POINTER Memory, | 1738 | IN gctCONST_POINTER Memory, |
1624 | IN gctSIZE_T Bytes | 1739 | IN gctSIZE_T Bytes |
@@ -1630,10 +1745,10 @@ gcoTEXTURE_UploadCompressedSub( | |||
1630 | IN gcoTEXTURE Texture, | 1745 | IN gcoTEXTURE Texture, |
1631 | IN gctINT MipMap, | 1746 | IN gctINT MipMap, |
1632 | IN gceTEXTURE_FACE Face, | 1747 | IN gceTEXTURE_FACE Face, |
1633 | IN gctUINT XOffset, | 1748 | IN gctSIZE_T XOffset, |
1634 | IN gctUINT YOffset, | 1749 | IN gctSIZE_T YOffset, |
1635 | IN gctUINT Width, | 1750 | IN gctSIZE_T Width, |
1636 | IN gctUINT Height, | 1751 | IN gctSIZE_T Height, |
1637 | IN gctUINT Slice, | 1752 | IN gctUINT Slice, |
1638 | IN gctCONST_POINTER Memory, | 1753 | IN gctCONST_POINTER Memory, |
1639 | IN gctSIZE_T Size | 1754 | IN gctSIZE_T Size |
@@ -1654,7 +1769,7 @@ gcoTEXTURE_GetMipMapFace( | |||
1654 | IN gctUINT MipMap, | 1769 | IN gctUINT MipMap, |
1655 | IN gceTEXTURE_FACE Face, | 1770 | IN gceTEXTURE_FACE Face, |
1656 | OUT gcoSURF * Surface, | 1771 | OUT gcoSURF * Surface, |
1657 | OUT gctUINT32_PTR Offset | 1772 | OUT gctSIZE_T_PTR Offset |
1658 | ); | 1773 | ); |
1659 | 1774 | ||
1660 | gceSTATUS | 1775 | gceSTATUS |
@@ -1663,7 +1778,7 @@ gcoTEXTURE_GetMipMapSlice( | |||
1663 | IN gctUINT MipMap, | 1778 | IN gctUINT MipMap, |
1664 | IN gctUINT Slice, | 1779 | IN gctUINT Slice, |
1665 | OUT gcoSURF * Surface, | 1780 | OUT gcoSURF * Surface, |
1666 | OUT gctUINT32_PTR Offset | 1781 | OUT gctSIZE_T_PTR Offset |
1667 | ); | 1782 | ); |
1668 | 1783 | ||
1669 | gceSTATUS | 1784 | gceSTATUS |
@@ -1672,9 +1787,9 @@ gcoTEXTURE_AddMipMap( | |||
1672 | IN gctINT Level, | 1787 | IN gctINT Level, |
1673 | IN gctINT InternalFormat, | 1788 | IN gctINT InternalFormat, |
1674 | IN gceSURF_FORMAT Format, | 1789 | IN gceSURF_FORMAT Format, |
1675 | IN gctUINT Width, | 1790 | IN gctSIZE_T Width, |
1676 | IN gctUINT Height, | 1791 | IN gctSIZE_T Height, |
1677 | IN gctUINT Depth, | 1792 | IN gctSIZE_T Depth, |
1678 | IN gctUINT Faces, | 1793 | IN gctUINT Faces, |
1679 | IN gcePOOL Pool, | 1794 | IN gcePOOL Pool, |
1680 | OUT gcoSURF * Surface | 1795 | OUT gcoSURF * Surface |
@@ -1853,7 +1968,7 @@ gceSTATUS | |||
1853 | gcoSTREAM_Upload( | 1968 | gcoSTREAM_Upload( |
1854 | IN gcoSTREAM Stream, | 1969 | IN gcoSTREAM Stream, |
1855 | IN gctCONST_POINTER Buffer, | 1970 | IN gctCONST_POINTER Buffer, |
1856 | IN gctUINT32 Offset, | 1971 | IN gctSIZE_T Offset, |
1857 | IN gctSIZE_T Bytes, | 1972 | IN gctSIZE_T Bytes, |
1858 | IN gctBOOL Dynamic | 1973 | IN gctBOOL Dynamic |
1859 | ); | 1974 | ); |
@@ -1937,7 +2052,7 @@ gcoSTREAM_CPUCacheOperation( | |||
1937 | gceSTATUS | 2052 | gceSTATUS |
1938 | gcoSTREAM_CPUCacheOperation_Range( | 2053 | gcoSTREAM_CPUCacheOperation_Range( |
1939 | IN gcoSTREAM Stream, | 2054 | IN gcoSTREAM Stream, |
1940 | IN gctUINT32 Offset, | 2055 | IN gctSIZE_T Offset, |
1941 | IN gctSIZE_T Length, | 2056 | IN gctSIZE_T Length, |
1942 | IN gceCACHEOPERATION Operation | 2057 | IN gceCACHEOPERATION Operation |
1943 | ); | 2058 | ); |
@@ -2015,7 +2130,7 @@ typedef struct _gcsATTRIBUTE | |||
2015 | gctBOOL normalized; | 2130 | gctBOOL normalized; |
2016 | 2131 | ||
2017 | /* Stride of the component. */ | 2132 | /* Stride of the component. */ |
2018 | gctUINT stride; | 2133 | gctSIZE_T stride; |
2019 | 2134 | ||
2020 | /* Divisor of the attribute */ | 2135 | /* Divisor of the attribute */ |
2021 | gctUINT divisor; | 2136 | gctUINT divisor; |
@@ -2131,7 +2246,7 @@ gcoVERTEXARRAY_Bind_Ex2( | |||
2131 | IN gcoVERTEXARRAY Vertex, | 2246 | IN gcoVERTEXARRAY Vertex, |
2132 | IN gctUINT32 EnableBits, | 2247 | IN gctUINT32 EnableBits, |
2133 | IN gcsATTRIBUTE_PTR VertexArray, | 2248 | IN gcsATTRIBUTE_PTR VertexArray, |
2134 | IN gctUINT First, | 2249 | IN gctSIZE_T First, |
2135 | IN gctSIZE_T Count, | 2250 | IN gctSIZE_T Count, |
2136 | IN gctBOOL DrawArraysInstanced, | 2251 | IN gctBOOL DrawArraysInstanced, |
2137 | IN gctSIZE_T InstanceCount, | 2252 | IN gctSIZE_T InstanceCount, |
@@ -2140,7 +2255,7 @@ gcoVERTEXARRAY_Bind_Ex2( | |||
2140 | IN gctPOINTER IndexMemory, | 2255 | IN gctPOINTER IndexMemory, |
2141 | IN OUT gcePRIMITIVE * PrimitiveType, | 2256 | IN OUT gcePRIMITIVE * PrimitiveType, |
2142 | #if gcdUSE_WCLIP_PATCH | 2257 | #if gcdUSE_WCLIP_PATCH |
2143 | IN OUT gctUINT * PrimitiveCount, | 2258 | IN OUT gctSIZE_T * PrimitiveCount, |
2144 | IN OUT gctFLOAT * wLimitRms, | 2259 | IN OUT gctFLOAT * wLimitRms, |
2145 | IN OUT gctBOOL * wLimitDirty, | 2260 | IN OUT gctBOOL * wLimitDirty, |
2146 | #else | 2261 | #else |
@@ -2330,7 +2445,7 @@ gceSTATUS | |||
2330 | gcoBUFOBJ_Upload( | 2445 | gcoBUFOBJ_Upload( |
2331 | IN gcoBUFOBJ BufObj, | 2446 | IN gcoBUFOBJ BufObj, |
2332 | IN gctCONST_POINTER Buffer, | 2447 | IN gctCONST_POINTER Buffer, |
2333 | IN gctUINT32 Offset, | 2448 | IN gctSIZE_T Offset, |
2334 | IN gctSIZE_T Bytes, | 2449 | IN gctSIZE_T Bytes, |
2335 | IN gceBUFOBJ_USAGE Usage | 2450 | IN gceBUFOBJ_USAGE Usage |
2336 | ); | 2451 | ); |
@@ -2365,7 +2480,7 @@ gcoBUFOBJ_SetDirty( | |||
2365 | gceSTATUS | 2480 | gceSTATUS |
2366 | gcoBUFOBJ_AlignIndexBufferWhenNeeded( | 2481 | gcoBUFOBJ_AlignIndexBufferWhenNeeded( |
2367 | IN gcoBUFOBJ BufObj, | 2482 | IN gcoBUFOBJ BufObj, |
2368 | IN gctUINT32 Offset, | 2483 | IN gctSIZE_T Offset, |
2369 | OUT gcoBUFOBJ * AlignedBufObj | 2484 | OUT gcoBUFOBJ * AlignedBufObj |
2370 | ); | 2485 | ); |
2371 | 2486 | ||
@@ -2380,7 +2495,7 @@ gcoBUFOBJ_CPUCacheOperation( | |||
2380 | gceSTATUS | 2495 | gceSTATUS |
2381 | gcoBUFOBJ_CPUCacheOperation_Range( | 2496 | gcoBUFOBJ_CPUCacheOperation_Range( |
2382 | IN gcoBUFOBJ BufObj, | 2497 | IN gcoBUFOBJ BufObj, |
2383 | IN gctUINT32 Offset, | 2498 | IN gctSIZE_T Offset, |
2384 | IN gctSIZE_T Length, | 2499 | IN gctSIZE_T Length, |
2385 | IN gceCACHEOPERATION Operation | 2500 | IN gceCACHEOPERATION Operation |
2386 | ); | 2501 | ); |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h index 09bc6313ce1a..f081ea9598df 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine_vg.h | |||
@@ -567,7 +567,7 @@ gcoHAL_ReserveTask( | |||
567 | IN gcoHAL Hal, | 567 | IN gcoHAL Hal, |
568 | IN gceBLOCK Block, | 568 | IN gceBLOCK Block, |
569 | IN gctUINT TaskCount, | 569 | IN gctUINT TaskCount, |
570 | IN gctSIZE_T Bytes, | 570 | IN gctUINT32 Bytes, |
571 | OUT gctPOINTER * Memory | 571 | OUT gctPOINTER * Memory |
572 | ); | 572 | ); |
573 | /******************************************************************************\ | 573 | /******************************************************************************\ |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h index 589739db5ce6..9c2bce6462b0 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h | |||
@@ -30,13 +30,16 @@ extern "C" { | |||
30 | /* Chip models. */ | 30 | /* Chip models. */ |
31 | typedef enum _gceCHIPMODEL | 31 | typedef enum _gceCHIPMODEL |
32 | { | 32 | { |
33 | gcv200 = 0x0200, | ||
33 | gcv300 = 0x0300, | 34 | gcv300 = 0x0300, |
34 | gcv320 = 0x0320, | 35 | gcv320 = 0x0320, |
36 | gcv328 = 0x0328, | ||
35 | gcv350 = 0x0350, | 37 | gcv350 = 0x0350, |
36 | gcv355 = 0x0355, | 38 | gcv355 = 0x0355, |
37 | gcv400 = 0x0400, | 39 | gcv400 = 0x0400, |
38 | gcv410 = 0x0410, | 40 | gcv410 = 0x0410, |
39 | gcv420 = 0x0420, | 41 | gcv420 = 0x0420, |
42 | gcv428 = 0x0428, | ||
40 | gcv450 = 0x0450, | 43 | gcv450 = 0x0450, |
41 | gcv500 = 0x0500, | 44 | gcv500 = 0x0500, |
42 | gcv530 = 0x0530, | 45 | gcv530 = 0x0530, |
@@ -226,6 +229,7 @@ typedef enum _gceFEATURE | |||
226 | gcvFEATURE_TEXTURE_16K, | 229 | gcvFEATURE_TEXTURE_16K, |
227 | gcvFEATURE_PA_FARZCLIPPING_FIX, | 230 | gcvFEATURE_PA_FARZCLIPPING_FIX, |
228 | gcvFEATURE_PE_DITHER_COLORMASK_FIX, | 231 | gcvFEATURE_PE_DITHER_COLORMASK_FIX, |
232 | gcvFEATURE_ZSCALE_FIX, | ||
229 | 233 | ||
230 | gcvFEATURE_MULTI_PIXELPIPES, | 234 | gcvFEATURE_MULTI_PIXELPIPES, |
231 | gcvFEATURE_PIPE_CL, | 235 | gcvFEATURE_PIPE_CL, |
@@ -234,6 +238,14 @@ typedef enum _gceFEATURE | |||
234 | 238 | ||
235 | gcvFEATURE_UNIFIED_SAMPLERS, | 239 | gcvFEATURE_UNIFIED_SAMPLERS, |
236 | gcvFEATURE_CL_PS_WALKER, | 240 | gcvFEATURE_CL_PS_WALKER, |
241 | gcvFEATURE_NEW_HZ, | ||
242 | |||
243 | gcvFEATURE_TX_FRAC_PRECISION_6BIT, | ||
244 | gcvFEATURE_SH_INSTRUCTION_PREFETCH, | ||
245 | gcvFEATURE_PROBE, | ||
246 | |||
247 | gcvFEATURE_BUG_FIXES8, | ||
248 | gcvFEATURE_2D_ALL_QUAD, | ||
237 | 249 | ||
238 | /* Insert features above this comment only. */ | 250 | /* Insert features above this comment only. */ |
239 | gcvFEATURE_COUNT /* Not a feature. */ | 251 | gcvFEATURE_COUNT /* Not a feature. */ |
@@ -256,9 +268,9 @@ gceSWWA; | |||
256 | /* Option Set*/ | 268 | /* Option Set*/ |
257 | typedef enum _gceOPITON | 269 | typedef enum _gceOPITON |
258 | { | 270 | { |
259 | /* HW setting we takes PREFER */ | 271 | /* HW setting we take PREFER */ |
260 | gcvOPTION_PREFER_MULTIPIPE_RS = 0, | 272 | gcvOPTION_PREFER_MULTIPIPE_RS = 0, |
261 | 273 | gcvOPTION_PREFER_ZCONVERT_BYPASS =1, | |
262 | 274 | ||
263 | 275 | ||
264 | gcvOPTION_HW_NULL = 50, | 276 | gcvOPTION_HW_NULL = 50, |
@@ -404,6 +416,20 @@ typedef enum _gceSURF_ROTATION | |||
404 | } | 416 | } |
405 | gceSURF_ROTATION; | 417 | gceSURF_ROTATION; |
406 | 418 | ||
419 | /* Surface flag */ | ||
420 | typedef enum _gceSURF_FLAG | ||
421 | { | ||
422 | /* None flag */ | ||
423 | gcvSURF_FLAG_NONE = 0x0, | ||
424 | /* content is preserved after swap */ | ||
425 | gcvSURF_FLAG_CONTENT_PRESERVED = 0x1, | ||
426 | /* content is updated after swap*/ | ||
427 | gcvSURF_FLAG_CONTENT_UPDATED = 0x2, | ||
428 | /* content is y inverted */ | ||
429 | gcvSURF_FLAG_CONTENT_YINVERTED = 0x4, | ||
430 | } | ||
431 | gceSURF_FLAG; | ||
432 | |||
407 | typedef enum _gceMIPMAP_IMAGE_FORMAT | 433 | typedef enum _gceMIPMAP_IMAGE_FORMAT |
408 | { | 434 | { |
409 | gcvUNKNOWN_MIPMAP_IMAGE_FORMAT = -2 | 435 | gcvUNKNOWN_MIPMAP_IMAGE_FORMAT = -2 |
@@ -1418,9 +1444,7 @@ gceMULTI_GPU_MODE; | |||
1418 | 1444 | ||
1419 | typedef enum _gceMACHINECODE | 1445 | typedef enum _gceMACHINECODE |
1420 | { | 1446 | { |
1421 | gcvMACHINECODE_HOVERJET0 = 0x0, | 1447 | gcvMACHINECODE_ANTUTU0 = 0x0, |
1422 | |||
1423 | gcvMACHINECODE_ANTUTU0, | ||
1424 | 1448 | ||
1425 | gcvMACHINECODE_GLB27_RELEASE_0, | 1449 | gcvMACHINECODE_GLB27_RELEASE_0, |
1426 | 1450 | ||
@@ -1433,6 +1457,20 @@ typedef enum _gceMACHINECODE | |||
1433 | } | 1457 | } |
1434 | gceMACHINECODE; | 1458 | gceMACHINECODE; |
1435 | 1459 | ||
1460 | typedef enum _gceUNIFORMCVT | ||
1461 | { | ||
1462 | gcvUNIFORMCVT_NONE = 0, | ||
1463 | gcvUNIFORMCVT_TO_BOOL, | ||
1464 | gcvUNIFORMCVT_TO_FLOAT, | ||
1465 | } gceUNIFORMCVT; | ||
1466 | |||
1467 | typedef enum _gceHAL_ARG_VERSION | ||
1468 | { | ||
1469 | gcvHAL_ARG_VERSION_V1 = 0x0, | ||
1470 | } | ||
1471 | gceHAL_ARG_VERSION; | ||
1472 | |||
1473 | |||
1436 | /* GL_VIV internal usage */ | 1474 | /* GL_VIV internal usage */ |
1437 | #ifndef GL_MAP_BUFFER_OBJ_VIV | 1475 | #ifndef GL_MAP_BUFFER_OBJ_VIV |
1438 | #define GL_MAP_BUFFER_OBJ_VIV 0x10000 | 1476 | #define GL_MAP_BUFFER_OBJ_VIV 0x10000 |
@@ -1445,10 +1483,6 @@ gceMACHINECODE; | |||
1445 | typedef struct _gckCONTEXT * gckCONTEXT; | 1483 | typedef struct _gckCONTEXT * gckCONTEXT; |
1446 | typedef struct _gcoCMDBUF * gcoCMDBUF; | 1484 | typedef struct _gcoCMDBUF * gcoCMDBUF; |
1447 | 1485 | ||
1448 | #if gcdTEMP_CMD_BUFFER_SIZE | ||
1449 | typedef struct _gcsTEMPCMDBUF * gcsTEMPCMDBUF; | ||
1450 | #endif | ||
1451 | |||
1452 | typedef struct _gcsSTATE_DELTA * gcsSTATE_DELTA_PTR; | 1486 | typedef struct _gcsSTATE_DELTA * gcsSTATE_DELTA_PTR; |
1453 | typedef struct _gcsQUEUE * gcsQUEUE_PTR; | 1487 | typedef struct _gcsQUEUE * gcsQUEUE_PTR; |
1454 | typedef struct _gcoQUEUE * gcoQUEUE; | 1488 | typedef struct _gcoQUEUE * gcoQUEUE; |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h index d23b637d7c0f..e6454ec7412e 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #ifndef __gc_hal_kernel_buffer_h_ | 23 | #ifndef __gc_hal_kernel_buffer_h_ |
24 | #define __gc_hal_kernel_buffer_h_ | 24 | #define __gc_hal_kernel_buffer_h_ |
25 | 25 | ||
26 | |||
27 | #ifdef __cplusplus | 26 | #ifdef __cplusplus |
28 | extern "C" { | 27 | extern "C" { |
29 | #endif | 28 | #endif |
@@ -141,20 +140,20 @@ struct _gcoCMDBUF | |||
141 | gctUINT64 logical; | 140 | gctUINT64 logical; |
142 | 141 | ||
143 | /* Number of bytes in command buffer. */ | 142 | /* Number of bytes in command buffer. */ |
144 | gctUINT bytes; | 143 | gctUINT32 bytes; |
145 | 144 | ||
146 | /* Start offset into the command buffer. */ | 145 | /* Start offset into the command buffer. */ |
147 | gctUINT startOffset; | 146 | gctUINT32 startOffset; |
148 | 147 | ||
149 | /* Current offset into the command buffer. */ | 148 | /* Current offset into the command buffer. */ |
150 | gctUINT offset; | 149 | gctUINT32 offset; |
151 | 150 | ||
152 | /* Number of free bytes in command buffer. */ | 151 | /* Number of free bytes in command buffer. */ |
153 | gctUINT free; | 152 | gctUINT32 free; |
154 | 153 | ||
155 | /* Location of the last reserved area. */ | 154 | /* Location of the last reserved area. */ |
156 | gctUINT64 lastReserve; | 155 | gctUINT64 lastReserve; |
157 | gctUINT lastOffset; | 156 | gctUINT32 lastOffset; |
158 | 157 | ||
159 | #if gcdSECURE_USER | 158 | #if gcdSECURE_USER |
160 | /* Hint array for the current command buffer. */ | 159 | /* Hint array for the current command buffer. */ |
@@ -202,23 +201,17 @@ struct _gcoQUEUE | |||
202 | gcsQUEUE_PTR head; | 201 | gcsQUEUE_PTR head; |
203 | gcsQUEUE_PTR tail; | 202 | gcsQUEUE_PTR tail; |
204 | 203 | ||
205 | #ifdef __QNXNTO__ | 204 | /* chunks of the records. */ |
206 | /* Buffer for records. */ | 205 | gctPOINTER chunks; |
207 | gcsQUEUE_PTR records; | 206 | |
208 | gctUINT32 freeBytes; | ||
209 | gctUINT32 offset; | ||
210 | #else | ||
211 | /* List of free records. */ | 207 | /* List of free records. */ |
212 | gcsQUEUE_PTR freeList; | 208 | gcsQUEUE_PTR freeList; |
213 | #endif | 209 | |
214 | #define gcdIN_QUEUE_RECORD_LIMIT 16 | 210 | #define gcdIN_QUEUE_RECORD_LIMIT 16 |
215 | /* Number of records currently in queue */ | 211 | /* Number of records currently in queue */ |
216 | gctUINT32 recordCount; | 212 | gctUINT32 recordCount; |
217 | }; | 213 | }; |
218 | 214 | ||
219 | |||
220 | #if gcdTEMP_CMD_BUFFER_SIZE | ||
221 | |||
222 | struct _gcsTEMPCMDBUF | 215 | struct _gcsTEMPCMDBUF |
223 | { | 216 | { |
224 | gctUINT32 currentByteSize; | 217 | gctUINT32 currentByteSize; |
@@ -226,8 +219,6 @@ struct _gcsTEMPCMDBUF | |||
226 | gctBOOL inUse; | 219 | gctBOOL inUse; |
227 | }; | 220 | }; |
228 | 221 | ||
229 | #endif | ||
230 | |||
231 | #ifdef __cplusplus | 222 | #ifdef __cplusplus |
232 | } | 223 | } |
233 | #endif | 224 | #endif |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h index 34e3e61bb611..bf2b8173efa8 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | |||
@@ -19,11 +19,18 @@ | |||
19 | *****************************************************************************/ | 19 | *****************************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | |||
23 | #ifndef __gc_hal_options_h_ | 22 | #ifndef __gc_hal_options_h_ |
24 | #define __gc_hal_options_h_ | 23 | #define __gc_hal_options_h_ |
25 | 24 | ||
26 | /* | 25 | /* |
26 | gcdSECURITY | ||
27 | |||
28 | */ | ||
29 | #ifndef gcdSECURITY | ||
30 | # define gcdSECURITY 0 | ||
31 | #endif | ||
32 | |||
33 | /* | ||
27 | gcdPRINT_VERSION | 34 | gcdPRINT_VERSION |
28 | 35 | ||
29 | Print HAL version. | 36 | Print HAL version. |
@@ -63,6 +70,9 @@ | |||
63 | # define VIVANTE_PROFILER_PERDRAW 0 | 70 | # define VIVANTE_PROFILER_PERDRAW 0 |
64 | #endif | 71 | #endif |
65 | 72 | ||
73 | #ifndef VIVANTE_PROFILER_NEW | ||
74 | # define VIVANTE_PROFILER_NEW 0 | ||
75 | #endif | ||
66 | /* | 76 | /* |
67 | gcdUSE_VG | 77 | gcdUSE_VG |
68 | 78 | ||
@@ -752,15 +762,6 @@ | |||
752 | #endif | 762 | #endif |
753 | 763 | ||
754 | /* | 764 | /* |
755 | gcdENABLE_RECOVERY | ||
756 | |||
757 | This define enables the recovery code. | ||
758 | */ | ||
759 | #ifndef gcdENABLE_RECOVERY | ||
760 | # define gcdENABLE_RECOVERY 1 | ||
761 | #endif | ||
762 | |||
763 | /* | ||
764 | gcdRENDER_THREADS | 765 | gcdRENDER_THREADS |
765 | 766 | ||
766 | Number of render threads. Make it zero, and there will be no render | 767 | Number of render threads. Make it zero, and there will be no render |
@@ -966,11 +967,19 @@ | |||
966 | Android only for now. | 967 | Android only for now. |
967 | */ | 968 | */ |
968 | #ifndef gcdENABLE_RENDER_INTO_WINDOW | 969 | #ifndef gcdENABLE_RENDER_INTO_WINDOW |
969 | #if gcdDUMP | ||
970 | # define gcdENABLE_RENDER_INTO_WINDOW 0 | ||
971 | #else | ||
972 | # define gcdENABLE_RENDER_INTO_WINDOW 1 | 970 | # define gcdENABLE_RENDER_INTO_WINDOW 1 |
973 | #endif | 971 | #endif |
972 | |||
973 | /* | ||
974 | gcdENABLE_BLIT_BUFFER_PRESERVE | ||
975 | |||
976 | Render-Into-Window (ie, No-Resolve) does not include preserved swap | ||
977 | behavior. This feature can enable buffer preserve in No-Resolve mode. | ||
978 | When enabled, previous buffer (may be part of ) will be resolve-blitted | ||
979 | to current buffer. | ||
980 | */ | ||
981 | #ifndef gcdENABLE_BLIT_BUFFER_PRESERVE | ||
982 | # define gcdENABLE_BLIT_BUFFER_PRESERVE 0 | ||
974 | #endif | 983 | #endif |
975 | 984 | ||
976 | /* | 985 | /* |
@@ -1111,15 +1120,65 @@ | |||
1111 | #endif | 1120 | #endif |
1112 | 1121 | ||
1113 | /* | 1122 | /* |
1114 | gcdTEMP_CMD_BUFFER_SIZE | 1123 | gcdYINVERTED_RENDERING |
1115 | When it's zero, use original command buffer generation logic. | 1124 | When it's not zero, we will rendering display buffer |
1116 | Otherwise, set it as 0x4000 as temp buffer size. | 1125 | with top-bottom direction. All other offscreen rendering |
1126 | will be bottom-top, which follow OpenGL ES spec. | ||
1127 | */ | ||
1128 | #ifndef gcdYINVERTED_RENDERING | ||
1129 | # define gcdYINVERTED_RENDERING 1 | ||
1130 | #endif | ||
1131 | |||
1132 | #if gcdYINVERTED_RENDERING | ||
1133 | /* disable unaligned linear composition adjust in Y-inverted rendering mode. */ | ||
1134 | # undef gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST | ||
1135 | # define gcdANDROID_UNALIGNED_LINEAR_COMPOSITION_ADJUST 0 | ||
1136 | #endif | ||
1137 | |||
1138 | /* | ||
1139 | gcdFENCE_WAIT_LOOP_COUNT | ||
1140 | Wait fence, loop count. | ||
1117 | */ | 1141 | */ |
1142 | #ifndef gcdFENCE_WAIT_LOOP_COUNT | ||
1143 | # define gcdFENCE_WAIT_LOOP_COUNT 100 | ||
1144 | #endif | ||
1118 | 1145 | ||
1119 | #ifndef gcdTEMP_CMD_BUFFER_SIZE | 1146 | /* |
1120 | #define gcdTEMP_CMD_BUFFER_SIZE 0 | 1147 | gcdHAL_3D_DRAWBLIT |
1148 | When it's not zero, we will enable HAL 3D drawblit | ||
1149 | to replace client 3dblit. | ||
1150 | */ | ||
1151 | #ifndef gcdHAL_3D_DRAWBLIT | ||
1152 | # define gcdHAL_3D_DRAWBLIT 1 | ||
1121 | #endif | 1153 | #endif |
1122 | 1154 | ||
1155 | /* | ||
1156 | gcdPARTIAL_FAST_CLEAR | ||
1157 | When it's not zero, partial fast clear is enabled. | ||
1158 | Depends on gcdHAL_3D_DRAWBLIT, if gcdHAL_3D_DRAWBLIT is not enabled, | ||
1159 | only available when scissor box is completely aligned. | ||
1160 | Expremental, under test. | ||
1161 | */ | ||
1162 | #ifndef gcdPARTIAL_FAST_CLEAR | ||
1163 | # define gcdPARTIAL_FAST_CLEAR 0 | ||
1164 | #endif | ||
1165 | |||
1166 | /* Force disable bank alignment when partial fast clear enabled. */ | ||
1167 | #if gcdPARTIAL_FAST_CLEAR | ||
1168 | # undef gcdENABLE_BANK_ALIGNMENT | ||
1169 | # define gcdENABLE_BANK_ALIGNMENT 0 | ||
1170 | #endif | ||
1171 | |||
1172 | /* | ||
1173 | gcdREMOVE_SURF_ORIENTATION | ||
1174 | When it's not zero, we will remove surface orientation function. | ||
1175 | It wil become to a parameter of resolve function. | ||
1176 | */ | ||
1177 | #ifndef gcdREMOVE_SURF_ORIENTATION | ||
1178 | # define gcdREMOVE_SURF_ORIENTATION 0 | ||
1179 | #endif | ||
1180 | |||
1181 | |||
1123 | #define LINUX_CMA_FSL 1 | 1182 | #define LINUX_CMA_FSL 1 |
1124 | #define DYNAMIC_MEMORY_RECORD 1 | 1183 | #define DYNAMIC_MEMORY_RECORD 1 |
1125 | 1184 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h index b416b63674f4..73cd53929ec7 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_profiler.h | |||
@@ -23,6 +23,10 @@ | |||
23 | #ifndef __gc_hal_profiler_h_ | 23 | #ifndef __gc_hal_profiler_h_ |
24 | #define __gc_hal_profiler_h_ | 24 | #define __gc_hal_profiler_h_ |
25 | 25 | ||
26 | #if VIVANTE_PROFILER_NEW | ||
27 | #include "gc_hal_engine.h" | ||
28 | #endif | ||
29 | |||
26 | #ifdef __cplusplus | 30 | #ifdef __cplusplus |
27 | extern "C" { | 31 | extern "C" { |
28 | #endif | 32 | #endif |
@@ -190,6 +194,7 @@ extern "C" { | |||
190 | #define VPG_FRAME 0x190000 | 194 | #define VPG_FRAME 0x190000 |
191 | #define VPG_ES11_DRAW 0x200000 | 195 | #define VPG_ES11_DRAW 0x200000 |
192 | #define VPG_ES30_DRAW 0x210000 | 196 | #define VPG_ES30_DRAW 0x210000 |
197 | #define VPG_VG11_TIME 0x220000 | ||
193 | #define VPG_END 0xff0000 | 198 | #define VPG_END 0xff0000 |
194 | 199 | ||
195 | /* Info. */ | 200 | /* Info. */ |
@@ -417,6 +422,10 @@ typedef struct _gcsPROFILER_COUNTERS | |||
417 | } | 422 | } |
418 | gcsPROFILER_COUNTERS; | 423 | gcsPROFILER_COUNTERS; |
419 | 424 | ||
425 | #if VIVANTE_PROFILER_NEW | ||
426 | #define NumOfDrawBuf 64 | ||
427 | #endif | ||
428 | |||
420 | /* HAL profile information. */ | 429 | /* HAL profile information. */ |
421 | typedef struct _gcsPROFILER | 430 | typedef struct _gcsPROFILER |
422 | { | 431 | { |
@@ -477,6 +486,11 @@ typedef struct _gcsPROFILER | |||
477 | gctUINT32 prevPSTexInstCount; | 486 | gctUINT32 prevPSTexInstCount; |
478 | gctUINT32 prevPSPixelCount; | 487 | gctUINT32 prevPSPixelCount; |
479 | 488 | ||
489 | #if VIVANTE_PROFILER_NEW | ||
490 | gcoBUFOBJ newCounterBuf[NumOfDrawBuf]; | ||
491 | gctUINT32 curBufId; | ||
492 | #endif | ||
493 | |||
480 | } | 494 | } |
481 | gcsPROFILER; | 495 | gcsPROFILER; |
482 | 496 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h index 4d128b70685d..8244b4ecd1c1 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_rename.h | |||
@@ -50,8 +50,9 @@ | |||
50 | #define gckOS_FreeContiguous gcmHAL2D(gckOS_FreeContiguous) | 50 | #define gckOS_FreeContiguous gcmHAL2D(gckOS_FreeContiguous) |
51 | #define gckOS_GetPageSize gcmHAL2D(gckOS_GetPageSize) | 51 | #define gckOS_GetPageSize gcmHAL2D(gckOS_GetPageSize) |
52 | #define gckOS_GetPhysicalAddress gcmHAL2D(gckOS_GetPhysicalAddress) | 52 | #define gckOS_GetPhysicalAddress gcmHAL2D(gckOS_GetPhysicalAddress) |
53 | #define gckOS_GetPhysicalAddressProcess gcmHAL2D(gckOS_GetPhysicalAddressProcess) | 53 | #define gckOS_UserLogicalToPhysical gcmHAL2D(gckOS_UserLogicalToPhysical) |
54 | #define gckOS_MapPhysical gcmHAL2D(gckOS_MapPhysical) | 54 | #define gckOS_GetPhysicalAddressProcess gcmHAL2D(gckOS_GetPhysicalAddressProcess) |
55 | #define gckOS_MapPhysical gcmHAL2D(gckOS_MapPhysical) | ||
55 | #define gckOS_UnmapPhysical gcmHAL2D(gckOS_UnmapPhysical) | 56 | #define gckOS_UnmapPhysical gcmHAL2D(gckOS_UnmapPhysical) |
56 | #define gckOS_ReadRegister gcmHAL2D(gckOS_ReadRegister) | 57 | #define gckOS_ReadRegister gcmHAL2D(gckOS_ReadRegister) |
57 | #define gckOS_WriteRegister gcmHAL2D(gckOS_WriteRegister) | 58 | #define gckOS_WriteRegister gcmHAL2D(gckOS_WriteRegister) |
@@ -151,7 +152,6 @@ | |||
151 | #define gckHARDWARE_Execute gcmHAL2D(gckHARDWARE_Execute) | 152 | #define gckHARDWARE_Execute gcmHAL2D(gckHARDWARE_Execute) |
152 | #define gckHARDWARE_End gcmHAL2D(gckHARDWARE_End) | 153 | #define gckHARDWARE_End gcmHAL2D(gckHARDWARE_End) |
153 | #define gckHARDWARE_Nop gcmHAL2D(gckHARDWARE_Nop) | 154 | #define gckHARDWARE_Nop gcmHAL2D(gckHARDWARE_Nop) |
154 | #define gckHARDWARE_Wait gcmHAL2D(gckHARDWARE_Wait) | ||
155 | #define gckHARDWARE_PipeSelect gcmHAL2D(gckHARDWARE_PipeSelect) | 155 | #define gckHARDWARE_PipeSelect gcmHAL2D(gckHARDWARE_PipeSelect) |
156 | #define gckHARDWARE_Link gcmHAL2D(gckHARDWARE_Link) | 156 | #define gckHARDWARE_Link gcmHAL2D(gckHARDWARE_Link) |
157 | #define gckHARDWARE_Event gcmHAL2D(gckHARDWARE_Event) | 157 | #define gckHARDWARE_Event gcmHAL2D(gckHARDWARE_Event) |
@@ -164,7 +164,6 @@ | |||
164 | #define gckHARDWARE_AlignToTile gcmHAL2D(gckHARDWARE_AlignToTile) | 164 | #define gckHARDWARE_AlignToTile gcmHAL2D(gckHARDWARE_AlignToTile) |
165 | #define gckHARDWARE_UpdateQueueTail gcmHAL2D(gckHARDWARE_UpdateQueueTail) | 165 | #define gckHARDWARE_UpdateQueueTail gcmHAL2D(gckHARDWARE_UpdateQueueTail) |
166 | #define gckHARDWARE_ConvertLogical gcmHAL2D(gckHARDWARE_ConvertLogical) | 166 | #define gckHARDWARE_ConvertLogical gcmHAL2D(gckHARDWARE_ConvertLogical) |
167 | #define gckHARDWARE_ConvertPhysical gcmHAL2D(gckHARDWARE_ConvertPhysical) | ||
168 | #define gckHARDWARE_Interrupt gcmHAL2D(gckHARDWARE_Interrupt) | 167 | #define gckHARDWARE_Interrupt gcmHAL2D(gckHARDWARE_Interrupt) |
169 | #define gckHARDWARE_SetMMU gcmHAL2D(gckHARDWARE_SetMMU) | 168 | #define gckHARDWARE_SetMMU gcmHAL2D(gckHARDWARE_SetMMU) |
170 | #define gckHARDWARE_FlushMMU gcmHAL2D(gckHARDWARE_FlushMMU) | 169 | #define gckHARDWARE_FlushMMU gcmHAL2D(gckHARDWARE_FlushMMU) |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h index 0fd12154ab4c..fa9a125eaf15 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_types.h | |||
@@ -26,6 +26,29 @@ | |||
26 | #include "gc_hal_version.h" | 26 | #include "gc_hal_version.h" |
27 | #include "gc_hal_options.h" | 27 | #include "gc_hal_options.h" |
28 | 28 | ||
29 | #if !defined(VIV_KMD) | ||
30 | #if defined(__KERNEL__) | ||
31 | #include "linux/version.h" | ||
32 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) | ||
33 | typedef unsigned long uintptr_t; | ||
34 | # endif | ||
35 | # include "linux/types.h" | ||
36 | #elif defined(UNDER_CE) | ||
37 | #include <crtdefs.h> | ||
38 | #elif defined(_MSC_VER) && (_MSC_VER <= 1500) | ||
39 | #include <crtdefs.h> | ||
40 | #include "vadefs.h" | ||
41 | #elif defined(__QNXNTO__) | ||
42 | #define _QNX_SOURCE | ||
43 | #include <stdint.h> | ||
44 | #include <stddef.h> | ||
45 | #else | ||
46 | #include <stdlib.h> | ||
47 | #include <stddef.h> | ||
48 | #include <stdint.h> | ||
49 | #endif | ||
50 | #endif | ||
51 | |||
29 | #ifdef _WIN32 | 52 | #ifdef _WIN32 |
30 | #pragma warning(disable:4127) /* Conditional expression is constant (do { } | 53 | #pragma warning(disable:4127) /* Conditional expression is constant (do { } |
31 | ** while(0)). */ | 54 | ** while(0)). */ |
@@ -130,7 +153,6 @@ typedef int gctBOOL; | |||
130 | typedef gctBOOL * gctBOOL_PTR; | 153 | typedef gctBOOL * gctBOOL_PTR; |
131 | 154 | ||
132 | typedef int gctINT; | 155 | typedef int gctINT; |
133 | typedef long gctLONG; | ||
134 | typedef signed char gctINT8; | 156 | typedef signed char gctINT8; |
135 | typedef signed short gctINT16; | 157 | typedef signed short gctINT16; |
136 | typedef signed int gctINT32; | 158 | typedef signed int gctINT32; |
@@ -147,7 +169,7 @@ typedef unsigned char gctUINT8; | |||
147 | typedef unsigned short gctUINT16; | 169 | typedef unsigned short gctUINT16; |
148 | typedef unsigned int gctUINT32; | 170 | typedef unsigned int gctUINT32; |
149 | typedef unsigned long long gctUINT64; | 171 | typedef unsigned long long gctUINT64; |
150 | typedef unsigned long gctUINTPTR_T; | 172 | typedef uintptr_t gctUINTPTR_T; |
151 | 173 | ||
152 | typedef gctUINT * gctUINT_PTR; | 174 | typedef gctUINT * gctUINT_PTR; |
153 | typedef gctUINT8 * gctUINT8_PTR; | 175 | typedef gctUINT8 * gctUINT8_PTR; |
@@ -155,7 +177,7 @@ typedef gctUINT16 * gctUINT16_PTR; | |||
155 | typedef gctUINT32 * gctUINT32_PTR; | 177 | typedef gctUINT32 * gctUINT32_PTR; |
156 | typedef gctUINT64 * gctUINT64_PTR; | 178 | typedef gctUINT64 * gctUINT64_PTR; |
157 | 179 | ||
158 | typedef unsigned long gctSIZE_T; | 180 | typedef size_t gctSIZE_T; |
159 | typedef gctSIZE_T * gctSIZE_T_PTR; | 181 | typedef gctSIZE_T * gctSIZE_T_PTR; |
160 | typedef gctUINT32 gctTRACE; | 182 | typedef gctUINT32 gctTRACE; |
161 | 183 | ||
@@ -181,6 +203,7 @@ typedef gctUINT32 gctTRACE; | |||
181 | #define gcvMINUINT32 0x80000000 | 203 | #define gcvMINUINT32 0x80000000 |
182 | #define gcvMAXUINT64 0xffffffffffffffff | 204 | #define gcvMAXUINT64 0xffffffffffffffff |
183 | #define gcvMINUINT64 0x8000000000000000 | 205 | #define gcvMINUINT64 0x8000000000000000 |
206 | #define gcvMAXUINTPTR_T (~(gctUINTPTR_T)0) | ||
184 | 207 | ||
185 | typedef float gctFLOAT; | 208 | typedef float gctFLOAT; |
186 | typedef signed int gctFIXED_POINT; | 209 | typedef signed int gctFIXED_POINT; |
@@ -670,608 +693,6 @@ gceSTATUS; | |||
670 | ((Address & (~0U << Name ## _LSB)) == (Name ## _Address >> 2)) \ | 693 | ((Address & (~0U << Name ## _LSB)) == (Name ## _Address >> 2)) \ |
671 | ) | 694 | ) |
672 | 695 | ||
673 | /******************************************************************************* | ||
674 | ** | ||
675 | ** A set of macros to aid state loading. | ||
676 | ** | ||
677 | ** ARGUMENTS: | ||
678 | ** | ||
679 | ** CommandBuffer Pointer to a gcoCMDBUF object. | ||
680 | ** StateDelta Pointer to a gcsSTATE_DELTA state delta structure. | ||
681 | ** Memory Destination memory pointer of gctUINT32_PTR type. | ||
682 | ** PartOfContext Whether or not the state is a part of the context. | ||
683 | ** FixedPoint Whether or not the state is of the fixed point format. | ||
684 | ** Count Number of consecutive states to be loaded. | ||
685 | ** Address State address. | ||
686 | ** Data Data to be set to the state. | ||
687 | */ | ||
688 | |||
689 | /*----------------------------------------------------------------------------*/ | ||
690 | |||
691 | #if gcmIS_DEBUG(gcdDEBUG_CODE) | ||
692 | |||
693 | # define gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count) \ | ||
694 | CommandBuffer->lastLoadStatePtr = gcmPTR_TO_UINT64(Memory); \ | ||
695 | CommandBuffer->lastLoadStateAddress = Address; \ | ||
696 | CommandBuffer->lastLoadStateCount = Count | ||
697 | |||
698 | # define gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address) \ | ||
699 | gcmASSERT( \ | ||
700 | (gctUINT) (Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastLoadStatePtr, gctUINT32_PTR) - 1) \ | ||
701 | == \ | ||
702 | (gctUINT) (Address - CommandBuffer->lastLoadStateAddress) \ | ||
703 | ); \ | ||
704 | \ | ||
705 | gcmASSERT(CommandBuffer->lastLoadStateCount > 0); \ | ||
706 | \ | ||
707 | CommandBuffer->lastLoadStateCount -= 1 | ||
708 | |||
709 | # define gcmVERIFYLOADSTATEDONE(CommandBuffer) \ | ||
710 | gcmASSERT(CommandBuffer->lastLoadStateCount == 0) | ||
711 | |||
712 | #else | ||
713 | |||
714 | # define gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count) | ||
715 | # define gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address) | ||
716 | # define gcmVERIFYLOADSTATEDONE(CommandBuffer) | ||
717 | |||
718 | #endif | ||
719 | |||
720 | #if gcdSECURE_USER | ||
721 | |||
722 | # define gcmDEFINESECUREUSER() \ | ||
723 | gctUINT __secure_user_offset__; \ | ||
724 | gctUINT32_PTR __secure_user_hintArray__; | ||
725 | |||
726 | # define gcmBEGINSECUREUSER() \ | ||
727 | __secure_user_offset__ = reserve->lastOffset; \ | ||
728 | \ | ||
729 | __secure_user_hintArray__ = gcmUINT64_TO_PTR(reserve->hintArrayTail) | ||
730 | |||
731 | # define gcmENDSECUREUSER() \ | ||
732 | reserve->hintArrayTail = gcmPTR_TO_UINT64(__secure_user_hintArray__) | ||
733 | |||
734 | # define gcmSKIPSECUREUSER() \ | ||
735 | __secure_user_offset__ += gcmSIZEOF(gctUINT32) | ||
736 | |||
737 | # define gcmUPDATESECUREUSER() \ | ||
738 | *__secure_user_hintArray__ = __secure_user_offset__; \ | ||
739 | \ | ||
740 | __secure_user_offset__ += gcmSIZEOF(gctUINT32); \ | ||
741 | __secure_user_hintArray__ += 1 | ||
742 | |||
743 | #else | ||
744 | |||
745 | # define gcmDEFINESECUREUSER() | ||
746 | # define gcmBEGINSECUREUSER() | ||
747 | # define gcmENDSECUREUSER() | ||
748 | # define gcmSKIPSECUREUSER() | ||
749 | # define gcmUPDATESECUREUSER() | ||
750 | |||
751 | #endif | ||
752 | |||
753 | /*----------------------------------------------------------------------------*/ | ||
754 | |||
755 | #if gcdDUMP | ||
756 | # define gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, Data) \ | ||
757 | if (FixedPoint) \ | ||
758 | { \ | ||
759 | gcmDUMP(gcvNULL, "#[state.x 0x%04X 0x%08X]", \ | ||
760 | Address, Data \ | ||
761 | ); \ | ||
762 | } \ | ||
763 | else \ | ||
764 | { \ | ||
765 | gcmDUMP(gcvNULL, "#[state 0x%04X 0x%08X]", \ | ||
766 | Address, Data \ | ||
767 | ); \ | ||
768 | } | ||
769 | #else | ||
770 | # define gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, Data) | ||
771 | #endif | ||
772 | |||
773 | #define gcmDEFINESTATEBUFFER(CommandBuffer, StateDelta, Memory, ReserveSize) \ | ||
774 | gcmDEFINESECUREUSER() \ | ||
775 | gctSIZE_T ReserveSize; \ | ||
776 | gcoCMDBUF CommandBuffer; \ | ||
777 | gctUINT32_PTR Memory; \ | ||
778 | gcsSTATE_DELTA_PTR StateDelta | ||
779 | |||
780 | #define gcmBEGINSTATEBUFFER(Hardware, CommandBuffer, StateDelta, Memory, ReserveSize) \ | ||
781 | { \ | ||
782 | gcmONERROR(gcoBUFFER_Reserve( \ | ||
783 | Hardware->buffer, ReserveSize, gcvTRUE, &CommandBuffer \ | ||
784 | )); \ | ||
785 | \ | ||
786 | Memory = (gctUINT32_PTR) gcmUINT64_TO_PTR(CommandBuffer->lastReserve); \ | ||
787 | \ | ||
788 | StateDelta = Hardware->delta; \ | ||
789 | \ | ||
790 | gcmBEGINSECUREUSER(); \ | ||
791 | } | ||
792 | |||
793 | #define gcmENDSTATEBUFFER(Hardware, CommandBuffer, Memory, ReserveSize) \ | ||
794 | { \ | ||
795 | gcmENDSECUREUSER(); \ | ||
796 | \ | ||
797 | gcmASSERT( \ | ||
798 | gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT8_PTR) + ReserveSize \ | ||
799 | == \ | ||
800 | (gctUINT8_PTR) Memory \ | ||
801 | ); \ | ||
802 | } | ||
803 | |||
804 | /*----------------------------------------------------------------------------*/ | ||
805 | |||
806 | #define gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, Count) \ | ||
807 | { \ | ||
808 | gcmASSERT(((Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT32_PTR)) & 1) == 0); \ | ||
809 | gcmASSERT((gctUINT32)Count <= 1024); \ | ||
810 | \ | ||
811 | gcmVERIFYLOADSTATEDONE(CommandBuffer); \ | ||
812 | \ | ||
813 | gcmSTORELOADSTATE(CommandBuffer, Memory, Address, Count); \ | ||
814 | \ | ||
815 | *Memory++ \ | ||
816 | = gcmSETFIELDVALUE(0, AQ_COMMAND_LOAD_STATE_COMMAND, OPCODE, LOAD_STATE) \ | ||
817 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, FLOAT, FixedPoint) \ | ||
818 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, COUNT, Count) \ | ||
819 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, ADDRESS, Address); \ | ||
820 | \ | ||
821 | gcmSKIPSECUREUSER(); \ | ||
822 | } | ||
823 | |||
824 | #define gcmENDSTATEBATCH(CommandBuffer, Memory) \ | ||
825 | { \ | ||
826 | gcmVERIFYLOADSTATEDONE(CommandBuffer); \ | ||
827 | \ | ||
828 | gcmASSERT(((Memory - gcmUINT64_TO_TYPE(CommandBuffer->lastReserve, gctUINT32_PTR)) & 1) == 0); \ | ||
829 | } | ||
830 | |||
831 | /*----------------------------------------------------------------------------*/ | ||
832 | |||
833 | #define gcmSETSTATEDATA(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
834 | Address, Data) \ | ||
835 | { \ | ||
836 | gctUINT32 __temp_data32__; \ | ||
837 | \ | ||
838 | gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address); \ | ||
839 | \ | ||
840 | __temp_data32__ = Data; \ | ||
841 | \ | ||
842 | *Memory++ = __temp_data32__; \ | ||
843 | \ | ||
844 | gcoHARDWARE_UpdateDelta( \ | ||
845 | StateDelta, FixedPoint, Address, 0, __temp_data32__ \ | ||
846 | ); \ | ||
847 | \ | ||
848 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
849 | \ | ||
850 | gcmUPDATESECUREUSER(); \ | ||
851 | } | ||
852 | |||
853 | #define gcmSETSTATEDATAWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
854 | Address, Mask, Data) \ | ||
855 | { \ | ||
856 | gctUINT32 __temp_data32__; \ | ||
857 | \ | ||
858 | gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address); \ | ||
859 | \ | ||
860 | __temp_data32__ = Data; \ | ||
861 | \ | ||
862 | *Memory++ = __temp_data32__; \ | ||
863 | \ | ||
864 | gcoHARDWARE_UpdateDelta( \ | ||
865 | StateDelta, FixedPoint, Address, Mask, __temp_data32__ \ | ||
866 | ); \ | ||
867 | \ | ||
868 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
869 | \ | ||
870 | gcmUPDATESECUREUSER(); \ | ||
871 | } | ||
872 | |||
873 | |||
874 | #define gcmSETCTRLSTATE(StateDelta, CommandBuffer, Memory, Address, Data) \ | ||
875 | { \ | ||
876 | gctUINT32 __temp_data32__; \ | ||
877 | \ | ||
878 | gcmVERIFYLOADSTATE(CommandBuffer, Memory, Address); \ | ||
879 | \ | ||
880 | __temp_data32__ = Data; \ | ||
881 | \ | ||
882 | *Memory++ = __temp_data32__; \ | ||
883 | \ | ||
884 | gcmDUMPSTATEDATA(StateDelta, gcvFALSE, Address, __temp_data32__); \ | ||
885 | \ | ||
886 | gcmSKIPSECUREUSER(); \ | ||
887 | } | ||
888 | |||
889 | #define gcmSETFILLER(CommandBuffer, Memory) \ | ||
890 | { \ | ||
891 | gcmVERIFYLOADSTATEDONE(CommandBuffer); \ | ||
892 | \ | ||
893 | Memory += 1; \ | ||
894 | \ | ||
895 | gcmSKIPSECUREUSER(); \ | ||
896 | } | ||
897 | |||
898 | /*----------------------------------------------------------------------------*/ | ||
899 | |||
900 | #define gcmSETSINGLESTATE(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
901 | Address, Data) \ | ||
902 | { \ | ||
903 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
904 | gcmSETSTATEDATA(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
905 | Address, Data); \ | ||
906 | gcmENDSTATEBATCH(CommandBuffer, Memory); \ | ||
907 | } | ||
908 | |||
909 | #define gcmSETSINGLESTATEWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
910 | Address, Mask, Data) \ | ||
911 | { \ | ||
912 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
913 | gcmSETSTATEDATAWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
914 | Address, Mask, Data); \ | ||
915 | gcmENDSTATEBATCH(CommandBuffer, Memory); \ | ||
916 | } | ||
917 | |||
918 | |||
919 | #define gcmSETSINGLECTRLSTATE(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
920 | Address, Data) \ | ||
921 | { \ | ||
922 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
923 | gcmSETCTRLSTATE(StateDelta, CommandBuffer, Memory, Address, Data); \ | ||
924 | gcmENDSTATEBATCH(CommandBuffer, Memory); \ | ||
925 | } | ||
926 | |||
927 | |||
928 | |||
929 | #define gcmSETSEMASTALLPIPE(StateDelta, CommandBuffer, Memory, Data) \ | ||
930 | { \ | ||
931 | gcmSETSINGLESTATE(StateDelta, CommandBuffer, Memory, gcvFALSE, AQSemaphoreRegAddrs, Data); \ | ||
932 | \ | ||
933 | *Memory++ = gcmSETFIELDVALUE(0, STALL_COMMAND, OPCODE, STALL); \ | ||
934 | \ | ||
935 | *Memory++ = Data; \ | ||
936 | \ | ||
937 | gcmDUMP(gcvNULL, "#[stall 0x%08X 0x%08X]", \ | ||
938 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, SOURCE, FRONT_END), \ | ||
939 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, DESTINATION, PIXEL_ENGINE)); \ | ||
940 | \ | ||
941 | gcmSKIPSECUREUSER(); \ | ||
942 | } | ||
943 | |||
944 | /******************************************************************************* | ||
945 | ** | ||
946 | ** gcmSETSTARTDECOMMAND | ||
947 | ** | ||
948 | ** Form a START_DE command. | ||
949 | ** | ||
950 | ** ARGUMENTS: | ||
951 | ** | ||
952 | ** Memory Destination memory pointer of gctUINT32_PTR type. | ||
953 | ** Count Number of the rectangles. | ||
954 | */ | ||
955 | |||
956 | #define gcmSETSTARTDECOMMAND(Memory, Count) \ | ||
957 | { \ | ||
958 | *Memory++ \ | ||
959 | = gcmSETFIELDVALUE(0, AQ_COMMAND_START_DE_COMMAND, OPCODE, START_DE) \ | ||
960 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, COUNT, Count) \ | ||
961 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, DATA_COUNT, 0); \ | ||
962 | \ | ||
963 | *Memory++ = 0xDEADDEED; \ | ||
964 | } | ||
965 | |||
966 | |||
967 | /*----------------------------------------------------------------------------*/ | ||
968 | #if !gcdTEMP_CMD_BUFFER_SIZE | ||
969 | |||
970 | #define gcmDEFINESTATEBUFFER_NEW(CommandBuffer, StateDelta, Memory, ReserveSize) \ | ||
971 | gcmDEFINESTATEBUFFER(CommandBuffer, StateDelta, Memory, ReserveSize) | ||
972 | |||
973 | #define gcmBEGINSTATEBUFFER_NEW(Hardware, CommandBuffer, StateDelta, Memory, ReserveSize, OutSide) \ | ||
974 | gcmBEGINSTATEBUFFER(Hardware, CommandBuffer, StateDelta, Memory, ReserveSize) | ||
975 | |||
976 | #define gcmENDSTATEBUFFER_NEW(Hardware, CommandBuffer, Memory, ReserveSize, OutSide) \ | ||
977 | gcmENDSTATEBUFFER(Hardware, CommandBuffer, Memory, ReserveSize) | ||
978 | |||
979 | /*----------------------------------------------------------------------------*/ | ||
980 | |||
981 | #define gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, Count) \ | ||
982 | gcmBEGINSTATEBATCH(CommandBuffer, Memory, FixedPoint, Address, Count) | ||
983 | |||
984 | #define gcmENDSTATEBATCH_NEW(CommandBuffer, Memory) \ | ||
985 | gcmENDSTATEBATCH(CommandBuffer, Memory) | ||
986 | /*----------------------------------------------------------------------------*/ | ||
987 | |||
988 | #define gcmSETSTATEDATA_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
989 | Address, Data) \ | ||
990 | gcmSETSTATEDATA(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
991 | Address, Data) | ||
992 | |||
993 | #define gcmSETSTATEDATAWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
994 | Address, Mask, Data) \ | ||
995 | gcmSETSTATEDATAWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
996 | Address, Mask, Data) \ | ||
997 | |||
998 | |||
999 | #define gcmSETCTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, Address, Data) \ | ||
1000 | gcmSETCTRLSTATE(StateDelta, CommandBuffer, Memory, Address, Data) | ||
1001 | |||
1002 | #define gcmSETFILLER_NEW(CommandBuffer, Memory) \ | ||
1003 | gcmSETFILLER(CommandBuffer, Memory) | ||
1004 | |||
1005 | /*----------------------------------------------------------------------------*/ | ||
1006 | |||
1007 | #define gcmSETSINGLESTATE_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1008 | Address, Data) \ | ||
1009 | gcmSETSINGLESTATE(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1010 | Address, Data) | ||
1011 | |||
1012 | #define gcmSETSINGLESTATEWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1013 | Address, Mask, Data) \ | ||
1014 | gcmSETSINGLESTATEWITHMASK(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1015 | Address, Mask, Data) | ||
1016 | |||
1017 | |||
1018 | #define gcmSETSINGLECTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1019 | Address, Data) \ | ||
1020 | gcmSETSINGLECTRLSTATE(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1021 | Address, Data) | ||
1022 | |||
1023 | |||
1024 | |||
1025 | #define gcmSETSEMASTALLPIPE_NEW(StateDelta, CommandBuffer, Memory, Data) \ | ||
1026 | gcmSETSEMASTALLPIPE(StateDelta, CommandBuffer, Memory, Data) | ||
1027 | |||
1028 | #define gcmSETSTARTDECOMMAND_NEW(CommandBuffer, Memory, Count) \ | ||
1029 | gcmSETSTARTDECOMMAND(CommandBuffer, Memory, Count) | ||
1030 | |||
1031 | |||
1032 | #else | ||
1033 | |||
1034 | #define gcmDEFINESTATEBUFFER_NEW(CommandBuffer, StateDelta, Memory, ReserveSize) \ | ||
1035 | gcmDEFINESECUREUSER() \ | ||
1036 | gctSIZE_T ReserveSize = 0; \ | ||
1037 | gcsTEMPCMDBUF CommandBuffer = gcvNULL; \ | ||
1038 | gctUINT32_PTR Memory; \ | ||
1039 | gcsSTATE_DELTA_PTR StateDelta | ||
1040 | |||
1041 | #define gcmBEGINSTATEBUFFER_NEW(Hardware, CommandBuffer, StateDelta, Memory, ReserveSize, OutSide) \ | ||
1042 | { \ | ||
1043 | if (OutSide) \ | ||
1044 | {\ | ||
1045 | Memory = (gctUINT32_PTR)*OutSide; \ | ||
1046 | }\ | ||
1047 | else \ | ||
1048 | {\ | ||
1049 | gcmONERROR(gcoBUFFER_StartTEMPCMDBUF( \ | ||
1050 | Hardware->buffer, &CommandBuffer \ | ||
1051 | ));\ | ||
1052 | \ | ||
1053 | Memory = (gctUINT32_PTR)(CommandBuffer->buffer); \ | ||
1054 | \ | ||
1055 | }\ | ||
1056 | StateDelta = Hardware->delta; \ | ||
1057 | \ | ||
1058 | gcmBEGINSECUREUSER(); \ | ||
1059 | } | ||
1060 | |||
1061 | #define gcmENDSTATEBUFFER_NEW(Hardware, CommandBuffer, Memory, ReserveSize, OutSide) \ | ||
1062 | { \ | ||
1063 | gcmENDSECUREUSER(); \ | ||
1064 | \ | ||
1065 | ReserveSize = ReserveSize; \ | ||
1066 | \ | ||
1067 | if (OutSide) \ | ||
1068 | {\ | ||
1069 | *OutSide = Memory; \ | ||
1070 | }\ | ||
1071 | else \ | ||
1072 | {\ | ||
1073 | CommandBuffer->currentByteSize = (gctUINT8_PTR)Memory - \ | ||
1074 | (gctUINT8_PTR)CommandBuffer->buffer; \ | ||
1075 | \ | ||
1076 | gcmONERROR(gcoBUFFER_EndTEMPCMDBUF(Hardware->buffer));\ | ||
1077 | }\ | ||
1078 | } | ||
1079 | |||
1080 | /*----------------------------------------------------------------------------*/ | ||
1081 | |||
1082 | #define gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, Count) \ | ||
1083 | { \ | ||
1084 | gcmASSERT((gctUINT32)Count <= 1024); \ | ||
1085 | \ | ||
1086 | *Memory++ \ | ||
1087 | = gcmSETFIELDVALUE(0, AQ_COMMAND_LOAD_STATE_COMMAND, OPCODE, LOAD_STATE) \ | ||
1088 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, FLOAT, FixedPoint) \ | ||
1089 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, COUNT, Count) \ | ||
1090 | | gcmSETFIELD (0, AQ_COMMAND_LOAD_STATE_COMMAND, ADDRESS, Address); \ | ||
1091 | \ | ||
1092 | gcmSKIPSECUREUSER(); \ | ||
1093 | } | ||
1094 | |||
1095 | #define gcmENDSTATEBATCH_NEW(CommandBuffer, Memory) | ||
1096 | |||
1097 | /*----------------------------------------------------------------------------*/ | ||
1098 | |||
1099 | #define gcmSETSTATEDATA_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1100 | Address, Data) \ | ||
1101 | { \ | ||
1102 | gctUINT32 __temp_data32__; \ | ||
1103 | \ | ||
1104 | __temp_data32__ = Data; \ | ||
1105 | \ | ||
1106 | *Memory++ = __temp_data32__; \ | ||
1107 | \ | ||
1108 | gcoHARDWARE_UpdateDelta( \ | ||
1109 | StateDelta, FixedPoint, Address, 0, __temp_data32__ \ | ||
1110 | ); \ | ||
1111 | \ | ||
1112 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
1113 | \ | ||
1114 | gcmUPDATESECUREUSER(); \ | ||
1115 | } | ||
1116 | |||
1117 | #define gcmSETSTATEDATAWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1118 | Address, Mask, Data) \ | ||
1119 | { \ | ||
1120 | gctUINT32 __temp_data32__; \ | ||
1121 | \ | ||
1122 | __temp_data32__ = Data; \ | ||
1123 | \ | ||
1124 | *Memory++ = __temp_data32__; \ | ||
1125 | \ | ||
1126 | gcoHARDWARE_UpdateDelta( \ | ||
1127 | StateDelta, FixedPoint, Address, Mask, __temp_data32__ \ | ||
1128 | ); \ | ||
1129 | \ | ||
1130 | gcmDUMPSTATEDATA(StateDelta, FixedPoint, Address, __temp_data32__); \ | ||
1131 | \ | ||
1132 | gcmUPDATESECUREUSER(); \ | ||
1133 | } | ||
1134 | |||
1135 | |||
1136 | #define gcmSETCTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, Address, Data) \ | ||
1137 | { \ | ||
1138 | gctUINT32 __temp_data32__; \ | ||
1139 | \ | ||
1140 | __temp_data32__ = Data; \ | ||
1141 | \ | ||
1142 | *Memory++ = __temp_data32__; \ | ||
1143 | \ | ||
1144 | gcmDUMPSTATEDATA(StateDelta, gcvFALSE, Address, __temp_data32__); \ | ||
1145 | \ | ||
1146 | gcmSKIPSECUREUSER(); \ | ||
1147 | } | ||
1148 | |||
1149 | #define gcmSETFILLER_NEW(CommandBuffer, Memory) \ | ||
1150 | { \ | ||
1151 | Memory += 1; \ | ||
1152 | \ | ||
1153 | gcmSKIPSECUREUSER(); \ | ||
1154 | } | ||
1155 | |||
1156 | /*----------------------------------------------------------------------------*/ | ||
1157 | |||
1158 | #define gcmSETSINGLESTATE_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1159 | Address, Data) \ | ||
1160 | { \ | ||
1161 | gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
1162 | gcmSETSTATEDATA_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1163 | Address, Data); \ | ||
1164 | gcmENDSTATEBATCH_NEW(CommandBuffer, Memory); \ | ||
1165 | } | ||
1166 | |||
1167 | #define gcmSETSINGLESTATEWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1168 | Address, Mask, Data) \ | ||
1169 | { \ | ||
1170 | gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
1171 | gcmSETSTATEDATAWITHMASK_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1172 | Address, Mask, Data); \ | ||
1173 | gcmENDSTATEBATCH_NEW(CommandBuffer, Memory); \ | ||
1174 | } | ||
1175 | |||
1176 | |||
1177 | #define gcmSETSINGLECTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, FixedPoint, \ | ||
1178 | Address, Data) \ | ||
1179 | { \ | ||
1180 | gcmBEGINSTATEBATCH_NEW(CommandBuffer, Memory, FixedPoint, Address, 1); \ | ||
1181 | gcmSETCTRLSTATE_NEW(StateDelta, CommandBuffer, Memory, Address, Data); \ | ||
1182 | gcmENDSTATEBATCH_NEW(CommandBuffer, Memory); \ | ||
1183 | } | ||
1184 | |||
1185 | |||
1186 | |||
1187 | #define gcmSETSEMASTALLPIPE_NEW(StateDelta, CommandBuffer, Memory, Data) \ | ||
1188 | { \ | ||
1189 | gcmSETSINGLESTATE_NEW(StateDelta, CommandBuffer, Memory, gcvFALSE, AQSemaphoreRegAddrs, Data); \ | ||
1190 | \ | ||
1191 | *Memory++ = gcmSETFIELDVALUE(0, STALL_COMMAND, OPCODE, STALL); \ | ||
1192 | \ | ||
1193 | *Memory++ = Data; \ | ||
1194 | \ | ||
1195 | gcmDUMP(gcvNULL, "#[stall 0x%08X 0x%08X]", \ | ||
1196 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, SOURCE, FRONT_END), \ | ||
1197 | gcmSETFIELDVALUE(0, AQ_SEMAPHORE, DESTINATION, PIXEL_ENGINE)); \ | ||
1198 | \ | ||
1199 | gcmSKIPSECUREUSER(); \ | ||
1200 | } | ||
1201 | |||
1202 | #define gcmSETSTARTDECOMMAND_NEW(CommandBuffer, Memory, Count) \ | ||
1203 | { \ | ||
1204 | *Memory++ \ | ||
1205 | = gcmSETFIELDVALUE(0, AQ_COMMAND_START_DE_COMMAND, OPCODE, START_DE) \ | ||
1206 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, COUNT, Count) \ | ||
1207 | | gcmSETFIELD (0, AQ_COMMAND_START_DE_COMMAND, DATA_COUNT, 0); \ | ||
1208 | \ | ||
1209 | *Memory++ = 0xDEADDEED; \ | ||
1210 | \ | ||
1211 | } | ||
1212 | |||
1213 | #endif | ||
1214 | |||
1215 | /******************************************************************************* | ||
1216 | ** | ||
1217 | ** gcmCONFIGUREUNIFORMS | ||
1218 | ** | ||
1219 | ** Configure uniforms according to chip and numConstants. | ||
1220 | */ | ||
1221 | #define gcmCONFIGUREUNIFORMS(ChipModel, ChipRevision, NumConstants, \ | ||
1222 | UnifiedConst, VsConstBase, PsConstBase, VsConstMax, PsConstMax) \ | ||
1223 | { \ | ||
1224 | if (ChipModel == gcv2000 && ChipRevision == 0x5118) \ | ||
1225 | { \ | ||
1226 | UnifiedConst = gcvFALSE; \ | ||
1227 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
1228 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
1229 | VsConstMax = 256; \ | ||
1230 | PsConstMax = 64; \ | ||
1231 | } \ | ||
1232 | else if (NumConstants == 320) \ | ||
1233 | { \ | ||
1234 | UnifiedConst = gcvFALSE; \ | ||
1235 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
1236 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
1237 | VsConstMax = 256; \ | ||
1238 | PsConstMax = 64; \ | ||
1239 | } \ | ||
1240 | /* All GC1000 series chips can only support 64 uniforms for ps on non-unified const mode. */ \ | ||
1241 | else if (NumConstants > 256 && ChipModel == gcv1000) \ | ||
1242 | { \ | ||
1243 | UnifiedConst = gcvFALSE; \ | ||
1244 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
1245 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
1246 | VsConstMax = 256; \ | ||
1247 | PsConstMax = 64; \ | ||
1248 | } \ | ||
1249 | else if (NumConstants > 256) \ | ||
1250 | { \ | ||
1251 | UnifiedConst = gcvFALSE; \ | ||
1252 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
1253 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
1254 | VsConstMax = 256; \ | ||
1255 | PsConstMax = 256; \ | ||
1256 | } \ | ||
1257 | else if (NumConstants == 256) \ | ||
1258 | { \ | ||
1259 | UnifiedConst = gcvFALSE; \ | ||
1260 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
1261 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
1262 | VsConstMax = 256; \ | ||
1263 | PsConstMax = 256; \ | ||
1264 | } \ | ||
1265 | else \ | ||
1266 | { \ | ||
1267 | UnifiedConst = gcvFALSE; \ | ||
1268 | VsConstBase = AQVertexShaderConstRegAddrs; \ | ||
1269 | PsConstBase = AQPixelShaderConstRegAddrs; \ | ||
1270 | VsConstMax = 168; \ | ||
1271 | PsConstMax = 64; \ | ||
1272 | } \ | ||
1273 | } | ||
1274 | |||
1275 | /******************************************************************************\ | 696 | /******************************************************************************\ |
1276 | ******************************** Ceiling Macro ******************************** | 697 | ******************************** Ceiling Macro ******************************** |
1277 | \******************************************************************************/ | 698 | \******************************************************************************/ |
@@ -1302,24 +723,15 @@ gceSTATUS; | |||
1302 | ** | 723 | ** |
1303 | ** p Pointer value. | 724 | ** p Pointer value. |
1304 | */ | 725 | */ |
1305 | #if defined(_WIN32) || (defined(__LP64__) && __LP64__) | 726 | #define gcmPTR2INT(p) \ |
1306 | #if defined(_WIN64) | 727 | ( \ |
1307 | # define gcmPTR2INT(p) \ | 728 | (gctUINTPTR_T) (p) \ |
1308 | ( \ | 729 | ) |
1309 | (gctUINT64) (p) \ | 730 | |
1310 | ) | 731 | #define gcmPTR2INT32(p) \ |
1311 | #else | 732 | ( \ |
1312 | # define gcmPTR2INT(p) \ | 733 | (gctUINT32)(gctUINTPTR_T) (p) \ |
1313 | ( \ | 734 | ) |
1314 | (gctUINT32) (gctUINT64) (p) \ | ||
1315 | ) | ||
1316 | #endif | ||
1317 | #else | ||
1318 | # define gcmPTR2INT(p) \ | ||
1319 | ( \ | ||
1320 | (gctUINT32) (p) \ | ||
1321 | ) | ||
1322 | #endif | ||
1323 | 735 | ||
1324 | /******************************************************************************* | 736 | /******************************************************************************* |
1325 | ** | 737 | ** |
@@ -1331,17 +743,11 @@ gceSTATUS; | |||
1331 | ** | 743 | ** |
1332 | ** v Integer value. | 744 | ** v Integer value. |
1333 | */ | 745 | */ |
1334 | #ifdef __LP64__ | 746 | |
1335 | # define gcmINT2PTR(i) \ | 747 | #define gcmINT2PTR(i) \ |
1336 | ( \ | 748 | ( \ |
1337 | (gctPOINTER) (gctINT64) (i) \ | 749 | (gctPOINTER) (gctUINTPTR_T)(i) \ |
1338 | ) | 750 | ) |
1339 | #else | ||
1340 | # define gcmINT2PTR(i) \ | ||
1341 | ( \ | ||
1342 | (gctPOINTER) (i) \ | ||
1343 | ) | ||
1344 | #endif | ||
1345 | 751 | ||
1346 | /******************************************************************************* | 752 | /******************************************************************************* |
1347 | ** | 753 | ** |
@@ -1356,7 +762,7 @@ gceSTATUS; | |||
1356 | */ | 762 | */ |
1357 | #define gcmOFFSETOF(s, field) \ | 763 | #define gcmOFFSETOF(s, field) \ |
1358 | ( \ | 764 | ( \ |
1359 | gcmPTR2INT(& (((struct s *) 0)->field)) \ | 765 | gcmPTR2INT32(& (((struct s *) 0)->field)) \ |
1360 | ) | 766 | ) |
1361 | 767 | ||
1362 | /******************************************************************************* | 768 | /******************************************************************************* |
@@ -1471,7 +877,6 @@ struct _gckLINKQUEUE | |||
1471 | }; | 877 | }; |
1472 | #endif | 878 | #endif |
1473 | 879 | ||
1474 | #if gcdPROCESS_ADDRESS_SPACE | ||
1475 | #define gcdENTRY_QUEUE_SIZE 256 | 880 | #define gcdENTRY_QUEUE_SIZE 256 |
1476 | typedef struct _gckENTRYDATA * gckENTRYDATA; | 881 | typedef struct _gckENTRYDATA * gckENTRYDATA; |
1477 | struct _gckENTRYDATA | 882 | struct _gckENTRYDATA |
@@ -1488,7 +893,18 @@ struct _gckENTRYQUEUE | |||
1488 | gctUINT32 front; | 893 | gctUINT32 front; |
1489 | gctUINT32 count; | 894 | gctUINT32 count; |
1490 | }; | 895 | }; |
1491 | #endif | 896 | |
897 | typedef enum _gceTRACEMODE | ||
898 | { | ||
899 | gcvTRACEMODE_NONE = 0, | ||
900 | gcvTRACEMODE_FULL = 1, | ||
901 | gcvTRACEMODE_LOGGER = 2, | ||
902 | gcvTRACEMODE_PRE = 3, | ||
903 | gcvTRACEMODE_POST = 4, | ||
904 | gcvTRACEMODE_SYSTRACE = 5, | ||
905 | |||
906 | } gceTRACEMODE; | ||
907 | |||
1492 | 908 | ||
1493 | #ifdef __cplusplus | 909 | #ifdef __cplusplus |
1494 | } | 910 | } |
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h index 1e6aeadb74a0..57e3e4c362e3 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | |||
@@ -27,11 +27,11 @@ | |||
27 | 27 | ||
28 | #define gcvVERSION_MINOR 0 | 28 | #define gcvVERSION_MINOR 0 |
29 | 29 | ||
30 | #define gcvVERSION_PATCH 9 | 30 | #define gcvVERSION_PATCH 11 |
31 | 31 | ||
32 | #define gcvVERSION_BUILD 17083 | 32 | #define gcvVERSION_BUILD 17486 |
33 | 33 | ||
34 | #define gcvVERSION_STRING "5.0.9.1.17083" | 34 | #define gcvVERSION_STRING "5.0.11.14786" |
35 | 35 | ||
36 | #define gcvVERSION_DATE __DATE__ | 36 | #define gcvVERSION_DATE __DATE__ |
37 | 37 | ||
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h index 27021a932fb1..c6044de8aefe 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h | |||
@@ -422,7 +422,7 @@ gceSTATUS | |||
422 | gckVGHARDWARE_Execute( | 422 | gckVGHARDWARE_Execute( |
423 | IN gckVGHARDWARE Hardware, | 423 | IN gckVGHARDWARE Hardware, |
424 | IN gctUINT32 Address, | 424 | IN gctUINT32 Address, |
425 | IN gctSIZE_T Count | 425 | IN gctUINT32 Count |
426 | ); | 426 | ); |
427 | 427 | ||
428 | /* Query the available memory. */ | 428 | /* Query the available memory. */ |
@@ -482,6 +482,7 @@ gceSTATUS | |||
482 | gckVGHARDWARE_ConvertLogical( | 482 | gckVGHARDWARE_ConvertLogical( |
483 | IN gckVGHARDWARE Hardware, | 483 | IN gckVGHARDWARE Hardware, |
484 | IN gctPOINTER Logical, | 484 | IN gctPOINTER Logical, |
485 | IN gctBOOL InUserSpace, | ||
485 | OUT gctUINT32 * Address | 486 | OUT gctUINT32 * Address |
486 | ); | 487 | ); |
487 | 488 | ||
@@ -568,7 +569,7 @@ gckVGHARDWARE_QueryIdle( | |||
568 | \******************************************************************************/ | 569 | \******************************************************************************/ |
569 | 570 | ||
570 | /* Vacant command buffer marker. */ | 571 | /* Vacant command buffer marker. */ |
571 | #define gcvVACANT_BUFFER ((gcsCOMPLETION_SIGNAL_PTR) (1)) | 572 | #define gcvVACANT_BUFFER ((gcsCOMPLETION_SIGNAL_PTR) ((gctSIZE_T)1)) |
572 | 573 | ||
573 | /* Command buffer header. */ | 574 | /* Command buffer header. */ |
574 | typedef struct _gcsCMDBUFFER * gcsCMDBUFFER_PTR; | 575 | typedef struct _gcsCMDBUFFER * gcsCMDBUFFER_PTR; |
@@ -590,7 +591,7 @@ typedef struct _gcsCMDBUFFER | |||
590 | 591 | ||
591 | /* Size of the area allocated for the data portion of this particular | 592 | /* Size of the area allocated for the data portion of this particular |
592 | command buffer (headers and tail reserves are excluded). */ | 593 | command buffer (headers and tail reserves are excluded). */ |
593 | gctSIZE_T size; | 594 | gctUINT32 size; |
594 | 595 | ||
595 | /* Offset into the buffer [0..size]; reflects exactly how much data has | 596 | /* Offset into the buffer [0..size]; reflects exactly how much data has |
596 | been put into the command buffer. */ | 597 | been put into the command buffer. */ |
@@ -598,7 +599,7 @@ typedef struct _gcsCMDBUFFER | |||
598 | 599 | ||
599 | /* The number of command units in the buffer for the hardware to | 600 | /* The number of command units in the buffer for the hardware to |
600 | execute. */ | 601 | execute. */ |
601 | gctSIZE_T dataCount; | 602 | gctUINT32 dataCount; |
602 | 603 | ||
603 | /* MANAGED BY : user HAL (gcoBUFFER object). | 604 | /* MANAGED BY : user HAL (gcoBUFFER object). |
604 | USED BY : user HAL (gcoBUFFER object). | 605 | USED BY : user HAL (gcoBUFFER object). |
@@ -653,8 +654,8 @@ typedef struct _gcsVGCONTEXT | |||
653 | gctUINT32 currentPipe; | 654 | gctUINT32 currentPipe; |
654 | 655 | ||
655 | /* State map/mod buffer. */ | 656 | /* State map/mod buffer. */ |
656 | gctSIZE_T mapFirst; | 657 | gctUINT32 mapFirst; |
657 | gctSIZE_T mapLast; | 658 | gctUINT32 mapLast; |
658 | gcsVGCONTEXT_MAP_PTR mapContainer; | 659 | gcsVGCONTEXT_MAP_PTR mapContainer; |
659 | gcsVGCONTEXT_MAP_PTR mapPrev; | 660 | gcsVGCONTEXT_MAP_PTR mapPrev; |
660 | gcsVGCONTEXT_MAP_PTR mapCurr; | 661 | gcsVGCONTEXT_MAP_PTR mapCurr; |
@@ -849,7 +850,7 @@ typedef struct _gckVGMMU * gckVGMMU; | |||
849 | gceSTATUS | 850 | gceSTATUS |
850 | gckVGMMU_Construct( | 851 | gckVGMMU_Construct( |
851 | IN gckVGKERNEL Kernel, | 852 | IN gckVGKERNEL Kernel, |
852 | IN gctSIZE_T MmuSize, | 853 | IN gctUINT32 MmuSize, |
853 | OUT gckVGMMU * Mmu | 854 | OUT gckVGMMU * Mmu |
854 | ); | 855 | ); |
855 | 856 | ||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c new file mode 100644 index 000000000000..0342660db900 --- /dev/null +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c | |||
@@ -0,0 +1,969 @@ | |||
1 | /**************************************************************************** | ||
2 | * | ||
3 | * Copyright (C) 2005 - 2014 by Vivante Corp. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the license, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | |||
21 | |||
22 | |||
23 | #include "gc_hal_kernel_linux.h" | ||
24 | #include "gc_hal_kernel_allocator.h" | ||
25 | #include <linux/pagemap.h> | ||
26 | #include <linux/seq_file.h> | ||
27 | #include <linux/mman.h> | ||
28 | #include <asm/atomic.h> | ||
29 | #include <linux/dma-mapping.h> | ||
30 | #include <linux/slab.h> | ||
31 | |||
32 | #include "gc_hal_kernel_allocator_array.h" | ||
33 | |||
34 | #define _GC_OBJ_ZONE gcvZONE_OS | ||
35 | |||
36 | static void | ||
37 | _NonContiguousFree( | ||
38 | IN struct page ** Pages, | ||
39 | IN gctUINT32 NumPages | ||
40 | ) | ||
41 | { | ||
42 | gctINT i; | ||
43 | |||
44 | gcmkHEADER_ARG("Pages=0x%X, NumPages=%d", Pages, NumPages); | ||
45 | |||
46 | gcmkASSERT(Pages != gcvNULL); | ||
47 | |||
48 | for (i = 0; i < NumPages; i++) | ||
49 | { | ||
50 | __free_page(Pages[i]); | ||
51 | } | ||
52 | |||
53 | if (is_vmalloc_addr(Pages)) | ||
54 | { | ||
55 | vfree(Pages); | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | kfree(Pages); | ||
60 | } | ||
61 | |||
62 | gcmkFOOTER_NO(); | ||
63 | } | ||
64 | |||
65 | static struct page ** | ||
66 | _NonContiguousAlloc( | ||
67 | IN gctUINT32 NumPages | ||
68 | ) | ||
69 | { | ||
70 | struct page ** pages; | ||
71 | struct page *p; | ||
72 | gctINT i, size; | ||
73 | |||
74 | gcmkHEADER_ARG("NumPages=%lu", NumPages); | ||
75 | |||
76 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) | ||
77 | if (NumPages > totalram_pages) | ||
78 | #else | ||
79 | if (NumPages > num_physpages) | ||
80 | #endif | ||
81 | { | ||
82 | gcmkFOOTER_NO(); | ||
83 | return gcvNULL; | ||
84 | } | ||
85 | |||
86 | size = NumPages * sizeof(struct page *); | ||
87 | |||
88 | pages = kmalloc(size, GFP_KERNEL | gcdNOWARN); | ||
89 | |||
90 | if (!pages) | ||
91 | { | ||
92 | pages = vmalloc(size); | ||
93 | |||
94 | if (!pages) | ||
95 | { | ||
96 | gcmkFOOTER_NO(); | ||
97 | return gcvNULL; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | for (i = 0; i < NumPages; i++) | ||
102 | { | ||
103 | p = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | gcdNOWARN); | ||
104 | |||
105 | if (!p) | ||
106 | { | ||
107 | _NonContiguousFree(pages, i); | ||
108 | gcmkFOOTER_NO(); | ||
109 | return gcvNULL; | ||
110 | } | ||
111 | |||
112 | pages[i] = p; | ||
113 | } | ||
114 | |||
115 | gcmkFOOTER_ARG("pages=0x%X", pages); | ||
116 | return pages; | ||
117 | } | ||
118 | |||
119 | gctSTRING | ||
120 | _CreateKernelVirtualMapping( | ||
121 | IN PLINUX_MDL Mdl | ||
122 | ) | ||
123 | { | ||
124 | gctSTRING addr = 0; | ||
125 | gctINT numPages = Mdl->numPages; | ||
126 | |||
127 | #if gcdNONPAGED_MEMORY_CACHEABLE | ||
128 | if (Mdl->contiguous) | ||
129 | { | ||
130 | addr = page_address(Mdl->u.contiguousPages); | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | addr = vmap(Mdl->u.nonContiguousPages, | ||
135 | numPages, | ||
136 | 0, | ||
137 | PAGE_KERNEL); | ||
138 | |||
139 | /* Trigger a page fault. */ | ||
140 | memset(addr, 0, numPages * PAGE_SIZE); | ||
141 | } | ||
142 | #else | ||
143 | struct page ** pages; | ||
144 | gctBOOL free = gcvFALSE; | ||
145 | gctINT i; | ||
146 | |||
147 | if (Mdl->contiguous) | ||
148 | { | ||
149 | pages = kmalloc(sizeof(struct page *) * numPages, GFP_KERNEL | gcdNOWARN); | ||
150 | |||
151 | if (!pages) | ||
152 | { | ||
153 | return gcvNULL; | ||
154 | } | ||
155 | |||
156 | for (i = 0; i < numPages; i++) | ||
157 | { | ||
158 | pages[i] = nth_page(Mdl->u.contiguousPages, i); | ||
159 | } | ||
160 | |||
161 | free = gcvTRUE; | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | pages = Mdl->u.nonContiguousPages; | ||
166 | } | ||
167 | |||
168 | /* ioremap() can't work on system memory since 2.6.38. */ | ||
169 | addr = vmap(pages, numPages, 0, gcmkNONPAGED_MEMROY_PROT(PAGE_KERNEL)); | ||
170 | |||
171 | if (free) | ||
172 | { | ||
173 | kfree(pages); | ||
174 | } | ||
175 | |||
176 | #endif | ||
177 | |||
178 | return addr; | ||
179 | } | ||
180 | |||
181 | void | ||
182 | _DestoryKernelVirtualMapping( | ||
183 | IN gctSTRING Addr | ||
184 | ) | ||
185 | { | ||
186 | #if !gcdNONPAGED_MEMORY_CACHEABLE | ||
187 | vunmap(Addr); | ||
188 | #endif | ||
189 | } | ||
190 | |||
191 | void | ||
192 | _UnmapUserLogical( | ||
193 | IN gctPOINTER Logical, | ||
194 | IN gctUINT32 Size | ||
195 | ) | ||
196 | { | ||
197 | if (unlikely(current->mm == gcvNULL)) | ||
198 | { | ||
199 | /* Do nothing if process is exiting. */ | ||
200 | return; | ||
201 | } | ||
202 | |||
203 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) | ||
204 | if (vm_munmap((unsigned long)Logical, Size) < 0) | ||
205 | { | ||
206 | gcmkTRACE_ZONE( | ||
207 | gcvLEVEL_WARNING, gcvZONE_OS, | ||
208 | "%s(%d): vm_munmap failed", | ||
209 | __FUNCTION__, __LINE__ | ||
210 | ); | ||
211 | } | ||
212 | #else | ||
213 | down_write(¤t->mm->mmap_sem); | ||
214 | if (do_munmap(current->mm, (unsigned long)Logical, Size) < 0) | ||
215 | { | ||
216 | gcmkTRACE_ZONE( | ||
217 | gcvLEVEL_WARNING, gcvZONE_OS, | ||
218 | "%s(%d): do_munmap failed", | ||
219 | __FUNCTION__, __LINE__ | ||
220 | ); | ||
221 | } | ||
222 | up_write(¤t->mm->mmap_sem); | ||
223 | #endif | ||
224 | } | ||
225 | |||
226 | /***************************************************************************\ | ||
227 | ************************ Default Allocator ********************************** | ||
228 | \***************************************************************************/ | ||
229 | |||
230 | static gceSTATUS | ||
231 | _DefaultAlloc( | ||
232 | IN gckALLOCATOR Allocator, | ||
233 | INOUT PLINUX_MDL Mdl, | ||
234 | IN gctSIZE_T NumPages, | ||
235 | IN gctUINT32 Flags | ||
236 | ) | ||
237 | { | ||
238 | gceSTATUS status; | ||
239 | gctUINT32 order; | ||
240 | gctSIZE_T bytes; | ||
241 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
242 | gctPOINTER addr = gcvNULL; | ||
243 | #endif | ||
244 | gctUINT32 numPages; | ||
245 | gctUINT i = 0; | ||
246 | gctBOOL contiguous = Flags & gcvALLOC_FLAG_CONTIGUOUS; | ||
247 | |||
248 | gcmkHEADER_ARG("Mdl=%p NumPages=%d", Mdl, NumPages); | ||
249 | |||
250 | numPages = NumPages; | ||
251 | bytes = NumPages * PAGE_SIZE; | ||
252 | order = get_order(bytes); | ||
253 | |||
254 | if (contiguous) | ||
255 | { | ||
256 | if (order >= MAX_ORDER) | ||
257 | { | ||
258 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
259 | } | ||
260 | |||
261 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
262 | addr = | ||
263 | alloc_pages_exact(bytes, GFP_KERNEL | gcdNOWARN | __GFP_NORETRY); | ||
264 | |||
265 | Mdl->u.contiguousPages = addr | ||
266 | ? virt_to_page(addr) | ||
267 | : gcvNULL; | ||
268 | |||
269 | Mdl->exact = gcvTRUE; | ||
270 | #else | ||
271 | Mdl->u.contiguousPages = | ||
272 | alloc_pages(GFP_KERNEL | gcdNOWARN | __GFP_NORETRY, order); | ||
273 | #endif | ||
274 | |||
275 | if (Mdl->u.contiguousPages == gcvNULL) | ||
276 | { | ||
277 | Mdl->u.contiguousPages = | ||
278 | alloc_pages(GFP_KERNEL | __GFP_HIGHMEM | gcdNOWARN, order); | ||
279 | |||
280 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
281 | Mdl->exact = gcvFALSE; | ||
282 | #endif | ||
283 | } | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | Mdl->u.nonContiguousPages = _NonContiguousAlloc(numPages); | ||
288 | } | ||
289 | |||
290 | if (Mdl->u.contiguousPages == gcvNULL && Mdl->u.nonContiguousPages == gcvNULL) | ||
291 | { | ||
292 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
293 | } | ||
294 | |||
295 | for (i = 0; i < numPages; i++) | ||
296 | { | ||
297 | struct page *page; | ||
298 | |||
299 | if (contiguous) | ||
300 | { | ||
301 | page = nth_page(Mdl->u.contiguousPages, i); | ||
302 | } | ||
303 | else | ||
304 | { | ||
305 | page = _NonContiguousToPage(Mdl->u.nonContiguousPages, i); | ||
306 | } | ||
307 | |||
308 | SetPageReserved(page); | ||
309 | |||
310 | if (!PageHighMem(page) && page_to_phys(page)) | ||
311 | { | ||
312 | gcmkVERIFY_OK( | ||
313 | gckOS_CacheFlush(Allocator->os, _GetProcessID(), gcvNULL, | ||
314 | page_to_phys(page), | ||
315 | page_address(page), | ||
316 | PAGE_SIZE)); | ||
317 | } | ||
318 | else | ||
319 | { | ||
320 | flush_dcache_page(page); | ||
321 | |||
322 | #if !gcdCACHE_FUNCTION_UNIMPLEMENTED && defined(CONFIG_OUTER_CACHE) && gcdENABLE_OUTER_CACHE_PATCH | ||
323 | if (page_to_phys(page)) | ||
324 | { | ||
325 | _HandleOuterCache( | ||
326 | Allocator->os, | ||
327 | page_to_phys(page), | ||
328 | gcvNULL, | ||
329 | PAGE_SIZE, | ||
330 | gcvCACHE_FLUSH | ||
331 | ); | ||
332 | } | ||
333 | #endif | ||
334 | } | ||
335 | } | ||
336 | |||
337 | gcmkFOOTER_NO(); | ||
338 | return gcvSTATUS_OK; | ||
339 | |||
340 | OnError: | ||
341 | gcmkFOOTER(); | ||
342 | return status; | ||
343 | } | ||
344 | |||
345 | static void | ||
346 | _DefaultFree( | ||
347 | IN gckALLOCATOR Allocator, | ||
348 | IN OUT PLINUX_MDL Mdl | ||
349 | ) | ||
350 | { | ||
351 | gctINT i; | ||
352 | |||
353 | for (i = 0; i < Mdl->numPages; i++) | ||
354 | { | ||
355 | if (Mdl->contiguous) | ||
356 | { | ||
357 | ClearPageReserved(nth_page(Mdl->u.contiguousPages, i)); | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | ClearPageReserved(_NonContiguousToPage(Mdl->u.nonContiguousPages, i)); | ||
362 | } | ||
363 | } | ||
364 | |||
365 | if (Mdl->contiguous) | ||
366 | { | ||
367 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
368 | if (Mdl->exact == gcvTRUE) | ||
369 | { | ||
370 | free_pages_exact(page_address(Mdl->u.contiguousPages), Mdl->numPages * PAGE_SIZE); | ||
371 | } | ||
372 | else | ||
373 | #endif | ||
374 | { | ||
375 | __free_pages(Mdl->u.contiguousPages, get_order(Mdl->numPages * PAGE_SIZE)); | ||
376 | } | ||
377 | } | ||
378 | else | ||
379 | { | ||
380 | _NonContiguousFree(Mdl->u.nonContiguousPages, Mdl->numPages); | ||
381 | } | ||
382 | } | ||
383 | |||
384 | gctINT | ||
385 | _DefaultMapUser( | ||
386 | gckALLOCATOR Allocator, | ||
387 | PLINUX_MDL Mdl, | ||
388 | PLINUX_MDL_MAP MdlMap, | ||
389 | gctBOOL Cacheable | ||
390 | ) | ||
391 | { | ||
392 | |||
393 | gctSTRING addr; | ||
394 | unsigned long start; | ||
395 | unsigned long pfn; | ||
396 | gctINT i; | ||
397 | |||
398 | PLINUX_MDL mdl = Mdl; | ||
399 | PLINUX_MDL_MAP mdlMap = MdlMap; | ||
400 | |||
401 | gcmkHEADER_ARG("Allocator=%p Mdl=%p MdlMap=%p gctBOOL=%d", Allocator, Mdl, MdlMap, Cacheable); | ||
402 | |||
403 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) | ||
404 | mdlMap->vmaAddr = (gctSTRING)vm_mmap(gcvNULL, | ||
405 | 0L, | ||
406 | mdl->numPages * PAGE_SIZE, | ||
407 | PROT_READ | PROT_WRITE, | ||
408 | MAP_SHARED, | ||
409 | 0); | ||
410 | #else | ||
411 | down_write(¤t->mm->mmap_sem); | ||
412 | |||
413 | mdlMap->vmaAddr = (gctSTRING)do_mmap_pgoff(gcvNULL, | ||
414 | 0L, | ||
415 | mdl->numPages * PAGE_SIZE, | ||
416 | PROT_READ | PROT_WRITE, | ||
417 | MAP_SHARED, | ||
418 | 0); | ||
419 | |||
420 | up_write(¤t->mm->mmap_sem); | ||
421 | #endif | ||
422 | |||
423 | gcmkTRACE_ZONE( | ||
424 | gcvLEVEL_INFO, gcvZONE_OS, | ||
425 | "%s(%d): vmaAddr->0x%X for phys_addr->0x%X", | ||
426 | __FUNCTION__, __LINE__, | ||
427 | (gctUINT32)(gctUINTPTR_T)mdlMap->vmaAddr, | ||
428 | (gctUINT32)(gctUINTPTR_T)mdl | ||
429 | ); | ||
430 | |||
431 | if (IS_ERR(mdlMap->vmaAddr)) | ||
432 | { | ||
433 | gcmkTRACE_ZONE( | ||
434 | gcvLEVEL_INFO, gcvZONE_OS, | ||
435 | "%s(%d): do_mmap_pgoff error", | ||
436 | __FUNCTION__, __LINE__ | ||
437 | ); | ||
438 | |||
439 | mdlMap->vmaAddr = gcvNULL; | ||
440 | |||
441 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
442 | return gcvSTATUS_OUT_OF_MEMORY; | ||
443 | } | ||
444 | |||
445 | down_write(¤t->mm->mmap_sem); | ||
446 | |||
447 | mdlMap->vma = find_vma(current->mm, (unsigned long)mdlMap->vmaAddr); | ||
448 | |||
449 | if (mdlMap->vma == gcvNULL) | ||
450 | { | ||
451 | up_write(¤t->mm->mmap_sem); | ||
452 | |||
453 | gcmkTRACE_ZONE( | ||
454 | gcvLEVEL_INFO, gcvZONE_OS, | ||
455 | "%s(%d): find_vma error", | ||
456 | __FUNCTION__, __LINE__ | ||
457 | ); | ||
458 | |||
459 | mdlMap->vmaAddr = gcvNULL; | ||
460 | |||
461 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_RESOURCES); | ||
462 | return gcvSTATUS_OUT_OF_RESOURCES; | ||
463 | } | ||
464 | |||
465 | |||
466 | |||
467 | |||
468 | addr = mdl->addr; | ||
469 | |||
470 | /* Now map all the vmalloc pages to this user address. */ | ||
471 | if (mdl->contiguous) | ||
472 | { | ||
473 | /* map kernel memory to user space.. */ | ||
474 | mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
475 | |||
476 | if (Cacheable == gcvFALSE) | ||
477 | { | ||
478 | /* Make this mapping non-cached. */ | ||
479 | mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); | ||
480 | } | ||
481 | |||
482 | if (remap_pfn_range(mdlMap->vma, | ||
483 | mdlMap->vma->vm_start, | ||
484 | page_to_pfn(mdl->u.contiguousPages), | ||
485 | mdlMap->vma->vm_end - mdlMap->vma->vm_start, | ||
486 | mdlMap->vma->vm_page_prot) < 0) | ||
487 | { | ||
488 | up_write(¤t->mm->mmap_sem); | ||
489 | |||
490 | gcmkTRACE_ZONE( | ||
491 | gcvLEVEL_INFO, gcvZONE_OS, | ||
492 | "%s(%d): unable to mmap ret", | ||
493 | __FUNCTION__, __LINE__ | ||
494 | ); | ||
495 | |||
496 | mdlMap->vmaAddr = gcvNULL; | ||
497 | |||
498 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
499 | return gcvSTATUS_OUT_OF_MEMORY; | ||
500 | } | ||
501 | } | ||
502 | else | ||
503 | { | ||
504 | mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
505 | |||
506 | if (Cacheable == gcvFALSE) | ||
507 | { | ||
508 | /* Make this mapping non-cached. */ | ||
509 | mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); | ||
510 | } | ||
511 | |||
512 | start = mdlMap->vma->vm_start; | ||
513 | |||
514 | for (i = 0; i < mdl->numPages; i++) | ||
515 | { | ||
516 | pfn = _NonContiguousToPfn(mdl->u.nonContiguousPages, i); | ||
517 | |||
518 | if (remap_pfn_range(mdlMap->vma, | ||
519 | start, | ||
520 | pfn, | ||
521 | PAGE_SIZE, | ||
522 | mdlMap->vma->vm_page_prot) < 0) | ||
523 | { | ||
524 | up_write(¤t->mm->mmap_sem); | ||
525 | |||
526 | mdlMap->vmaAddr = gcvNULL; | ||
527 | |||
528 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
529 | return gcvSTATUS_OUT_OF_MEMORY; | ||
530 | } | ||
531 | |||
532 | start += PAGE_SIZE; | ||
533 | addr += PAGE_SIZE; | ||
534 | } | ||
535 | } | ||
536 | |||
537 | up_write(¤t->mm->mmap_sem); | ||
538 | |||
539 | gcmkFOOTER_NO(); | ||
540 | return gcvSTATUS_OK; | ||
541 | } | ||
542 | |||
543 | void | ||
544 | _DefaultUnmapUser( | ||
545 | IN gckALLOCATOR Allocator, | ||
546 | IN gctPOINTER Logical, | ||
547 | IN gctUINT32 Size | ||
548 | ) | ||
549 | { | ||
550 | _UnmapUserLogical(Logical, Size); | ||
551 | } | ||
552 | |||
553 | gceSTATUS | ||
554 | _DefaultMapKernel( | ||
555 | IN gckALLOCATOR Allocator, | ||
556 | IN PLINUX_MDL Mdl, | ||
557 | OUT gctPOINTER *Logical | ||
558 | ) | ||
559 | { | ||
560 | if (Mdl->contiguous && Mdl->addr) | ||
561 | { | ||
562 | /*for the memory allocated from DMA, there is no contiguousPages, | ||
563 | but the kernel virtual address is already got*/ | ||
564 | *Logical = Mdl->addr; | ||
565 | } | ||
566 | else | ||
567 | *Logical = _CreateKernelVirtualMapping(Mdl); | ||
568 | return gcvSTATUS_OK; | ||
569 | } | ||
570 | |||
571 | gceSTATUS | ||
572 | _DefaultUnmapKernel( | ||
573 | IN gckALLOCATOR Allocator, | ||
574 | IN PLINUX_MDL Mdl, | ||
575 | IN gctPOINTER Logical | ||
576 | ) | ||
577 | { | ||
578 | if (!Mdl->addr) | ||
579 | _DestoryKernelVirtualMapping(Logical); | ||
580 | return gcvSTATUS_OK; | ||
581 | } | ||
582 | |||
583 | gceSTATUS | ||
584 | _DefaultLogicalToPhysical( | ||
585 | IN gckALLOCATOR Allocator, | ||
586 | IN PLINUX_MDL Mdl, | ||
587 | IN gctPOINTER Logical, | ||
588 | IN gctUINT32 ProcessID, | ||
589 | OUT gctUINT32_PTR Physical | ||
590 | ) | ||
591 | { | ||
592 | return _ConvertLogical2Physical( | ||
593 | Allocator->os, Logical, ProcessID, Mdl, Physical); | ||
594 | } | ||
595 | |||
596 | gceSTATUS | ||
597 | _DefaultCache( | ||
598 | IN gckALLOCATOR Allocator, | ||
599 | IN PLINUX_MDL Mdl, | ||
600 | IN gctPOINTER Logical, | ||
601 | IN gctUINT32 Physical, | ||
602 | IN gctUINT32 Bytes, | ||
603 | IN gceCACHEOPERATION Operation | ||
604 | ) | ||
605 | { | ||
606 | return gcvSTATUS_OK; | ||
607 | } | ||
608 | |||
609 | gceSTATUS | ||
610 | _DefaultPhysical( | ||
611 | IN gckALLOCATOR Allocator, | ||
612 | IN PLINUX_MDL Mdl, | ||
613 | IN gctUINT32 Offset, | ||
614 | OUT gctUINT32_PTR Physical | ||
615 | ) | ||
616 | { | ||
617 | gcmkASSERT(Mdl->pagedMem && !Mdl->contiguous); | ||
618 | *Physical = _NonContiguousToPhys(Mdl->u.nonContiguousPages, Offset); | ||
619 | |||
620 | return gcvSTATUS_OK; | ||
621 | } | ||
622 | |||
623 | /* Default allocator operations. */ | ||
624 | gcsALLOCATOR_OPERATIONS DefaultAllocatorOperations = { | ||
625 | .Alloc = _DefaultAlloc, | ||
626 | .Free = _DefaultFree, | ||
627 | .MapUser = _DefaultMapUser, | ||
628 | .UnmapUser = _DefaultUnmapUser, | ||
629 | .MapKernel = _DefaultMapKernel, | ||
630 | .UnmapKernel = _DefaultUnmapKernel, | ||
631 | .LogicalToPhysical = _DefaultLogicalToPhysical, | ||
632 | .Cache = _DefaultCache, | ||
633 | .Physical = _DefaultPhysical, | ||
634 | }; | ||
635 | |||
636 | /* Default allocator entry. */ | ||
637 | gceSTATUS | ||
638 | _DefaultAlloctorInit( | ||
639 | IN gckOS Os, | ||
640 | OUT gckALLOCATOR * Allocator | ||
641 | ) | ||
642 | { | ||
643 | gceSTATUS status; | ||
644 | gckALLOCATOR allocator; | ||
645 | |||
646 | gcmkONERROR( | ||
647 | gckALLOCATOR_Construct(Os, &DefaultAllocatorOperations, &allocator)); | ||
648 | |||
649 | *Allocator = allocator; | ||
650 | |||
651 | return gcvSTATUS_OK; | ||
652 | |||
653 | OnError: | ||
654 | return status; | ||
655 | } | ||
656 | #if LINUX_CMA_FSL | ||
657 | |||
658 | static gceSTATUS | ||
659 | _CMAFSLAlloc( | ||
660 | IN gckALLOCATOR Allocator, | ||
661 | INOUT PLINUX_MDL Mdl, | ||
662 | IN gctSIZE_T NumPages, | ||
663 | IN gctUINT32 Flags | ||
664 | ) | ||
665 | { | ||
666 | gceSTATUS status; | ||
667 | gctPOINTER addr = gcvNULL; | ||
668 | |||
669 | gcmkHEADER_ARG("Mdl=%p NumPages=%d", Mdl, NumPages); | ||
670 | |||
671 | addr = dma_alloc_writecombine(gcvNULL, | ||
672 | NumPages * PAGE_SIZE, | ||
673 | &Mdl->dmaHandle, | ||
674 | GFP_KERNEL | gcdNOWARN); | ||
675 | |||
676 | if (addr == gcvNULL) | ||
677 | { | ||
678 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
679 | } | ||
680 | |||
681 | Mdl->addr = addr; | ||
682 | |||
683 | gcmkFOOTER_NO(); | ||
684 | return gcvSTATUS_OK; | ||
685 | |||
686 | OnError: | ||
687 | gcmkFOOTER(); | ||
688 | return status; | ||
689 | } | ||
690 | |||
691 | static void | ||
692 | _CMAFSLFree( | ||
693 | IN gckALLOCATOR Allocator, | ||
694 | IN OUT PLINUX_MDL Mdl | ||
695 | ) | ||
696 | { | ||
697 | dma_free_writecombine(gcvNULL, | ||
698 | Mdl->numPages * PAGE_SIZE, | ||
699 | Mdl->addr, | ||
700 | Mdl->dmaHandle); | ||
701 | } | ||
702 | |||
703 | gctINT | ||
704 | _CMAFSLMapUser( | ||
705 | gckALLOCATOR Allocator, | ||
706 | PLINUX_MDL Mdl, | ||
707 | PLINUX_MDL_MAP MdlMap, | ||
708 | gctBOOL Cacheable | ||
709 | ) | ||
710 | { | ||
711 | |||
712 | gctSTRING addr; | ||
713 | PLINUX_MDL mdl = Mdl; | ||
714 | PLINUX_MDL_MAP mdlMap = MdlMap; | ||
715 | |||
716 | gcmkHEADER_ARG("Allocator=%p Mdl=%p MdlMap=%p gctBOOL=%d", Allocator, Mdl, MdlMap, Cacheable); | ||
717 | |||
718 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) | ||
719 | mdlMap->vmaAddr = (gctSTRING)vm_mmap(gcvNULL, | ||
720 | 0L, | ||
721 | mdl->numPages * PAGE_SIZE, | ||
722 | PROT_READ | PROT_WRITE, | ||
723 | MAP_SHARED, | ||
724 | 0); | ||
725 | #else | ||
726 | down_write(¤t->mm->mmap_sem); | ||
727 | |||
728 | mdlMap->vmaAddr = (gctSTRING)do_mmap_pgoff(gcvNULL, | ||
729 | 0L, | ||
730 | mdl->numPages * PAGE_SIZE, | ||
731 | PROT_READ | PROT_WRITE, | ||
732 | MAP_SHARED, | ||
733 | 0); | ||
734 | |||
735 | up_write(¤t->mm->mmap_sem); | ||
736 | #endif | ||
737 | |||
738 | gcmkTRACE_ZONE( | ||
739 | gcvLEVEL_INFO, gcvZONE_OS, | ||
740 | "%s(%d): vmaAddr->0x%X for phys_addr->0x%X", | ||
741 | __FUNCTION__, __LINE__, | ||
742 | (gctUINT32)(gctUINTPTR_T)mdlMap->vmaAddr, | ||
743 | (gctUINT32)(gctUINTPTR_T)mdl | ||
744 | ); | ||
745 | |||
746 | if (IS_ERR(mdlMap->vmaAddr)) | ||
747 | { | ||
748 | gcmkTRACE_ZONE( | ||
749 | gcvLEVEL_INFO, gcvZONE_OS, | ||
750 | "%s(%d): do_mmap_pgoff error", | ||
751 | __FUNCTION__, __LINE__ | ||
752 | ); | ||
753 | |||
754 | mdlMap->vmaAddr = gcvNULL; | ||
755 | |||
756 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
757 | return gcvSTATUS_OUT_OF_MEMORY; | ||
758 | } | ||
759 | |||
760 | down_write(¤t->mm->mmap_sem); | ||
761 | |||
762 | mdlMap->vma = find_vma(current->mm, (unsigned long)mdlMap->vmaAddr); | ||
763 | |||
764 | if (mdlMap->vma == gcvNULL) | ||
765 | { | ||
766 | up_write(¤t->mm->mmap_sem); | ||
767 | |||
768 | gcmkTRACE_ZONE( | ||
769 | gcvLEVEL_INFO, gcvZONE_OS, | ||
770 | "%s(%d): find_vma error", | ||
771 | __FUNCTION__, __LINE__ | ||
772 | ); | ||
773 | |||
774 | mdlMap->vmaAddr = gcvNULL; | ||
775 | |||
776 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_RESOURCES); | ||
777 | return gcvSTATUS_OUT_OF_RESOURCES; | ||
778 | } | ||
779 | |||
780 | addr = mdl->addr; | ||
781 | |||
782 | /* Now map all the vmalloc pages to this user address. */ | ||
783 | if (mdl->contiguous && (!mdl->cacheable)) | ||
784 | { | ||
785 | /* map kernel memory to user space.. */ | ||
786 | if (dma_mmap_writecombine(gcvNULL, | ||
787 | mdlMap->vma, | ||
788 | mdl->addr, | ||
789 | mdl->dmaHandle, | ||
790 | mdl->numPages * PAGE_SIZE) < 0) | ||
791 | { | ||
792 | up_write(¤t->mm->mmap_sem); | ||
793 | |||
794 | gcmkTRACE_ZONE( | ||
795 | gcvLEVEL_WARNING, gcvZONE_OS, | ||
796 | "%s(%d): dma_mmap_attrs error", | ||
797 | __FUNCTION__, __LINE__ | ||
798 | ); | ||
799 | |||
800 | mdlMap->vmaAddr = gcvNULL; | ||
801 | |||
802 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
803 | return gcvSTATUS_OUT_OF_MEMORY; | ||
804 | } | ||
805 | } | ||
806 | else | ||
807 | { | ||
808 | gckOS_Print("incorrect mdl:conti%d:cachable:%d\n",mdl->contiguous, mdl->cacheable); | ||
809 | } | ||
810 | |||
811 | up_write(¤t->mm->mmap_sem); | ||
812 | |||
813 | gcmkFOOTER_NO(); | ||
814 | return gcvSTATUS_OK; | ||
815 | } | ||
816 | |||
817 | |||
818 | |||
819 | /* Default allocator operations. */ | ||
820 | gcsALLOCATOR_OPERATIONS CMAFSLAllocatorOperations = { | ||
821 | .Alloc = _CMAFSLAlloc, | ||
822 | .Free = _CMAFSLFree, | ||
823 | .MapUser = _CMAFSLMapUser, | ||
824 | .UnmapUser = _DefaultUnmapUser, | ||
825 | .MapKernel = _DefaultMapKernel, | ||
826 | .UnmapKernel = _DefaultUnmapKernel, | ||
827 | .LogicalToPhysical = _DefaultLogicalToPhysical, | ||
828 | .Cache = _DefaultCache, | ||
829 | .Physical = _DefaultPhysical, | ||
830 | }; | ||
831 | |||
832 | /* Default allocator entry. */ | ||
833 | gceSTATUS | ||
834 | _CMAFSLAlloctorInit( | ||
835 | IN gckOS Os, | ||
836 | OUT gckALLOCATOR * Allocator | ||
837 | ) | ||
838 | { | ||
839 | gceSTATUS status; | ||
840 | gckALLOCATOR allocator; | ||
841 | |||
842 | gcmkONERROR( | ||
843 | gckALLOCATOR_Construct(Os, &CMAFSLAllocatorOperations, &allocator)); | ||
844 | |||
845 | allocator->privateData = (void *)1; | ||
846 | |||
847 | *Allocator = allocator; | ||
848 | |||
849 | return gcvSTATUS_OK; | ||
850 | |||
851 | OnError: | ||
852 | return status; | ||
853 | } | ||
854 | |||
855 | #endif | ||
856 | /***************************************************************************\ | ||
857 | ************************ Allocator helper *********************************** | ||
858 | \***************************************************************************/ | ||
859 | |||
860 | gceSTATUS | ||
861 | gckALLOCATOR_Construct( | ||
862 | IN gckOS Os, | ||
863 | IN gcsALLOCATOR_OPERATIONS * Operations, | ||
864 | OUT gckALLOCATOR * Allocator | ||
865 | ) | ||
866 | { | ||
867 | gceSTATUS status; | ||
868 | gckALLOCATOR allocator; | ||
869 | |||
870 | gcmkHEADER_ARG("Os=%p, Operations=%p, Allocator=%p", | ||
871 | Os, Operations, Allocator); | ||
872 | |||
873 | gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); | ||
874 | gcmkVERIFY_ARGUMENT(Allocator != gcvNULL); | ||
875 | gcmkVERIFY_ARGUMENT | ||
876 | ( Operations | ||
877 | && Operations->Alloc | ||
878 | && Operations->Free | ||
879 | && Operations->MapUser | ||
880 | && Operations->UnmapUser | ||
881 | && Operations->MapKernel | ||
882 | && Operations->UnmapKernel | ||
883 | && Operations->LogicalToPhysical | ||
884 | && Operations->Cache | ||
885 | && Operations->Physical | ||
886 | ); | ||
887 | |||
888 | gcmkONERROR( | ||
889 | gckOS_Allocate(Os, gcmSIZEOF(gckALLOCATOR), (gctPOINTER *)&allocator)); | ||
890 | |||
891 | gckOS_ZeroMemory(allocator, gcmSIZEOF(gckALLOCATOR)); | ||
892 | |||
893 | /* Record os. */ | ||
894 | allocator->os = Os; | ||
895 | |||
896 | /* Set operations. */ | ||
897 | allocator->ops = Operations; | ||
898 | |||
899 | *Allocator = allocator; | ||
900 | |||
901 | gcmkFOOTER_NO(); | ||
902 | return gcvSTATUS_OK; | ||
903 | |||
904 | OnError: | ||
905 | gcmkFOOTER(); | ||
906 | return status; | ||
907 | } | ||
908 | |||
909 | /***************************************************************************\ | ||
910 | ************************ Allocator management ******************************* | ||
911 | \***************************************************************************/ | ||
912 | |||
913 | gceSTATUS | ||
914 | gckOS_ImportAllocators( | ||
915 | gckOS Os | ||
916 | ) | ||
917 | { | ||
918 | gceSTATUS status; | ||
919 | gctUINT i; | ||
920 | gckALLOCATOR allocator; | ||
921 | |||
922 | INIT_LIST_HEAD(&Os->allocatorList); | ||
923 | |||
924 | for (i = 0; i < gcmCOUNTOF(allocatorArray); i++) | ||
925 | { | ||
926 | if (allocatorArray[i].construct) | ||
927 | { | ||
928 | /* Construct allocator. */ | ||
929 | status = allocatorArray[i].construct(Os, &allocator); | ||
930 | |||
931 | if (gcmIS_ERROR(status)) | ||
932 | { | ||
933 | gcmkPRINT("["DEVICE_NAME"]: Can't construct allocator(%s)", | ||
934 | allocatorArray[i].name); | ||
935 | |||
936 | continue; | ||
937 | } | ||
938 | |||
939 | list_add(&allocator->head, &Os->allocatorList); | ||
940 | } | ||
941 | } | ||
942 | |||
943 | return gcvSTATUS_OK; | ||
944 | } | ||
945 | |||
946 | gceSTATUS | ||
947 | gckOS_FreeAllocators( | ||
948 | gckOS Os | ||
949 | ) | ||
950 | { | ||
951 | gckALLOCATOR allocator; | ||
952 | gckALLOCATOR temp; | ||
953 | |||
954 | list_for_each_entry_safe(allocator, temp, &Os->allocatorList, head) | ||
955 | { | ||
956 | list_del(&allocator->head); | ||
957 | |||
958 | /* Free private data. */ | ||
959 | if (allocator->privateDataDestructor && allocator->privateData) | ||
960 | { | ||
961 | allocator->privateDataDestructor(allocator->privateData); | ||
962 | } | ||
963 | |||
964 | gckOS_Free(Os, allocator); | ||
965 | } | ||
966 | |||
967 | return gcvSTATUS_OK; | ||
968 | } | ||
969 | |||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.h new file mode 100644 index 000000000000..b81e4e7e6e76 --- /dev/null +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.h | |||
@@ -0,0 +1,393 @@ | |||
1 | /**************************************************************************** | ||
2 | * | ||
3 | * Copyright (C) 2005 - 2014 by Vivante Corp. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the license, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | |||
21 | |||
22 | |||
23 | #ifndef __gc_hal_kernel_allocator_h_ | ||
24 | #define __gc_hal_kernel_allocator_h_ | ||
25 | |||
26 | #include <linux/list.h> | ||
27 | |||
28 | #define gcvALLOC_FLAG_CONTIGUOUS (1 << 0) | ||
29 | #define gcvALLOC_FLAG_CACHEABLE (1 << 1) | ||
30 | |||
31 | /* | ||
32 | * Defines | ||
33 | */ | ||
34 | |||
35 | typedef struct _gcsALLOCATOR * gckALLOCATOR; | ||
36 | |||
37 | typedef struct _gcsALLOCATOR_OPERATIONS | ||
38 | { | ||
39 | /************************************************************************** | ||
40 | ** | ||
41 | ** Alloc | ||
42 | ** | ||
43 | ** Allocte memory, request size is page aligned. | ||
44 | ** | ||
45 | ** INPUT: | ||
46 | ** | ||
47 | ** gckALLOCATOR Allocator | ||
48 | ** Pointer to an gckALLOCATOER object. | ||
49 | ** | ||
50 | ** PLINUX_Mdl | ||
51 | ** Pointer to Mdl whichs stores information | ||
52 | ** about allocated memory. | ||
53 | ** | ||
54 | ** gctSIZE_T NumPages | ||
55 | ** Number of pages need to allocate. | ||
56 | ** | ||
57 | ** gctUINT32 Flag | ||
58 | ** Allocation option. | ||
59 | ** | ||
60 | ** OUTPUT: | ||
61 | ** | ||
62 | ** Nothing. | ||
63 | ** | ||
64 | */ | ||
65 | gceSTATUS | ||
66 | (*Alloc)( | ||
67 | IN gckALLOCATOR Allocator, | ||
68 | IN PLINUX_MDL Mdl, | ||
69 | IN gctSIZE_T NumPages, | ||
70 | IN gctUINT32 Flag | ||
71 | ); | ||
72 | |||
73 | /************************************************************************** | ||
74 | ** | ||
75 | ** Free | ||
76 | ** | ||
77 | ** Free memory. | ||
78 | ** | ||
79 | ** INPUT: | ||
80 | ** | ||
81 | ** gckALLOCATOR Allocator | ||
82 | ** Pointer to an gckALLOCATOER object. | ||
83 | ** | ||
84 | ** PLINUX_MDL Mdl | ||
85 | ** Mdl which stores information. | ||
86 | ** | ||
87 | ** OUTPUT: | ||
88 | ** | ||
89 | ** Nothing. | ||
90 | ** | ||
91 | */ | ||
92 | void | ||
93 | (*Free)( | ||
94 | IN gckALLOCATOR Allocator, | ||
95 | IN PLINUX_MDL Mdl | ||
96 | ); | ||
97 | |||
98 | /************************************************************************** | ||
99 | ** | ||
100 | ** MapUser | ||
101 | ** | ||
102 | ** Map memory to user space. | ||
103 | ** | ||
104 | ** INPUT: | ||
105 | ** gckALLOCATOR Allocator | ||
106 | ** Pointer to an gckALLOCATOER object. | ||
107 | ** | ||
108 | ** PLINUX_MDL Mdl | ||
109 | ** Pointer to a Mdl. | ||
110 | ** | ||
111 | ** PLINUX_MDL_MAP MdlMap | ||
112 | ** Pointer to a MdlMap, mapped address is stored | ||
113 | ** in MdlMap->vmaAddr | ||
114 | ** | ||
115 | ** gctBOOL Cacheable | ||
116 | ** Whether this mapping is cacheable. | ||
117 | ** | ||
118 | ** OUTPUT: | ||
119 | ** | ||
120 | ** Nothing. | ||
121 | ** | ||
122 | */ | ||
123 | gctINT | ||
124 | (*MapUser)( | ||
125 | IN gckALLOCATOR Allocator, | ||
126 | IN PLINUX_MDL Mdl, | ||
127 | IN PLINUX_MDL_MAP MdlMap, | ||
128 | IN gctBOOL Cacheable | ||
129 | ); | ||
130 | |||
131 | /************************************************************************** | ||
132 | ** | ||
133 | ** UnmapUser | ||
134 | ** | ||
135 | ** Unmap address from user address space. | ||
136 | ** | ||
137 | ** INPUT: | ||
138 | ** gckALLOCATOR Allocator | ||
139 | ** Pointer to an gckALLOCATOER object. | ||
140 | ** | ||
141 | ** gctPOINTER Logical | ||
142 | ** Address to be unmap | ||
143 | ** | ||
144 | ** gctUINT32 Size | ||
145 | ** Size of address space | ||
146 | ** | ||
147 | ** OUTPUT: | ||
148 | ** | ||
149 | ** Nothing. | ||
150 | ** | ||
151 | */ | ||
152 | void | ||
153 | (*UnmapUser)( | ||
154 | IN gckALLOCATOR Allocator, | ||
155 | IN gctPOINTER Logical, | ||
156 | IN gctUINT32 Size | ||
157 | ); | ||
158 | |||
159 | /************************************************************************** | ||
160 | ** | ||
161 | ** MapKernel | ||
162 | ** | ||
163 | ** Map memory to kernel space. | ||
164 | ** | ||
165 | ** INPUT: | ||
166 | ** gckALLOCATOR Allocator | ||
167 | ** Pointer to an gckALLOCATOER object. | ||
168 | ** | ||
169 | ** PLINUX_MDL Mdl | ||
170 | ** Pointer to a Mdl object. | ||
171 | ** | ||
172 | ** OUTPUT: | ||
173 | ** gctPOINTER * Logical | ||
174 | ** Mapped kernel address. | ||
175 | */ | ||
176 | gceSTATUS | ||
177 | (*MapKernel)( | ||
178 | IN gckALLOCATOR Allocator, | ||
179 | IN PLINUX_MDL Mdl, | ||
180 | OUT gctPOINTER *Logical | ||
181 | ); | ||
182 | |||
183 | /************************************************************************** | ||
184 | ** | ||
185 | ** UnmapKernel | ||
186 | ** | ||
187 | ** Unmap memory from kernel space. | ||
188 | ** | ||
189 | ** INPUT: | ||
190 | ** gckALLOCATOR Allocator | ||
191 | ** Pointer to an gckALLOCATOER object. | ||
192 | ** | ||
193 | ** PLINUX_MDL Mdl | ||
194 | ** Pointer to a Mdl object. | ||
195 | ** | ||
196 | ** gctPOINTER Logical | ||
197 | ** Mapped kernel address. | ||
198 | ** | ||
199 | ** OUTPUT: | ||
200 | ** | ||
201 | ** Nothing. | ||
202 | ** | ||
203 | */ | ||
204 | gceSTATUS | ||
205 | (*UnmapKernel)( | ||
206 | IN gckALLOCATOR Allocator, | ||
207 | IN PLINUX_MDL Mdl, | ||
208 | IN gctPOINTER Logical | ||
209 | ); | ||
210 | |||
211 | /************************************************************************** | ||
212 | ** | ||
213 | ** LogicalToPhysical | ||
214 | ** | ||
215 | ** Get physical address from logical address, logical | ||
216 | ** address could be user virtual address or kernel | ||
217 | ** virtual address. | ||
218 | ** | ||
219 | ** INPUT: | ||
220 | ** gckALLOCATOR Allocator | ||
221 | ** Pointer to an gckALLOCATOER object. | ||
222 | ** | ||
223 | ** PLINUX_MDL Mdl | ||
224 | ** Pointer to a Mdl object. | ||
225 | ** | ||
226 | ** gctPOINTER Logical | ||
227 | ** Mapped kernel address. | ||
228 | ** | ||
229 | ** gctUINT32 ProcessID | ||
230 | ** pid of current process. | ||
231 | ** OUTPUT: | ||
232 | ** | ||
233 | ** gctUINT32_PTR Physical | ||
234 | ** Physical address. | ||
235 | ** | ||
236 | */ | ||
237 | gceSTATUS | ||
238 | (*LogicalToPhysical)( | ||
239 | IN gckALLOCATOR Allocator, | ||
240 | IN PLINUX_MDL Mdl, | ||
241 | IN gctPOINTER Logical, | ||
242 | IN gctUINT32 ProcessID, | ||
243 | OUT gctUINT32_PTR Physical | ||
244 | ); | ||
245 | |||
246 | /************************************************************************** | ||
247 | ** | ||
248 | ** Cache | ||
249 | ** | ||
250 | ** Maintain cache coherency. | ||
251 | ** | ||
252 | ** INPUT: | ||
253 | ** gckALLOCATOR Allocator | ||
254 | ** Pointer to an gckALLOCATOER object. | ||
255 | ** | ||
256 | ** PLINUX_MDL Mdl | ||
257 | ** Pointer to a Mdl object. | ||
258 | ** | ||
259 | ** gctPOINTER Logical | ||
260 | ** Logical address, could be user address or kernel address | ||
261 | ** | ||
262 | ** gctUINT32_PTR Physical | ||
263 | ** Physical address. | ||
264 | ** | ||
265 | ** gctUINT32 Bytes | ||
266 | ** Size of memory region. | ||
267 | ** | ||
268 | ** gceCACHEOPERATION Opertaion | ||
269 | ** Cache operation. | ||
270 | ** | ||
271 | ** OUTPUT: | ||
272 | ** | ||
273 | ** Nothing. | ||
274 | ** | ||
275 | */ | ||
276 | gceSTATUS (*Cache)( | ||
277 | IN gckALLOCATOR Allocator, | ||
278 | IN PLINUX_MDL Mdl, | ||
279 | IN gctPOINTER Logical, | ||
280 | IN gctUINT32 Physical, | ||
281 | IN gctUINT32 Bytes, | ||
282 | IN gceCACHEOPERATION Operation | ||
283 | ); | ||
284 | |||
285 | /************************************************************************** | ||
286 | ** | ||
287 | ** Physical | ||
288 | ** | ||
289 | ** Get physical address from a offset in memory region. | ||
290 | ** | ||
291 | ** INPUT: | ||
292 | ** gckALLOCATOR Allocator | ||
293 | ** Pointer to an gckALLOCATOER object. | ||
294 | ** | ||
295 | ** PLINUX_MDL Mdl | ||
296 | ** Pointer to a Mdl object. | ||
297 | ** | ||
298 | ** gctUINT32 Offset | ||
299 | ** Offset in this memory region. | ||
300 | ** | ||
301 | ** OUTPUT: | ||
302 | ** gctUINT32_PTR Physical | ||
303 | ** Physical address. | ||
304 | ** | ||
305 | */ | ||
306 | gceSTATUS (*Physical)( | ||
307 | IN gckALLOCATOR Allocator, | ||
308 | IN PLINUX_MDL Mdl, | ||
309 | IN gctUINT32 Offset, | ||
310 | OUT gctUINT32_PTR Physical | ||
311 | ); | ||
312 | } | ||
313 | gcsALLOCATOR_OPERATIONS; | ||
314 | |||
315 | typedef struct _gcsALLOCATOR | ||
316 | { | ||
317 | /* Pointer to gckOS Object. */ | ||
318 | gckOS os; | ||
319 | |||
320 | /* Operations. */ | ||
321 | gcsALLOCATOR_OPERATIONS* ops; | ||
322 | |||
323 | struct list_head head; | ||
324 | |||
325 | /* Private data used by customer allocator. */ | ||
326 | void * privateData; | ||
327 | |||
328 | /* Private data destructor. */ | ||
329 | void (*privateDataDestructor)(void *); | ||
330 | } | ||
331 | gcsALLOCATOR; | ||
332 | |||
333 | typedef struct _gcsALLOCATOR_DESC | ||
334 | { | ||
335 | /* Name of a allocator. */ | ||
336 | char * name; | ||
337 | |||
338 | /* Entry function to construct a allocator. */ | ||
339 | gceSTATUS (*construct)(gckOS, gckALLOCATOR *); | ||
340 | } | ||
341 | gcsALLOCATOR_DESC; | ||
342 | |||
343 | /* | ||
344 | * Helpers | ||
345 | */ | ||
346 | |||
347 | /* Fill a gcsALLOCATOR_DESC structure. */ | ||
348 | #define gcmkDEFINE_ALLOCATOR_DESC(Name, Construct) \ | ||
349 | { \ | ||
350 | .name = Name, \ | ||
351 | .construct = Construct, \ | ||
352 | } | ||
353 | |||
354 | /* Construct a allocator. */ | ||
355 | gceSTATUS | ||
356 | gckALLOCATOR_Construct( | ||
357 | IN gckOS Os, | ||
358 | IN gcsALLOCATOR_OPERATIONS * Operations, | ||
359 | OUT gckALLOCATOR * Allocator | ||
360 | ); | ||
361 | |||
362 | /* | ||
363 | How to implement customer allocator | ||
364 | |||
365 | Build in customer alloctor | ||
366 | |||
367 | It is recommanded that customer allocator is implmented in independent | ||
368 | source file(s) which is specified by CUSOMTER_ALLOCATOR_OBJS in Kbuld. | ||
369 | |||
370 | Register gcsALLOCATOR | ||
371 | |||
372 | For each customer specified allocator, a desciption entry must be added | ||
373 | to allocatorArray defined in gc_hal_kernel_allocator_array.h. | ||
374 | |||
375 | An entry in allocatorArray is a gcsALLOCATOR_DESC structure which describes | ||
376 | name and constructor of a gckALLOCATOR object. | ||
377 | |||
378 | |||
379 | Implement gcsALLOCATOR_DESC.init() | ||
380 | |||
381 | In gcsALLOCATOR_DESC.init(), gckALLOCATOR_Construct should be called | ||
382 | to create a gckALLOCATOR object, customer specified private data can | ||
383 | be put in gcsALLOCATOR.privateData. | ||
384 | |||
385 | |||
386 | Implement gcsALLOCATOR_OPERATIONS | ||
387 | |||
388 | When call gckALLOCATOR_Construct to create a gckALLOCATOR object, a | ||
389 | gcsALLOCATOR_OPERATIONS structure must be provided whose all members | ||
390 | implemented. | ||
391 | |||
392 | */ | ||
393 | #endif | ||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator_array.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator_array.h new file mode 100644 index 000000000000..2e3259ffdf22 --- /dev/null +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator_array.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /**************************************************************************** | ||
2 | * | ||
3 | * Copyright (C) 2005 - 2014 by Vivante Corp. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the license, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | |||
21 | |||
22 | |||
23 | extern gceSTATUS | ||
24 | _DefaultAlloctorInit( | ||
25 | IN gckOS Os, | ||
26 | OUT gckALLOCATOR * Allocator | ||
27 | ); | ||
28 | |||
29 | extern gceSTATUS | ||
30 | _CMAFSLAlloctorInit( | ||
31 | IN gckOS Os, | ||
32 | OUT gckALLOCATOR * Allocator | ||
33 | ); | ||
34 | |||
35 | gcsALLOCATOR_DESC allocatorArray[] = | ||
36 | { | ||
37 | /* Default allocator. */ | ||
38 | gcmkDEFINE_ALLOCATOR_DESC("default", _DefaultAlloctorInit), | ||
39 | #if LINUX_CMA_FSL | ||
40 | gcmkDEFINE_ALLOCATOR_DESC("cmafsl", _CMAFSLAlloctorInit), | ||
41 | #endif | ||
42 | }; | ||
43 | |||
44 | |||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h index 794953c6171e..69fec425b5a0 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debug.h | |||
@@ -92,7 +92,7 @@ typedef va_list gctARGUMENTS; | |||
92 | snprintf(Destination, Size, Message, Value1, Value2, Value3) | 92 | snprintf(Destination, Size, Message, Value1, Value2, Value3) |
93 | 93 | ||
94 | #define gcmkVSPRINTF(Destination, Size, Message, Arguments) \ | 94 | #define gcmkVSPRINTF(Destination, Size, Message, Arguments) \ |
95 | vsnprintf(Destination, Size, Message, *(va_list *) &Arguments) | 95 | vsnprintf(Destination, Size, Message, *((va_list*)Arguments)) |
96 | 96 | ||
97 | #define gcmkSTRCAT(Destination, Size, String) \ | 97 | #define gcmkSTRCAT(Destination, Size, String) \ |
98 | strncat(Destination, String, Size) | 98 | strncat(Destination, String, Size) |
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c index 3cf3f537fa34..665710129d60 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_debugfs.c | |||
@@ -102,7 +102,7 @@ typedef va_list gctDBGARGS ; | |||
102 | { \ | 102 | { \ |
103 | gctDBGARGS __arguments__; \ | 103 | gctDBGARGS __arguments__; \ |
104 | gcmkARGS_START(__arguments__, Message); \ | 104 | gcmkARGS_START(__arguments__, Message); \ |
105 | _debugfs_res = _DebugFSPrint(ArgumentSize, Message, __arguments__);\ | 105 | _debugfs_res = _DebugFSPrint(ArgumentSize, Message, &__arguments__);\ |
106 | gcmkARGS_END(__arguments__); \ | 106 | gcmkARGS_END(__arguments__); \ |
107 | } | 107 | } |
108 | 108 | ||
@@ -354,7 +354,7 @@ static ssize_t | |||
354 | _DebugFSPrint ( | 354 | _DebugFSPrint ( |
355 | IN unsigned int ArgumentSize , | 355 | IN unsigned int ArgumentSize , |
356 | IN const char* Message , | 356 | IN const char* Message , |
357 | IN gctDBGARGS Arguments | 357 | IN gctDBGARGS * Arguments |
358 | 358 | ||
359 | ) | 359 | ) |
360 | { | 360 | { |
@@ -371,7 +371,7 @@ _DebugFSPrint ( | |||
371 | { | 371 | { |
372 | return - ERESTARTSYS ; | 372 | return - ERESTARTSYS ; |
373 | } | 373 | } |
374 | len = vsnprintf ( buffer , sizeof (buffer ) , Message , *( va_list * ) & Arguments ) ; | 374 | len = vsnprintf ( buffer , sizeof (buffer ) , Message , *( va_list * ) Arguments ) ; |
375 | buffer[len] = '\0' ; | 375 | buffer[len] = '\0' ; |
376 | 376 | ||
377 | /* Add end-of-line if missing. */ | 377 | /* Add end-of-line if missing. */ |
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c index 49a7daf57dcc..87b01d4dcd6a 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c | |||
@@ -2360,7 +2360,7 @@ gckGALDEVICE_Start( | |||
2360 | /* Setup the ISR routine. */ | 2360 | /* Setup the ISR routine. */ |
2361 | gcmkONERROR(gckGALDEVICE_Setup_ISR_VG(Device)); | 2361 | gcmkONERROR(gckGALDEVICE_Setup_ISR_VG(Device)); |
2362 | 2362 | ||
2363 | #if gcdENABLE_VG | 2363 | #if gcdENABLE_VG |
2364 | /* Switch to SUSPEND power state. */ | 2364 | /* Switch to SUSPEND power state. */ |
2365 | gcmkONERROR(gckVGHARDWARE_SetPowerManagementState( | 2365 | gcmkONERROR(gckVGHARDWARE_SetPowerManagementState( |
2366 | Device->kernels[gcvCORE_VG]->vg->hardware, gcvPOWER_OFF_BROADCAST | 2366 | Device->kernels[gcvCORE_VG]->vg->hardware, gcvPOWER_OFF_BROADCAST |
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c index 9a036a60dd8a..1b0da4ffcbd0 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | |||
@@ -261,17 +261,17 @@ static ssize_t show_meminfo(struct device_driver *dev, char *buf) | |||
261 | size+= snprintf(buf+size, PAGE_SIZE-size,"Reseverd memory information:\n"); | 261 | size+= snprintf(buf+size, PAGE_SIZE-size,"Reseverd memory information:\n"); |
262 | size+= snprintf(buf+size, PAGE_SIZE-size,"Type\r\tbaseaddress\r\t\t\tsize(bytes)\r\t\t\t\t\tused(bytes)\r\t\t\t\t\t\t\tfree(bytes)\n"); | 262 | size+= snprintf(buf+size, PAGE_SIZE-size,"Type\r\tbaseaddress\r\t\t\tsize(bytes)\r\t\t\t\t\tused(bytes)\r\t\t\t\t\t\t\tfree(bytes)\n"); |
263 | if(galDevice->internalVidMem) | 263 | if(galDevice->internalVidMem) |
264 | size+= snprintf(buf+size, PAGE_SIZE-size,"Internal\r\t0x%x\r\t\t\t%lu\r\t\t\t\t\t%lu\r\t\t\t\t\t\t\t%lu\n", | 264 | size+= snprintf(buf+size, PAGE_SIZE-size,"Internal\r\t0x%x\r\t\t\t%u\r\t\t\t\t\t%u\r\t\t\t\t\t\t\t%u\n", |
265 | galDevice->internalVidMem->baseAddress,galDevice->internalVidMem->bytes, | 265 | galDevice->internalVidMem->baseAddress,galDevice->internalVidMem->bytes, |
266 | galDevice->internalVidMem->bytes-galDevice->internalVidMem->freeBytes, | 266 | galDevice->internalVidMem->bytes-galDevice->internalVidMem->freeBytes, |
267 | galDevice->internalVidMem->freeBytes); | 267 | galDevice->internalVidMem->freeBytes); |
268 | if(galDevice->externalVidMem) | 268 | if(galDevice->externalVidMem) |
269 | size+= snprintf(buf+size, PAGE_SIZE-size,"External\r\t0x%x\r\t\t\t%lu\r\t\t\t\t\t%lu\r\t\t\t\t\t\t\t%lu\n", | 269 | size+= snprintf(buf+size, PAGE_SIZE-size,"External\r\t0x%x\r\t\t\t%u\r\t\t\t\t\t%u\r\t\t\t\t\t\t\t%u\n", |
270 | galDevice->externalVidMem->baseAddress,galDevice->externalVidMem->bytes, | 270 | galDevice->externalVidMem->baseAddress,galDevice->externalVidMem->bytes, |
271 | galDevice->externalVidMem->bytes-galDevice->externalVidMem->freeBytes, | 271 | galDevice->externalVidMem->bytes-galDevice->externalVidMem->freeBytes, |
272 | galDevice->externalVidMem->freeBytes); | 272 | galDevice->externalVidMem->freeBytes); |
273 | if(galDevice->contiguousVidMem) | 273 | if(galDevice->contiguousVidMem) |
274 | size+= snprintf(buf+size, PAGE_SIZE-size,"System\r\t0x%x\r\t\t\t%lu\r\t\t\t\t\t%lu\r\t\t\t\t\t\t\t%lu\n", | 274 | size+= snprintf(buf+size, PAGE_SIZE-size,"System\r\t0x%x\r\t\t\t%u\r\t\t\t\t\t%u\r\t\t\t\t\t\t\t%u\n", |
275 | galDevice->contiguousVidMem ->baseAddress,galDevice->contiguousVidMem->bytes, | 275 | galDevice->contiguousVidMem ->baseAddress,galDevice->contiguousVidMem->bytes, |
276 | galDevice->contiguousVidMem->bytes-galDevice->contiguousVidMem->freeBytes, | 276 | galDevice->contiguousVidMem->bytes-galDevice->contiguousVidMem->freeBytes, |
277 | galDevice->contiguousVidMem->freeBytes); | 277 | galDevice->contiguousVidMem->freeBytes); |
@@ -280,15 +280,15 @@ static ssize_t show_meminfo(struct device_driver *dev, char *buf) | |||
280 | size+= snprintf(buf+size, PAGE_SIZE-size,"Dynamic memory information:\n"); | 280 | size+= snprintf(buf+size, PAGE_SIZE-size,"Dynamic memory information:\n"); |
281 | 281 | ||
282 | size+= snprintf(buf+size, PAGE_SIZE-size,"Type\r\t\t\t\t\tused size(bytes)\n"); | 282 | size+= snprintf(buf+size, PAGE_SIZE-size,"Type\r\t\t\t\t\tused size(bytes)\n"); |
283 | size+= snprintf(buf+size, PAGE_SIZE-size,"Cached memory\r\t\t\t\t\t%lu\n", galDevice->cachedsize); | 283 | size+= snprintf(buf+size, PAGE_SIZE-size,"Cached memory\r\t\t\t\t\t%u\n", galDevice->cachedsize); |
284 | size+= snprintf(buf+size, PAGE_SIZE-size,"Non paged memory\r\t\t\t\t\t%lu\n", galDevice->nonpagedmemorysize); | 284 | size+= snprintf(buf+size, PAGE_SIZE-size,"Non paged memory\r\t\t\t\t\t%u\n", galDevice->nonpagedmemorysize); |
285 | #if LINUX_CMA_FSL | 285 | #if LINUX_CMA_FSL |
286 | size+= snprintf(buf+size, PAGE_SIZE-size,"CMA memory\r\t\t\t\t\t%lu\n", galDevice->cmasize); | 286 | size+= snprintf(buf+size, PAGE_SIZE-size,"CMA memory\r\t\t\t\t\t%u\n", galDevice->cmasize); |
287 | #endif | 287 | #endif |
288 | size+= snprintf(buf+size, PAGE_SIZE-size,"Contiguous paged memory(low)\r\t\t\t\t\t%lu\n", galDevice->contiguouslowmemsize); | 288 | size+= snprintf(buf+size, PAGE_SIZE-size,"Contiguous paged memory(low)\r\t\t\t\t\t%u\n", galDevice->contiguouslowmemsize); |
289 | size+= snprintf(buf+size, PAGE_SIZE-size,"Contiguous paged memory(high)\r\t\t\t\t\t%lu\n", galDevice->contiguoushighmemsize); | 289 | size+= snprintf(buf+size, PAGE_SIZE-size,"Contiguous paged memory(high)\r\t\t\t\t\t%u\n", galDevice->contiguoushighmemsize); |
290 | size+= snprintf(buf+size, PAGE_SIZE-size,"NonContiguous paged memory(low)\r\t\t\t\t\t%lu\n", galDevice->noncontiguouslowmemsize); | 290 | size+= snprintf(buf+size, PAGE_SIZE-size,"NonContiguous paged memory(low)\r\t\t\t\t\t%u\n", galDevice->noncontiguouslowmemsize); |
291 | size+= snprintf(buf+size, PAGE_SIZE-size,"NonContiguous paged memory(high)\r\t\t\t\t\t%lu\n", galDevice->noncontiguoushighmemsize); | 291 | size+= snprintf(buf+size, PAGE_SIZE-size,"NonContiguous paged memory(high)\r\t\t\t\t\t%u\n", galDevice->noncontiguoushighmemsize); |
292 | #endif | 292 | #endif |
293 | return strlen(buf); | 293 | return strlen(buf); |
294 | } | 294 | } |
@@ -506,12 +506,15 @@ int drv_open( | |||
506 | 506 | ||
507 | if ((!galDevice->contiguousMapped) && galDevice->contiguousSize) | 507 | if ((!galDevice->contiguousMapped) && galDevice->contiguousSize) |
508 | { | 508 | { |
509 | gcmkONERROR(gckOS_MapMemory( | 509 | if (galDevice->contiguousPhysical != gcvNULL) |
510 | galDevice->os, | 510 | { |
511 | galDevice->contiguousPhysical, | 511 | gcmkONERROR(gckOS_MapMemory( |
512 | galDevice->contiguousSize, | 512 | galDevice->os, |
513 | &data->contiguousLogical | 513 | galDevice->contiguousPhysical, |
514 | )); | 514 | galDevice->contiguousSize, |
515 | &data->contiguousLogical | ||
516 | )); | ||
517 | } | ||
515 | } | 518 | } |
516 | 519 | ||
517 | filp->private_data = data; | 520 | filp->private_data = data; |
@@ -1127,8 +1130,9 @@ static int drv_init(struct device *pdev) | |||
1127 | #endif | 1130 | #endif |
1128 | 1131 | ||
1129 | 1132 | ||
1133 | |||
1130 | /* Register the character device. */ | 1134 | /* Register the character device. */ |
1131 | ret = register_chrdev(major, DRV_NAME, &driver_fops); | 1135 | ret = register_chrdev(major, DEVICE_NAME, &driver_fops); |
1132 | 1136 | ||
1133 | if (ret < 0) | 1137 | if (ret < 0) |
1134 | { | 1138 | { |
@@ -1161,9 +1165,9 @@ static int drv_init(struct device *pdev) | |||
1161 | } | 1165 | } |
1162 | 1166 | ||
1163 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) | 1167 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) |
1164 | device_create(device_class, NULL, MKDEV(major, 0), NULL, "galcore"); | 1168 | device_create(device_class, NULL, MKDEV(major, 0), NULL, DEVICE_NAME); |
1165 | #else | 1169 | #else |
1166 | device_create(device_class, NULL, MKDEV(major, 0), "galcore"); | 1170 | device_create(device_class, NULL, MKDEV(major, 0), DEVICE_NAME); |
1167 | #endif | 1171 | #endif |
1168 | 1172 | ||
1169 | galDevice = device; | 1173 | galDevice = device; |
@@ -1224,7 +1228,7 @@ static void drv_exit(void) | |||
1224 | device_destroy(gpuClass, MKDEV(major, 0)); | 1228 | device_destroy(gpuClass, MKDEV(major, 0)); |
1225 | class_destroy(gpuClass); | 1229 | class_destroy(gpuClass); |
1226 | 1230 | ||
1227 | unregister_chrdev(major, DRV_NAME); | 1231 | unregister_chrdev(major, DEVICE_NAME); |
1228 | 1232 | ||
1229 | gcmkVERIFY_OK(gckGALDEVICE_Stop(galDevice)); | 1233 | gcmkVERIFY_OK(gckGALDEVICE_Stop(galDevice)); |
1230 | gcmkVERIFY_OK(gckGALDEVICE_Destroy(galDevice)); | 1234 | gcmkVERIFY_OK(gckGALDEVICE_Destroy(galDevice)); |
@@ -1256,15 +1260,9 @@ static void drv_exit(void) | |||
1256 | module_exit(drv_exit); | 1260 | module_exit(drv_exit); |
1257 | #else | 1261 | #else |
1258 | 1262 | ||
1259 | #ifdef CONFIG_DOVE_GPU | ||
1260 | # define DEVICE_NAME "dove_gpu" | ||
1261 | #else | ||
1262 | # define DEVICE_NAME "galcore" | ||
1263 | #endif | ||
1264 | |||
1265 | #if gcdENABLE_FSCALE_VAL_ADJUST | 1263 | #if gcdENABLE_FSCALE_VAL_ADJUST |
1266 | static int thermal_hot_pm_notify(struct notifier_block *nb, unsigned long event, | 1264 | static int thermal_hot_pm_notify(struct notifier_block *nb, unsigned long event, |
1267 | void *dummy) | 1265 | void *dummy) |
1268 | { | 1266 | { |
1269 | static gctUINT orgFscale, minFscale, maxFscale; | 1267 | static gctUINT orgFscale, minFscale, maxFscale; |
1270 | static gctBOOL bAlreadyTooHot = gcvFALSE; | 1268 | static gctBOOL bAlreadyTooHot = gcvFALSE; |
@@ -1289,6 +1287,7 @@ static struct notifier_block thermal_hot_pm_notifier = { | |||
1289 | #endif | 1287 | #endif |
1290 | 1288 | ||
1291 | 1289 | ||
1290 | |||
1292 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) | 1291 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) |
1293 | static int gpu_probe(struct platform_device *pdev) | 1292 | static int gpu_probe(struct platform_device *pdev) |
1294 | #else | 1293 | #else |
@@ -1299,14 +1298,15 @@ static int __devinit gpu_probe(struct platform_device *pdev) | |||
1299 | struct resource* res; | 1298 | struct resource* res; |
1300 | 1299 | ||
1301 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) | 1300 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) |
1302 | struct contiguous_mem_pool *pool; | 1301 | struct contiguous_mem_pool *pool; |
1303 | struct reset_control *rstc; | 1302 | struct reset_control *rstc; |
1304 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) | 1303 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) |
1305 | struct device_node *dn =pdev->dev.of_node; | 1304 | struct device_node *dn =pdev->dev.of_node; |
1306 | const u32 *prop; | 1305 | const u32 *prop; |
1307 | #else | 1306 | #else |
1308 | struct viv_gpu_platform_data *pdata; | 1307 | struct viv_gpu_platform_data *pdata; |
1309 | #endif | 1308 | #endif |
1309 | |||
1310 | gcmkHEADER(); | 1310 | gcmkHEADER(); |
1311 | 1311 | ||
1312 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phys_baseaddr"); | 1312 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phys_baseaddr"); |
@@ -1365,10 +1365,10 @@ static int __devinit gpu_probe(struct platform_device *pdev) | |||
1365 | } | 1365 | } |
1366 | dev_set_drvdata(&pdev->dev, pool); | 1366 | dev_set_drvdata(&pdev->dev, pool); |
1367 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) | 1367 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) |
1368 | prop = of_get_property(dn, "contiguousbase", NULL); | 1368 | prop = of_get_property(dn, "contiguousbase", NULL); |
1369 | if(prop) | 1369 | if(prop) |
1370 | contiguousBase = *prop; | 1370 | contiguousBase = *prop; |
1371 | of_property_read_u32(dn,"contiguoussize", (u32 *)&contiguousSize); | 1371 | of_property_read_u32(dn,"contiguoussize", (u32 *)&contiguousSize); |
1372 | #else | 1372 | #else |
1373 | pdata = pdev->dev.platform_data; | 1373 | pdata = pdev->dev.platform_data; |
1374 | if (pdata) { | 1374 | if (pdata) { |
@@ -1389,9 +1389,11 @@ static int __devinit gpu_probe(struct platform_device *pdev) | |||
1389 | rstc = devm_reset_control_get(&pdev->dev, "gpu2d"); | 1389 | rstc = devm_reset_control_get(&pdev->dev, "gpu2d"); |
1390 | galDevice->rstc[gcvCORE_2D] = IS_ERR(rstc) ? NULL : rstc; | 1390 | galDevice->rstc[gcvCORE_2D] = IS_ERR(rstc) ? NULL : rstc; |
1391 | 1391 | ||
1392 | |||
1392 | rstc = devm_reset_control_get(&pdev->dev, "gpuvg"); | 1393 | rstc = devm_reset_control_get(&pdev->dev, "gpuvg"); |
1393 | galDevice->rstc[gcvCORE_VG] = IS_ERR(rstc) ? NULL : rstc; | 1394 | galDevice->rstc[gcvCORE_VG] = IS_ERR(rstc) ? NULL : rstc; |
1394 | #endif | 1395 | #endif |
1396 | |||
1395 | platform_set_drvdata(pdev, galDevice); | 1397 | platform_set_drvdata(pdev, galDevice); |
1396 | 1398 | ||
1397 | #if gcdENABLE_FSCALE_VAL_ADJUST | 1399 | #if gcdENABLE_FSCALE_VAL_ADJUST |
@@ -1414,6 +1416,7 @@ static int __devinit gpu_probe(struct platform_device *pdev) | |||
1414 | gcmkFOOTER_NO(); | 1416 | gcmkFOOTER_NO(); |
1415 | return ret; | 1417 | return ret; |
1416 | } | 1418 | } |
1419 | |||
1417 | #if gcdENABLE_FSCALE_VAL_ADJUST | 1420 | #if gcdENABLE_FSCALE_VAL_ADJUST |
1418 | UNREG_THERMAL_NOTIFIER(&thermal_hot_pm_notifier); | 1421 | UNREG_THERMAL_NOTIFIER(&thermal_hot_pm_notifier); |
1419 | #endif | 1422 | #endif |
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c index ba2a0272da2c..2e7fd157d609 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.c | |||
@@ -257,13 +257,14 @@ gckKERNEL_MapVideoMemoryEx( | |||
257 | OUT gctPOINTER * Logical | 257 | OUT gctPOINTER * Logical |
258 | ) | 258 | ) |
259 | { | 259 | { |
260 | gckGALDEVICE device; | 260 | gckGALDEVICE device = gcvNULL; |
261 | PLINUX_MDL mdl; | 261 | PLINUX_MDL mdl = gcvNULL; |
262 | PLINUX_MDL_MAP mdlMap; | 262 | PLINUX_MDL_MAP mdlMap = gcvNULL; |
263 | gcePOOL pool; | 263 | gcePOOL pool = gcvPOOL_UNKNOWN; |
264 | gctUINT32 offset, base; | 264 | gctUINT32 offset = 0; |
265 | gctUINT32 base = 0; | ||
265 | gceSTATUS status; | 266 | gceSTATUS status; |
266 | gctPOINTER logical; | 267 | gctPOINTER logical = gcvNULL; |
267 | 268 | ||
268 | gcmkHEADER_ARG("Kernel=%p InUserSpace=%d Address=%08x", | 269 | gcmkHEADER_ARG("Kernel=%p InUserSpace=%d Address=%08x", |
269 | Kernel, InUserSpace, Address); | 270 | Kernel, InUserSpace, Address); |
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h index 6f7cafdd28d5..58150483bf7c 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <linux/dma-mapping.h> | 38 | #include <linux/dma-mapping.h> |
39 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
40 | 40 | ||
41 | #include <linux/idr.h> | ||
42 | |||
41 | #ifdef MODVERSIONS | 43 | #ifdef MODVERSIONS |
42 | # include <linux/modversions.h> | 44 | # include <linux/modversions.h> |
43 | #endif | 45 | #endif |
@@ -70,7 +72,11 @@ | |||
70 | 72 | ||
71 | #define countof(a) (sizeof(a) / sizeof(a[0])) | 73 | #define countof(a) (sizeof(a) / sizeof(a[0])) |
72 | 74 | ||
73 | #define DRV_NAME "galcore" | 75 | #ifdef CONFIG_DOVE_GPU |
76 | # define DEVICE_NAME "dove_gpu" | ||
77 | #else | ||
78 | # define DEVICE_NAME "galcore" | ||
79 | #endif | ||
74 | 80 | ||
75 | #define GetPageCount(size, offset) ((((size) + ((offset) & ~PAGE_CACHE_MASK)) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) | 81 | #define GetPageCount(size, offset) ((((size) + ((offset) & ~PAGE_CACHE_MASK)) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) |
76 | 82 | ||
@@ -80,4 +86,295 @@ | |||
80 | #define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED) | 86 | #define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED) |
81 | #endif | 87 | #endif |
82 | 88 | ||
89 | /* Protection bit when mapping memroy to user sapce */ | ||
90 | #define gcmkPAGED_MEMROY_PROT(x) pgprot_writecombine(x) | ||
91 | |||
92 | #if gcdNONPAGED_MEMORY_BUFFERABLE | ||
93 | #define gcmkIOREMAP ioremap_wc | ||
94 | #define gcmkNONPAGED_MEMROY_PROT(x) pgprot_writecombine(x) | ||
95 | #elif !gcdNONPAGED_MEMORY_CACHEABLE | ||
96 | #define gcmkIOREMAP ioremap_nocache | ||
97 | #define gcmkNONPAGED_MEMROY_PROT(x) pgprot_noncached(x) | ||
98 | #endif | ||
99 | |||
100 | #define gcdSUPPRESS_OOM_MESSAGE 1 | ||
101 | |||
102 | #if gcdSUPPRESS_OOM_MESSAGE | ||
103 | #define gcdNOWARN __GFP_NOWARN | ||
104 | #else | ||
105 | #define gcdNOWARN 0 | ||
106 | #endif | ||
107 | |||
108 | #define gcdUSE_NON_PAGED_MEMORY_CACHE 0 | ||
109 | |||
110 | /******************************************************************************\ | ||
111 | ********************************** Structures ********************************** | ||
112 | \******************************************************************************/ | ||
113 | #if gcdUSE_NON_PAGED_MEMORY_CACHE | ||
114 | typedef struct _gcsNonPagedMemoryCache | ||
115 | { | ||
116 | #ifndef NO_DMA_COHERENT | ||
117 | gctINT size; | ||
118 | gctSTRING addr; | ||
119 | dma_addr_t dmaHandle; | ||
120 | #else | ||
121 | long order; | ||
122 | struct page * page; | ||
123 | #endif | ||
124 | |||
125 | struct _gcsNonPagedMemoryCache * prev; | ||
126 | struct _gcsNonPagedMemoryCache * next; | ||
127 | } | ||
128 | gcsNonPagedMemoryCache; | ||
129 | #endif /* gcdUSE_NON_PAGED_MEMORY_CACHE */ | ||
130 | |||
131 | typedef struct _gcsUSER_MAPPING * gcsUSER_MAPPING_PTR; | ||
132 | typedef struct _gcsUSER_MAPPING | ||
133 | { | ||
134 | /* Pointer to next mapping structure. */ | ||
135 | gcsUSER_MAPPING_PTR next; | ||
136 | |||
137 | /* Physical address of this mapping. */ | ||
138 | gctUINT32 physical; | ||
139 | |||
140 | /* Logical address of this mapping. */ | ||
141 | gctPOINTER logical; | ||
142 | |||
143 | /* Number of bytes of this mapping. */ | ||
144 | gctSIZE_T bytes; | ||
145 | |||
146 | /* Starting address of this mapping. */ | ||
147 | gctINT8_PTR start; | ||
148 | |||
149 | /* Ending address of this mapping. */ | ||
150 | gctINT8_PTR end; | ||
151 | } | ||
152 | gcsUSER_MAPPING; | ||
153 | |||
154 | typedef struct _gcsINTEGER_DB * gcsINTEGER_DB_PTR; | ||
155 | typedef struct _gcsINTEGER_DB | ||
156 | { | ||
157 | struct idr idr; | ||
158 | spinlock_t lock; | ||
159 | gctINT curr; | ||
160 | } | ||
161 | gcsINTEGER_DB; | ||
162 | |||
163 | struct _gckOS | ||
164 | { | ||
165 | /* Object. */ | ||
166 | gcsOBJECT object; | ||
167 | |||
168 | /* Pointer to device */ | ||
169 | gckGALDEVICE device; | ||
170 | |||
171 | /* Memory management */ | ||
172 | gctPOINTER memoryLock; | ||
173 | gctPOINTER memoryMapLock; | ||
174 | |||
175 | struct _LINUX_MDL *mdlHead; | ||
176 | struct _LINUX_MDL *mdlTail; | ||
177 | |||
178 | /* Kernel process ID. */ | ||
179 | gctUINT32 kernelProcessID; | ||
180 | |||
181 | /* Signal management. */ | ||
182 | |||
183 | /* Lock. */ | ||
184 | gctPOINTER signalMutex; | ||
185 | |||
186 | /* signal id database. */ | ||
187 | gcsINTEGER_DB signalDB; | ||
188 | |||
189 | #if gcdANDROID_NATIVE_FENCE_SYNC | ||
190 | /* Lock. */ | ||
191 | gctPOINTER syncPointMutex; | ||
192 | |||
193 | /* sync point id database. */ | ||
194 | gcsINTEGER_DB syncPointDB; | ||
195 | #endif | ||
196 | |||
197 | gcsUSER_MAPPING_PTR userMap; | ||
198 | gctPOINTER debugLock; | ||
199 | |||
200 | #if gcdUSE_NON_PAGED_MEMORY_CACHE | ||
201 | gctUINT cacheSize; | ||
202 | gcsNonPagedMemoryCache * cacheHead; | ||
203 | gcsNonPagedMemoryCache * cacheTail; | ||
204 | #endif | ||
205 | |||
206 | /* workqueue for os timer. */ | ||
207 | struct workqueue_struct * workqueue; | ||
208 | |||
209 | /* Allocate extra page to avoid cache overflow */ | ||
210 | struct page* paddingPage; | ||
211 | |||
212 | /* Detect unfreed allocation. */ | ||
213 | atomic_t allocateCount; | ||
214 | |||
215 | struct list_head allocatorList; | ||
216 | }; | ||
217 | |||
218 | typedef struct _gcsSIGNAL * gcsSIGNAL_PTR; | ||
219 | typedef struct _gcsSIGNAL | ||
220 | { | ||
221 | /* Kernel sync primitive. */ | ||
222 | struct completion obj; | ||
223 | |||
224 | /* Manual reset flag. */ | ||
225 | gctBOOL manualReset; | ||
226 | |||
227 | /* The reference counter. */ | ||
228 | atomic_t ref; | ||
229 | |||
230 | /* The owner of the signal. */ | ||
231 | gctHANDLE process; | ||
232 | |||
233 | gckHARDWARE hardware; | ||
234 | |||
235 | /* ID. */ | ||
236 | gctUINT32 id; | ||
237 | } | ||
238 | gcsSIGNAL; | ||
239 | |||
240 | #if gcdANDROID_NATIVE_FENCE_SYNC | ||
241 | typedef struct _gcsSYNC_POINT * gcsSYNC_POINT_PTR; | ||
242 | typedef struct _gcsSYNC_POINT | ||
243 | { | ||
244 | /* The reference counter. */ | ||
245 | atomic_t ref; | ||
246 | |||
247 | /* State. */ | ||
248 | atomic_t state; | ||
249 | |||
250 | /* timeline. */ | ||
251 | struct sync_timeline * timeline; | ||
252 | |||
253 | /* ID. */ | ||
254 | gctUINT32 id; | ||
255 | } | ||
256 | gcsSYNC_POINT; | ||
257 | #endif | ||
258 | |||
259 | typedef struct _gcsPageInfo * gcsPageInfo_PTR; | ||
260 | typedef struct _gcsPageInfo | ||
261 | { | ||
262 | struct page **pages; | ||
263 | gctUINT32_PTR pageTable; | ||
264 | gctUINT32 extraPage; | ||
265 | gctUINT32 address; | ||
266 | #if gcdPROCESS_ADDRESS_SPACE | ||
267 | gckMMU mmu; | ||
268 | #endif | ||
269 | } | ||
270 | gcsPageInfo; | ||
271 | |||
272 | typedef struct _gcsOSTIMER * gcsOSTIMER_PTR; | ||
273 | typedef struct _gcsOSTIMER | ||
274 | { | ||
275 | struct delayed_work work; | ||
276 | gctTIMERFUNCTION function; | ||
277 | gctPOINTER data; | ||
278 | } gcsOSTIMER; | ||
279 | |||
280 | gceSTATUS | ||
281 | gckOS_ImportAllocators( | ||
282 | gckOS Os | ||
283 | ); | ||
284 | |||
285 | gceSTATUS | ||
286 | gckOS_FreeAllocators( | ||
287 | gckOS Os | ||
288 | ); | ||
289 | |||
290 | gceSTATUS | ||
291 | _HandleOuterCache( | ||
292 | IN gckOS Os, | ||
293 | IN gctUINT32 Physical, | ||
294 | IN gctPOINTER Logical, | ||
295 | IN gctSIZE_T Bytes, | ||
296 | IN gceCACHEOPERATION Type | ||
297 | ); | ||
298 | |||
299 | gceSTATUS | ||
300 | _ConvertLogical2Physical( | ||
301 | IN gckOS Os, | ||
302 | IN gctPOINTER Logical, | ||
303 | IN gctUINT32 ProcessID, | ||
304 | IN PLINUX_MDL Mdl, | ||
305 | OUT gctUINT32_PTR Physical | ||
306 | ); | ||
307 | |||
308 | gctSTRING | ||
309 | _CreateKernelVirtualMapping( | ||
310 | IN PLINUX_MDL Mdl | ||
311 | ); | ||
312 | |||
313 | void | ||
314 | _DestoryKernelVirtualMapping( | ||
315 | IN gctSTRING Addr | ||
316 | ); | ||
317 | |||
318 | void | ||
319 | _UnmapUserLogical( | ||
320 | IN gctPOINTER Logical, | ||
321 | IN gctUINT32 Size | ||
322 | ); | ||
323 | |||
324 | static inline gctINT | ||
325 | _GetProcessID( | ||
326 | void | ||
327 | ) | ||
328 | { | ||
329 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) | ||
330 | return task_tgid_vnr(current); | ||
331 | #else | ||
332 | return current->tgid; | ||
333 | #endif | ||
334 | } | ||
335 | |||
336 | static inline struct page * | ||
337 | _NonContiguousToPage( | ||
338 | IN struct page ** Pages, | ||
339 | IN gctUINT32 Index | ||
340 | ) | ||
341 | { | ||
342 | gcmkASSERT(Pages != gcvNULL); | ||
343 | return Pages[Index]; | ||
344 | } | ||
345 | |||
346 | static inline unsigned long | ||
347 | _NonContiguousToPfn( | ||
348 | IN struct page ** Pages, | ||
349 | IN gctUINT32 Index | ||
350 | ) | ||
351 | { | ||
352 | gcmkASSERT(Pages != gcvNULL); | ||
353 | return page_to_pfn(_NonContiguousToPage(Pages, Index)); | ||
354 | } | ||
355 | |||
356 | static inline unsigned long | ||
357 | _NonContiguousToPhys( | ||
358 | IN struct page ** Pages, | ||
359 | IN gctUINT32 Index | ||
360 | ) | ||
361 | { | ||
362 | gcmkASSERT(Pages != gcvNULL); | ||
363 | return page_to_phys(_NonContiguousToPage(Pages, Index)); | ||
364 | } | ||
365 | |||
366 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) | ||
367 | static inline int | ||
368 | is_vmalloc_addr( | ||
369 | void *Addr | ||
370 | ) | ||
371 | { | ||
372 | unsigned long addr = (unsigned long)Addr; | ||
373 | |||
374 | return addr >= VMALLOC_START && addr < VMALLOC_END; | ||
375 | } | ||
376 | #endif | ||
377 | |||
378 | |||
379 | |||
83 | #endif /* __gc_hal_kernel_linux_h_ */ | 380 | #endif /* __gc_hal_kernel_linux_h_ */ |
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c index eda7e53c6f55..a1476d20604f 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | |||
@@ -28,12 +28,10 @@ | |||
28 | #include <asm/atomic.h> | 28 | #include <asm/atomic.h> |
29 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/idr.h> | ||
32 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) | 31 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) |
33 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
34 | #endif | 33 | #endif |
35 | #include <linux/workqueue.h> | 34 | #include <linux/workqueue.h> |
36 | #include <linux/idr.h> | ||
37 | #include <linux/irqflags.h> | 35 | #include <linux/irqflags.h> |
38 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) | 36 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) |
39 | #include <linux/math64.h> | 37 | #include <linux/math64.h> |
@@ -54,6 +52,8 @@ static inline void imx_gpc_power_up_pu(bool flag) {} | |||
54 | 52 | ||
55 | #define _GC_OBJ_ZONE gcvZONE_OS | 53 | #define _GC_OBJ_ZONE gcvZONE_OS |
56 | 54 | ||
55 | #include "gc_hal_kernel_allocator.h" | ||
56 | |||
57 | /******************************************************************************* | 57 | /******************************************************************************* |
58 | ***** Version Signature *******************************************************/ | 58 | ***** Version Signature *******************************************************/ |
59 | 59 | ||
@@ -63,7 +63,6 @@ const char * _PLATFORM = "\n\0$PLATFORM$Android$\n"; | |||
63 | const char * _PLATFORM = "\n\0$PLATFORM$Linux$\n"; | 63 | const char * _PLATFORM = "\n\0$PLATFORM$Linux$\n"; |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #define gcdSUPPRESS_OOM_MESSAGE 1 | ||
67 | 66 | ||
68 | #define MEMORY_LOCK(os) \ | 67 | #define MEMORY_LOCK(os) \ |
69 | gcmkVERIFY_OK(gckOS_AcquireMutex( \ | 68 | gcmkVERIFY_OK(gckOS_AcquireMutex( \ |
@@ -83,209 +82,11 @@ const char * _PLATFORM = "\n\0$PLATFORM$Linux$\n"; | |||
83 | #define MEMORY_MAP_UNLOCK(os) \ | 82 | #define MEMORY_MAP_UNLOCK(os) \ |
84 | gcmkVERIFY_OK(gckOS_ReleaseMutex((os), (os)->memoryMapLock)) | 83 | gcmkVERIFY_OK(gckOS_ReleaseMutex((os), (os)->memoryMapLock)) |
85 | 84 | ||
86 | /* Protection bit when mapping memroy to user sapce */ | ||
87 | #define gcmkPAGED_MEMROY_PROT(x) pgprot_writecombine(x) | ||
88 | |||
89 | #if gcdNONPAGED_MEMORY_BUFFERABLE | ||
90 | #define gcmkIOREMAP ioremap_wc | ||
91 | #define gcmkNONPAGED_MEMROY_PROT(x) pgprot_writecombine(x) | ||
92 | #elif !gcdNONPAGED_MEMORY_CACHEABLE | ||
93 | #define gcmkIOREMAP ioremap_nocache | ||
94 | #define gcmkNONPAGED_MEMROY_PROT(x) pgprot_noncached(x) | ||
95 | #endif | ||
96 | |||
97 | #if gcdSUPPRESS_OOM_MESSAGE | ||
98 | #define gcdNOWARN __GFP_NOWARN | ||
99 | #else | ||
100 | #define gcdNOWARN 0 | ||
101 | #endif | ||
102 | |||
103 | #define gcdUSE_NON_PAGED_MEMORY_CACHE 10 | ||
104 | |||
105 | /******************************************************************************\ | ||
106 | ********************************** Structures ********************************** | ||
107 | \******************************************************************************/ | ||
108 | #if gcdUSE_NON_PAGED_MEMORY_CACHE | ||
109 | typedef struct _gcsNonPagedMemoryCache | ||
110 | { | ||
111 | #ifndef NO_DMA_COHERENT | ||
112 | gctINT size; | ||
113 | gctSTRING addr; | ||
114 | dma_addr_t dmaHandle; | ||
115 | #else | ||
116 | long order; | ||
117 | struct page * page; | ||
118 | #endif | ||
119 | |||
120 | struct _gcsNonPagedMemoryCache * prev; | ||
121 | struct _gcsNonPagedMemoryCache * next; | ||
122 | } | ||
123 | gcsNonPagedMemoryCache; | ||
124 | #endif /* gcdUSE_NON_PAGED_MEMORY_CACHE */ | ||
125 | |||
126 | typedef struct _gcsUSER_MAPPING * gcsUSER_MAPPING_PTR; | ||
127 | typedef struct _gcsUSER_MAPPING | ||
128 | { | ||
129 | /* Pointer to next mapping structure. */ | ||
130 | gcsUSER_MAPPING_PTR next; | ||
131 | |||
132 | /* Physical address of this mapping. */ | ||
133 | gctUINT32 physical; | ||
134 | |||
135 | /* Logical address of this mapping. */ | ||
136 | gctPOINTER logical; | ||
137 | |||
138 | /* Number of bytes of this mapping. */ | ||
139 | gctSIZE_T bytes; | ||
140 | |||
141 | /* Starting address of this mapping. */ | ||
142 | gctINT8_PTR start; | ||
143 | |||
144 | /* Ending address of this mapping. */ | ||
145 | gctINT8_PTR end; | ||
146 | } | ||
147 | gcsUSER_MAPPING; | ||
148 | |||
149 | typedef struct _gcsINTEGER_DB * gcsINTEGER_DB_PTR; | ||
150 | typedef struct _gcsINTEGER_DB | ||
151 | { | ||
152 | struct idr idr; | ||
153 | spinlock_t lock; | ||
154 | gctINT curr; | ||
155 | } | ||
156 | gcsINTEGER_DB; | ||
157 | |||
158 | struct _gckOS | ||
159 | { | ||
160 | /* Object. */ | ||
161 | gcsOBJECT object; | ||
162 | |||
163 | /* Pointer to device */ | ||
164 | gckGALDEVICE device; | ||
165 | |||
166 | /* Memory management */ | ||
167 | gctPOINTER memoryLock; | ||
168 | gctPOINTER memoryMapLock; | ||
169 | |||
170 | struct _LINUX_MDL *mdlHead; | ||
171 | struct _LINUX_MDL *mdlTail; | ||
172 | |||
173 | /* Kernel process ID. */ | ||
174 | gctUINT32 kernelProcessID; | ||
175 | |||
176 | /* Signal management. */ | ||
177 | |||
178 | /* Lock. */ | ||
179 | gctPOINTER signalMutex; | ||
180 | |||
181 | /* signal id database. */ | ||
182 | gcsINTEGER_DB signalDB; | ||
183 | |||
184 | #if gcdANDROID_NATIVE_FENCE_SYNC | ||
185 | /* Lock. */ | ||
186 | gctPOINTER syncPointMutex; | ||
187 | |||
188 | /* sync point id database. */ | ||
189 | gcsINTEGER_DB syncPointDB; | ||
190 | #endif | ||
191 | |||
192 | gcsUSER_MAPPING_PTR userMap; | ||
193 | gctPOINTER debugLock; | ||
194 | |||
195 | #if gcdUSE_NON_PAGED_MEMORY_CACHE | ||
196 | gctUINT cacheSize; | ||
197 | gcsNonPagedMemoryCache * cacheHead; | ||
198 | gcsNonPagedMemoryCache * cacheTail; | ||
199 | #endif | ||
200 | |||
201 | /* workqueue for os timer. */ | ||
202 | struct workqueue_struct * workqueue; | ||
203 | |||
204 | /* Allocate extra page to avoid cache overflow */ | ||
205 | struct page* paddingPage; | ||
206 | |||
207 | /* Detect unfreed allocation. */ | ||
208 | atomic_t allocateCount; | ||
209 | }; | ||
210 | |||
211 | typedef struct _gcsSIGNAL * gcsSIGNAL_PTR; | ||
212 | typedef struct _gcsSIGNAL | ||
213 | { | ||
214 | /* Kernel sync primitive. */ | ||
215 | struct completion obj; | ||
216 | |||
217 | /* Manual reset flag. */ | ||
218 | gctBOOL manualReset; | ||
219 | |||
220 | /* The reference counter. */ | ||
221 | atomic_t ref; | ||
222 | |||
223 | /* The owner of the signal. */ | ||
224 | gctHANDLE process; | ||
225 | |||
226 | gckHARDWARE hardware; | ||
227 | |||
228 | /* ID. */ | ||
229 | gctUINT32 id; | ||
230 | } | ||
231 | gcsSIGNAL; | ||
232 | |||
233 | #if gcdANDROID_NATIVE_FENCE_SYNC | ||
234 | typedef struct _gcsSYNC_POINT * gcsSYNC_POINT_PTR; | ||
235 | typedef struct _gcsSYNC_POINT | ||
236 | { | ||
237 | /* The reference counter. */ | ||
238 | atomic_t ref; | ||
239 | |||
240 | /* State. */ | ||
241 | atomic_t state; | ||
242 | |||
243 | /* timeline. */ | ||
244 | struct sync_timeline * timeline; | ||
245 | |||
246 | /* ID. */ | ||
247 | gctUINT32 id; | ||
248 | } | ||
249 | gcsSYNC_POINT; | ||
250 | #endif | ||
251 | |||
252 | typedef struct _gcsPageInfo * gcsPageInfo_PTR; | ||
253 | typedef struct _gcsPageInfo | ||
254 | { | ||
255 | struct page **pages; | ||
256 | gctUINT32_PTR pageTable; | ||
257 | gctUINT32 extraPage; | ||
258 | #if gcdPROCESS_ADDRESS_SPACE | ||
259 | gctUINT32 address; | ||
260 | gckMMU mmu; | ||
261 | #endif | ||
262 | } | ||
263 | gcsPageInfo; | ||
264 | |||
265 | typedef struct _gcsOSTIMER * gcsOSTIMER_PTR; | ||
266 | typedef struct _gcsOSTIMER | ||
267 | { | ||
268 | struct delayed_work work; | ||
269 | gctTIMERFUNCTION function; | ||
270 | gctPOINTER data; | ||
271 | } gcsOSTIMER; | ||
272 | 85 | ||
273 | /******************************************************************************\ | 86 | /******************************************************************************\ |
274 | ******************************* Private Functions ****************************** | 87 | ******************************* Private Functions ****************************** |
275 | \******************************************************************************/ | 88 | \******************************************************************************/ |
276 | static gctINT | 89 | static gctINT |
277 | _GetProcessID( | ||
278 | void | ||
279 | ) | ||
280 | { | ||
281 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) | ||
282 | return task_tgid_vnr(current); | ||
283 | #else | ||
284 | return current->tgid; | ||
285 | #endif | ||
286 | } | ||
287 | |||
288 | static gctINT | ||
289 | _GetThreadID( | 90 | _GetThreadID( |
290 | void | 91 | void |
291 | ) | 92 | ) |
@@ -445,140 +246,6 @@ FindMdlMap( | |||
445 | return gcvNULL; | 246 | return gcvNULL; |
446 | } | 247 | } |
447 | 248 | ||
448 | void | ||
449 | OnProcessExit( | ||
450 | IN gckOS Os, | ||
451 | IN gckKERNEL Kernel | ||
452 | ) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) | ||
457 | static inline int | ||
458 | is_vmalloc_addr( | ||
459 | void *Addr | ||
460 | ) | ||
461 | { | ||
462 | unsigned long addr = (unsigned long)Addr; | ||
463 | |||
464 | return addr >= VMALLOC_START && addr < VMALLOC_END; | ||
465 | } | ||
466 | #endif | ||
467 | |||
468 | static void | ||
469 | _NonContiguousFree( | ||
470 | IN struct page ** Pages, | ||
471 | IN gctUINT32 NumPages | ||
472 | ) | ||
473 | { | ||
474 | gctINT i; | ||
475 | |||
476 | gcmkHEADER_ARG("Pages=0x%X, NumPages=%d", Pages, NumPages); | ||
477 | |||
478 | gcmkASSERT(Pages != gcvNULL); | ||
479 | |||
480 | for (i = 0; i < NumPages; i++) | ||
481 | { | ||
482 | __free_page(Pages[i]); | ||
483 | } | ||
484 | |||
485 | if (is_vmalloc_addr(Pages)) | ||
486 | { | ||
487 | vfree(Pages); | ||
488 | } | ||
489 | else | ||
490 | { | ||
491 | kfree(Pages); | ||
492 | } | ||
493 | |||
494 | gcmkFOOTER_NO(); | ||
495 | } | ||
496 | |||
497 | static struct page ** | ||
498 | _NonContiguousAlloc( | ||
499 | IN gctUINT32 NumPages | ||
500 | ) | ||
501 | { | ||
502 | struct page ** pages; | ||
503 | struct page *p; | ||
504 | gctINT i, size; | ||
505 | |||
506 | gcmkHEADER_ARG("NumPages=%lu", NumPages); | ||
507 | |||
508 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) | ||
509 | if (NumPages > totalram_pages) | ||
510 | #else | ||
511 | if (NumPages > num_physpages) | ||
512 | #endif | ||
513 | { | ||
514 | gcmkFOOTER_NO(); | ||
515 | return gcvNULL; | ||
516 | } | ||
517 | |||
518 | size = NumPages * sizeof(struct page *); | ||
519 | |||
520 | pages = kmalloc(size, GFP_KERNEL | gcdNOWARN); | ||
521 | |||
522 | if (!pages) | ||
523 | { | ||
524 | pages = vmalloc(size); | ||
525 | |||
526 | if (!pages) | ||
527 | { | ||
528 | gcmkFOOTER_NO(); | ||
529 | return gcvNULL; | ||
530 | } | ||
531 | } | ||
532 | |||
533 | for (i = 0; i < NumPages; i++) | ||
534 | { | ||
535 | p = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | gcdNOWARN); | ||
536 | |||
537 | if (!p) | ||
538 | { | ||
539 | _NonContiguousFree(pages, i); | ||
540 | gcmkFOOTER_NO(); | ||
541 | return gcvNULL; | ||
542 | } | ||
543 | |||
544 | pages[i] = p; | ||
545 | } | ||
546 | |||
547 | gcmkFOOTER_ARG("pages=0x%X", pages); | ||
548 | return pages; | ||
549 | } | ||
550 | |||
551 | static inline struct page * | ||
552 | _NonContiguousToPage( | ||
553 | IN struct page ** Pages, | ||
554 | IN gctUINT32 Index | ||
555 | ) | ||
556 | { | ||
557 | gcmkASSERT(Pages != gcvNULL); | ||
558 | return Pages[Index]; | ||
559 | } | ||
560 | |||
561 | static inline unsigned long | ||
562 | _NonContiguousToPfn( | ||
563 | IN struct page ** Pages, | ||
564 | IN gctUINT32 Index | ||
565 | ) | ||
566 | { | ||
567 | gcmkASSERT(Pages != gcvNULL); | ||
568 | return page_to_pfn(_NonContiguousToPage(Pages, Index)); | ||
569 | } | ||
570 | |||
571 | static inline unsigned long | ||
572 | _NonContiguousToPhys( | ||
573 | IN struct page ** Pages, | ||
574 | IN gctUINT32 Index | ||
575 | ) | ||
576 | { | ||
577 | gcmkASSERT(Pages != gcvNULL); | ||
578 | return page_to_phys(_NonContiguousToPage(Pages, Index)); | ||
579 | } | ||
580 | |||
581 | |||
582 | #if gcdUSE_NON_PAGED_MEMORY_CACHE | 249 | #if gcdUSE_NON_PAGED_MEMORY_CACHE |
583 | 250 | ||
584 | static gctBOOL | 251 | static gctBOOL |
@@ -916,42 +583,6 @@ _DestroyIntegerId( | |||
916 | return gcvSTATUS_OK; | 583 | return gcvSTATUS_OK; |
917 | } | 584 | } |
918 | 585 | ||
919 | static void | ||
920 | _UnmapUserLogical( | ||
921 | IN gctINT Pid, | ||
922 | IN gctPOINTER Logical, | ||
923 | IN gctUINT32 Size | ||
924 | ) | ||
925 | { | ||
926 | if (unlikely(current->mm == gcvNULL)) | ||
927 | { | ||
928 | /* Do nothing if process is exiting. */ | ||
929 | return; | ||
930 | } | ||
931 | |||
932 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) | ||
933 | if (vm_munmap((unsigned long)Logical, Size) < 0) | ||
934 | { | ||
935 | gcmkTRACE_ZONE( | ||
936 | gcvLEVEL_WARNING, gcvZONE_OS, | ||
937 | "%s(%d): vm_munmap failed", | ||
938 | __FUNCTION__, __LINE__ | ||
939 | ); | ||
940 | } | ||
941 | #else | ||
942 | down_write(¤t->mm->mmap_sem); | ||
943 | if (do_munmap(current->mm, (unsigned long)Logical, Size) < 0) | ||
944 | { | ||
945 | gcmkTRACE_ZONE( | ||
946 | gcvLEVEL_WARNING, gcvZONE_OS, | ||
947 | "%s(%d): do_munmap failed", | ||
948 | __FUNCTION__, __LINE__ | ||
949 | ); | ||
950 | } | ||
951 | up_write(¤t->mm->mmap_sem); | ||
952 | #endif | ||
953 | } | ||
954 | |||
955 | gceSTATUS | 586 | gceSTATUS |
956 | _QueryProcessPageTable( | 587 | _QueryProcessPageTable( |
957 | IN gctPOINTER Logical, | 588 | IN gctPOINTER Logical, |
@@ -1055,7 +686,7 @@ outer_func( | |||
1055 | ** gceOUTERCACHE_OPERATION Type | 686 | ** gceOUTERCACHE_OPERATION Type |
1056 | ** Operation need to be execute. | 687 | ** Operation need to be execute. |
1057 | */ | 688 | */ |
1058 | static gceSTATUS | 689 | gceSTATUS |
1059 | _HandleOuterCache( | 690 | _HandleOuterCache( |
1060 | IN gckOS Os, | 691 | IN gckOS Os, |
1061 | IN gctUINT32 Physical, | 692 | IN gctUINT32 Physical, |
@@ -1232,6 +863,8 @@ gckOS_Construct( | |||
1232 | SetPageReserved(os->paddingPage); | 863 | SetPageReserved(os->paddingPage); |
1233 | } | 864 | } |
1234 | 865 | ||
866 | gckOS_ImportAllocators(os); | ||
867 | |||
1235 | /* Return pointer to the gckOS object. */ | 868 | /* Return pointer to the gckOS object. */ |
1236 | *Os = os; | 869 | *Os = os; |
1237 | 870 | ||
@@ -1350,17 +983,14 @@ gckOS_Destroy( | |||
1350 | /* Destory work queue. */ | 983 | /* Destory work queue. */ |
1351 | destroy_workqueue(Os->workqueue); | 984 | destroy_workqueue(Os->workqueue); |
1352 | 985 | ||
986 | gckOS_FreeAllocators(Os); | ||
987 | |||
1353 | /* Flush the debug cache. */ | 988 | /* Flush the debug cache. */ |
1354 | gcmkDEBUGFLUSH(~0U); | 989 | gcmkDEBUGFLUSH(~0U); |
1355 | 990 | ||
1356 | /* Mark the gckOS object as unknown. */ | 991 | /* Mark the gckOS object as unknown. */ |
1357 | Os->object.type = gcvOBJ_UNKNOWN; | 992 | Os->object.type = gcvOBJ_UNKNOWN; |
1358 | 993 | ||
1359 | if (atomic_read(&Os->allocateCount) != 0) | ||
1360 | { | ||
1361 | gcmkPRINT("[galcore]: Memory leak detected, %d allocation not freed", | ||
1362 | atomic_read(&Os->allocateCount)); | ||
1363 | } | ||
1364 | 994 | ||
1365 | /* Free the gckOS object. */ | 995 | /* Free the gckOS object. */ |
1366 | kfree(Os); | 996 | kfree(Os); |
@@ -1370,109 +1000,73 @@ gckOS_Destroy( | |||
1370 | return gcvSTATUS_OK; | 1000 | return gcvSTATUS_OK; |
1371 | } | 1001 | } |
1372 | 1002 | ||
1373 | static gctSTRING | 1003 | gceSTATUS |
1374 | _CreateKernelVirtualMapping( | 1004 | gckOS_CreateKernelVirtualMapping( |
1375 | IN PLINUX_MDL Mdl | 1005 | IN gckOS Os, |
1006 | IN gctPHYS_ADDR Physical, | ||
1007 | IN gctSIZE_T Bytes, | ||
1008 | OUT gctPOINTER * Logical, | ||
1009 | OUT gctSIZE_T * PageCount | ||
1376 | ) | 1010 | ) |
1377 | { | 1011 | { |
1378 | gctSTRING addr = 0; | 1012 | gceSTATUS status; |
1379 | gctINT numPages = Mdl->numPages; | 1013 | PLINUX_MDL mdl = (PLINUX_MDL)Physical; |
1380 | 1014 | gckALLOCATOR allocator = mdl->allocator; | |
1381 | #if gcdNONPAGED_MEMORY_CACHEABLE | ||
1382 | if (Mdl->contiguous) | ||
1383 | { | ||
1384 | addr = page_address(Mdl->u.contiguousPages); | ||
1385 | } | ||
1386 | else | ||
1387 | { | ||
1388 | addr = vmap(Mdl->u.nonContiguousPages, | ||
1389 | numPages, | ||
1390 | 0, | ||
1391 | PAGE_KERNEL); | ||
1392 | |||
1393 | /* Trigger a page fault. */ | ||
1394 | memset(addr, 0, numPages * PAGE_SIZE); | ||
1395 | } | ||
1396 | #else | ||
1397 | struct page ** pages; | ||
1398 | gctBOOL free = gcvFALSE; | ||
1399 | gctINT i; | ||
1400 | |||
1401 | if (Mdl->contiguous) | ||
1402 | { | ||
1403 | if(Mdl->addr) | ||
1404 | { | ||
1405 | /*for the memory allocated from DMA, there is no contiguousPages, | ||
1406 | but the kernel virtual address is already got*/ | ||
1407 | return Mdl->addr; | ||
1408 | } | ||
1409 | pages = kmalloc(sizeof(struct page *) * numPages, GFP_KERNEL | gcdNOWARN); | ||
1410 | |||
1411 | if (!pages) | ||
1412 | { | ||
1413 | return gcvNULL; | ||
1414 | } | ||
1415 | |||
1416 | for (i = 0; i < numPages; i++) | ||
1417 | { | ||
1418 | pages[i] = nth_page(Mdl->u.contiguousPages, i); | ||
1419 | } | ||
1420 | 1015 | ||
1421 | free = gcvTRUE; | 1016 | gcmkHEADER(); |
1422 | } | ||
1423 | else | ||
1424 | { | ||
1425 | pages = Mdl->u.nonContiguousPages; | ||
1426 | } | ||
1427 | 1017 | ||
1428 | /* ioremap() can't work on system memory since 2.6.38. */ | 1018 | *PageCount = mdl->numPages; |
1429 | addr = vmap(pages, numPages, 0, gcmkNONPAGED_MEMROY_PROT(PAGE_KERNEL)); | ||
1430 | 1019 | ||
1431 | if (free) | 1020 | gcmkONERROR(allocator->ops->MapKernel(allocator, mdl, Logical)); |
1432 | { | ||
1433 | kfree(pages); | ||
1434 | } | ||
1435 | 1021 | ||
1436 | #endif | 1022 | gcmkFOOTER_NO(); |
1023 | return gcvSTATUS_OK; | ||
1437 | 1024 | ||
1438 | return addr; | 1025 | OnError: |
1026 | gcmkFOOTER(); | ||
1027 | return status; | ||
1439 | } | 1028 | } |
1440 | 1029 | ||
1441 | static void | 1030 | gceSTATUS |
1442 | _DestoryKernelVirtualMapping( | 1031 | gckOS_DestroyKernelVirtualMapping( |
1443 | IN PLINUX_MDL Mdl, | 1032 | IN gckOS Os, |
1444 | IN gctSTRING Addr | 1033 | IN gctPHYS_ADDR Physical, |
1034 | IN gctSIZE_T Bytes, | ||
1035 | IN gctPOINTER Logical | ||
1445 | ) | 1036 | ) |
1446 | { | 1037 | { |
1447 | #if !gcdNONPAGED_MEMORY_CACHEABLE | 1038 | PLINUX_MDL mdl = (PLINUX_MDL)Physical; |
1448 | if(!Mdl->addr) | 1039 | gckALLOCATOR allocator = mdl->allocator; |
1449 | vunmap(Addr); | 1040 | |
1450 | #endif | 1041 | gcmkHEADER(); |
1042 | |||
1043 | allocator->ops->UnmapKernel(allocator, mdl, Logical); | ||
1044 | |||
1045 | gcmkFOOTER_NO(); | ||
1046 | return gcvSTATUS_OK; | ||
1451 | } | 1047 | } |
1452 | 1048 | ||
1453 | gceSTATUS | 1049 | gceSTATUS |
1454 | gckOS_CreateKernelVirtualMapping( | 1050 | gckOS_CreateUserVirtualMapping( |
1051 | IN gckOS Os, | ||
1455 | IN gctPHYS_ADDR Physical, | 1052 | IN gctPHYS_ADDR Physical, |
1456 | IN gctSIZE_T Bytes, | 1053 | IN gctSIZE_T Bytes, |
1457 | OUT gctSIZE_T * PageCount, | 1054 | OUT gctPOINTER * Logical, |
1458 | OUT gctPOINTER * Logical | 1055 | OUT gctSIZE_T * PageCount |
1459 | ) | 1056 | ) |
1460 | { | 1057 | { |
1461 | *PageCount = ((PLINUX_MDL)Physical)->numPages; | 1058 | return gckOS_LockPages(Os, Physical, Bytes, gcvFALSE, Logical, PageCount); |
1462 | *Logical = _CreateKernelVirtualMapping((PLINUX_MDL)Physical); | ||
1463 | |||
1464 | return gcvSTATUS_OK; | ||
1465 | } | 1059 | } |
1466 | 1060 | ||
1467 | gceSTATUS | 1061 | gceSTATUS |
1468 | gckOS_DestroyKernelVirtualMapping( | 1062 | gckOS_DestroyUserVirtualMapping( |
1469 | IN gctPHYS_ADDR physical, | 1063 | IN gckOS Os, |
1470 | IN gctPOINTER Logical, | 1064 | IN gctPHYS_ADDR Physical, |
1471 | IN gctSIZE_T Bytes | 1065 | IN gctSIZE_T Bytes, |
1066 | IN gctPOINTER Logical | ||
1472 | ) | 1067 | ) |
1473 | { | 1068 | { |
1474 | _DestoryKernelVirtualMapping((PLINUX_MDL)physical, (gctSTRING)Logical); | 1069 | return gckOS_UnlockPages(Os, Physical, Bytes, Logical); |
1475 | return gcvSTATUS_OK; | ||
1476 | } | 1070 | } |
1477 | 1071 | ||
1478 | /******************************************************************************* | 1072 | /******************************************************************************* |
@@ -1975,7 +1569,7 @@ gckOS_UnmapMemoryEx( | |||
1975 | return gcvSTATUS_INVALID_ARGUMENT; | 1569 | return gcvSTATUS_INVALID_ARGUMENT; |
1976 | } | 1570 | } |
1977 | 1571 | ||
1978 | _UnmapUserLogical(PID, mdlMap->vmaAddr, mdl->numPages * PAGE_SIZE); | 1572 | _UnmapUserLogical(mdlMap->vmaAddr, mdl->numPages * PAGE_SIZE); |
1979 | 1573 | ||
1980 | gcmkVERIFY_OK(_DestroyMdlMap(mdl, mdlMap)); | 1574 | gcmkVERIFY_OK(_DestroyMdlMap(mdl, mdlMap)); |
1981 | } | 1575 | } |
@@ -2072,9 +1666,10 @@ gckOS_AllocateCMAMemoryFSL( | |||
2072 | gctSIZE_T bytes; | 1666 | gctSIZE_T bytes; |
2073 | gctINT numPages; | 1667 | gctINT numPages; |
2074 | PLINUX_MDL mdl = gcvNULL; | 1668 | PLINUX_MDL mdl = gcvNULL; |
2075 | gctSTRING addr; | ||
2076 | gctBOOL locked = gcvFALSE; | 1669 | gctBOOL locked = gcvFALSE; |
2077 | gceSTATUS status; | 1670 | gceSTATUS status; |
1671 | gckALLOCATOR allocator; | ||
1672 | gctUINT32 flag = 0; | ||
2078 | 1673 | ||
2079 | gcmkHEADER_ARG("Os=0x%X *Bytes=%lu", | 1674 | gcmkHEADER_ARG("Os=0x%X *Bytes=%lu", |
2080 | Os, gcmOPT_VALUE(Bytes)); | 1675 | Os, gcmOPT_VALUE(Bytes)); |
@@ -2098,48 +1693,37 @@ gckOS_AllocateCMAMemoryFSL( | |||
2098 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | 1693 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); |
2099 | } | 1694 | } |
2100 | 1695 | ||
2101 | mdl->pagedMem = 0; | 1696 | /* Walk all default allocators. */ |
2102 | mdl->numPages = numPages; | 1697 | list_for_each_entry(allocator, &Os->allocatorList, head) |
2103 | |||
2104 | MEMORY_LOCK(Os); | ||
2105 | locked = gcvTRUE; | ||
2106 | |||
2107 | |||
2108 | addr = dma_alloc_writecombine(gcvNULL, | ||
2109 | mdl->numPages * PAGE_SIZE, | ||
2110 | &mdl->dmaHandle, | ||
2111 | GFP_KERNEL | gcdNOWARN); | ||
2112 | |||
2113 | #if gcdUSE_NON_PAGED_MEMORY_CACHE | ||
2114 | if(addr == gcvNULL) | ||
2115 | { | 1698 | { |
2116 | MEMORY_UNLOCK(Os); | 1699 | if(allocator->privateData) |
2117 | locked = gcvFALSE; | 1700 | { |
2118 | /*Free all cache and try again*/ | 1701 | status = allocator->ops->Alloc(allocator, mdl, numPages, flag); |
2119 | _FreeAllNonPagedMemoryCache(Os); | 1702 | |
2120 | MEMORY_LOCK(Os); | 1703 | if (gcmIS_SUCCESS(status)) |
2121 | locked = gcvTRUE; | 1704 | { |
2122 | addr = dma_alloc_writecombine(gcvNULL, | 1705 | mdl->allocator = allocator; |
2123 | mdl->numPages * PAGE_SIZE, | 1706 | break; |
2124 | &mdl->dmaHandle, | 1707 | } |
2125 | GFP_KERNEL | gcdNOWARN); | 1708 | } |
2126 | } | 1709 | } |
2127 | #endif | 1710 | |
1711 | mdl->pagedMem = 0; | ||
1712 | mdl->numPages = numPages; | ||
2128 | mdl->contiguous = gcvTRUE; | 1713 | mdl->contiguous = gcvTRUE; |
2129 | mdl->cacheable=gcvFALSE; | 1714 | mdl->cacheable=gcvFALSE; |
2130 | 1715 | ||
2131 | if (addr == gcvNULL) | ||
2132 | { | ||
2133 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
2134 | } | ||
2135 | |||
2136 | if ((Os->device->baseAddress & 0x80000000) != (mdl->dmaHandle & 0x80000000)) | 1716 | if ((Os->device->baseAddress & 0x80000000) != (mdl->dmaHandle & 0x80000000)) |
2137 | { | 1717 | { |
2138 | gckOS_Print("Incorrect memory address allocated from CMA.0x%X!!\n",mdl->dmaHandle); | 1718 | gckOS_Print("Incorrect memory address allocated from CMA.0x%X!!\n",mdl->dmaHandle); |
1719 | allocator->ops->Free(allocator, mdl); | ||
2139 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | 1720 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); |
2140 | } | 1721 | } |
2141 | 1722 | ||
2142 | mdl->addr = addr; | 1723 | |
1724 | |||
1725 | MEMORY_LOCK(Os); | ||
1726 | locked = gcvTRUE; | ||
2143 | 1727 | ||
2144 | /* Return allocated memory. */ | 1728 | /* Return allocated memory. */ |
2145 | *Bytes = bytes; | 1729 | *Bytes = bytes; |
@@ -2221,6 +1805,7 @@ gceSTATUS gckOS_FreeCMAMemoryFSL( | |||
2221 | ) | 1805 | ) |
2222 | { | 1806 | { |
2223 | PLINUX_MDL mdl; | 1807 | PLINUX_MDL mdl; |
1808 | gckALLOCATOR allocator; | ||
2224 | 1809 | ||
2225 | gcmkHEADER_ARG("Os=0x%X Bytes=%lu Physical=0x%X", | 1810 | gcmkHEADER_ARG("Os=0x%X Bytes=%lu Physical=0x%X", |
2226 | Os, Bytes, Physical); | 1811 | Os, Bytes, Physical); |
@@ -2232,14 +1817,10 @@ gceSTATUS gckOS_FreeCMAMemoryFSL( | |||
2232 | 1817 | ||
2233 | /* Convert physical address into a pointer to a MDL. */ | 1818 | /* Convert physical address into a pointer to a MDL. */ |
2234 | mdl = (PLINUX_MDL) Physical; | 1819 | mdl = (PLINUX_MDL) Physical; |
2235 | 1820 | allocator = (gckALLOCATOR)mdl->allocator; | |
1821 | |||
2236 | MEMORY_LOCK(Os); | 1822 | MEMORY_LOCK(Os); |
2237 | 1823 | ||
2238 | dma_free_writecombine(gcvNULL, | ||
2239 | mdl->numPages * PAGE_SIZE, | ||
2240 | mdl->addr, | ||
2241 | mdl->dmaHandle); | ||
2242 | |||
2243 | #if DYNAMIC_MEMORY_RECORD | 1824 | #if DYNAMIC_MEMORY_RECORD |
2244 | Os->device->cmasize-=(mdl->numPages * PAGE_SIZE); | 1825 | Os->device->cmasize-=(mdl->numPages * PAGE_SIZE); |
2245 | #endif | 1826 | #endif |
@@ -2267,11 +1848,14 @@ gceSTATUS gckOS_FreeCMAMemoryFSL( | |||
2267 | 1848 | ||
2268 | MEMORY_UNLOCK(Os); | 1849 | MEMORY_UNLOCK(Os); |
2269 | 1850 | ||
1851 | allocator->ops->Free(allocator, mdl); | ||
1852 | |||
2270 | gcmkVERIFY_OK(_DestroyMdl(mdl)); | 1853 | gcmkVERIFY_OK(_DestroyMdl(mdl)); |
2271 | 1854 | ||
2272 | /* Success. */ | 1855 | /* Success. */ |
2273 | gcmkFOOTER_NO(); | 1856 | gcmkFOOTER_NO(); |
2274 | return gcvSTATUS_OK; | 1857 | return gcvSTATUS_OK; |
1858 | |||
2275 | } | 1859 | } |
2276 | #endif | 1860 | #endif |
2277 | 1861 | ||
@@ -2713,7 +2297,7 @@ gceSTATUS gckOS_FreeNonPagedMemory( | |||
2713 | free_pages((unsigned long)mdl->kaddr, get_order(mdl->numPages * PAGE_SIZE)); | 2297 | free_pages((unsigned long)mdl->kaddr, get_order(mdl->numPages * PAGE_SIZE)); |
2714 | } | 2298 | } |
2715 | 2299 | ||
2716 | _DestoryKernelVirtualMapping(mdl, mdl->addr); | 2300 | _DestoryKernelVirtualMapping(mdl->addr); |
2717 | #endif /* NO_DMA_COHERENT */ | 2301 | #endif /* NO_DMA_COHERENT */ |
2718 | 2302 | ||
2719 | mdlMap = mdl->maps; | 2303 | mdlMap = mdl->maps; |
@@ -3021,6 +2605,34 @@ OnError: | |||
3021 | return status; | 2605 | return status; |
3022 | } | 2606 | } |
3023 | 2607 | ||
2608 | /******************************************************************************* | ||
2609 | ** | ||
2610 | ** gckOS_UserLogicalToPhysical | ||
2611 | ** | ||
2612 | ** Get the physical system address of a corresponding user virtual address. | ||
2613 | ** | ||
2614 | ** INPUT: | ||
2615 | ** | ||
2616 | ** gckOS Os | ||
2617 | ** Pointer to an gckOS object. | ||
2618 | ** | ||
2619 | ** gctPOINTER Logical | ||
2620 | ** Logical address. | ||
2621 | ** | ||
2622 | ** OUTPUT: | ||
2623 | ** | ||
2624 | ** gctUINT32 * Address | ||
2625 | ** Pointer to a variable that receives the 32-bit physical address. | ||
2626 | */ | ||
2627 | gceSTATUS gckOS_UserLogicalToPhysical( | ||
2628 | IN gckOS Os, | ||
2629 | IN gctPOINTER Logical, | ||
2630 | OUT gctUINT32 * Address | ||
2631 | ) | ||
2632 | { | ||
2633 | return gckOS_GetPhysicalAddress(Os, Logical, Address); | ||
2634 | } | ||
2635 | |||
3024 | #if gcdSECURE_USER | 2636 | #if gcdSECURE_USER |
3025 | static gceSTATUS | 2637 | static gceSTATUS |
3026 | gckOS_AddMapping( | 2638 | gckOS_AddMapping( |
@@ -3106,7 +2718,7 @@ OnError: | |||
3106 | } | 2718 | } |
3107 | #endif | 2719 | #endif |
3108 | 2720 | ||
3109 | static gceSTATUS | 2721 | gceSTATUS |
3110 | _ConvertLogical2Physical( | 2722 | _ConvertLogical2Physical( |
3111 | IN gckOS Os, | 2723 | IN gckOS Os, |
3112 | IN gctPOINTER Logical, | 2724 | IN gctPOINTER Logical, |
@@ -3142,7 +2754,7 @@ _ConvertLogical2Physical( | |||
3142 | } | 2754 | } |
3143 | else | 2755 | else |
3144 | { | 2756 | { |
3145 | *Physical = gcmPTR2INT(virt_to_phys(base)) + offset; | 2757 | *Physical = gcmPTR2INT32(virt_to_phys(base)) + offset; |
3146 | } | 2758 | } |
3147 | 2759 | ||
3148 | return gcvSTATUS_OK; | 2760 | return gcvSTATUS_OK; |
@@ -3230,6 +2842,7 @@ gckOS_GetPhysicalAddressProcess( | |||
3230 | { | 2842 | { |
3231 | PLINUX_MDL mdl; | 2843 | PLINUX_MDL mdl; |
3232 | gctINT8_PTR base; | 2844 | gctINT8_PTR base; |
2845 | gckALLOCATOR allocator = gcvNULL; | ||
3233 | gceSTATUS status = gcvSTATUS_INVALID_ADDRESS; | 2846 | gceSTATUS status = gcvSTATUS_INVALID_ADDRESS; |
3234 | 2847 | ||
3235 | gcmkHEADER_ARG("Os=0x%X Logical=0x%X ProcessID=%d", Os, Logical, ProcessID); | 2848 | gcmkHEADER_ARG("Os=0x%X Logical=0x%X ProcessID=%d", Os, Logical, ProcessID); |
@@ -3272,11 +2885,27 @@ gckOS_GetPhysicalAddressProcess( | |||
3272 | for (mdl = Os->mdlHead; mdl != gcvNULL; mdl = mdl->next) | 2885 | for (mdl = Os->mdlHead; mdl != gcvNULL; mdl = mdl->next) |
3273 | { | 2886 | { |
3274 | /* Try this MDL. */ | 2887 | /* Try this MDL. */ |
3275 | status = _ConvertLogical2Physical(Os, | 2888 | allocator = mdl->allocator; |
3276 | Logical, | 2889 | |
3277 | ProcessID, | 2890 | if (allocator) |
3278 | mdl, | 2891 | { |
3279 | Address); | 2892 | status = allocator->ops->LogicalToPhysical( |
2893 | allocator, | ||
2894 | mdl, | ||
2895 | Logical, | ||
2896 | ProcessID, | ||
2897 | Address | ||
2898 | ); | ||
2899 | } | ||
2900 | else | ||
2901 | { | ||
2902 | status = _ConvertLogical2Physical(Os, | ||
2903 | Logical, | ||
2904 | ProcessID, | ||
2905 | mdl, | ||
2906 | Address); | ||
2907 | } | ||
2908 | |||
3280 | if (gcmIS_SUCCESS(status)) | 2909 | if (gcmIS_SUCCESS(status)) |
3281 | { | 2910 | { |
3282 | break; | 2911 | break; |
@@ -3471,7 +3100,7 @@ gckOS_UnmapPhysical( | |||
3471 | char * addr= mdl->addr; | 3100 | char * addr= mdl->addr; |
3472 | /*reset mdl->addr*/ | 3101 | /*reset mdl->addr*/ |
3473 | mdl->addr = gcvNULL; | 3102 | mdl->addr = gcvNULL; |
3474 | _DestoryKernelVirtualMapping(mdl,addr); | 3103 | _DestoryKernelVirtualMapping(addr); |
3475 | } | 3104 | } |
3476 | break; | 3105 | break; |
3477 | } | 3106 | } |
@@ -3573,7 +3202,7 @@ gckOS_DeleteMutex( | |||
3573 | gcmkVERIFY_ARGUMENT(Mutex != gcvNULL); | 3202 | gcmkVERIFY_ARGUMENT(Mutex != gcvNULL); |
3574 | 3203 | ||
3575 | /* Destroy the mutex. */ | 3204 | /* Destroy the mutex. */ |
3576 | mutex_destroy(Mutex); | 3205 | mutex_destroy((struct mutex *)Mutex); |
3577 | 3206 | ||
3578 | /* Free the mutex structure. */ | 3207 | /* Free the mutex structure. */ |
3579 | gcmkONERROR(gckOS_Free(Os, Mutex)); | 3208 | gcmkONERROR(gckOS_Free(Os, Mutex)); |
@@ -3731,6 +3360,7 @@ gckOS_AtomicExchange( | |||
3731 | 3360 | ||
3732 | /* Verify the arguments. */ | 3361 | /* Verify the arguments. */ |
3733 | gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); | 3362 | gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); |
3363 | gcmkVERIFY_ARGUMENT(OldValue != gcvNULL); | ||
3734 | 3364 | ||
3735 | /* Exchange the pair of 32-bit values. */ | 3365 | /* Exchange the pair of 32-bit values. */ |
3736 | *OldValue = (gctUINT32) atomic_xchg((atomic_t *) Target, (int) NewValue); | 3366 | *OldValue = (gctUINT32) atomic_xchg((atomic_t *) Target, (int) NewValue); |
@@ -3776,6 +3406,7 @@ gckOS_AtomicExchangePtr( | |||
3776 | 3406 | ||
3777 | /* Verify the arguments. */ | 3407 | /* Verify the arguments. */ |
3778 | gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); | 3408 | gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); |
3409 | gcmkVERIFY_ARGUMENT(OldValue != gcvNULL); | ||
3779 | 3410 | ||
3780 | /* Exchange the pair of pointers. */ | 3411 | /* Exchange the pair of pointers. */ |
3781 | *OldValue = (gctPOINTER)(gctUINTPTR_T) atomic_xchg((atomic_t *) Target, (int)(gctUINTPTR_T) NewValue); | 3412 | *OldValue = (gctPOINTER)(gctUINTPTR_T) atomic_xchg((atomic_t *) Target, (int)(gctUINTPTR_T) NewValue); |
@@ -3785,7 +3416,6 @@ gckOS_AtomicExchangePtr( | |||
3785 | return gcvSTATUS_OK; | 3416 | return gcvSTATUS_OK; |
3786 | } | 3417 | } |
3787 | 3418 | ||
3788 | #if gcdSMP | ||
3789 | /******************************************************************************* | 3419 | /******************************************************************************* |
3790 | ** | 3420 | ** |
3791 | ** gckOS_AtomicSetMask | 3421 | ** gckOS_AtomicSetMask |
@@ -3861,7 +3491,6 @@ gckOS_AtomClearMask( | |||
3861 | gcmkFOOTER_NO(); | 3491 | gcmkFOOTER_NO(); |
3862 | return gcvSTATUS_OK; | 3492 | return gcvSTATUS_OK; |
3863 | } | 3493 | } |
3864 | #endif | ||
3865 | 3494 | ||
3866 | /******************************************************************************* | 3495 | /******************************************************************************* |
3867 | ** | 3496 | ** |
@@ -4238,9 +3867,12 @@ gckOS_GetTime( | |||
4238 | OUT gctUINT64_PTR Time | 3867 | OUT gctUINT64_PTR Time |
4239 | ) | 3868 | ) |
4240 | { | 3869 | { |
3870 | struct timeval tv; | ||
4241 | gcmkHEADER(); | 3871 | gcmkHEADER(); |
4242 | 3872 | ||
4243 | *Time = 0; | 3873 | /* Return the time of day in microseconds. */ |
3874 | do_gettimeofday(&tv); | ||
3875 | *Time = (tv.tv_sec * 1000000ULL) + tv.tv_usec; | ||
4244 | 3876 | ||
4245 | gcmkFOOTER_NO(); | 3877 | gcmkFOOTER_NO(); |
4246 | return gcvSTATUS_OK; | 3878 | return gcvSTATUS_OK; |
@@ -4373,13 +4005,11 @@ gckOS_AllocatePagedMemoryEx( | |||
4373 | ) | 4005 | ) |
4374 | { | 4006 | { |
4375 | gctINT numPages; | 4007 | gctINT numPages; |
4376 | gctINT i; | ||
4377 | PLINUX_MDL mdl = gcvNULL; | 4008 | PLINUX_MDL mdl = gcvNULL; |
4378 | gctSIZE_T bytes; | 4009 | gctSIZE_T bytes; |
4379 | gceSTATUS status; | 4010 | gceSTATUS status = gcvSTATUS_OUT_OF_MEMORY; |
4380 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | 4011 | gckALLOCATOR allocator; |
4381 | gctPOINTER addr = gcvNULL; | 4012 | gctUINT32 flag = 0; |
4382 | #endif | ||
4383 | 4013 | ||
4384 | gcmkHEADER_ARG("Os=0x%X Contiguous=%d Bytes=%lu", Os, Contiguous, Bytes); | 4014 | gcmkHEADER_ARG("Os=0x%X Contiguous=%d Bytes=%lu", Os, Contiguous, Bytes); |
4385 | 4015 | ||
@@ -4400,45 +4030,26 @@ gckOS_AllocatePagedMemoryEx( | |||
4400 | 4030 | ||
4401 | if (Contiguous) | 4031 | if (Contiguous) |
4402 | { | 4032 | { |
4403 | gctUINT32 order = get_order(bytes); | 4033 | flag |= gcvALLOC_FLAG_CONTIGUOUS; |
4404 | 4034 | } | |
4405 | if (order >= MAX_ORDER) | ||
4406 | { | ||
4407 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
4408 | } | ||
4409 | |||
4410 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
4411 | addr = | ||
4412 | alloc_pages_exact(numPages * PAGE_SIZE, GFP_KERNEL | gcdNOWARN | __GFP_NORETRY); | ||
4413 | |||
4414 | mdl->u.contiguousPages = addr | ||
4415 | ? virt_to_page(addr) | ||
4416 | : gcvNULL; | ||
4417 | 4035 | ||
4418 | mdl->exact = gcvTRUE; | 4036 | /* Walk all default allocators. */ |
4419 | #else | 4037 | list_for_each_entry(allocator, &Os->allocatorList, head) |
4420 | mdl->u.contiguousPages = | 4038 | { |
4421 | alloc_pages(GFP_KERNEL | gcdNOWARN | __GFP_NORETRY, order); | 4039 | if(!allocator->privateData) |
4422 | #endif | ||
4423 | if (mdl->u.contiguousPages == gcvNULL) | ||
4424 | { | 4040 | { |
4425 | mdl->u.contiguousPages = | 4041 | status = allocator->ops->Alloc(allocator, mdl, numPages, flag); |
4426 | alloc_pages(GFP_KERNEL | __GFP_HIGHMEM | gcdNOWARN, order); | ||
4427 | 4042 | ||
4428 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | 4043 | if (gcmIS_SUCCESS(status)) |
4429 | mdl->exact = gcvFALSE; | 4044 | { |
4430 | #endif | 4045 | mdl->allocator = allocator; |
4046 | break; | ||
4047 | } | ||
4431 | } | 4048 | } |
4432 | } | 4049 | } |
4433 | else | ||
4434 | { | ||
4435 | mdl->u.nonContiguousPages = _NonContiguousAlloc(numPages); | ||
4436 | } | ||
4437 | 4050 | ||
4438 | if (mdl->u.contiguousPages == gcvNULL && mdl->u.nonContiguousPages == gcvNULL) | 4051 | /* Check status. */ |
4439 | { | 4052 | gcmkONERROR(status); |
4440 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
4441 | } | ||
4442 | 4053 | ||
4443 | mdl->dmaHandle = 0; | 4054 | mdl->dmaHandle = 0; |
4444 | mdl->addr = 0; | 4055 | mdl->addr = 0; |
@@ -4447,48 +4058,6 @@ gckOS_AllocatePagedMemoryEx( | |||
4447 | mdl->contiguous = Contiguous; | 4058 | mdl->contiguous = Contiguous; |
4448 | mdl->cacheable=gcvTRUE; | 4059 | mdl->cacheable=gcvTRUE; |
4449 | 4060 | ||
4450 | |||
4451 | for (i = 0; i < mdl->numPages; i++) | ||
4452 | { | ||
4453 | struct page *page; | ||
4454 | |||
4455 | if (mdl->contiguous) | ||
4456 | { | ||
4457 | page = nth_page(mdl->u.contiguousPages, i); | ||
4458 | } | ||
4459 | else | ||
4460 | { | ||
4461 | page = _NonContiguousToPage(mdl->u.nonContiguousPages, i); | ||
4462 | } | ||
4463 | |||
4464 | SetPageReserved(page); | ||
4465 | |||
4466 | if (!PageHighMem(page) && page_to_phys(page)) | ||
4467 | { | ||
4468 | gcmkVERIFY_OK( | ||
4469 | gckOS_CacheFlush(Os, _GetProcessID(), gcvNULL, | ||
4470 | page_to_phys(page), | ||
4471 | page_address(page), | ||
4472 | PAGE_SIZE)); | ||
4473 | } | ||
4474 | else | ||
4475 | { | ||
4476 | flush_dcache_page(page); | ||
4477 | |||
4478 | #if !gcdCACHE_FUNCTION_UNIMPLEMENTED && defined(CONFIG_OUTER_CACHE) && gcdENABLE_OUTER_CACHE_PATCH | ||
4479 | if (page_to_phys(page)) | ||
4480 | { | ||
4481 | _HandleOuterCache( | ||
4482 | Os, | ||
4483 | page_to_phys(page), | ||
4484 | gcvNULL, | ||
4485 | PAGE_SIZE, | ||
4486 | gcvCACHE_FLUSH | ||
4487 | ); | ||
4488 | } | ||
4489 | #endif | ||
4490 | } | ||
4491 | } | ||
4492 | #if DYNAMIC_MEMORY_RECORD | 4061 | #if DYNAMIC_MEMORY_RECORD |
4493 | if(mdl->contiguous) | 4062 | if(mdl->contiguous) |
4494 | { | 4063 | { |
@@ -4575,7 +4144,7 @@ gckOS_FreePagedMemory( | |||
4575 | ) | 4144 | ) |
4576 | { | 4145 | { |
4577 | PLINUX_MDL mdl = (PLINUX_MDL) Physical; | 4146 | PLINUX_MDL mdl = (PLINUX_MDL) Physical; |
4578 | gctINT i; | 4147 | gckALLOCATOR allocator = (gckALLOCATOR)mdl->allocator; |
4579 | 4148 | ||
4580 | gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%lu", Os, Physical, Bytes); | 4149 | gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%lu", Os, Physical, Bytes); |
4581 | 4150 | ||
@@ -4627,35 +4196,7 @@ gckOS_FreePagedMemory( | |||
4627 | 4196 | ||
4628 | MEMORY_UNLOCK(Os); | 4197 | MEMORY_UNLOCK(Os); |
4629 | 4198 | ||
4630 | for (i = 0; i < mdl->numPages; i++) | 4199 | allocator->ops->Free(allocator, mdl); |
4631 | { | ||
4632 | if (mdl->contiguous) | ||
4633 | { | ||
4634 | ClearPageReserved(nth_page(mdl->u.contiguousPages, i)); | ||
4635 | } | ||
4636 | else | ||
4637 | { | ||
4638 | ClearPageReserved(_NonContiguousToPage(mdl->u.nonContiguousPages, i)); | ||
4639 | } | ||
4640 | } | ||
4641 | |||
4642 | if (mdl->contiguous) | ||
4643 | { | ||
4644 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
4645 | if (mdl->exact == gcvTRUE) | ||
4646 | { | ||
4647 | free_pages_exact(page_address(mdl->u.contiguousPages), mdl->numPages * PAGE_SIZE); | ||
4648 | } | ||
4649 | else | ||
4650 | #endif | ||
4651 | { | ||
4652 | __free_pages(mdl->u.contiguousPages, get_order(mdl->numPages * PAGE_SIZE)); | ||
4653 | } | ||
4654 | } | ||
4655 | else | ||
4656 | { | ||
4657 | _NonContiguousFree(mdl->u.nonContiguousPages, mdl->numPages); | ||
4658 | } | ||
4659 | 4200 | ||
4660 | /* Free the structure... */ | 4201 | /* Free the structure... */ |
4661 | gcmkVERIFY_OK(_DestroyMdl(mdl)); | 4202 | gcmkVERIFY_OK(_DestroyMdl(mdl)); |
@@ -4705,12 +4246,10 @@ gckOS_LockPages( | |||
4705 | OUT gctSIZE_T * PageCount | 4246 | OUT gctSIZE_T * PageCount |
4706 | ) | 4247 | ) |
4707 | { | 4248 | { |
4249 | gceSTATUS status; | ||
4708 | PLINUX_MDL mdl; | 4250 | PLINUX_MDL mdl; |
4709 | PLINUX_MDL_MAP mdlMap; | 4251 | PLINUX_MDL_MAP mdlMap; |
4710 | gctSTRING addr; | 4252 | gckALLOCATOR allocator; |
4711 | unsigned long start; | ||
4712 | unsigned long pfn; | ||
4713 | gctINT i; | ||
4714 | 4253 | ||
4715 | gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%lu", Os, Physical, Logical); | 4254 | gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%lu", Os, Physical, Logical); |
4716 | 4255 | ||
@@ -4721,6 +4260,7 @@ gckOS_LockPages( | |||
4721 | gcmkVERIFY_ARGUMENT(PageCount != gcvNULL); | 4260 | gcmkVERIFY_ARGUMENT(PageCount != gcvNULL); |
4722 | 4261 | ||
4723 | mdl = (PLINUX_MDL) Physical; | 4262 | mdl = (PLINUX_MDL) Physical; |
4263 | allocator = mdl->allocator; | ||
4724 | 4264 | ||
4725 | MEMORY_LOCK(Os); | 4265 | MEMORY_LOCK(Os); |
4726 | 4266 | ||
@@ -4741,187 +4281,15 @@ gckOS_LockPages( | |||
4741 | 4281 | ||
4742 | if (mdlMap->vmaAddr == gcvNULL) | 4282 | if (mdlMap->vmaAddr == gcvNULL) |
4743 | { | 4283 | { |
4744 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) | 4284 | status = allocator->ops->MapUser(allocator, mdl, mdlMap, Cacheable); |
4745 | mdlMap->vmaAddr = (gctSTRING)vm_mmap(gcvNULL, | ||
4746 | 0L, | ||
4747 | mdl->numPages * PAGE_SIZE, | ||
4748 | PROT_READ | PROT_WRITE, | ||
4749 | MAP_SHARED, | ||
4750 | 0); | ||
4751 | #else | ||
4752 | down_write(¤t->mm->mmap_sem); | ||
4753 | |||
4754 | mdlMap->vmaAddr = (gctSTRING)do_mmap_pgoff(gcvNULL, | ||
4755 | 0L, | ||
4756 | mdl->numPages * PAGE_SIZE, | ||
4757 | PROT_READ | PROT_WRITE, | ||
4758 | MAP_SHARED, | ||
4759 | 0); | ||
4760 | 4285 | ||
4761 | up_write(¤t->mm->mmap_sem); | 4286 | if (gcmIS_ERROR(status)) |
4762 | #endif | ||
4763 | |||
4764 | gcmkTRACE_ZONE( | ||
4765 | gcvLEVEL_INFO, gcvZONE_OS, | ||
4766 | "%s(%d): vmaAddr->0x%X for phys_addr->0x%X", | ||
4767 | __FUNCTION__, __LINE__, | ||
4768 | (gctUINT32)(gctUINTPTR_T)mdlMap->vmaAddr, | ||
4769 | (gctUINT32)(gctUINTPTR_T)mdl | ||
4770 | ); | ||
4771 | |||
4772 | if (IS_ERR(mdlMap->vmaAddr)) | ||
4773 | { | 4287 | { |
4774 | gcmkTRACE_ZONE( | ||
4775 | gcvLEVEL_INFO, gcvZONE_OS, | ||
4776 | "%s(%d): do_mmap_pgoff error", | ||
4777 | __FUNCTION__, __LINE__ | ||
4778 | ); | ||
4779 | |||
4780 | mdlMap->vmaAddr = gcvNULL; | ||
4781 | |||
4782 | MEMORY_UNLOCK(Os); | 4288 | MEMORY_UNLOCK(Os); |
4783 | 4289 | ||
4784 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | 4290 | gcmkFOOTER_ARG("*status=%d", status); |
4785 | return gcvSTATUS_OUT_OF_MEMORY; | 4291 | return status; |
4786 | } | 4292 | } |
4787 | |||
4788 | down_write(¤t->mm->mmap_sem); | ||
4789 | |||
4790 | mdlMap->vma = find_vma(current->mm, (unsigned long)mdlMap->vmaAddr); | ||
4791 | |||
4792 | if (mdlMap->vma == gcvNULL) | ||
4793 | { | ||
4794 | up_write(¤t->mm->mmap_sem); | ||
4795 | |||
4796 | gcmkTRACE_ZONE( | ||
4797 | gcvLEVEL_INFO, gcvZONE_OS, | ||
4798 | "%s(%d): find_vma error", | ||
4799 | __FUNCTION__, __LINE__ | ||
4800 | ); | ||
4801 | |||
4802 | mdlMap->vmaAddr = gcvNULL; | ||
4803 | |||
4804 | MEMORY_UNLOCK(Os); | ||
4805 | |||
4806 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_RESOURCES); | ||
4807 | return gcvSTATUS_OUT_OF_RESOURCES; | ||
4808 | } | ||
4809 | |||
4810 | |||
4811 | |||
4812 | addr = mdl->addr; | ||
4813 | |||
4814 | /* Now map all the vmalloc pages to this user address. */ | ||
4815 | if (mdl->contiguous) | ||
4816 | { | ||
4817 | /* map kernel memory to user space.. */ | ||
4818 | #if LINUX_CMA_FSL | ||
4819 | if(!mdl->cacheable) | ||
4820 | { | ||
4821 | if (dma_mmap_writecombine(gcvNULL, | ||
4822 | mdlMap->vma, | ||
4823 | mdl->addr, | ||
4824 | mdl->dmaHandle, | ||
4825 | mdl->numPages * PAGE_SIZE) < 0) | ||
4826 | { | ||
4827 | up_write(¤t->mm->mmap_sem); | ||
4828 | |||
4829 | gcmkTRACE_ZONE( | ||
4830 | gcvLEVEL_WARNING, gcvZONE_OS, | ||
4831 | "%s(%d): dma_mmap_attrs error", | ||
4832 | __FUNCTION__, __LINE__ | ||
4833 | ); | ||
4834 | |||
4835 | mdlMap->vmaAddr = gcvNULL; | ||
4836 | |||
4837 | MEMORY_UNLOCK(Os); | ||
4838 | |||
4839 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
4840 | return gcvSTATUS_OUT_OF_MEMORY; | ||
4841 | } | ||
4842 | } | ||
4843 | else | ||
4844 | #endif | ||
4845 | { | ||
4846 | mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
4847 | |||
4848 | if (Cacheable == gcvFALSE) | ||
4849 | { | ||
4850 | /* Make this mapping non-cached. */ | ||
4851 | mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); | ||
4852 | } | ||
4853 | |||
4854 | if (remap_pfn_range(mdlMap->vma, | ||
4855 | mdlMap->vma->vm_start, | ||
4856 | page_to_pfn(mdl->u.contiguousPages), | ||
4857 | mdlMap->vma->vm_end - mdlMap->vma->vm_start, | ||
4858 | mdlMap->vma->vm_page_prot) < 0) | ||
4859 | { | ||
4860 | up_write(¤t->mm->mmap_sem); | ||
4861 | |||
4862 | gcmkTRACE_ZONE( | ||
4863 | gcvLEVEL_INFO, gcvZONE_OS, | ||
4864 | "%s(%d): unable to mmap ret", | ||
4865 | __FUNCTION__, __LINE__ | ||
4866 | ); | ||
4867 | |||
4868 | mdlMap->vmaAddr = gcvNULL; | ||
4869 | |||
4870 | MEMORY_UNLOCK(Os); | ||
4871 | |||
4872 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
4873 | return gcvSTATUS_OUT_OF_MEMORY; | ||
4874 | } | ||
4875 | } | ||
4876 | } | ||
4877 | else | ||
4878 | { | ||
4879 | mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
4880 | |||
4881 | if (Cacheable == gcvFALSE) | ||
4882 | { | ||
4883 | /* Make this mapping non-cached. */ | ||
4884 | mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); | ||
4885 | } | ||
4886 | |||
4887 | start = mdlMap->vma->vm_start; | ||
4888 | |||
4889 | for (i = 0; i < mdl->numPages; i++) | ||
4890 | { | ||
4891 | pfn = _NonContiguousToPfn(mdl->u.nonContiguousPages, i); | ||
4892 | |||
4893 | if (remap_pfn_range(mdlMap->vma, | ||
4894 | start, | ||
4895 | pfn, | ||
4896 | PAGE_SIZE, | ||
4897 | mdlMap->vma->vm_page_prot) < 0) | ||
4898 | { | ||
4899 | up_write(¤t->mm->mmap_sem); | ||
4900 | |||
4901 | gcmkTRACE_ZONE( | ||
4902 | gcvLEVEL_INFO, gcvZONE_OS, | ||
4903 | "%s(%d): gctPHYS_ADDR->0x%X Logical->0x%X Unable to map addr->0x%X to start->0x%X", | ||
4904 | __FUNCTION__, __LINE__, | ||
4905 | (gctUINT32)(gctUINTPTR_T)Physical, | ||
4906 | (gctUINT32)(gctUINTPTR_T)*Logical, | ||
4907 | (gctUINT32)(gctUINTPTR_T)addr, | ||
4908 | (gctUINT32)(gctUINTPTR_T)start | ||
4909 | ); | ||
4910 | |||
4911 | mdlMap->vmaAddr = gcvNULL; | ||
4912 | |||
4913 | MEMORY_UNLOCK(Os); | ||
4914 | |||
4915 | gcmkFOOTER_ARG("*status=%d", gcvSTATUS_OUT_OF_MEMORY); | ||
4916 | return gcvSTATUS_OUT_OF_MEMORY; | ||
4917 | } | ||
4918 | |||
4919 | start += PAGE_SIZE; | ||
4920 | addr += PAGE_SIZE; | ||
4921 | } | ||
4922 | } | ||
4923 | |||
4924 | up_write(¤t->mm->mmap_sem); | ||
4925 | } | 4293 | } |
4926 | 4294 | ||
4927 | mdlMap->count++; | 4295 | mdlMap->count++; |
@@ -5021,6 +4389,7 @@ gckOS_MapPagesEx( | |||
5021 | gckKERNEL kernel = Os->device->kernels[Core]; | 4389 | gckKERNEL kernel = Os->device->kernels[Core]; |
5022 | gckMMU mmu; | 4390 | gckMMU mmu; |
5023 | #endif | 4391 | #endif |
4392 | gckALLOCATOR allocator; | ||
5024 | 4393 | ||
5025 | gcmkHEADER_ARG("Os=0x%X Core=%d Physical=0x%X PageCount=%u PageTable=0x%X", | 4394 | gcmkHEADER_ARG("Os=0x%X Core=%d Physical=0x%X PageCount=%u PageTable=0x%X", |
5026 | Os, Core, Physical, PageCount, PageTable); | 4395 | Os, Core, Physical, PageCount, PageTable); |
@@ -5034,6 +4403,8 @@ gckOS_MapPagesEx( | |||
5034 | /* Convert pointer to MDL. */ | 4403 | /* Convert pointer to MDL. */ |
5035 | mdl = (PLINUX_MDL)Physical; | 4404 | mdl = (PLINUX_MDL)Physical; |
5036 | 4405 | ||
4406 | allocator = mdl->allocator; | ||
4407 | |||
5037 | gcmkTRACE_ZONE( | 4408 | gcmkTRACE_ZONE( |
5038 | gcvLEVEL_INFO, gcvZONE_OS, | 4409 | gcvLEVEL_INFO, gcvZONE_OS, |
5039 | "%s(%d): Physical->0x%X PageCount->0x%X PagedMemory->?%d", | 4410 | "%s(%d): Physical->0x%X PageCount->0x%X PagedMemory->?%d", |
@@ -5063,11 +4434,11 @@ gckOS_MapPagesEx( | |||
5063 | while (PageCount-- > 0) | 4434 | while (PageCount-- > 0) |
5064 | { | 4435 | { |
5065 | gctUINT i; | 4436 | gctUINT i; |
5066 | unsigned long phys = ~0; | 4437 | gctUINT32 phys = ~0; |
5067 | 4438 | ||
5068 | if (mdl->pagedMem && !mdl->contiguous) | 4439 | if (mdl->pagedMem && !mdl->contiguous) |
5069 | { | 4440 | { |
5070 | phys = _NonContiguousToPhys(mdl->u.nonContiguousPages, offset); | 4441 | allocator->ops->Physical(allocator, mdl, offset, &phys); |
5071 | } | 4442 | } |
5072 | else | 4443 | else |
5073 | { | 4444 | { |
@@ -5175,6 +4546,7 @@ gckOS_UnlockPages( | |||
5175 | { | 4546 | { |
5176 | PLINUX_MDL_MAP mdlMap; | 4547 | PLINUX_MDL_MAP mdlMap; |
5177 | PLINUX_MDL mdl = (PLINUX_MDL)Physical; | 4548 | PLINUX_MDL mdl = (PLINUX_MDL)Physical; |
4549 | gckALLOCATOR allocator = mdl->allocator; | ||
5178 | 4550 | ||
5179 | gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%u Logical=0x%X", | 4551 | gcmkHEADER_ARG("Os=0x%X Physical=0x%X Bytes=%u Logical=0x%X", |
5180 | Os, Physical, Bytes, Logical); | 4552 | Os, Physical, Bytes, Logical); |
@@ -5199,7 +4571,11 @@ gckOS_UnlockPages( | |||
5199 | --mdlMap->count; | 4571 | --mdlMap->count; |
5200 | if (mdlMap->count == 0) | 4572 | if (mdlMap->count == 0) |
5201 | { | 4573 | { |
5202 | _UnmapUserLogical(mdlMap->pid, mdlMap->vmaAddr, mdl->numPages * PAGE_SIZE); | 4574 | allocator->ops->UnmapUser( |
4575 | allocator, | ||
4576 | mdlMap->vmaAddr, | ||
4577 | mdl->numPages * PAGE_SIZE); | ||
4578 | |||
5203 | mdlMap->vmaAddr = gcvNULL; | 4579 | mdlMap->vmaAddr = gcvNULL; |
5204 | } | 4580 | } |
5205 | } | 4581 | } |
@@ -6178,12 +5554,12 @@ OnError: | |||
6178 | { | 5554 | { |
6179 | #if gcdPROCESS_ADDRESS_SPACE | 5555 | #if gcdPROCESS_ADDRESS_SPACE |
6180 | info->mmu = mmu; | 5556 | info->mmu = mmu; |
6181 | info->address = address; | ||
6182 | gcmkONERROR(gckMMU_Flush(mmu)); | 5557 | gcmkONERROR(gckMMU_Flush(mmu)); |
6183 | #else | 5558 | #else |
6184 | gcmkONERROR(gckMMU_Flush(Os->device->kernels[Core]->mmu)); | 5559 | gcmkONERROR(gckMMU_Flush(Os->device->kernels[Core]->mmu, gcvSURF_TYPE_UNKNOWN)); |
6185 | #endif | 5560 | #endif |
6186 | } | 5561 | } |
5562 | info->address = address; | ||
6187 | 5563 | ||
6188 | /* Save pointer to page table. */ | 5564 | /* Save pointer to page table. */ |
6189 | info->pageTable = pageTable; | 5565 | info->pageTable = pageTable; |
@@ -8319,7 +7695,7 @@ gckOS_WaitSignal( | |||
8319 | else | 7695 | else |
8320 | { | 7696 | { |
8321 | /* Convert wait to milliseconds. */ | 7697 | /* Convert wait to milliseconds. */ |
8322 | gctINT timeout = (Wait == gcvINFINITE) | 7698 | long timeout = (Wait == gcvINFINITE) |
8323 | ? MAX_SCHEDULE_TIMEOUT | 7699 | ? MAX_SCHEDULE_TIMEOUT |
8324 | : Wait * HZ / 1000; | 7700 | : Wait * HZ / 1000; |
8325 | 7701 | ||
@@ -8483,9 +7859,10 @@ gckOS_CreateUserSignal( | |||
8483 | gctSIZE_T signal; | 7859 | gctSIZE_T signal; |
8484 | 7860 | ||
8485 | /* Create a new signal. */ | 7861 | /* Create a new signal. */ |
8486 | status = gckOS_CreateSignal(Os, ManualReset, (gctSIGNAL *) &signal); | 7862 | gcmkONERROR(gckOS_CreateSignal(Os, ManualReset, (gctSIGNAL *) &signal)); |
8487 | *SignalID = (gctINT) signal; | 7863 | *SignalID = (gctINT) signal; |
8488 | 7864 | ||
7865 | OnError: | ||
8489 | return status; | 7866 | return status; |
8490 | } | 7867 | } |
8491 | 7868 | ||
@@ -9474,3 +8851,5 @@ OnError: | |||
9474 | return status; | 8851 | return status; |
9475 | } | 8852 | } |
9476 | #endif | 8853 | #endif |
8854 | |||
8855 | |||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h index 5593041b5498..2eb428f55d17 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h | |||
@@ -63,6 +63,12 @@ typedef struct _LINUX_MDL | |||
63 | PLINUX_MDL_MAP maps; | 63 | PLINUX_MDL_MAP maps; |
64 | struct _LINUX_MDL * prev; | 64 | struct _LINUX_MDL * prev; |
65 | struct _LINUX_MDL * next; | 65 | struct _LINUX_MDL * next; |
66 | |||
67 | /* Pointer to allocator which allocates memory for this mdl. */ | ||
68 | void * allocator; | ||
69 | |||
70 | /* Private data used by allocator. */ | ||
71 | void * priv; | ||
66 | } | 72 | } |
67 | LINUX_MDL, *PLINUX_MDL; | 73 | LINUX_MDL, *PLINUX_MDL; |
68 | 74 | ||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_security_channel.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_security_channel.c new file mode 100644 index 000000000000..0c93cbe11edd --- /dev/null +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_security_channel.c | |||
@@ -0,0 +1,373 @@ | |||
1 | /**************************************************************************** | ||
2 | * | ||
3 | * Copyright (C) 2005 - 2014 by Vivante Corp. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the license, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | |||
21 | |||
22 | |||
23 | #include "gc_hal_kernel_linux.h" | ||
24 | #include <linux/slab.h> | ||
25 | |||
26 | #include "tee_client_api.h" | ||
27 | |||
28 | #define _GC_OBJ_ZONE gcvZONE_OS | ||
29 | |||
30 | #define GPU3D_UUID { 0x111111, 0x1111, 0x1111, { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 } } | ||
31 | static const TEEC_UUID gpu3d_uuid = GPU3D_UUID; | ||
32 | TEEC_Context teecContext; | ||
33 | |||
34 | typedef struct _gcsSecurityChannel { | ||
35 | gckOS os; | ||
36 | TEEC_Session session; | ||
37 | int * virtual; | ||
38 | TEEC_SharedMemory inputBuffer; | ||
39 | gctUINT32 bytes; | ||
40 | gctPOINTER mutex; | ||
41 | } gcsSecurityChannel; | ||
42 | |||
43 | TEEC_SharedMemory * | ||
44 | gpu3d_allocate_secure_mem( | ||
45 | gckOS Os, | ||
46 | unsigned int size | ||
47 | ) | ||
48 | { | ||
49 | TEEC_Result result; | ||
50 | TEEC_Context *context = &teecContext; | ||
51 | TEEC_SharedMemory *shm = NULL; | ||
52 | void *handle = NULL; | ||
53 | unsigned int phyAddr = 0xFFFFFFFF; | ||
54 | gceSTATUS status; | ||
55 | gctSIZE_T bytes = size; | ||
56 | |||
57 | shm = kmalloc(sizeof(TEEC_SharedMemory), GFP_KERNEL); | ||
58 | |||
59 | if (NULL == shm) | ||
60 | { | ||
61 | return NULL; | ||
62 | } | ||
63 | |||
64 | memset(shm, 0, sizeof(TEEC_SharedMemory)); | ||
65 | |||
66 | status = gckOS_AllocateIonMemory(Os, | ||
67 | gcvTRUE, | ||
68 | &bytes, | ||
69 | (gctPHYS_ADDR *)&handle, | ||
70 | &phyAddr); | ||
71 | |||
72 | if (gcmIS_ERROR(status)) | ||
73 | { | ||
74 | kfree(shm); | ||
75 | return NULL; | ||
76 | } | ||
77 | |||
78 | /* record the handle into shm->user_data */ | ||
79 | shm->userdata = handle; | ||
80 | |||
81 | /* [b] Bulk input buffer. */ | ||
82 | shm->size = size; | ||
83 | shm->flags = TEEC_MEM_INPUT; | ||
84 | |||
85 | /* Use TEE Client API to register the underlying memory buffer. */ | ||
86 | shm->phyAddr = (void *)phyAddr; | ||
87 | |||
88 | result = TEEC_RegisterSharedMemory( | ||
89 | context, | ||
90 | shm); | ||
91 | if (result != TEEC_SUCCESS) | ||
92 | { | ||
93 | gpu_free_memory(handle); | ||
94 | kfree(shm); | ||
95 | return NULL; | ||
96 | } | ||
97 | |||
98 | return shm; | ||
99 | } | ||
100 | |||
101 | void gpu3d_release_secure_mem( | ||
102 | gckOS Os, | ||
103 | void *shm_handle | ||
104 | ) | ||
105 | { | ||
106 | TEEC_SharedMemory *shm = shm_handle; | ||
107 | void * handle; | ||
108 | |||
109 | if (!shm) | ||
110 | { | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | handle = shm->userdata; | ||
115 | |||
116 | TEEC_ReleaseSharedMemory(shm); | ||
117 | |||
118 | gckOS_FreeIonMemory(Os, (gctPHYS_ADDR)handle); | ||
119 | |||
120 | kfree(shm); | ||
121 | |||
122 | return; | ||
123 | } | ||
124 | |||
125 | static TEEC_Result gpu3d_session_callback( | ||
126 | TEEC_Session* session, | ||
127 | uint32_t commandID, | ||
128 | TEEC_Operation* operation, | ||
129 | void* userdata | ||
130 | ) | ||
131 | { | ||
132 | gcsSecurityChannel *channel = userdata; | ||
133 | |||
134 | if (channel == gcvNULL) | ||
135 | { | ||
136 | return TEEC_ERROR_BAD_PARAMETERS; | ||
137 | } | ||
138 | |||
139 | switch(commandID) | ||
140 | { | ||
141 | case gcvTA_CALLBACK_ALLOC_SECURE_MEM: | ||
142 | { | ||
143 | uint32_t size = operation->params[0].value.a; | ||
144 | TEEC_SharedMemory *shm = NULL; | ||
145 | |||
146 | shm = gpu3d_allocate_secure_mem(channel->os, size); | ||
147 | |||
148 | /* use the value to save the pointer in client side */ | ||
149 | operation->params[0].value.a = (uint32_t)shm; | ||
150 | operation->params[0].value.b = (uint32_t)shm->phyAddr; | ||
151 | |||
152 | break; | ||
153 | } | ||
154 | case gcvTA_CALLBACK_FREE_SECURE_MEM: | ||
155 | { | ||
156 | TEEC_SharedMemory *shm = (TEEC_SharedMemory *)operation->params[0].value.a; | ||
157 | |||
158 | gpu3d_release_secure_mem(channel->os, shm); | ||
159 | break; | ||
160 | } | ||
161 | default: | ||
162 | break; | ||
163 | } | ||
164 | |||
165 | return TEEC_SUCCESS; | ||
166 | } | ||
167 | |||
168 | gceSTATUS | ||
169 | gckOS_OpenSecurityChannel( | ||
170 | IN gckOS Os, | ||
171 | IN gceCORE GPU, | ||
172 | OUT gctUINT32 *Channel | ||
173 | ) | ||
174 | { | ||
175 | gceSTATUS status; | ||
176 | TEEC_Result result; | ||
177 | static bool initialized = gcvFALSE; | ||
178 | gcsSecurityChannel *channel = gcvNULL; | ||
179 | |||
180 | TEEC_Operation operation = {0}; | ||
181 | |||
182 | /* Connect to TEE. */ | ||
183 | if (initialized == gcvFALSE) | ||
184 | { | ||
185 | result = TEEC_InitializeContext(NULL, &teecContext); | ||
186 | |||
187 | if (result != TEEC_SUCCESS) { | ||
188 | gcmkONERROR(gcvSTATUS_CHIP_NOT_READY); | ||
189 | } | ||
190 | |||
191 | initialized = gcvTRUE; | ||
192 | } | ||
193 | |||
194 | /* Construct channel. */ | ||
195 | gcmkONERROR( | ||
196 | gckOS_Allocate(Os, gcmSIZEOF(*channel), (gctPOINTER *)&channel)); | ||
197 | |||
198 | gckOS_ZeroMemory(channel, gcmSIZEOF(gcsSecurityChannel)); | ||
199 | |||
200 | channel->os = Os; | ||
201 | |||
202 | gcmkONERROR(gckOS_CreateMutex(Os, &channel->mutex)); | ||
203 | |||
204 | /* Allocate shared memory for passing gcTA_INTERFACE. */ | ||
205 | channel->bytes = gcmSIZEOF(gcsTA_INTERFACE); | ||
206 | channel->virtual = kmalloc(channel->bytes, GFP_KERNEL | __GFP_NOWARN); | ||
207 | |||
208 | if (!channel->virtual) | ||
209 | { | ||
210 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
211 | } | ||
212 | |||
213 | channel->inputBuffer.size = channel->bytes; | ||
214 | channel->inputBuffer.flags = TEEC_MEM_INPUT | TEEC_MEM_OUTPUT; | ||
215 | channel->inputBuffer.phyAddr = (void *)virt_to_phys(channel->virtual); | ||
216 | |||
217 | result = TEEC_RegisterSharedMemory(&teecContext, &channel->inputBuffer); | ||
218 | |||
219 | if (result != TEEC_SUCCESS) | ||
220 | { | ||
221 | gcmkONERROR(gcvSTATUS_OUT_OF_RESOURCES); | ||
222 | } | ||
223 | |||
224 | operation.paramTypes = TEEC_PARAM_TYPES( | ||
225 | TEEC_VALUE_INPUT, | ||
226 | TEEC_NONE, | ||
227 | TEEC_NONE, | ||
228 | TEEC_NONE); | ||
229 | |||
230 | operation.params[0].value.a = GPU; | ||
231 | |||
232 | /* Open session with TEE application. */ | ||
233 | result = TEEC_OpenSession( | ||
234 | &teecContext, | ||
235 | &channel->session, | ||
236 | &gpu3d_uuid, | ||
237 | TEEC_LOGIN_USER, | ||
238 | NULL, | ||
239 | &operation, | ||
240 | NULL); | ||
241 | |||
242 | /* Prepare callback. */ | ||
243 | TEEC_RegisterCallback(&channel->session, gpu3d_session_callback, channel); | ||
244 | |||
245 | *Channel = (gctUINT32)channel; | ||
246 | |||
247 | return gcvSTATUS_OK; | ||
248 | |||
249 | OnError: | ||
250 | if (channel) | ||
251 | { | ||
252 | if (channel->virtual) | ||
253 | { | ||
254 | } | ||
255 | |||
256 | if (channel->mutex) | ||
257 | { | ||
258 | gcmkVERIFY_OK(gckOS_DeleteMutex(Os, channel->mutex)); | ||
259 | } | ||
260 | |||
261 | gcmkVERIFY_OK(gckOS_Free(Os, channel)); | ||
262 | } | ||
263 | |||
264 | return status; | ||
265 | } | ||
266 | |||
267 | gceSTATUS | ||
268 | gckOS_CloseSecurityChannel( | ||
269 | IN gctUINT32 Channel | ||
270 | ) | ||
271 | { | ||
272 | /* TODO . */ | ||
273 | return gcvSTATUS_OK; | ||
274 | } | ||
275 | |||
276 | gceSTATUS | ||
277 | gckOS_CallSecurityService( | ||
278 | IN gctUINT32 Channel, | ||
279 | IN gcsTA_INTERFACE *Interface | ||
280 | ) | ||
281 | { | ||
282 | gceSTATUS status; | ||
283 | TEEC_Result result; | ||
284 | gcsSecurityChannel *channel = (gcsSecurityChannel *)Channel; | ||
285 | TEEC_Operation operation = {0}; | ||
286 | |||
287 | gcmkHEADER(); | ||
288 | gcmkVERIFY_ARGUMENT(Channel != 0); | ||
289 | |||
290 | gckOS_AcquireMutex(channel->os, channel->mutex, gcvINFINITE); | ||
291 | |||
292 | gckOS_MemCopy(channel->virtual, Interface, channel->bytes); | ||
293 | |||
294 | operation.paramTypes = TEEC_PARAM_TYPES( | ||
295 | TEEC_MEMREF_PARTIAL_INPUT, | ||
296 | TEEC_NONE, | ||
297 | TEEC_NONE, | ||
298 | TEEC_NONE); | ||
299 | |||
300 | /* Note: we use the updated size in the MemRef output by the encryption. */ | ||
301 | operation.params[0].memref.parent = &channel->inputBuffer; | ||
302 | operation.params[0].memref.offset = 0; | ||
303 | operation.params[0].memref.size = sizeof(gcsTA_INTERFACE); | ||
304 | operation.started = true; | ||
305 | |||
306 | /* Start the commit command within the TEE application. */ | ||
307 | result = TEEC_InvokeCommand( | ||
308 | &channel->session, | ||
309 | gcvTA_COMMAND_DISPATCH, | ||
310 | &operation, | ||
311 | NULL); | ||
312 | |||
313 | gckOS_MemCopy(Interface, channel->virtual, channel->bytes); | ||
314 | |||
315 | gckOS_ReleaseMutex(channel->os, channel->mutex); | ||
316 | |||
317 | if (result != TEEC_SUCCESS) | ||
318 | { | ||
319 | gcmkONERROR(gcvSTATUS_GENERIC_IO); | ||
320 | } | ||
321 | |||
322 | gcmkFOOTER_NO(); | ||
323 | return gcvSTATUS_OK; | ||
324 | |||
325 | OnError: | ||
326 | gcmkFOOTER(); | ||
327 | return status; | ||
328 | } | ||
329 | |||
330 | gceSTATUS | ||
331 | gckOS_InitSecurityChannel( | ||
332 | IN gctUINT32 Channel | ||
333 | ) | ||
334 | { | ||
335 | gceSTATUS status; | ||
336 | TEEC_Result result; | ||
337 | gcsSecurityChannel *channel = (gcsSecurityChannel *)Channel; | ||
338 | TEEC_Operation operation = {0}; | ||
339 | |||
340 | gcmkHEADER(); | ||
341 | gcmkVERIFY_ARGUMENT(Channel != 0); | ||
342 | |||
343 | operation.paramTypes = TEEC_PARAM_TYPES( | ||
344 | TEEC_MEMREF_PARTIAL_INPUT, | ||
345 | TEEC_NONE, | ||
346 | TEEC_NONE, | ||
347 | TEEC_NONE); | ||
348 | |||
349 | /* Note: we use the updated size in the MemRef output by the encryption. */ | ||
350 | operation.params[0].memref.parent = &channel->inputBuffer; | ||
351 | operation.params[0].memref.offset = 0; | ||
352 | operation.params[0].memref.size = gcmSIZEOF(gcsTA_INTERFACE); | ||
353 | operation.started = true; | ||
354 | |||
355 | /* Start the commit command within the TEE application. */ | ||
356 | result = TEEC_InvokeCommand( | ||
357 | &channel->session, | ||
358 | gcvTA_COMMAND_INIT, | ||
359 | &operation, | ||
360 | NULL); | ||
361 | |||
362 | if (result != TEEC_SUCCESS) | ||
363 | { | ||
364 | gcmkONERROR(gcvSTATUS_GENERIC_IO); | ||
365 | } | ||
366 | |||
367 | gcmkFOOTER_NO(); | ||
368 | return gcvSTATUS_OK; | ||
369 | |||
370 | OnError: | ||
371 | gcmkFOOTER(); | ||
372 | return status; | ||
373 | } | ||
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_sync.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_sync.c index 54bd8f195dfa..86511e78542b 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_sync.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_sync.c | |||
@@ -20,6 +20,11 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | #include <gc_hal.h> | ||
24 | #include <gc_hal_base.h> | ||
25 | |||
26 | #if gcdANDROID_NATIVE_FENCE_SYNC | ||
27 | |||
23 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
24 | #include <linux/file.h> | 29 | #include <linux/file.h> |
25 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
@@ -30,8 +35,6 @@ | |||
30 | 35 | ||
31 | #include "gc_hal_kernel_sync.h" | 36 | #include "gc_hal_kernel_sync.h" |
32 | 37 | ||
33 | #if gcdANDROID_NATIVE_FENCE_SYNC | ||
34 | |||
35 | static struct sync_pt * | 38 | static struct sync_pt * |
36 | viv_sync_pt_dup( | 39 | viv_sync_pt_dup( |
37 | struct sync_pt * sync_pt | 40 | struct sync_pt * sync_pt |