@@ -369,7 +369,7 @@ void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
369
369
case XE_GPU_REG_DC_LUT_SEQ_COLOR: {
370
370
// Should be in the 256-entry table writing mode.
371
371
assert_zero (regs[XE_GPU_REG_DC_LUT_RW_MODE] & 0b1 );
372
- auto & gamma_ramp_rw_index = regs.Get <reg::DC_LUT_RW_INDEX>();
372
+ auto gamma_ramp_rw_index = regs.Get <reg::DC_LUT_RW_INDEX>();
373
373
// DC_LUT_SEQ_COLOR is in the red, green, blue order, but the write
374
374
// enable mask is blue, green, red.
375
375
bool write_gamma_ramp_component =
@@ -395,7 +395,11 @@ void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
395
395
}
396
396
if (++gamma_ramp_rw_component_ >= 3 ) {
397
397
gamma_ramp_rw_component_ = 0 ;
398
- ++gamma_ramp_rw_index.rw_index ;
398
+ reg::DC_LUT_RW_INDEX new_gamma_ramp_rw_index = gamma_ramp_rw_index;
399
+ ++new_gamma_ramp_rw_index.rw_index ;
400
+ WriteRegister (
401
+ XE_GPU_REG_DC_LUT_RW_INDEX,
402
+ xe::memory::Reinterpret<uint32_t >(new_gamma_ramp_rw_index));
399
403
}
400
404
if (write_gamma_ramp_component) {
401
405
OnGammaRamp256EntryTableValueWritten ();
@@ -405,7 +409,7 @@ void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
405
409
case XE_GPU_REG_DC_LUT_PWL_DATA: {
406
410
// Should be in the PWL writing mode.
407
411
assert_not_zero (regs[XE_GPU_REG_DC_LUT_RW_MODE] & 0b1 );
408
- auto & gamma_ramp_rw_index = regs.Get <reg::DC_LUT_RW_INDEX>();
412
+ auto gamma_ramp_rw_index = regs.Get <reg::DC_LUT_RW_INDEX>();
409
413
// Bit 7 of the index is ignored for PWL.
410
414
uint32_t gamma_ramp_rw_index_pwl = gamma_ramp_rw_index.rw_index & 0x7F ;
411
415
// DC_LUT_PWL_DATA is likely in the red, green, blue order because
@@ -424,13 +428,17 @@ void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
424
428
}
425
429
if (++gamma_ramp_rw_component_ >= 3 ) {
426
430
gamma_ramp_rw_component_ = 0 ;
431
+ reg::DC_LUT_RW_INDEX new_gamma_ramp_rw_index = gamma_ramp_rw_index;
427
432
// TODO(Triang3l): Should this increase beyond 7 bits for PWL?
428
433
// Direct3D 9 explicitly sets rw_index to 0x80 after writing the last
429
434
// PWL entry. However, the DC_LUT_RW_INDEX documentation says that for
430
435
// PWL, the bit 7 is ignored.
431
- gamma_ramp_rw_index .rw_index =
436
+ new_gamma_ramp_rw_index .rw_index =
432
437
(gamma_ramp_rw_index.rw_index & ~UINT32_C (0x7F )) |
433
438
((gamma_ramp_rw_index_pwl + 1 ) & 0x7F );
439
+ WriteRegister (
440
+ XE_GPU_REG_DC_LUT_RW_INDEX,
441
+ xe::memory::Reinterpret<uint32_t >(new_gamma_ramp_rw_index));
434
442
}
435
443
if (write_gamma_ramp_component) {
436
444
OnGammaRampPWLValueWritten ();
@@ -440,7 +448,7 @@ void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
440
448
case XE_GPU_REG_DC_LUT_30_COLOR: {
441
449
// Should be in the 256-entry table writing mode.
442
450
assert_zero (regs[XE_GPU_REG_DC_LUT_RW_MODE] & 0b1 );
443
- auto & gamma_ramp_rw_index = regs.Get <reg::DC_LUT_RW_INDEX>();
451
+ auto gamma_ramp_rw_index = regs.Get <reg::DC_LUT_RW_INDEX>();
444
452
uint32_t gamma_ramp_write_enable_mask =
445
453
regs[XE_GPU_REG_DC_LUT_WRITE_EN_MASK] & 0b111 ;
446
454
if (gamma_ramp_write_enable_mask) {
@@ -457,11 +465,16 @@ void CommandProcessor::WriteRegister(uint32_t index, uint32_t value) {
457
465
gamma_ramp_entry.color_10_red = gamma_ramp_value.color_10_red ;
458
466
}
459
467
}
460
- ++gamma_ramp_rw_index.rw_index ;
461
468
// TODO(Triang3l): Should this reset the component write index? If this
462
469
// increase is assumed to behave like a full DC_LUT_RW_INDEX write, it
463
- // probably should.
470
+ // probably should. Currently this also calls WriteRegister for
471
+ // DC_LUT_RW_INDEX, which resets gamma_ramp_rw_component_ as well.
464
472
gamma_ramp_rw_component_ = 0 ;
473
+ reg::DC_LUT_RW_INDEX new_gamma_ramp_rw_index = gamma_ramp_rw_index;
474
+ ++new_gamma_ramp_rw_index.rw_index ;
475
+ WriteRegister (
476
+ XE_GPU_REG_DC_LUT_RW_INDEX,
477
+ xe::memory::Reinterpret<uint32_t >(new_gamma_ramp_rw_index));
465
478
if (gamma_ramp_write_enable_mask) {
466
479
OnGammaRamp256EntryTableValueWritten ();
467
480
}
0 commit comments